skiptools / skip-ui

SwiftUI for Android
https://skip.tools
GNU Lesser General Public License v3.0
119 stars 12 forks source link

Kotlin 2.0 Compose compiler errors: Backend Internal error: Exception during IR lowering #34

Open marcprux opened 4 months ago

marcprux commented 4 months ago

When upgrading to Kotlin 2.0, inscrutable errors like "org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering" may occur in the build log. This appears to be the failure mode when the new built-in compose compiler is not used, or the old separate compose compiler is active.

To resolve this, add the new libs.plugins.compose.compiler plugin to the app's Android/app/build.gradle.kts file

plugins {
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.android.application)
    id("skip-build-plugin")
    alias(libs.plugins.compose.compiler) // NEW
}

And remove the old plugin from the file:

    composeOptions {
        //kotlinCompilerExtensionVersion = libs.versions.kotlin.compose.compiler.extension.get() // REMOVE
    }

For reference, the errors will look like:

e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /Users/marc/Library/Developer/Xcode/DerivedData/Skip-Everything-aqywrhrzhkbvfseiqgxuufbdwdft/SourcePackages/plugins/skipapp-fireside.output/FireSide/skipstone/SkipUI/src/main/kotlin/skip/ui/Animation.kt
The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
    at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:253)
    at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException$default(CodegenUtil.kt:236)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invokeSequential(performByIrFile.kt:65)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(performByIrFile.kt:52)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(performByIrFile.kt:38)
    at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.phaseBody(CompilerPhase.kt:166)
    at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedCompilerPhase.invoke(CompilerPhase.kt:113)
    at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:29)
    at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:16)
    at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.phaseBody(CompilerPhase.kt:166)
    at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedCompilerPhase.invoke(CompilerPhase.kt:113)
    at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:62)
    at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.invokeCodegen(JvmIrCodegenFactory.kt:371)
    at org.jetbrains.kotlin.codegen.CodegenFactory.generateModule(CodegenFactory.kt:47)
    at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModuleInFrontendIRMode(JvmIrCodegenFactory.kt:433)
    at org.jetbrains.kotlin.cli.jvm.compiler.pipeline.JvmCompilerPipelineKt.generateCodeFromIr(jvmCompilerPipeline.kt:241)
    at org.jetbrains.kotlin.cli.jvm.compiler.pipeline.JvmCompilerPipelineKt.compileModulesUsingFrontendIrAndLightTree(jvmCompilerPipeline.kt:140)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:155)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:50)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:104)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:48)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:453)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:62)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.doCompile(IncrementalCompilerRunner.kt:506)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:423)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:301)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:129)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:676)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:92)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1661)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:598)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:844)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:721)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:720)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.RuntimeException: Exception while generating code for:
