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

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

Issue 195983006: Constrain constant references from deferred libraries (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 import 'package:expect/expect.dart';
7 import 'package:async_helper/async_helper.dart';
8
9 @lazy import "deferred_constraints_constants_lib.dart" as lib;
10
11 const lazy = const DeferredLibrary('lib');
12
13 const myConst1 = lib.constantInstance; /// reference1: compile-time error
14 const myConst2 = lib.Const.instance; /// reference2: compile-time error
15
16 void f1({a: const lib.Const()}) {} /// default_argument1: compile-time error
floitsch 2014/03/12 16:48:13 Try to reduce the coverage of the "///". If this l
17 void f2({a: lib.constantInstance}) {} /// default_argument2: compile-time error
18
19 @lib.Const() class H1 {} /// metadata1: compile-time error
floitsch 2014/03/12 16:48:13 @lib.Const() /// metadata1: compile-time error cl
20 @lib.Const.instance class H2 {} /// metadata2: compile-time error
21 @lib.Const.namedConstructor() class H3 {} /// metadata3: compile-time error
22
23 void main() {
24 var a1 = myConst1; /// reference1: continued
25 var a2 = myConst2; /// reference2: continued
26
27 asyncStart();
28 lazy.load().then((_) {
29 var instance = lib.constantInstance;
30 var c1 = const lib.Const(); /// constructor1: compile-time error
31 var c2 = const lib.Const.namedConstructor(); /// constructor2: compile-time error
32 f1(); /// default_argument1: continued
33 f2(); /// default_argument2: continued
34 var constInstance = lib.constantInstance; /// reference_after_load: ok
35 var h1 = new H1(); /// metadata1: continued
36 var h2 = new H2(); /// metadata2: continued
37 var h3 = new H3(); /// metadata3: continued
38 asyncEnd();
39 });
40 }
41
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698