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

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

Issue 2935783003: Add type inference for assignments to `super[...]` (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 Base {
24 B operator [](Index i) => null;
25 void operator []=(Index i, B v) {}
26 }
27
28 class Test extends Base {
29 void test() {
30 super /*@target=Base::[]=*/ [
31 /*@typeArgs=dynamic*/ f()] = /*@typeArgs=B*/ f();
32 super /*@target=Base::[]=*/ [
33 /*@typeArgs=dynamic*/ f()] ??= /*@typeArgs=B*/ f();
34 super /*@target=Base::[]=*/ [
35 /*@typeArgs=dynamic*/ f()] += /*@typeArgs=dynamic*/ f();
36 super /*@target=Base::[]=*/ [
37 /*@typeArgs=dynamic*/ f()] *= /*@typeArgs=dynamic*/ f();
38 super /*@target=Base::[]=*/ [
39 /*@typeArgs=dynamic*/ f()] &= /*@typeArgs=dynamic*/ f();
40 --super /*@target=Base::[]=*/ [/*@typeArgs=dynamic*/ f()];
41 super /*@target=Base::[]=*/ [/*@typeArgs=dynamic*/ f()]--;
42 var /*@type=B*/ v1 = super /*@target=Base::[]=*/ [
43 /*@typeArgs=dynamic*/ f()] = /*@typeArgs=B*/ f();
44 var /*@type=B*/ v2 = super /*@target=Base::[]=*/ [
45 /*@typeArgs=dynamic*/ f()] ??= /*@typeArgs=B*/ f();
46 var /*@type=A*/ v3 = super /*@target=Base::[]=*/ [
47 /*@typeArgs=dynamic*/ f()] += /*@typeArgs=dynamic*/ f();
48 var /*@type=B*/ v4 = super /*@target=Base::[]=*/ [
49 /*@typeArgs=dynamic*/ f()] *= /*@typeArgs=dynamic*/ f();
50 var /*@type=C*/ v5 = super /*@target=Base::[]=*/ [
51 /*@typeArgs=dynamic*/ f()] &= /*@typeArgs=dynamic*/ f();
52 var /*@type=B*/ v6 =
53 --super /*@target=Base::[]=*/ [/*@typeArgs=dynamic*/ f()];
54 var /*@type=B*/ v7 =
55 super /*@target=Base::[]=*/ [/*@typeArgs=dynamic*/ f()]--;
56 }
57 }
58
59 main() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698