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

Side by Side Diff: tests/compiler/dart2js_extra/inference_super_set_call_test.dart

Issue 2508513003: Fix issue #27830: the type of an super-set assignment expression is the type of (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Regression test for dart2js: we incorrectly modeled `super.x = rhs` as a
6 // call and not an assignment, so the type of the expression was incorrectly
7 // assumed to be the return type of the setter rather than the type of the rhs.
8 import 'package:expect/expect.dart';
9
10 abstract class A {
11 set x(v) {}
12 set z(v) {}
13 set y(v) { return 'hi';}
14 }
15
16 class S extends A {
17 var _x; // was bad: inferred as null, than [null | int]
18 var _y = ''; // was bad: inferred as String, rather than [String | int]
19 var _z; // was ok : inferred as [null | int]
20
21 set x(v) {
22 _x = super.x = v;
23 }
24
25 set z(v) {
26 super.z = v;
27 _z = v;
28 }
29
30 set y(v) {
31 _y = super.y = v;
32 }
33
34 get isXNull => _x == null;
35 get isZNull => _z == null;
36 }
37
38 main() {
39 var s = new S()
40 ..x = 2
41 ..y = 2
42 ..z = 2;
43 Expect.equals(false, s.isXNull); // was incorrectly optimized to 'true'
44 Expect.equals(false, s._y is String); // was incorrectly optimized to 'true'
45 Expect.equals(false, s.isZNull); // prints false
46 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698