FUN name:current visibility:internal modality:FINAL <> ($this:skip.ui.Animation.Companion, isAnimating:kotlin.Boolean) returnType:skip.ui.Animation?
  annotations:
    Composable
  $this: VALUE_PARAMETER name:<this> type:skip.ui.Animation.Companion
  VALUE_PARAMETER name:isAnimating index:0 type:kotlin.Boolean
  BLOCK_BODY
    VAR name:environmentAnimation type:skip.ui.Animation? [val]
      TYPE_OP type=skip.ui.Animation? origin=IMPLICIT_CAST typeOperand=skip.ui.Animation?
        CALL 'public final fun sref$default <T> (onUpdate: kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>?, $mask0: kotlin.Int, $handler: kotlin.Any?): T of skip.lib.StructKt.sref$default declared in skip.lib.StructKt' type=T of skip.lib.StructKt.sref$default origin=DEFAULT_DISPATCH_CALL
          <T>: skip.ui.Animation?
          $receiver: CALL 'internal open fun <get-_animation> (): skip.ui.Animation? declared in skip.ui.EnvironmentValues' type=skip.ui.Animation? origin=GET_PROPERTY
            $this: CALL 'public final fun <get-shared> (): skip.ui.EnvironmentValues declared in skip.ui.EnvironmentValues.Companion' type=skip.ui.EnvironmentValues origin=GET_PROPERTY
              $this: GET_FIELD 'FIELD FIELD_FOR_OBJECT_INSTANCE name:Companion type:skip.ui.EnvironmentValues.Companion visibility:public [final,static]' type=skip.ui.EnvironmentValues.Companion origin=null
          onUpdate: COMPOSITE type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? origin=DEFAULT_VALUE
            CONST Null type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? value=null
          $mask0: CONST Int type=kotlin.Int value=1
          $handler: CONST Null type=kotlin.Any? value=null
    VAR name:animation type:skip.ui.Animation? [val]
      TYPE_OP type=skip.ui.Animation? origin=IMPLICIT_CAST typeOperand=skip.ui.Animation?
        CALL 'public final fun sref$default <T> (onUpdate: kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>?, $mask0: kotlin.Int, $handler: kotlin.Any?): T of skip.lib.StructKt.sref$default declared in skip.lib.StructKt' type=T of skip.lib.StructKt.sref$default origin=DEFAULT_DISPATCH_CALL
          <T>: skip.ui.Animation?
          $receiver: BLOCK type=skip.ui.Animation? origin=FOLDED_ELVIS
            WHEN type=skip.ui.Animation? origin=FOLDED_ELVIS
              BRANCH
                if: COMPOSITE type=kotlin.Boolean origin=null
                  CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=null
                    $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=null
                      arg0: GET_VAR 'val environmentAnimation: skip.ui.Animation? [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.Animation? origin=null
                      arg1: CONST Null type=kotlin.Nothing? value=null
                then: GET_VAR 'val environmentAnimation: skip.ui.Animation? [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.Animation? origin=null
              BRANCH
                if: CONST Boolean type=kotlin.Boolean value=true
                then: CALL 'private final fun <get-_withAnimation> (): skip.ui.Animation? declared in skip.ui.Animation.Companion' type=skip.ui.Animation? origin=GET_PROPERTY
                  $this: GET_VAR '<this>: skip.ui.Animation.Companion declared in skip.ui.Animation.Companion.current' type=skip.ui.Animation.Companion origin=null
          onUpdate: COMPOSITE type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? origin=DEFAULT_VALUE
            CONST Null type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? value=null
          $mask0: CONST Int type=kotlin.Int value=1
          $handler: CONST Null type=kotlin.Any? value=null
    VAR name:rememberedAnimationHolder type:skip.ui.AnimationHolder [val]
      CALL 'public final fun remember <T> (calculation: @[DisallowComposableCalls] kotlin.Function0<T of androidx.compose.runtime.ComposablesKt.remember>): T of androidx.compose.runtime.ComposablesKt.remember [inline] declared in androidx.compose.runtime.ComposablesKt' type=skip.ui.AnimationHolder origin=null
        <T>: skip.ui.AnimationHolder
        calculation: BLOCK type=kotlin.Function0<skip.ui.AnimationHolder> origin=LAMBDA
          COMPOSITE type=kotlin.Unit origin=null
          FUNCTION_REFERENCE 'private final fun current$lambda$0 (): skip.ui.AnimationHolder declared in skip.ui.Animation.Companion' type=kotlin.Function0<skip.ui.AnimationHolder> origin=INLINE_LAMBDA reflectionTarget=null
    VAR name:rememberedAnimation type:skip.ui.Animation? [val]
      TYPE_OP type=skip.ui.Animation? origin=IMPLICIT_CAST typeOperand=skip.ui.Animation?
        CALL 'public final fun sref$default <T> (onUpdate: kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>?, $mask0: kotlin.Int, $handler: kotlin.Any?): T of skip.lib.StructKt.sref$default declared in skip.lib.StructKt' type=T of skip.lib.StructKt.sref$default origin=DEFAULT_DISPATCH_CALL
          <T>: skip.ui.Animation?
          $receiver: CALL 'internal final fun <get-animation> (): skip.ui.Animation? declared in skip.ui.AnimationHolder' type=skip.ui.Animation? origin=GET_PROPERTY
            $this: GET_VAR 'val rememberedAnimationHolder: skip.ui.AnimationHolder [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.AnimationHolder origin=null
          onUpdate: COMPOSITE type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? origin=DEFAULT_VALUE
            CONST Null type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? value=null
          $mask0: CONST Int type=kotlin.Int value=1
          $handler: CONST Null type=kotlin.Any? value=null
    WHEN type=kotlin.Unit origin=IF
      BRANCH
        if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
          $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
            arg0: GET_VAR 'val animation: skip.ui.Animation? [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.Animation? origin=null
            arg1: CONST Null type=kotlin.Nothing? value=null
        then: BLOCK type=kotlin.Unit origin=null
          CALL 'internal final fun <set-animation> (newValue: skip.ui.Animation?): kotlin.Unit declared in skip.ui.AnimationHolder' type=kotlin.Unit origin=EQ
            $this: GET_VAR 'val rememberedAnimationHolder: skip.ui.AnimationHolder [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.AnimationHolder origin=null
            newValue: GET_VAR 'val animation: skip.ui.Animation? [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.Animation? origin=null
      BRANCH
        if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=null
          $this: GET_VAR 'isAnimating: kotlin.Boolean declared in skip.ui.Animation.Companion.current' type=kotlin.Boolean origin=null
        then: BLOCK type=kotlin.Unit origin=null
          CALL 'internal final fun <set-animation> (newValue: skip.ui.Animation?): kotlin.Unit declared in skip.ui.AnimationHolder' type=kotlin.Unit origin=EQ
            $this: GET_VAR 'val rememberedAnimationHolder: skip.ui.AnimationHolder [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.AnimationHolder origin=null
            newValue: CONST Null type=kotlin.Nothing? value=null
    WHEN type=kotlin.Unit origin=IF
      BRANCH
        if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
          $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
            arg0: GET_VAR 'val animation: skip.ui.Animation? [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.Animation? origin=null
            arg1: CONST Null type=kotlin.Nothing? value=null
        then: BLOCK type=kotlin.Unit origin=null
          RETURN type=kotlin.Nothing from='internal final fun current (isAnimating: kotlin.Boolean): skip.ui.Animation? declared in skip.ui.Animation.Companion'
            TYPE_OP type=skip.ui.Animation origin=IMPLICIT_CAST typeOperand=skip.ui.Animation
              CALL 'public final fun sref$default <T> (onUpdate: kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>?, $mask0: kotlin.Int, $handler: kotlin.Any?): T of skip.lib.StructKt.sref$default declared in skip.lib.StructKt' type=T of skip.lib.StructKt.sref$default origin=DEFAULT_DISPATCH_CALL
                <T>: skip.ui.Animation
                $receiver: GET_VAR 'val animation: skip.ui.Animation? [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.Animation? origin=null
                onUpdate: COMPOSITE type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? origin=DEFAULT_VALUE
                  CONST Null type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? value=null
                $mask0: CONST Int type=kotlin.Int value=1
                $handler: CONST Null type=kotlin.Any? value=null
    RETURN type=kotlin.Nothing from='internal final fun current (isAnimating: kotlin.Boolean): skip.ui.Animation? declared in skip.ui.Animation.Companion'
      TYPE_OP type=skip.ui.Animation? origin=IMPLICIT_CAST typeOperand=skip.ui.Animation?
        CALL 'public final fun sref$default <T> (onUpdate: kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>?, $mask0: kotlin.Int, $handler: kotlin.Any?): T of skip.lib.StructKt.sref$default declared in skip.lib.StructKt' type=T of skip.lib.StructKt.sref$default origin=DEFAULT_DISPATCH_CALL
          <T>: skip.ui.Animation?
          $receiver: WHEN type=skip.ui.Animation? origin=IF
            BRANCH
              if: GET_VAR 'isAnimating: kotlin.Boolean declared in skip.ui.Animation.Companion.current' type=kotlin.Boolean origin=null
              then: GET_VAR 'val rememberedAnimation: skip.ui.Animation? [val] declared in skip.ui.Animation.Companion.current' type=skip.ui.Animation? origin=null
            BRANCH
              if: CONST Boolean type=kotlin.Boolean value=true
              then: CONST Null type=kotlin.Nothing? value=null
          onUpdate: COMPOSITE type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? origin=DEFAULT_VALUE
            CONST Null type=kotlin.Function1<T of skip.lib.StructKt.sref$default, kotlin.Unit>? value=null
          $mask0: CONST Int type=kotlin.Int value=1
          $handler: CONST Null type=kotlin.Any? value=null

    at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
    at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate$default(FunctionCodegen.kt:42)
    at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethodNode(ClassCodegen.kt:385)
    at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethod(ClassCodegen.kt:402)
    at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate(ClassCodegen.kt:169)
    at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate(ClassCodegen.kt:182)
    at org.jetbrains.kotlin.backend.jvm.FileCodegen.lower(JvmPhases.kt:41)
    at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt.makeIrFilePhase$lambda$5(PhaseBuilders.kt:114)
    at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$createSimpleNamedCompilerPhase$1.phaseBody(PhaseBuilders.kt:71)
    at org.jetbrains.kotlin.backend.common.phaser.SimpleNamedCompilerPhase.phaseBody(CompilerPhase.kt:226)
    at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedCompilerPhase.invoke(CompilerPhase.kt:113)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invokeSequential(performByIrFile.kt:62)
    ... 43 more
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call: CALL 'public final fun remember <T> (calculation: @[DisallowComposableCalls] kotlin.Function0<T of androidx.compose.runtime.ComposablesKt.remember>): T of androidx.compose.runtime.ComposablesKt.remember [inline] declared in androidx.compose.runtime.ComposablesKt' type=skip.ui.AnimationHolder origin=null
Method: null
File is unknown
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.getMethodNode(SourceCompilerForInline.kt:118)
    at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:65)
    at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCodegen.genInlineCall(IrInlineCodegen.kt:162)
    at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCallGenerator.genCall(IrInlineCallGenerator.kt:36)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:647)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:137)
    at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:24)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitVariable(ExpressionCodegen.kt:784)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitVariable(ExpressionCodegen.kt:137)
    at org.jetbrains.kotlin.ir.declarations.IrVariable.accept(IrVariable.kt:36)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitStatementContainer(ExpressionCodegen.kt:573)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:578)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:137)
    at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBlockBody.kt:20)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.generate(ExpressionCodegen.kt:239)
    at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.doGenerate(FunctionCodegen.kt:121)
    at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:46)
    ... 54 more
