psi2ir: ersatz type approximation for intersection types
Emulate old JVM back-end behavior for intersection type mapping. IrType renderer should render the IR type, not the original Kotlin type.
This commit is contained in:
@@ -22,12 +22,15 @@ import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.types.impl.originalKotlinType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.renderer.ClassifierNamePolicy
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRendererModifier
|
||||
import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
|
||||
fun IrElement.render() = accept(RenderIrElementVisitor(), null)
|
||||
@@ -351,38 +354,84 @@ class RenderIrElementVisitor : IrElementVisitor<String, Nothing?> {
|
||||
|
||||
override fun visitErrorCallExpression(expression: IrErrorCallExpression, data: Nothing?): String =
|
||||
"ERROR_CALL '${expression.description}' type=${expression.type.render()}"
|
||||
}
|
||||
|
||||
companion object {
|
||||
val DECLARATION_RENDERER = DescriptorRenderer.withOptions {
|
||||
withDefinedIn = false
|
||||
overrideRenderingPolicy = OverrideRenderingPolicy.RENDER_OPEN_OVERRIDE
|
||||
includePropertyConstant = true
|
||||
classifierNamePolicy = ClassifierNamePolicy.FULLY_QUALIFIED
|
||||
verbose = false
|
||||
modifiers = DescriptorRendererModifier.ALL
|
||||
private val DECLARATION_RENDERER = DescriptorRenderer.withOptions {
|
||||
withDefinedIn = false
|
||||
overrideRenderingPolicy = OverrideRenderingPolicy.RENDER_OPEN_OVERRIDE
|
||||
includePropertyConstant = true
|
||||
classifierNamePolicy = ClassifierNamePolicy.FULLY_QUALIFIED
|
||||
verbose = false
|
||||
modifiers = DescriptorRendererModifier.ALL
|
||||
}
|
||||
|
||||
private val REFERENCE_RENDERER = DescriptorRenderer.ONLY_NAMES_WITH_SHORT_TYPES
|
||||
|
||||
internal fun IrDeclaration.name(): String =
|
||||
descriptor.name.toString()
|
||||
|
||||
internal fun DescriptorRenderer.renderDescriptor(descriptor: DeclarationDescriptor): String =
|
||||
if (descriptor is ReceiverParameterDescriptor)
|
||||
"this@${descriptor.containingDeclaration.name}: ${descriptor.type}"
|
||||
else
|
||||
render(descriptor)
|
||||
|
||||
internal fun IrDeclaration.renderDeclared(): String =
|
||||
DECLARATION_RENDERER.renderDescriptor(this.descriptor)
|
||||
|
||||
internal fun DeclarationDescriptor.ref(): String =
|
||||
REFERENCE_RENDERER.renderDescriptor(this.original)
|
||||
|
||||
internal fun KotlinType.render(): String =
|
||||
DECLARATION_RENDERER.renderType(this)
|
||||
|
||||
internal fun IrDeclaration.renderOriginIfNonTrivial(): String =
|
||||
if (origin != IrDeclarationOrigin.DEFINED) origin.toString() + " " else ""
|
||||
|
||||
internal fun IrType.renderTypeInner(): String =
|
||||
when (this) {
|
||||
is IrDynamicType -> "dynamic"
|
||||
|
||||
is IrErrorType -> "ERROR"
|
||||
|
||||
is IrSimpleType -> buildString {
|
||||
append(DECLARATION_RENDERER.renderClassifierName(classifier.descriptor)) // TODO get rid of descriptors
|
||||
if (arguments.isNotEmpty()) {
|
||||
append(
|
||||
arguments.joinToString(prefix = "<", postfix = ">", separator = ", ") {
|
||||
it.renderTypeArgument()
|
||||
}
|
||||
)
|
||||
}
|
||||
if (hasQuestionMark) {
|
||||
append('?')
|
||||
}
|
||||
}
|
||||
|
||||
val REFERENCE_RENDERER = DescriptorRenderer.ONLY_NAMES_WITH_SHORT_TYPES
|
||||
|
||||
internal fun IrDeclaration.name(): String =
|
||||
descriptor.name.toString()
|
||||
|
||||
internal fun DescriptorRenderer.renderDescriptor(descriptor: DeclarationDescriptor): String =
|
||||
if (descriptor is ReceiverParameterDescriptor)
|
||||
"this@${descriptor.containingDeclaration.name}: ${descriptor.type}"
|
||||
else
|
||||
render(descriptor)
|
||||
|
||||
internal fun IrDeclaration.renderDeclared(): String =
|
||||
DECLARATION_RENDERER.renderDescriptor(this.descriptor)
|
||||
|
||||
internal fun DeclarationDescriptor.ref(): String =
|
||||
REFERENCE_RENDERER.renderDescriptor(this.original)
|
||||
|
||||
internal fun KotlinType.render(): String =
|
||||
DECLARATION_RENDERER.renderType(this)
|
||||
|
||||
internal fun IrDeclaration.renderOriginIfNonTrivial(): String =
|
||||
if (origin != IrDeclarationOrigin.DEFINED) origin.toString() + " " else ""
|
||||
else ->
|
||||
originalKotlinType?.let {
|
||||
DECLARATION_RENDERER.renderType(it)
|
||||
} ?: "IrType without originalKotlinType: $this"
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrTypeArgument.renderTypeArgument(): String =
|
||||
when (this) {
|
||||
is IrStarProjection -> "*"
|
||||
|
||||
is IrTypeProjection -> buildString {
|
||||
append(variance.label)
|
||||
if (variance != Variance.INVARIANT) append(' ')
|
||||
append(type.render())
|
||||
}
|
||||
|
||||
else -> "IrTypeArgument[$this]"
|
||||
}
|
||||
|
||||
internal fun renderTypeAnnotations(annotations: List<IrCall>) =
|
||||
if (annotations.isEmpty())
|
||||
""
|
||||
else
|
||||
annotations.joinToString(prefix = "", postfix = " ", separator = " ") { "@[${it.render()}]" }
|
||||
|
||||
fun IrType.render() = "${renderTypeAnnotations(annotations)}${renderTypeInner()}"
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.util
|
||||
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.impl.originalKotlinType
|
||||
|
||||
fun IrType.render() =
|
||||
originalKotlinType?.let {
|
||||
RenderIrElementVisitor.DECLARATION_RENDERER.renderType(it)
|
||||
} ?: "IrType without originalKotlinType: $this"
|
||||
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections
|
||||
import org.jetbrains.kotlin.types.typesApproximation.approximateCapturedTypes
|
||||
|
||||
class TypeTranslator(
|
||||
@@ -33,14 +34,14 @@ class TypeTranslator(
|
||||
|
||||
fun enterScope(irElement: IrTypeParametersContainer) {
|
||||
typeParametersResolver.enterTypeParameterScope(irElement)
|
||||
if(enterTableScope) {
|
||||
if (enterTableScope) {
|
||||
symbolTable.enterScope(irElement.descriptor)
|
||||
}
|
||||
}
|
||||
|
||||
fun leaveScope(irElement: IrTypeParametersContainer) {
|
||||
typeParametersResolver.leaveTypeParameterScope()
|
||||
if(enterTableScope) {
|
||||
if (enterTableScope) {
|
||||
symbolTable.leaveScope(irElement.descriptor)
|
||||
}
|
||||
}
|
||||
@@ -54,43 +55,45 @@ class TypeTranslator(
|
||||
|
||||
private fun resolveTypeParameter(typeParameterDescriptor: TypeParameterDescriptor) =
|
||||
typeParametersResolver.resolveScopedTypeParameter(typeParameterDescriptor)
|
||||
?: symbolTable.referenceTypeParameter(typeParameterDescriptor)
|
||||
?: symbolTable.referenceTypeParameter(typeParameterDescriptor)
|
||||
|
||||
fun translateType(ktType: KotlinType): IrType =
|
||||
translateType(ktType, Variance.INVARIANT).type
|
||||
|
||||
private fun translateType(ktType0: KotlinType, variance: Variance): IrTypeProjection {
|
||||
// TODO "old" JVM BE does this for reified type arguments. Is it ok for arbitrary subexpressions?
|
||||
|
||||
val ktTypeUpper = ktType0.approximate(languageVersionSettings)
|
||||
private fun translateType(ktType: KotlinType, variance: Variance): IrTypeProjection {
|
||||
val approximatedType = LegacyTypeApproximation().approximate(ktType)
|
||||
|
||||
when {
|
||||
ktTypeUpper.isError -> return IrErrorTypeImpl(ktTypeUpper, translateTypeAnnotations(ktTypeUpper.annotations), variance)
|
||||
ktTypeUpper.isDynamic() -> return IrDynamicTypeImpl(ktTypeUpper, translateTypeAnnotations(ktTypeUpper.annotations), variance)
|
||||
ktTypeUpper.isFlexible() -> return translateType(ktTypeUpper.upperIfFlexible(), variance)
|
||||
approximatedType.isError ->
|
||||
return IrErrorTypeImpl(approximatedType, translateTypeAnnotations(approximatedType.annotations), variance)
|
||||
approximatedType.isDynamic() ->
|
||||
return IrDynamicTypeImpl(approximatedType, translateTypeAnnotations(approximatedType.annotations), variance)
|
||||
approximatedType.isFlexible() ->
|
||||
return translateType(approximatedType.upperIfFlexible(), variance)
|
||||
}
|
||||
|
||||
val ktTypeConstructor = ktTypeUpper.constructor
|
||||
val ktTypeDescriptor = ktTypeConstructor.declarationDescriptor ?: throw AssertionError("No descriptor for type $ktTypeUpper")
|
||||
val ktTypeConstructor = approximatedType.constructor
|
||||
val ktTypeDescriptor = ktTypeConstructor.declarationDescriptor
|
||||
?: throw AssertionError("No descriptor for type $approximatedType")
|
||||
|
||||
return when (ktTypeDescriptor) {
|
||||
is TypeParameterDescriptor ->
|
||||
IrSimpleTypeImpl(
|
||||
ktTypeUpper,
|
||||
approximatedType,
|
||||
resolveTypeParameter(ktTypeDescriptor),
|
||||
ktTypeUpper.isMarkedNullable,
|
||||
approximatedType.isMarkedNullable,
|
||||
emptyList(),
|
||||
translateTypeAnnotations(ktTypeUpper.annotations),
|
||||
translateTypeAnnotations(approximatedType.annotations),
|
||||
variance
|
||||
)
|
||||
|
||||
is ClassDescriptor ->
|
||||
IrSimpleTypeImpl(
|
||||
ktTypeUpper,
|
||||
approximatedType,
|
||||
symbolTable.referenceClass(ktTypeDescriptor),
|
||||
ktTypeUpper.isMarkedNullable,
|
||||
translateTypeArguments(ktTypeUpper.arguments),
|
||||
translateTypeAnnotations(ktTypeUpper.annotations),
|
||||
approximatedType.isMarkedNullable,
|
||||
translateTypeArguments(approximatedType.arguments),
|
||||
translateTypeAnnotations(approximatedType.annotations),
|
||||
variance
|
||||
)
|
||||
|
||||
@@ -99,15 +102,36 @@ class TypeTranslator(
|
||||
}
|
||||
}
|
||||
|
||||
private fun KotlinType.approximate(languageVersionSettings: LanguageVersionSettings): KotlinType {
|
||||
if (this.constructor.isDenotable) return this
|
||||
private inner class LegacyTypeApproximation {
|
||||
|
||||
fun approximate(ktType: KotlinType): KotlinType {
|
||||
val properlyApproximatedType = approximateByKotlinRules(ktType)
|
||||
|
||||
// If there's an intersection type, take the most common supertype of its intermediate supertypes.
|
||||
// That's what old back-end effectively does.
|
||||
val typeConstructor = properlyApproximatedType.constructor
|
||||
if (typeConstructor is IntersectionTypeConstructor) {
|
||||
val commonSupertype = CommonSupertypes.commonSupertype(typeConstructor.supertypes)
|
||||
return approximate(commonSupertype.replaceArgumentsWithStarProjections())
|
||||
}
|
||||
|
||||
// Other types should be approximated properly. Right? Riiight?
|
||||
return properlyApproximatedType
|
||||
}
|
||||
|
||||
|
||||
private fun approximateByKotlinRules(ktType: KotlinType): KotlinType {
|
||||
if (ktType.constructor.isDenotable) return ktType
|
||||
|
||||
return if (languageVersionSettings.supportsFeature(LanguageFeature.NewInference))
|
||||
typeApproximatorForNI.approximateDeclarationType(ktType, local = false, languageVersionSettings = languageVersionSettings)
|
||||
else
|
||||
approximateCapturedTypes(ktType).upper
|
||||
}
|
||||
|
||||
return if (languageVersionSettings.supportsFeature(LanguageFeature.NewInference))
|
||||
typeApproximatorForNI.approximateDeclarationType(this, local = false, languageVersionSettings = languageVersionSettings)
|
||||
else
|
||||
approximateCapturedTypes(this).upper
|
||||
}
|
||||
|
||||
|
||||
private fun translateTypeAnnotations(annotations: Annotations): List<IrCall> =
|
||||
annotations.map(constantValueGenerator::generateAnnotationConstructorCall)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
class In<in I>
|
||||
|
||||
fun <S> select(x: S, y: S): S = x
|
||||
|
||||
fun <T> foo(a: Array<In<T>>, b: Array<In<String>>) =
|
||||
select(a, b)[0].ofType(true)
|
||||
|
||||
inline fun <reified K> In<K>.ofType(y: Any?) =
|
||||
y is K
|
||||
|
||||
fun test() {
|
||||
val a1 = arrayOf(In<Int>())
|
||||
val a2 = arrayOf(In<String>())
|
||||
foo(a1, a2)
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
FILE fqName:<root> fileName:/intersectionType1.kt
|
||||
CLASS CLASS name:In modality:FINAL visibility:public flags: superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:In<I> flags:
|
||||
TYPE_PARAMETER name:I index:0 variance:in superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> () returnType:In<I> flags:primary
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='In'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN name:select visibility:public modality:FINAL <S> (x:S, y:S) returnType:S flags:
|
||||
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:S flags:
|
||||
VALUE_PARAMETER name:y index:1 type:S flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='select(S, S): S'
|
||||
GET_VAR 'value-parameter x: S' type=S origin=null
|
||||
FUN name:foo visibility:public modality:FINAL <T> (a:kotlin.Array<In<T>>, b:kotlin.Array<In<kotlin.String>>) returnType:kotlin.Boolean flags:
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Array<In<T>> flags:
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Array<In<kotlin.String>> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='foo(Array<In<T>>, Array<In<String>>): Boolean'
|
||||
CALL 'ofType(Any?) on In<K>: Boolean' type=kotlin.Boolean origin=null
|
||||
<reified K>: kotlin.Any?
|
||||
$receiver: CALL 'get(Int): T' type=In<kotlin.Any?> origin=GET_ARRAY_ELEMENT
|
||||
$this: CALL 'select(S, S): S' type=kotlin.Array<out In<kotlin.Any?>> origin=null
|
||||
<S>: kotlin.Array<out In<kotlin.Any?>>
|
||||
x: GET_VAR 'value-parameter a: Array<In<T>>' type=kotlin.Array<In<T>> origin=null
|
||||
y: GET_VAR 'value-parameter b: Array<In<String>>' type=kotlin.Array<In<kotlin.String>> origin=null
|
||||
index: CONST Int type=kotlin.Int value=0
|
||||
y: CONST Boolean type=kotlin.Boolean value=true
|
||||
FUN name:ofType visibility:public modality:FINAL <K> ($receiver:In<K>, y:kotlin.Any?) returnType:kotlin.Boolean flags:inline
|
||||
TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:In<K> flags:
|
||||
VALUE_PARAMETER name:y index:0 type:kotlin.Any? flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='ofType(Any?) on In<K>: Boolean'
|
||||
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=K
|
||||
typeOperand: TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?]
|
||||
GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit flags:
|
||||
BLOCK_BODY
|
||||
VAR name:a1 type:kotlin.Array<In<kotlin.Int>> flags:val
|
||||
CALL 'arrayOf(vararg T): Array<T>' type=kotlin.Array<In<kotlin.Int>> origin=null
|
||||
<reified T>: In<kotlin.Int>
|
||||
elements: VARARG type=kotlin.Array<out In<kotlin.Int>> varargElementType=In<kotlin.Int>
|
||||
CALL 'constructor In()' type=In<kotlin.Int> origin=null
|
||||
<in I>: kotlin.Int
|
||||
VAR name:a2 type:kotlin.Array<In<kotlin.String>> flags:val
|
||||
CALL 'arrayOf(vararg T): Array<T>' type=kotlin.Array<In<kotlin.String>> origin=null
|
||||
<reified T>: In<kotlin.String>
|
||||
elements: VARARG type=kotlin.Array<out In<kotlin.String>> varargElementType=In<kotlin.String>
|
||||
CALL 'constructor In()' type=In<kotlin.String> origin=null
|
||||
<in I>: kotlin.String
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any]
|
||||
CALL 'foo(Array<In<T>>, Array<In<String>>): Boolean' type=kotlin.Boolean origin=null
|
||||
<T>: kotlin.Int
|
||||
a: GET_VAR 'a1: Array<In<Int>>' type=kotlin.Array<In<kotlin.Int>> origin=null
|
||||
b: GET_VAR 'a2: Array<In<String>>' type=kotlin.Array<In<kotlin.String>> origin=null
|
||||
@@ -0,0 +1,16 @@
|
||||
interface A<out T>
|
||||
interface Foo
|
||||
|
||||
open class B : Foo, A<B>
|
||||
open class C : Foo, A<C>
|
||||
|
||||
fun <T> run(fn: () -> T) = fn()
|
||||
|
||||
fun foo() = run {
|
||||
val mm = B()
|
||||
val nn = C()
|
||||
|
||||
val c = if (true) mm else nn
|
||||
|
||||
c
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
FILE fqName:<root> fileName:/intersectionType2.kt
|
||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public flags: superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:A<T> flags:
|
||||
TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any?]
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public flags: superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:Foo flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
CLASS CLASS name:B modality:OPEN visibility:public flags: superTypes:[Foo; A<B>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:B flags:
|
||||
CONSTRUCTOR visibility:public <> () returnType:B flags:primary
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='B'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
CLASS CLASS name:C modality:OPEN visibility:public flags: superTypes:[Foo; A<C>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:C flags:
|
||||
CONSTRUCTOR visibility:public <> () returnType:C flags:primary
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='C'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN name:run visibility:public modality:FINAL <T> (fn:kotlin.Function0<T>) returnType:T flags:
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<T> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='run(() -> T): T'
|
||||
CALL 'invoke(): R' type=T origin=INVOKE
|
||||
$this: GET_VAR 'value-parameter fn: () -> T' type=kotlin.Function0<T> origin=VARIABLE_AS_FUNCTION
|
||||
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Any flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='foo(): Any'
|
||||
CALL 'run(() -> T): T' type=kotlin.Any origin=null
|
||||
<T>: kotlin.Any
|
||||
fn: BLOCK type=kotlin.Function0<kotlin.Any> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Any flags:
|
||||
BLOCK_BODY
|
||||
VAR name:mm type:B flags:val
|
||||
CALL 'constructor B()' type=B origin=null
|
||||
VAR name:nn type:C flags:val
|
||||
CALL 'constructor C()' type=C origin=null
|
||||
VAR name:c type:kotlin.Any flags:val
|
||||
WHEN type=kotlin.Any origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'mm: B' type=B origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'nn: C' type=C origin=null
|
||||
RETURN type=kotlin.Nothing from='<anonymous>(): Any'
|
||||
GET_VAR 'c: Any' type=kotlin.Any origin=null
|
||||
FUNCTION_REFERENCE '<anonymous>(): Any' type=kotlin.Function0<kotlin.Any> origin=LAMBDA
|
||||
@@ -0,0 +1,30 @@
|
||||
interface In<in T>
|
||||
|
||||
inline fun <reified T> In<T>.isT(): Boolean =
|
||||
this is T
|
||||
|
||||
inline fun <reified T> In<T>.asT() { this as T }
|
||||
|
||||
fun <S> sel(x: S, y: S): S = 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>) = sel(x, y).isT()
|
||||
|
||||
fun testInIs2(x: In<Z1>, y: In<Z2>) = sel(x, y).isT()
|
||||
|
||||
fun testInIs3(x: In<A1>, y: In<A2>) = sel(x, y).isT()
|
||||
|
||||
fun testInAs1(x: In<A>, y: In<B>) = sel(x, y).asT()
|
||||
|
||||
fun testInAs2(x: In<Z1>, y: In<Z2>) = sel(x, y).asT()
|
||||
|
||||
fun testInAs3(x: In<A1>, y: In<A2>) = sel(x, y).asT()
|
||||
@@ -0,0 +1,203 @@
|
||||
FILE fqName:<root> fileName:/intersectionType3.kt
|
||||
CLASS INTERFACE name:In modality:ABSTRACT visibility:public flags: superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:In<T> flags:
|
||||
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 flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN name:isT visibility:public modality:FINAL <T> ($receiver:In<T>) returnType:kotlin.Boolean flags:inline
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:In<T> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='isT() on In<T>: Boolean'
|
||||
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T
|
||||
typeOperand: TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
GET_VAR 'this@isT: In<T>' type=In<T> origin=null
|
||||
FUN name:asT visibility:public modality:FINAL <T> ($receiver:In<T>) returnType:kotlin.Unit flags:inline
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:In<T> flags:
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any]
|
||||
TYPE_OP type=T origin=CAST typeOperand=T
|
||||
typeOperand: TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
GET_VAR 'this@asT: In<T>' type=In<T> origin=null
|
||||
FUN name:sel visibility:public modality:FINAL <S> (x:S, y:S) returnType:S flags:
|
||||
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:S flags:
|
||||
VALUE_PARAMETER name:y index:1 type:S flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='sel(S, S): S'
|
||||
GET_VAR 'value-parameter x: S' type=S origin=null
|
||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public flags: superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:A flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
CLASS INTERFACE name:B modality:ABSTRACT visibility:public flags: superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:B flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
CLASS INTERFACE name:A1 modality:ABSTRACT visibility:public flags: superTypes:[A]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:A1 flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
CLASS INTERFACE name:A2 modality:ABSTRACT visibility:public flags: superTypes:[A]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:A2 flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
CLASS INTERFACE name:Z1 modality:ABSTRACT visibility:public flags: superTypes:[A; B]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:Z1 flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
CLASS INTERFACE name:Z2 modality:ABSTRACT visibility:public flags: superTypes:[A; B]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:Z2 flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
overridden:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags:
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
|
||||
FUN name:testInIs1 visibility:public modality:FINAL <> (x:In<A>, y:In<B>) returnType:kotlin.Boolean flags:
|
||||
VALUE_PARAMETER name:x index:0 type:In<A> flags:
|
||||
VALUE_PARAMETER name:y index:1 type:In<B> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='testInIs1(In<A>, In<B>): Boolean'
|
||||
CALL 'isT() on In<T>: Boolean' type=kotlin.Boolean origin=null
|
||||
<reified T>: kotlin.Any
|
||||
$receiver: CALL 'sel(S, S): S' type=In<kotlin.Any> origin=null
|
||||
<S>: In<kotlin.Any>
|
||||
x: GET_VAR 'value-parameter x: In<A>' type=In<A> origin=null
|
||||
y: GET_VAR 'value-parameter y: In<B>' type=In<B> origin=null
|
||||
FUN name:testInIs2 visibility:public modality:FINAL <> (x:In<Z1>, y:In<Z2>) returnType:kotlin.Boolean flags:
|
||||
VALUE_PARAMETER name:x index:0 type:In<Z1> flags:
|
||||
VALUE_PARAMETER name:y index:1 type:In<Z2> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='testInIs2(In<Z1>, In<Z2>): Boolean'
|
||||
CALL 'isT() on In<T>: Boolean' type=kotlin.Boolean origin=null
|
||||
<reified T>: kotlin.Any
|
||||
$receiver: CALL 'sel(S, S): S' type=In<kotlin.Any> origin=null
|
||||
<S>: In<kotlin.Any>
|
||||
x: GET_VAR 'value-parameter x: In<Z1>' type=In<Z1> origin=null
|
||||
y: GET_VAR 'value-parameter y: In<Z2>' type=In<Z2> origin=null
|
||||
FUN name:testInIs3 visibility:public modality:FINAL <> (x:In<A1>, y:In<A2>) returnType:kotlin.Boolean flags:
|
||||
VALUE_PARAMETER name:x index:0 type:In<A1> flags:
|
||||
VALUE_PARAMETER name:y index:1 type:In<A2> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='testInIs3(In<A1>, In<A2>): Boolean'
|
||||
CALL 'isT() on In<T>: Boolean' type=kotlin.Boolean origin=null
|
||||
<reified T>: A
|
||||
$receiver: CALL 'sel(S, S): S' type=In<A> origin=null
|
||||
<S>: In<A>
|
||||
x: GET_VAR 'value-parameter x: In<A1>' type=In<A1> origin=null
|
||||
y: GET_VAR 'value-parameter y: In<A2>' type=In<A2> origin=null
|
||||
FUN name:testInAs1 visibility:public modality:FINAL <> (x:In<A>, y:In<B>) returnType:kotlin.Unit flags:
|
||||
VALUE_PARAMETER name:x index:0 type:In<A> flags:
|
||||
VALUE_PARAMETER name:y index:1 type:In<B> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='testInAs1(In<A>, In<B>): Unit'
|
||||
CALL 'asT() on In<T>: Unit' type=kotlin.Unit origin=null
|
||||
<reified T>: kotlin.Any
|
||||
$receiver: CALL 'sel(S, S): S' type=In<kotlin.Any> origin=null
|
||||
<S>: In<kotlin.Any>
|
||||
x: GET_VAR 'value-parameter x: In<A>' type=In<A> origin=null
|
||||
y: GET_VAR 'value-parameter y: In<B>' type=In<B> origin=null
|
||||
FUN name:testInAs2 visibility:public modality:FINAL <> (x:In<Z1>, y:In<Z2>) returnType:kotlin.Unit flags:
|
||||
VALUE_PARAMETER name:x index:0 type:In<Z1> flags:
|
||||
VALUE_PARAMETER name:y index:1 type:In<Z2> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='testInAs2(In<Z1>, In<Z2>): Unit'
|
||||
CALL 'asT() on In<T>: Unit' type=kotlin.Unit origin=null
|
||||
<reified T>: kotlin.Any
|
||||
$receiver: CALL 'sel(S, S): S' type=In<kotlin.Any> origin=null
|
||||
<S>: In<kotlin.Any>
|
||||
x: GET_VAR 'value-parameter x: In<Z1>' type=In<Z1> origin=null
|
||||
y: GET_VAR 'value-parameter y: In<Z2>' type=In<Z2> origin=null
|
||||
FUN name:testInAs3 visibility:public modality:FINAL <> (x:In<A1>, y:In<A2>) returnType:kotlin.Unit flags:
|
||||
VALUE_PARAMETER name:x index:0 type:In<A1> flags:
|
||||
VALUE_PARAMETER name:y index:1 type:In<A2> flags:
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='testInAs3(In<A1>, In<A2>): Unit'
|
||||
CALL 'asT() on In<T>: Unit' type=kotlin.Unit origin=null
|
||||
<reified T>: A
|
||||
$receiver: CALL 'sel(S, S): S' type=In<A> origin=null
|
||||
<S>: In<A>
|
||||
x: GET_VAR 'value-parameter x: In<A1>' type=In<A1> origin=null
|
||||
y: GET_VAR 'value-parameter y: In<A2>' type=In<A2> origin=null
|
||||
@@ -1485,4 +1485,32 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
||||
runTest("compiler/testData/ir/irText/stubs/simple.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/ir/irText/types")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Types extends AbstractIrTextTestCase {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTypes() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/ir/irText/types"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionType1.kt")
|
||||
public void testIntersectionType1() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/intersectionType1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionType2.kt")
|
||||
public void testIntersectionType2() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/intersectionType2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionType3.kt")
|
||||
public void testIntersectionType3() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/intersectionType3.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user