-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Error on REPL with implicit parens #1420
Comments
It doesn't look like it's the REPL's fault: edit: It looks like pretty much everything that's similar but slightly different compiles fine. So it's a bug, but definitely not the REPL's fault. |
Ah, so the root cause of the problem is that
gives you an error. Gotcha. Any idea how the unbalance is happening? These all work:
and this gets the same error:
So the major commonality in all the error cases is that |
A little debugging output:
tokens: [ [ '(', '(', 0 ], [ 'IDENTIFIER', 'fn', 0 ], [ 'CALL_START', '(', 0 ], [ 'CALL_END', ')', 0, spaced: true ], [ 'CALL_START', '(', 0 ], [ 'IDENTIFIER', 'a', 0 ], [ 'CALL_END', ')', 0 ], [ ')', ')', 0 ], [ 'TERMINATOR', '\n', 0 ] ] pair counts: { '(': 0, '[': 0, '{': 0, INDENT: 0, CALL_START: 0, PARAM_START: 0, INDEX_START: 0 } [( (] [IDENTIFIER fn] [CALL_START (] [CALL_END )] [CALL_START (] [IDENTIFIER a] [CALL_END )] [) )] [TERMINATOR \n] So everything gets paired up at the end (all the counts end at zero and never dip below zero).
coffee -te "(fn() ->)" tokens: [ [ 'PARAM_START', '(', 0 ], [ 'IDENTIFIER', 'fn', 0 ], [ 'CALL_START', '(', 0 ], [ 'CALL_END', ')', 0, spaced: true ], [ 'CALL_START', '(', 0 ], [ '->', '->', 0 ], [ 'INDENT', 2, 0, generated: true ], [ 'OUTDENT', 2, 0, generated: true ], [ 'CALL_END', ')', 0 ], [ ')', ')', 0 ], [ 'TERMINATOR', '\n', 0 ] ] pair counts: { '(': -1, '[': 0, '{': 0, INDENT: 0, CALL_START: 0, PARAM_START: 1, INDEX_START: 0 } Error: too many ) on line 1 Here, we see a update: the problem is definitely in the lexer, most likely the |
@TrevorBurnham: should be fixed by the above commit. |
whitespace in the function invocation tests
The code
is perfectly legit, equivalent to
a(b)(-> c)
. But on the REPL, it fails with the message(as of the current master; error message is
on line 1
on 1.1.1). Note that this is the same error that was happening in #1398 with comments (since fixed by Michael).To be clear,
works fine, but
fails.
The text was updated successfully, but these errors were encountered: