OLD | NEW |
| (Empty) |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 import 'package:kernel/kernel.dart'; | |
5 import 'package:kernel/type_algebra.dart'; | |
6 import 'type_parser.dart'; | |
7 import 'type_unification_test.dart' show testCases; | |
8 import 'package:test/test.dart'; | |
9 | |
10 checkType(DartType type) { | |
11 var map = {new TypeParameter(): const DynamicType()}; | |
12 var other = substitute(type, map); | |
13 if (!identical(type, other)) { | |
14 fail('Identity substitution test failed for $type'); | |
15 } | |
16 other = Substitution.fromUpperAndLowerBounds(map, map).substituteType(type); | |
17 if (!identical(type, other)) { | |
18 fail('Identity bounded substitution test failed for $type'); | |
19 } | |
20 } | |
21 | |
22 main() { | |
23 for (var testCase in testCases) { | |
24 test('$testCase', () { | |
25 var env = new LazyTypeEnvironment(); | |
26 checkType(env.parse(testCase.type1)); | |
27 checkType(env.parse(testCase.type2)); | |
28 }); | |
29 } | |
30 } | |
OLD | NEW |