| Index: tests/language/type_annotation_test.dart
|
| diff --git a/tests/language/type_annotation_test.dart b/tests/language/type_annotation_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6ea2ca7fd987c1a12402f2fa31b3f41cc94ec0b0
|
| --- /dev/null
|
| +++ b/tests/language/type_annotation_test.dart
|
| @@ -0,0 +1,53 @@
|
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +// Test for type arguments and prefixes on special types.
|
| +
|
| +class C<T> {
|
| + C.named();
|
| +
|
| + // This is a syntax error.
|
| + void<T> voidWithTypeArguments() {} /// 01: compile-time error
|
| +
|
| + // This is a malformed type since 'dynamic' is not a generic type.
|
| + dynamic<T> dynamicWithTypeArguments() => new Object(); /// 02: static type warning, dynamic type error
|
| +
|
| + // This is a syntax error.
|
| + void.suffix voidAsPrefix() {} /// 03: compile-time error
|
| +
|
| + // This is a malformed type since since 'dynamic' is not a prefix and 'suffix'
|
| + // therefore cannot be resolved.
|
| + dynamic.suffix dynamicAsPrefix() => new Object(); /// 04: static type warning, dynamic type error
|
| +
|
| + // This is a syntax error.
|
| + prefix.void voidWithPrefix() {} /// 05: compile-time error
|
| +
|
| + // This is a malformed type since 'prefix' cannot be resolved.
|
| + prefix.dynamic dynamicWithPrefix() => new Object(); /// 06: static type warning, dynamic type error
|
| +
|
| + // This is a malformed type since 'T' is not a generic type.
|
| + T<int> typeVariableWithTypeArguments() => new Object(); /// 07: static type warning, dynamic type error
|
| +
|
| + // This is a malformed type since 'T' is in a static member and is not a
|
| + // generic type.
|
| + static T<int> staticTypeVariableWithTypeArguments() => new Object(); /// 08: static type warning, dynamic type error
|
| +
|
| + // This is a malformed type since 'C' is not a prefix.
|
| + C.named constructorName() => new C.named(); /// 09: static type warning, dynamic type error
|
| +}
|
| +
|
| +main() {
|
| + var c = new C<int>.named();
|
| +
|
| + c.voidWithTypeArguments(); /// 01: continued
|
| + c.dynamicWithTypeArguments(); /// 02: continued
|
| + c.voidAsPrefix(); /// 03: continued
|
| + c.dynamicAsPrefix(); /// 04: continued
|
| + c.voidWithPrefix(); /// 05: continued
|
| + c.dynamicWithPrefix(); /// 06: continued
|
| + c.typeVariableWithTypeArguments(); /// 07: continued
|
| + C.staticTypeVariableWithTypeArguments(); /// 08: continued
|
| + c.constructorName(); /// 09: continued
|
| +}
|
| +
|
|
|