OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 | 7 |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 import 'package:compiler/src/constants/expressions.dart'; | 10 import 'package:compiler/src/constants/expressions.dart'; |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 main() { | 1220 main() { |
1221 mname() { }; | 1221 mname() { }; |
1222 mname = 3; | 1222 mname = 3; |
1223 } | 1223 } |
1224 ''', [MessageKind.ASSIGNING_METHOD]); | 1224 ''', [MessageKind.ASSIGNING_METHOD]); |
1225 | 1225 |
1226 // Can't override top-level functions | 1226 // Can't override top-level functions |
1227 checkWarningOn(''' | 1227 checkWarningOn(''' |
1228 m() {} | 1228 m() {} |
1229 main() { m = 4; } | 1229 main() { m = 4; } |
1230 ''', [MessageKind.ASSIGNING_METHOD]); | 1230 ''', [MessageKind.ASSIGNING_METHOD, |
| 1231 // TODO(johnniwinther): Avoid duplicate warnings. |
| 1232 MessageKind.NOT_ASSIGNABLE]); |
1231 | 1233 |
1232 // Can't override instance methods | 1234 // Can't override instance methods |
1233 checkWarningOn(''' | 1235 checkWarningOn(''' |
1234 main() { new B().bar(); } | 1236 main() { new B().bar(); } |
1235 class B { | 1237 class B { |
1236 mname() {} | 1238 mname() {} |
1237 bar() { | 1239 bar() { |
1238 mname = () => null; | 1240 mname = () => null; |
1239 } | 1241 } |
1240 } | 1242 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 } | 1414 } |
1413 main() => A.m(); | 1415 main() => A.m(); |
1414 ''', functionName: 'm'); | 1416 ''', functionName: 'm'); |
1415 check(''' | 1417 check(''' |
1416 class A { | 1418 class A { |
1417 m() => () => await - 3; | 1419 m() => () => await - 3; |
1418 } | 1420 } |
1419 main() => new A().m(); | 1421 main() => new A().m(); |
1420 ''', className: 'A'); | 1422 ''', className: 'A'); |
1421 } | 1423 } |
OLD | NEW |