JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.24k stars 1.11k forks source link

Compose compiler build failure on iOS simulator compilation: Compilation failed: No such value argument slot in IrCallImpl: 3 (total=3) #4971

Open ZacSweers opened 1 week ago

ZacSweers commented 1 week ago

Describe the bug When compiling the referenced repro project for iOS simulator, compilation fails.

Affected platforms

Versions

To Reproduce Steps to reproduce the behavior:

  1. Checkout this repo at main: https://github.com/ZacSweers/FieldSpottr
  2. Run ./gradlew :compileKotlinIosSimulatorArm64

Observe the below

> Task :compileKotlinIosSimulatorArm64 FAILED
e: Compilation failed: No such value argument slot in IrCallImpl: 3 (total=3)
 * Source files: DbArea.kt, DbPermit.kt, FSDatabase.kt, FsdbQueries.kt, FSDatabaseImpl.kt, DateSelector.kt, FSAppDirs.kt, FieldSpottrApp.kt, GroupSelector.kt, Home.kt, PermitGrid.kt, Area.kt, PermitRepository.kt, db.kt, Parceling.common.kt, Color.kt, Theme.kt, Type.kt, db.native.kt, Parceling.native.kt
 * Compiler version: 2.0.0
 * Output kind: LIBRARY
e: java.lang.AssertionError: No such value argument slot in IrCallImpl: 3 (total=3)
        at org.jetbrains.kotlin.ir.expressions.IrExpressionsKt.checkArgumentSlotAccess(IrExpressions.kt:73)
        at org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression.putValueArgument(IrMemberAccessExpression.kt:50)
        at androidx.compose.compiler.plugins.kotlin.lower.ComposerParamTransformer.withComposerParamIfNeeded(ComposerParamTransformer.kt:248)
        at androidx.compose.compiler.plugins.kotlin.lower.ComposerParamTransformer$copyWithComposerParam$2$5.visitCall(ComposerParamTransformer.kt:641)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:299)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:19)
        at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:24)
        at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:24)
        at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:20)
        at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35)
        at org.jetbrains.kotlin.ir.expressions.IrBlockBody.transformChildren(IrBlockBody.kt:27)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBody(IrElementTransformerVoid.kt:174)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:188)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:191)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:19)
        at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBlockBody.kt:20)
        at org.jetbrains.kotlin.ir.expressions.IrBody.transform(IrBody.kt:20)
        at org.jetbrains.kotlin.ir.declarations.IrFunction.transformChildren(IrFunction.kt:58)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:565)
        at androidx.compose.compiler.plugins.kotlin.lower.ComposerParamTransformer.copyWithComposerParam(ComposerParamTransformer.kt:593)
        at androidx.compose.compiler.plugins.kotlin.lower.ComposerParamTransformer.withComposerParamIfNeeded(ComposerParamTransformer.kt:372)
        at androidx.compose.compiler.plugins.kotlin.lower.ComposerParamTransformer.visitSimpleFunction(ComposerParamTransformer.kt:158)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:131)

Expected behavior It should compile successfully or offer a meaningful error message

ZacSweers commented 1 week ago

figured this out after hopping into a debugger during compilation. The actual issue was a missing actual declaration for a compose function. Possibly worth closing this, but also think it's worth an improved error message

luca992 commented 1 week ago

Same usually, usually missing actual throws a readable error. A better error would be appreciated