Skip to content

Commit 26543d1

Browse files
committed
AST: Preserve sugar in getIdentitySubstitutionMap()
We implement getIdentitySubstitutionMap() by passing in a no-op substitution callback. Remove the unnecessary getCanonicalType() call, to ensure that the abstract conformance in the identity substitution map uses the sugared form of the subject type.
1 parent 00766f7 commit 26543d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/AST/SubstitutionMap.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ SubstitutionMap SubstitutionMap::get(GenericSignature genericSig,
176176
for (const auto &req : genericSig.getRequirements()) {
177177
if (req.getKind() != RequirementKind::Conformance) continue;
178178

179-
CanType depTy = req.getFirstType()->getCanonicalType();
179+
Type depTy = req.getFirstType();
180180
auto replacement = depTy.subst(IFS);
181181
auto *proto = req.getProtocolDecl();
182-
auto conformance = IFS.lookupConformance(depTy, replacement, proto,
183-
/*level=*/0);
182+
auto conformance = IFS.lookupConformance(
183+
depTy->getCanonicalType(), replacement, proto, /*level=*/0);
184184
conformances.push_back(conformance);
185185
}
186186

0 commit comments

Comments
 (0)