| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 | 4 |
| 5 library subtype_test; | 5 library subtype_test; |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:compiler/src/dart_types.dart'; | 9 import 'package:compiler/src/dart_types.dart'; |
| 10 import 'package:compiler/src/elements/elements.dart' | 10 import 'package:compiler/src/elements/elements.dart' |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 FunctionType void__Object_B = | 374 FunctionType void__Object_B = |
| 375 env.functionType(void_, [Object_, B]); | 375 env.functionType(void_, [Object_, B]); |
| 376 FunctionType void__Object_C = | 376 FunctionType void__Object_C = |
| 377 env.functionType(void_, [Object_, C]); | 377 env.functionType(void_, [Object_, C]); |
| 378 FunctionType void__B_Object = | 378 FunctionType void__B_Object = |
| 379 env.functionType(void_, [B, Object_]); | 379 env.functionType(void_, [B, Object_]); |
| 380 | 380 |
| 381 checkLub(DartType a, DartType b, DartType expectedLub) { | 381 checkLub(DartType a, DartType b, DartType expectedLub) { |
| 382 DartType lub = env.computeLeastUpperBound(a, b); | 382 DartType lub = env.computeLeastUpperBound(a, b); |
| 383 if (a != b) { | 383 if (a != b) { |
| 384 expectedLub = expectedLub.unalias(env.compiler); | 384 expectedLub = expectedLub.unalias(env.compiler.resolution); |
| 385 lub = lub.unalias(env.compiler); | 385 lub = lub.unalias(env.compiler.resolution); |
| 386 } | 386 } |
| 387 Expect.equals(expectedLub, lub, | 387 Expect.equals(expectedLub, lub, |
| 388 'Unexpected lub(${a.unalias(env.compiler)},' | 388 'Unexpected lub(${a.unalias(env.compiler.resolution)},' |
| 389 '${b.unalias(env.compiler)}) = ' | 389 '${b.unalias(env.compiler.resolution)}) = ' |
| 390 '${lub}, expected ${expectedLub}'); | 390 '${lub}, expected ${expectedLub}'); |
| 391 } | 391 } |
| 392 | 392 |
| 393 checkLub(Object_, Object_, Object_); | 393 checkLub(Object_, Object_, Object_); |
| 394 checkLub(Object_, Function_, Object_); | 394 checkLub(Object_, Function_, Object_); |
| 395 checkLub(Object_, dynamic__, Object_); | 395 checkLub(Object_, dynamic__, Object_); |
| 396 checkLub(Object_, void__, Object_); | 396 checkLub(Object_, void__, Object_); |
| 397 checkLub(Object_, A__, Object_); | 397 checkLub(Object_, A__, Object_); |
| 398 checkLub(Object_, B__, Object_); | 398 checkLub(Object_, B__, Object_); |
| 399 checkLub(Object_, C__, Object_); | 399 checkLub(Object_, C__, Object_); |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 checkLub(X, S, Object_); | 843 checkLub(X, S, Object_); |
| 844 checkLub(X, T, T); | 844 checkLub(X, T, T); |
| 845 checkLub(X, U, B); | 845 checkLub(X, U, B); |
| 846 checkLub(X, V, T); | 846 checkLub(X, V, T); |
| 847 checkLub(X, W, T); | 847 checkLub(X, W, T); |
| 848 checkLub(X, X, X); | 848 checkLub(X, X, X); |
| 849 })); | 849 })); |
| 850 } | 850 } |
| 851 | 851 |
| 852 | 852 |
| OLD | NEW |