Skip to content

Commit cd3f2fb

Browse files
natebiggsCommit Queue
authored andcommitted
[dart2wasm] Add dynamic modules subtyping test.
Tests that types defined fully with dynamic modules type check correctly. In WASM this ensures that the class ID ranges used for the type checks are correct. Change-Id: I22aa528599eb918062e198b878ba2b4cdc901a06 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430620 Auto-Submit: Nate Biggs <[email protected]> Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Nate Biggs <[email protected]>
1 parent 88e2419 commit cd3f2fb

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
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.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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 '../../common/testing.dart' as helper;
6+
7+
void main() async {
8+
await helper.load('entry1.dart');
9+
await helper.load('entry2.dart');
10+
helper.done();
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
class Child {}
6+
7+
Object getChild(int x) {
8+
return x < 3 ? Child() : 4;
9+
}
10+
11+
@pragma('dyn-module:entry-point')
12+
Object? dynamicModuleEntrypoint() => getChild(1) as Child;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
class Child {}
6+
7+
Object getChild(int x) {
8+
return x < 3 ? Child() : 4;
9+
}
10+
11+
@pragma('dyn-module:entry-point')
12+
Object? dynamicModuleEntrypoint() => getChild(1) as Child;

0 commit comments

Comments
 (0)