[ASTGen] Fix SetterAccessAttr e.g. private(set)

'set' part was not parsed as a keyword. Let's just compare the text.
This commit is contained in:
Rintaro Ishizaki
2025-02-17 22:15:17 -08:00
parent 30068c87d7
commit 7dd8944512
2 changed files with 6 additions and 1 deletions

View File

@@ -1983,7 +1983,10 @@ extension ASTGenVisitor {
-> BridgedDeclAttribute?
{
if let detail = node.detail {
precondition(detail.detail.keywordKind == .set, "only accepted modifier argument is '(set)'")
guard detail.detail.rawText == "set" else {
// TODO: Diagnose
fatalError("only accepted modifier argument is '(set)'")
}
return BridgedSetterAccessAttr.createParsed(
self.ctx,
range: self.generateSourceRange(node),

View File

@@ -141,6 +141,8 @@ struct TestVars {
var s: Int {
get async throws { return 0 }
}
private(set) var testPrivateSet = 1
}
extension TestVars {