File tree Expand file tree Collapse file tree 17 files changed +481
-0
lines changed
patch_static_initializer_with_closure
run_new_field_initializers_syntax_error2
run_new_field_initializers_syntax_error
shape_change_mutual_reference Expand file tree Collapse file tree 17 files changed +481
-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+ 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/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L3546
10+
11+ enum Fruit { Apple , Banana }
12+
13+ helper () {
14+ String r = '' ;
15+ r += Fruit .Apple .toString ();
16+ r += ' ' ;
17+ r += Fruit .Banana .toString ();
18+ return r;
19+ }
20+
21+ Future <void > main () async {
22+ Expect .equals ('Fruit.Apple Fruit.Banana' , helper ());
23+ await hotReload ();
24+
25+ Expect .equals ('Fruit.Apple Fruit.Cantaloupe Fruit.Banana' , helper ());
26+ }
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/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L3546
10+
11+ enum Fruit { Apple , Cantaloupe , Banana }
12+
13+ helper () {
14+ String r = '' ;
15+ r += Fruit .Apple .toString ();
16+ r += ' ' ;
17+ r += Fruit .Cantaloupe .toString ();
18+ r += ' ' ;
19+ r += Fruit .Banana .toString ();
20+ return r;
21+ }
22+
23+ Future <void > main () async {
24+ Expect .equals ('Fruit.Apple Fruit.Banana' , helper ());
25+ await hotReload ();
26+
27+ Expect .equals ('Fruit.Apple Fruit.Cantaloupe Fruit.Banana' , helper ());
28+ }
29+
30+ /** DIFF **/
31+ /*
32+ // Adapted from:
33+ // https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L3546
34+
35+ -enum Fruit { Apple, Banana }
36+ +enum Fruit { Apple, Cantaloupe, Banana }
37+
38+ helper() {
39+ String r = '';
40+ r += Fruit.Apple.toString();
41+ r += ' ';
42+ + r += Fruit.Cantaloupe.toString();
43+ + r += ' ';
44+ r += Fruit.Banana.toString();
45+ return r;
46+ }
47+ */
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/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L47
10+
11+ helper () {
12+ return 4 ;
13+ }
14+
15+ Future <void > main () async {
16+ Expect .equals (4 , helper ());
17+ await hotReload ();
18+
19+ Expect .equals (10 , helper ());
20+ }
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/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L47
10+
11+ helper () {
12+ return 10 ;
13+ }
14+
15+ Future <void > main () async {
16+ Expect .equals (4 , helper ());
17+ await hotReload ();
18+
19+ Expect .equals (10 , helper ());
20+ }
21+
22+ /** DIFF **/
23+ /*
24+ // https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L47
25+
26+ helper() {
27+ - return 4;
28+ + return 10;
29+ }
30+
31+ Future<void> main() async {
32+ */
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/174ce4005f34bc860d1a4189ff21292b0796c94b/runtime/vm/isolate_reload_test.cc#L6091
10+
11+ dynamic field = (a) => 'a$a ' ;
12+
13+ Future <void > main () async {
14+ dynamic f = field;
15+ Expect .equals ('ab' , f ('b' ));
16+ await hotReload ();
17+
18+ dynamic g = field;
19+ Expect .equals ('ac' , g ('c' ));
20+ }
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/174ce4005f34bc860d1a4189ff21292b0796c94b/runtime/vm/isolate_reload_test.cc#L6091
10+
11+ dynamic field = (_, __) => 'Not executed' ;
12+
13+ Future <void > main () async {
14+ dynamic f = field;
15+ Expect .equals ('ab' , f ('b' ));
16+ await hotReload ();
17+
18+ dynamic g = field;
19+ Expect .equals ('ac' , g ('c' ));
20+ }
21+
22+ /** DIFF **/
23+ /*
24+ // Adapted from:
25+ // https://github.com/dart-lang/sdk/blob/174ce4005f34bc860d1a4189ff21292b0796c94b/runtime/vm/isolate_reload_test.cc#L6091
26+
27+ -dynamic field = (a) => 'a$a';
28+ +dynamic field = (_, __) => 'Not executed';
29+
30+ Future<void> main() async {
31+ dynamic f = field;
32+ */
Original file line number Diff line number Diff line change 1+ {
2+ "expectedErrors" : {
3+ "1" : " Error: Expected an identifier, but got '...'"
4+ }
5+ }
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/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L5209
10+
11+ // When an initializer expression has a syntax error, we detect it at reload
12+ // time.
13+
14+ class Foo {
15+ int x = 4 ;
16+ }
17+
18+ late Foo value;
19+ helper () {
20+ value = Foo ();
21+ return value.x;
22+ }
23+
24+ Future <void > main () async {
25+ Expect .equals (4 , helper ());
26+ // Add the field y with a syntax error in the initializing expression.
27+ // The reload fails because the initializing expression is parsed at
28+ // class finalization time.
29+ await hotReload (expectRejection: true );
30+ }
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/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L5209
10+
11+ // When an initializer expression has a syntax error, we detect it at reload
12+ // time.
13+
14+ class Foo {
15+ int x = 4 ;
16+ int y = ......;
17+ }
18+
19+ late Foo value;
20+ helper () {
21+ return value.y;
22+ }
23+
24+ Future <void > main () async {
25+ Expect .equals (4 , helper ());
26+ // Add the field y with a syntax error in the initializing expression.
27+ // The reload fails because the initializing expression is parsed at
28+ // class finalization time.
29+ await hotReload (expectRejection: true );
30+ }
31+
32+ /** DIFF **/
33+ /*
34+
35+ class Foo {
36+ int x = 4;
37+ + int y = ......;
38+ }
39+
40+ late Foo value;
41+ helper() {
42+ - value = Foo();
43+ - return value.x;
44+ + return value.y;
45+ }
46+
47+ Future<void> main() async {
48+ */
Original file line number Diff line number Diff line change 1+ {
2+ "expectedErrors" : {
3+ "1" : " Error: Expected an identifier, but got '...'"
4+ }
5+ }
You can’t perform that action at this time.
0 commit comments