diff --git a/Sources/SwiftParser/Lookahead.swift b/Sources/SwiftParser/Lookahead.swift index 90748e2cd38..ff3b1a66b2f 100644 --- a/Sources/SwiftParser/Lookahead.swift +++ b/Sources/SwiftParser/Lookahead.swift @@ -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 } diff --git a/Tests/SwiftParserTest/DeclarationTests.swift b/Tests/SwiftParserTest/DeclarationTests.swift index 5818b008d85..44c95f9ed38 100644 --- a/Tests/SwiftParserTest/DeclarationTests.swift +++ b/Tests/SwiftParserTest/DeclarationTests.swift @@ -3831,4 +3831,16 @@ final class UsingDeclarationTests: ParserTestCase { ) ) } + + func testAccessorBlockAfterPatternBindingDeclWithAttribute() { + assertParse( + """ + var x: Int = foo() + { + @available(*, deprecated) + didSet {} + } + """ + ) + } }