Skip to content

Unclosed array literal #5

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

Open
littledan opened this issue Oct 13, 2018 · 1 comment
Open

Unclosed array literal #5

littledan opened this issue Oct 13, 2018 · 1 comment

Comments

@littledan
Copy link
Collaborator

What is the code triggering the message?

let arr = [1, 2, 3
print(arr[0])

What went wrong in the code? What is the system trying to tell you?

The array literal is left open; I forgot to put a closing ].

What error message do you see?
Which JavaScript environment produced this error?

#### jsc
SyntaxError: Unexpected identifier 'print'. Expected either a closing ']' or a ',' following an array element.

#### V8
SyntaxError: Unexpected identifier

#### chakracore
SyntaxError: Expected ']'

#### spidermonkey
SyntaxError: missing ] after element list:

What error message would you like to see?

JSC's style of error message in all engines would be the best!

Do you agree to license your suggested error message under an MIT-style license?

Yes

@codehag
Copy link
Owner

codehag commented Oct 17, 2018

Just want to see if this has any potential, so i am testing it out with this error -- what do you think about doing elm style error messages?

SyntaxError: Unexpected identifier 'print'. Expected either a closing ']' or a ',' following an array element.

   --> components/some.js:511:26
511 |         let arr = [1, 2, 3
    |                          ^-
    |                          |
    |                          Expected either a closing ']' or a ',' following an array element.
512 |        print(arr[0]);
    | -------^^^^^
    |         |
    |         Unexpected identifier 'print'.

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