@@ -1850,7 +1850,7 @@ class IsBindableVisitor
1850
1850
auto genericSig = decl->getGenericSignature ();
1851
1851
1852
1852
SmallVector<Type, 4 > newParams;
1853
- llvm::DenseMap<Type , Type> newParamsMap;
1853
+ llvm::DenseMap<SubstitutableType * , Type> newParamsMap;
1854
1854
bool didChange = false ;
1855
1855
1856
1856
// The upper bounds for the nominal type's arguments may depend on the
@@ -1991,8 +1991,7 @@ class IsBindableVisitor
1991
1991
SmallVector<ProtocolConformanceRef, 4 > paramSubstConformances;
1992
1992
if (paramUpperBound) {
1993
1993
for (auto proto : paramUpperBound->getConformsTo ()) {
1994
- auto conformance = upperBoundSubstMap.lookupConformance (gp->getCanonicalType (),
1995
- proto);
1994
+ auto conformance = upperBoundSubstMap.lookupConformance (gp, proto);
1996
1995
if (!conformance)
1997
1996
return CanType ();
1998
1997
paramSubstConformances.push_back (conformance);
@@ -2005,7 +2004,7 @@ class IsBindableVisitor
2005
2004
return CanType ();
2006
2005
2007
2006
newParams.push_back (newParam);
2008
- newParamsMap.insert ({gpTy , newParam});
2007
+ newParamsMap.insert ({gp-> castTo <GenericTypeParamType>() , newParam});
2009
2008
didChange |= (newParam != subst);
2010
2009
}
2011
2010
@@ -2042,14 +2041,15 @@ class IsBindableVisitor
2042
2041
2043
2042
// Gather the conformances for the new binding type, if the type changed.
2044
2043
if (didChange) {
2045
- auto newSubstTy = newParamsMap.find (req.getFirstType ());
2046
- assert (newSubstTy != newParamsMap.end ());
2044
+ auto newSubstTy = req.getFirstType ().subst (
2045
+ QueryTypeSubstitutionMap{newParamsMap},
2046
+ LookUpConformanceInModule (moduleDecl));
2047
2047
2048
- if (newSubstTy->second -> isTypeParameter ()) {
2048
+ if (newSubstTy->isTypeParameter ()) {
2049
2049
newConformances.push_back (ProtocolConformanceRef (proto));
2050
2050
} else {
2051
2051
auto newConformance
2052
- = moduleDecl->lookupConformance (newSubstTy-> second , proto);
2052
+ = moduleDecl->lookupConformance (newSubstTy, proto);
2053
2053
if (!newConformance)
2054
2054
return CanType ();
2055
2055
newConformances.push_back (newConformance);
0 commit comments