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

Unified Diff: tests/language_strong/dynamic_invoke_test.dart

Issue 2848153002: fix #29504, dcall on object member when a temporary was involved. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/code_generator.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language_strong/dynamic_invoke_test.dart
diff --git a/tests/language_strong/dynamic_invoke_test.dart b/tests/language_strong/dynamic_invoke_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d01beca077e000be69b3dda05b4e4536bb0ec906
--- /dev/null
+++ b/tests/language_strong/dynamic_invoke_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2011, 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.
+// Dart test program for testing dynamic calls.
+
+import "package:expect/expect.dart";
+
+// Make this something that DDC considers side effecting.
+dynamic get d => "hello";
+
+regress29504() {
+ // These forms were being incorrectly generated as dynamic invokes, which is
+ // not supposed to be done for the Object members that are always present on
+ // all Dart types, including `null`.
+ //
+ // See https://github.com/dart-lang/sdk/issues/29504
+ //
+ // What we're testing here is that none of these generate dynamic invokes,
+ // because that will throw a NoSuchMethod error if it happens.
+ Expect.equals(d.runtimeType, String);
+ Expect.equals(d?.runtimeType, String);
+ Expect.equals(d..runtimeType, "hello");
+
+ Expect.equals(d.hashCode, "hello".hashCode);
+ Expect.equals(d?.hashCode, "hello".hashCode);
+ Expect.equals(d..hashCode, "hello");
+
+ Expect.equals(d.toString(), "hello");
+ Expect.equals(d?.toString(), "hello");
+ Expect.equals(d..toString(), "hello");
+}
+
+main() {
+ regress29504();
+}
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/code_generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698