diff --git a/tests/hot_reload/super_call_regress_59628/config.json b/tests/hot_reload/super_call_regress_59628/config.json new file mode 100644 index 000000000000..b72fb4b01b6d --- /dev/null +++ b/tests/hot_reload/super_call_regress_59628/config.json @@ -0,0 +1,3 @@ +{ + "exclude": [] +} \ No newline at end of file diff --git a/tests/hot_reload/super_call_regress_59628/main.0.dart b/tests/hot_reload/super_call_regress_59628/main.0.dart new file mode 100644 index 000000000000..26efc27fa23a --- /dev/null +++ b/tests/hot_reload/super_call_regress_59628/main.0.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2024, 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. + +import 'package:expect/expect.dart'; +import 'package:reload_test/reload_test_utils.dart'; + +// Regression test for https://github.com/dart-lang/sdk/issues/59628. + +class A { + method() { + return 'A.method'; + } +} + +class B extends A { + method() { + return '${super.method()} - B.method'; + } +} + +String unrelatedChange() => 'before'; + +Future main() async { + Expect.equals('before', unrelatedChange()); + var b = B(); + Expect.equals('A.method - B.method', b.method()); + await hotReload(); + Expect.equals('after', unrelatedChange()); + Expect.equals('A.method - B.method', b.method()); +} diff --git a/tests/hot_reload/super_call_regress_59628/main.1.dart b/tests/hot_reload/super_call_regress_59628/main.1.dart new file mode 100644 index 000000000000..2078d343934e --- /dev/null +++ b/tests/hot_reload/super_call_regress_59628/main.1.dart @@ -0,0 +1,49 @@ +// Copyright (c) 2024, 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. + +import 'package:expect/expect.dart'; +import 'package:reload_test/reload_test_utils.dart'; + +// Regression test for https://github.com/dart-lang/sdk/issues/59628. + +class A { + method() { + return 'A.method'; + } +} + +class B extends A { + method() { + return '${super.method()} - B.method'; + } +} + +String unrelatedChange() => 'after'; + +Future main() async { + Expect.equals('before', unrelatedChange()); + var b = B(); + Expect.equals('A.method - B.method', b.method()); + await hotReload(); + Expect.equals('after', unrelatedChange()); + Expect.equals('A.method - B.method', b.method()); +} + +/** DIFF **/ +/* +@@ -19,7 +19,7 @@ + } + } + +-String unrelatedChange() => 'before'; ++String unrelatedChange() => 'after'; + + Future main() async { + Expect.equals('before', unrelatedChange()); +@@ -29,3 +29,4 @@ + Expect.equals('after', unrelatedChange()); + Expect.equals('A.method - B.method', b.method()); + } ++ +*/