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

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

Issue 177543002: Constrain type annotations with deferred types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months 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) 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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "dart:async";
6
7 @lazy import "deferred_constraints_lib.dart" as lib;
8 import "deferred_constraints_lib.dart" as lib2; /// type_annotation_non_deferred : ok
9
10 const lazy = const DeferredLibrary('lib');
11
12 class F {}
13 class G2<T> {}
14
15 void main() {
16 lib.C a = new lib.C(); /// type_annotation1: runtime error, static type warnin g
17 lib.C a = null; /// type_annotation_null: static type warning
18
19 // In this case we do not defer C.
20 lib2.C a1 = new lib2.C(); /// type_annotation_non_deferred: continued
21 lazy.load().then((_) {
22 lib.C a2 = new lib.C(); /// type_annotation2: dynamic type error, static typ e warning
23 lib.G<F> a3 = new lib.G<F>(); /// type_annotation_generic1: dynamic type err or, static type warning
24 G2<lib.C> a4 = new G2(); /// type_annotation_generic2: static type warning
25 G2<lib.C> a5 = new G2<lib.C>(); /// type_annotation_generic3: static type wa rning
26 lib.G<lib.C> a = new lib.G<lib.C>(); /// type_annotation_generic4: dynamic t ype error, static type warning
27 var a6 = new lib.C(); /// new: ok
28 var g1 = new lib.G<F>(); /// new_generic1: ok
29 var g2 = new G2<lib.C>(); /// new_generic2: static type warning
floitsch 2014/03/03 14:18:06 Add comment explaining why this is still (at runti
sigurdm 2014/03/04 12:36:19 Done.
30 var g3 = new lib.G<lib.C>(); /// new_generic3: static type warning
31 var instance = lib.constantInstance;
32 bool a7 = instance is lib.Const; /// is_check: runtime error, static type wa rning
33 instance as lib.Const; /// as_operation: runtime error, static type warning
34 try { throw inst; } on lib.C {} /// catch_check: runtime error, static type warning
35 int i = lib.C.staticMethod(); /// static_method: ok
sigurdm 2014/03/03 13:18:49 I added a test of invoking a static method from a
floitsch 2014/03/03 14:18:06 yes.
36 });
37 }
38
39 lib.C a9 = null; /// type_annotation_top_level: static type warning
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698