@@ -3933,13 +3933,26 @@ class Wrong<T> {
39333933 }
39343934
39353935 void test_invalidInterpolation_missingClosingBrace_issue35900() {
3936- parseCompilationUnit(r"main () { print('${x' '); }", errors: [
3937- expectedError(ScannerErrorCode.EXPECTED_TOKEN, 23, 1),
3938- expectedError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 26, 1),
3939- expectedError(ParserErrorCode.EXPECTED_TOKEN, 20, 3),
3940- expectedError(ParserErrorCode.EXPECTED_STRING_LITERAL, 23, 1),
3941- expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 27, 0),
3942- ]);
3936+ parseCompilationUnit(r"main () { print('${x' '); }",
3937+ errors: usingFastaParser
3938+ ? [
3939+ expectedError(ScannerErrorCode.EXPECTED_TOKEN, 23, 1),
3940+ expectedError(
3941+ ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 26, 1),
3942+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 20, 3),
3943+ expectedError(ParserErrorCode.EXPECTED_STRING_LITERAL, 23, 1),
3944+ expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 27, 0),
3945+ ]
3946+ : [
3947+ expectedError(ScannerErrorCode.EXPECTED_TOKEN, 23, 1),
3948+ expectedError(
3949+ ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 26, 1),
3950+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 20, 3),
3951+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 23, 1),
3952+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 23, 1),
3953+ expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 23, 1),
3954+ expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 23, 1),
3955+ ]);
39433956 }
39443957
39453958 void test_invalidInterpolationIdentifier_startWithDigit() {
@@ -5364,6 +5377,20 @@ main() {
53645377 errors: [expectedError(ParserErrorCode.TYPEDEF_IN_CLASS, 10, 7)]);
53655378 }
53665379
5380+ void test_unexpectedCommaThenInterpolation() {
5381+ // https://github.com/Dart-Code/Dart-Code/issues/1548
5382+ parseCompilationUnit(r"main() { String s = 'a' 'b', 'c$foo'; return s; }",
5383+ errors: usingFastaParser
5384+ ? [
5385+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 29, 2),
5386+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 29, 2),
5387+ ]
5388+ : [
5389+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 29, 2),
5390+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 29, 1),
5391+ ]);
5392+ }
5393+
53675394 void test_unexpectedTerminatorForParameterGroup_named() {
53685395 createParser('(a, b})');
53695396 FormalParameterList list = parser.parseFormalParameterList();
0 commit comments