Skip to content

SIL: Fix SILType::isLoweringOf() to correctly handle opaque archetypes #77299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Oct 30, 2024

This predicate is meant to ask if the loweredType is equal to getLoweredType(pattern, formalType) for some abstraction pattern.

If the formal type contained an opaque archetype, we performed a different check, because we asked if loweredEqual is equal to getLoweredType(AbstractionPattern(formalType), formalType).

This caused a spurious SIL verifier failure when the payload of an existential contained an opaque archetype, because we lower the payload with the most general AbstractionPattern, so that @thin metatypes become @thick, etc.

The regression test exercises this bug, and also another bug that was present in 6.0 but was already fixed on main by one of my earlier refactorings.

Fixes rdar://problem/138655637.

This predicate is meant to ask if the loweredType is equal to
`getLoweredType(pattern, formalType)` for *some* abstraction pattern.

If the formal type contained an opaque archetype, we performed a
different check, because we asked if loweredEqual is equal to
`getLoweredType(AbstractionPattern(formalType), formalType)`.

This caused a spurious SIL verifier failure when the payload of an
existential contained an opaque archetype, because we lower the
payload with the most general AbstractionPattern, so that
@thin metatypes become @thick, etc.

The regression test exercises this bug, and also another bug that was
present in 6.0 but was already fixed on main by one of my earlier
refactorings.

Fixes rdar://problem/138655637.
@slavapestov slavapestov requested a review from jckarter as a code owner October 30, 2024 17:20
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please test Windows

@slavapestov slavapestov merged commit dc74ebf into swiftlang:main Oct 31, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant