[NI] Discriminate Nothing? result type from nullability constraints
Nullability constraints should not be chosen when proper argument constraints for variables in contravariant position present. ^KT-32106 Fixed ^KT-33166 Fixed
This commit is contained in:
Generated
+10
@@ -10604,6 +10604,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
|||||||
public void testNontrivialCallExpression() throws Exception {
|
public void testNontrivialCallExpression() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("preferArgumentToNullability.kt")
|
||||||
|
public void testPreferArgumentToNullability() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/preferArgumentToNullability.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("preferNothingToBound.kt")
|
||||||
|
public void testPreferNothingToBound() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/preferNothingToBound.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/nothingType")
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/nothingType")
|
||||||
|
|||||||
+4
-1
@@ -175,7 +175,10 @@ class ConstraintIncorporator(
|
|||||||
val inputTypePosition = if (baseConstraint.position.from is OnlyInputTypeConstraintPosition)
|
val inputTypePosition = if (baseConstraint.position.from is OnlyInputTypeConstraintPosition)
|
||||||
baseConstraint.position else null
|
baseConstraint.position else null
|
||||||
|
|
||||||
addNewIncorporatedConstraint(targetVariable, newConstraint, ConstraintContext(kind, derivedFrom, inputTypePosition))
|
val isNullabilityConstraint = isUsefulForNullabilityConstraint && newConstraint.isNullableNothing()
|
||||||
|
val constraintContext = ConstraintContext(kind, derivedFrom, inputTypePosition, isNullabilityConstraint)
|
||||||
|
|
||||||
|
addNewIncorporatedConstraint(targetVariable, newConstraint, constraintContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.containsConstrainingTypeWithoutProjection(
|
fun Context.containsConstrainingTypeWithoutProjection(
|
||||||
|
|||||||
+10
-4
@@ -178,7 +178,7 @@ class ConstraintInjector(
|
|||||||
val typeVariable = c.allTypeVariables[typeVariableConstructor]
|
val typeVariable = c.allTypeVariables[typeVariableConstructor]
|
||||||
?: error("Should by type variableConstructor: $typeVariableConstructor. ${c.allTypeVariables.values}")
|
?: error("Should by type variableConstructor: $typeVariableConstructor. ${c.allTypeVariables.values}")
|
||||||
|
|
||||||
addNewIncorporatedConstraint(typeVariable, type, ConstraintContext(kind, emptySet()))
|
addNewIncorporatedConstraint(typeVariable, type, ConstraintContext(kind, emptySet(), isNullabilityConstraint = false))
|
||||||
}
|
}
|
||||||
|
|
||||||
// from ConstraintIncorporator.Context
|
// from ConstraintIncorporator.Context
|
||||||
@@ -194,7 +194,7 @@ class ConstraintInjector(
|
|||||||
type: KotlinTypeMarker,
|
type: KotlinTypeMarker,
|
||||||
constraintContext: ConstraintContext
|
constraintContext: ConstraintContext
|
||||||
) {
|
) {
|
||||||
val (kind, derivedFrom, inputTypePosition) = constraintContext
|
val (kind, derivedFrom, inputTypePosition, isNullabilityConstraint) = constraintContext
|
||||||
|
|
||||||
var targetType = type
|
var targetType = type
|
||||||
if (targetType.isUninferredParameter()) {
|
if (targetType.isUninferredParameter()) {
|
||||||
@@ -231,7 +231,12 @@ class ConstraintInjector(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
possibleNewConstraints.add(typeVariable to Constraint(kind, targetType, position, derivedFrom = derivedFrom))
|
val newConstraint = Constraint(
|
||||||
|
kind, targetType, position,
|
||||||
|
derivedFrom = derivedFrom,
|
||||||
|
isNullabilityConstraint = isNullabilityConstraint
|
||||||
|
)
|
||||||
|
possibleNewConstraints.add(typeVariable to newConstraint)
|
||||||
inputTypePosition?.let { preservedInputTypePositions.add(it) }
|
inputTypePosition?.let { preservedInputTypePositions.add(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,5 +269,6 @@ class ConstraintInjector(
|
|||||||
data class ConstraintContext(
|
data class ConstraintContext(
|
||||||
val kind: ConstraintKind,
|
val kind: ConstraintKind,
|
||||||
val derivedFrom: Set<TypeVariableMarker>,
|
val derivedFrom: Set<TypeVariableMarker>,
|
||||||
val inputTypePosition: ConstraintPosition? = null
|
val inputTypePosition: ConstraintPosition? = null,
|
||||||
|
val isNullabilityConstraint: Boolean
|
||||||
)
|
)
|
||||||
|
|||||||
+13
-9
@@ -80,23 +80,27 @@ class ResultTypeResolver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun Context.isSuitableType(resultType: KotlinTypeMarker, variableWithConstraints: VariableWithConstraints): Boolean {
|
private fun Context.isSuitableType(resultType: KotlinTypeMarker, variableWithConstraints: VariableWithConstraints): Boolean {
|
||||||
for (constraint in variableWithConstraints.constraints) {
|
val filteredConstraints = variableWithConstraints.constraints.filter { isProperType(it.type) }
|
||||||
if (!isProperType(constraint.type)) continue
|
for (constraint in filteredConstraints) {
|
||||||
if (!checkConstraint(this, constraint.type, constraint.kind, resultType)) return false
|
if (!checkConstraint(this, constraint.type, constraint.kind, resultType)) return false
|
||||||
}
|
}
|
||||||
if (
|
if (!trivialConstraintTypeInferenceOracle.isSuitableResultedType(resultType)) {
|
||||||
!trivialConstraintTypeInferenceOracle.isSuitableResultedType(resultType)
|
if (nothingIsForbiddenFor(variableWithConstraints.typeVariable)) return false
|
||||||
&& isNothingNotSuitableFor(variableWithConstraints.typeVariable)
|
if (resultType.isNullableType() && checkSingleLowerNullabilityConstraint(filteredConstraints)) return false
|
||||||
) return false
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isNothingNotSuitableFor(variable: TypeVariableMarker): Boolean {
|
private fun nothingIsForbiddenFor(variable: TypeVariableMarker): Boolean {
|
||||||
val parameterName = variable.safeAs<TypeVariableFromCallableDescriptor>()?.originalTypeParameter?.name ?: return false
|
val parameterName = variable.safeAs<TypeVariableFromCallableDescriptor>()?.originalTypeParameter?.name ?: return false
|
||||||
val isSpecialFunctionParameter = statelessCallbacks?.isSpecialFunctionTypeParameterName(parameterName) ?: false
|
val isSpecialFunctionParameter = statelessCallbacks?.isSpecialFunctionTypeParameterName(parameterName) ?: false
|
||||||
val isBangBangParameter = isSpecialFunctionParameter && statelessCallbacks?.isExclExclTypeParameterName(parameterName) ?: false
|
val isFromExclExcl = isSpecialFunctionParameter && statelessCallbacks?.isExclExclTypeParameterName(parameterName) ?: false
|
||||||
return isSpecialFunctionParameter && !isBangBangParameter
|
return isSpecialFunctionParameter && !isFromExclExcl
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkSingleLowerNullabilityConstraint(constraints: List<Constraint>): Boolean {
|
||||||
|
return constraints.singleOrNull { it.kind.isLower() }?.isNullabilityConstraint ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Context.findSubType(variableWithConstraints: VariableWithConstraints): KotlinTypeMarker? {
|
private fun Context.findSubType(variableWithConstraints: VariableWithConstraints): KotlinTypeMarker? {
|
||||||
|
|||||||
+2
-1
@@ -68,7 +68,8 @@ class Constraint(
|
|||||||
val type: KotlinTypeMarker, // flexible types here is allowed
|
val type: KotlinTypeMarker, // flexible types here is allowed
|
||||||
val position: IncorporationConstraintPosition,
|
val position: IncorporationConstraintPosition,
|
||||||
val typeHashCode: Int = type.hashCode(),
|
val typeHashCode: Int = type.hashCode(),
|
||||||
val derivedFrom: Set<TypeVariableMarker>
|
val derivedFrom: Set<TypeVariableMarker>,
|
||||||
|
val isNullabilityConstraint: Boolean
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
|
|||||||
+2
-1
@@ -68,7 +68,8 @@ class MutableVariableWithConstraints(
|
|||||||
constraint.type,
|
constraint.type,
|
||||||
constraint.position,
|
constraint.position,
|
||||||
constraint.typeHashCode,
|
constraint.typeHashCode,
|
||||||
derivedFrom = constraint.derivedFrom
|
derivedFrom = constraint.derivedFrom,
|
||||||
|
isNullabilityConstraint = false
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
constraint
|
constraint
|
||||||
|
|||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
// !LANGUAGE: +NewInference
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
open class Cls
|
||||||
|
|
||||||
|
abstract class In<in I>
|
||||||
|
class SubIn : In<Cls?>()
|
||||||
|
|
||||||
|
inline fun <reified T : Cls> materialize(): T? = TODO()
|
||||||
|
|
||||||
|
fun <D> transform(transformer: In<D>, data: D): Unit = TODO()
|
||||||
|
|
||||||
|
fun test(subIn: SubIn) {
|
||||||
|
transform(subIn, materialize()) // D should be inferred to Cls?, not Nothing?
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
// !LANGUAGE: +NewInference
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
open class Cls
|
||||||
|
|
||||||
|
abstract class In<in I>
|
||||||
|
class SubIn : In<Cls?>()
|
||||||
|
|
||||||
|
inline fun <reified T : Cls> materialize(): T? = TODO()
|
||||||
|
|
||||||
|
fun <D> transform(transformer: In<D>, data: D): Unit = TODO()
|
||||||
|
|
||||||
|
fun test(subIn: SubIn) {
|
||||||
|
transform(subIn, materialize()) // D should be inferred to Cls?, not Nothing?
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public inline fun </*0*/ reified T : Cls> materialize(): T?
|
||||||
|
public fun test(/*0*/ subIn: SubIn): kotlin.Unit
|
||||||
|
public fun </*0*/ D> transform(/*0*/ transformer: In<D>, /*1*/ data: D): kotlin.Unit
|
||||||
|
|
||||||
|
public open class Cls {
|
||||||
|
public constructor Cls()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class In</*0*/ in I> {
|
||||||
|
public constructor In</*0*/ in I>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class SubIn : In<Cls?> {
|
||||||
|
public constructor SubIn()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fun <K> id(arg: K): K = arg
|
||||||
|
|
||||||
|
val v = id(null)
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fun <K> id(arg: K): K = arg
|
||||||
|
|
||||||
|
val v = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>id(null)<!>
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public val v: kotlin.Nothing?
|
||||||
|
public fun </*0*/ K> id(/*0*/ arg: K): K
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||||
|
|
||||||
|
class Out<out T : Any>(result: T?)
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
val a = Out(null)
|
||||||
|
|
||||||
|
a
|
||||||
|
|
||||||
|
var b: Out<Int>? = null
|
||||||
|
b = a
|
||||||
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
// !LANGUAGE: +NewInference
|
|
||||||
|
|
||||||
class Query<out T : Any> private constructor(
|
class Query<out T : Any> private constructor(
|
||||||
private val result: T?,
|
private val result: T?,
|
||||||
private val error: Throwable?,
|
private val error: Throwable?,
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// !LANGUAGE: +NewInference
|
|
||||||
|
|
||||||
class Query<out T : Any> private constructor(
|
class Query<out T : Any> private constructor(
|
||||||
private val result: T?,
|
private val result: T?,
|
||||||
private val error: Throwable?,
|
private val error: Throwable?,
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,6 @@ fun testOK(first: First, bound: Bound, second: Second) {
|
|||||||
strictSelect(OutB(first), OutB(bound))
|
strictSelect(OutB(first), OutB(bound))
|
||||||
strictSelect(In(first), In(bound))
|
strictSelect(In(first), In(bound))
|
||||||
strictSelect(InB(first), InB(bound))
|
strictSelect(InB(first), InB(bound))
|
||||||
strictSelect(InB(first), InB(second)) // different behaviour in contravariant position
|
|
||||||
|
|
||||||
val out: Out<Bound> = strictSelect(Out(first), Out(second))
|
val out: Out<Bound> = strictSelect(Out(first), Out(second))
|
||||||
val outb: OutB<Bound> = strictSelect(OutB(first), OutB(second))
|
val outb: OutB<Bound> = strictSelect(OutB(first), OutB(second))
|
||||||
@@ -49,6 +48,7 @@ fun testFail(first: First, bound: Bound, second: Second) {
|
|||||||
strictSelect(Inv(first), Inv(bound))
|
strictSelect(Inv(first), Inv(bound))
|
||||||
strictSelect(Out(first), Out(second))
|
strictSelect(Out(first), Out(second))
|
||||||
strictSelect(In(first), In(second))
|
strictSelect(In(first), In(second))
|
||||||
|
strictSelect(InB(first), InB(second))
|
||||||
strictSelect(Out(Inv(first)), Out(Inv(second)))
|
strictSelect(Out(Inv(first)), Out(Inv(second)))
|
||||||
strictSelect(In(Inv(first)), In(Inv(second)))
|
strictSelect(In(Inv(first)), In(Inv(second)))
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,6 @@ fun testOK(first: First, bound: Bound, second: Second) {
|
|||||||
strictSelect(OutB(first), OutB(bound))
|
strictSelect(OutB(first), OutB(bound))
|
||||||
strictSelect(In(first), In(bound))
|
strictSelect(In(first), In(bound))
|
||||||
strictSelect(InB(first), InB(bound))
|
strictSelect(InB(first), InB(bound))
|
||||||
<!OI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(InB(first), InB(second)) // different behaviour in contravariant position
|
|
||||||
|
|
||||||
val out: Out<Bound> = strictSelect(Out(first), Out(second))
|
val out: Out<Bound> = strictSelect(Out(first), Out(second))
|
||||||
val outb: OutB<Bound> = strictSelect(OutB(first), OutB(second))
|
val outb: OutB<Bound> = strictSelect(OutB(first), OutB(second))
|
||||||
@@ -49,6 +48,7 @@ fun testFail(first: First, bound: Bound, second: Second) {
|
|||||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Inv(first), Inv(bound))
|
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Inv(first), Inv(bound))
|
||||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Out(first), Out(second))
|
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Out(first), Out(second))
|
||||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(In(first), In(second))
|
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(In(first), In(second))
|
||||||
|
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(InB(first), InB(second))
|
||||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Out(Inv(first)), Out(Inv(second)))
|
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Out(Inv(first)), Out(Inv(second)))
|
||||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(In(Inv(first)), In(Inv(second)))
|
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(In(Inv(first)), In(Inv(second)))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ fun test1(): Map<Int, Int> = run {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun test2(): Map<Int, Int> = run {
|
fun test2(): Map<Int, Int> = run {
|
||||||
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>try {
|
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>try {
|
||||||
emptyMap()
|
emptyMap()
|
||||||
} catch (e: ExcA) {
|
} catch (e: ExcA) {
|
||||||
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>mapOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>"" to ""<!>)<!>
|
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>mapOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>"" to ""<!>)<!>
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ FILE fqName:<root> fileName:/whenReturn.kt
|
|||||||
FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
|
FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
|
||||||
VALUE_PARAMETER name:grade index:0 type:kotlin.String
|
VALUE_PARAMETER name:grade index:0 type:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=kotlin.String origin=WHEN
|
BLOCK type=kotlin.Nothing origin=WHEN
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.String [val]
|
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.String [val]
|
||||||
GET_VAR 'grade: kotlin.String declared in <root>.toString' type=kotlin.String origin=null
|
GET_VAR 'grade: kotlin.String declared in <root>.toString' type=kotlin.String origin=null
|
||||||
WHEN type=kotlin.String origin=WHEN
|
WHEN type=kotlin.Nothing origin=WHEN
|
||||||
BRANCH
|
BRANCH
|
||||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||||
arg0: GET_VAR 'val tmp_0: kotlin.String [val] declared in <root>.toString' type=kotlin.String origin=null
|
arg0: GET_VAR 'val tmp_0: kotlin.String [val] declared in <root>.toString' type=kotlin.String origin=null
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
FILE fqName:<root> fileName:/nonLocalReturn.kt
|
FILE fqName:<root> fileName:/nonLocalReturn.kt
|
||||||
FUN name:test0 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:test0 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.run>): R of kotlin.run [inline] declared in kotlin' type=kotlin.Unit origin=null
|
CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.run>): R of kotlin.run [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||||
<R>: kotlin.Unit
|
<R>: kotlin.Nothing
|
||||||
block: FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
block: FUN_EXPR type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun test0 (): kotlin.Unit declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun test0 (): kotlin.Unit declared in <root>'
|
||||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||||
@@ -33,12 +33,12 @@ FILE fqName:<root> fileName:/nonLocalReturn.kt
|
|||||||
block: FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
block: FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.run>): R of kotlin.run [inline] declared in kotlin' type=kotlin.Unit origin=null
|
CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.run>): R of kotlin.run [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||||
<R>: kotlin.Unit
|
<R>: kotlin.Nothing
|
||||||
block: FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
block: FUN_EXPR type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test3.<anonymous>'
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Nothing declared in <root>.test3.<anonymous>'
|
||||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||||
FUN name:testLrmFoo1 visibility:public modality:FINAL <> (ints:kotlin.collections.List<kotlin.Int>) returnType:kotlin.Unit
|
FUN name:testLrmFoo1 visibility:public modality:FINAL <> (ints:kotlin.collections.List<kotlin.Int>) returnType:kotlin.Unit
|
||||||
VALUE_PARAMETER name:ints index:0 type:kotlin.collections.List<kotlin.Int>
|
VALUE_PARAMETER name:ints index:0 type:kotlin.collections.List<kotlin.Int>
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ fun case_24(a: ((() -> Unit) -> Unit), b: (() -> Unit)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TESTCASE NUMBER: 25
|
// TESTCASE NUMBER: 25
|
||||||
fun case_25(a: (() -> Unit) -> Unit, b: (() -> Unit) -> Unit = if (<!SENSELESS_COMPARISON!>a == null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("(() -> kotlin.Unit) -> kotlin.Unit & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>a<!> else <!TYPE_MISMATCH!>{{}}<!>) {
|
fun case_25(a: (() -> Unit) -> Unit, b: (() -> Unit) -> Unit = if (<!SENSELESS_COMPARISON!>a == null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("(() -> kotlin.Unit) -> kotlin.Unit & kotlin.Nothing")!>a<!> else {{}}) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("(() -> kotlin.Unit) -> kotlin.Unit")!>a<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("(() -> kotlin.Unit) -> kotlin.Unit")!>a<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("(() -> kotlin.Unit) -> kotlin.Unit")!>b<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("(() -> kotlin.Unit) -> kotlin.Unit")!>b<!>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10611,6 +10611,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
public void testNontrivialCallExpression() throws Exception {
|
public void testNontrivialCallExpression() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("preferArgumentToNullability.kt")
|
||||||
|
public void testPreferArgumentToNullability() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/preferArgumentToNullability.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("preferNothingToBound.kt")
|
||||||
|
public void testPreferNothingToBound() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/preferNothingToBound.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/nothingType")
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/nothingType")
|
||||||
|
|||||||
Generated
+10
@@ -10606,6 +10606,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
public void testNontrivialCallExpression() throws Exception {
|
public void testNontrivialCallExpression() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("preferArgumentToNullability.kt")
|
||||||
|
public void testPreferArgumentToNullability() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/preferArgumentToNullability.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("preferNothingToBound.kt")
|
||||||
|
public void testPreferNothingToBound() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/preferNothingToBound.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/nothingType")
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/nothingType")
|
||||||
|
|||||||
Reference in New Issue
Block a user