File tree Expand file tree Collapse file tree 5 files changed +149
-0
lines changed Expand file tree Collapse file tree 5 files changed +149
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, 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+ mixin ImportedMixin {
6+ mixinFunc () => 'mixin' ;
7+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, 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+ import 'lib.dart' show ImportedMixin;
6+ import 'package:expect/expect.dart' ;
7+ import 'package:reload_test/reload_test_utils.dart' ;
8+
9+ // Adapted from:
10+ // https://github.com/dart-lang/sdk/blob/1a486499bf73ee5b007abbe522b94869a1f36d02/runtime/vm/isolate_reload_test.cc#L1222
11+
12+ // Verifies that we assign the correct patch classes for imported
13+ // mixins when we reload.
14+
15+ class A extends Object with ImportedMixin {}
16+
17+ var func = new A ().mixinFunc;
18+
19+ Future <void > main () async {
20+ Expect .equals ('mixin' , func ());
21+ await hotReload ();
22+ Expect .equals ('mixin' , func ());
23+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, 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+ import 'lib.dart' show ImportedMixin;
6+ import 'package:expect/expect.dart' ;
7+ import 'package:reload_test/reload_test_utils.dart' ;
8+
9+ // Adapted from:
10+ // https://github.com/dart-lang/sdk/blob/1a486499bf73ee5b007abbe522b94869a1f36d02/runtime/vm/isolate_reload_test.cc#L1222
11+
12+ // Verifies that we assign the correct patch classes for imported
13+ // mixins when we reload.
14+
15+ class A extends Object with ImportedMixin {}
16+
17+ var func;
18+
19+ Future <void > main () async {
20+ Expect .equals ('mixin' , func ());
21+ await hotReload ();
22+ Expect .equals ('mixin' , func ());
23+ }
24+
25+ /** DIFF **/
26+ /*
27+ @@ -14,7 +14,7 @@
28+
29+ class A extends Object with ImportedMixin {}
30+
31+ -var func = new A().mixinFunc;
32+ +var func;
33+
34+ Future<void> main() async {
35+ Expect.equals('mixin', func());
36+ */
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, 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+ import 'package:expect/expect.dart' ;
6+ import 'package:reload_test/reload_test_utils.dart' ;
7+
8+ // Adapted from:
9+ // https://github.com/dart-lang/sdk/blob/1a486499bf73ee5b007abbe522b94869a1f36d02/runtime/vm/isolate_reload_test.cc#L917
10+
11+ mixin Mixin1 {
12+ var field = 'mixin1' ;
13+ func () => 'mixin1' ;
14+ }
15+
16+ class B extends Object with Mixin1 {}
17+
18+ Future <void > main () async {
19+ var saved = B ();
20+ Expect .equals ('mixin1' , saved.field);
21+ Expect .equals ('mixin1' , saved.func ());
22+ await hotReload ();
23+
24+ // The saved instance of B retains its old field value from mixin1,
25+ // but it gets the new implementation of func from mixin2.
26+ var newer = B ();
27+ Expect .equals ('mixin1' , saved.field);
28+ Expect .equals ('mixin2' , saved.func ());
29+ Expect .equals ('mixin2' , newer.field);
30+ Expect .equals ('mixin2' , newer.func ());
31+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, 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+ import 'package:expect/expect.dart' ;
6+ import 'package:reload_test/reload_test_utils.dart' ;
7+
8+ // Adapted from:
9+ // https://github.com/dart-lang/sdk/blob/1a486499bf73ee5b007abbe522b94869a1f36d02/runtime/vm/isolate_reload_test.cc#L917
10+
11+ mixin Mixin2 {
12+ var field = 'mixin2' ;
13+ func () => 'mixin2' ;
14+ }
15+
16+ class B extends Object with Mixin2 {}
17+
18+ Future <void > main () async {
19+ var saved = B ();
20+ Expect .equals ('mixin1' , saved.field);
21+ Expect .equals ('mixin1' , saved.func ());
22+ await hotReload ();
23+
24+ // The saved instance of B retains its old field value from mixin1,
25+ // but it gets the new implementation of func from mixin2.
26+ var newer = B ();
27+ Expect .equals ('mixin1' , saved.field);
28+ Expect .equals ('mixin2' , saved.func ());
29+ Expect .equals ('mixin2' , newer.field);
30+ Expect .equals ('mixin2' , newer.func ());
31+ }
32+
33+ /** DIFF **/
34+ /*
35+ @@ -8,12 +8,12 @@
36+ // Adapted from:
37+ // https://github.com/dart-lang/sdk/blob/1a486499bf73ee5b007abbe522b94869a1f36d02/runtime/vm/isolate_reload_test.cc#L917
38+
39+ -mixin Mixin1 {
40+ - var field = 'mixin1';
41+ - func() => 'mixin1';
42+ +mixin Mixin2 {
43+ + var field = 'mixin2';
44+ + func() => 'mixin2';
45+ }
46+
47+ -class B extends Object with Mixin1 {}
48+ +class B extends Object with Mixin2 {}
49+
50+ Future<void> main() async {
51+ var saved = B();
52+ */
You can’t perform that action at this time.
0 commit comments