[ddc] Porting VM hot reload tests to the hot reload framework related to type updates.
Change-Id: I3c42781acd253ac82658593c96ab92ef6c2cdb50 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392466 Commit-Queue: Mark Zhou <markzipan@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5493
|
||||
|
||||
// Note: The original VM test checks for allocated objects on the heap after a
|
||||
// hot reload. There isn't an obvious web analogue, so we've left this off
|
||||
// unless this side effect becomes visible across platforms.
|
||||
|
||||
class C {
|
||||
int value = 42;
|
||||
}
|
||||
|
||||
class Foo {
|
||||
static var x = C();
|
||||
}
|
||||
|
||||
late var closure;
|
||||
|
||||
helper() {
|
||||
closure = () => Foo.x.value;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
helper();
|
||||
Expect.equals(42, closure());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws(closure);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5493
|
||||
|
||||
// Note: The original VM test checks for allocated objects on the heap after a
|
||||
// hot reload. There isn't an obvious web analogue, so we've left this off
|
||||
// unless this side effect becomes visible across platforms.
|
||||
|
||||
class C {
|
||||
int value = 42;
|
||||
}
|
||||
|
||||
class Foo {}
|
||||
|
||||
late var closure;
|
||||
|
||||
helper() {}
|
||||
|
||||
Future<void> main() async {
|
||||
helper();
|
||||
Expect.equals(42, closure());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws(closure);
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -16,15 +16,11 @@
|
||||
int value = 42;
|
||||
}
|
||||
|
||||
-class Foo {
|
||||
- static var x = C();
|
||||
-}
|
||||
+class Foo {}
|
||||
|
||||
late var closure;
|
||||
|
||||
-helper() {
|
||||
- closure = () => Foo.x.value;
|
||||
-}
|
||||
+helper() {}
|
||||
|
||||
Future<void> main() async {
|
||||
helper();
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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 'dart:typed_data';
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:reload_test/reload_test_utils.dart';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L5674
|
||||
|
||||
class Foo {
|
||||
int x = 42;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.type<int>(Foo().x);
|
||||
Expect.equals(42, Foo().x);
|
||||
await hotReload();
|
||||
|
||||
Expect.type<String>(Foo().x);
|
||||
Expect.equals('42', Foo().x);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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 'dart:typed_data';
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:reload_test/reload_test_utils.dart';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L5674
|
||||
|
||||
class Foo {
|
||||
String x = '42';
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.type<int>(Foo().x);
|
||||
Expect.equals(42, Foo().x);
|
||||
await hotReload();
|
||||
|
||||
Expect.type<String>(Foo().x);
|
||||
Expect.equals('42', Foo().x);
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -10,7 +10,7 @@
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L5674
|
||||
|
||||
class Foo {
|
||||
- int x = 42;
|
||||
+ String x = '42';
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
@@ -30,7 +30,6 @@ Future<void> main() async {
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains(
|
||||
"type 'B' is not a subtype of type 'A' of 'function result'", helper());
|
||||
Expect.contains("type 'B' is not a subtype of type 'A'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ Future<void> main() async {
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains(
|
||||
"type 'B' is not a subtype of type 'A' of 'function result'", helper());
|
||||
Expect.contains("type 'B' is not a subtype of type 'A'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
/** DIFF **/
|
||||
|
||||
@@ -34,8 +34,6 @@ Future<void> main() async {
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.equals(
|
||||
"type '(A) => bool' is not a subtype of type "
|
||||
"'(B) => bool' of 'function result'",
|
||||
helper());
|
||||
"type '(A) => bool' is not a subtype of type '(B) => bool'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
|
||||
@@ -37,9 +37,7 @@ Future<void> main() async {
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.equals(
|
||||
"type '(A) => bool' is not a subtype of type "
|
||||
"'(B) => bool' of 'function result'",
|
||||
helper());
|
||||
"type '(A) => bool' is not a subtype of type '(B) => bool'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
/** DIFF **/
|
||||
|
||||
@@ -32,7 +32,6 @@ Future<void> main() async {
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.contains(
|
||||
"type 'List<B>' is not a subtype of type 'List<A>' of 'function result'",
|
||||
helper());
|
||||
"type 'List<B>' is not a subtype of type 'List<A>'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ Future<void> main() async {
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.contains(
|
||||
"type 'List<B>' is not a subtype of type 'List<A>' of 'function result'",
|
||||
helper());
|
||||
"type 'List<B>' is not a subtype of type 'List<A>'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
/** DIFF **/
|
||||
|
||||
@@ -30,7 +30,6 @@ Future<void> main() async {
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains(
|
||||
"type 'A' is not a subtype of type 'B' of 'function result'", helper());
|
||||
Expect.contains("type 'A' is not a subtype of type 'B'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ Future<void> main() async {
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains(
|
||||
"type 'A' is not a subtype of type 'B' of 'function result'", helper());
|
||||
Expect.contains("type 'A' is not a subtype of type 'B'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
/** DIFF **/
|
||||
|
||||
@@ -30,7 +30,6 @@ Future<void> main() async {
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains(
|
||||
"type 'B' is not a subtype of type 'A' of 'function result'", helper());
|
||||
Expect.contains("type 'B' is not a subtype of type 'A'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ Future<void> main() async {
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains(
|
||||
"type 'B' is not a subtype of type 'A' of 'function result'", helper());
|
||||
Expect.contains("type 'B' is not a subtype of type 'A'", helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
/** DIFF **/
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5929
|
||||
|
||||
class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
typedef bool Predicate(B b);
|
||||
|
||||
Predicate value = init();
|
||||
init() => (A a) => true;
|
||||
|
||||
String helper() {
|
||||
try {
|
||||
return value.toString();
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.contains('Closure: (A) => bool', helper());
|
||||
|
||||
await hotReload();
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.contains(
|
||||
"type '(A) => bool' is not a subtype of type '(B) => bool'", helper());
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5929
|
||||
|
||||
class A {}
|
||||
|
||||
class B {}
|
||||
|
||||
typedef bool Predicate(B b);
|
||||
|
||||
Predicate value = init();
|
||||
init() => (A a) => true;
|
||||
|
||||
String helper() {
|
||||
try {
|
||||
return value.toString();
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.contains('Closure: (A) => bool', helper());
|
||||
|
||||
await hotReload();
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.contains(
|
||||
"type '(A) => bool' is not a subtype of type '(B) => bool'", helper());
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class A {}
|
||||
|
||||
-class B extends A {}
|
||||
+class B {}
|
||||
|
||||
typedef bool Predicate(B b);
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5841
|
||||
|
||||
class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
List<A> value = init();
|
||||
init() => List<B>.empty();
|
||||
|
||||
String helper() {
|
||||
try {
|
||||
return value.toString();
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('[]', helper());
|
||||
|
||||
await hotReload();
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.contains(
|
||||
"type 'List<B>' is not a subtype of type 'List<A>'", helper());
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5841
|
||||
|
||||
class A {}
|
||||
|
||||
class B {}
|
||||
|
||||
List<A> value = init();
|
||||
init() => List<B>.empty();
|
||||
|
||||
String helper() {
|
||||
try {
|
||||
return value.toString();
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('[]', helper());
|
||||
|
||||
await hotReload();
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.contains(
|
||||
"type 'List<B>' is not a subtype of type 'List<A>'", helper());
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class A {}
|
||||
|
||||
-class B extends A {}
|
||||
+class B {}
|
||||
|
||||
List<A> value = init();
|
||||
init() => List<B>.empty();
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/680749e6559ecbc9166584ee34a20dbcda607e83/runtime/vm/isolate_reload_test.cc#L6039
|
||||
|
||||
// The CFE lowers typedefs to function types and as such the VM will not see
|
||||
// any name collision between a class and a typedef class (which doesn't exist
|
||||
// anymore).
|
||||
|
||||
class Predicate {
|
||||
bool call(dynamic x) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void expectHelper() {
|
||||
Expect.notType<Predicate>((foo) => false);
|
||||
Expect.notType<Predicate>(42);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
expectHelper();
|
||||
await hotReload();
|
||||
expectHelper();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/680749e6559ecbc9166584ee34a20dbcda607e83/runtime/vm/isolate_reload_test.cc#L6039
|
||||
|
||||
// The CFE lowers typedefs to function types and as such the VM will not see
|
||||
// any name collision between a class and a typedef class (which doesn't exist
|
||||
// anymore).
|
||||
|
||||
typedef bool Predicate(dynamic x);
|
||||
|
||||
void expectHelper() {
|
||||
Expect.type<Predicate>((foo) => false);
|
||||
Expect.notType<Predicate>(42);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
expectHelper();
|
||||
await hotReload();
|
||||
expectHelper();
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -12,14 +12,10 @@
|
||||
// any name collision between a class and a typedef class (which doesn't exist
|
||||
// anymore).
|
||||
|
||||
-class Predicate {
|
||||
- bool call(dynamic x) {
|
||||
- return false;
|
||||
- }
|
||||
-}
|
||||
+typedef bool Predicate(dynamic x);
|
||||
|
||||
void expectHelper() {
|
||||
- Expect.notType<Predicate>((foo) => false);
|
||||
+ Expect.type<Predicate>((foo) => false);
|
||||
Expect.notType<Predicate>(42);
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/640ad1416eaa2779e33f19e11a3249bb4f9d13f9/runtime/vm/isolate_reload_test.cc#L5167
|
||||
|
||||
class Foo {
|
||||
int x = 4;
|
||||
}
|
||||
|
||||
late Foo value;
|
||||
|
||||
int helper() {
|
||||
value = Foo();
|
||||
return value.x;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals(4, helper());
|
||||
await hotReload();
|
||||
|
||||
// Verify that we ran field initializers on cyclic fields added to existing
|
||||
// instances.
|
||||
Expect.throws<StackOverflowError>(() => helper());
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/640ad1416eaa2779e33f19e11a3249bb4f9d13f9/runtime/vm/isolate_reload_test.cc#L5167
|
||||
|
||||
class Foo {
|
||||
int x = 4;
|
||||
int y = value.y;
|
||||
}
|
||||
|
||||
late Foo value;
|
||||
|
||||
int helper() {
|
||||
return value.y;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals(4, helper());
|
||||
await hotReload();
|
||||
|
||||
// Verify that we ran field initializers on cyclic fields added to existing
|
||||
// instances.
|
||||
Expect.throws<StackOverflowError>(() => helper());
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
class Foo {
|
||||
int x = 4;
|
||||
+ int y = value.y;
|
||||
}
|
||||
|
||||
late Foo value;
|
||||
|
||||
int helper() {
|
||||
- value = Foo();
|
||||
- return value.x;
|
||||
+ return value.y;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/640ad1416eaa2779e33f19e11a3249bb4f9d13f9/runtime/vm/isolate_reload_test.cc#L5323
|
||||
|
||||
class Super {
|
||||
static var foo = 'right';
|
||||
}
|
||||
|
||||
class Foo extends Super {
|
||||
static var foo = 'wrong';
|
||||
}
|
||||
|
||||
late Foo value;
|
||||
String helper() {
|
||||
value = Foo();
|
||||
return 'okay';
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('right', Super.foo);
|
||||
Expect.equals('wrong', Foo.foo);
|
||||
Expect.equals('okay', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.equals('right', helper());
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/640ad1416eaa2779e33f19e11a3249bb4f9d13f9/runtime/vm/isolate_reload_test.cc#L5323
|
||||
|
||||
class Super {
|
||||
static var foo = 'right';
|
||||
var newField = foo;
|
||||
}
|
||||
|
||||
class Foo extends Super {
|
||||
static var foo = 'wrong';
|
||||
}
|
||||
|
||||
late Foo value;
|
||||
String helper() {
|
||||
return value.newField;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('right', Super.foo);
|
||||
Expect.equals('wrong', Foo.foo);
|
||||
Expect.equals('okay', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.equals('right', helper());
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
class Super {
|
||||
static var foo = 'right';
|
||||
+ var newField = foo;
|
||||
}
|
||||
|
||||
class Foo extends Super {
|
||||
@@ -18,8 +19,7 @@
|
||||
|
||||
late Foo value;
|
||||
String helper() {
|
||||
- value = Foo();
|
||||
- return 'okay';
|
||||
+ return value.newField;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/640ad1416eaa2779e33f19e11a3249bb4f9d13f9/runtime/vm/isolate_reload_test.cc#L5127
|
||||
|
||||
class Foo {
|
||||
int x = 4;
|
||||
}
|
||||
|
||||
late Foo value;
|
||||
|
||||
int helper() {
|
||||
value = Foo();
|
||||
return value.x;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals(4, helper());
|
||||
await hotReload();
|
||||
|
||||
// Verify that we ran field initializers on throwing fields added to existing
|
||||
// instances.
|
||||
Expect.throws(() => helper(), (e) => '$e' == 'field throws');
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/640ad1416eaa2779e33f19e11a3249bb4f9d13f9/runtime/vm/isolate_reload_test.cc#L5127
|
||||
|
||||
class Foo {
|
||||
int x = 4;
|
||||
int y = throw 'field throws';
|
||||
}
|
||||
|
||||
late Foo value;
|
||||
|
||||
int helper() {
|
||||
return value.y;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals(4, helper());
|
||||
await hotReload();
|
||||
|
||||
// Verify that we ran field initializers on throwing fields added to existing
|
||||
// instances.
|
||||
Expect.throws(() => helper(), (e) => '$e' == 'field throws');
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
class Foo {
|
||||
int x = 4;
|
||||
+ int y = throw 'field throws';
|
||||
}
|
||||
|
||||
late Foo value;
|
||||
|
||||
int helper() {
|
||||
- value = Foo();
|
||||
- return value.x;
|
||||
+ return value.y;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5381
|
||||
|
||||
class Foo<T> {
|
||||
T? x;
|
||||
}
|
||||
|
||||
late Foo value1;
|
||||
late Foo value2;
|
||||
|
||||
(dynamic, dynamic) helper() {
|
||||
value1 = Foo<String>();
|
||||
value2 = Foo<int>();
|
||||
return (value1.x, value2.x);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
var (v1, v2) = helper();
|
||||
Expect.type<String?>(v1);
|
||||
Expect.type<int?>(v2);
|
||||
await hotReload();
|
||||
|
||||
(v1, v2) = helper();
|
||||
Expect.type<List<String>>(v1);
|
||||
Expect.type<List<int>>(v2);
|
||||
await hotReload();
|
||||
|
||||
(v1, v2) = helper();
|
||||
Expect.type<Map<String, String>>(v1);
|
||||
Expect.type<Map<int, int>>(v2);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5381
|
||||
|
||||
class Foo<T> {
|
||||
T? x;
|
||||
List<T> y = List<T>.empty();
|
||||
}
|
||||
|
||||
late Foo value1;
|
||||
late Foo value2;
|
||||
|
||||
(dynamic, dynamic) helper() {
|
||||
return (value1.y, value2.y);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
var (v1, v2) = helper();
|
||||
Expect.type<String?>(v1);
|
||||
Expect.type<int?>(v2);
|
||||
await hotReload();
|
||||
|
||||
(v1, v2) = helper();
|
||||
Expect.type<List<String>>(v1);
|
||||
Expect.type<List<int>>(v2);
|
||||
await hotReload();
|
||||
|
||||
(v1, v2) = helper();
|
||||
Expect.type<Map<String, String>>(v1);
|
||||
Expect.type<Map<int, int>>(v2);
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -10,15 +10,14 @@
|
||||
|
||||
class Foo<T> {
|
||||
T? x;
|
||||
+ List<T> y = List<T>.empty();
|
||||
}
|
||||
|
||||
late Foo value1;
|
||||
late Foo value2;
|
||||
|
||||
(dynamic, dynamic) helper() {
|
||||
- value1 = Foo<String>();
|
||||
- value2 = Foo<int>();
|
||||
- return (value1.x, value2.x);
|
||||
+ return (value1.y, value2.y);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
@@ -0,0 +1,57 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5381
|
||||
|
||||
class Foo<T> {
|
||||
T? x;
|
||||
List<T> y = List<T>.empty();
|
||||
dynamic z = <T, T>{};
|
||||
}
|
||||
|
||||
late Foo value1;
|
||||
late Foo value2;
|
||||
|
||||
(dynamic, dynamic) helper() {
|
||||
return (value1.z, value2.z);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
var (v1, v2) = helper();
|
||||
Expect.type<String?>(v1);
|
||||
Expect.type<int?>(v2);
|
||||
await hotReload();
|
||||
|
||||
(v1, v2) = helper();
|
||||
Expect.type<List<String>>(v1);
|
||||
Expect.type<List<int>>(v2);
|
||||
await hotReload();
|
||||
|
||||
(v1, v2) = helper();
|
||||
Expect.type<Map<String, String>>(v1);
|
||||
Expect.type<Map<int, int>>(v2);
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -11,13 +11,14 @@
|
||||
class Foo<T> {
|
||||
T? x;
|
||||
List<T> y = List<T>.empty();
|
||||
+ dynamic z = <T, T>{};
|
||||
}
|
||||
|
||||
late Foo value1;
|
||||
late Foo value2;
|
||||
|
||||
(dynamic, dynamic) helper() {
|
||||
- return (value1.y, value2.y);
|
||||
+ return (value1.z, value2.z);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L760
|
||||
|
||||
class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
expectHelper() {
|
||||
Expect.type<A>(A());
|
||||
Expect.type<A>(B());
|
||||
Expect.notType<B>(A());
|
||||
Expect.type<B>(B());
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
expectHelper();
|
||||
await hotReload();
|
||||
expectHelper();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L760
|
||||
|
||||
class B {}
|
||||
|
||||
class A extends B {}
|
||||
|
||||
expectHelper() {
|
||||
Expect.type<A>(A());
|
||||
Expect.notType<A>(B());
|
||||
Expect.type<B>(A());
|
||||
Expect.type<B>(B());
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
expectHelper();
|
||||
await hotReload();
|
||||
expectHelper();
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -8,14 +8,14 @@
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L760
|
||||
|
||||
-class A {}
|
||||
+class B {}
|
||||
|
||||
-class B extends A {}
|
||||
+class A extends B {}
|
||||
|
||||
expectHelper() {
|
||||
Expect.type<A>(A());
|
||||
- Expect.type<A>(B());
|
||||
- Expect.notType<B>(A());
|
||||
+ Expect.notType<A>(B());
|
||||
+ Expect.type<B>(A());
|
||||
Expect.type<B>(B());
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L6114
|
||||
|
||||
class A {
|
||||
get x => "a";
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
f() async {
|
||||
var old_x = super.x;
|
||||
await hotReload();
|
||||
var new_x = super.x;
|
||||
return "$old_x:$new_x";
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('a:b', await B().f());
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L6114
|
||||
|
||||
class A {
|
||||
get x => "b";
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
f() async {
|
||||
var old_x = super.x;
|
||||
await hotReload();
|
||||
var new_x = super.x;
|
||||
return "$old_x:$new_x";
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('a:b', await B().f());
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -9,7 +9,7 @@
|
||||
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L6114
|
||||
|
||||
class A {
|
||||
- get x => "a";
|
||||
+ get x => "b";
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L822
|
||||
|
||||
class T {}
|
||||
|
||||
getType() => T;
|
||||
|
||||
Future<void> main() async {
|
||||
var oldType = getType();
|
||||
await hotReload();
|
||||
|
||||
var newType = getType();
|
||||
Expect.identical(oldType, newType);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L822
|
||||
|
||||
class T extends Stopwatch {}
|
||||
|
||||
getType() => T;
|
||||
|
||||
Future<void> main() async {
|
||||
var oldType = getType();
|
||||
await hotReload();
|
||||
|
||||
var newType = getType();
|
||||
Expect.identical(oldType, 34);
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -8,7 +8,7 @@
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L822
|
||||
|
||||
-class T {}
|
||||
+class T extends Stopwatch {}
|
||||
|
||||
getType() => T;
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
await hotReload();
|
||||
|
||||
var newType = getType();
|
||||
- Expect.identical(oldType, newType);
|
||||
+ Expect.identical(oldType, 34);
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L853
|
||||
|
||||
class T<G> {}
|
||||
|
||||
getType() => T<int>().runtimeType;
|
||||
|
||||
Future<void> main() async {
|
||||
var oldType = getType();
|
||||
await hotReload();
|
||||
|
||||
var newType = getType();
|
||||
Expect.identical(oldType, newType);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L853
|
||||
|
||||
class T<G> extends Stopwatch {}
|
||||
|
||||
getType() => T<int>().runtimeType;
|
||||
|
||||
Future<void> main() async {
|
||||
var oldType = getType();
|
||||
await hotReload();
|
||||
|
||||
var newType = getType();
|
||||
Expect.identical(oldType, newType);
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -8,7 +8,7 @@
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L853
|
||||
|
||||
-class T<G> {}
|
||||
+class T<G> extends Stopwatch {}
|
||||
|
||||
getType() => T<int>().runtimeType;
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L884
|
||||
|
||||
class T<G> {
|
||||
getTypeVar() => G;
|
||||
}
|
||||
|
||||
getType() => T<int>().getTypeVar();
|
||||
|
||||
Future<void> main() async {
|
||||
var oldType = getType();
|
||||
await hotReload();
|
||||
|
||||
var newType = getType();
|
||||
Expect.identical(oldType, newType);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L884
|
||||
|
||||
class T<G> extends Stopwatch {
|
||||
getTypeVar() => G;
|
||||
}
|
||||
|
||||
getType() => T<int>().getTypeVar();
|
||||
|
||||
Future<void> main() async {
|
||||
var oldType = getType();
|
||||
await hotReload();
|
||||
|
||||
var newType = getType();
|
||||
Expect.identical(oldType, newType);
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -8,7 +8,7 @@
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/bc58f69e532960a2f1d88f4b282869d6e2ad7cbe/runtime/vm/isolate_reload_test.cc#L884
|
||||
|
||||
-class T<G> {
|
||||
+class T<G> extends Stopwatch {
|
||||
getTypeVar() => G;
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/0b221871890a3daf331799aba7409bf299a35cfb/runtime/vm/isolate_reload_test.cc#L6065
|
||||
|
||||
typedef bool Predicate(dynamic x);
|
||||
|
||||
void expectHelper() {
|
||||
bool foo(x) => true;
|
||||
Expect.type<Predicate>(foo);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
expectHelper();
|
||||
await hotReload();
|
||||
expectHelper();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/0b221871890a3daf331799aba7409bf299a35cfb/runtime/vm/isolate_reload_test.cc#L6065
|
||||
|
||||
typedef bool Predicate(dynamic x, dynamic y);
|
||||
|
||||
void expectHelper() {
|
||||
bool foo(x) => true;
|
||||
Expect.notType<Predicate>(foo);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
expectHelper();
|
||||
await hotReload();
|
||||
expectHelper();
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -8,11 +8,11 @@
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/0b221871890a3daf331799aba7409bf299a35cfb/runtime/vm/isolate_reload_test.cc#L6065
|
||||
|
||||
-typedef bool Predicate(dynamic x);
|
||||
+typedef bool Predicate(dynamic x, dynamic y);
|
||||
|
||||
void expectHelper() {
|
||||
bool foo(x) => true;
|
||||
- Expect.type<Predicate>(foo);
|
||||
+ Expect.notType<Predicate>(foo);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/0b221871890a3daf331799aba7409bf299a35cfb/runtime/vm/isolate_reload_test.cc#L6013
|
||||
|
||||
// The CFE lowers typedefs to function types and as such the VM will not see
|
||||
// any name collision between a class and a typedef class (which doesn't exist
|
||||
// anymore).
|
||||
|
||||
typedef bool Predicate(dynamic x);
|
||||
|
||||
void expectHelper() {
|
||||
Expect.type<Predicate>((foo) => false);
|
||||
Expect.notType<Predicate>(42);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
expectHelper();
|
||||
await hotReload();
|
||||
expectHelper();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// 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';
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/0b221871890a3daf331799aba7409bf299a35cfb/runtime/vm/isolate_reload_test.cc#L6013
|
||||
|
||||
// The CFE lowers typedefs to function types and as such the VM will not see
|
||||
// any name collision between a class and a typedef class (which doesn't exist
|
||||
// anymore).
|
||||
|
||||
class Predicate {
|
||||
bool call(dynamic x) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void expectHelper() {
|
||||
Expect.notType<Predicate>((foo) => false);
|
||||
Expect.notType<Predicate>(42);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
expectHelper();
|
||||
await hotReload();
|
||||
expectHelper();
|
||||
}
|
||||
/** DIFF **/
|
||||
/*
|
||||
@@ -12,10 +12,14 @@
|
||||
// any name collision between a class and a typedef class (which doesn't exist
|
||||
// anymore).
|
||||
|
||||
-typedef bool Predicate(dynamic x);
|
||||
+class Predicate {
|
||||
+ bool call(dynamic x) {
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
|
||||
void expectHelper() {
|
||||
- Expect.type<Predicate>((foo) => false);
|
||||
+ Expect.notType<Predicate>((foo) => false);
|
||||
Expect.notType<Predicate>(42);
|
||||
}
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user