-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Labels
bugSomething isn't workingSomething isn't workingwaiting for upstreamThis issue or PR is dependent on upstream Kotlin compiler changes/fixesThis issue or PR is dependent on upstream Kotlin compiler changes/fixes
Description
Description
This happens on iOS. When a property with @Named(...) annotation is used on param of a @Provide function in a separate module, the app crashes in runtime.
Steps to reproduce:
- Create a new module (outside of the kmp shared module)
- In the new module provide a property with a
@Namedannotation - Inject property with a
@Namedannotation
Code example:
// declared in baselines-kmp/label-factory module
@ContributesTo(UiScope::class)
interface LabelFactoryModule {
@Provides
@Named("named_param")
fun provideNamed(): String {
return "named param"
}
@Provides
fun provideLabelFactory(
@Named("named_param") param: String
): LabelFactory = { "Created: $param" }
}
// This is the code in kmp shared module: baselines-kmp/app/compose
@Inject
@SingleIn(UiScope::class)
class ComposeApp(
private val factory: LabelFactory,
) {
@Composable
operator fun invoke() {
MaterialTheme {
Text(
modifier = Modifier.systemBarsPadding(),
text = "[ Label: ${factory.create()}} ]",
)
}
}
}Self-contained Reproducer
Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError.
It is considered unexpected and unhandled instead. Program will be terminated.
Uncaught Kotlin exception: kotlin.internal.IrLinkageError: Abstract function 'createUiComponent' is not implemented in non-abstract class 'Impl'
at 0 Baselines Sample.debug.dylib 0x1099bbad7 kfun:kotlin.Throwable#<init>(kotlin.String?){} + 99
at 1 Baselines Sample.debug.dylib 0x1099b5fab kfun:kotlin.Error#<init>(kotlin.String?){} + 95
at 2 Baselines Sample.debug.dylib 0x1099f60b3 kfun:kotlin.internal.IrLinkageError#<init>(kotlin.String?){} + 95
at 3 Baselines Sample.debug.dylib 0x1099f6167 kfun:kotlin.internal#throwIrLinkageError(kotlin.String?){}kotlin.Nothing + 163
at 4 Baselines Sample.debug.dylib 0x108e44e5b kfun:io.baselines.sample.compose.di.IosAppComponent.Impl#createUiComponent(){}io.baselines.sample.compose.di.IosUiComponent + 63
at 5 Baselines Sample.debug.dylib 0x108e4669b kfun:io.baselines.sample.compose.di.IosUiComponent.Factory#createUiComponent(){}io.baselines.sample.compose.di.IosUiComponent-trampoline + 99
at 6 Baselines Sample.debug.dylib 0x108e450f3 kfun:io.baselines.sample.compose.di#createComponent(io.baselines.sample.compose.di.IosAppComponent){}io.baselines.sample.compose.di.IosUiComponent + 75
at 7 Baselines Sample.debug.dylib 0x108e4f81b objc2kotlin_kfun:io.baselines.sample.compose.di#createComponent(io.baselines.sample.compose.di.IosAppComponent){}io.baselines.sample.compose.di.IosUiComponent + 147
at 8 Baselines Sample.debug.dylib 0x108b4e81f $s16Baselines_Sample0aB3AppV4bodyQrvgAA11ContentViewVycfU_ + 151 (/Users/igormalytsky/Developer/baselines/baselines-kmp/app/ios/BaselinesSample/BaselinesSample/Source/BaselinesSampleApp.swift:11:48)
at 9 SwiftUI 0x1da10b75b $s7SwiftUI4MenuV_7contentACyAA4TextVq_GAA18LocalizedStringKeyV_q_yXEtcAFRszrlufcq_yXEfU_Tm + 87
at 10 SwiftUICore 0x1db33e7cf $s7SwiftUI16ViewBodyAccessorV06updateD02of7changedyx_SbtFyyScMYcXEfU_ + 1435
at 11 SwiftUICore 0x1db33e203 $s7SwiftUI16ViewBodyAccessorV06updateD02of7changedyx_SbtF + 179
at 12 SwiftUICore 0x1db33e8ef $s7SwiftUI16ViewBodyAccessorVyxGAA0dE0A2aEP06updateD02of7changedy9ContainerQz_SbtFTW + 11
at 13 SwiftUICore 0x1db46647f $s7SwiftUI10StaticBody33_A4C1D658B3717A3062FEFC91A812D6EBLLV11updateValueyyFyyXEfU_ + 275
at 14 SwiftUICore 0x1db4660cb $s7SwiftUI10StaticBody33_A4C1D658B3717A3062FEFC91A812D6EBLLV11updateValueyyF + 571
at 15 SwiftUICore 0x1db1d88df $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcfu_TA + 27
at 16 AttributeGraph 0x1c4794727 _ZN2AG5Graph11UpdateStack6updateEv + 491
at 17 AttributeGraph 0x1c4794e17 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 351
at 18 AttributeGraph 0x1c479c54b _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjjPK15AGSwiftMetadataRhl + 667
at 19 AttributeGraph 0x1c47b41cb AGGraphGetValue + 235
at 20 SwiftUICore 0x1db465e3f $s7SwiftUI10StaticBody33_A4C1D658B3717A3062FEFC91A812D6EBLLV9container9ContainerQzvg + 79
at 21 SwiftUICore 0x1db466453 $s7SwiftUI10StaticBody33_A4C1D658B3717A3062FEFC91A812D6EBLLV11updateValueyyFyyXEfU_ + 231
at 22 SwiftUICore 0x1db4660cb $s7SwiftUI10StaticBody33_A4C1D658B3717A3062FEFC91A812D6EBLLV11updateValueyyF + 571
at 23 SwiftUICore 0x1db1d88df $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcfu_TA + 27
at 24 AttributeGraph 0x1c4794727 _ZN2AG5Graph11UpdateStack6updateEv + 491
at 25 AttributeGraph 0x1c4794e17 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 351
at 26 AttributeGraph 0x1c479c54b _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjjPK15AGSwiftMetadataRhl + 667
at 27 AttributeGraph 0x1c47b41cb AGGraphGetValue + 235
at 28 SwiftUICore 0x1db0b16af $s7SwiftUI32UnaryPositionAwareLayoutComputer33_1C3B77B617AD058A6802F719E38F5D79LLV11updateValueyyFAA024_SafeAreaRegionsIgnoringF0V_Tg5 + 79
at 29 SwiftUICore 0x1db0d41af $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcfu_7SwiftUI14LayoutComputerV_AK018UnaryPositionAwareiJ033_1C3B77B617AD058A6802F719E38F5D79LLVyAK024_SafeAreaRegionsIgnoringI0VGTt1g5 + 19
at 30 AttributeGraph 0x1c4794727 _ZN2AG5Graph11UpdateStack6updateEv + 491
at 31 AttributeGraph 0x1c4794e17 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 351
at 32 AttributeGraph 0x1c479c54b _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjjPK15AGSwiftMetadataRhl + 667
at 33 AttributeGraph 0x1c47b41cb AGGraphGetValue + 235
at 34 SwiftUICore 0x1db58e22b $s7SwiftUI31UnaryPositionAwareChildGeometry33_1C3B77B617AD058A6802F719E38F5D79LLV5valueAA04ViewG0VvgAA23_SafeAreaIgnoringLayoutV_Tg5Tm + 115
at 35 SwiftUICore 0x1db5ae447 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA4RuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcfu_7SwiftUI12ViewGeometryV_AK023UnaryPositionAwareChildI033_1C3B77B617AD058A6802F719E38F5D79LLVyAK23_SafeAreaIgnoringLayoutVGTt1g5Tm + 47
at 36 AttributeGraph 0x1c4794727 _ZN2AG5Graph11UpdateStack6updateEv + 491
at 37 AttributeGraph 0x1c4794e17 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 351
at 38 AttributeGraph 0x1c479c54b _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjjPK15AGSwiftMetadataRhl + 667
at 39 AttributeGraph 0x1c47b41cb AGGraphGetValue + 235
at 40 SwiftUICore 0x1db771e7f $s7SwiftUI24AnimatableFrameAttributeV11updateValueyyF + 67
at 41 SwiftUICore 0x1db0d394b $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcfu_7SwiftUI9ViewFrameV_AK010AnimatablejA0VTt1g5 + 19
at 42 AttributeGraph 0x1c4794727 _ZN2AG5Graph11UpdateStack6updateEv + 491
at 43 AttributeGraph 0x1c47a388b _ZN2AG8Subgraph6updateEj + 943
at 44 SwiftUICore 0x1db697013 $s7SwiftUI9GraphHostC14runTransaction_2do2idyAA0F0VSg_yyXEs6UInt32VSgtF03$s7a3UI9cD27C14runTransactionyyFyyXEfU_Tf1ncnn_n + 319
at 45 SwiftUICore 0x1dba8be5b $s7SwiftUI9ViewGraphC13updateOutputs2atyAA4TimeV_tF + 171
at 46 SwiftUICore 0x1dba8612b $s7SwiftUI25ViewGraphRootValueUpdaterPAAE6render8interval17updateDisplayList15targetTimestampySd_SbAA4TimeVSgtFyyXEfU_ + 643
at 47 SwiftUICore 0x1dba84857 $s7SwiftUI25ViewGraphRootValueUpdaterPAAE6render8interval17updateDisplayList15targetTimestampySd_SbAA4TimeVSgtF + 419
at 48 UIKitCore 0x1852f9197 block_destroy_helper.37 + 3047
at 49 SwiftUI 0x1dab2546f $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyF + 79
at 50 SwiftUI 0x1dab254a3 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyFTo + 31
at 51 UIKitCore 0x18558294b block_destroy_helper.13 + 10135
at 52 UIKitCore 0x185582cdf block_destroy_helper.13 + 11051
at 53 UIKitCore 0x1869151c7 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2655
at 54 QuartzCore 0x18c7e7ff7 _ZN2CA5Layer15perform_update_EPS0_P7CALayerjNS_17LayerUpdateReasonEPNS_11TransactionE + 451
at 55 QuartzCore 0x18c7e7847 _ZN2CA5Layer17update_if_needed_EPNS_11TransactionENS_17LayerUpdateReasonE + 599
at 56 QuartzCore 0x18c7f34d7 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 151
at 57 QuartzCore 0x18c7089fb _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 543
at 58 QuartzCore 0x18c738b53 _ZN2CA11Transaction6commitEv + 635
at 59 UIKitCore 0x186361177 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 31
at 60 CoreFoundation 0x18045616f __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 19
at 61 CoreFoundation 0x1804558f7 __CFRunLoopDoBlocks + 339
at 62 CoreFoundation 0x180454c67 __CFRunLoopRun + 787
at 63 CoreFoundation 0x18044fceb _CFRunLoopRunSpecificWithOptions + 495
at 64 GraphicsServices 0x192a669bb GSEventRunModal + 115
at 65 UIKitCore 0x186348573 -[UIApplication _run] + 771
at 66 UIKitCore 0x18634c79b UIApplicationMain + 123
at 67 SwiftUI 0x1da58d61f $s7SwiftUI17KitRendererCommon33_ACC2C5639A7D76F611E170E831FCA491LLys5NeverOyXlXpFAESpySpys4Int8VGSgGXEfU_ + 163
at 68 SwiftUI 0x1da58d367 $s7SwiftUI6runAppys5NeverOxAA0D0RzlF + 179
at 69 SwiftUI 0x1da31b42b $s7SwiftUI3AppPAAE4mainyyFZ + 147
at 70 Baselines Sample.debug.dylib 0x108b4eda7 $s16Baselines_Sample0aB3AppV5$mainyyFZ + 39
at 71 Baselines Sample.debug.dylib 0x108b4ef4f __debug_main_executable_dylib_entry_point + 11
at 72 dyld 0x104ab53cf 0x0 + 4373304271
at 73 ??? 0x104e18d53 0x0 + 4376857939
Metro version
0.9.1
Context
Reproducible on an iOS simulator, happens in runtime during app launch. Running with with kotlin = "2.3.20-dev-6919"
Hospes
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingwaiting for upstreamThis issue or PR is dependent on upstream Kotlin compiler changes/fixesThis issue or PR is dependent on upstream Kotlin compiler changes/fixes