When using a string template like ```took: $`it`m...
# getting-started
m
When using a string template like
Copy code
took: $`it`ms
the compiler gives a warning saying the backticks are redundant. But then removing the backticks gives a compiler error!
j
I think what you want is
"took ${it}ms"
. In the case of
"took $itms"
the compiler is going to look for a variable called "itms" instead of "it".
m
Yes, that also works. But the backticks way should not give a “redundant” warning, though perhaps a suggestion to use the way you suggest. Although in this case I think backticks are more appropriate because it’s specifically saying this is a value, not some more general code.
j
I'm guessing that the warning is just not context aware. Would be nice for the compiler to emit a more specific warning in cases like this.
m
Yes, although there shouldn’t be a warning at all IMO.
i
@Mark Thank you! I've created an issue: https://youtrack.jetbrains.com/issue/KT-35051
🙏 2
👍 1