Skip to content

Commit

Permalink
Version 2.15.0-119.0.dev
Browse files Browse the repository at this point in the history
Merge commit 'af18bfacc153dc23528a64fedcc849daac6a26f2' into 'dev'
  • Loading branch information
Dart CI committed Sep 17, 2021
2 parents 1874cf4 + af18bfa commit 70186de
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 34 deletions.
Expand Up @@ -1805,7 +1805,7 @@ const Code<Null> codeConstructorWithTypeArguments =
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageConstructorWithTypeArguments = const MessageCode(
"ConstructorWithTypeArguments",
analyzerCodes: <String>["WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR"],
index: 118,
message:
r"""A constructor invocation can't have type arguments after the constructor name.""",
tip:
Expand Down
1 change: 1 addition & 0 deletions pkg/analyzer/lib/error/error.dart
Expand Up @@ -685,6 +685,7 @@ const List<ErrorCode> errorCodeValues = [
ParserErrorCode.CONST_METHOD,
ParserErrorCode.CONST_TYPEDEF,
ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE,
ParserErrorCode.CONSTRUCTOR_WITH_TYPE_ARGUMENTS,
ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP,
ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE,
ParserErrorCode.COVARIANT_AND_STATIC,
Expand Down
3 changes: 3 additions & 0 deletions pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
Expand Up @@ -114,6 +114,9 @@ class ParserErrorCode extends ErrorCode {
static const ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE =
_CONSTRUCTOR_WITH_RETURN_TYPE;

static const ParserErrorCode CONSTRUCTOR_WITH_TYPE_ARGUMENTS =
_CONSTRUCTOR_WITH_TYPE_ARGUMENTS;

static const ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP =
_CONTINUE_OUTSIDE_OF_LOOP;

Expand Down
7 changes: 7 additions & 0 deletions pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
Expand Up @@ -125,6 +125,7 @@ final fastaAnalyzerErrorCodes = <ErrorCode?>[
_LITERAL_WITH_CLASS_AND_NEW,
_LITERAL_WITH_CLASS,
_LITERAL_WITH_NEW,
_CONSTRUCTOR_WITH_TYPE_ARGUMENTS,
];

const ParserErrorCode _ABSTRACT_CLASS_MEMBER = ParserErrorCode(
Expand Down Expand Up @@ -196,6 +197,12 @@ const ParserErrorCode _CONSTRUCTOR_WITH_RETURN_TYPE = ParserErrorCode(
'CONSTRUCTOR_WITH_RETURN_TYPE', r"Constructors can't have a return type.",
correction: "Try removing the return type.");

const ParserErrorCode _CONSTRUCTOR_WITH_TYPE_ARGUMENTS = ParserErrorCode(
'CONSTRUCTOR_WITH_TYPE_ARGUMENTS',
r"A constructor invocation can't have type arguments after the constructor name.",
correction:
"Try removing the type arguments or placing them after the class name.");

const ParserErrorCode _CONST_AND_FINAL = ParserErrorCode('CONST_AND_FINAL',
r"Members can't be declared to be both 'const' and 'final'.",
correction: "Try removing either the 'const' or 'final' keyword.");
Expand Down
7 changes: 0 additions & 7 deletions pkg/analyzer/lib/src/fasta/error_converter.dart
Expand Up @@ -317,13 +317,6 @@ class FastaErrorReporter {
offset,
length);
return;
case "WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR":
errorReporter?.reportErrorMessage(
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
offset,
length,
message);
return;
case "WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER":
errorReporter?.reportErrorForOffset(
ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER,
Expand Down
4 changes: 1 addition & 3 deletions pkg/analyzer/test/generated/expression_parser_test.dart
Expand Up @@ -10,7 +10,6 @@ import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/src/dart/ast/ast.dart'
show InstanceCreationExpressionImpl;
import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/testing/token_factory.dart';
import 'package:pub_semver/src/version.dart';
import 'package:test/test.dart';
Expand Down Expand Up @@ -1159,8 +1158,7 @@ class ExpressionParserTest extends FastaParserTestCase {

void test_parseInstanceCreationExpression_type_named_typeArguments_34403() {
var expression = parseExpression('new a.b.c<C>()', errors: [
expectedError(
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR, 8, 1)
expectedError(ParserErrorCode.CONSTRUCTOR_WITH_TYPE_ARGUMENTS, 8, 1)
]) as InstanceCreationExpressionImpl;
expect(expression, isNotNull);
expect(expression.keyword!.keyword, Keyword.NEW);
Expand Down
4 changes: 1 addition & 3 deletions pkg/analyzer/test/generated/statement_parser_test.dart
Expand Up @@ -6,7 +6,6 @@ import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart' as analyzer;
import 'package:analyzer/dart/ast/token.dart' show TokenType;
import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

Expand Down Expand Up @@ -995,8 +994,7 @@ main() {

void test_parseNonLabeledStatement_const_object_named_typeParameters_34403() {
var statement = parseStatement('const A<B>.c<C>();') as ExpressionStatement;
assertErrorsWithCodes(
[CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR]);
assertErrorsWithCodes([ParserErrorCode.CONSTRUCTOR_WITH_TYPE_ARGUMENTS]);
expect(statement.expression, isNotNull);
}

Expand Down
Expand Up @@ -201,8 +201,7 @@ main() {
new p.Foo.bar<int>();
}
''', [
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR, 44,
3),
error(ParserErrorCode.CONSTRUCTOR_WITH_TYPE_ARGUMENTS, 44, 3),
]);

// TODO(brianwilkerson) Test this more carefully after we can re-write the
Expand Down
3 changes: 2 additions & 1 deletion pkg/front_end/messages.yaml
Expand Up @@ -1630,7 +1630,8 @@ ConstructorWithTypeParameters:
ConstructorWithTypeArguments:
template: "A constructor invocation can't have type arguments after the constructor name."
tip: "Try removing the type arguments or placing them after the class name."
analyzerCode: WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
analyzerCode: ParserErrorCode.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
index: 118
script:
- "class C<X> { C.foo(); } bar() { new C.foo<int>(); }"
- "class C<X> { C.foo(); } bar() { C.foo<int>(); }"
Expand Down
12 changes: 6 additions & 6 deletions tests/language/constructor/named_constructor_test.dart
Expand Up @@ -29,7 +29,7 @@ void main() {
// 'Class<int>.named<int>' doesn't fit the grammar syntax T.id:
new Class<int>.named<int>().value;
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.

new prefix.Class().value;
Expand All @@ -45,7 +45,7 @@ void main() {
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'prefix.Class'.

Expand All @@ -65,15 +65,15 @@ void main() {
// 'prefix.Class.named<int>' doesn't fit the grammar syntax T.id:
new prefix.Class.named<int>().value;
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.

// 'prefix<int>.Class<int>' doesn't fit the grammar syntax T.id:
new prefix<int>.Class<int>.named().value;
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'prefix.Class'.

Expand All @@ -91,15 +91,15 @@ void main() {
// 'prefix.Class<int>.named<int>' doesn't fit the grammar syntax T.id:
new prefix.Class<int>.named<int>().value;
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.

// 'prefix<int>.Class<int>.named<int>' doesn't fit the grammar syntax T.id:
new prefix<int>.Class<int>.named<int>().value;
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'prefix.Class'.
}
4 changes: 2 additions & 2 deletions tests/language/constructor/reference_test.dart
Expand Up @@ -39,7 +39,7 @@ main() {
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'Foo.bar.baz'.

Expand Down Expand Up @@ -73,7 +73,7 @@ main() {
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'Foo.bar.baz'.

Expand Down
12 changes: 6 additions & 6 deletions tests/language_2/constructor/named_constructor_test.dart
Expand Up @@ -31,7 +31,7 @@ void main() {
// 'Class<int>.named<int>' doesn't fit the grammar syntax T.id:
new Class<int>.named<int>().value;
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.

new prefix.Class().value;
Expand All @@ -47,7 +47,7 @@ void main() {
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'prefix.Class'.

Expand All @@ -67,15 +67,15 @@ void main() {
// 'prefix.Class.named<int>' doesn't fit the grammar syntax T.id:
new prefix.Class.named<int>().value;
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.

// 'prefix<int>.Class<int>' doesn't fit the grammar syntax T.id:
new prefix<int>.Class<int>.named().value;
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'prefix.Class'.

Expand All @@ -93,15 +93,15 @@ void main() {
// 'prefix.Class<int>.named<int>' doesn't fit the grammar syntax T.id:
new prefix.Class<int>.named<int>().value;
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.

// 'prefix<int>.Class<int>.named<int>' doesn't fit the grammar syntax T.id:
new prefix<int>.Class<int>.named<int>().value;
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'prefix.Class'.
}
4 changes: 2 additions & 2 deletions tests/language_2/constructor/reference_test.dart
Expand Up @@ -41,7 +41,7 @@ main() {
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'Foo.bar.baz'.

Expand Down Expand Up @@ -75,7 +75,7 @@ main() {
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
// ^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// [cfe] Couldn't find constructor 'Foo.bar.baz'.

Expand Down
2 changes: 1 addition & 1 deletion tools/VERSION
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 2
MINOR 15
PATCH 0
PRERELEASE 118
PRERELEASE 119
PRERELEASE_PATCH 0

0 comments on commit 70186de

Please sign in to comment.