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

Unified Diff: tests/compiler/dart2js/container_mask_equal_test.dart

Issue 94873002: Fix ContainerTypeMask== and ContainerTypeMask.hashCode. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/util/util.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/container_mask_equal_test.dart
===================================================================
--- tests/compiler/dart2js/container_mask_equal_test.dart (revision 0)
+++ tests/compiler/dart2js/container_mask_equal_test.dart (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for dart2js that used to have a bogus
+// implementation of var.== and
+// var.hashCode.
+
+import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
+import 'memory_compiler.dart';
+
+const MEMORY_SOURCE_FILES = const {
+ 'main.dart': '''
+
+import 'dart:typed_data';
+
+a() => [0];
+b() => [1, 2];
+c() => new Uint8List(1);
+d() => new Uint8List(2);
+
+main() {
+ print(a); print(b); print(c); print(d);
+}
+''',
+};
+
+main() {
+ var compiler = compilerFor(MEMORY_SOURCE_FILES);
+ asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
+ var typesInferrer = compiler.typesTask.typesInferrer;
+
+ var element = compiler.mainApp.find('a');
+ var mask1 = typesInferrer.getReturnTypeOfElement(element);
+
+ element = compiler.mainApp.find('b');
+ var mask2 = typesInferrer.getReturnTypeOfElement(element);
+
+ element = compiler.mainApp.find('c');
+ var mask3 = typesInferrer.getReturnTypeOfElement(element);
+
+ element = compiler.mainApp.find('d');
+ var mask4 = typesInferrer.getReturnTypeOfElement(element);
+
+ Expect.notEquals(mask1.union(mask2, compiler),
+ mask3.union(mask4, compiler));
+ }));
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/util/util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698