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

Unified Diff: test/codegen/lib/mirrors/inference_and_no_such_method_test.dart

Issue 2265533002: Add mirrors tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 4 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
Index: test/codegen/lib/mirrors/inference_and_no_such_method_test.dart
diff --git a/test/codegen/lib/mirrors/inference_and_no_such_method_test.dart b/test/codegen/lib/mirrors/inference_and_no_such_method_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4f57eedf219c0c4f7603074c1d37afa9b4c30b59
--- /dev/null
+++ b/test/codegen/lib/mirrors/inference_and_no_such_method_test.dart
@@ -0,0 +1,26 @@
+// 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 did type inferencing on parameters
+// whose type may change at runtime due to an invocation through
+// [InstanceMirror.delegate].
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+class A {
+ noSuchMethod(im) {
+ reflect(new B()).delegate(im);
+ }
+}
+
+class B {
+ foo(a) => a + 42;
+}
+
+main() {
+ Expect.equals(42, new B().foo(0));
+ Expect.throws(() => new A().foo('foo'),
+ (e) => e is ArgumentError || e is TypeError);
+}
« no previous file with comments | « test/codegen/lib/mirrors/immutable_collections_test.dart ('k') | test/codegen/lib/mirrors/inherit_field_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698