-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue: #46867 Change-Id: I7e2912752ac8c48df233f27869599280e2c322fa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209853 Reviewed-by: Mark Zhou <[email protected]> Commit-Queue: Nicholas Shahan <[email protected]>
- Loading branch information
1 parent
d904834
commit a899525
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2021, 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. | ||
|
||
// Regression test for https://github.com/dart-lang/sdk/issues/46867 | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class Interface { | ||
covariant Object x = 'from Interface'; | ||
} | ||
|
||
mixin Mixin implements Interface {} | ||
|
||
class BaseClass { | ||
static var getterCallCount = 0; | ||
static var setterCallCount = 0; | ||
Object get x => getterCallCount++; | ||
set x(Object value) => setterCallCount++; | ||
} | ||
|
||
class SubClass extends BaseClass with Mixin {} | ||
|
||
void main() { | ||
Expect.equals(0, BaseClass.getterCallCount); | ||
SubClass().x; | ||
Expect.equals(1, BaseClass.getterCallCount); | ||
|
||
Expect.equals(0, BaseClass.setterCallCount); | ||
SubClass().x = 42; | ||
Expect.equals(1, BaseClass.setterCallCount); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2021, 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. | ||
|
||
// @dart = 2.9 | ||
|
||
// Regression test for https://github.com/dart-lang/sdk/issues/46867 | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class Interface { | ||
covariant Object x = 'from Interface'; | ||
} | ||
|
||
mixin Mixin implements Interface {} | ||
|
||
class BaseClass { | ||
static var getterCallCount = 0; | ||
static var setterCallCount = 0; | ||
Object get x => getterCallCount++; | ||
set x(Object value) => setterCallCount++; | ||
} | ||
|
||
class SubClass extends BaseClass with Mixin {} | ||
|
||
void main() { | ||
Expect.equals(0, BaseClass.getterCallCount); | ||
SubClass().x; | ||
Expect.equals(1, BaseClass.getterCallCount); | ||
|
||
Expect.equals(0, BaseClass.setterCallCount); | ||
SubClass().x = 42; | ||
Expect.equals(1, BaseClass.setterCallCount); | ||
} |