Type of an if-null or conditional expression should only be the LUB if it's a subtype of the context #32339
Labels
analyzer-spec
Issues with the analyzer's implementation of the language spec
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
area-front-end
Use area-front-end for front end / CFE / kernel format related issues.
P4
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
Milestone
Consider the following code:
The current analyzer and front end reject this code, because they consider the type of
c ?? d
to beLUB(C, D)
, which isObject
, andObject
does not define a methodf
.According to #32291 (comment), the LUB should only be used if it is a subtype of the greatest closure of the context; otherwise the greatest closure of the context should be used. So the type of
c ?? d
should beI
and the code should be accepted.The text was updated successfully, but these errors were encountered: