Hi, I'm trying (and so far failing) to understand ...
# getting-started
m
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
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
👍 1
m
Thanks for confirmation! Somehow my quick scan of issues failed to turn up these prior -- now I see this seems to be a known¹ bug². ¹ https://youtrack.jetbrains.com/issue/KT-30479 ² https://youtrack.jetbrains.com/issue/KT-35512