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

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

Issue 22999005: Make analyzer happy and use annotations the right way. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
« no previous file with comments | « tests/language/inferrer_constructor2_test.dart ('k') | tests/language/issue12284_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Regression test for dart2js that used to optimistically infer the 5 // Regression test for dart2js that used to optimistically infer the
6 // wrong types for fields because of generative constructors being 6 // wrong types for fields because of generative constructors being
7 // inlined. 7 // inlined.
8 8
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 import "compiler_annotations.dart"; 10 import "compiler_annotations.dart";
11 11
12 class A { 12 class A {
13 var field; 13 var field;
14 A(this.field); 14 A(this.field);
15 } 15 }
16 16
17 var c = () => new List(42)[0]; 17 var c = () => new List(42)[0];
18 18
19 main() { 19 main() {
20 bar(); 20 bar();
21 // Defeat type inferencing. 21 // Defeat type inferencing.
22 new A(c()); 22 new A(c());
23 doIt(); 23 doIt();
24 bar(); 24 bar();
25 } 25 }
26 26
27 @DontInline 27 @DontInline()
28 doIt() { 28 doIt() {
29 () => 42; 29 () => 42;
30 var c = new A(null); 30 var c = new A(null);
31 Expect.throws(() => c.field + 42, (e) => e is NoSuchMethodError); 31 Expect.throws(() => c.field + 42, (e) => e is NoSuchMethodError);
32 } 32 }
33 33
34 @DontInline 34 @DontInline()
35 bar() { 35 bar() {
36 () => 42; 36 () => 42;
37 return inlineLevel1(); 37 return inlineLevel1();
38 } 38 }
39 39
40 inlineLevel1() { 40 inlineLevel1() {
41 return inlineLevel2(); 41 return inlineLevel2();
42 } 42 }
43 43
44 inlineLevel2() { 44 inlineLevel2() {
45 return inlineLevel3(); 45 return inlineLevel3();
46 } 46 }
47 47
48 inlineLevel3() { 48 inlineLevel3() {
49 return inlineLevel4(); 49 return inlineLevel4();
50 } 50 }
51 51
52 inlineLevel4() { 52 inlineLevel4() {
53 return new A(42); 53 return new A(42);
54 } 54 }
OLDNEW
« no previous file with comments | « tests/language/inferrer_constructor2_test.dart ('k') | tests/language/issue12284_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698