Files
sdk/pkg/front_end/testcases/patterns/never_map.dart.strong.modular.expect
T
Johnni Winther 756dd1c665 [cfe] Use required type for lookup in map/list pattern
The members used to match a map/list pattern should be pulled from the required type and not the matched type in order to avoid wrongfully using extension type members.

Closes #63315

Change-Id: Idccc19fad1a3fc5cd1ecac2cfdb0ef0ee431d50f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502700
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-05-12 05:08:33 -07:00

27 lines
1.0 KiB
Plaintext

library;
import self as self;
import "dart:core" as core;
static method main() → void {
try {
hoisted has-declared-initializer core::Object? b;
{
final synthesized Never #0#0 = throw <core::int, core::int>{42: 42};
synthesized core::Object? #0#3;
synthesized core::bool #0#3#isSet = false;
final const synthesized core::int #0#1 = #C1;
if(!((!((#0#3#isSet ?{core::Object?} #0#3 : let final dynamic #t1 = #0#3#isSet = true in #0#3 = #0#0.{core::Map::[]}(#C1){(core::Object?) → core::Object?}) == null) || null is core::Object? && #0#0.{core::Map::containsKey}(#C1){(core::Object?) → core::bool}) && (let final dynamic #t2 = b = #0#3#isSet ?{core::Object?} #0#3 : let final dynamic #t3 = #0#3#isSet = true in #0#3 = #0#0.{core::Map::[]}(#C1){(core::Object?) → core::Object?} in true)))
throw{for-error-handling} new core::StateError::•("Pattern matching error");
}
}
on core::Object catch(final core::Object e) {
core::print(e);
return;
}
throw "Missing exception";
}
constants {
#C1 = 42
}