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