Closed holgerbrandl closed 2 years ago
@holgerbrandl thanks for reporting! It seems to be one more problem of scripts code generation, but can be easily workarounded on kernel side. I'll try to provide a better solution on scripting side later.
The downside of this workaround is that if you have defined a renderer for type A
, and defined anonymous object object : A() {}
, it will not be rendered with A
's renderer.
@holgerbrandl @altavir try updating to 0.10.3.31
Works in DataLore on 0.10.3.31
.
Just to remember: reproducer in Kotlin JvmReplTest
:
fun testAnonymousObjectReflection() {
JvmTestRepl()
.use { repl ->
assertEvalResult(repl, "42", 42)
assertEvalUnit(repl, "val sim = object : ArrayList<String>() {}")
val compiledSnippet = checkCompile(repl, "sim")
val evalResult = repl.eval(compiledSnippet!!)
val a = (evalResult.valueOrThrow().get().result as ResultValue.Value).value!!
assertTrue(a::class.isSubclassOf(Any::class))
}
}
Works like charm now. Thank you so much for your great and blazingly fast support.
Consider the following example
When using
sim
in a second code-cell this fails with:Since object expressions are a very useful tool when prototyping (i.e. working with notebooks), it would be most wonderful if this language feature could be fixed/enabled for the kernel.
Used kernel version: Kotlin kernel v. 0.10.3.20, Kotlin v. 1.6.20-dev-3702