Hi, I'm trying (and so far failing) to understand why evaluating the following code in a scratch file in idea results in unexpected (for me) output:
Copy code
val l = mutableListOf("a")
l[0] = "b"
val x = l.first()
println("""$x=${l.first()}""")
⇒
Copy code
val l: MutableList<String>
val x: String
a=b
When evaluated with "Use REPL" or via run command from the menu it prints "b=b" instead.
Am I missing something or is this a bug?
(If this is too intellij-specific and not getting-started-related enough, I'll be happy to move this to #intellij)
d
Dmitry
01/05/2021, 3:19 PM
It’s definitely is an unexpected result.
IntelliJ scratch is showing incorrect result. Looks like a bug in Kotlin plugin for IntelliJ, that evaluates scratch file. I would suggest opening ticket