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

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

Issue 2938443003: Add type inference for assignments to `this[...]` (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 this /*@target=Test::[]=*/ [
29 /*@typeArgs=dynamic*/ f()] = /*@typeArgs=B*/ f();
30 this /*@target=Test::[]=*/ [
31 /*@typeArgs=dynamic*/ f()] ??= /*@typeArgs=B*/ f();
32 this /*@target=Test::[]=*/ [
33 /*@typeArgs=dynamic*/ f()] += /*@typeArgs=dynamic*/ f();
34 this /*@target=Test::[]=*/ [
35 /*@typeArgs=dynamic*/ f()] *= /*@typeArgs=dynamic*/ f();
36 this /*@target=Test::[]=*/ [
37 /*@typeArgs=dynamic*/ f()] &= /*@typeArgs=dynamic*/ f();
38 --this /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()];
39 this /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()]--;
40 var /*@type=B*/ v1 = this /*@target=Test::[]=*/ [
41 /*@typeArgs=dynamic*/ f()] = /*@typeArgs=B*/ f();
42 var /*@type=B*/ v2 = this /*@target=Test::[]=*/ [
43 /*@typeArgs=dynamic*/ f()] ??= /*@typeArgs=B*/ f();
44 var /*@type=A*/ v3 = this /*@target=Test::[]=*/ [
45 /*@typeArgs=dynamic*/ f()] += /*@typeArgs=dynamic*/ f();
46 var /*@type=B*/ v4 = this /*@target=Test::[]=*/ [
47 /*@typeArgs=dynamic*/ f()] *= /*@typeArgs=dynamic*/ f();
48 var /*@type=C*/ v5 = this /*@target=Test::[]=*/ [
49 /*@typeArgs=dynamic*/ f()] &= /*@typeArgs=dynamic*/ f();
50 var /*@type=B*/ v6 =
51 --this /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()];
52 var /*@type=B*/ v7 =
53 this /*@target=Test::[]=*/ [/*@typeArgs=dynamic*/ f()]--;
54 }
55 }
56
57 main() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698