[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>
diff --git a/sdk/lib/_internal/wasm/lib/bool.dart b/sdk/lib/_internal/wasm/lib/bool.dart
index 2aeab66..a949961 100644
--- a/sdk/lib/_internal/wasm/lib/bool.dart
+++ b/sdk/lib/_internal/wasm/lib/bool.dart
@@ -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.