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

Data race runtime warnings, when LanguageLayer is adding a new sub-layer #47

Open
dvclmn opened this issue Sep 8, 2024 · 0 comments
Open

Comments

@dvclmn
Copy link

dvclmn commented Sep 8, 2024

Error message:

warning: data race detected: @MainActor function at
{PackageName}/{FileName}:{LineNumber} was not
called on the main thread

Here is the line highlighted by the purple runtime warning, from LanguageLayer.swift.

Here was the code used to initialise a TextViewHighlighter, that brought about the warnings.

It's just now occurred to me that the actual error is happening on code from SwiftTreeSitter, not Neon itself. Would you prefer me to post over there?

Neon is being used in my case from within a Swift Package, and the below snippet from my Package.swift was being used to enable strict concurrency checking:

for target in package.targets {
  target.swiftSettings = target.swiftSettings ?? []
  target.swiftSettings?.append(
    .unsafeFlags([
      "-Xfrontend", "-warn-concurrency",
      "-Xfrontend", "-enable-actor-data-race-checks"
    ])
  )
}

Removing this, and replacing it with the below, does make the warnings go away.

swiftSettings: [
    .enableExperimentalFeature("StrictConcurrency")
]
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

No branches or pull requests

1 participant