| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
| 7 | 7 |
| 8 @lazy import "deferred_constraints_lib.dart" as lib; | 8 @lazy import "deferred_constraints_lib.dart" as lib; |
| 9 import "deferred_constraints_lib.dart" as lib2; /// type_annotation_non_deferred
: ok | 9 import "deferred_constraints_lib.dart" as lib2; /// type_annotation_non_deferred
: ok |
| 10 | 10 |
| 11 const lazy = const DeferredLibrary('lib'); | 11 const lazy = const DeferredLibrary('lib'); |
| 12 | 12 |
| 13 class F {} | 13 class F {} |
| 14 class G2<T> {} | 14 class G2<T> {} |
| 15 | 15 |
| 16 void f({a: const lib.Const()}) {} /// const_default_argument: compile-time error |
| 17 |
| 18 @lib.Const() class H {} /// const_annotation: compile-time error |
| 19 |
| 16 void main() { | 20 void main() { |
| 17 Expect.throws(() { /// type_annotation1: static type warning | 21 Expect.throws(() { /// type_annotation1: static type warning |
| 18 lib.C a = new lib.C(); /// type_annotation1: continued | 22 lib.C a = new lib.C(); /// type_annotation1: continued |
| 19 }, (e) => e is NoSuchMethodError); /// type_annotation1: continued | 23 }, (e) => e is NoSuchMethodError); /// type_annotation1: continued |
| 20 lib.C a = null; /// type_annotation_null: static type warning | 24 lib.C a = null; /// type_annotation_null: static type warning |
| 21 | 25 |
| 22 // In this case we do not defer C. | 26 // In this case we do not defer C. |
| 23 lib2.C a1 = new lib2.C(); /// type_annotation_non_deferred: continued | 27 lib2.C a1 = new lib2.C(); /// type_annotation_non_deferred: continued |
| 24 lazy.load().then((_) { | 28 lazy.load().then((_) { |
| 25 lib.C a2 = new lib.C(); /// type_annotation2: dynamic type error, static typ
e warning | 29 lib.C a2 = new lib.C(); /// type_annotation2: dynamic type error, static typ
e warning |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 Expect.throws(() { /// is_check: static type warning | 41 Expect.throws(() { /// is_check: static type warning |
| 38 bool a7 = instance is lib.Const; /// is_check: continued | 42 bool a7 = instance is lib.Const; /// is_check: continued |
| 39 }, (e) => e is TypeError); /// is_check: continued | 43 }, (e) => e is TypeError); /// is_check: continued |
| 40 Expect.throws(() { /// as_operation: static type warning | 44 Expect.throws(() { /// as_operation: static type warning |
| 41 instance as lib.Const; /// as_operation: continued | 45 instance as lib.Const; /// as_operation: continued |
| 42 }, (e) => e is TypeError); /// as_operation: continued | 46 }, (e) => e is TypeError); /// as_operation: continued |
| 43 Expect.throws(() { /// catch_check: static type warning | 47 Expect.throws(() { /// catch_check: static type warning |
| 44 try { throw instance; } on lib.Const {} /// catch_check: continued | 48 try { throw instance; } on lib.Const {} /// catch_check: continued |
| 45 }, (e) => e is TypeError); /// catch_check: continued | 49 }, (e) => e is TypeError); /// catch_check: continued |
| 46 int i = lib.C.staticMethod(); /// static_method: ok | 50 int i = lib.C.staticMethod(); /// static_method: ok |
| 51 var c1 = const lib.Const(); /// const: compile-time error |
| 52 f(); /// const_default_argument: continued |
| 53 var constInstance = lib.constantInstance; /// const_instance: ok |
| 54 var h = new H(); /// const_annotation: continued |
| 47 }); | 55 }); |
| 48 } | 56 } |
| 49 | 57 |
| 50 lib.C a9 = null; /// type_annotation_top_level: static type warning | 58 lib.C a9 = null; /// type_annotation_top_level: static type warning |
| OLD | NEW |