swift
14ac4bef - SILOptimizer: Fix invariant violation in getWitnessMethodSubstitutions() with class witness methods

Commit
3 years ago
SILOptimizer: Fix invariant violation in getWitnessMethodSubstitutions() with class witness methods Witness thunks where the conforming type is a class and the witness is in a protocol extension have an extra generic parameter constrained to the class type that is passed as the 'Self' parameter for the protocol extension method. This means the substitution map for the devirtualized call must be assembled from three sources: - The 'Self' substitution - The generic parameters of the concrete conforming type, if any - The generic parameters of the protocol requirement, if any This was previously done by making two calls to combineSubstitutionMaps(), the first call combined the first two maps and the second call combined the result of the first call with the third map. Unfortunately, both calls were made with the generic signature of the witness thunk, and the result of combining the first two substitution maps does not provide sufficient replacements for all generic parameters and conformance requirements in the witness thunk's signature. This was apparently fine with the GenericSignatureBuilder, but the Requirement Machine flags the missing generic parameters in assert builds. Fixes https://github.com/apple/swift/issues/59193.
Author
Committer
Parents
Loading