Does SwiftSyntax have to be run on the main thread for some reason?

I have a syntax which works perfectly when run from the main thread, but when I wrap it like this:

DispatchQueue.global().async {
    let syntax = try SyntaxParser.parse(sourceURL)
    let result = myRewriter.visit(syntax)
}

I get an ExecBadAccess several layers deep into visitChildren

Is there a reason related to SwiftSyntax why this should not work?

I'm using the Swift 5.1 release of SwiftSyntax if it matters.

It may be this bug https://github.com/apple/swift-syntax/pull/205

Ah yes this seems to be exactly the issue, thanks! I guess the best solution is to try to increase the stack size of the thread

Terms of Service

Privacy Policy

Cookie Policy