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

Side by Side Diff: pkg/kernel/testcases/input/covariant_generic.dart

Issue 2825063002: Move kernel baseline tests to front_end. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « pkg/kernel/testcases/input/closure.dart ('k') | pkg/kernel/testcases/input/escape.dart » ('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) 2016, 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 typedef void Callback<T>(T x);
5
6 class Foo<T> {
7 final T finalField;
8 final Callback<T> callbackField;
9
10 T mutableField;
11 Callback<T> mutableCallbackField;
12
13 Foo(this.finalField, this.callbackField);
14
15 void method(T x) {}
16
17 set setter(T x) {}
18
19 void withCallback(Callback<T> callback) {
20 callback(finalField);
21 }
22 }
23
24 main() {
25 Foo<int> fooInt = new Foo<int>(1, (int x) {});
26
27 fooInt.method(3);
28 fooInt.setter = 3;
29 fooInt.withCallback((int x) {});
30 fooInt.withCallback((num x) {});
31 fooInt.mutableField = 3;
32 fooInt.mutableCallbackField = (int x) {};
33
34 Foo<num> fooNum = fooInt;
35 fooNum.method(3);
36 fooNum.method(2.5);
37 fooNum.setter = 3;
38 fooNum.setter = 2.5;
39 fooNum.withCallback((num x) {});
40 fooNum.mutableField = 3;
41 fooNum.mutableField = 2.5;
42 fooNum.mutableCallbackField(3);
43 fooNum.mutableCallbackField(2.5);
44 fooNum.mutableCallbackField = (num x) {};
45 }
OLDNEW
« no previous file with comments | « pkg/kernel/testcases/input/closure.dart ('k') | pkg/kernel/testcases/input/escape.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698