Translate errors for conflicting members.
This fixed language_2/bad_override_test/05
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: I6f6b860bba40f2f6a4ce8804635d95a3828cf64f
Reviewed-on: https://dart-review.googlesource.com/64646
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 5bc0f10..9975d1f 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -82,6 +82,8 @@
CompileTimeErrorCode.CONFLICTING_GENERIC_INTERFACES,
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS,
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER,
+ CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR,
+ CompileTimeErrorCode.CONFLICTS_WITH_MEMBER,
CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD,
@@ -108,6 +110,7 @@
CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
+ CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED,
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER,
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS,
CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR,
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 832b4fa..af873a8 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -449,6 +449,12 @@
"this class.",
correction: "Try renaming either the type variable or the member.");
+ static const CompileTimeErrorCode CONFLICTS_WITH_CONSTRUCTOR =
+ const CompileTimeErrorCode.fromFasta('CONFLICTS_WITH_CONSTRUCTOR');
+
+ static const CompileTimeErrorCode CONFLICTS_WITH_MEMBER =
+ const CompileTimeErrorCode.fromFasta('CONFLICTS_WITH_MEMBER');
+
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
@@ -771,6 +777,10 @@
"The class '{0}' doesn't have a default constant constructor.",
correction: "Try calling a different contructor.");
+ static const CompileTimeErrorCode DECLARED_MEMBER_CONFLICTS_WITH_INHERITED =
+ const CompileTimeErrorCode.fromFasta(
+ 'DECLARED_MEMBER_CONFLICTS_WITH_INHERITED');
+
/**
* 15.3.1 Typedef: It is a compile-time error if any default values are
* specified in the signature of a function type alias.
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
index 18716d6..61c6acf 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
@@ -114,27 +114,6 @@
@override
@failingTest
- test_conflictingConstructorNameAndMember_field() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, found 0
- await super.test_conflictingConstructorNameAndMember_field();
- }
-
- @override
- @failingTest
- test_conflictingConstructorNameAndMember_getter() async {
- // Bad state: No type information for 42 at 25
- await super.test_conflictingConstructorNameAndMember_getter();
- }
-
- @override
- @failingTest
- test_conflictingConstructorNameAndMember_method() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, found 0
- await super.test_conflictingConstructorNameAndMember_method();
- }
-
- @override
- @failingTest
test_conflictingGenericInterfaces_hierarchyLoop() =>
super.test_conflictingGenericInterfaces_hierarchyLoop();
@@ -150,69 +129,7 @@
@override
@failingTest
- test_conflictingGetterAndMethod_field_method() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD, found 0
- await super.test_conflictingGetterAndMethod_field_method();
- }
-
- @override
- @failingTest
- test_conflictingGetterAndMethod_getter_method() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD, found 0
- await super.test_conflictingGetterAndMethod_getter_method();
- }
-
- @override
- @failingTest
- test_conflictingGetterAndMethod_method_field() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER, found 0
- await super.test_conflictingGetterAndMethod_method_field();
- }
-
- @override
- @failingTest
- test_conflictingGetterAndMethod_method_getter() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER, found 0
- await super.test_conflictingGetterAndMethod_method_getter();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndClass() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS, found 0
- await super.test_conflictingTypeVariableAndClass();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndMember_field() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
- await super.test_conflictingTypeVariableAndMember_field();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndMember_getter() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
- await super.test_conflictingTypeVariableAndMember_getter();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndMember_method() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
- await super.test_conflictingTypeVariableAndMember_method();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndMember_method_static() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
- await super.test_conflictingTypeVariableAndMember_method_static();
- }
-
- @override
- @failingTest
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/33827')
test_conflictingTypeVariableAndMember_setter() async {
// Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
await super.test_conflictingTypeVariableAndMember_setter();
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 4ff4fc3..474e0eb 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -731,7 +731,13 @@
}''');
await computeAnalysisResult(source);
assertErrors(
- source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
+ source,
+ useCFE
+ ? [
+ CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR,
+ CompileTimeErrorCode.CONFLICTS_WITH_MEMBER
+ ]
+ : [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
verify([source]);
}
@@ -743,7 +749,13 @@
}''');
await computeAnalysisResult(source);
assertErrors(
- source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
+ source,
+ useCFE
+ ? [
+ CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR,
+ CompileTimeErrorCode.CONFLICTS_WITH_MEMBER
+ ]
+ : [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
verify([source]);
}
@@ -755,7 +767,13 @@
}''');
await computeAnalysisResult(source);
assertErrors(
- source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]);
+ source,
+ useCFE
+ ? [
+ CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR,
+ CompileTimeErrorCode.CONFLICTS_WITH_MEMBER
+ ]
+ : [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]);
verify([source]);
}
@@ -818,7 +836,11 @@
m() {}
}''');
await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED]
+ : [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
verify([source]);
}
@@ -831,7 +853,11 @@
m() {}
}''');
await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED]
+ : [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
verify([source]);
}
@@ -844,7 +870,11 @@
int m;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED]
+ : [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
verify([source]);
}
@@ -857,7 +887,11 @@
get m => 0;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED]
+ : [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
verify([source]);
}
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index 4051879..d97c8f6 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -692,6 +692,8 @@
const Code<Message Function(String name)> codeConflictsWithConstructor =
const Code<Message Function(String name)>(
"ConflictsWithConstructor", templateConflictsWithConstructor,
+ analyzerCode: "CONFLICTS_WITH_CONSTRUCTOR",
+ dart2jsCode: "*fatal*",
severity: Severity.error);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -730,6 +732,8 @@
const Code<Message Function(String name)> codeConflictsWithMember =
const Code<Message Function(String name)>(
"ConflictsWithMember", templateConflictsWithMember,
+ analyzerCode: "CONFLICTS_WITH_MEMBER",
+ dart2jsCode: "*fatal*",
severity: Severity.error);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -809,6 +813,8 @@
const Code<Message Function(String name)> codeConflictsWithTypeVariable =
const Code<Message Function(String name)>(
"ConflictsWithTypeVariable", templateConflictsWithTypeVariable,
+ analyzerCode: "CONFLICTING_TYPE_VARIABLE_AND_MEMBER",
+ dart2jsCode: "*fatal*",
severity: Severity.error);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -1552,6 +1558,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageDeclaredMemberConflictsWithInheritedMember =
const MessageCode("DeclaredMemberConflictsWithInheritedMember",
+ analyzerCode: "DECLARED_MEMBER_CONFLICTS_WITH_INHERITED",
+ dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning,
message:
r"""Can't declare a member that conflicts with an inherited one.""");
@@ -6392,6 +6400,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageTypeVariableSameNameAsEnclosing = const MessageCode(
"TypeVariableSameNameAsEnclosing",
+ analyzerCode: "CONFLICTING_TYPE_VARIABLE_AND_CLASS",
+ dart2jsCode: "*fatal*",
message:
r"""A type variable can't have the same name as its enclosing declaration.""");
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 64ec59f..9ea8d23 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -39,11 +39,9 @@
CantUseSuperBoundedTypeForInstanceCreation/analyzerCode: Fail
CantUseSuperBoundedTypeForInstanceCreation/example: Fail
ColonInPlaceOfIn/example: Fail
-ConflictsWithConstructor/analyzerCode: Fail
ConflictsWithConstructor/example: Fail
ConflictsWithFactory/analyzerCode: Fail
ConflictsWithFactory/example: Fail
-ConflictsWithMember/analyzerCode: Fail
ConflictsWithMember/example: Fail
ConflictsWithMemberWarning/analyzerCode: Fail
ConflictsWithMemberWarning/example: Fail
@@ -51,7 +49,6 @@
ConflictsWithSetter/example: Fail
ConflictsWithSetterWarning/analyzerCode: Fail
ConflictsWithSetterWarning/example: Fail
-ConflictsWithTypeVariable/analyzerCode: Fail
ConflictsWithTypeVariable/example: Fail
ConstAfterFactory/script1: Fail
ConstAndCovariant/script2: Fail
@@ -99,7 +96,6 @@
CyclicClassHierarchy/analyzerCode: Fail
CyclicClassHierarchy/example: Fail
CyclicTypedef/example: Fail
-DeclaredMemberConflictsWithInheritedMember/analyzerCode: Fail
DeferredAfterPrefix/example: Fail
DeferredPrefixDuplicated/example: Fail
DeferredTypeAnnotation/example: Fail
@@ -354,7 +350,6 @@
TypeNotFound/example: Fail
TypeVariableDuplicatedName/example: Fail
TypeVariableInStaticContext/example: Fail
-TypeVariableSameNameAsEnclosing/analyzerCode: Fail
TypeVariableSameNameAsEnclosing/example: Fail
TypedefNotFunction/example: Fail
UnexpectedDollarInString/script1: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index b57020e..b2e60aa 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -1528,6 +1528,8 @@
ConflictsWithConstructor:
template: "Conflicts with constructor '#name'."
severity: ERROR
+ analyzerCode: CONFLICTS_WITH_CONSTRUCTOR
+ dart2jsCode: "*fatal*"
ConflictsWithFactory:
template: "Conflicts with factory '#name'."
@@ -1536,6 +1538,8 @@
ConflictsWithMember:
template: "Conflicts with member '#name'."
severity: ERROR
+ analyzerCode: CONFLICTS_WITH_MEMBER
+ dart2jsCode: "*fatal*"
ConflictsWithMemberWarning:
template: "Conflicts with member '#name'."
@@ -1552,6 +1556,8 @@
ConflictsWithTypeVariable:
template: "Conflicts with type variable '#name'."
severity: ERROR
+ analyzerCode: CONFLICTING_TYPE_VARIABLE_AND_MEMBER
+ dart2jsCode: "*fatal*"
ConflictsWithTypeVariableCause:
template: "This is the type variable."
@@ -1560,6 +1566,8 @@
DeclaredMemberConflictsWithInheritedMember:
template: "Can't declare a member that conflicts with an inherited one."
severity: ERROR_LEGACY_WARNING
+ analyzerCode: DECLARED_MEMBER_CONFLICTS_WITH_INHERITED
+ dart2jsCode: "*fatal*"
script:
- >-
class A {
@@ -1695,6 +1703,8 @@
TypeVariableSameNameAsEnclosing:
template: "A type variable can't have the same name as its enclosing declaration."
+ analyzerCode: CONFLICTING_TYPE_VARIABLE_AND_CLASS
+ dart2jsCode: "*fatal*"
ExpectedEnumBody:
template: "Expected a enum body, but got '#lexeme'."