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

Formatter bug #4782

Closed
benoist opened this issue Aug 3, 2017 · 1 comment · Fixed by #4784
Closed

Formatter bug #4782

benoist opened this issue Aug 3, 2017 · 1 comment · Fixed by #4784

Comments

@benoist
Copy link
Contributor

benoist commented Aug 3, 2017

This code:

object[foo: "foo",
  bar: "bar"
]

After first format, gets formatted to: (note the extra comma after "bar")

object[foo: "foo",
  bar: "bar",
]

After second format:
Syntax Error: expected named argument, not ]

Crystal version:
Crystal 0.23.1 (2017-07-13) LLVM 4.0.1

makenowjust added a commit to makenowjust/crystal that referenced this issue Aug 3, 2017
…tation

Fix crystal-lang#4782

For example, current compiler cannot compile this:

    a = [1, 2, 3]
    a[
      index: 1,
    ]
    # Syntax error in foo.cr:4: expected named argument, not ]

Because the compiler does not allow comma after named arguments in index
notation. This fixes it so above is now working.
@makenowjust
Copy link
Contributor

This is a bug about the parser because trailing comma in index notation should be parsed also. I fixed this in #4784. Thank you for reporting 👍

RX14 pushed a commit that referenced this issue Aug 16, 2017
…tation (#4784)

Fix #4782

For example, current compiler cannot compile this:

    a = [1, 2, 3]
    a[
      index: 1,
    ]
    # Syntax error in foo.cr:4: expected named argument, not ]

Because the compiler does not allow comma after named arguments in index
notation. This fixes it so above is now working.
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