[FIR] Fix nullability of function type created from custom function type
#KT-64706 Fixed
This commit is contained in:
committed by
Space Team
parent
811e8d7c3b
commit
d047db850f
@@ -113,7 +113,7 @@ private fun ConeKotlinType.createFunctionTypeWithNewKind(session: FirSession, ki
|
||||
val functionTypeId = ClassId(kind.packageFqName, kind.numberedClassName(expandedType.typeArguments.size - 1))
|
||||
return functionTypeId.toLookupTag().constructClassType(
|
||||
expandedType.typeArguments,
|
||||
isNullable = false,
|
||||
isNullable = expandedType.isNullable,
|
||||
attributes = expandedType.attributes
|
||||
)
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
Module: a
|
||||
FILE: a.kt
|
||||
public final fun RMenuItem(onClick: R|(() -> kotlin/Unit)?| = Null(null), trailing: R|@R|org/jetbrains/kotlin/fir/plugin/MyComposable|() some/MyComposableFunction0<kotlin/Unit>?| = Null(null)): R|kotlin/Unit| {
|
||||
}
|
||||
Module: b
|
||||
FILE: b.kt
|
||||
public final fun bar(onClick: R|(() -> kotlin/Unit)?| = Null(null)): R|kotlin/Unit| {
|
||||
R|/RMenuItem|(onClick = R|<local>/onClick|, trailing = R|<local>/onClick|?.{ $subj$.R|kotlin/let|<R|() -> kotlin/Unit|, R|@R|org/jetbrains/kotlin/fir/plugin/MyComposable|() some/MyComposableFunction0<kotlin/Unit>?|>(<L> = let@fun <anonymous>(it: R|() -> kotlin/Unit|): R|@R|org/jetbrains/kotlin/fir/plugin/MyComposable|() some/MyComposableFunction0<kotlin/Unit>?| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^ let@fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
|
||||
^@let Unit
|
||||
}
|
||||
|
||||
}
|
||||
) })
|
||||
}
|
||||
public final fun box(): R|kotlin/String| {
|
||||
^box String(OK)
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// ISSUE: KT-64994
|
||||
|
||||
// MODULE: a
|
||||
// FILE: a.kt
|
||||
import org.jetbrains.kotlin.fir.plugin.MyComposable
|
||||
|
||||
fun RMenuItem(
|
||||
onClick: (() -> Unit)? = null,
|
||||
trailing: (@MyComposable () -> Unit)? = null,
|
||||
) {}
|
||||
|
||||
// MODULE: b(a)
|
||||
// FILE: b.kt
|
||||
import org.jetbrains.kotlin.fir.plugin.MyComposable
|
||||
|
||||
fun bar(onClick: (() -> Unit)? = null) {
|
||||
RMenuItem(
|
||||
onClick = onClick,
|
||||
trailing = onClick?.let {
|
||||
{ }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun box() = "OK"
|
||||
+6
@@ -97,6 +97,12 @@ public class FirLightTreePluginBlackBoxCodegenTestGenerated extends AbstractFirL
|
||||
runTest("plugins/fir-plugin-prototype/testData/box/newSupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableComposableParameterAcrossModules.kt")
|
||||
public void testNullableComposableParameterAcrossModules() throws Exception {
|
||||
runTest("plugins/fir-plugin-prototype/testData/box/nullableComposableParameterAcrossModules.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replaceActualFunctionBodyWitExpectDefaultValue.kt")
|
||||
public void testReplaceActualFunctionBodyWitExpectDefaultValue() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user