Skip to content

Conversation

@slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Apr 4, 2024

Fix infinite recursion in opaque type substitution when parameter packs are present

Opaque type replacement is not semantically a transformation that maps parameter packs to concrete packs, so we must pass SubstFlags::PreservePackExpansionLevel. Otherwise we would get an infinite recursion in SIL type substitution.

Fixes rdar://123645784.

Fix crash when opaque return type witnessed by variadic generic type with conditional conformance

There was a missing case in the mangler.

Fixes rdar://125668798.

@slavapestov slavapestov requested review from hborla and xedin as code owners April 4, 2024 18:59
@slavapestov slavapestov changed the title Fix infinite recursion in opaque type substitution when parameter packs are present Fix two problems with opaque return types -vs- parameter packs Apr 4, 2024
The names of the private witness table accessor thunks we generate for
an opaque return type mangle the concrete conformance of the underlying
type.

If a conformance requirement of the opaque return type was witnessed by
a conditional conformance of a variadic generic type, we would crash
because of an unimplemented case in the mangler.

Fixes rdar://problem/125668798.
…ePackExpansionLevel

Fixes rdar://problem/123645784.
Unfortunately SILGen still blows up when emitting witness thunks here.
@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 480592a into swiftlang:main Apr 5, 2024
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