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

Unified Diff: test/browser/runtime_tests.js

Issue 1152583002: Add constructors to signatures (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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/browser/runtime_tests.js
diff --git a/test/browser/runtime_tests.js b/test/browser/runtime_tests.js
index b43b32d872bca821f35a0be7588336b813cdfe99..806816e7920e46a4b91bf4811ef6aa161fff0956 100644
--- a/test/browser/runtime_tests.js
+++ b/test/browser/runtime_tests.js
@@ -94,6 +94,7 @@ suite('instanceOf', () => {
let runtimeType = dart.realRuntimeType;
let functionType = dart.functionType;
let typedef = dart.typedef;
+ let isSubtype = dart.isSubtype;
let Object = core.Object;
let String = core.String;
@@ -277,6 +278,28 @@ suite('instanceOf', () => {
checkType(m4, Map);
});
+ test('constructors', () => {
+ class C extends core.Object {
+ C(x) {};
+ named(x, y) {};
+ }
+ dart.defineNamedConstructor(C, 'named');
+ dart.setSignature(C, {
+ constructors: () => ({
+ C: [C, [core.int]],
+ named: [C, [core.int, core.int]]
+ })
+ });
+ let getType = dart.classGetConstructorType;
+ isSubtype(getType(C), dart.functionType(C, [core.int]));
+ isSubtype(getType(C), dart.functionType(C, [core.String]), false);
+ isSubtype(getType(C, 'C'), dart.functionType(C, [core.int]));
+ isSubtype(getType(C, 'C'), dart.functionType(C, [core.String]), false);
+ isSubtype(getType(C, 'named'), dart.functionType(C, [core.int, core.int]));
+ isSubtype(getType(C, 'named'),
+ dart.functionType(C, [core.int, core.String]), false);
+ });
+
test('generic and inheritance', () => {
let aaraw = new AA();
let aarawtype = runtimeType(aaraw);

Powered by Google App Engine
This is Rietveld 408576698