@@ -3005,35 +3005,29 @@ void ASTMangler::appendTypeListElement(Identifier name, Type elementType,
3005
3005
appendOperator (" d" );
3006
3006
}
3007
3007
3008
- // / Filters out requirements stating that a type conforms to one of the
3009
- // / invertible protocols.
3010
- // / TODO: reconsituteInverses so the absence of conformances gets mangled
3011
- static void withoutInvertibleRequirements (ArrayRef<Requirement> requirements,
3012
- SmallVector<Requirement, 4 > &output) {
3013
- for (auto req : requirements) {
3014
- // Skip conformance requirements for invertible protocols.
3015
- if (req.getKind () == RequirementKind::Conformance
3016
- && req.getProtocolDecl ()->getInvertibleProtocolKind ())
3017
- continue ;
3018
-
3019
- output.push_back (req);
3020
- }
3021
- }
3022
-
3023
3008
bool ASTMangler::appendGenericSignature (GenericSignature sig,
3024
3009
GenericSignature contextSig) {
3025
3010
auto canSig = sig.getCanonicalSignature ();
3026
3011
3012
+ // FIXME: We just ignore invertible requirements for now.
3013
+ SmallVector<Requirement, 2 > reqs;
3014
+ SmallVector<InverseRequirement, 2 > inverseReqs;
3015
+ canSig->getRequirementsWithInverses (reqs, inverseReqs);
3016
+
3027
3017
unsigned initialParamDepth;
3028
3018
ArrayRef<CanTypeWrapper<GenericTypeParamType>> genericParams;
3029
- SmallVector<Requirement, 4 > requirements;
3030
3019
if (contextSig) {
3031
3020
// If the signature is the same as the context signature, there's nothing
3032
3021
// to do.
3033
3022
if (contextSig.getCanonicalSignature () == canSig) {
3034
3023
return false ;
3035
3024
}
3036
3025
3026
+ // FIXME: We just ignore invertible requirements for now.
3027
+ SmallVector<Requirement, 2 > contextReqs;
3028
+ SmallVector<InverseRequirement, 2 > contextInverseReqs;
3029
+ contextSig->getRequirementsWithInverses (contextReqs, contextInverseReqs);
3030
+
3037
3031
// The signature depth starts above the depth of the context signature.
3038
3032
if (!contextSig.getGenericParams ().empty ()) {
3039
3033
initialParamDepth = contextSig.getGenericParams ().back ()->getDepth () + 1 ;
@@ -3053,26 +3047,25 @@ bool ASTMangler::appendGenericSignature(GenericSignature sig,
3053
3047
// have a special-case mangling for that.
3054
3048
if (genericParams.empty () &&
3055
3049
contextSig.getGenericParams ().size () == 1 &&
3056
- contextSig. getRequirements () .empty ()) {
3050
+ contextReqs .empty ()) {
3057
3051
initialParamDepth = 0 ;
3058
3052
genericParams = canSig.getGenericParams ();
3059
- withoutInvertibleRequirements (canSig.getRequirements (), requirements);
3060
3053
} else {
3061
- withoutInvertibleRequirements (
3062
- canSig.requirementsNotSatisfiedBy (contextSig), requirements);
3054
+ llvm::erase_if (reqs, [&](Requirement req) {
3055
+ return contextSig->isRequirementSatisfied (req);
3056
+ });
3063
3057
}
3064
3058
} else {
3065
3059
// Use the complete canonical signature.
3066
3060
initialParamDepth = 0 ;
3067
3061
genericParams = canSig.getGenericParams ();
3068
- withoutInvertibleRequirements (canSig.getRequirements (), requirements);
3069
3062
}
3070
3063
3071
- if (genericParams.empty () && requirements .empty ())
3064
+ if (genericParams.empty () && reqs .empty ())
3072
3065
return false ;
3073
3066
3074
3067
appendGenericSignatureParts (sig, genericParams,
3075
- initialParamDepth, requirements );
3068
+ initialParamDepth, reqs );
3076
3069
return true ;
3077
3070
}
3078
3071
0 commit comments