[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 <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This commit is contained in:
Ömer Sinan Ağacan
2022-12-21 11:09:22 +00:00
committed by Commit Queue
parent 7155cf140d
commit 2dffe31edd
+12
View File
@@ -4,6 +4,18 @@
part of "core_patch.dart";
@patch
class bool {
// Note: this needs to be in `bool`, cannot be overridden in `_BoxedBool`. I
// suspect the problem is there's an assumption in the front-end that `bool`
// has one implementation class (unlike `double`, `int`, `String`) which is
// the `bool` class itself. So when `runtimeType` is not overridden in
// `bool`, in code like `x.runtimeType` where `x` is `bool`, direct call
// metadata says that the member is `Object.runtimeType`.
@override
Type get runtimeType => bool;
}
@pragma("wasm:entry-point")
class _BoxedBool extends bool {
// A boxed bool contains an unboxed bool.