File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,9 @@ pub fn ensure_no_specific_syntax_errors(parsed_source: &ParsedSource) -> Result<
7575 SyntaxError :: ExpectedSemiForExprStmt { .. } |
7676 SyntaxError :: ExpectedUnicodeEscape |
7777 // unexpected token
78- SyntaxError :: Unexpected { .. }
78+ SyntaxError :: Unexpected { .. } |
79+ // Merge conflict marker
80+ SyntaxError :: TS1185
7981 )
8082 } )
8183 . collect :: < Vec < _ > > ( ) ;
@@ -225,6 +227,35 @@ mod tests {
225227 ) ;
226228 }
227229
230+ #[ test]
231+ fn it_should_error_for_merge_conflict_marker ( ) {
232+ run_non_fatal_diagnostic_test (
233+ "./test.ts" ,
234+ r#"class Test {
235+ <<<<<<< HEAD
236+ v = 1;
237+ =======
238+ v = 2;
239+ >>>>>>> Branch-a
240+ }
241+ "# ,
242+ r#"Merge conflict marker encountered. at ./test.ts:2:1
243+
244+ <<<<<<< HEAD
245+ ~~~~~~~
246+
247+ Merge conflict marker encountered. at ./test.ts:4:1
248+
249+ =======
250+ ~~~~~~~
251+
252+ Merge conflict marker encountered. at ./test.ts:6:1
253+
254+ >>>>>>> Branch-a
255+ ~~~~~~~"# ,
256+ ) ;
257+ }
258+
228259 fn run_non_fatal_diagnostic_test ( file_path : & str , text : & str , expected : & str ) {
229260 let file_path = PathBuf :: from ( file_path) ;
230261 assert_eq ! ( format!( "{}" , parse_swc_ast( & file_path, text) . err( ) . unwrap( ) ) , expected) ;
You can’t perform that action at this time.
0 commit comments