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

Side by Side Diff: test/codegen/covariance.dart

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, 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 unified diff | Download patch
« no previous file with comments | « test/browser/runtime_tests.js ('k') | test/codegen/expect/covariance.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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
5 class Foo<T> {
6 T _t;
7 add(T t) {
8 _t = t;
9 }
10
11 forEach(void fn(T t)) {
12 // No check needed for `fn`
13 fn(_t);
14 }
15 }
16
17 class Bar extends Foo<int> {
18 add(int x) {
19 print('Bar.add got $x');
20 super.add(x);
21 }
22 }
23
24 main() {
25 Foo<Object> foo = new Bar();
26 foo.add('hi'); // should throw
27 }
OLDNEW
« no previous file with comments | « test/browser/runtime_tests.js ('k') | test/codegen/expect/covariance.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698