In legacy libraries apply LEGACY_ERASURE to concrete members.

This fixes with unforked SDK:
* language_2/abstract/equal_test
* language_2/abstract/object_method_test

Change-Id: I8d183f5a15eef29c590fe56f40e813d56ba6ad54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135359
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2020-02-12 18:12:57 +00:00 committed by commit-bot@chromium.org
parent ad5ee10e69
commit 08778f9045
2 changed files with 18 additions and 0 deletions

View file

@ -231,6 +231,7 @@ class _ClassVerifier {
// diagnostic should be reported on the name of the mixin defining the
// method. In other cases, it should be reported on the name of the
// overriding method. The classNameNode is always wrong.
concreteElement = library.toLegacyElementIfOptOut(concreteElement);
CorrectOverrideHelper(
typeSystem: typeSystem,
thisMember: concreteElement,

View file

@ -505,6 +505,23 @@ class InvalidOverrideWithNnbdTest extends DriverResolutionTest {
@override
bool get typeToStringWithNullability => true;
test_method_parameter_interfaceOptOut_concreteOptIn() async {
newFile('/test/lib/a.dart', content: r'''
class A {
void foo(Object a) {}
}
''');
await assertNoErrorsInCode('''
// @dart=2.6
import 'a.dart';
class B extends A {
void foo(dynamic a);
}
''');
}
test_method_viaLegacy_returnType_notSubtype() async {
newFile('/test/lib/a.dart', content: r'''
class Nullable {