[sil-verifier] Verify correctly that lowered SIL optional types are lowered types of formal optional types. #5249
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently, the lowering of Optional was changed to be more like the lowering
of tuples. Specifically this means that we recursively propagate types into the
optional's component type rather than treating the component type as a
standalone formal type ala other nominal types.
This patch updates the function isLoweringOf in the SILVerifier that was missed
as apart of the aforementioned updates. Specifically, previously isLoweringOf
assumed that the optional's component type was always a formal type implying
that it could just compare the lowered SIL types corresponding formal type and
the passed in formal type. Now since we are propagating types down into the
optional's component types, we need to recurse performing isLoweringOf on the
maximally abstracted version of the optional SIL type (i.e. the primitive
address form).
I would like to thank John for his patience in explaining the big picture here.
rdar://28536812