Skip to content

(lib/IDE) @_documentation attribute always crashes sourcekit-lsp #64309

@tayloraswift

Description

@tayloraswift

using the @_documentation attribute always crashes sourcekit-lsp on the 5.8 branch.

@_documentation(visibility: public)
enum E
{
}

both @_documentation(visibility:) and @_documentation(metadata:) are affected, as well as both quoted and un-quoted metadata forms.

it appears to trip this assertion in lib/IDE/SyntaxModel.cpp:

sourcekit-lsp: /home/build-user/swift/lib/IDE/SyntaxModel.cpp:1343: auto (anonymous namespace)::ModelASTWalker::handleAttrRanges(ArrayRef<(anonymous namespace)::ModelASTWalker::DeclAttributeAndRange>)::(anonymous class)::operator()(swift::SourceRange) const: Assertion `(TokenNodes.empty() || SM.isBeforeInBuffer(AttrRange.End, TokenNodes.front().Range.getStart())) && "AttrRange doesn't align with any TokenNode?"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.

this happens on swift-5.8-DEVELOPMENT-SNAPSHOT-2023-02-23-a.

$ swift --version
Swift version 5.8-dev (LLVM 44d4f9d4b49845f, Swift b9562e1a860ec0b)
Target: x86_64-unknown-linux-gnu

Metadata

Metadata

Assignees

No one assigned

    Labels

    @_documentationFeature → attributes: the @_documentation attributeattributesFeature: Declaration and type attributesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwaresource toolingArea: IDE support, SourceKit, and other source toolingswift 5.8

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions