@@ -1645,7 +1645,7 @@ open class KotlinFileExtractor(
16451645 extractMethodAndParameterTypeAccesses : Boolean ,
16461646 typeSubstitution : TypeSubstitution ? ,
16471647 classTypeArgsIncludingOuterClasses : List <IrTypeArgument >?
1648- ) =
1648+ ) : Label < out DbCallable > =
16491649 forceExtractFunction(
16501650 f,
16511651 parentId,
@@ -2975,12 +2975,22 @@ open class KotlinFileExtractor(
29752975 val locId = tw.getLocation(s)
29762976 tw.writeStmts_block(blockId, parent, idx, callable)
29772977 tw.writeHasLocation(blockId, locId)
2978- extractVariable(s.delegate, callable, blockId, 0 )
2978+ // For Kotlin < 2.3, s.deligate is not-nullable. Cast to a be nullable,
2979+ // as a workaround to silence warnings for kotlin < 2.3 about the elvis
2980+ // operator being redundant.
2981+ // For Kotlin >= 2.3, the cast is redundant, so we need to silence that warning
2982+
2983+ @Suppress(" USELESS_CAST" )
2984+ val delegate = (s.delegate as IrVariable ? ) ? : run {
2985+ logger.errorElement(" Local delegated property is missing delegate" , s)
2986+ return
2987+ }
2988+ extractVariable(delegate, callable, blockId, 0 )
29792989
29802990 val propId = tw.getFreshIdLabel<DbKt_property >()
29812991 tw.writeKtProperties(propId, s.name.asString())
29822992 tw.writeHasLocation(propId, locId)
2983- tw.writeKtPropertyDelegates(propId, useVariable(s. delegate))
2993+ tw.writeKtPropertyDelegates(propId, useVariable(delegate))
29842994
29852995 // Getter:
29862996 extractStatement(s.getter, callable, blockId, 1 )
0 commit comments