mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
NFC: Add GenericSignature::getCanonicalSignature. (#29105)
Motivation: `GenericSignatureImpl::getCanonicalSignature` crashes for `GenericSignature` with underlying `nullptr`. This led to verbose workarounds when computing `CanGenericSignature` from `GenericSignature`. Solution: `GenericSignature::getCanonicalSignature` is a wrapper around `GenericSignatureImpl::getCanonicalSignature` that returns the canonical signature, or `nullptr` if the underlying pointer is `nullptr`. Rewrite all verbose workarounds using `GenericSignature::getCanonicalSignature`.
This commit is contained in:
@@ -140,7 +140,7 @@ RequirementEnvironment::RequirementEnvironment(
|
||||
reqSig->getRequirements().size() == 1) {
|
||||
syntheticSignature = conformanceDC->getGenericSignatureOfContext();
|
||||
if (syntheticSignature) {
|
||||
syntheticSignature = syntheticSignature->getCanonicalSignature();
|
||||
syntheticSignature = syntheticSignature.getCanonicalSignature();
|
||||
syntheticEnvironment =
|
||||
syntheticSignature->getGenericEnvironment();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user