Caused by: java.lang.IllegalStateException: couldn't find inline method Landroidx/compose/runtime/ComposablesKt;.remember(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
    at org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.getMethodNode(SourceCompilerForInline.kt:118)
    at org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.loadCompiledInlineFunction(SourceCompilerForInline.kt:96)
    at org.jetbrains.kotlin.backend.jvm.codegen.IrSourceCompilerForInline.compileInlineFunction(IrSourceCompilerForInline.kt:91)
    at org.jetbrains.kotlin.codegen.inline.InlineCodegen.compileInline(InlineCodegen.kt:43)
    at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:51)
    ... 69 more

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':skipstone:SkipUI:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Internal compiler error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 35s
175 actionable tasks: 148 executed, 27 up-to-date

Another similar error:

e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /opt/src/github/skiptools/skipapp-fireside/Android/app/src/main/kotlin/fire/side/Main.kt
The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
    at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:253)
    at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException$default(CodegenUtil.kt:236)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invokeSequential(performByIrFile.kt:65)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(performByIrFile.kt:52)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(performByIrFile.kt:38)
    at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.phaseBody(CompilerPhase.kt:166)
    at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedCompilerPhase.invoke(CompilerPhase.kt:113)
    at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:29)
    at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:16)
    at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.phaseBody(CompilerPhase.kt:166)
    at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedCompilerPhase.invoke(CompilerPhase.kt:113)
    at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:62)
    at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.invokeCodegen(JvmIrCodegenFactory.kt:371)
    at org.jetbrains.kotlin.codegen.CodegenFactory.generateModule(CodegenFactory.kt:47)
    at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModuleInFrontendIRMode(JvmIrCodegenFactory.kt:433)
    at org.jetbrains.kotlin.cli.jvm.compiler.pipeline.JvmCompilerPipelineKt.generateCodeFromIr(jvmCompilerPipeline.kt:241)
    at org.jetbrains.kotlin.cli.jvm.compiler.pipeline.JvmCompilerPipelineKt.compileModulesUsingFrontendIrAndLightTree(jvmCompilerPipeline.kt:140)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:155)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:50)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:104)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:48)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:453)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:62)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.doCompile(IncrementalCompilerRunner.kt:506)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:423)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:301)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:129)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:676)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:92)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1661)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:598)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:844)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:721)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:720)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.RuntimeException: Exception while generating code for:
