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

nullary patterns in function heads cause syntax errors #123

Open
BrianHicks opened this issue Jun 27, 2022 · 1 comment
Open

nullary patterns in function heads cause syntax errors #123

BrianHicks opened this issue Jun 27, 2022 · 1 comment

Comments

@BrianHicks
Copy link

Hello! I've got something a little weird. I'm making some tools with tree-sitter-elm and found that nullary patterns in function heads will cause a syntax error in tree-sitter-elm, but be accepted by Elm proper. Here's a SSCCE:

module Main exposing (..)


type Foo
    = Bar


fooToString : Foo -> String
fooToString Bar =
    "Bar"

Tree-sitter-elm will say there's a syntax error on line 9, column 13 (the Bar in fooToString Bar.) Changing Bar to _ resolves the problem.

Here it is in an Ellie, being compiled by Elm: https://ellie-app.com/hST6r7VtQjKa1

@razzeee
Copy link
Member

razzeee commented Jun 27, 2022

I can reproduce this.

IntelliJ elm seems to have the same problem.

It's caused by this choice not allowing anything that starts with an uppercase. https://github.com/elm-tooling/tree-sitter-elm/blob/main/grammar.js#L209

https://github.com/klazuka/intellij-elm/blob/master/src/main/grammars/ElmParser.bnf#L185

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

2 participants