Blake Anderson
11/10/2023, 7:02 AMjsTest
(but not jvmTest
).
IrLinkageError: Constructor 'RhovasSpec.<init>' can not be called: Can not instantiate abstract class 'RhovasSpec'
at throwLinkageError (C:\dev\Rhovas\Interpreter\build\compileSync\js\test\testDevelopmentExecutable\kotlin\js-ir\runtime\unlinked.kt:11:11)
at main (C:\dev\Rhovas\Interpreter\build\js\packages\Interpreter-test\kotlin\Interpreter-test.js:552:5)
...
The linked compilation output is this.
function main() {
var tmp = TestEngineLauncher_init_$Create$().withProjectConfig_bmospl_k$([]).withJs_d0wdap_k$();
throwLinkageError("Constructor 'RhovasSpec.<init>' can not be called: Can not instantiate abstract class 'RhovasSpec'");
}
Changing the class to be open
(instead of abstract
) results in the following compiler error:
java.lang.IllegalStateException: IrSimpleFunctionPublicSymbolImpl for dev.rhovas.interpreter/main|main(){}[0] is already bound: FUN name:main visibility:public modality:FINAL <> () returnType:<unbound IrClassPublicSymbolImpl>
at org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.bind(IrPublicSymbolBase.kt:69)
at org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl.<init>(IrFunctionImpl.kt:49)
Since jvmTest
is fine, this is very likely a JS IR compiler bug. Tracing through previous versions, this also occurs on both 1.9.0 and 1.9.10, however it only shows the full stacktrace with 1.9.20 FWIW; I'm using Kotest as well and there's some JS-specific things here to workaround a bug so that adds some complexity to this. The class is defined here.
Any ideas? As-is this would block me from updating and the theoretical workaround (open class
) doesn't work.turansky
11/10/2023, 8:01 AM./gradlew clean
?turansky
11/10/2023, 8:02 AMBlake Anderson
11/10/2023, 8:33 PMabstract class
and it doesn't work, but looks like clean does fix the illegal state exception with open class
, which at least unblocks me. I opened a ticket for this: https://youtrack.jetbrains.com/issue/KT-63399/Kotlin-JS-IrLinkageError-Constructor-can-not-be-called-can-not-instantiate-abstract-class