fix #27643, failed to virtualize fields if an abstract one is mixed in

R=vsm@google.com

Review URL: https://codereview.chromium.org/2441693003 .
This commit is contained in:
Jennifer Messerly 2016-10-20 16:31:06 -07:00
parent 3c44a09882
commit 95ef8bb59a
3 changed files with 47 additions and 4 deletions

View file

@ -30,10 +30,6 @@ PropertyOverrideResult checkForPropertyOverride(
var setter = superprop.setter;
bool hasSetter = setter != null && !setter.isAbstract;
if (hasSetter) foundSetter = true;
// Stop if this is an abstract getter/setter
// TODO(jmesserly): why were we doing this?
if (!hasGetter && !hasSetter) break;
}
return new PropertyOverrideResult(foundGetter, foundSetter);

View file

@ -0,0 +1,43 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:expect/expect.dart';
abstract class B {
int get x;
}
class C {
int get x => 42;
}
class D extends C with B {
final int x;
D(this.x);
}
class C2 {
int get x => 42;
}
abstract class B2 extends C2 {
int get x;
}
class D2 extends B2 {
final int x;
D2(this.x);
}
void main() {
var d = new D(17);
Expect.equals(d.x, 17);
var d2 = new D2(17);
Expect.equals(d.x, 17);
}

View file

@ -1,3 +1,7 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math' hide Rectangle;
import 'dart:math' as math show Point, Rectangle, MutableRectangle;
import 'package:expect/expect.dart' show Expect;