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

Side by Side Diff: pkg/front_end/testcases/inference/infer_assign_to_static_upwards.dart

Issue 2933643002: Implement type inference for assignments to a static variable. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
(Empty)
1 // Copyright (c) 2017, 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 /*@testedFeatures=inference*/
6 library test;
7
8 int getInt() => 0;
9 num getNum() => 0;
10 double getDouble() => 0.0;
11
12 int topLevelInt;
13 num topLevelNum;
14 double topLevelDouble;
15
16 void test1() {
17 var /*@type=int*/ v1 = topLevelInt = getInt();
18 var /*@type=num*/ v2 = topLevelInt = getNum();
19 var /*@type=int*/ v4 = topLevelInt ??= getInt();
20 var /*@type=num*/ v5 = topLevelInt ??= getNum();
21 var /*@type=int*/ v7 = topLevelInt += getInt();
22 var /*@type=num*/ v8 = topLevelInt += getNum();
23 var /*@type=int*/ v10 = ++topLevelInt;
24 var /*@type=int*/ v11 = topLevelInt++;
25 }
26
27 void test2() {
28 var /*@type=int*/ v1 = topLevelNum = getInt();
29 var /*@type=num*/ v2 = topLevelNum = getNum();
30 var /*@type=double*/ v3 = topLevelNum = getDouble();
31 var /*@type=num*/ v4 = topLevelNum ??= getInt();
32 var /*@type=num*/ v5 = topLevelNum ??= getNum();
33 var /*@type=num*/ v6 = topLevelNum ??= getDouble();
34 var /*@type=num*/ v7 = topLevelNum += getInt();
35 var /*@type=num*/ v8 = topLevelNum += getNum();
36 var /*@type=num*/ v9 = topLevelNum += getDouble();
37 var /*@type=num*/ v10 = ++topLevelNum;
38 var /*@type=num*/ v11 = topLevelNum++;
39 }
40
41 void test3() {
42 var /*@type=num*/ v2 = topLevelDouble = getNum();
43 var /*@type=double*/ v3 = topLevelDouble = getDouble();
44 var /*@type=num*/ v5 = topLevelDouble ??= getNum();
45 var /*@type=double*/ v6 = topLevelDouble ??= getDouble();
46 var /*@type=double*/ v7 = topLevelDouble += getInt();
47 var /*@type=double*/ v8 = topLevelDouble += getNum();
48 var /*@type=double*/ v9 = topLevelDouble += getDouble();
49 var /*@type=double*/ v10 = ++topLevelDouble;
50 var /*@type=double*/ v11 = topLevelDouble++;
51 }
52
53 main() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698