| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011, 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 // Dart test program for testing dynamic calls. |
| 5 |
| 6 import "package:expect/expect.dart"; |
| 7 |
| 8 // Make this something that DDC considers side effecting. |
| 9 dynamic get d => "hello"; |
| 10 |
| 11 regress29504() { |
| 12 // These forms were being incorrectly generated as dynamic invokes, which is |
| 13 // not supposed to be done for the Object members that are always present on |
| 14 // all Dart types, including `null`. |
| 15 // |
| 16 // See https://github.com/dart-lang/sdk/issues/29504 |
| 17 // |
| 18 // What we're testing here is that none of these generate dynamic invokes, |
| 19 // because that will throw a NoSuchMethod error if it happens. |
| 20 Expect.equals(d.runtimeType, String); |
| 21 Expect.equals(d?.runtimeType, String); |
| 22 Expect.equals(d..runtimeType, "hello"); |
| 23 |
| 24 Expect.equals(d.hashCode, "hello".hashCode); |
| 25 Expect.equals(d?.hashCode, "hello".hashCode); |
| 26 Expect.equals(d..hashCode, "hello"); |
| 27 |
| 28 Expect.equals(d.toString(), "hello"); |
| 29 Expect.equals(d?.toString(), "hello"); |
| 30 Expect.equals(d..toString(), "hello"); |
| 31 } |
| 32 |
| 33 main() { |
| 34 regress29504(); |
| 35 } |
| OLD | NEW |