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

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

Issue 10913081: Fix resolution of type parameters in static context, and the use of type parameters in closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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_dart2js.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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class A<T> {
6 Function closure;
7 A._(this.closure);
8
9 factory A() {
10 return new A._(() => new Set<T>());
11 }
12
13 A.bar() {
14 closure = () => new Set<T>();
15 }
16
17 static
18 T /// 01: static type warning, dynamic type error
19 staticMethod(
20 T /// 02: static type warning, dynamic type error
21 a) {
22 final
23 T /// 03: static type warning, dynamic type error
24 a = null;
25 print(a);
26 }
27
28 static final
29 T /// 04: static type warning, dynamic type error
30 staticField = null;
31 }
32
33 main() {
34 var s = ((new A()).closure)();
35 Expect.isTrue(s is Set);
36
37 s = ((new A.bar()).closure)();
38 Expect.isTrue(s is Set);
39
40 s = ((new A<int>()).closure)();
41 Expect.isTrue(s is Set<int>);
42 Expect.isFalse(s is Set<double>);
43
44 s = ((new A<int>.bar()).closure)();
45 Expect.isTrue(s is Set<int>);
46 Expect.isFalse(s is Set<double>);
47
48 A.staticMethod(null);
49 print(A.staticField);
50 }
OLDNEW
« no previous file with comments | « tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698