blob: 69ea072c1f7171365d1bf71e7a00f245f7f1900f [file] [log] [blame]
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
// @dart = 2.9
// VMOptions=--optimization_counter_threshold=10 --deterministic
// Regression test for https://dartbug.com/40710.
// Verifies that specialized type testing stub can reject
// instances with all-dynamic (null) type arguments.
import "package:expect/expect.dart";
class A<T> {
@pragma('vm:never-inline')
void foo(x) {
print(x as T);
}
}
class B<T> {}
main(List<String> args) {
for (int i = 0; i < 20; ++i) {
final a = new A<B<String>>();
a.foo(new B<String>());
Expect.throwsTypeError(() {
a.foo(new B<dynamic>());
});
}
}