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

Unified Diff: test/codegen/expect/covariance.js

Issue 1117793002: add checks needed for covariant generics, and List<E> (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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 | « test/codegen/covariance.dart ('k') | test/codegen/expect/covariance.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/expect/covariance.js
diff --git a/test/codegen/expect/covariance.js b/test/codegen/expect/covariance.js
new file mode 100644
index 0000000000000000000000000000000000000000..030ab955718927acc938f987c2b44f63463e90ad
--- /dev/null
+++ b/test/codegen/expect/covariance.js
@@ -0,0 +1,38 @@
+var covariance;
+(function(exports) {
+ 'use strict';
+ let _t = Symbol('_t');
+ let Foo$ = dart.generic(function(T) {
+ class Foo extends core.Object {
+ Foo() {
+ this[_t] = null;
+ }
+ add(t) {
+ dart.as(t, T);
+ this[_t] = t;
+ }
+ forEach(fn) {
+ dart.as(fn, dart.functionType(dart.void, [T]));
+ fn(this[_t]);
+ }
+ }
+ return Foo;
+ });
+ let Foo = Foo$();
+ class Bar extends Foo$(core.int) {
+ add(x) {
+ core.print(`Bar.add got ${x}`);
+ super.add(x);
+ }
+ }
+ // Function main: () → dynamic
+ function main() {
+ let foo = new Bar();
+ foo.add('hi');
+ }
+ // Exports:
+ exports.Foo$ = Foo$;
+ exports.Foo = Foo;
+ exports.Bar = Bar;
+ exports.main = main;
+})(covariance || (covariance = {}));
« no previous file with comments | « test/codegen/covariance.dart ('k') | test/codegen/expect/covariance.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698