File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed
Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) 2021, 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 https://github.com/dart-lang/sdk/issues/46867
6+
7+ import 'package:expect/expect.dart' ;
8+
9+ class Interface {
10+ covariant Object x = 'from Interface' ;
11+ }
12+
13+ mixin Mixin implements Interface {}
14+
15+ class BaseClass {
16+ static var getterCallCount = 0 ;
17+ static var setterCallCount = 0 ;
18+ Object get x => getterCallCount++ ;
19+ set x (Object value) => setterCallCount++ ;
20+ }
21+
22+ class SubClass extends BaseClass with Mixin {}
23+
24+ void main () {
25+ Expect .equals (0 , BaseClass .getterCallCount);
26+ SubClass ().x;
27+ Expect .equals (1 , BaseClass .getterCallCount);
28+
29+ Expect .equals (0 , BaseClass .setterCallCount);
30+ SubClass ().x = 42 ;
31+ Expect .equals (1 , BaseClass .setterCallCount);
32+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2021, 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+ // @dart = 2.9
6+
7+ // Regression test for https://github.com/dart-lang/sdk/issues/46867
8+
9+ import 'package:expect/expect.dart' ;
10+
11+ class Interface {
12+ covariant Object x = 'from Interface' ;
13+ }
14+
15+ mixin Mixin implements Interface {}
16+
17+ class BaseClass {
18+ static var getterCallCount = 0 ;
19+ static var setterCallCount = 0 ;
20+ Object get x => getterCallCount++ ;
21+ set x (Object value) => setterCallCount++ ;
22+ }
23+
24+ class SubClass extends BaseClass with Mixin {}
25+
26+ void main () {
27+ Expect .equals (0 , BaseClass .getterCallCount);
28+ SubClass ().x;
29+ Expect .equals (1 , BaseClass .getterCallCount);
30+
31+ Expect .equals (0 , BaseClass .setterCallCount);
32+ SubClass ().x = 42 ;
33+ Expect .equals (1 , BaseClass .setterCallCount);
34+ }
You can’t perform that action at this time.
0 commit comments