rescript-compiler
rescript-compiler copied to clipboard
Template literal strings in pattern matching don't compile to unicode
This code will return false:
let test = switch `ü` {
| `ü` => true
| _ => false
}
Compiled JS output:
var test = "ü" === "\xc3\xbc" ? true : false;
As a user, this caught me by surprise since I was expecting strings in backticks to always compile to unicode and there is no compiler warning or documentation (as far as I know).
See https://forum.rescript-lang.org/t/unicode-support-in-pattern-matching/2380 for reference on my initial post about this on the forum where I was asked to file an issue here.
I have also spotted this related issue in the syntax repo that was closed with added backtick parsing in switch statements: https://github.com/rescript-lang/syntax/issues/314