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

Multiple assignment count mismatch #5793

Closed
benjis opened this issue Mar 8, 2018 · 2 comments
Closed

Multiple assignment count mismatch #5793

benjis opened this issue Mar 8, 2018 · 2 comments

Comments

@benjis
Copy link

benjis commented Mar 8, 2018

According to: https://crystal-lang.org/docs/syntax_and_semantics/multiple_assignment.html

If the left-hand side contains just one variable, the right-hand side is considered an array:
names = "John", "Peter", "Jack"

The above is the same as:

names = ["John", "Peter", "Jack"]

However, above code throws "Multiple assignment count mismatch" syntax error.

➜  ~ crystal test.cr
Syntax error in test.cr:1: Multiple assignment count mismatch

names = "John", "Peter", "Jack"
^

Is this intended behaviour in Crystal or the doc needs a update?

  • Crystal 0.24.1 (2018-01-27)
  • LLVM: 5.0.1
  • Default target: x86_64-apple-macosx
@pblca
Copy link
Contributor

pblca commented Mar 8, 2018

It looks as though the spec doesn't allow for this behavior, suspect the docs are wrong at this point

assert_syntax_error "a = 1, 2, 3", "Multiple assignment count mismatch"

@straight-shoota
Copy link
Member

Bare array creation was removed in 0.24.0 (see #4824). The language reference has not yet been updated.

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

3 participants