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

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

Issue 2926763003: Add type inference for complex assignments whose LHS is an index expression. (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 class Index {}
9
10 class A {}
11
12 class B extends A {
13 A operator +(C v) => null;
14 B operator -(int i) => null;
15 B operator *(B v) => null;
16 C operator &(A v) => null;
17 }
18
19 class C extends B {}
20
21 T f<T>() => null;
22
23 class Test {
24 B operator [](Index i) => null;
25 void operator []=(Index i, B v) {}
26
27 void test() {
28 Test t = /*@typeArgs=Test*/ f();
29 t /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()] = /*@typeArgs=B*/ f();
30 t /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()] ??= /*@typeArgs=B*/ f();
31 t /*@target=Test::[]=*/ [
32 /*@typeArgs=dynamic*/ f()] += /*@typeArgs=dynamic*/ f();
33 t /*@target=Test::[]=*/ [
34 /*@typeArgs=dynamic*/ f()] *= /*@typeArgs=dynamic*/ f();
35 t /*@target=Test::[]=*/ [
36 /*@typeArgs=dynamic*/ f()] &= /*@typeArgs=dynamic*/ f();
37 --t /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()];
38 t /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()]--;
39 var /*@type=B*/ v1 = t /*@target=Test::[]=*/ [
40 /*@typeArgs=dynamic*/ f()] = /*@typeArgs=B*/ f();
41 var /*@type=B*/ v2 = t /*@target=Test::[]=*/ [
42 /*@typeArgs=dynamic*/ f()] ??= /*@typeArgs=B*/ f();
43 var /*@type=A*/ v3 = t /*@target=Test::[]=*/ [
44 /*@typeArgs=dynamic*/ f()] += /*@typeArgs=dynamic*/ f();
45 var /*@type=B*/ v4 = t /*@target=Test::[]=*/ [
46 /*@typeArgs=dynamic*/ f()] *= /*@typeArgs=dynamic*/ f();
47 var /*@type=C*/ v5 = t /*@target=Test::[]=*/ [
48 /*@typeArgs=dynamic*/ f()] &= /*@typeArgs=dynamic*/ f();
49 var /*@type=B*/ v6 = --t /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()];
50 var /*@type=B*/ v7 = t /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()]--;
51 }
52 }
53
54 main() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698