FUN LOCAL_FUNCTION_FOR_LAMBDA name:PresentationRootView$lambda$1 visibility:private modality:FINAL <> (ctx:skip.ui.ComposeContext) returnType:kotlin.Unit?
  VALUE_PARAMETER name:ctx index:0 type:skip.ui.ComposeContext
  BLOCK_BODY
    VAR name:contentContext type:skip.ui.ComposeContext [val]
      CALL 'public final fun content$default ($this: skip.ui.ComposeContext, modifier: androidx.compose.ui.Modifier?, composer: skip.ui.Composer?, stateSaver: androidx.compose.runtime.saveable.Saver<kotlin.Any?, kotlin.Any>?, $mask0: kotlin.Int, $handler: kotlin.Any?): skip.ui.ComposeContext declared in skip.ui.ComposeContext' type=skip.ui.ComposeContext origin=DEFAULT_DISPATCH_CALL
        $this: GET_VAR 'ctx: skip.ui.ComposeContext declared in fire.side.MainKt.PresentationRootView$lambda$1' type=skip.ui.ComposeContext origin=null
        modifier: COMPOSITE type=androidx.compose.ui.Modifier? origin=DEFAULT_VALUE
          CONST Null type=androidx.compose.ui.Modifier? value=null
        composer: COMPOSITE type=skip.ui.Composer? origin=DEFAULT_VALUE
          CONST Null type=skip.ui.Composer? value=null
        stateSaver: COMPOSITE type=androidx.compose.runtime.saveable.Saver<kotlin.Any?, kotlin.Any>? origin=DEFAULT_VALUE
          CONST Null type=androidx.compose.runtime.saveable.Saver<kotlin.Any?, kotlin.Any>? value=null
        $mask0: CONST Int type=kotlin.Int value=7
        $handler: CONST Null type=kotlin.Any? value=null
    CALL 'public final fun Box$default (modifier: androidx.compose.ui.Modifier?, contentAlignment: androidx.compose.ui.Alignment?, propagateMinConstraints: kotlin.Boolean, content: @[Composable] @[ExtensionFunctionType] kotlin.Function1<androidx.compose.foundation.layout.BoxScope, kotlin.Unit>, $mask0: kotlin.Int, $handler: kotlin.Any?): kotlin.Unit [inline] declared in androidx.compose.foundation.layout.BoxKt' type=kotlin.Unit origin=DEFAULT_DISPATCH_CALL
      modifier: CALL 'public final fun fillMaxSize$default (fraction: kotlin.Float, $mask0: kotlin.Int, $handler: kotlin.Any?): androidx.compose.ui.Modifier declared in androidx.compose.foundation.layout.SizeKt' type=androidx.compose.ui.Modifier origin=DEFAULT_DISPATCH_CALL
        $receiver: CALL 'public final fun <get-modifier> (): androidx.compose.ui.Modifier declared in skip.ui.ComposeContext' type=androidx.compose.ui.Modifier origin=GET_PROPERTY
          $this: GET_VAR 'ctx: skip.ui.ComposeContext declared in fire.side.MainKt.PresentationRootView$lambda$1' type=skip.ui.ComposeContext origin=null
        fraction: COMPOSITE type=kotlin.Float origin=DEFAULT_VALUE
          CONST Float type=kotlin.Float value=0.0
        $mask0: CONST Int type=kotlin.Int value=1
        $handler: CONST Null type=kotlin.Any? value=null
      contentAlignment: CALL 'public final fun <get-Center> (): androidx.compose.ui.Alignment declared in androidx.compose.ui.Alignment.Companion' type=androidx.compose.ui.Alignment origin=GET_PROPERTY
        $this: GET_FIELD 'FIELD FIELD_FOR_OBJECT_INSTANCE name:Companion type:androidx.compose.ui.Alignment.Companion visibility:public [final,static]' type=androidx.compose.ui.Alignment.Companion origin=null
      propagateMinConstraints: COMPOSITE type=kotlin.Boolean origin=DEFAULT_VALUE
        CONST Boolean type=kotlin.Boolean value=false
      content: BLOCK type=@[ExtensionFunctionType] kotlin.Function1<androidx.compose.foundation.layout.BoxScope, kotlin.Unit> origin=LAMBDA
        COMPOSITE type=kotlin.Unit origin=null
        FUNCTION_REFERENCE 'private final fun PresentationRootView$lambda$1$lambda$0 ($contentContext: skip.ui.ComposeContext): kotlin.Unit declared in fire.side.MainKt' type=@[ExtensionFunctionType] kotlin.Function1<androidx.compose.foundation.layout.BoxScope, kotlin.Unit> origin=INLINE_LAMBDA reflectionTarget=null
          $contentContext: GET_VAR 'val contentContext: skip.ui.ComposeContext [val] declared in fire.side.MainKt.PresentationRootView$lambda$1' type=skip.ui.ComposeContext origin=null
      $mask0: CONST Int type=kotlin.Int value=4
      $handler: CONST Null type=kotlin.Any? value=null

    at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
    at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate$default(FunctionCodegen.kt:42)
    at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethodNode(ClassCodegen.kt:385)
    at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethod(ClassCodegen.kt:402)
    at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate(ClassCodegen.kt:169)
    at org.jetbrains.kotlin.backend.jvm.FileCodegen.lower(JvmPhases.kt:41)
    at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt.makeIrFilePhase$lambda$5(PhaseBuilders.kt:114)
    at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$createSimpleNamedCompilerPhase$1.phaseBody(PhaseBuilders.kt:71)
    at org.jetbrains.kotlin.backend.common.phaser.SimpleNamedCompilerPhase.phaseBody(CompilerPhase.kt:226)
    at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedCompilerPhase.invoke(CompilerPhase.kt:113)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invokeSequential(performByIrFile.kt:62)
    ... 43 more
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call: CALL 'public final fun Box$default (modifier: androidx.compose.ui.Modifier?, contentAlignment: androidx.compose.ui.Alignment?, propagateMinConstraints: kotlin.Boolean, content: @[Composable] @[ExtensionFunctionType] kotlin.Function1<androidx.compose.foundation.layout.BoxScope, kotlin.Unit>, $mask0: kotlin.Int, $handler: kotlin.Any?): kotlin.Unit [inline] declared in androidx.compose.foundation.layout.BoxKt' type=kotlin.Unit origin=DEFAULT_DISPATCH_CALL
Method: null
File is unknown
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.getMethodNode(SourceCompilerForInline.kt:118)
    at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:65)
    at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCodegen.genInlineCall(IrInlineCodegen.kt:162)
    at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCallGenerator.genCall(IrInlineCallGenerator.kt:36)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:647)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:137)
    at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:24)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitStatementContainer(ExpressionCodegen.kt:573)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:578)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:137)
    at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBlockBody.kt:20)
    at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.generate(ExpressionCodegen.kt:239)
    at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.doGenerate(FunctionCodegen.kt:121)
    at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:46)
    ... 53 more
Caused by: java.lang.IllegalStateException: couldn't find inline method Landroidx/compose/foundation/layout/BoxKt;.Box$default(Landroidx/compose/ui/Modifier;Landroidx/compose/ui/Alignment;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
    at org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.getMethodNode(SourceCompilerForInline.kt:118)
    at org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.loadCompiledInlineFunction(SourceCompilerForInline.kt:96)
    at org.jetbrains.kotlin.backend.jvm.codegen.IrSourceCompilerForInline.compileInlineFunction(IrSourceCompilerForInline.kt:91)
    at org.jetbrains.kotlin.codegen.inline.InlineCodegen.compileInline(InlineCodegen.kt:43)
    at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:51)
    ... 65 more

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Internal compiler error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 3s
186 actionable tasks: 2 executed, 184 up-to-date
marcprux commented 4 months ago

Another, less inscrutable, indication of this problem may be the error:

e: This version (1.3.2) of the Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 2.0.0 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).