Skip to content

Commit 08778f9

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
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>
1 parent ad5ee10 commit 08778f9

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

pkg/analyzer/lib/src/error/inheritance_override.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class _ClassVerifier {
231231
// diagnostic should be reported on the name of the mixin defining the
232232
// method. In other cases, it should be reported on the name of the
233233
// overriding method. The classNameNode is always wrong.
234+
concreteElement = library.toLegacyElementIfOptOut(concreteElement);
234235
CorrectOverrideHelper(
235236
typeSystem: typeSystem,
236237
thisMember: concreteElement,

pkg/analyzer/test/src/diagnostics/invalid_override_test.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,23 @@ class InvalidOverrideWithNnbdTest extends DriverResolutionTest {
505505
@override
506506
bool get typeToStringWithNullability => true;
507507

508+
test_method_parameter_interfaceOptOut_concreteOptIn() async {
509+
newFile('/test/lib/a.dart', content: r'''
510+
class A {
511+
void foo(Object a) {}
512+
}
513+
''');
514+
515+
await assertNoErrorsInCode('''
516+
// @dart=2.6
517+
import 'a.dart';
518+
519+
class B extends A {
520+
void foo(dynamic a);
521+
}
522+
''');
523+
}
524+
508525
test_method_viaLegacy_returnType_notSubtype() async {
509526
newFile('/test/lib/a.dart', content: r'''
510527
class Nullable {

0 commit comments

Comments
 (0)