Skip to content

Commit 4c8450e

Browse files
committed
[Typechecker] Add a comment to explain why we don't offer a fix-it when prefix/postfix is missing
1 parent 37ffd6b commit 4c8450e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,8 @@ diagnoseMatch(ModuleDecl *module, NormalProtocolConformance *conformance,
21292129
auto diag = diags.diagnose(
21302130
witness, diag::protocol_witness_prefix_postfix_conflict, false,
21312131
witness->getAttrs().hasAttribute<PostfixAttr>() ? 2 : 0);
2132+
// We already emit a fix-it when we're missing the attribute, so only
2133+
// emit a fix-it if the attribute is there, but is not correct.
21322134
if (auto attr = witness->getAttrs().getAttribute<PostfixAttr>()) {
21332135
diag.fixItReplace(attr->getLocation(), "prefix");
21342136
}
@@ -2140,6 +2142,8 @@ diagnoseMatch(ModuleDecl *module, NormalProtocolConformance *conformance,
21402142
auto diag = diags.diagnose(
21412143
witness, diag::protocol_witness_prefix_postfix_conflict, true,
21422144
witness->getAttrs().hasAttribute<PrefixAttr>() ? 1 : 0);
2145+
// We already emit a fix-it when we're missing the attribute, so only
2146+
// emit a fix-it if the attribute is there, but is not correct.
21432147
if (auto attr = witness->getAttrs().getAttribute<PrefixAttr>()) {
21442148
diag.fixItReplace(attr->getLocation(), "postfix");
21452149
}

0 commit comments

Comments
 (0)