I just updated one of my projects to use both `LEG...
# javascript
e
I just updated one of my projects to use both
LEGACY
and
IR
compilers to support some users (I was only using
IR
before). After doing so I got strange test failures that were all related to conditions in a
when
not matching properly. Works on JS IR and all other backends except JS LEGACY:
Copy code
when(uriString[end]) {
  '/',
  '\\',
  '?',
  '#'
  -> break // break isn't executed when uriString[end] == '/'
}
Works on all backends:
Copy code
val c = uriString[end]
if(c == '/' || c == '\\' || c == '?' || c == '#') break
Is behavior like this expected?
t
I don’t know about this specific case, and in general I don’t know the details of JS Legacy issues related to the handling of `Char`s, but I’ve encountered a number of them. And I seem to recall seemingly non-relevant factors played a role there too, with the exact same code sometimes working and sometimes not working depending on whether it’s in a global/static/member function and on whether the function is public or private. From issues on YouTrack (some reported by me and some by others) it seems JetBrains have no intention of fixing JS Legacy issues unless they’re critical, so if supporting JS Legacy is important to you, and if you’ve got a working workaround, just use that. (Clarification: I’m not affiliated with JetBrains and the above is merely my impression from discussions I’ve witnessed and participated in on YouTrack.)
t
Do you use global constants for chars?
e
Nope the chars are literals