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

PureScript and Haskell conflict #1

Closed
postsolar opened this issue Feb 22, 2024 · 2 comments · Fixed by #2
Closed

PureScript and Haskell conflict #1

postsolar opened this issue Feb 22, 2024 · 2 comments · Fixed by #2

Comments

@postsolar
Copy link
Contributor

postsolar commented Feb 22, 2024

The title refers to this:

zat/src/file_types.zig

Lines 214 to 219 in 10de00d

// conflicts with haskell
// pub const purescript = .{
// .extensions = &[_][]const u8{"purs"},
// .comment = "--",
// .injections = @embedFile("tree-sitter-purescript/queries/injections.scm"),
// };

Hi 👋, I'm the maintainer of PureScript TS grammar. It started as a fork of Haskell's grammar and its C scanner was mostly left untouched (due to me not knowing C).

Indeed if I uncomment this filetype and try to build zat I'm getting:

└─ install zat
   └─ zig build-exe zat ReleaseSmall native 1 errors
error: ld.lld: duplicate symbol: state_new
    note: defined at scanner.c
    note:            /tmp/zat/zig-cache/o/2f3c88c48c0e525bd29533e3aac02ab0/scanner.o:(state_new) in archive /tmp/zat/zig-cache/o/ac7b81e2c1f5d0f85b023adfbed9accb/libtree-sitter.a
    note: defined at scanner.c
    note:            /tmp/zat/zig-cache/o/2b99987fca3759990739259e47c5877a/scanner.o:(.text+0x0) in archive /tmp/zat/zig-cache/o/ac7b81e2c1f5d0f85b023adfbed9accb/libtree-sitter.a

I would be very grateful if you could brief me on what is the issue and/or direct me towards what I could do on my end to resolve this incompatibility. I think I fixed it

postsolar added a commit to postsolar/tree-sitter-purescript that referenced this issue Feb 23, 2024
I suspect this is what causing issues for multiple projects attempting to use this grammar:

- neurocyte/zat#1

- zed-industries/zed#7543 (comment)

Don't know why it wasn't static in the first place (in the original Haskell grammar),
but I looked at what other grammars do and none export any functions other than those used by Tree-sitter.
postsolar added a commit to postsolar/tree-sitter-purescript that referenced this issue Feb 23, 2024
I suspect this is what causing issues for multiple projects attempting to use this grammar:

- neurocyte/zat#1

- zed-industries/zed#7543 (comment)

Don't know why it wasn't static in the first place (in the original Haskell grammar),
but I looked at what other grammars do and none export any functions other than those used by Tree-sitter.
@postsolar
Copy link
Contributor Author

I think I fixed it in postsolar/tree-sitter-purescript@08cdbb8, it now works for me (I tested it by updating https://github.com/neurocyte/tree-sitter on my fork and building with this updated dependency).

So I believe if you update tree-sitter and its dep here it should work. I'll issue a follow-up PR to enable PureScript.

@neurocyte
Copy link
Owner

Good to know that the purescript/haskell conflict is resolved. I will merge your PR after updating.

Note that both haskell and purescript parsers apparently have sanitizer bugs so I will also disable the sanitizer in tree-sitter first. (zig enables it by default unlike clang)

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.

2 participants