File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 31
31
#include " swift/AST/InFlightSubstitution.h"
32
32
#include " swift/AST/LazyResolver.h"
33
33
#include " swift/AST/Module.h"
34
+ #include " swift/AST/PackConformance.h"
34
35
#include " swift/AST/ProtocolConformance.h"
35
36
#include " swift/AST/TypeCheckRequests.h"
36
37
#include " swift/AST/Types.h"
@@ -792,13 +793,29 @@ bool SubstitutionMap::isIdentity() const {
792
793
if (empty ())
793
794
return true ;
794
795
796
+ for (auto conf : getConformances ()) {
797
+ if (conf.isAbstract ())
798
+ continue ;
799
+
800
+ if (conf.isPack ()) {
801
+ auto patternConfs = conf.getPack ()->getPatternConformances ();
802
+ if (patternConfs.size () == 1 && patternConfs[0 ].isAbstract ())
803
+ continue ;
804
+ }
805
+
806
+ return false ;
807
+ }
808
+
795
809
GenericSignature sig = getGenericSignature ();
796
810
bool hasNonIdentityReplacement = false ;
797
811
auto replacements = getReplacementTypesBuffer ();
798
812
799
813
sig->forEachParam ([&](GenericTypeParamType *paramTy, bool isCanonical) {
800
814
if (isCanonical) {
801
- if (!paramTy->isEqual (replacements[0 ]))
815
+ Type wrappedParamTy = paramTy;
816
+ if (paramTy->isParameterPack ())
817
+ wrappedParamTy = PackType::getSingletonPackExpansion (paramTy);
818
+ if (!wrappedParamTy->isEqual (replacements[0 ]))
802
819
hasNonIdentityReplacement = true ;
803
820
}
804
821
You can’t perform that action at this time.
0 commit comments