I'm currently looking at <KT-39891> . As mentioned...
# compiler
a
I'm currently looking at KT-39891 . As mentioned in the ticket the problem could be solved by adding
toString()
calls for the different
expression.arguments
(here). The "pre IR" translator had a similar mechanism. However I'm unsure why the pre IR code also added
toString
for the other types (Any, Comparable, Number)? At least if I look at the kotlin.js , I can only see
Long
and
BoxedChar
implementing
valueOf
.
Ok, I think I just understood why it also needs to add
toString()
for types
Any
,
Number
and
Comparable
. These are the interfaces/super classes that are implemented by Long 🤦‍♂️
Does it make sense to add the
toString()
calls directly in the
IrElementToJsExpressionTransformer
or would it be better to handle such cases during the "lowering" ? Adding the
toString
calls for "normal" values would be easy, however it gets more complex if the values are optional
b
I think it’s better to do by lowering, otherwise, for example, we need keep in sync it with DCE.
a
I gave this a shot on the weekend and implemented some lowering steps that would fix this issue: https://github.com/JetBrains/kotlin/pull/4364
@bashor is this going in the direction you had in mind?
u
… cc @anton.bannykh (?)
b
@andi Hi! I’m sorry for the delay. We will take a look on it soon.
a
Thanks 👍 . I'll try to rebase the PR as well. But I think I will only get to it starting next week