You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking into the issue reported in this tweet. I can repro it with:
main() {
String? s =null;
var length =switch (0) {
_ when s !=null=> s.length,
_ =>0,
};
switch (0) {
case _ when s !=null: s.length;
};
}
The switch statement is fine, but the switch expression yields:
temp.dart:5:27: Error: Property 'length' cannot be accessed on 'String?' because it is potentially null.
Try accessing using ?. instead.
_ when s != null => s.length,
^^^^^^
Do we not do type promotion in switch expression guards?
Yeah, this is a known issue that I discovered just before 3.0 shipped, when there was no longer time to cherry-pick a fix. The fix has been cherry-picked to stable, and will ship in 3.0.1.
I'm looking into the issue reported in this tweet. I can repro it with:
The switch statement is fine, but the switch expression yields:
Do we not do type promotion in switch expression guards?
@stereotype441
The text was updated successfully, but these errors were encountered: