FIR: keep nullability of lambda return type
This commit is contained in:
committed by
Mikhail Glukhikh
parent
28a1d1ceac
commit
3d7d87ace5
+3
-3
@@ -13,8 +13,7 @@ import org.jetbrains.kotlin.fir.resolve.calls.*
|
|||||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedReferenceError
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedReferenceError
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.StoreNameReference
|
import org.jetbrains.kotlin.fir.resolve.transformers.StoreNameReference
|
||||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.types.ConeTypeVariable
|
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzerContext
|
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzerContext
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilder
|
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilder
|
||||||
@@ -117,7 +116,8 @@ class PostponedArgumentsAnalyzer(
|
|||||||
c.canBeProper(rawReturnType) -> substitute(rawReturnType)
|
c.canBeProper(rawReturnType) -> substitute(rawReturnType)
|
||||||
|
|
||||||
// For Unit-coercion
|
// For Unit-coercion
|
||||||
c.hasUpperOrEqualUnitConstraint(rawReturnType) -> unitType
|
c.hasUpperOrEqualUnitConstraint(rawReturnType) ->
|
||||||
|
if (rawReturnType.isMarkedNullable) unitType.withNullability(ConeNullability.NULLABLE) else unitType
|
||||||
|
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,6 +1,5 @@
|
|||||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||||
// WASM_MUTE_REASON: UNIT_ISSUES
|
// WASM_MUTE_REASON: UNIT_ISSUES
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
class Inv<T>(val x: T?)
|
class Inv<T>(val x: T?)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user