Hi there, What's the best way to debug compiler er...
# compiler
s
Hi there, What's the best way to debug compiler errors like this ?
Copy code
e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
  File being compiled: sourcecode/w1/src/main/java/com/app/ui/view/fragment/Fragment.kt
  The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.ir.util.IrUtilsKt.copyValueParametersToStatic(IrUtils.kt:1060)
  Caused by: java.lang.AssertionError: Dispatch receiver type Fragment is not a subtype of  BaseMainFragment
I'm using Kotlin 2.0.20 however I've set the Language Version to 1.9. I'm sure that's the cause here, but I wanted to understand what specifically is causing this (for future references too)
w
I had similar issues. Using the plugin from @mbonnin
com.gradleup.kctf
helped me alot. https://github.com/flock-community/kmapper/blob/main/compiler-plugin/build.gradle.kts
🫶 1
m
Thanks for sharing this. @satyarth if you're writting a compiler plugin
kctf
will help you with the test boilerplate setup.
If you're just using the compiler, I've had some success opening the Kotlin repo itself and running a remote debug configuration
Just make sure to run your main build (the one that fails) with
-Dorg.gradle.debug=true -Pkotlin.compiler.execution.strategy=in-process
and then you can debug it from the Kotlin repo
s
Hi there, thank you very much for the info and the links 🙂 I have been exploring writing compiler plugins separately , so this would be useful !. I am currently just using the compiler and facing this failure. I will try this out by debugging with the kotlin repo. However this happens when I try to mix and match dependencies. I'm using Kotlin 2.0.20 with Compose gradle plugin (because 2.0.20 requires that ) but setting the language version to 1.9 . I think that can be a problematic setup, so instead of trying to make that work, I'll try to see how to move this to newer versions instead.