coffeescript icon indicating copy to clipboard operation
coffeescript copied to clipboard

Array containment test broken on master?

Open odf opened this issue 15 years ago • 5 comments

This happens on commit 97f8e9ce1c0e:

coffee> f = (x) -> x in [1..3]
Error: In repl, Parse error on line 1: Unexpected 'FORIN'
    at Object.parseError (/home/olaf/JavaScript/coffee-script/lib/parser.js:470:11)
    at Object.parse (/home/olaf/JavaScript/coffee-script/lib/parser.js:540:22)
    at /home/olaf/JavaScript/coffee-script/lib/coffee-script.js:26:22

It works in 0.9.6

odf avatar Dec 24 '10 10:12 odf

Works again in 1.0.0

odf avatar Dec 25 '10 09:12 odf

I cannot reopen this issue, @odf can you? In 1.1.1 the following does not compile but instead raises the parse error Unexpected 'FORIN'

y = 'a'
arr = [1, 'b', 'a']
if (y in arr)
^   alert(12)

pearjoint avatar Jun 19 '11 23:06 pearjoint

No, I can't reopen either.

odf avatar Jun 19 '11 23:06 odf

Update -- this is too strange: the above test code compiles everywhere except as a method in a single inheriting class file of mine... which compiles just fine if i remove the line with the in-array test though.

pearjoint avatar Jun 19 '11 23:06 pearjoint

@pearjoint: If you can provide a repeatable test case, I can reopen the issue for you.

michaelficarra avatar Jun 20 '11 03:06 michaelficarra