Skip to content

Commit 3c3dd54

Browse files
committed
AST: Cut down on DescriptiveDeclKind usage in DiagnosticsParse.def
1 parent 2d899d0 commit 3c3dd54

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

include/swift/AST/DiagnosticsParse.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ ERROR(disallowed_var_multiple_getset,none,
229229
"'var' declarations with multiple variables cannot have explicit"
230230
" getters/setters", ())
231231
ERROR(stub_decl_cannot_have_body,none,
232-
"stub %0 cannot have body",
233-
(DescriptiveDeclKind))
232+
"stub %kindonly0 cannot have body",
233+
(const Decl *))
234234

235235
ERROR(disallowed_init,none,
236236
"initial value is not allowed here", ())

lib/Parse/ParseDecl.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6916,9 +6916,8 @@ bool Parser::parseMemberDeclList(SourceLoc &LBLoc, SourceLoc &RBLoc,
69166916
IDC->setMaybeHasDerivativeDeclarations();
69176917

69186918
if (Flags.contains(PD_StubOnly)) {
6919-
diagnose(LBLoc, diag::stub_decl_cannot_have_body,
6920-
IDC->getDecl()->getDescriptiveKind())
6921-
.fixItRemove({LBLoc, RBLoc});
6919+
diagnose(LBLoc, diag::stub_decl_cannot_have_body, IDC->getDecl())
6920+
.fixItRemove({LBLoc, RBLoc});
69226921

69236922
// Cache the empty result to prevent delayed parsing.
69246923
Context.evaluator.cacheOutput(ParseMembersRequest{IDC},
@@ -8299,9 +8298,8 @@ Parser::parseDeclVarGetSet(PatternBindingEntry &entry, ParseDeclOptions Flags,
82998298

83008299
// Reject accessors when we're parsing stubs only.
83018300
if (Flags.contains(PD_StubOnly) && !accessors.Accessors.empty()) {
8302-
diagnose(Tok, diag::stub_decl_cannot_have_body,
8303-
PrimaryVar->getDescriptiveKind())
8304-
.fixItRemove({ accessors.LBLoc, accessors.RBLoc });
8301+
diagnose(Tok, diag::stub_decl_cannot_have_body, PrimaryVar)
8302+
.fixItRemove({accessors.LBLoc, accessors.RBLoc});
83058303
Invalid = true;
83068304
}
83078305

@@ -9027,9 +9025,8 @@ void Parser::parseAbstractFunctionBody(AbstractFunctionDecl *AFD,
90279025
setIDEInspectionDelayedDeclStateIfNeeded();
90289026

90299027
if (Flags.contains(PD_StubOnly)) {
9030-
diagnose(BodyRange.Start, diag::stub_decl_cannot_have_body,
9031-
AFD->getDescriptiveKind())
9032-
.fixItRemove(BodyRange);
9028+
diagnose(BodyRange.Start, diag::stub_decl_cannot_have_body, AFD)
9029+
.fixItRemove(BodyRange);
90339030
AFD->setBody(nullptr, AbstractFunctionDecl::BodyKind::None);
90349031
}
90359032
}

0 commit comments

Comments
 (0)