@@ -4629,9 +4629,9 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement(
4629
4629
->getDependentType (getGenericParams ());
4630
4630
4631
4631
Impl->HadAnyError = true ;
4632
-
4633
- auto invalidConstraint = InvalidConstraint (subjectType, constraintType,
4634
- source.getLoc ( ));
4632
+
4633
+ auto invalidConstraint = InvalidConstraint (
4634
+ subjectType, constraintType, source.getSource (* this , subjectType ));
4635
4635
invalidConstraints.push_back (invalidConstraint);
4636
4636
}
4637
4637
@@ -5758,10 +5758,11 @@ GenericSignatureBuilder::finalize(SourceLoc loc,
5758
5758
// allowConcreteGenericParams is true or the subject type is a member type.
5759
5759
if (!invalidConstraints.empty ()) {
5760
5760
for (auto constraint : invalidConstraints) {
5761
- auto loc = constraint.sourceLoc ;
5762
5761
auto subjectType = constraint.subjectType ;
5763
5762
auto constraintType = constraint.constraintType ;
5764
-
5763
+ auto source = constraint.reqSource ;
5764
+ auto loc = source->getLoc ();
5765
+
5765
5766
Diags.diagnose (loc, diag::requires_conformance_nonprotocol,
5766
5767
subjectType, constraintType);
5767
5768
@@ -5774,10 +5775,10 @@ GenericSignatureBuilder::finalize(SourceLoc loc,
5774
5775
5775
5776
return subjectTypeName;
5776
5777
};
5777
-
5778
- auto DMT = subjectType-> getAs <DependentMemberType>();
5779
-
5780
- if (allowConcreteGenericParams || (DMT && !DMT-> getAssocType ())) {
5778
+
5779
+ if (allowConcreteGenericParams ||
5780
+ (subjectType-> is <DependentMemberType>() &&
5781
+ !source-> isProtocolRequirement ())) {
5781
5782
auto subjectTypeName = subjectType.getString ();
5782
5783
auto subjectTypeNameWithoutSelf = getNameWithoutSelf (subjectTypeName);
5783
5784
Diags.diagnose (loc, diag::requires_conformance_nonprotocol_fixit,
0 commit comments