Bug: using "not in" operator in switch works as "in" instead
Opened this issue · 0 comments
hendricha commented
switch
when thing in arr
console.log 'this'
when thing not in arr
console.log 'that'Expected Behavior
The above should probably compile to something along the lines of this:
var indexOf = [].indexOf;
switch (false) {
case indexOf.call(arr, thing) < 0:
console.log('this');
break;
case indexOf.call(arr, thing) >= 0:
console.log('that');
}Current Behavior
It however compiles to this:
var indexOf = [].indexOf;
switch (false) {
case indexOf.call(arr, thing) < 0:
console.log('this');
break;
case indexOf.call(arr, thing) < 0:
console.log('that');
}Environment
- CoffeeScript version: 2.7.0
- Node.js version: some version of 14 for legacy reasons
But the thing happens even on the "try coffeescript" page on the website too
Other context
This does not happen in coffee v1 nor in civet with coffee compat