Skip to content

Commit 0055f0a

Browse files
nshahanCommit Queue
authored andcommitted
[ddc] Add test for super calls after hot reload
Regression test for broken super calls after a hot reload. Issue: #59628 Change-Id: I799cac6babb45f0a8f7d2dd63fdfbaea72dba9b9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398041 Reviewed-by: Nate Biggs <[email protected]> Commit-Queue: Nicholas Shahan <[email protected]> Reviewed-by: Mark Zhou <[email protected]>
1 parent 47e3ad7 commit 0055f0a

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"exclude": []
3+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) 2024, 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+
// Regression test for https://github.com/dart-lang/sdk/issues/59628.
9+
10+
class A {
11+
method() {
12+
return 'A.method';
13+
}
14+
}
15+
16+
class B extends A {
17+
method() {
18+
return '${super.method()} - B.method';
19+
}
20+
}
21+
22+
String unrelatedChange() => 'before';
23+
24+
Future<void> main() async {
25+
Expect.equals('before', unrelatedChange());
26+
var b = B();
27+
Expect.equals('A.method - B.method', b.method());
28+
await hotReload();
29+
Expect.equals('after', unrelatedChange());
30+
Expect.equals('A.method - B.method', b.method());
31+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright (c) 2024, 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+
// Regression test for https://github.com/dart-lang/sdk/issues/59628.
9+
10+
class A {
11+
method() {
12+
return 'A.method';
13+
}
14+
}
15+
16+
class B extends A {
17+
method() {
18+
return '${super.method()} - B.method';
19+
}
20+
}
21+
22+
String unrelatedChange() => 'after';
23+
24+
Future<void> main() async {
25+
Expect.equals('before', unrelatedChange());
26+
var b = B();
27+
Expect.equals('A.method - B.method', b.method());
28+
await hotReload();
29+
Expect.equals('after', unrelatedChange());
30+
Expect.equals('A.method - B.method', b.method());
31+
}
32+
33+
/** DIFF **/
34+
/*
35+
@@ -19,7 +19,7 @@
36+
}
37+
}
38+
39+
-String unrelatedChange() => 'before';
40+
+String unrelatedChange() => 'after';
41+
42+
Future<void> main() async {
43+
Expect.equals('before', unrelatedChange());
44+
@@ -29,3 +29,4 @@
45+
Expect.equals('after', unrelatedChange());
46+
Expect.equals('A.method - B.method', b.method());
47+
}
48+
+
49+
*/

0 commit comments

Comments
 (0)