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

[SR-14529] swift-format-ignore inside switch causes linter to crash #309

Open
swift-ci opened this issue Apr 26, 2021 · 0 comments
Open
Labels
bug Something isn't working swift-format

Comments

@swift-ci
Copy link

Previous ID SR-14529
Radar None
Original Reporter afannin (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Bug
Assignee None
Priority Medium

md5: 7cb3c42b9551dc52aa2896c609bb2f3e

Issue Description:

Adding // swift-format-ignore inside a case in a switch statement causes the linter to crash with the following message:

Fatal error: At least one .break(.open) was not matched by a .break(.close): file SwiftFormatPrettyPrint/PrettyPrint.swift, line 689

Example code that causes the crash is below (running swift-format -r -m lint .):

class Test {
 enum FooBar: String {
     case foo
     case bar
 }
 
 func myFunc(_ val: FooBar) {
     switch val {
     case .foo:
         // swift-format-ignore
         print("Foo")
     case .bar:
         print("Bar")
     }
   }
}
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swift-format
Projects
None yet
Development

No branches or pull requests

1 participant