Skip to content

Commit 2dffe31

Browse files
osa1Commit Queue
authored and
Commit Queue
committed
[dart2wasm] Override _BoxedBool runtime type
Continuation of 181c996. Overriding `_BoxedBool` runtime type turned out to be a bit tricky, as explained in comments. New passing tests: - co19/Language/Expressions/Booleans/runtime_type_t01 - co19/LanguageFeatures/Enhanced-Enum/semantics_A07_t01 - language/type_object/first_class_types_literals_runtime_1_test - language/type_object/first_class_types_literals_runtime_2_test - language/type_object/first_class_types_literals_runtime_test Change-Id: Icdd3eb61989298f70bfd6dca42a029fcc1ae9ec2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276502 Reviewed-by: Aske Simon Christensen <[email protected]> Commit-Queue: Ömer Ağacan <[email protected]>
1 parent 7155cf1 commit 2dffe31

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sdk/lib/_internal/wasm/lib/bool.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44

55
part of "core_patch.dart";
66

7+
@patch
8+
class bool {
9+
// Note: this needs to be in `bool`, cannot be overridden in `_BoxedBool`. I
10+
// suspect the problem is there's an assumption in the front-end that `bool`
11+
// has one implementation class (unlike `double`, `int`, `String`) which is
12+
// the `bool` class itself. So when `runtimeType` is not overridden in
13+
// `bool`, in code like `x.runtimeType` where `x` is `bool`, direct call
14+
// metadata says that the member is `Object.runtimeType`.
15+
@override
16+
Type get runtimeType => bool;
17+
}
18+
719
@pragma("wasm:entry-point")
820
class _BoxedBool extends bool {
921
// A boxed bool contains an unboxed bool.

0 commit comments

Comments
 (0)