Remove the last vestiges of two dead multitest outcomes.

A multitest section marked "dynamic type error" or "checked mode
compile time error" didn't actually do anything. It was silently treated
as "ok", which makes for a very confusing looking test.

Fixed the only remaining four tests that used "dynamic type error".
The other outcome was not used by any test.

Change-Id: I9727b3b524cf1effb0dd899bf206aa65dbd60803
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198180
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
This commit is contained in:
Robert Nystrom 2021-05-05 15:39:45 +00:00 committed by commit-bot@chromium.org
parent 16accc2de8
commit cc1f9b9564
5 changed files with 31 additions and 18 deletions

View file

@ -83,10 +83,7 @@ final _multitestOutcomes = {
'syntax error',
'compile-time error',
'runtime error',
// TODO(rnystrom): Remove these after Dart 1.0 tests are removed.
'static type warning', // This is still a valid analyzer test
'dynamic type error', // This is now a no-op
'checked mode compile-time error' // This is now a no-op
'static type warning', // Used by some analyzer tests.
};
void _generateTestsFromMultitest(Path filePath, Map<String, String> tests,

View file

@ -22,11 +22,11 @@ main() {
lib2.C a1 = new lib2.C(); //# type_annotation_non_deferred: continued
asyncStart();
lib.loadLibrary().then((_) {
lib.C a2 = new lib.C(); //# type_annotation1: dynamic type error, compile-time error
lib.G<F> a3 = new lib.G<F>(); //# type_annotation_generic1: dynamic type error, compile-time error
lib.C a2 = new lib.C(); //# type_annotation1: compile-time error
lib.G<F> a3 = new lib.G<F>(); //# type_annotation_generic1: compile-time error
G2<lib.C> a4 = new G2(); //# type_annotation_generic2: compile-time error
G2<lib.C> a5 = new G2<lib.C>(); //# type_annotation_generic3: compile-time error
lib.G<lib.C> a = new lib.G<lib.C>(); //# type_annotation_generic4: dynamic type error, compile-time error
lib.G<lib.C> a = new lib.G<lib.C>(); //# type_annotation_generic4: compile-time error
var a6 = new lib.C(); //# new: ok
var g1 = new lib.G<F>(); //# new_generic1: ok
// new G2<lib.C>() does not give a dynamic type error because a malformed

View file

@ -6,7 +6,11 @@
class A<T> {
A() {}
factory A.factory() {
return new A<String>(); // //# 00: compile-time error
return new A<String>();
// ^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// ^
// [cfe] A value of type 'A<String>' can't be returned from a function with return type 'A<T>'.
return A<T>();
}
}
@ -14,14 +18,18 @@ class A<T> {
class B<T> extends A<T> {
B() {}
factory B.factory() {
return new B<String>(); // //# 01: compile-time error
return new B<String>();
// ^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// ^
// [cfe] A value of type 'B<String>' can't be returned from a function with return type 'B<T>'.
return B<T>();
}
}
main() {
new A<String>.factory();
new A<int>.factory(); // //# 00: dynamic type error
new A<int>.factory();
new B<String>.factory();
new B<int>.factory(); // //# 01: dynamic type error
new B<int>.factory();
}

View file

@ -24,11 +24,11 @@ main() {
lib2.C a1 = new lib2.C(); //# type_annotation_non_deferred: continued
asyncStart();
lib.loadLibrary().then((_) {
lib.C a2 = new lib.C(); //# type_annotation1: dynamic type error, compile-time error
lib.G<F> a3 = new lib.G<F>(); //# type_annotation_generic1: dynamic type error, compile-time error
lib.C a2 = new lib.C(); //# type_annotation1: compile-time error
lib.G<F> a3 = new lib.G<F>(); //# type_annotation_generic1: compile-time error
G2<lib.C> a4 = new G2(); //# type_annotation_generic2: compile-time error
G2<lib.C> a5 = new G2<lib.C>(); //# type_annotation_generic3: compile-time error
lib.G<lib.C> a = new lib.G<lib.C>(); //# type_annotation_generic4: dynamic type error, compile-time error
lib.G<lib.C> a = new lib.G<lib.C>(); //# type_annotation_generic4: compile-time error
var a6 = new lib.C(); //# new: ok
var g1 = new lib.G<F>(); //# new_generic1: ok
// new G2<lib.C>() does not give a dynamic type error because a malformed

View file

@ -8,20 +8,28 @@
class A<T> {
A() {}
factory A.factory() {
return new A<String>(); // //# 00: compile-time error
return new A<String>();
// ^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// ^
// [cfe] A value of type 'A<String>' can't be assigned to a variable of type 'A<T>'.
}
}
class B<T> extends A<T> {
B() {}
factory B.factory() {
return new B<String>(); // //# 01: compile-time error
return new B<String>();
// ^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// ^
// [cfe] A value of type 'B<String>' can't be assigned to a variable of type 'B<T>'.
}
}
main() {
new A<String>.factory();
new A<int>.factory(); // //# 00: dynamic type error
new A<int>.factory();
new B<String>.factory();
new B<int>.factory(); // //# 01: dynamic type error
new B<int>.factory();
}