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

Pattern parser not hinting at missing comma #2328

Open
Golden-Phy opened this issue May 26, 2024 · 1 comment
Open

Pattern parser not hinting at missing comma #2328

Golden-Phy opened this issue May 26, 2024 · 1 comment

Comments

@Golden-Phy
Copy link

Quick Summary: When destructuring a tuple a missing comma will lead the parser to correctly complain at the next token, but the message fails to communicate that a comma (,) is also a valid continuation of the pattern.

SSCCE

module Main exposing (..)

import Browser
import Html exposing (Html, div, text)

-- MAIN
main =
  Browser.sandbox { init = init, update = update, view = view }

-- UPDATE
update : () -> Model -> Model
update _ model =
  model

-- MODEL
type alias Model = Int

init : Model
init = 3

-- VIEW
view : Model -> Html ()
view model =
    div [] [text (String.fromInt(factorial (model, 0)))]
    
factorial : (Int, Int) -> Int
factorial (i _) =
  if i <= 1 then 1 else i * (factorial (i - 1 , 1))
  • Elm: Playground on https://elm-lang.org/try as of 26/5/2024
  • Browser: Mozilla Firefox for Fedora 123.0 (64)
  • Operating System: Fedora 39

Additional Details

Compiler output:

UNFINISHED PARENTHESES
Jump to problem
I was partway through parsing a pattern, but I got stuck here:

27| factorial (i _) =

                 ^
I was expecting a closing parenthesis next, so try adding a ) to see if that
helps?
Copy link

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.

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