diff --git a/sdk/lib/_internal/wasm/lib/bool.dart b/sdk/lib/_internal/wasm/lib/bool.dart index 2aeab66110e..a949961f405 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.