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-8910] Swift Syntax - Trouble Parsing # sign syntax #443

Closed
swift-ci opened this issue Oct 4, 2018 · 3 comments
Closed

[SR-8910] Swift Syntax - Trouble Parsing # sign syntax #443

swift-ci opened this issue Oct 4, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Oct 4, 2018

Previous ID SR-8910
Radar rdar://problem/45049365
Original Reporter loganwright (JIRA User)
Type Bug
Environment

Mac

Additional Detail from JIRA
Votes 1
Component/s SwiftSyntax
Labels Bug
Assignee None
Priority Medium

md5: be1d5a0a862ac57009440f63a00bba35

Issue Description:

I had seen it before on an `#if !os(macOS)` but I wasn't able to replicate.

Basically, SwiftSyntax crashes on pound syntax, notably `#file`

Version:
`.package(url: "https://github.com/apple/swift-syntax", from: "0.40200.0"),`

Repro:
```
func example() {
let _ = #file
}
```

Create a SyntaxVisitor that visits functions. It was crashing with a `bus 10` error.

@belkadan
Copy link

belkadan commented Oct 5, 2018

@swift-ci create

@nkcsgexi
Copy link
Member

loganwright (JIRA User) i used SwiftSyntax to visit the given code example as such

import Foundation
 import SwiftSyntax

let input = URL(fileURLWithPath: "/tmp/test.swift")
 let result = try! SyntaxTreeParser.parse(input)

class Visitor: SyntaxVisitor {
   override open func visit(_ node: PoundFileExprSyntax)

{     print("visited")   }

}

Visitor().visit(result)

This code executes successfully without hitting a `bus 10` error.

Could you also share the code example you were using to visit the crashing case?

@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
@CodaFi
Copy link
Member

CodaFi commented Sep 8, 2022

This no longer reproduces with the new parser or the old SwiftSyntaxParser. Please verify this against a recent checkout of swift-syntax.

@ahoppen ahoppen closed this as completed Oct 25, 2022
adevress pushed a commit to adevress/swift-syntax that referenced this issue Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants