FIR: Render "?" on nullable function types.
This commit is contained in:
committed by
TeamCityServer
parent
a9cc046ec9
commit
9cf5ac1fbd
+1
-1
@@ -1,5 +1,5 @@
|
||||
public open class MethodWithFunctionTypes : R|kotlin/Any| {
|
||||
public open fun foo(f: R|(kotlin/String?) -> kotlin/String|): R|kotlin/String.() -> kotlin/String?|
|
||||
public open fun foo(f: R|(kotlin/String?) -> kotlin/String|): R|(kotlin/String.() -> kotlin/String?)?|
|
||||
|
||||
public constructor(): R|test/MethodWithFunctionTypes|
|
||||
|
||||
|
||||
+8
@@ -1,8 +1,16 @@
|
||||
public final fun test1(): R|suspend () -> kotlin/Unit|
|
||||
|
||||
public final fun test1N(): R|(suspend () -> kotlin/Unit)?|
|
||||
|
||||
public final fun test2(): R|suspend kotlin/Int.() -> kotlin/Int|
|
||||
|
||||
public final fun test2N(): R|(suspend kotlin/Int.() -> kotlin/Int)?|
|
||||
|
||||
public final fun test3(): R|kotlin/collections/List<kotlin/coroutines/SuspendFunction0<kotlin/Unit>>|
|
||||
|
||||
public final fun test3N(): R|kotlin/collections/List<kotlin/coroutines/SuspendFunction0<kotlin/Unit>?>|
|
||||
|
||||
public final fun test4(): R|suspend () -> kotlin/coroutines/SuspendFunction0<kotlin/Unit>|
|
||||
|
||||
public final fun test4N(): R|(suspend () -> kotlin/coroutines/SuspendFunction0<kotlin/Unit>?)?|
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: safeCallOnTypeAlias.kt
|
||||
public final typealias MyTypeAlias = R|() -> kotlin/String?|
|
||||
public final typealias MyTypeAlias = R|(() -> kotlin/String?)?|
|
||||
public final fun foo(x: R|MyTypeAlias|): R|kotlin/Unit| {
|
||||
R|<local>/x|?.{ $subj$.R|kotlin/let|<R|() -> kotlin/String?|, R|kotlin/String?|>(<L> = let@fun <anonymous>(y: R|() -> kotlin/String?|): R|kotlin/String?| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^ R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/String?|>|()?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(<L> = let@fun <anonymous>(result: R|kotlin/String|): R|kotlin/String| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
|
||||
@@ -18,7 +18,7 @@ FILE: kt41982.kt
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <Type : R|Base|, Base : R|DelegateProvider<Base>|> R|Type|.long(initializer: R|() -> kotlin/Long?| = Null(null)): R|Delegate<Type, kotlin/Long>| {
|
||||
public final fun <Type : R|Base|, Base : R|DelegateProvider<Base>|> R|Type|.long(initializer: R|(() -> kotlin/Long?)?| = Null(null)): R|Delegate<Type, kotlin/Long>| {
|
||||
^long Null(null)!!
|
||||
}
|
||||
public final class Test : R|DelegateProvider<kotlin/Any>| {
|
||||
|
||||
Vendored
+4
-4
@@ -1,11 +1,11 @@
|
||||
FILE: propertyWithExtensionType.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(x: R|kotlin/String.() -> kotlin/Unit|, y: R|kotlin/String.() -> kotlin/Int|): R|A| {
|
||||
public constructor(x: R|(kotlin/String.() -> kotlin/Unit)?|, y: R|kotlin/String.() -> kotlin/Int|): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|kotlin/String.() -> kotlin/Unit| = R|<local>/x|
|
||||
public get(): R|kotlin/String.() -> kotlin/Unit|
|
||||
public final val x: R|(kotlin/String.() -> kotlin/Unit)?| = R|<local>/x|
|
||||
public get(): R|(kotlin/String.() -> kotlin/Unit)?|
|
||||
|
||||
public final val y: R|kotlin/String.() -> kotlin/Int| = R|<local>/y|
|
||||
public get(): R|kotlin/String.() -> kotlin/Int|
|
||||
@@ -14,7 +14,7 @@ FILE: propertyWithExtensionType.kt
|
||||
public final fun test(a: R|A|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/a|.R|/A.x|, Null(null)) -> {
|
||||
lval b: R|kotlin/String.() -> kotlin/Unit| = R|<local>/a|.R|/A.x|
|
||||
lval b: R|(kotlin/String.() -> kotlin/Unit)?| = R|<local>/a|.R|/A.x|
|
||||
R|<local>/b|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(String())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ FILE: kt41989.kt
|
||||
|
||||
}
|
||||
public abstract interface C : R|B| {
|
||||
public open val lineCellStyle: R|A.() -> kotlin/Unit|
|
||||
public get(): R|A.() -> kotlin/Unit| {
|
||||
public open val lineCellStyle: R|(A.() -> kotlin/Unit)?|
|
||||
public get(): R|(A.() -> kotlin/Unit)?| {
|
||||
^ when () {
|
||||
R|/cond|() -> {
|
||||
fun R|A|.<anonymous>(): R|kotlin/Unit| <inline=Unknown> {
|
||||
|
||||
+2
-2
@@ -21,14 +21,14 @@ FILE: lambdaArgInScopeFunction.kt
|
||||
this@R|special/anonymous|.R|/_|<R|KotlinClass?|>()
|
||||
}
|
||||
)
|
||||
lval lambda: R|() -> KotlinClass| = R|<local>/kotlinClass|?.{ $subj$.R|kotlin/let|<R|KotlinClass|, R|() -> KotlinClass|>(<L> = let@fun <anonymous>(it: R|KotlinClass|): R|() -> KotlinClass| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
lval lambda: R|(() -> KotlinClass)?| = R|<local>/kotlinClass|?.{ $subj$.R|kotlin/let|<R|KotlinClass|, R|() -> KotlinClass|>(<L> = let@fun <anonymous>(it: R|KotlinClass|): R|() -> KotlinClass| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^ let@fun <anonymous>(): R|KotlinClass| <inline=Unknown> {
|
||||
^ R|<local>/it|
|
||||
}
|
||||
|
||||
}
|
||||
) }
|
||||
R|<local>/lambda|.R|/checkType|<R|() -> KotlinClass|>(<L> = checkType@fun R|CheckTypeInv<kotlin/Function0<KotlinClass>?>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
R|<local>/lambda|.R|/checkType|<R|(() -> KotlinClass)?|>(<L> = checkType@fun R|CheckTypeInv<kotlin/Function0<KotlinClass>?>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
this@R|special/anonymous|.<Inapplicable(INAPPLICABLE_WRONG_RECEIVER): /_>#<R|(kotlin/Unit) -> KotlinClass?|>()
|
||||
}
|
||||
)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: smartcastOnLambda.kt
|
||||
public final fun test(func: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
public final fun test(func: R|(() -> kotlin/Unit)?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/func|, Null(null)) -> {
|
||||
R|<local>/func|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
|
||||
@@ -69,7 +69,7 @@ fun ConeKotlinType.renderFunctionType(
|
||||
kind: FunctionClassKind?, isExtension: Boolean, renderType: ConeTypeProjection.() -> String = { render() }
|
||||
): String {
|
||||
if (!kind.withPrettyRender()) return renderType()
|
||||
return buildString {
|
||||
val renderedType = buildString {
|
||||
if (kind == FunctionClassKind.SuspendFunction) {
|
||||
append("suspend ")
|
||||
}
|
||||
@@ -88,6 +88,7 @@ fun ConeKotlinType.renderFunctionType(
|
||||
append(" -> ")
|
||||
append(returnType.renderType())
|
||||
}
|
||||
return if (isMarkedNullable) "($renderedType)?" else renderedType
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
package test
|
||||
|
||||
fun test1(): suspend () -> Unit = null!!
|
||||
fun test1N(): (suspend () -> Unit)? = null
|
||||
fun test2(): suspend Int.() -> Int = null!!
|
||||
fun test2N(): (suspend Int.() -> Int)? = null
|
||||
fun test3(): List<suspend () -> Unit> = null!!
|
||||
fun test3N(): List<(suspend () -> Unit)?> = null!!
|
||||
fun test4(): suspend () -> (suspend () -> Unit) = null!!
|
||||
fun test4N(): (suspend () -> (suspend () -> Unit)?)? = null
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package test
|
||||
|
||||
public fun test1(): suspend () -> kotlin.Unit
|
||||
public fun test1N(): (suspend () -> kotlin.Unit)?
|
||||
public fun test2(): suspend kotlin.Int.() -> kotlin.Int
|
||||
public fun test2N(): (suspend kotlin.Int.() -> kotlin.Int)?
|
||||
public fun test3(): kotlin.collections.List<suspend () -> kotlin.Unit>
|
||||
public fun test3N(): kotlin.collections.List<(suspend () -> kotlin.Unit)?>
|
||||
public fun test4(): suspend () -> suspend () -> kotlin.Unit
|
||||
public fun test4N(): (suspend () -> (suspend () -> kotlin.Unit)?)?
|
||||
|
||||
Reference in New Issue
Block a user