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

Side by Side Diff: tests/language/src/TypeVariableScopeTest.dart

Issue 8921033: Implement revised factories in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // VMOptions=--enable_type_checks 4 // VMOptions=--enable_type_checks
5 5
6 // Test that type variables aren't in scope of static methods and factories. 6 // Test that type variables aren't in scope of static methods and factories.
7 7
8 class Foo<T> { 8 class Foo<T> {
9 // T is not in scope for a static method. 9 // T is not in scope for a static method.
10 static 10 static
11 Foo<T> /// 00: compile-time error 11 Foo<T> /// 00: compile-time error
12 m( 12 m(
13 Foo<T> /// 01: compile-time error 13 Foo<T> /// 01: compile-time error
14 f) { 14 f) {
15 I<T> x; /// 02: compile-time error 15 I<T> x; /// 02: compile-time error
16 } 16 }
17 17
18 // T is not in scope for a static method. 18 // T is in scope for a factory method.
19 factory I<X>( 19 factory I(I<T> i) {
20 I<T> /// 03: compile-time error 20 I<T> x;
21 i) {
22 I<T> x; /// 04: compile-time error
23 } 21 }
24 22
25 // T is not in scope for a static field. 23 // T is not in scope for a static field.
26 static Foo<T> f1; /// 05: compile-time error 24 static Foo<T> f1; /// 03: compile-time error
27 25
28 static 26 static
29 Foo<T> /// 06: compile-time error 27 Foo<T> /// 04: compile-time error
30 get f() { return null; } 28 get f() { return null; }
31 29
32 static void set f( 30 static void set f(
33 Foo<T> /// 07: compile-time error 31 Foo<T> /// 05: compile-time error
34 value) {} 32 value) {}
35 } 33 }
36 34
37 interface I<X> factory Foo<T> { 35 interface I<T> factory Foo<T> {
38 I(I<X> i); 36 I(I<T> i);
39 } 37 }
40 38
41 main() { 39 main() {
42 Foo.m(null); 40 Foo.m(null);
43 new I(null); 41 new I(null);
44 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698