@@ -827,9 +827,6 @@ Type TypeResolution::applyUnboundGenericArguments(
827
827
genericArgs.size () >= decl->getGenericParams ()->size () - 1 )) &&
828
828
" invalid arguments, use applyGenericArguments for diagnostic emitting" );
829
829
830
- auto genericSig = decl->getGenericSignature ();
831
- assert (!genericSig.isNull ());
832
-
833
830
TypeSubstitutionMap subs;
834
831
835
832
// Get the interface type for the declaration. We will be substituting
@@ -855,6 +852,7 @@ Type TypeResolution::applyUnboundGenericArguments(
855
852
if (!resultType->hasTypeParameter ())
856
853
return resultType;
857
854
855
+ auto genericSig = decl->getGenericSignature ();
858
856
auto parentSig = decl->getDeclContext ()->getGenericSignatureOfContext ();
859
857
for (auto gp : parentSig.getGenericParams ())
860
858
subs[gp->getCanonicalType ()->castTo <GenericTypeParamType>()] =
@@ -864,18 +862,18 @@ Type TypeResolution::applyUnboundGenericArguments(
864
862
}
865
863
866
864
skipRequirementsCheck |= parentTy->hasTypeVariable ();
867
- } else if (auto genericSig =
865
+ } else if (auto parentSig =
868
866
decl->getDeclContext ()->getGenericSignatureOfContext ()) {
869
- for (auto gp : genericSig .getGenericParams ()) {
867
+ for (auto gp : parentSig .getGenericParams ()) {
870
868
subs[gp->getCanonicalType ()->castTo <GenericTypeParamType>()] = gp;
871
869
}
872
870
}
873
871
874
872
// Realize the types of the generic arguments and add them to the
875
873
// substitution map.
876
- auto innerParams = genericSig. getInnermostGenericParams ();
877
- for (unsigned i = 0 ; i < innerParams. size (); ++i ) {
878
- auto origTy = innerParams[i];
874
+ auto innerParams = decl-> getGenericParams ()-> getParams ();
875
+ for (unsigned i : indices (innerParams) ) {
876
+ auto origTy = innerParams[i]-> getDeclaredInterfaceType () ;
879
877
auto origGP = origTy->getCanonicalType ()->castTo <GenericTypeParamType>();
880
878
881
879
if (!origGP->isTypeSequence ()) {
@@ -894,7 +892,8 @@ Type TypeResolution::applyUnboundGenericArguments(
894
892
// types we can bind to this type sequence parameter.
895
893
unsigned tail;
896
894
for (tail = 1 ; tail <= innerParams.size (); ++tail) {
897
- auto tailTy = innerParams[innerParams.size () - tail];
895
+ auto tailTy = innerParams[innerParams.size () - tail]
896
+ ->getDeclaredInterfaceType ();
898
897
auto tailGP = tailTy->getCanonicalType ()->castTo <GenericTypeParamType>();
899
898
if (tailGP->isTypeSequence ()) {
900
899
assert (tailGP->isEqual (origGP) &&
@@ -943,6 +942,7 @@ Type TypeResolution::applyUnboundGenericArguments(
943
942
if (noteLoc.isInvalid ())
944
943
noteLoc = loc;
945
944
945
+ auto genericSig = decl->getGenericSignature ();
946
946
auto result = TypeChecker::checkGenericArguments (
947
947
module , loc, noteLoc,
948
948
UnboundGenericType::get (decl, parentTy, getASTContext ()),
0 commit comments