// Copyright (c) 2018, 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.7 import 'package:async_helper/async_helper.dart'; import '../helpers/d8_helper.dart'; import '../helpers/memory_compiler.dart'; const String SOURCE1 = r''' import 'package:expect/expect.dart'; class A {} class B {} method1() {} class C { method2() {} } main() { bool printError(e) { print(e); return true; } method3() {} dynamic m1 = method1; dynamic m2 = new C().method2; dynamic m3 = method3; m1(); Expect.throws(() => m1(), printError); m2(); Expect.throws(() => m2(), printError); m3(); Expect.throws(() => m3(), printError); } '''; const String OUTPUT1 = r''' TypeError: The type argument 'B' is not a subtype of the type variable bound 'A' of type variable 'T' in 'method1'. TypeError: The type argument 'A' is not a subtype of the type variable bound 'B' of type variable 'S' in 'method2'. TypeError: The type argument 'A' is not a subtype of the type variable bound 'B' of type variable 'T' in 'call'. '''; main(List args) { asyncTest(() async { await runWithD8( memorySourceFiles: {'main.dart': SOURCE1}, expectedOutput: OUTPUT1, printJs: args.contains('-v'), options: ['--libraries-spec=$sdkLibrariesSpecificationUri']); }); }