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

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

Issue 22978011: Fix static type warnings in language/null_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/language.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Second dart test program. 4 // Second dart test program.
5 5
6 // VMOptions=--optimization-counter-threshold=5 6 // VMOptions=--optimization-counter-threshold=5
7 7
8 import "dart:mirrors"; 8 import "dart:mirrors";
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
(...skipping 19 matching lines...) Expand all
30 class Generic2<T, S> { 30 class Generic2<T, S> {
31 bool test(o) => new Generic<T>().test(o); 31 bool test(o) => new Generic<T>().test(o);
32 T cast(o) => new Generic<T>().cast(o); 32 T cast(o) => new Generic<T>().cast(o);
33 Type get type => new Generic<T>().type; 33 Type get type => new Generic<T>().type;
34 } 34 }
35 35
36 // Magic incantation to avoid the compiler recognizing the constant values 36 // Magic incantation to avoid the compiler recognizing the constant values
37 // at compile time. If the result is computed at compile time, the dynamic code 37 // at compile time. If the result is computed at compile time, the dynamic code
38 // will not be tested. 38 // will not be tested.
39 confuse(x) { 39 confuse(x) {
40 try { throw [x]; } catch (e) { return e[0]; } 40 try { throw [x]; } on dynamic catch (e) { return e[0]; }
41 return 42; 41 return 42;
42 } 42 }
43 43
44 void main() { 44 void main() {
45 for (int i = 0; i < 10; i++) { 45 for (int i = 0; i < 10; i++) {
46 test(); 46 test();
47 } 47 }
48 } 48 }
49 49
50 void test() { 50 void test() {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // cannot be extracted. 182 // cannot be extracted.
183 // Currently fails in VM. 183 // Currently fails in VM.
184 Expect.equals(null.toString, obj.toString); 184 Expect.equals(null.toString, obj.toString);
185 Expect.equals(null.noSuchMethod, obj.noSuchMethod); 185 Expect.equals(null.noSuchMethod, obj.noSuchMethod);
186 Expect.equals(null.hashCode, obj.hashCode); 186 Expect.equals(null.hashCode, obj.hashCode);
187 187
188 var toString = null.toString; 188 var toString = null.toString;
189 Expect.equals("null", toString()); 189 Expect.equals("null", toString());
190 Expect.equals("null", Function.apply(toString, [])); 190 Expect.equals("null", Function.apply(toString, []));
191 191
192 Expect.throws(() => null.notDeclared()); 192 Expect.throws(() => obj.notDeclared());
193 var noSuchMethod = null.noSuchMethod; 193 var noSuchMethod = null.noSuchMethod;
194 // Assing to "var" to prevent warning. 194 // Assing to "var" to prevent warning.
195 var capture = new CaptureInvocationMirror(); 195 var capture = new CaptureInvocationMirror();
196 var mirror = capture.notDeclared(); 196 var mirror = capture.notDeclared();
197 Expect.throws(() => noSuchMethod(mirror)); 197 Expect.throws(() => noSuchMethod(mirror));
198 Expect.throws(() => Function.apply(noSuchMethod, [mirror])); 198 Expect.throws(() => Function.apply(noSuchMethod, [mirror]));
199 } 199 }
200 200
201 201
202 class CaptureInvocationMirror { 202 class CaptureInvocationMirror {
203 noSuchMethod(mirror) => mirror; 203 noSuchMethod(mirror) => mirror;
204 } 204 }
OLDNEW
« no previous file with comments | « tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698