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
[cfe] Move assignability checking for for-element conditions earlier.
Previously, the logic to validate that the condition part of a
for-element (a "for" loop inside a collection) was done in
`InferenceVisitorImpl.checkElement` and
`InferenceVisitorImpl.checkMapEntry` (which execute after the type of
the collection has been fully inferred). This CL moves the logic to
`InferenceVisitorImpl._inferForElementBase` and
`InferenceVisitorImpl._inferForMapEntryBase` (so that the
assignability check happens right after the condition has been visited
by the type inferrer).
Moving the assignability checking earlier ensures that if there is an
assignability error, the flow analysis "why not promoted" information
will still be valid, increasing the chances that the user can be given
a helpful "why not promoted" context message.
Change-Id: Ie239a88c94da1bf476fa9e1361053df2d1a56ba2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388223
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Paul Berry <[email protected]>
0 commit comments