Breaking change 55436: Make type inference of `e1 ?? e2` consistent.

99 views
Skip to first unread message

Paul Berry

unread,
Apr 11, 2024, 4:11:21 AMApr 11
to anno...@dartlang.org
The rules used by the compiler front end to perform type inference on if-null expressions (expressions of the form e1 ?? e2) will be changed to match the behavior of the analyzer. The change is as follows: when the context for the entire e1 ?? e2 expression is dynamic, the context for e2 will be the static type of e1.

This change is expected to have low impact on real-world code. But in principle it could cause compile-time errors or changes in runtime behavior.

For additional details please see https://github.com/dart-lang/sdk/issues/55436.

If this breaking change poses a severe problem, please leave comments in the linked issue.

Paul Berry

unread,
May 7, 2024, 12:35:24 PMMay 7
to anno...@dartlang.org
This change is being implemented now.
Reply all
Reply to author
Forward
0 new messages