OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import "package:expect/expect.dart"; | |
6 | |
7 // Test class literal expressions. | |
8 | |
9 class Class { | |
10 static fisk() => 42; | |
11 } | |
12 | |
13 foo(x) {} | |
14 | |
15 main() { | |
16 // Verify that dereferencing a class literal is a compile-time error. | |
17 Class(); //# 01: compile-time error | |
18 Class[0]; //# 02: compile-time error | |
19 var x = Class(); //# 03: compile-time error | |
20 var y = Class[0]; //# 04: compile-time error | |
21 var z = Class[0].field; //# 05: compile-time error | |
22 var w = Class[0].method(); //# 06: compile-time error | |
23 foo(Class()); //# 07: compile-time error | |
24 foo(Class[0]); //# 08: compile-time error | |
25 foo(Class[0].field); //# 09: compile-time error | |
26 foo(Class[0].method()); //# 10: compile-time error | |
27 Class[0] = 91; //# 11: compile-time error | |
28 Class++; //# 12: compile-time error | |
29 ++Class; //# 13: compile-time error | |
30 Class[0] += 3; //# 14: compile-time error | |
31 ++Class[0]; //# 15: compile-time error | |
32 Class[0]++; //# 16: compile-time error | |
33 Class.method(); //# 17: compile-time error | |
34 Class.field; //# 18: compile-time error | |
35 var p = Class.method(); //# 19: compile-time error | |
36 var q = Class.field; //# 20: compile-time error | |
37 foo(Class.method()); //# 21: compile-time error | |
38 foo(Class.field); //# 22: compile-time error | |
39 Class / 3; //# 23: compile-time error | |
40 Class += 3; //# 24: compile-time error | |
41 Class.toString(); //# 25: compile-time error | |
42 } | |
OLD | NEW |