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

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

Issue 61883003: Add static type warning annotation to make the test pass on analyzer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | « no previous file | 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 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 bool get inCheckedMode { 7 bool get inCheckedMode {
8 try { 8 try {
9 String a = 42; 9 String a = 42; /// 01: static type warning
kasperl 2013/11/06 14:26:13 You could also just do: var i = 42; String a
ngeoffray 2013/11/06 14:37:32 Done.
10 } catch (e) { 10 } catch (e) {
11 return true; 11 return true;
12 } 12 }
13 return false; 13 return false;
14 } 14 }
15 15
16 class A<T> { 16 class A<T> {
17 T field; 17 T field;
18 } 18 }
19 19
(...skipping 11 matching lines...) Expand all
31 if (inCheckedMode) { 31 if (inCheckedMode) {
32 Expect.throws(() => a.field = 42, (e) => e is TypeError); 32 Expect.throws(() => a.field = 42, (e) => e is TypeError);
33 Expect.throws(() => new B<String>(), (e) => e is TypeError); 33 Expect.throws(() => new B<String>(), (e) => e is TypeError);
34 Expect.throws(() => c.field = 'foo', (e) => e is TypeError); 34 Expect.throws(() => c.field = 'foo', (e) => e is TypeError);
35 } else { 35 } else {
36 a.field = 42; 36 a.field = 42;
37 new B<String>(); 37 new B<String>();
38 c.field = 'foo'; 38 c.field = 'foo';
39 } 39 }
40 } 40 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698