Skip to content

Assertion failed: Too many unresolved delimiter token lengths for enum cases with associated values when using prioritizeKeepingFunctionOutputTogether: true  #726

@ahoppen

Description

@ahoppen

Formatting the following file with the following configuration cause an assertion failure

enum Error {
  case alreadyOpen(Int)
}
{
    "version": 1,
    "prioritizeKeepingFunctionOutputTogether": true
}

Stack trace:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib            	       0x1947691e8 _assertionFailure(_:_:file:line:flags:) + 268
1   swift-format                  	       0x10316b5c8 PrettyPrinter.prettyPrint() + 4568 (PrettyPrint.swift:680)
2   swift-format                  	       0x10317c380 SwiftFormatter.format<A>(syntax:operatorTable:assumingFileURL:source:to:) + 1376 (SwiftFormatter.swift:164)
3   swift-format                  	       0x10317bd20 SwiftFormatter.format<A>(source:assumingFileURL:to:parsingDiagnosticHandler:) + 428 (SwiftFormatter.swift:110)
4   swift-format                  	       0x103bc3fd4 FormatFrontend.processFile(_:) + 1560 (FormatFrontend.swift:65)
5   swift-format                  	       0x103bc69bc implicit closure #8 in implicit closure #7 in Frontend.processURLs(_:parallel:) + 56 (Frontend.swift:143)
6   swift-format                  	       0x103bc69e8 thunk for @callee_guaranteed (@guaranteed Frontend.FileToProcess) -> (@error @owned Error) + 28
7   swift-format                  	       0x103bc887c partial apply for thunk for @callee_guaranteed (@guaranteed Frontend.FileToProcess) -> (@error @owned Error) + 28
8   libswiftCore.dylib            	       0x19480a9f8 Sequence.forEach(_:) + 688
9   swift-format                  	       0x103bc66ec Frontend.processURLs(_:parallel:) + 1356 (Frontend.swift:143)
10  swift-format                  	       0x103bc5da0 Frontend.run() + 516 (Frontend.swift:93)
11  swift-format                  	       0x103bbf6fc closure #1 in SwiftFormatCommand.Format.run() + 116 (Format.swift:45)
12  swift-format                  	       0x103bbf7f8 partial apply for closure #1 in SwiftFormatCommand.Format.run() + 24
13  swift-format                  	       0x103bd5e90 PerformanceMeasurementsOptions.printingInstructionCountIfRequested<A>(_:) + 140 (PerformanceMeasurement.swift:24)
14  swift-format                  	       0x103bbf608 SwiftFormatCommand.Format.run() + 160 (Format.swift:43)
15  swift-format                  	       0x103bc0e74 protocol witness for ParsableCommand.run() in conformance SwiftFormatCommand.Format + 44
16  swift-format                  	       0x102fc6910 static ParsableCommand.main(_:) + 576 (ParsableCommand.swift:142)
17  swift-format                  	       0x102fc715c static ParsableCommand.main() + 52 (ParsableCommand.swift:159)
18  swift-format                  	       0x103bda73c static SwiftFormatCommand.$main() + 40
19  swift-format                  	       0x103bdb524 main + 12 (SwiftFormatCommand.swift:18)
20  dyld                          	       0x184b010e0 start + 2360

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