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

Side by Side Diff: tests/lib/mirrors/generic_bounded_test.dart

Issue 2763823002: Move spaces from before comments to within comments (Closed)
Patch Set: Fix comments Created 3 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library test.generic_bounded; 5 library test.generic_bounded;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 10
11 import 'generics_helper.dart'; 11 import 'generics_helper.dart';
12 12
13 class Super<T extends num> {} 13 class Super<T extends num> {}
14 14
15 class Fixed extends Super<int> {} 15 class Fixed extends Super<int> {}
16 class Generic<R> extends Super<R> {} /// 02: static type warning 16 class Generic<R> extends Super<R> {} // /// 02: static type warning
17 class Malbounded extends Super<String> {} /// 01: static type warning 17 class Malbounded extends Super<String> {} /// 01: static type warning
18 18
19 bool inCheckedMode() { 19 bool inCheckedMode() {
20 try { 20 try {
21 var s = 'string'; 21 var s = 'string';
22 int i = s; 22 int i = s;
23 } catch(e) { 23 } catch(e) {
24 return true; 24 return true;
25 } 25 }
26 return false; 26 return false;
27 } 27 }
28 28
29 main() { 29 main() {
30 ClassMirror superDecl = reflectClass(Super); 30 ClassMirror superDecl = reflectClass(Super);
31 ClassMirror superOfInt = reflectClass(Fixed).superclass; 31 ClassMirror superOfInt = reflectClass(Fixed).superclass;
32 ClassMirror genericDecl = reflectClass(Generic); /// 02: continued 32 ClassMirror genericDecl = reflectClass(Generic); // /// 02: continued
33 ClassMirror superOfR = genericDecl.superclass; /// 02: continued 33 ClassMirror superOfR = genericDecl.superclass; // /// 02: continued
34 ClassMirror genericOfDouble = reflect(new Generic<double>()).type; /// 02: co ntinued 34 ClassMirror genericOfDouble = reflect(new Generic<double>()).type; // /// 02: continued
35 ClassMirror superOfDouble = genericOfDouble.superclass; /// 02: continued 35 ClassMirror superOfDouble = genericOfDouble.superclass; // /// 02: continued
36 36
37 try { 37 try {
38 ClassMirror genericOfBool = reflect(new Generic<bool>()).type; /// 02: stat ic type warning 38 ClassMirror genericOfBool = reflect(new Generic<bool>()).type; // /// 02: st atic type warning
39 ClassMirror superOfBool = genericOfBool.superclass; /// 02: continued 39 ClassMirror superOfBool = genericOfBool.superclass; // /// 02: continued
40 Expect.isFalse(genericOfBool.isOriginalDeclaration); /// 02: continued 40 Expect.isFalse(genericOfBool.isOriginalDeclaration); // /// 02: continued
41 Expect.isFalse(superOfBool.isOriginalDeclaration); /// 02: continued 41 Expect.isFalse(superOfBool.isOriginalDeclaration); // /// 02: continued
42 typeParameters(genericOfBool, [#R]); /// 02: continued 42 typeParameters(genericOfBool, [#R]); // /// 02: continued
43 typeParameters(superOfBool, [#T]); /// 02: continued 43 typeParameters(superOfBool, [#T]); // /// 02: continued
44 typeArguments(genericOfBool, [reflectClass(bool)]); /// 02: continued 44 typeArguments(genericOfBool, [reflectClass(bool)]); // /// 02: continued
45 typeArguments(superOfBool, [reflectClass(bool)]); /// 02: continued 45 typeArguments(superOfBool, [reflectClass(bool)]); // /// 02: continued
46 Expect.isFalse(inCheckedMode()); /// 02: continued 46 Expect.isFalse(inCheckedMode()); /// 02: continued
47 } on TypeError catch(e) { 47 } on TypeError catch(e) {
48 Expect.isTrue(inCheckedMode()); 48 Expect.isTrue(inCheckedMode());
49 } 49 }
50 50
51 ClassMirror superOfString = reflectClass(Malbounded).superclass; /// 01: cont inued 51 ClassMirror superOfString = reflectClass(Malbounded).superclass; // /// 01: co ntinued
52 52
53 Expect.isTrue(superDecl.isOriginalDeclaration); 53 Expect.isTrue(superDecl.isOriginalDeclaration);
54 Expect.isFalse(superOfInt.isOriginalDeclaration); 54 Expect.isFalse(superOfInt.isOriginalDeclaration);
55 Expect.isTrue(genericDecl.isOriginalDeclaration); /// 02: continued 55 Expect.isTrue(genericDecl.isOriginalDeclaration); // /// 02: continued
56 Expect.isFalse(superOfR.isOriginalDeclaration); /// 02: continued 56 Expect.isFalse(superOfR.isOriginalDeclaration); // /// 02: continued
57 Expect.isFalse(genericOfDouble.isOriginalDeclaration); /// 02: continued 57 Expect.isFalse(genericOfDouble.isOriginalDeclaration); // /// 02: continued
58 Expect.isFalse(superOfDouble.isOriginalDeclaration); /// 02: continued 58 Expect.isFalse(superOfDouble.isOriginalDeclaration); // /// 02: continued
59 59
60 Expect.isFalse(superOfString.isOriginalDeclaration); /// 01: continued 60 Expect.isFalse(superOfString.isOriginalDeclaration); // /// 01: continued
61 61
62 TypeVariableMirror tFromSuper = superDecl.typeVariables.single; 62 TypeVariableMirror tFromSuper = superDecl.typeVariables.single;
63 TypeVariableMirror rFromGeneric = genericDecl.typeVariables.single; /// 02: c ontinued 63 TypeVariableMirror rFromGeneric = genericDecl.typeVariables.single; // /// 02: continued
64 64
65 Expect.equals(reflectClass(num), tFromSuper.upperBound); 65 Expect.equals(reflectClass(num), tFromSuper.upperBound);
66 Expect.equals(reflectClass(Object), rFromGeneric.upperBound); /// 02: continu ed 66 Expect.equals(reflectClass(Object), rFromGeneric.upperBound); // /// 02: conti nued
67 67
68 typeParameters(superDecl, [#T]); 68 typeParameters(superDecl, [#T]);
69 typeParameters(superOfInt, [#T]); 69 typeParameters(superOfInt, [#T]);
70 typeParameters(genericDecl, [#R]); /// 02: continued 70 typeParameters(genericDecl, [#R]); // /// 02: continued
71 typeParameters(superOfR, [#T]); /// 02: continued 71 typeParameters(superOfR, [#T]); // /// 02: continued
72 typeParameters(genericOfDouble, [#R]); /// 02: continued 72 typeParameters(genericOfDouble, [#R]); // /// 02: continued
73 typeParameters(superOfDouble, [#T]); /// 02: continued 73 typeParameters(superOfDouble, [#T]); // /// 02: continued
74 typeParameters(superOfString, [#T]); /// 01: continued 74 typeParameters(superOfString, [#T]); // /// 01: continued
75 75
76 typeArguments(superDecl, []); 76 typeArguments(superDecl, []);
77 typeArguments(superOfInt, [reflectClass(int)]); 77 typeArguments(superOfInt, [reflectClass(int)]);
78 typeArguments(genericDecl, []); /// 02: continued 78 typeArguments(genericDecl, []); // /// 02: continued
79 typeArguments(superOfR, [rFromGeneric]); /// 02: continued 79 typeArguments(superOfR, [rFromGeneric]); // /// 02: continued
80 typeArguments(genericOfDouble, [reflectClass(double)]); /// 02: continued 80 typeArguments(genericOfDouble, [reflectClass(double)]); // /// 02: continued
81 typeArguments(superOfDouble, [reflectClass(double)]); /// 02: continued 81 typeArguments(superOfDouble, [reflectClass(double)]); // /// 02: continued
82 typeArguments(superOfString, [reflectClass(String)]); /// 01: continued 82 typeArguments(superOfString, [reflectClass(String)]); // /// 01: continued
83 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698