Skip to content

Commit c94c9c4

Browse files
authored
Merge pull request #71592 from kavon/ncgenerics-test-fixes-kavon-v12
Ncgenerics test fixes kavon v12
2 parents c5dbeca + 88e4ece commit c94c9c4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4575,7 +4575,17 @@ bool UnintendedExtraGenericParamMemberFailure::diagnoseAsError() {
45754575
SourceLoc loc = genericTy->getDecl()->getSourceRange().End;
45764576
StringRef replacement;
45774577

4578-
if (archetype->getConformsTo().size()) {
4578+
// FIXME: this won't handle an explicit Copyable written in source, but it's
4579+
// close enough.
4580+
bool conformsToAnExplicitRequirement = false;
4581+
for (auto proto : archetype->getConformsTo()) {
4582+
if (proto->getInvertibleProtocolKind())
4583+
continue;
4584+
conformsToAnExplicitRequirement = true;
4585+
break;
4586+
}
4587+
4588+
if (conformsToAnExplicitRequirement) {
45794589
loc = loc.getAdvancedLoc(
45804590
archetype->getConformsTo().back()->getName().getLength());
45814591
replacement = " &";

0 commit comments

Comments
 (0)