Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SwiftParser/Lookahead.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ extension Parser.Lookahead {
}

// If we don't have attributes, then it cannot be an accessor block.
if nextToken.rawTokenKind != .atSign {
guard self.peek(isAt: .atSign) else {
return false
}

Expand Down
12 changes: 12 additions & 0 deletions Tests/SwiftParserTest/DeclarationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3768,4 +3768,16 @@ final class UsingDeclarationTests: ParserTestCase {
"""
)
}

func testAccessorBlockAfterPatternBindingDeclWithAttribute() {
assertParse(
"""
var x: Int = 2
{
@something
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rintaro Do you have an idea what kind of attribute would make sense here, I can’t think of anything.

didSet {}
}
"""
)
}
}