| OLD | NEW |
| (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 // Test for type arguments and prefixes on special types. |
| 6 |
| 7 class C<T> { |
| 8 C.named(); |
| 9 |
| 10 // This is a syntax error. |
| 11 void<T> voidWithTypeArguments() {} /// 01: compile-time error |
| 12 |
| 13 // This is a malformed type since 'dynamic' is not a generic type. |
| 14 dynamic<T> dynamicWithTypeArguments() => new Object(); /// 02: static type war
ning, dynamic type error |
| 15 |
| 16 // This is a syntax error. |
| 17 void.suffix voidAsPrefix() {} /// 03: compile-time error |
| 18 |
| 19 // This is a malformed type since since 'dynamic' is not a prefix and 'suffix' |
| 20 // therefore cannot be resolved. |
| 21 dynamic.suffix dynamicAsPrefix() => new Object(); /// 04: static type warning,
dynamic type error |
| 22 |
| 23 // This is a syntax error. |
| 24 prefix.void voidWithPrefix() {} /// 05: compile-time error |
| 25 |
| 26 // This is a malformed type since 'prefix' cannot be resolved. |
| 27 prefix.dynamic dynamicWithPrefix() => new Object(); /// 06: static type warnin
g, dynamic type error |
| 28 |
| 29 // This is a malformed type since 'T' is not a generic type. |
| 30 T<int> typeVariableWithTypeArguments() => new Object(); /// 07: static type wa
rning, dynamic type error |
| 31 |
| 32 // This is a malformed type since 'T' is in a static member and is not a |
| 33 // generic type. |
| 34 static T<int> staticTypeVariableWithTypeArguments() => new Object(); /// 08: s
tatic type warning, dynamic type error |
| 35 |
| 36 // This is a malformed type since 'C' is not a prefix. |
| 37 C.named constructorName() => new C.named(); /// 09: static type warning, dynam
ic type error |
| 38 } |
| 39 |
| 40 main() { |
| 41 var c = new C<int>.named(); |
| 42 |
| 43 c.voidWithTypeArguments(); /// 01: continued |
| 44 c.dynamicWithTypeArguments(); /// 02: continued |
| 45 c.voidAsPrefix(); /// 03: continued |
| 46 c.dynamicAsPrefix(); /// 04: continued |
| 47 c.voidWithPrefix(); /// 05: continued |
| 48 c.dynamicWithPrefix(); /// 06: continued |
| 49 c.typeVariableWithTypeArguments(); /// 07: continued |
| 50 C.staticTypeVariableWithTypeArguments(); /// 08: continued |
| 51 c.constructorName(); /// 09: continued |
| 52 } |
| 53 |
| OLD | NEW |