[NI] Consider intersection type with number type as Nothing
Currently, only for "in": In<in Int & A> == In<in Nothing> == In<*> #KT-37302 Fixed
This commit is contained in:
@@ -2803,7 +2803,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
KotlinType approximatedType =
|
||||
CapturedTypeConstructorKt.isCaptured(type) ?
|
||||
(KotlinType) approximator.approximateToSuperType(
|
||||
type, TypeApproximatorConfiguration.CapturedAndIntegerLiteralsTypesApproximation.INSTANCE
|
||||
type, TypeApproximatorConfiguration.InternalTypesApproximation.INSTANCE
|
||||
) : null;
|
||||
return approximatedType != null ? approximatedType : type;
|
||||
} else {
|
||||
|
||||
Generated
+5
@@ -4745,6 +4745,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/constants/long.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberLiteralCoercionToInferredType.kt")
|
||||
public void testNumberLiteralCoercionToInferredType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/numberLiteralCoercionToInferredType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateConst.kt")
|
||||
public void testPrivateConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/privateConst.kt");
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ fun CallableDescriptor.substituteAndApproximateTypes(
|
||||
}
|
||||
}
|
||||
|
||||
return substitute(TypeSubstitutor.create(wrappedSubstitution))
|
||||
return substitute(TypeSubstitutor.create(wrappedSubstitution)) ?: this
|
||||
}
|
||||
|
||||
internal fun <E> MutableList<E>.trimToSize(newSize: Int) = subList(newSize, size).clear()
|
||||
|
||||
+2
-2
@@ -149,7 +149,7 @@ class ResultTypeResolver(
|
||||
|
||||
return typeApproximator.approximateToSuperType(
|
||||
commonSuperType,
|
||||
TypeApproximatorConfiguration.CapturedAndIntegerLiteralsTypesApproximation
|
||||
TypeApproximatorConfiguration.InternalTypesApproximation
|
||||
) ?: commonSuperType
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ class ResultTypeResolver(
|
||||
|
||||
return typeApproximator.approximateToSubType(
|
||||
upperType,
|
||||
TypeApproximatorConfiguration.CapturedAndIntegerLiteralsTypesApproximation
|
||||
TypeApproximatorConfiguration.InternalTypesApproximation
|
||||
) ?: upperType
|
||||
}
|
||||
return null
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
package org.jetbrains.kotlin.resolve.calls.tower
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.getReceiverValueWithSmartCast
|
||||
@@ -144,11 +141,11 @@ internal class MemberScopeTowerLevel(
|
||||
Variance.INVARIANT -> null
|
||||
Variance.OUT_VARIANCE -> approximator.approximateToSuperType(
|
||||
topLevelType.unwrap(),
|
||||
TypeApproximatorConfiguration.CapturedAndIntegerLiteralsTypesApproximation
|
||||
TypeApproximatorConfiguration.InternalTypesApproximation
|
||||
)
|
||||
Variance.IN_VARIANCE -> approximator.approximateToSubType(
|
||||
topLevelType.unwrap(),
|
||||
TypeApproximatorConfiguration.CapturedAndIntegerLiteralsTypesApproximation
|
||||
TypeApproximatorConfiguration.InternalTypesApproximation
|
||||
)
|
||||
} ?: topLevelType
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.types.TypeApproximatorConfiguration.IntersectionStra
|
||||
import org.jetbrains.kotlin.types.checker.NewCapturedTypeConstructor
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
import org.jetbrains.kotlin.types.model.CaptureStatus.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.isSignedOrUnsignedNumberType
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
|
||||
@@ -42,6 +43,7 @@ open class TypeApproximatorConfiguration {
|
||||
open val integerLiteralType: Boolean = false // IntegerLiteralTypeConstructor
|
||||
open val definitelyNotNullType get() = true
|
||||
open val intersection: IntersectionStrategy = TO_COMMON_SUPERTYPE
|
||||
open val intersectionTypesInContravariantPositions = false
|
||||
|
||||
open val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean = { false }
|
||||
open fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean =
|
||||
@@ -60,6 +62,7 @@ open class TypeApproximatorConfiguration {
|
||||
override val intersection get() = ALLOWED
|
||||
override val errorType get() = true
|
||||
override val integerLiteralType: Boolean get() = true
|
||||
override val intersectionTypesInContravariantPositions: Boolean get() = true
|
||||
}
|
||||
|
||||
object PublicDeclaration : AllFlexibleSameValue() {
|
||||
@@ -67,6 +70,7 @@ open class TypeApproximatorConfiguration {
|
||||
override val errorType get() = true
|
||||
override val definitelyNotNullType get() = false
|
||||
override val integerLiteralType: Boolean get() = true
|
||||
override val intersectionTypesInContravariantPositions: Boolean get() = true
|
||||
}
|
||||
|
||||
abstract class AbstractCapturedTypesApproximation(val approximatedCapturedStatus: CaptureStatus) :
|
||||
@@ -84,13 +88,15 @@ open class TypeApproximatorConfiguration {
|
||||
|
||||
object IncorporationConfiguration : TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FOR_INCORPORATION)
|
||||
object SubtypeCapturedTypesApproximation : TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FOR_SUBTYPING)
|
||||
object CapturedAndIntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FROM_EXPRESSION) {
|
||||
object InternalTypesApproximation : TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FROM_EXPRESSION) {
|
||||
override val integerLiteralType: Boolean get() = true
|
||||
override val intersectionTypesInContravariantPositions: Boolean get() = true
|
||||
}
|
||||
|
||||
object FinalApproximationAfterResolutionAndInference :
|
||||
TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FROM_EXPRESSION) {
|
||||
override val integerLiteralType: Boolean get() = true
|
||||
override val intersectionTypesInContravariantPositions: Boolean get() = true
|
||||
}
|
||||
|
||||
object IntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AllFlexibleSameValue() {
|
||||
@@ -279,6 +285,13 @@ abstract class AbstractTypeApproximator(val ctx: TypeSystemInferenceExtensionCon
|
||||
}
|
||||
}
|
||||
|
||||
private fun isIntersectionTypeEffectivelyNothing(constructor: IntersectionTypeConstructor): Boolean {
|
||||
// We consider intersection as Nothing only if one of it's component is a primitive number type
|
||||
// It's intentional we're not trying to prove population of some type as it was in OI
|
||||
|
||||
return constructor.supertypes.any { !it.isMarkedNullable && it.isSignedOrUnsignedNumberType() }
|
||||
}
|
||||
|
||||
private fun approximateIntersectionType(
|
||||
type: SimpleTypeMarker,
|
||||
conf: TypeApproximatorConfiguration,
|
||||
@@ -512,6 +525,18 @@ abstract class AbstractTypeApproximator(val ctx: TypeSystemInferenceExtensionCon
|
||||
} else type.defaultResult(toSuper)
|
||||
}
|
||||
TypeVariance.OUT, TypeVariance.IN -> {
|
||||
if (
|
||||
conf.intersectionTypesInContravariantPositions &&
|
||||
effectiveVariance == TypeVariance.IN &&
|
||||
argumentType.typeConstructor().isIntersection()
|
||||
) {
|
||||
val intersectionTypeConstructor = argumentType.typeConstructor() as? IntersectionTypeConstructor
|
||||
if (intersectionTypeConstructor != null && isIntersectionTypeEffectivelyNothing(intersectionTypeConstructor)) {
|
||||
newArguments[index] = createStarProjection(parameter)
|
||||
continue@loop
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Out<Foo> <: Out<superType(Foo)>
|
||||
* Inv<out Foo> <: Inv<out superType(Foo)>
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
// IGNORE_BACKEND: JS, JS_IR
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
public static long platformLong() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
public static Comparable<Long> platformCLong() {
|
||||
return new Long(42);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
inline fun <reified T> check(value: Any?) {
|
||||
if (value !is T) throw Exception("value: $value should have type ${T::class.simpleName}")
|
||||
}
|
||||
|
||||
fun <K> selectFirst(vararg xs: K): K = xs[0]
|
||||
|
||||
fun takeNLong(nL: Long?) {}
|
||||
|
||||
fun <T> checkArray(array: T, copy: T.() -> T, toList: T.() -> List<*>, check: (T, T) -> Boolean, modify: T.() -> Unit) {}
|
||||
|
||||
fun testFromStdlib() {
|
||||
checkArray(arrayOf("a", 1, null), { copyOf() }, { toList() }, { a1, a2 -> a1 contentEquals a2 }, { reverse() })
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
check<Long>(selectFirst(0, 0L))
|
||||
check<Byte>(selectFirst(0, 0.toByte()))
|
||||
check<Short>(selectFirst(0, 0.toShort()))
|
||||
|
||||
takeNLong(0)
|
||||
|
||||
val cLong: Comparable<Long> = 0L
|
||||
check<Long>(selectFirst(0, cLong))
|
||||
|
||||
val cByte: Comparable<Byte> = 0.toByte()
|
||||
check<Byte>(selectFirst(0, cByte))
|
||||
|
||||
val cShort: Comparable<Short> = 0.toShort()
|
||||
check<Short>(selectFirst(0, cShort))
|
||||
|
||||
val cStar: Comparable<*> = 0L
|
||||
check<Int>(selectFirst(0, cStar))
|
||||
|
||||
check<Long>(selectFirst(0, J.platformLong()))
|
||||
check<Long>(selectFirst(0, J.platformCLong()))
|
||||
|
||||
check<Int>(selectFirst(0, 0L, "string"))
|
||||
check<Int>(selectFirst(0, 0L, true))
|
||||
check<Int>(selectFirst(0, 0L, 0.toByte()))
|
||||
check<Int>(selectFirst(0, 0L, 0f))
|
||||
check<Int>(selectFirst(0, 0L, 0f, 0.0))
|
||||
|
||||
val r = 0
|
||||
check<Int>(
|
||||
when (r) {
|
||||
0 -> 0
|
||||
1 -> 0L
|
||||
2 -> "string"
|
||||
else -> TODO()
|
||||
}
|
||||
)
|
||||
|
||||
check<Int>(selectFirst(0, 0L, 0.0, null))
|
||||
|
||||
check<ULong>(selectFirst(0u, 0uL))
|
||||
check<UByte>(selectFirst(0u, 0.toUByte()))
|
||||
check<UShort>(selectFirst(0u, 0.toUShort()))
|
||||
|
||||
check<UInt>(selectFirst(0u, 0uL, "foo"))
|
||||
check<UInt>(selectFirst(0u, 0uL, "foo", null))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+1
-1
@@ -18,7 +18,7 @@ fun test() {
|
||||
// ISSUE: KT-27999
|
||||
// ISSUE: KT-30244
|
||||
fun test_1() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("() -> {Comparable<{Int & String}> & java.io.Serializable}")!>select(
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("() -> {Comparable<*> & java.io.Serializable}")!>select(
|
||||
{ 1 },
|
||||
{ "" }
|
||||
)<!>
|
||||
|
||||
+2
-2
@@ -107,7 +107,7 @@ fun case_8() {
|
||||
val x3 = Test.id(A(null))
|
||||
|
||||
val result_1 = select(x1, x2, x3)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<out {Comparable<{Int & String}> & java.io.Serializable}?>?")!>result_1<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<out {Comparable<*>? & java.io.Serializable?}>?")!>result_1<!>
|
||||
}
|
||||
|
||||
fun case_9() {
|
||||
@@ -116,7 +116,7 @@ fun case_9() {
|
||||
val x3 = A(Test.id(A('s')))
|
||||
|
||||
val result_1 = select(x1, x2, x3)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<out A<out {Comparable<{Char & Int & String}> & java.io.Serializable}>?>")!>result_1<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<out A<out {Comparable<*> & java.io.Serializable}>?>")!>result_1<!>
|
||||
}
|
||||
|
||||
fun case_10() {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
public val test1: C<kotlin.Int> /* = Cons<kotlin.Int> */
|
||||
public val test2: C<kotlin.Number> /* = Cons<kotlin.Number> */
|
||||
public val test2: Cons<out kotlin.Any?>
|
||||
|
||||
public final class Cons</*0*/ T : kotlin.Number> {
|
||||
public constructor Cons</*0*/ T : kotlin.Number>(/*0*/ head: T, /*1*/ tail: Cons<T>?)
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@ package
|
||||
|
||||
public val test0: P<kotlin.Int, kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test0p2: P2<kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test0p2a: Pair<out kotlin.Any, out kotlin.Any>
|
||||
public val test0p2a: Pair<out kotlin.Any?, out kotlin.Any?>
|
||||
public val test0pr: PR<kotlin.String, kotlin.Int> /* = Pair<kotlin.Int, kotlin.String> */
|
||||
public val test1: P<kotlin.Int, kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test1p2: P2<kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
@@ -13,7 +13,7 @@ public val test2pr: PR<kotlin.Int, kotlin.String> /* = Pair<kotlin.String, kotli
|
||||
public val test2pra: PR<kotlin.String, kotlin.Int> /* = Pair<kotlin.Int, kotlin.String> */
|
||||
public val test3: P<kotlin.Int, kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test3p2: P2<kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test3pr: Pair<out kotlin.Any, out kotlin.Any>
|
||||
public val test3pr: Pair<out kotlin.Any?, out kotlin.Any?>
|
||||
public val testMP0: MP<kotlin.Int> /* = MyPair<kotlin.String, kotlin.Int> */
|
||||
public val testMP1: MP<kotlin.String> /* = MyPair<kotlin.String, kotlin.String> */
|
||||
public val testMP2: MP<kotlin.String> /* = MyPair<kotlin.String, kotlin.String> */
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun test() {
|
||||
val u = when (true) {
|
||||
true -> 42
|
||||
else -> 1.0
|
||||
}
|
||||
|
||||
assertEquals(42, u)
|
||||
}
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
@@ -9,5 +8,5 @@ fun test() {
|
||||
else -> 1.0
|
||||
}
|
||||
|
||||
assertEquals(42, u)
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_WARNING!>assertEquals<!>(42, u)
|
||||
}
|
||||
+3
-3
@@ -10,7 +10,7 @@ fun test(a: Any, ls: List<String>) {
|
||||
Resolved call:
|
||||
|
||||
Candidate descriptor: fun <T> foo(t: T, l: List<T>): Unit defined in root package
|
||||
Resulting descriptor: fun <T> foo(t: {Comparable<{Int & String}> & java.io.Serializable}, l: List<{Comparable<{Int & String}> & java.io.Serializable}>): Unit defined in root package
|
||||
Resulting descriptor: fun <T> foo(t: {Comparable<*> & java.io.Serializable}, l: List<{Comparable<*> & java.io.Serializable}>): Unit defined in root package
|
||||
|
||||
Explicit receiver kind = NO_EXPLICIT_RECEIVER
|
||||
Dispatch receiver = NO_RECEIVER
|
||||
@@ -18,5 +18,5 @@ Extension receiver = NO_RECEIVER
|
||||
|
||||
Value arguments mapping:
|
||||
|
||||
SUCCESS t : {Comparable<{Int & String}> & java.io.Serializable} = 11
|
||||
SUCCESS l : List<{Comparable<{Int & String}> & java.io.Serializable}> = ls
|
||||
SUCCESS t : {Comparable<*> & java.io.Serializable} = 11
|
||||
SUCCESS l : List<{Comparable<*> & java.io.Serializable}> = ls
|
||||
|
||||
@@ -18,16 +18,16 @@ fun case_1() {
|
||||
val x = case_1(Out(10), Inv(0.1))
|
||||
|
||||
if (x != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>.funNullableAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.funNullableAny()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,16 +38,16 @@ fun case_2(y: Int) {
|
||||
val x = case_2(Out(y), Inv(0.1))
|
||||
|
||||
if (x != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Int}> & Number} & {Comparable<{Double & Int}> & Number}?")!>x<!>.funNullableAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number} & {Comparable<*> & Number}?")!>x<!>.funNullableAny()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,32 +61,32 @@ fun case_3(a: Int?, b: Float?, c: Double?, d: Boolean?) {
|
||||
false -> b
|
||||
null -> c
|
||||
}.apply {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}")!>this<!>
|
||||
if (this != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this<!>.funNullableAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}")!>this<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}")!>this<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}")!>this<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>this<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}")!>this<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}")!>this<!>.funNullableAny()
|
||||
}
|
||||
}.let {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>it<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing>? & Number?}")!>it<!>
|
||||
if (it != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}> & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it<!>.funNullableAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}")!>it<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}")!>it<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}")!>it<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}"), DEBUG_INFO_SMARTCAST!>it<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}")!>it<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<Nothing> & Number} & {Comparable<Nothing>? & Number?}")!>it<!>.funNullableAny()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,9 +100,9 @@ fun case_6() {
|
||||
val x = select(Case6_1<Int>(), Case6_2<Float>(), null)
|
||||
|
||||
if (x != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<{Float & Int}> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<Nothing> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>} & {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<{Float & Int}> & Number}>>? & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<Nothing> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>?}")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<{Float & Int}> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<Nothing> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>} & {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<{Float & Int}> & Number}>>? & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<Nothing> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>?}")!>x<!>.ip1test1()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<{Float & Int}> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<Nothing> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>} & {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<{Float & Int}> & Number}>>? & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<Nothing> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>?}")!>x<!>.ip1test2()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>} & {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>>? & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>?}")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>} & {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>>? & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>?}")!>x<!>.ip1test1()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>} & {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>>? & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out InterfaceWithTypeParameter2<out {Comparable<*> & Number}>> & InterfaceWithTypeParameter2<out InterfaceWithTypeParameter2<out {InterfaceWithTypeParameter1<out Any?> & InterfaceWithTypeParameter2<out Any?>}>>}>>?}")!>x<!>.ip1test2()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ fun case_7() {
|
||||
val x = select(Case7_1<Int, Float>(), Case7_2<Char, String>(), null)
|
||||
|
||||
if (x != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters<out Inv<out {Comparable<{Int & String}> & java.io.Serializable}>, out Inv<out {Comparable<{Char & Float}> & java.io.Serializable}>> & InterfaceWithTwoTypeParameters<out Inv<out {Comparable<{Int & String}> & java.io.Serializable}>, out Inv<out {Comparable<{Char & Float}> & java.io.Serializable}>>?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters<out Inv<out {Comparable<{Int & String}> & java.io.Serializable}>, out Inv<out {Comparable<{Char & Float}> & java.io.Serializable}>> & InterfaceWithTwoTypeParameters<out Inv<out {Comparable<{Int & String}> & java.io.Serializable}>, out Inv<out {Comparable<{Char & Float}> & java.io.Serializable}>>?")!>x<!>.ip2test()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters<out Inv<out {Comparable<*> & java.io.Serializable}>, out Inv<out {Comparable<*> & java.io.Serializable}>> & InterfaceWithTwoTypeParameters<out Inv<out {Comparable<*> & java.io.Serializable}>, out Inv<out {Comparable<*> & java.io.Serializable}>>?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters<out Inv<out {Comparable<*> & java.io.Serializable}>, out Inv<out {Comparable<*> & java.io.Serializable}>> & InterfaceWithTwoTypeParameters<out Inv<out {Comparable<*> & java.io.Serializable}>, out Inv<out {Comparable<*> & java.io.Serializable}>>?")!>x<!>.ip2test()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,24 +127,24 @@ fun case_8() {
|
||||
val x = select(Case8_1<Int, Float>(), Case8_2<Char, String>(), null)
|
||||
|
||||
if (x != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>, out {Comparable<{Char & Float}> & java.io.Serializable}> & ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>, out {Comparable<{Char & Float}> & java.io.Serializable}>?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>, out {Comparable<{Char & Float}> & java.io.Serializable}> & ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>, out {Comparable<{Char & Float}> & java.io.Serializable}>?")!>x<!>.test1()
|
||||
val y = <!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>, out {Comparable<{Char & Float}> & java.io.Serializable}> & ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>, out {Comparable<{Char & Float}> & java.io.Serializable}>?")!>x<!>.test2()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>, out {Comparable<*> & java.io.Serializable}> & ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>, out {Comparable<*> & java.io.Serializable}>?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>, out {Comparable<*> & java.io.Serializable}> & ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>, out {Comparable<*> & java.io.Serializable}>?")!>x<!>.test1()
|
||||
val y = <!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>, out {Comparable<*> & java.io.Serializable}> & ClassWithTwoTypeParameters<out ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>, out {Comparable<*> & java.io.Serializable}>?")!>x<!>.test2()
|
||||
if (y != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}> & ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}> & ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>?")!>y<!>.test1()
|
||||
val z = <!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}> & ClassWithTwoTypeParameters<out {Comparable<{Int & String}> & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>?")!>y<!>.test2()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}> & ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}> & ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>?")!>y<!>.test1()
|
||||
val z = <!DEBUG_INFO_EXPRESSION_TYPE("ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}> & ClassWithTwoTypeParameters<out {Comparable<*> & java.io.Serializable}, out {Comparable<*> & java.io.Serializable}>?")!>y<!>.test2()
|
||||
if (z != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Int & String}> & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z<!>.funNullableAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.propT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.propAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.propNullableT
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.propNullableAny
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.funT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.funAny()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & java.io.Serializable} & {Comparable<*> & java.io.Serializable}?")!>z<!>.funNullableAny()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,8 +143,8 @@ fun case_12(z: Any?) {
|
||||
return@let it as Int
|
||||
<!UNREACHABLE_CODE!>it as? Float ?: 10f<!>
|
||||
}
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Float & Int}> & Number}")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Float & Int}> & Number}")!>y<!>.toByte()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number}")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number}")!>y<!>.toByte()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -167,8 +167,8 @@ fun case_14(z: Any?) {
|
||||
return@run this as Int
|
||||
<!UNREACHABLE_CODE!>this as? Float ?: 10f<!>
|
||||
}
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Float & Int}> & Number}")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Float & Int}> & Number}")!>y<!>.toByte()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number}")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Comparable<*> & Number}")!>y<!>.toByte()
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+5
@@ -4775,6 +4775,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/constants/long.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberLiteralCoercionToInferredType.kt")
|
||||
public void testNumberLiteralCoercionToInferredType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/numberLiteralCoercionToInferredType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateConst.kt")
|
||||
public void testPrivateConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/privateConst.kt");
|
||||
|
||||
+5
@@ -4775,6 +4775,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/constants/long.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberLiteralCoercionToInferredType.kt")
|
||||
public void testNumberLiteralCoercionToInferredType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/numberLiteralCoercionToInferredType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateConst.kt")
|
||||
public void testPrivateConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/privateConst.kt");
|
||||
|
||||
+5
@@ -4745,6 +4745,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/constants/long.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberLiteralCoercionToInferredType.kt")
|
||||
public void testNumberLiteralCoercionToInferredType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/numberLiteralCoercionToInferredType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateConst.kt")
|
||||
public void testPrivateConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/privateConst.kt");
|
||||
|
||||
@@ -56,7 +56,13 @@ object KotlinTypeFactory {
|
||||
)
|
||||
}
|
||||
is TypeAliasDescriptor -> ErrorUtils.createErrorScope("Scope for abbreviation: ${descriptor.name}", true)
|
||||
else -> throw IllegalStateException("Unsupported classifier: $descriptor for constructor: $constructor")
|
||||
else -> {
|
||||
if (constructor is IntersectionTypeConstructor) {
|
||||
return constructor.createScopeForKotlinType()
|
||||
}
|
||||
|
||||
throw IllegalStateException("Unsupported classifier: $descriptor for constructor: $constructor")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -545,7 +545,7 @@ public class TypeUtils {
|
||||
return literalTypeConstructor.getApproximatedType();
|
||||
}
|
||||
|
||||
// If approximated type does not mathc expected type then expected type is very
|
||||
// If approximated type does not match expected type then expected type is very
|
||||
// specific type (e.g. Comparable<Byte>), so only one of possible types could match it
|
||||
KotlinType approximatedType = literalTypeConstructor.getApproximatedType();
|
||||
if (KotlinTypeChecker.DEFAULT.isSubtypeOf(approximatedType, expectedType)) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
|
||||
// PROBLEM: none
|
||||
// ERROR: Type mismatch: inferred type is List<{Comparable<{Int & Long}> & Number}> but MutableList<Int> was expected
|
||||
// ERROR: Type mismatch: inferred type is List<{Comparable<*> & Number}> but MutableList<Int> was expected
|
||||
// ERROR: Val cannot be reassigned
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
// ERROR: Type mismatch: inferred type is List<{Comparable<{Int & String}> & java.io.Serializable}> but List<String> was expected
|
||||
// ERROR: Type mismatch: inferred type is List<{Comparable<*> & java.io.Serializable}> but List<String> was expected
|
||||
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
|
||||
|
||||
fun test() {
|
||||
|
||||
Generated
+5
@@ -3895,6 +3895,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/constants/long.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberLiteralCoercionToInferredType.kt")
|
||||
public void testNumberLiteralCoercionToInferredType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/numberLiteralCoercionToInferredType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateConst.kt")
|
||||
public void testPrivateConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/privateConst.kt");
|
||||
|
||||
+5
@@ -3895,6 +3895,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/constants/long.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberLiteralCoercionToInferredType.kt")
|
||||
public void testNumberLiteralCoercionToInferredType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/numberLiteralCoercionToInferredType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateConst.kt")
|
||||
public void testPrivateConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/constants/privateConst.kt");
|
||||
|
||||
Reference in New Issue
Block a user