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

Side by Side Diff: tests/language/function_subtype_typearg5_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Check function subtyping of type arguments. These cases use typedefs as type 5 // Check function subtyping of type arguments. These cases use typedefs as type
6 // arguments, and the typedefs have type parameters that are used more than 6 // arguments, and the typedefs have type parameters that are used more than
7 // once. 7 // once.
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 10
11 typedef A F<A>(A arg1, A arg2); 11 typedef A F<A>(A arg1, A arg2);
12 typedef B G<A,B>(B arg1, B arg2); 12 typedef B G<A, B>(B arg1, B arg2);
13 13
14 typedef Set<A> FS<A>(Set<A> arg1, Set<A> arg2); 14 typedef Set<A> FS<A>(Set<A> arg1, Set<A> arg2);
15 15
16 @NoInline() @AssumeDynamic() dyn(x) => x; 16 @NoInline()
17 @AssumeDynamic()
18 dyn(x) => x;
17 19
18 class CheckEnv<X, Y> { 20 class CheckEnv<X, Y> {
19 test(bool intX) { 21 test(bool intX) {
20 Expect.isTrue(<F<X>>[] is List<F>); 22 Expect.isTrue(<F<X>>[] is List<F>);
21 Expect.isTrue(<F<X>>[] is List<F<X>>); 23 Expect.isTrue(<F<X>>[] is List<F<X>>);
22 Expect.isTrue(<F<X>>[] is List<G<Y,X>>); 24 Expect.isTrue(<F<X>>[] is List<G<Y, X>>);
23 25
24 Expect.isTrue(dyn(<F<X>>[]) is List<F>); 26 Expect.isTrue(dyn(<F<X>>[]) is List<F>);
25 Expect.isTrue(dyn(<F<X>>[]) is List<F<X>>); 27 Expect.isTrue(dyn(<F<X>>[]) is List<F<X>>);
26 Expect.isTrue(dyn(<F<X>>[]) is List<G<Y,X>>); 28 Expect.isTrue(dyn(<F<X>>[]) is List<G<Y, X>>);
27 29
28 Expect.isTrue(<F<X>>[] is! List<F<Y>>); 30 Expect.isTrue(<F<X>>[] is! List<F<Y>>);
29 Expect.isTrue(<F<X>>[] is! List<G<X,Y>>); 31 Expect.isTrue(<F<X>>[] is! List<G<X, Y>>);
30 32
31 Expect.isTrue(dyn(<F<X>>[]) is! List<F<Y>>); 33 Expect.isTrue(dyn(<F<X>>[]) is! List<F<Y>>);
32 Expect.isTrue(dyn(<F<X>>[]) is! List<G<X,Y>>); 34 Expect.isTrue(dyn(<F<X>>[]) is! List<G<X, Y>>);
33 35
34 Expect.isTrue(dyn(<FS<X>>[]) is List<FS>); 36 Expect.isTrue(dyn(<FS<X>>[]) is List<FS>);
35 Expect.isTrue(dyn(<FS<X>>[]) is List<FS<X>>); 37 Expect.isTrue(dyn(<FS<X>>[]) is List<FS<X>>);
36 if (intX) { 38 if (intX) {
37 Expect.isTrue(dyn(<FS<X>>[]) is List<FS<int>>); 39 Expect.isTrue(dyn(<FS<X>>[]) is List<FS<int>>);
38 Expect.isTrue(dyn(<FS<int>>[]) is List<FS<X>>); 40 Expect.isTrue(dyn(<FS<int>>[]) is List<FS<X>>);
39 Expect.isTrue(dyn(<FS<Y>>[]) is! List<FS<int>>); 41 Expect.isTrue(dyn(<FS<Y>>[]) is! List<FS<int>>);
40 Expect.isTrue(dyn(<FS<int>>[]) is! List<FS<Y>>); 42 Expect.isTrue(dyn(<FS<int>>[]) is! List<FS<Y>>);
41 } 43 }
42 } 44 }
43 } 45 }
44 46
45
46
47 main() { 47 main() {
48 Expect.isTrue(<F<int>>[] is List<F<int>>); 48 Expect.isTrue(<F<int>>[] is List<F<int>>);
49 Expect.isTrue(dyn(<F<int>>[]) is List<F<int>>); 49 Expect.isTrue(dyn(<F<int>>[]) is List<F<int>>);
50 Expect.isTrue(<F<int>>[] is List<G<bool,int>>); 50 Expect.isTrue(<F<int>>[] is List<G<bool, int>>);
51 Expect.isTrue(dyn(<F<int>>[]) is List<G<bool,int>>); 51 Expect.isTrue(dyn(<F<int>>[]) is List<G<bool, int>>);
52 52
53 new CheckEnv<int,String>().test(true); 53 new CheckEnv<int, String>().test(true);
54 new CheckEnv<String,int>().test(false); 54 new CheckEnv<String, int>().test(false);
55 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698