Skip to content

Conversation

@slavapestov
Copy link
Contributor

6.3 cherry-pick of #86131

  • Description: If we can see the underlying type of an opaque return type, and this underlying type does not depend on the opaque return type's generic signature, then we can end up in a situation where the lowered type of a re-abstraction thunk is not generic, but the formal type is. This would trigger an assertion failure. Check both the lowered type and formal type for type parameters to cope with this.

  • Issue: Fixes SILGen assertion failure with ForEach(Array(enumerated())) in SwiftUI View #86118.

  • Risk: Extremely low, because dropping the generic signature here is an optimization, so making it more conservative should generally be safe.

  • Reviewed by: @jckarter

…volving opaque return type

If we can see the underlying type of an opaque return type, and this
underlying type does not depend on the opaque return type's generic
signature, then we can end up in a situation where the lowered type
of a re-abstraction thunk is not generic, but the formal type is.

This would trigger an assertion failure. Check both the lowered type
and formal type for type parameters to cope with this.

- Fixes swiftlang#86118.
@slavapestov slavapestov requested a review from a team as a code owner December 20, 2025 01:03
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov changed the title SILGen: Fix assert when emitting re-abstraction thunk in edge case involving opaque return type [6.3] SILGen: Fix assert when emitting re-abstraction thunk in edge case involving opaque return type Dec 20, 2025
@slavapestov
Copy link
Contributor Author

@swift-ci Please test Windows

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.

2 participants