[FIR2IR] Approximate non-denotable types when converting ConeType to IrType

This commit is contained in:
Dmitriy Novozhilov
2021-02-27 15:19:23 +03:00
committed by TeamCityServer
parent c271f953d7
commit da0fd7cc15
31 changed files with 147 additions and 325 deletions
@@ -236,7 +236,8 @@ class ConeRawType(lowerBound: ConeKotlinType, upperBound: ConeKotlinType) : Cone
* only via ConeTypeIntersector
*/
class ConeIntersectionType(
val intersectedTypes: Collection<ConeKotlinType>
val intersectedTypes: Collection<ConeKotlinType>,
val alternativeType: ConeKotlinType? = null,
) : ConeSimpleKotlinType(), IntersectionTypeConstructorMarker {
override val typeArguments: Array<out ConeTypeProjection>
get() = emptyArray()
@@ -266,7 +267,10 @@ class ConeIntersectionType(
if (hashCode != 0) return hashCode
return intersectedTypes.hashCode().also { hashCode = it }
}
}
fun ConeIntersectionType.withAlternative(alternativeType: ConeKotlinType): ConeIntersectionType {
return ConeIntersectionType(intersectedTypes, alternativeType)
}
fun ConeIntersectionType.mapTypes(func: (ConeKotlinType) -> ConeKotlinType): ConeIntersectionType {
@@ -8,8 +8,11 @@ package org.jetbrains.kotlin.fir.backend
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
import org.jetbrains.kotlin.fir.expressions.classId
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.substitution.AbstractConeSubstitutor
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
import org.jetbrains.kotlin.fir.typeContext
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.types.impl.*
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
@@ -20,6 +23,7 @@ import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.types.TypeApproximatorConfiguration
import org.jetbrains.kotlin.types.Variance
class Fir2IrTypeConverter(
@@ -60,6 +64,8 @@ class Fir2IrTypeConverter(
private val capturedTypeCache = mutableMapOf<ConeCapturedType, IrType>()
private val errorTypeForCapturedTypeStub by lazy { createErrorType() }
private val typeApproximator = ConeTypeApproximator(session.typeContext)
fun FirTypeRef.toIrType(typeContext: ConversionTypeContext = ConversionTypeContext.DEFAULT): IrType {
capturedTypeCache.clear()
return when (this) {
@@ -106,9 +112,10 @@ class Fir2IrTypeConverter(
typeAnnotations += callGenerator.convertToIrConstructorCall(attributeAnnotation) as? IrConstructorCall ?: continue
}
val expandedType = fullyExpandedType(session)
val approximatedType = approximateType(expandedType)
IrSimpleTypeImpl(
irSymbol, !typeContext.definitelyNotNull && expandedType.isMarkedNullable,
expandedType.typeArguments.map { it.toIrTypeArgument(typeContext) },
irSymbol, !typeContext.definitelyNotNull && approximatedType.isMarkedNullable,
approximatedType.typeArguments.map { it.toIrTypeArgument(typeContext) },
typeAnnotations
)
}
@@ -211,6 +218,22 @@ class Fir2IrTypeConverter(
private fun getBuiltInClassSymbol(classId: ClassId?): IrClassSymbol? {
return classIdToSymbolMap[classId] ?: getArrayClassSymbol(classId)
}
private fun approximateType(type: ConeKotlinType): ConeKotlinType {
if (type is ConeClassLikeType && type.typeArguments.isEmpty()) return type
val substitutor = object : AbstractConeSubstitutor() {
override fun substituteType(type: ConeKotlinType): ConeKotlinType? {
return if (type is ConeIntersectionType) {
type.alternativeType?.let { substituteOrSelf(it) }
} else null
}
}
val typeWithSpecifiedIntersectionTypes = substitutor.substituteOrSelf(type)
return typeApproximator.approximateToSuperType(
typeWithSpecifiedIntersectionTypes,
TypeApproximatorConfiguration.PublicDeclaration
) ?: type
}
}
fun FirTypeRef.toIrType(
@@ -16616,6 +16616,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
}
@Test
@TestMetadata("intersectionTypeInArguments.kt")
public void testIntersectionTypeInArguments() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@Test
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
@@ -485,7 +485,11 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
firstCandidate: KotlinTypeMarker,
secondCandidate: KotlinTypeMarker
): KotlinTypeMarker {
// TODO
return firstCandidate
require(firstCandidate is ConeKotlinType)
require(secondCandidate is ConeKotlinType)
val intersectionType = firstCandidate.lowerBoundIfFlexible() as? ConeIntersectionType ?: error {
"Expected type is intersection, found $firstCandidate"
}
return intersectionType.withAlternative(secondCandidate)
}
}
@@ -0,0 +1,25 @@
// TARGET_BACKEND: JVM
// WITH_STDLIB
// WITH_REFLECT
import kotlin.reflect.KType
import kotlin.reflect.full.starProjectedType
fun convertPrimitivesArray(type: KType, args: Sequence<String?>): Any? {
val a = when (type.classifier) {
IntArray::class -> args.map { it?.toIntOrNull() }
CharArray::class -> args.map { it?.singleOrNull() }
else -> null
}
val b = a?.toList()
val c = b?.takeUnless { null in it }
val d = c?.toTypedArray()
return d
}
fun box(): String {
val type = CharArray::class.starProjectedType
val sequence = sequenceOf("O", "K")
val array = convertPrimitivesArray(type, sequence) as Array<*>
return array.joinToString("") { it.toString() }
}
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// SAM_CONVERSIONS: CLASS
+1
View File
@@ -3,6 +3,7 @@
// !LANGUAGE: +NewInference
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
// IR_DUMP
import kotlin.collections.toList
@@ -2,13 +2,14 @@ fun test(a: SomeJavaClass<out String>) {
a.someFunction(hello = local fun <anonymous>(it: String?) {
return Unit
}
/*-> Hello<String>? */)
/*-> Hello<String?>? */)
a.plus(hello = local fun <anonymous>(it: String?) {
return Unit
}
/*-> Hello<String>? */)
/*-> Hello<String?>? */)
a.get(hello = local fun <anonymous>(it: String?) {
return Unit
}
/*-> Hello<String>? */)
/*-> Hello<String?>? */)
}
@@ -4,7 +4,7 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
BLOCK_BODY
CALL 'public open fun someFunction (hello: example.Hello<A of example.SomeJavaClass?>?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=null
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
hello: TYPE_OP type=example.Hello<kotlin.String>? origin=SAM_CONVERSION typeOperand=example.Hello<kotlin.String>?
hello: TYPE_OP type=example.Hello<kotlin.String?>? origin=SAM_CONVERSION typeOperand=example.Hello<kotlin.String?>?
FUN_EXPR type=kotlin.Function1<kotlin.String?, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:kotlin.String?
@@ -13,7 +13,7 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
CALL 'public open fun plus (hello: example.Hello<A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=PLUS
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
hello: TYPE_OP type=example.Hello<kotlin.String>? origin=SAM_CONVERSION typeOperand=example.Hello<kotlin.String>?
hello: TYPE_OP type=example.Hello<kotlin.String?>? origin=SAM_CONVERSION typeOperand=example.Hello<kotlin.String?>?
FUN_EXPR type=kotlin.Function1<kotlin.String?, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:kotlin.String?
@@ -22,7 +22,7 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
CALL 'public open fun get (hello: example.Hello<A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=null
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
hello: TYPE_OP type=example.Hello<kotlin.String>? origin=SAM_CONVERSION typeOperand=example.Hello<kotlin.String>?
hello: TYPE_OP type=example.Hello<kotlin.String?>? origin=SAM_CONVERSION typeOperand=example.Hello<kotlin.String?>?
FUN_EXPR type=kotlin.Function1<kotlin.String?, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:kotlin.String?
@@ -41,7 +41,7 @@ interface FirCallableMemberDeclaration<F : FirCallableMemberDeclaration<F>> : Fi
}
fun foo(candidate: Candidate) {
val me: FirSymbolOwner<out FirSymbolOwner<out FirSymbolOwner<out FirSymbolOwner<out FirSymbolOwner<out Any?>>>>> = candidate.<get-symbol>().<get-fir>()
val me: FirSymbolOwner<*> = candidate.<get-symbol>().<get-fir>()
when {
when {
me is FirCallableMemberDeclaration<*> -> EQEQ(arg0 = me /*as FirCallableMemberDeclaration<*> */.<get-symbol>(), arg1 = null).not()
@@ -130,8 +130,8 @@ FILE fqName:<root> fileName:/candidateSymbol.kt
FUN name:foo visibility:public modality:FINAL <> (candidate:<root>.Candidate) returnType:kotlin.Unit
VALUE_PARAMETER name:candidate index:0 type:<root>.Candidate
BLOCK_BODY
VAR name:me type:<root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out kotlin.Any?>>>>> [val]
CALL 'public final fun <get-fir> (): E of <root>.AbstractFirBasedSymbol declared in <root>.AbstractFirBasedSymbol' type=<root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out kotlin.Any?>>>>> origin=GET_PROPERTY
VAR name:me type:<root>.FirSymbolOwner<*> [val]
CALL 'public final fun <get-fir> (): E of <root>.AbstractFirBasedSymbol declared in <root>.AbstractFirBasedSymbol' type=<root>.FirSymbolOwner<*> origin=GET_PROPERTY
$this: CALL 'public final fun <get-symbol> (): <root>.AbstractFirBasedSymbol<*> declared in <root>.Candidate' type=<root>.AbstractFirBasedSymbol<*> origin=GET_PROPERTY
$this: GET_VAR 'candidate: <root>.Candidate declared in <root>.foo' type=<root>.Candidate origin=null
WHEN type=kotlin.Unit origin=IF
@@ -139,12 +139,12 @@ FILE fqName:<root> fileName:/candidateSymbol.kt
if: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.FirCallableMemberDeclaration<*>
GET_VAR 'val me: <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out kotlin.Any?>>>>> [val] declared in <root>.foo' type=<root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out kotlin.Any?>>>>> origin=null
GET_VAR 'val me: <root>.FirSymbolOwner<*> [val] declared in <root>.foo' type=<root>.FirSymbolOwner<*> origin=null
then: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'public abstract fun <get-symbol> (): <root>.AbstractFirBasedSymbol<F of <root>.FirCallableMemberDeclaration> declared in <root>.FirCallableMemberDeclaration' type=<root>.AbstractFirBasedSymbol<out <root>.FirCallableMemberDeclaration<*>> origin=GET_PROPERTY
$this: TYPE_OP type=<root>.FirCallableMemberDeclaration<*> origin=IMPLICIT_CAST typeOperand=<root>.FirCallableMemberDeclaration<*>
GET_VAR 'val me: <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out kotlin.Any?>>>>> [val] declared in <root>.foo' type=<root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out <root>.FirSymbolOwner<out kotlin.Any?>>>>> origin=null
GET_VAR 'val me: <root>.FirSymbolOwner<*> [val] declared in <root>.foo' type=<root>.FirSymbolOwner<*> origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
@@ -16,7 +16,7 @@ abstract class AbstractSymbol<E> where E : Recursive<E>, E : Something {
}
fun foo(list: List<Any>) {
val result: List<AbstractSymbol<out Recursive<*>>> = list.filterIsInstance<Recursive<*>>().map<Recursive<*>, AbstractSymbol<out Recursive<*>>>(transform = Recursive::symbol)
val result: List<AbstractSymbol<*>> = list.filterIsInstance<Recursive<*>>().map<Recursive<*>, AbstractSymbol<*>>(transform = Recursive::symbol)
}
}
@@ -45,14 +45,14 @@ FILE fqName:<root> fileName:/recursiveCapturedTypeInPropertyReference.kt
$this: VALUE_PARAMETER name:<this> type:<root>.AbstractSymbol<E of <root>.AbstractSymbol>
VALUE_PARAMETER name:list index:0 type:kotlin.collections.List<kotlin.Any>
BLOCK_BODY
VAR name:result type:kotlin.collections.List<<root>.AbstractSymbol<out <root>.Recursive<*>>> [val]
CALL 'public final fun map <T, R> (transform: kotlin.Function1<T of kotlin.collections.CollectionsKt.map, R of kotlin.collections.CollectionsKt.map>): kotlin.collections.List<R of kotlin.collections.CollectionsKt.map> [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<<root>.AbstractSymbol<out <root>.Recursive<*>>> origin=null
VAR name:result type:kotlin.collections.List<<root>.AbstractSymbol<*>> [val]
CALL 'public final fun map <T, R> (transform: kotlin.Function1<T of kotlin.collections.CollectionsKt.map, R of kotlin.collections.CollectionsKt.map>): kotlin.collections.List<R of kotlin.collections.CollectionsKt.map> [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<<root>.AbstractSymbol<*>> origin=null
<T>: <root>.Recursive<*>
<R>: <root>.AbstractSymbol<out <root>.Recursive<*>>
<R>: <root>.AbstractSymbol<*>
$receiver: CALL 'public final fun filterIsInstance <R> (): kotlin.collections.List<R of kotlin.collections.CollectionsKt.filterIsInstance> [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<<root>.Recursive<*>> origin=null
<R>: <root>.Recursive<*>
$receiver: GET_VAR 'list: kotlin.collections.List<kotlin.Any> declared in <root>.AbstractSymbol.foo' type=kotlin.collections.List<kotlin.Any> origin=null
transform: PROPERTY_REFERENCE 'public abstract symbol: <root>.AbstractSymbol<R of <root>.Recursive> [val]' field=null getter='public abstract fun <get-symbol> (): <root>.AbstractSymbol<R of <root>.Recursive> declared in <root>.Recursive' setter=null type=kotlin.reflect.KProperty1<<root>.Recursive<*>, <root>.AbstractSymbol<<root>.Recursive<*>>> origin=null
transform: PROPERTY_REFERENCE 'public abstract symbol: <root>.AbstractSymbol<R of <root>.Recursive> [val]' field=null getter='public abstract fun <get-symbol> (): <root>.AbstractSymbol<R of <root>.Recursive> declared in <root>.Recursive' setter=null type=kotlin.reflect.KProperty1<<root>.Recursive<*>, <root>.AbstractSymbol<out kotlin.Any>> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
@@ -1,7 +1,7 @@
@OptIn(markerClass = [ExperimentalTypeInference::class])
fun <R : Any?> scopedFlow(@BuilderInference block: @ExtensionFunctionType SuspendFunction2<CoroutineScope, FlowCollector<R>, Unit>): Flow<R> {
return flow<R>(block = local suspend fun FlowCollector<R>.<anonymous>() {
val collector: FlowCollector<ErrorType> = <this>
val collector: FlowCollector<Nothing> = <this>
flowScope<Unit>(block = local suspend fun CoroutineScope.<anonymous>() {
block.invoke(p1 = <this>, p2 = collector)
}
@@ -12,7 +12,7 @@ fun <R : Any?> scopedFlow(@BuilderInference block: @ExtensionFunctionType Suspen
fun <T : Any?> Flow<T>.onCompletion(action: @ExtensionFunctionType SuspendFunction2<FlowCollector<T>, Throwable?, Unit>): Flow<T> {
return unsafeFlow<T>(block = local suspend fun FlowCollector<T>.<anonymous>() {
val safeCollector: SafeCollector<ErrorType> = SafeCollector<T>(collector = <this>)
val safeCollector: SafeCollector<Any?> = SafeCollector<T>(collector = <this>)
safeCollector.invokeSafely<T>(action = action)
}
)
@@ -14,8 +14,8 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.FlowCollector<R of <root>.scopedFlow>) returnType:kotlin.Unit [suspend]
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<R of <root>.scopedFlow>
BLOCK_BODY
VAR name:collector type:<root>.FlowCollector<IrErrorType> [val]
GET_VAR '<this>: <root>.FlowCollector<R of <root>.scopedFlow> declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<IrErrorType> origin=null
VAR name:collector type:<root>.FlowCollector<kotlin.Nothing> [val]
GET_VAR '<this>: <root>.FlowCollector<R of <root>.scopedFlow> declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<kotlin.Nothing> origin=null
CALL 'public final fun flowScope <R> (block: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.CoroutineScope, R of <root>.flowScope>): R of <root>.flowScope [suspend] declared in <root>' type=kotlin.Unit origin=null
<R>: kotlin.Unit
block: FUN_EXPR type=kotlin.coroutines.SuspendFunction1<<root>.CoroutineScope, kotlin.Unit> origin=LAMBDA
@@ -25,7 +25,7 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
CALL 'public abstract fun invoke (p1: P1 of kotlin.coroutines.SuspendFunction2, p2: P2 of kotlin.coroutines.SuspendFunction2): R of kotlin.coroutines.SuspendFunction2 [suspend,operator] declared in kotlin.coroutines.SuspendFunction2' type=kotlin.Unit origin=null
$this: GET_VAR 'block: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> declared in <root>.scopedFlow' type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> origin=VARIABLE_AS_FUNCTION
p1: GET_VAR '<this>: <root>.CoroutineScope declared in <root>.scopedFlow.<anonymous>.<anonymous>' type=<root>.CoroutineScope origin=null
p2: GET_VAR 'val collector: <root>.FlowCollector<IrErrorType> [val] declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
p2: GET_VAR 'val collector: <root>.FlowCollector<kotlin.Nothing> [val] declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
FUN name:onCompletion visibility:public modality:FINAL <T> ($receiver:<root>.Flow<T of <root>.onCompletion>, action:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit>) returnType:<root>.Flow<T of <root>.onCompletion>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.Flow<T of <root>.onCompletion>
@@ -38,13 +38,13 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.FlowCollector<T of <root>.onCompletion>) returnType:kotlin.Unit [suspend]
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<T of <root>.onCompletion>
BLOCK_BODY
VAR name:safeCollector type:<root>.SafeCollector<IrErrorType> [val]
VAR name:safeCollector type:<root>.SafeCollector<kotlin.Any?> [val]
CONSTRUCTOR_CALL 'public constructor <init> (collector: <root>.FlowCollector<T of <root>.SafeCollector>) [primary] declared in <root>.SafeCollector' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
<class: T>: T of <root>.onCompletion
collector: GET_VAR '<this>: <root>.FlowCollector<T of <root>.onCompletion> declared in <root>.onCompletion.<anonymous>' type=<root>.FlowCollector<T of <root>.onCompletion> origin=null
CALL 'public final fun invokeSafely <T> (action: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.invokeSafely>, kotlin.Throwable?, kotlin.Unit>): kotlin.Unit [suspend] declared in <root>' type=kotlin.Unit origin=null
<T>: T of <root>.onCompletion
$receiver: GET_VAR 'val safeCollector: <root>.SafeCollector<IrErrorType> [val] declared in <root>.onCompletion.<anonymous>' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
$receiver: GET_VAR 'val safeCollector: <root>.SafeCollector<kotlin.Any?> [val] declared in <root>.onCompletion.<anonymous>' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
action: GET_VAR 'action: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit> declared in <root>.onCompletion' type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit> origin=null
FUN name:invokeSafely visibility:public modality:FINAL <T> ($receiver:<root>.FlowCollector<T of <root>.invokeSafely>, action:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.invokeSafely>, kotlin.Throwable?, kotlin.Unit>) returnType:kotlin.Unit [suspend]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
@@ -90,8 +90,8 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
BLOCK_BODY
VAR name:channel type:<root>.ChannelCoroutine<kotlin.Any> [val]
TYPE_OP type=<root>.ChannelCoroutine<kotlin.Any> origin=CAST typeOperand=<root>.ChannelCoroutine<kotlin.Any>
CALL 'public abstract fun <get-channel> (): <root>.SendChannel<E of <root>.ProducerScope> declared in <root>.ProducerScope' type=<root>.SendChannel<IrErrorType> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ProducerScope<kotlin.Any> declared in <root>.asFairChannel.<anonymous>' type=<root>.ProducerScope<IrErrorType> origin=null
CALL 'public abstract fun <get-channel> (): <root>.SendChannel<E of <root>.ProducerScope> declared in <root>.ProducerScope' type=<root>.SendChannel<kotlin.Nothing> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ProducerScope<kotlin.Any> declared in <root>.asFairChannel.<anonymous>' type=<root>.ProducerScope<kotlin.Nothing> origin=null
CALL 'public final fun collect <T> (action: kotlin.coroutines.SuspendFunction1<T of <root>.collect, kotlin.Unit>): kotlin.Unit [inline,suspend] declared in <root>' type=kotlin.Unit origin=null
<T>: kotlin.Any?
$receiver: GET_VAR 'flow: <root>.Flow<*> declared in <root>.asFairChannel' type=<root>.Flow<*> origin=null
@@ -76,7 +76,7 @@ FILE fqName:<root> fileName:/genericFunWithStar.kt
VALUE_PARAMETER name:serializers index:0 type:kotlin.Array<out <root>.I<*>> varargElementType:<root>.I<*> [vararg]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun bar (vararg serializers: <root>.I<*>): <root>.I<*> declared in <root>.Box'
CALL 'public abstract fun foo <F> (tSerializer: <root>.I<F of <root>.Box.foo>): <root>.I<<root>.Box<F of <root>.Box.foo>> declared in <root>.Box' type=<root>.I<out <root>.Box<out <root>.IFoo>> origin=null
CALL 'public abstract fun foo <F> (tSerializer: <root>.I<F of <root>.Box.foo>): <root>.I<<root>.Box<F of <root>.Box.foo>> declared in <root>.Box' type=<root>.I<out <root>.Box<*>> origin=null
<F>: <root>.IFoo
$this: GET_VAR '<this>: <root>.Box<T of <root>.Box> declared in <root>.Box.bar' type=<root>.Box<T of <root>.Box> origin=null
tSerializer: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.I<*> origin=null
@@ -12,7 +12,7 @@ fun <S : Any?> select(x: S, y: S): S {
}
fun <T : Any?> foo(a: Array<In<T>>, b: Array<In<String>>): Boolean {
return select<Array<out In<T>>>(x = a, y = b).get(index = 0).ofType<Any?>(y = true)
return select<Array<out In<Nothing>>>(x = a, y = b).get(index = 0).ofType<Any?>(y = true)
}
inline fun <reified K : Any?> In<K>.ofType(y: Any?): Boolean {
@@ -24,3 +24,4 @@ fun test() {
val a2: Array<In<String>> = arrayOf<In<String>>(elements = [In<String>()])
foo<Int>(a = a1, b = a2) /*~> Unit */
}
@@ -34,9 +34,9 @@ FILE fqName:<root> fileName:/intersectionType1_NI.kt
RETURN type=kotlin.Nothing from='public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>'
CALL 'public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<K>: kotlin.Any?
$receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.In<T of <root>.foo> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<T of <root>.foo>> origin=null
<S>: kotlin.Array<out <root>.In<T of <root>.foo>>
$receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.In<kotlin.Nothing> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<kotlin.Nothing>> origin=null
<S>: kotlin.Array<out <root>.In<kotlin.Nothing>>
x: GET_VAR 'a: kotlin.Array<<root>.In<T of <root>.foo>> declared in <root>.foo' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
y: GET_VAR 'b: kotlin.Array<<root>.In<kotlin.String>> declared in <root>.foo' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
index: CONST Int type=kotlin.Int value=0
@@ -12,7 +12,7 @@ fun <S : Any?> select(x: S, y: S): S {
}
fun <T : Any?> foo(a: Array<In<T>>, b: Array<In<String>>): Boolean {
return select<Array<out In<T>>>(x = a, y = b).get(index = 0).ofType<Any?>(y = true)
return select<Array<out In<Nothing>>>(x = a, y = b).get(index = 0).ofType<Any?>(y = true)
}
inline fun <reified K : Any?> In<K>.ofType(y: Any?): Boolean {
@@ -34,9 +34,9 @@ FILE fqName:<root> fileName:/intersectionType1_OI.kt
RETURN type=kotlin.Nothing from='public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>'
CALL 'public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<K>: kotlin.Any?
$receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.In<T of <root>.foo> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<T of <root>.foo>> origin=null
<S>: kotlin.Array<out <root>.In<T of <root>.foo>>
$receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.In<kotlin.Nothing> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<kotlin.Nothing>> origin=null
<S>: kotlin.Array<out <root>.In<kotlin.Nothing>>
x: GET_VAR 'a: kotlin.Array<<root>.In<T of <root>.foo>> declared in <root>.foo' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
y: GET_VAR 'b: kotlin.Array<<root>.In<kotlin.String>> declared in <root>.foo' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
index: CONST Int type=kotlin.Int value=0
@@ -86,7 +86,7 @@ FILE fqName:<root> fileName:/intersectionType2_NI.kt
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any declared in <root>'
CALL 'public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>' type=<root>.Foo origin=null
<T>: <root>.Foo
fn: FUN_EXPR type=kotlin.Function0<<root>.Foo> origin=LAMBDA
fn: FUN_EXPR type=kotlin.Function0<kotlin.Any> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.Foo
BLOCK_BODY
VAR name:mm type:<root>.B [val]
@@ -86,7 +86,7 @@ FILE fqName:<root> fileName:/intersectionType2_OI.kt
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any declared in <root>'
CALL 'public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>' type=<root>.Foo origin=null
<T>: <root>.Foo
fn: FUN_EXPR type=kotlin.Function0<<root>.Foo> origin=LAMBDA
fn: FUN_EXPR type=kotlin.Function0<kotlin.Any> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.Foo
BLOCK_BODY
VAR name:mm type:<root>.B [val]
@@ -1,63 +0,0 @@
interface In<in T : Any?> {
}
inline fun <reified T : Any?> In<T>.isT(): Boolean {
return <this> is T
}
inline fun <reified T : Any?> In<T>.asT() {
<this> as T /*~> Unit */
}
fun <S : Any?> sel(x: S, y: S): S {
return x
}
interface A {
}
interface B {
}
interface A1 : A {
}
interface A2 : A {
}
interface Z1 : A, B {
}
interface Z2 : A, B {
}
fun testInIs1(x: In<A>, y: In<B>): Boolean {
return sel<In<A>>(x = x, y = y).isT<Any>()
}
fun testInIs2(x: In<Z1>, y: In<Z2>): Boolean {
return sel<In<Z1>>(x = x, y = y).isT<Any>()
}
fun testInIs3(x: In<A1>, y: In<A2>): Boolean {
return sel<In<A1>>(x = x, y = y).isT<A>()
}
fun testInAs1(x: In<A>, y: In<B>) {
return sel<In<A>>(x = x, y = y).asT<Any>()
}
fun testInAs2(x: In<Z1>, y: In<Z2>) {
return sel<In<Z1>>(x = x, y = y).asT<Any>()
}
fun testInAs3(x: In<A1>, y: In<A2>) {
return sel<In<A1>>(x = x, y = y).asT<A>()
}
@@ -1,200 +0,0 @@
FILE fqName:<root> fileName:/intersectionType3_NI.kt
CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<T of <root>.In>
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:isT visibility:public modality:FINAL <T> ($receiver:<root>.In<T of <root>.isT>) returnType:kotlin.Boolean [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<T of <root>.isT>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>'
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of <root>.isT
GET_VAR '<this>: <root>.In<T of <root>.isT> declared in <root>.isT' type=<root>.In<T of <root>.isT> origin=null
FUN name:asT visibility:public modality:FINAL <T> ($receiver:<root>.In<T of <root>.asT>) returnType:kotlin.Unit [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<T of <root>.asT>
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TYPE_OP type=T of <root>.asT origin=CAST typeOperand=T of <root>.asT
GET_VAR '<this>: <root>.In<T of <root>.asT> declared in <root>.asT' type=<root>.In<T of <root>.asT> origin=null
FUN name:sel visibility:public modality:FINAL <S> (x:S of <root>.sel, y:S of <root>.sel) returnType:S of <root>.sel
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:x index:0 type:S of <root>.sel
VALUE_PARAMETER name:y index:1 type:S of <root>.sel
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>'
GET_VAR 'x: S of <root>.sel declared in <root>.sel' type=S of <root>.sel origin=null
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:A1 modality:ABSTRACT visibility:public superTypes:[<root>.A]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A1
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:A2 modality:ABSTRACT visibility:public superTypes:[<root>.A]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A2
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:Z1 modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.B]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z1
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
public open fun toString (): kotlin.String [fake_override] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:Z2 modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.B]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z2
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
public open fun toString (): kotlin.String [fake_override] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:testInIs1 visibility:public modality:FINAL <> (x:<root>.In<<root>.A>, y:<root>.In<<root>.B>) returnType:kotlin.Boolean
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A>
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.B>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testInIs1 (x: <root>.In<<root>.A>, y: <root>.In<<root>.B>): kotlin.Boolean declared in <root>'
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<T>: kotlin.Any
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A> origin=null
<S>: <root>.In<<root>.A>
x: GET_VAR 'x: <root>.In<<root>.A> declared in <root>.testInIs1' type=<root>.In<<root>.A> origin=null
y: GET_VAR 'y: <root>.In<<root>.B> declared in <root>.testInIs1' type=<root>.In<<root>.B> origin=null
FUN name:testInIs2 visibility:public modality:FINAL <> (x:<root>.In<<root>.Z1>, y:<root>.In<<root>.Z2>) returnType:kotlin.Boolean
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.Z1>
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.Z2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testInIs2 (x: <root>.In<<root>.Z1>, y: <root>.In<<root>.Z2>): kotlin.Boolean declared in <root>'
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<T>: kotlin.Any
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.Z1> origin=null
<S>: <root>.In<<root>.Z1>
x: GET_VAR 'x: <root>.In<<root>.Z1> declared in <root>.testInIs2' type=<root>.In<<root>.Z1> origin=null
y: GET_VAR 'y: <root>.In<<root>.Z2> declared in <root>.testInIs2' type=<root>.In<<root>.Z2> origin=null
FUN name:testInIs3 visibility:public modality:FINAL <> (x:<root>.In<<root>.A1>, y:<root>.In<<root>.A2>) returnType:kotlin.Boolean
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A1>
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.A2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testInIs3 (x: <root>.In<<root>.A1>, y: <root>.In<<root>.A2>): kotlin.Boolean declared in <root>'
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<T>: <root>.A
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A1> origin=null
<S>: <root>.In<<root>.A1>
x: GET_VAR 'x: <root>.In<<root>.A1> declared in <root>.testInIs3' type=<root>.In<<root>.A1> origin=null
y: GET_VAR 'y: <root>.In<<root>.A2> declared in <root>.testInIs3' type=<root>.In<<root>.A2> origin=null
FUN name:testInAs1 visibility:public modality:FINAL <> (x:<root>.In<<root>.A>, y:<root>.In<<root>.B>) returnType:kotlin.Unit
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A>
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.B>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testInAs1 (x: <root>.In<<root>.A>, y: <root>.In<<root>.B>): kotlin.Unit declared in <root>'
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
<T>: kotlin.Any
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A> origin=null
<S>: <root>.In<<root>.A>
x: GET_VAR 'x: <root>.In<<root>.A> declared in <root>.testInAs1' type=<root>.In<<root>.A> origin=null
y: GET_VAR 'y: <root>.In<<root>.B> declared in <root>.testInAs1' type=<root>.In<<root>.B> origin=null
FUN name:testInAs2 visibility:public modality:FINAL <> (x:<root>.In<<root>.Z1>, y:<root>.In<<root>.Z2>) returnType:kotlin.Unit
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.Z1>
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.Z2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testInAs2 (x: <root>.In<<root>.Z1>, y: <root>.In<<root>.Z2>): kotlin.Unit declared in <root>'
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
<T>: kotlin.Any
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.Z1> origin=null
<S>: <root>.In<<root>.Z1>
x: GET_VAR 'x: <root>.In<<root>.Z1> declared in <root>.testInAs2' type=<root>.In<<root>.Z1> origin=null
y: GET_VAR 'y: <root>.In<<root>.Z2> declared in <root>.testInAs2' type=<root>.In<<root>.Z2> origin=null
FUN name:testInAs3 visibility:public modality:FINAL <> (x:<root>.In<<root>.A1>, y:<root>.In<<root>.A2>) returnType:kotlin.Unit
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A1>
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.A2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testInAs3 (x: <root>.In<<root>.A1>, y: <root>.In<<root>.A2>): kotlin.Unit declared in <root>'
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
<T>: <root>.A
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A1> origin=null
<S>: <root>.In<<root>.A1>
x: GET_VAR 'x: <root>.In<<root>.A1> declared in <root>.testInAs3' type=<root>.In<<root>.A1> origin=null
y: GET_VAR 'y: <root>.In<<root>.A2> declared in <root>.testInAs3' type=<root>.In<<root>.A2> origin=null
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
interface In<in T>
@@ -39,25 +39,26 @@ interface Z2 : A, B {
}
fun testInIs1(x: In<A>, y: In<B>): Boolean {
return sel<In<A>>(x = x, y = y).isT<Any>()
return sel<In<Nothing>>(x = x, y = y).isT<Any>()
}
fun testInIs2(x: In<Z1>, y: In<Z2>): Boolean {
return sel<In<Z1>>(x = x, y = y).isT<Any>()
return sel<In<Nothing>>(x = x, y = y).isT<Any>()
}
fun testInIs3(x: In<A1>, y: In<A2>): Boolean {
return sel<In<A1>>(x = x, y = y).isT<A>()
return sel<In<Nothing>>(x = x, y = y).isT<A>()
}
fun testInAs1(x: In<A>, y: In<B>) {
return sel<In<A>>(x = x, y = y).asT<Any>()
return sel<In<Nothing>>(x = x, y = y).asT<Any>()
}
fun testInAs2(x: In<Z1>, y: In<Z2>) {
return sel<In<Z1>>(x = x, y = y).asT<Any>()
return sel<In<Nothing>>(x = x, y = y).asT<Any>()
}
fun testInAs3(x: In<A1>, y: In<A2>) {
return sel<In<A1>>(x = x, y = y).asT<A>()
return sel<In<Nothing>>(x = x, y = y).asT<A>()
}
@@ -139,8 +139,8 @@ FILE fqName:<root> fileName:/intersectionType3_OI.kt
RETURN type=kotlin.Nothing from='public final fun testInIs1 (x: <root>.In<<root>.A>, y: <root>.In<<root>.B>): kotlin.Boolean declared in <root>'
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<T>: kotlin.Any
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A> origin=null
<S>: <root>.In<<root>.A>
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
<S>: <root>.In<kotlin.Nothing>
x: GET_VAR 'x: <root>.In<<root>.A> declared in <root>.testInIs1' type=<root>.In<<root>.A> origin=null
y: GET_VAR 'y: <root>.In<<root>.B> declared in <root>.testInIs1' type=<root>.In<<root>.B> origin=null
FUN name:testInIs2 visibility:public modality:FINAL <> (x:<root>.In<<root>.Z1>, y:<root>.In<<root>.Z2>) returnType:kotlin.Boolean
@@ -150,8 +150,8 @@ FILE fqName:<root> fileName:/intersectionType3_OI.kt
RETURN type=kotlin.Nothing from='public final fun testInIs2 (x: <root>.In<<root>.Z1>, y: <root>.In<<root>.Z2>): kotlin.Boolean declared in <root>'
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<T>: kotlin.Any
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.Z1> origin=null
<S>: <root>.In<<root>.Z1>
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
<S>: <root>.In<kotlin.Nothing>
x: GET_VAR 'x: <root>.In<<root>.Z1> declared in <root>.testInIs2' type=<root>.In<<root>.Z1> origin=null
y: GET_VAR 'y: <root>.In<<root>.Z2> declared in <root>.testInIs2' type=<root>.In<<root>.Z2> origin=null
FUN name:testInIs3 visibility:public modality:FINAL <> (x:<root>.In<<root>.A1>, y:<root>.In<<root>.A2>) returnType:kotlin.Boolean
@@ -161,8 +161,8 @@ FILE fqName:<root> fileName:/intersectionType3_OI.kt
RETURN type=kotlin.Nothing from='public final fun testInIs3 (x: <root>.In<<root>.A1>, y: <root>.In<<root>.A2>): kotlin.Boolean declared in <root>'
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<T>: <root>.A
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A1> origin=null
<S>: <root>.In<<root>.A1>
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
<S>: <root>.In<kotlin.Nothing>
x: GET_VAR 'x: <root>.In<<root>.A1> declared in <root>.testInIs3' type=<root>.In<<root>.A1> origin=null
y: GET_VAR 'y: <root>.In<<root>.A2> declared in <root>.testInIs3' type=<root>.In<<root>.A2> origin=null
FUN name:testInAs1 visibility:public modality:FINAL <> (x:<root>.In<<root>.A>, y:<root>.In<<root>.B>) returnType:kotlin.Unit
@@ -172,8 +172,8 @@ FILE fqName:<root> fileName:/intersectionType3_OI.kt
RETURN type=kotlin.Nothing from='public final fun testInAs1 (x: <root>.In<<root>.A>, y: <root>.In<<root>.B>): kotlin.Unit declared in <root>'
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
<T>: kotlin.Any
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A> origin=null
<S>: <root>.In<<root>.A>
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
<S>: <root>.In<kotlin.Nothing>
x: GET_VAR 'x: <root>.In<<root>.A> declared in <root>.testInAs1' type=<root>.In<<root>.A> origin=null
y: GET_VAR 'y: <root>.In<<root>.B> declared in <root>.testInAs1' type=<root>.In<<root>.B> origin=null
FUN name:testInAs2 visibility:public modality:FINAL <> (x:<root>.In<<root>.Z1>, y:<root>.In<<root>.Z2>) returnType:kotlin.Unit
@@ -183,8 +183,8 @@ FILE fqName:<root> fileName:/intersectionType3_OI.kt
RETURN type=kotlin.Nothing from='public final fun testInAs2 (x: <root>.In<<root>.Z1>, y: <root>.In<<root>.Z2>): kotlin.Unit declared in <root>'
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
<T>: kotlin.Any
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.Z1> origin=null
<S>: <root>.In<<root>.Z1>
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
<S>: <root>.In<kotlin.Nothing>
x: GET_VAR 'x: <root>.In<<root>.Z1> declared in <root>.testInAs2' type=<root>.In<<root>.Z1> origin=null
y: GET_VAR 'y: <root>.In<<root>.Z2> declared in <root>.testInAs2' type=<root>.In<<root>.Z2> origin=null
FUN name:testInAs3 visibility:public modality:FINAL <> (x:<root>.In<<root>.A1>, y:<root>.In<<root>.A2>) returnType:kotlin.Unit
@@ -194,7 +194,7 @@ FILE fqName:<root> fileName:/intersectionType3_OI.kt
RETURN type=kotlin.Nothing from='public final fun testInAs3 (x: <root>.In<<root>.A1>, y: <root>.In<<root>.A2>): kotlin.Unit declared in <root>'
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
<T>: <root>.A
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A1> origin=null
<S>: <root>.In<<root>.A1>
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
<S>: <root>.In<kotlin.Nothing>
x: GET_VAR 'x: <root>.In<<root>.A1> declared in <root>.testInAs3' type=<root>.In<<root>.A1> origin=null
y: GET_VAR 'y: <root>.In<<root>.A2> declared in <root>.testInAs3' type=<root>.In<<root>.A2> origin=null
@@ -96,7 +96,7 @@ FILE fqName:<root> fileName:/localVariableOfIntersectionType_NI.kt
BLOCK_BODY
CALL 'public abstract fun foo (): kotlin.Unit declared in <root>.IA' type=kotlin.Unit origin=null
$this: CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<<root>.IA> origin=null
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<out kotlin.Any> origin=null
<T>: <root>.IA
$this: GET_VAR 'z: <root>.Z declared in <root>.test' type=<root>.Z origin=null
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
@@ -104,14 +104,14 @@ FILE fqName:<root> fileName:/localVariableOfIntersectionType_NI.kt
CALL 'public abstract fun bar (): kotlin.Unit declared in <root>.IB' type=kotlin.Unit origin=null
$this: TYPE_OP type=<root>.IB origin=IMPLICIT_CAST typeOperand=<root>.IB
CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<<root>.IA> origin=null
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<out kotlin.Any> origin=null
<T>: <root>.IA
$this: GET_VAR 'z: <root>.Z declared in <root>.test' type=<root>.Z origin=null
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
y: GET_VAR 'b: <root>.In<<root>.IB> declared in <root>.test' type=<root>.In<<root>.IB> origin=null
VAR name:t type:<root>.IA [val]
CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<<root>.IA> origin=null
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<out kotlin.Any> origin=null
<T>: <root>.IA
$this: GET_VAR 'z: <root>.Z declared in <root>.test' type=<root>.Z origin=null
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
@@ -16616,6 +16616,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
}
@Test
@TestMetadata("intersectionTypeInArguments.kt")
public void testIntersectionTypeInArguments() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@Test
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
@@ -16616,6 +16616,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
}
@Test
@TestMetadata("intersectionTypeInArguments.kt")
public void testIntersectionTypeInArguments() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@Test
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
@@ -13790,6 +13790,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
}
@TestMetadata("intersectionTypeInArguments.kt")
public void testIntersectionTypeInArguments() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt10822.kt");