mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
embedded: fix specialization of associated conformance entries in witness tables
When creating a specialized witness table, we need to get the right specialized conformance. In IRGen don't emit associated conformance witness table entries if the protocol is not a class protocol. In this case the associated type can never be used to create an existential. Therefore such a witness table entry is never used at runtime in embedded swift. Fixes a compiler crash rdar://146448091
This commit is contained in:
@@ -144,11 +144,14 @@ func specializeWitnessTable(forConformance conformance: Conformance,
|
||||
case .associatedType(let requirement, let witness):
|
||||
let substType = witness.subst(with: conformance.specializedSubstitutions)
|
||||
return .associatedType(requirement: requirement, witness: substType)
|
||||
case .associatedConformance(let requirement, let proto, let witness):
|
||||
if witness.isSpecialized {
|
||||
specializeWitnessTable(forConformance: witness, errorLocation: errorLocation, context, notifyNewWitnessTable)
|
||||
case .associatedConformance(let requirement, let proto, _):
|
||||
let concreteAssociateConf = conformance.getAssociatedConformance(ofAssociatedType: requirement.type, to: proto)
|
||||
if concreteAssociateConf.isSpecialized {
|
||||
specializeWitnessTable(forConformance: concreteAssociateConf,
|
||||
errorLocation: errorLocation,
|
||||
context, notifyNewWitnessTable)
|
||||
}
|
||||
return .associatedConformance(requirement: requirement, protocol: proto, witness: witness)
|
||||
return .associatedConformance(requirement: requirement, protocol: proto, witness: concreteAssociateConf)
|
||||
}
|
||||
}
|
||||
let newWT = context.createWitnessTable(entries: newEntries,conformance: conformance,
|
||||
|
||||
Reference in New Issue
Block a user