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

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

Issue 11412245: MalformedType used for all invalid type annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bug fixes Created 8 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
(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
ahe 2012/11/30 15:44:07 void <T> /// 01: compile-time error voidWithTypeAr
Johnni Winther 2012/12/04 10:07:17 Done.
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
ahe 2012/11/30 15:44:07 May be able to remove "continued" tag if you follo
Johnni Winther 2012/12/04 10:07:17 Done.
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698