Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ahoppen opened this issue Apr 24, 2024 · 1 comment · Fixed by #728

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Apr 24, 2024

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
@ahoppen
Copy link
Contributor Author

ahoppen commented Apr 24, 2024

Synced to Apple’s issue tracker as rdar://126994097

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant