Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: test/type_substitute_bounds_test.dart

Issue 2439043002: Introduce Substitution class and Supertype class. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/type_parser.dart ('k') | test/type_substitution_identity_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library kernel.type_substitute_bounds_test; 4 library kernel.type_substitute_bounds_test;
5 5
6 import 'package:kernel/kernel.dart'; 6 import 'package:kernel/kernel.dart';
7 import 'package:kernel/type_algebra.dart'; 7 import 'package:kernel/type_algebra.dart';
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 import 'type_parser.dart'; 9 import 'type_parser.dart';
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 test('$testCase', () { 65 test('$testCase', () {
66 var environment = new LazyTypeEnvironment(); 66 var environment = new LazyTypeEnvironment();
67 var type = environment.parse(testCase.type); 67 var type = environment.parse(testCase.type);
68 var upperBounds = <TypeParameter, DartType>{}; 68 var upperBounds = <TypeParameter, DartType>{};
69 var lowerBounds = <TypeParameter, DartType>{}; 69 var lowerBounds = <TypeParameter, DartType>{};
70 testCase.bounds.forEach((String name, TypeBound bounds) { 70 testCase.bounds.forEach((String name, TypeBound bounds) {
71 var parameter = environment.getTypeParameter(name); 71 var parameter = environment.getTypeParameter(name);
72 upperBounds[parameter] = environment.parse(bounds.upper); 72 upperBounds[parameter] = environment.parse(bounds.upper);
73 lowerBounds[parameter] = environment.parse(bounds.lower); 73 lowerBounds[parameter] = environment.parse(bounds.lower);
74 }); 74 });
75 var substituted = substituteBounds(type, upperBounds, lowerBounds); 75 var substituted = Substitution
76 .fromUpperAndLowerBounds(upperBounds, lowerBounds)
77 .substituteType(type);
76 var expected = environment.parse(testCase.expected); 78 var expected = environment.parse(testCase.expected);
77 if (substituted != expected) { 79 if (substituted != expected) {
78 fail('Expected `$expected` but got `$substituted`'); 80 fail('Expected `$expected` but got `$substituted`');
79 } 81 }
80 }); 82 });
81 } 83 }
82 } 84 }
OLDNEW
« no previous file with comments | « test/type_parser.dart ('k') | test/type_substitution_identity_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698