https://kotlinlang.org logo
d

dave

02/04/2021, 12:53 PM
Is there a channel here to track issues with 1.4.30? I'm upgrading one of my libraries and am encountering a problem compilation (this happens when I make an inline class constructor private). Just want some advice to see if anyone else here is also experiencing this before raising an issue:
Copy code
> Task :values4k:compileTestKotlin FAILED
e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong bytecode generated
   L0
    LINENUMBER 17 L0
    ALOAD 0
    ILOAD 0
    INVOKESTATIC Money.constructor-impl (I)I
    IRETURN
   L1
    LOCALVARIABLE this LMoney; L0 L1 0
    LOCALVARIABLE value I L0 L1 1
    LOCALVARIABLE $constructor_marker Lkotlin/jvm/internal/DefaultConstructorMarker; L0 L1 2
    MAXSTACK = 2
    MAXLOCALS = 3
File is unknown
j

Javier

02/04/2021, 1:02 PM
have you enabled new IR?
d

dave

02/04/2021, 1:06 PM
This is without that. I'll try with it on.
Ok - so that compiles ok 👍 😃 - thank you! Next question - should it compile with the old backend - presumably yes? And I'm not sure about the ramifications of what that means practically from a library maintainer point of view WRT to people consuming the library,.
v

Vampire

02/04/2021, 2:02 PM
The "old backend" as the "stable backend", opposed to the "new backend" as the "experimental backend"? I hope so. 😉
d

dave

02/04/2021, 2:03 PM
well it's certainly stable in that it always fails to compile the code in question 😉
j

Javier

02/04/2021, 2:03 PM
@dave it shouldnt
d

dave

02/04/2021, 2:03 PM
that was my next question. 🙂
j

Javier

02/04/2021, 2:04 PM
Copy code
This feature requires Kotlin compiler 1.4.30-RC and enabling new IR compilers for JS and JVM.
d

dave

02/04/2021, 2:06 PM
aha - thanks @Javier 🙂 . WRT to my question - is there any (known) reason why it wouldn't be safe to release a library into the wild that was compiled with the IR backend? (Assuming not, but good to check! 🙂 )
j

Javier

02/04/2021, 2:07 PM
I think the lib can't be used in another project without the new IR, but I am not sure. I saw a similar error with that when I was playing with Compose but I am not sure
I think you can try publishing your library to mavenlocal, use it in another old project and check if
gradlew build
works
d

dave

02/04/2021, 2:09 PM
glad I asked then! Thank you so much for your help. 🙂
🙂 1
2 Views