| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Regression test for dart2js that used to have a bogus |
| 6 // implementation of var.== and |
| 7 // var.hashCode. |
| 8 |
| 9 import 'package:expect/expect.dart'; |
| 10 import "package:async_helper/async_helper.dart"; |
| 11 import 'memory_compiler.dart'; |
| 12 |
| 13 const MEMORY_SOURCE_FILES = const { |
| 14 'main.dart': ''' |
| 15 |
| 16 import 'dart:typed_data'; |
| 17 |
| 18 a() => [0]; |
| 19 b() => [1, 2]; |
| 20 c() => new Uint8List(1); |
| 21 d() => new Uint8List(2); |
| 22 |
| 23 main() { |
| 24 print(a); print(b); print(c); print(d); |
| 25 } |
| 26 ''', |
| 27 }; |
| 28 |
| 29 main() { |
| 30 var compiler = compilerFor(MEMORY_SOURCE_FILES); |
| 31 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { |
| 32 var typesInferrer = compiler.typesTask.typesInferrer; |
| 33 |
| 34 var element = compiler.mainApp.find('a'); |
| 35 var mask1 = typesInferrer.getReturnTypeOfElement(element); |
| 36 |
| 37 element = compiler.mainApp.find('b'); |
| 38 var mask2 = typesInferrer.getReturnTypeOfElement(element); |
| 39 |
| 40 element = compiler.mainApp.find('c'); |
| 41 var mask3 = typesInferrer.getReturnTypeOfElement(element); |
| 42 |
| 43 element = compiler.mainApp.find('d'); |
| 44 var mask4 = typesInferrer.getReturnTypeOfElement(element); |
| 45 |
| 46 Expect.notEquals(mask1.union(mask2, compiler), |
| 47 mask3.union(mask4, compiler)); |
| 48 })); |
| 49 } |
| OLD | NEW |