[web-fixit] Don't test covariance checks in production mode

Exit early for dart2jsProductionMode.
Remove multitest markers.

Change-Id: I9ccf1b3495823b8de3965f1c0b177ce4643c84f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338587
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
This commit is contained in:
Stephen Adams 2023-11-29 21:19:49 +00:00 committed by Commit Queue
parent c8b18439d4
commit 5a2ef55808
2 changed files with 17 additions and 11 deletions

View file

@ -37,22 +37,25 @@ class C extends B<A> {
}
main() {
// Covariance checks are omitted in dart2js production mode.
if (dart2jsProductionMode) return;
// Dynamic method calls should always have their arguments type checked.
dynamic d = new C();
Expect.throwsTypeError(() => d.s1 = new Object()); //# 01: ok
Expect.throwsTypeError(() => d.s1 = new Object());
// Interface calls should have any arguments marked "genericCovariantImpl"
// type checked provided that the corresponding argument on the interface
// target is marked "genericCovariantInterface".
B<Object> b = new C();
Expect.throwsTypeError(() => b.s2 = new Object()); //# 02: ok
Expect.throwsTypeError(() => b.s2 = new Object());
// Interface calls should have any arguments marked "covariant" type checked,
// regardless of whether the corresponding argument on the interface target is
// marked "genericCovariantInterface".
Expect.throwsTypeError(() => b.s3 = new Object()); //# 03: ok
Expect.throwsTypeError(() => b.s4 = new Object()); //# 04: ok
Expect.throwsTypeError(() => b.s3 = new Object());
Expect.throwsTypeError(() => b.s4 = new Object());
// This calls should have any arguments marked "covariant" type checked.
Expect.throwsTypeError(() => b.s5 = new Object()); //# 05: ok
Expect.throwsTypeError(() => b.s5 = new Object());
}

View file

@ -37,27 +37,30 @@ class C extends B<A> {
}
main() {
// Covariance checks are omitted in dart2js production mode.
if (dart2jsProductionMode) return;
// Dynamic method calls should always have their arguments type checked.
dynamic d = new C();
Expect.throwsTypeError(() => d.f1(new Object())); //# 01: ok
Expect.throwsTypeError(() => d.f1(new Object()));
// Closure calls should have any arguments marked "genericCovariantImpl" type
// checked.
B<Object> b = new C();
void Function(Object) f = b.f2;
Expect.throwsTypeError(() => f(new Object())); //# 02: ok
Expect.throwsTypeError(() => f(new Object()));
// Interface calls should have any arguments marked "genericCovariantImpl"
// type checked provided that the corresponding argument on the interface
// target is marked "genericCovariantInterface".
Expect.throwsTypeError(() => b.f2(new Object())); //# 03: ok
Expect.throwsTypeError(() => b.f2(new Object()));
// Interface calls should have any arguments marked "covariant" type checked,
// regardless of whether the corresponding argument on the interface target is
// marked "genericCovariantInterface".
Expect.throwsTypeError(() => b.f3(new Object())); //# 04: ok
Expect.throwsTypeError(() => b.f4(new Object())); //# 05: ok
Expect.throwsTypeError(() => b.f3(new Object()));
Expect.throwsTypeError(() => b.f4(new Object()));
// This calls should have any arguments marked "covariant" type checked.
Expect.throwsTypeError(() => b.f5(new Object())); //# 06: ok
Expect.throwsTypeError(() => b.f5(new Object()));
}