Skip to content

swift-format-ignore in conditionally-compiled code results in an assertion failure in PrettyPrint.swift #1079

@a7medev

Description

@a7medev

When running a debug build of swift-format on a file with the following content:

#if FOO
// swift-format-ignore
print("Hi")
#endif

swift-format crashes with the following assertion failure:

SwiftFormat/PrettyPrint.swift:720: Assertion failed: Too many unresolved delimiter token lengths.

I tested this on a new build from main (commit 80bcc35).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions