@@ -6926,26 +6926,29 @@ void GenericSignatureBuilder::enumerateRequirements(
6926
6926
SmallVectorImpl<Requirement> &requirements) {
6927
6927
auto recordRequirement = [&](RequirementKind kind,
6928
6928
Type depTy,
6929
- RequirementRHS type ) {
6929
+ RequirementRHS rhs ) {
6930
6930
depTy = getSugaredDependentType (depTy, genericParams);
6931
6931
6932
- if (auto concreteTy = type .dyn_cast <Type>()) {
6933
- if (concreteTy ->hasError ())
6932
+ if (auto type = rhs .dyn_cast <Type>()) {
6933
+ if (type ->hasError ())
6934
6934
return ;
6935
6935
6936
6936
// Drop requirements involving concrete types containing
6937
6937
// unresolved associated types.
6938
- if (concreteTy ->findUnresolvedDependentMemberType ()) {
6938
+ if (type ->findUnresolvedDependentMemberType ()) {
6939
6939
assert (Impl->HadAnyError );
6940
6940
return ;
6941
6941
}
6942
6942
6943
- if (concreteTy ->isTypeParameter ())
6944
- concreteTy = getSugaredDependentType (concreteTy , genericParams);
6943
+ if (type ->isTypeParameter ())
6944
+ type = getSugaredDependentType (type , genericParams);
6945
6945
6946
- requirements.push_back (Requirement (kind, depTy, concreteTy));
6946
+ requirements.push_back (Requirement (kind, depTy, type));
6947
+ } else if (auto *proto = rhs.dyn_cast <ProtocolDecl *>()) {
6948
+ auto type = proto->getDeclaredInterfaceType ();
6949
+ requirements.push_back (Requirement (kind, depTy, type));
6947
6950
} else {
6948
- auto layoutConstraint = type .get <LayoutConstraint>();
6951
+ auto layoutConstraint = rhs .get <LayoutConstraint>();
6949
6952
requirements.push_back (Requirement (kind, depTy, layoutConstraint));
6950
6953
return ;
6951
6954
}
@@ -7079,8 +7082,7 @@ void GenericSignatureBuilder::enumerateRequirements(
7079
7082
7080
7083
// Enumerate the conformance requirements.
7081
7084
for (auto proto : protocols) {
7082
- recordRequirement (RequirementKind::Conformance, subjectType,
7083
- proto->getDeclaredInterfaceType ());
7085
+ recordRequirement (RequirementKind::Conformance, subjectType, proto);
7084
7086
}
7085
7087
}
7086
7088
0 commit comments