`Bug Report` iOS Compilation Failure with ModalBot...
# multiplatform
s
Bug Report
iOS Compilation Failure with ModalBottomSheet Components IR lowering fails during iOS compilation with "Collection contains more than one matching element" error when using ModalBottomSheet components with complex nested composables. Android compilation works without issues.
1
## Environment - Kotlin Version: 2.2.0 - Compose Multiplatform Version: 1.8.2 ## Problem Description The project compiles successfully for Android targets but fails during iOS compilation in the IR lowering phase, specifically in the
ComposerLambdaMemoization
step. The error occurs when processing ModalBottomSheet components that contain complex nested composables with lambda expressions. ### Error Details The compilation fails with the following error pattern: - Phase: IR lowering - ComposerLambdaMemoization - Root Cause:
IllegalArgumentException: Collection contains more than one matching element
- Location:
ComposerLambdaMemoization.irRemember()
method - Affected Components: ModalBottomSheet components with nested composables ## Stack Trace
Copy code
e: Compilation failed: IR lowering failed at: CurrencySelectionBottomSheet.kt
e: java.lang.Exception: IR lowering failed at: CurrencySelectionBottomSheet.kt
	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitFile(ComposerLambdaMemoization.kt:1264)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitPackageFragment(IrElementTransformerVoid.kt:80)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFile(IrElementTransformerVoid.kt:77)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitModuleFragment(IrElementTransformerVoid.kt:84)
	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.lower(ComposerLambdaMemoization.kt:1259)
	at androidx.compose.compiler.plugins.kotlin.ComposeIrGenerationExtension.generate(ComposeIrGenerationExtension.kt:130)
	at org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension.generate(IrGenerationExtension.kt:22)
	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:143)
	at org.jetbrains.kotlin.codegen.CodegenFactory.generateModule(CodegenFactory.kt:54)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhases$contextLLVMSetup$3$1.invoke(ToplevelPhases.kt:145)
	...

Caused by: java.lang.IllegalArgumentException: Collection contains more than one matching element.
	at kotlin.collections.CollectionsKt___CollectionsKt.single(Collections.kt:1549)
	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.irRemember(ComposerLambdaMemoization.kt:1405)
	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitCall(ComposerLambdaMemoization.kt:1380)
	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitCall(ComposerLambdaMemoization.kt:1250)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpression(IrElementTransformerVoid.kt:44)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:166)
	at org.jetbrains.kotlin.ir.expressions.IrCall.transform(IrCall.kt:24)
	at org.jetbrains.kotlin.ir.expressions.IrCall.transformChildren(IrCall.kt:25)
	...
Copy code
### Error Details
The compilation fails with the following error pattern:
- **Phase**: IR lowering - ComposerLambdaMemoization
- **Root Cause**: `IllegalArgumentException: Collection contains more than one matching element`
- **Location**: `ComposerLambdaMemoization.irRemember()` method
- **Affected Components**: ModalBottomSheet components with nested composables