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

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

Issue 185053005: Revert "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 // new G2<lib.C>() does not give a dynamic type error because a malformed
30 // type used as type-parameter is treated as dynamic.
31 var g2 = new G2<lib.C>(); /// new_generic2: static type warning
32 var g3 = new lib.G<lib.C>(); /// new_generic3: static type warning
33 var instance = lib.constantInstance;
34 bool a7 = instance is lib.Const; /// is_check: runtime error, static type wa rning
35 instance as lib.Const; /// as_operation: runtime error, static type warning
36 try { throw inst; } on lib.C {} /// catch_check: runtime error, static type warning
37 int i = lib.C.staticMethod(); /// static_method: ok
38 });
39 }
40
41 lib.C a9 = null; /// type_annotation_top_level: static type warning
OLDNEW
« no previous file with comments | « tests/language/deferred_constraints_lib2.dart ('k') | tests/language/deferred_duplicate_prefix1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698