Adjust language{,_2}/regress/regress31596_covariant_declaration_test

These tests are updated to match the behavior which was specified in
dart-lang/language#1833. The change is valid for both language_2 and
language because it isn't tied to a language version. This should not
break any existing code because it only changes programs with
compile-time errors into programs with no errors.

(If we agree on this change then I'll approve the failures.)

Change-Id: I49f41fd1b1575c237c9c619c912de3e8de53356f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217016
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This commit is contained in:
Erik Ernst 2021-10-18 15:58:09 +00:00 committed by commit-bot@chromium.org
parent 098d517e9f
commit ace8c34996
2 changed files with 10 additions and 6 deletions

View file

@ -2,6 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test the treatment of a method whose signature has a covariant parameter
// in the interface of a class `C`, when the implementation of that method
// is inherited and its parameter is not covariant.
class I0 {}
class A {}
@ -16,9 +20,7 @@ abstract class I {
void f(covariant A x);
}
// As of dart-lang/language#1833 this is not a compile-time.
class D extends C implements I {}
// ^
// [analyzer] COMPILE_TIME_ERROR.INVALID_IMPLEMENTATION_OVERRIDE
// [cfe] unspecified
main() {}

View file

@ -4,6 +4,10 @@
// @dart = 2.9
// Test the treatment of a method whose signature has a covariant parameter
// in the interface of a class `C`, when the implementation of that method
// is inherited and its parameter is not covariant.
class I0 {}
class A {}
@ -18,9 +22,7 @@ abstract class I {
void f(covariant A x);
}
// As of dart-lang/language#1833 this is not a compile-time error.
class D extends C implements I {}
// ^
// [analyzer] COMPILE_TIME_ERROR.INVALID_IMPLEMENTATION_OVERRIDE
// [cfe] unspecified
main() {}