Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Unified Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 1709013004: Improve error message (issue 25113) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index b673ec4c986b9784261c2358c8f33abbfe7e24dc..710be9b836ef5c5038ab7409b5f95b6b923ec6ed 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -1510,27 +1510,6 @@ class Foo {
reason: 'parser recovers what it can');
}
- void test_method_invalidTypeParameters() {
- // TODO(jmesserly): ideally we'd be better at parser recovery here.
- // It doesn't try to advance past the invalid token `!` to find the
- // valid `>`. If it did we'd get less cascading errors, at least for this
- // particular example.
- enableGenericMethods = true;
- MethodDeclaration method = parse3(
- "parseClassMember",
- <Object>["C"],
- "void m<E, hello!>() {}",
- [
- ParserErrorCode.EXPECTED_TOKEN /*>*/,
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN /*(*/,
- ParserErrorCode.EXPECTED_TOKEN /*)*/,
- ParserErrorCode.MISSING_FUNCTION_BODY
- ]);
- expect(method.typeParameters.toString(), '<E, hello>',
- reason: 'parser recovers what it can');
- }
-
void test_method_invalidTypeParameterExtends() {
// Regression test for https://github.com/dart-lang/sdk/issues/25739.
@@ -1550,7 +1529,6 @@ class Foo {
reason: 'parser recovers what it can');
}
-
void test_method_invalidTypeParameterExtendsComment() {
// Regression test for https://github.com/dart-lang/sdk/issues/25739.
@@ -1575,6 +1553,27 @@ class Foo {
reason: 'parser recovers what it can');
}
+ void test_method_invalidTypeParameters() {
+ // TODO(jmesserly): ideally we'd be better at parser recovery here.
+ // It doesn't try to advance past the invalid token `!` to find the
+ // valid `>`. If it did we'd get less cascading errors, at least for this
+ // particular example.
+ enableGenericMethods = true;
+ MethodDeclaration method = parse3(
+ "parseClassMember",
+ <Object>["C"],
+ "void m<E, hello!>() {}",
+ [
+ ParserErrorCode.EXPECTED_TOKEN /*>*/,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN /*(*/,
+ ParserErrorCode.EXPECTED_TOKEN /*)*/,
+ ParserErrorCode.MISSING_FUNCTION_BODY
+ ]);
+ expect(method.typeParameters.toString(), '<E, hello>',
+ reason: 'parser recovers what it can');
+ }
+
void test_missingAssignableSelector_identifiersAssigned() {
parseExpression("x.y = y;");
}
@@ -1948,6 +1947,16 @@ class Foo {
[ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP]);
}
+ void test_redirectingConstructorWithBody_named() {
+ parse3("parseClassMember", <Object>["C"], "C.x() : this() {}",
+ [ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY]);
+ }
+
+ void test_redirectingConstructorWithBody_unnamed() {
+ parse3("parseClassMember", <Object>["C"], "C() : this.x() {}",
+ [ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY]);
+ }
+
void test_redirectionInNonFactoryConstructor() {
parse3("parseClassMember", <Object>["C"], "C() = D;",
[ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR]);
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698