Ignore noSuchMethod() for the purpose of searching concrete member implementations.
R=brianwilkerson@google.com
Bug: https://github.com/dart-lang/sdk/issues/33553
Change-Id: Ie597cb4d39ba16e4503503b59d1e5179c594bad5
Reviewed-on: https://dart-review.googlesource.com/76200
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index 7207be9..617f5a5 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -1789,11 +1789,6 @@
if (!concrete || acceptAbstract || !result.isAbstract) {
return result;
}
- ClassElementImpl elementImpl =
- AbstractClassElementImpl.getImpl(type.element);
- if (elementImpl.hasNoSuchMethod) {
- return result;
- }
}
}
diff --git a/pkg/analyzer/test/src/dart/resolution/class_test.dart b/pkg/analyzer/test/src/dart/resolution/class_test.dart
index e617b68..02afc12 100644
--- a/pkg/analyzer/test/src/dart/resolution/class_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/class_test.dart
@@ -96,6 +96,33 @@
assertElement(findNode.simple('foo; // ref'), findElement.method('foo'));
}
+ test_abstractSuperMemberReference_noSuchMethod() async {
+ setAnalysisOptions(enableSuperMixins: true);
+ addTestFile('''
+class A {
+ void foo();
+ noSuchMethod(im) {}
+}
+
+abstract class B {
+ void foo();
+ noSuchMethod(im) {}
+}
+
+class C extends A with B {
+ void bar() {
+ super.foo(); // ref
+ }
+}
+''');
+ await resolveTestFile();
+ assertTestErrors([CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
+ assertElement(
+ findNode.simple('foo(); // ref'),
+ findElement.method('foo', of: 'B'),
+ );
+ }
+
test_abstractSuperMemberReference_OK_mixinHasConcrete2_method() async {
addTestFile('''
class A {
@@ -121,33 +148,6 @@
);
}
- test_abstractSuperMemberReference_OK_noSuchMethod() async {
- setAnalysisOptions(enableSuperMixins: true);
- addTestFile('''
-class A {
- void foo();
- noSuchMethod(im) {}
-}
-
-abstract class B {
- void foo();
- noSuchMethod(im) {}
-}
-
-class C extends A with B {
- void bar() {
- super.foo(); // ref
- }
-}
-''');
- await resolveTestFile();
- assertNoTestErrors();
- assertElement(
- findNode.simple('foo(); // ref'),
- findElement.method('foo', of: 'B'),
- );
- }
-
test_abstractSuperMemberReference_OK_superHasConcrete_mixinHasAbstract_method() async {
addTestFile('''
class A {
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 0389ef8..65e2302 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -116,9 +116,9 @@
string_split_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
-super_call4_test/01: MissingCompileTimeError
-super_no_such_method4_test/01: MissingCompileTimeError # Issue 33553
-super_no_such_method5_test/01: MissingCompileTimeError # Issue 33553
+super_no_such_method1_test: CompileTimeError # Invalid test, probably, see https://github.com/dart-lang/sdk/issues/33963
+super_no_such_method2_test: CompileTimeError # Invalid test, probably, see https://github.com/dart-lang/sdk/issues/33963
+super_no_such_method3_test: CompileTimeError # Invalid test, probably, see https://github.com/dart-lang/sdk/issues/33963
super_setter_test: CompileTimeError # Invalid test, see https://github.com/dart-lang/sdk/issues/33837
syntax_test/60: MissingCompileTimeError
syntax_test/61: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index ae94dee..21ac2ad 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -106,15 +106,15 @@
issue34498_test: MissingCompileTimeError # Issue 34500
label_test: RuntimeError
left_shift_test: RuntimeError # Ints and doubles are unified.
-mixin_declaration/mixin_declaration_inference_invalid_03_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
-mixin_declaration/mixin_declaration_inference_invalid_04_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
-mixin_declaration/mixin_declaration_inference_invalid_05_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
-mixin_declaration/mixin_declaration_inference_invalid_06_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
-mixin_declaration/mixin_declaration_inference_invalid_07_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
-mixin_declaration/mixin_declaration_inference_invalid_08_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
-mixin_declaration/mixin_declaration_inference_invalid_09_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
-mixin_declaration/mixin_declaration_inference_invalid_10_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
-mixin_declaration/mixin_declaration_inference_invalid_11_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_03_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_04_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_05_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_06_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_07_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_08_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_09_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_10_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
+mixin_declaration/mixin_declaration_inference_invalid_11_test: MissingCompileTimeError # https://github.com/dart-lang/sdk/issues/34167
mixin_declaration/mixin_declaration_inference_valid_A00_test: CompileTimeError # Issue #34164
mixin_declaration/mixin_declaration_inference_valid_A01_test: CompileTimeError # Issue #34164
mixin_declaration/mixin_declaration_inference_valid_A02_test: CompileTimeError # Issue #34164
@@ -144,8 +144,8 @@
mixin_declaration/mixin_declaration_inference_valid_C11_test: CompileTimeError # Issue #34164
mixin_declaration/mixin_declaration_inference_valid_C12_test: CompileTimeError # Issue #34164
mixin_declaration/mixin_declaration_inference_valid_C13_test: CompileTimeError # Issue #34164
-mixin_declaration/mixin_declaration_inference_valid_mixin_applications_test: CompileTimeError # https://github.com/dart-lang/sdk/issues/34164
-mixin_declaration/mixin_declaration_invalid_superinvocation_test/10: CompileTimeError # Analyzer chooses wrong(?) super method.
+mixin_declaration/mixin_declaration_inference_valid_mixin_applications_test: CompileTimeError # https://github.com/dart-lang/sdk/issues/34164
+mixin_declaration/mixin_declaration_invalid_superinvocation_test/10: CompileTimeError # Analyzer chooses wrong(?) super method.
mixin_method_override_test/01: MissingCompileTimeError # Issue 34235
mixin_super_2_test/01: MissingCompileTimeError
mixin_super_2_test/03: MissingCompileTimeError
@@ -190,9 +190,9 @@
string_split_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
-super_call4_test/01: MissingCompileTimeError
-super_no_such_method4_test/01: MissingCompileTimeError # Requires Dart 2 semantics. See http://dartbug.com/33380.
-super_no_such_method5_test/01: MissingCompileTimeError # Requires Dart 2 semantics. See http://dartbug.com/33380.
+super_no_such_method1_test: CompileTimeError # Invalid test, probably, see https://github.com/dart-lang/sdk/issues/33963
+super_no_such_method2_test: CompileTimeError # Invalid test, probably, see https://github.com/dart-lang/sdk/issues/33963
+super_no_such_method3_test: CompileTimeError # Invalid test, probably, see https://github.com/dart-lang/sdk/issues/33963
super_operator_index5_test: RuntimeError # 33470
super_operator_index7_test: RuntimeError # 33470
super_operator_index8_test: RuntimeError # 33470