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

Unified Diff: test/codegen/language/callable_test.dart

Issue 2200913002: fixes #616, statics on callable functions (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 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 | « lib/src/compiler/code_generator.dart ('k') | test/codegen_expected/corelib/apply3_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/language/callable_test.dart
diff --git a/test/codegen/language/callable_test.dart b/test/codegen/language/callable_test.dart
index be43bfbfc23b70d56945fa41af1d4802be15adef..57e7ffb8fd8e4f9d23c86e34b7bf83e16076028e 100644
--- a/test/codegen/language/callable_test.dart
+++ b/test/codegen/language/callable_test.dart
@@ -2,12 +2,24 @@
// 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.
+import 'package:expect/expect.dart';
+
class X {
call() => 42;
}
class Y {
- call(int x) => 87;
+ call(int x) => 87 + x;
+
+ static int staticMethod(int x) => x + 1;
+}
+
+class Z<T> {
+ final T value;
+ Z(this.value);
+ call() => value;
+
+ static int staticMethod(int x) => x + 1;
}
typedef F(int x);
@@ -21,5 +33,15 @@ main() {
F f0 = y; // Should pass checked mode test
F f1 = x; /// 00: dynamic type error, static type warning
G g0 = y; /// 01: dynamic type error, static type warning
-}
+ Expect.equals(f(), 42);
+ Expect.equals(g(100), 187);
+
+ var z = new Z<int>(123);
+ Expect.equals(z(), 123);
+ // TODO(jmesserly): this test doesn't work yet.
+ // Expect.equals((z as dynamic)(), 123);
+
+ Expect.equals(Y.staticMethod(6), 7);
+ Expect.equals(Z.staticMethod(6), 7);
+}
« no previous file with comments | « lib/src/compiler/code_generator.dart ('k') | test/codegen_expected/corelib/apply3_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698