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

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

Issue 60293003: Version 0.8.10.5 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class A<T> { 7 class A<T> {
8 Function closure; 8 Function closure;
9 A._(this.closure); 9 A._(this.closure);
10 10
11 factory A() { 11 factory A() {
12 return new A._(() => new Set<T>()); 12 return new A._(() => new Set<T>());
13 } 13 }
14 14
15 A.bar() { 15 A.bar() {
16 closure = () => new Set<T>(); 16 closure = () => new Set<T>();
17 } 17 }
18 18
19 static 19 static
20 T /// 01: static type warning 20 T /// 01: static type warning, dynamic type error
21 staticMethod( 21 staticMethod(
22 T /// 02: static type warning 22 T /// 02: static type warning, dynamic type error
23 a) { 23 a) {
24 final 24 final
25 T /// 03: static type warning 25 T /// 03: static type warning, dynamic type error
26 a = "not_null"; 26 a = "not_null";
27 print(a); 27 print(a);
28 return a; 28 return a;
29 } 29 }
30 30
31 static final 31 static final
32 T /// 04: static type warning 32 T /// 04: static type warning, dynamic type error
33 staticFinalField = "not_null"; 33 staticFinalField = "not_null";
34 34
35 static const 35 static const
36 T /// 05: static type warning 36 T /// 05: static type warning, dynamic type error
37 staticConstField = "not_null"; 37 staticConstField = "not_null";
38 38
39 static not_null() => "not_null"; 39 static not_null() => "not_null";
40 static final 40 static final
41 T /// 06: static type warning 41 T /// 06: static type warning, dynamic type error
42 staticFinalField2 = not_null(); 42 staticFinalField2 = not_null();
43 43
44 // Assigning null to a malformed type is not a dynamic error. 44 // Assigning null to a malformed type is not a dynamic error.
45 static 45 static
46 T staticMethod2(T a) { 46 T staticMethod2(T a) {
47 final T a = null; 47 final T a = null;
48 print(a); 48 print(a);
49 return a; 49 return a;
50 } 50 }
51 51
(...skipping 20 matching lines...) Expand all
72 72
73 A.staticMethod("not_null"); 73 A.staticMethod("not_null");
74 print(A.staticFinalField); 74 print(A.staticFinalField);
75 print(A.staticConstField); 75 print(A.staticConstField);
76 print(A.staticFinalField2); 76 print(A.staticFinalField2);
77 77
78 A.staticMethod2(null); 78 A.staticMethod2(null);
79 print(A.staticFinalField3); 79 print(A.staticFinalField3);
80 print(A.staticFinalField4); 80 print(A.staticFinalField4);
81 } 81 }
OLDNEW
« no previous file with comments | « dart/tests/language/on_catch_malformed_type_test.dart ('k') | dart/tests/standalone/io/http_connection_info_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698