[FIR2IR] Correctly map arguments of type alias constructor call

Previously, we applied type arguments as is when converting type alias
constructor calls to IR.
Now, we map them using the expansion of the type alias.

#KT-59743 Fixed
This commit is contained in:
Kirill Rakhman
2023-07-19 10:48:13 +02:00
committed by Space Team
parent b4335c86c8
commit e35a28d36d
16 changed files with 653 additions and 11 deletions
@@ -25,11 +25,15 @@ import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutorByMap
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.approximateDeclarationType
import org.jetbrains.kotlin.fir.resolve.typeAliasForConstructor
import org.jetbrains.kotlin.fir.scopes.getDeclaredConstructors
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
import org.jetbrains.kotlin.fir.types.builder.buildTypeProjectionWithVariance
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.builders.declarations.UNDEFINED_PARAMETER_INDEX
@@ -43,6 +47,7 @@ import org.jetbrains.kotlin.ir.util.isFunctionTypeOrSubtype
import org.jetbrains.kotlin.ir.util.isInterface
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.util.OperatorNameConventions
class CallAndReferenceGenerator(
@@ -1054,12 +1059,51 @@ class CallAndReferenceGenerator(
}
internal fun IrExpression.applyTypeArguments(access: FirQualifiedAccessExpression): IrExpression {
val calleeReference = access.calleeReference
val originalTypeArguments = access.typeArguments
val callableFir = calleeReference.toResolvedCallableSymbol()?.fir
// If we have a constructor call through a type alias, we can't apply the type arguments as is.
// The type arguments in FIR correspond to the original type arguments as passed to the type alias.
// However, the type alias can map the type arguments arbitrarily (change order, change count by mapping K,V -> Map<K,V> or by
// having an unused argument).
// We need to map the type arguments using the expansion of the type alias.
val typeArguments = (callableFir as? FirConstructor)
?.typeAliasForConstructor
?.let { originalTypeArguments.toExpandedTypeArguments(it) }
?: originalTypeArguments
return applyTypeArguments(
access.typeArguments,
(access.calleeReference.toResolvedCallableSymbol()?.fir as? FirTypeParametersOwner)?.typeParameters
typeArguments,
(callableFir as? FirTypeParametersOwner)?.typeParameters
)
}
/**
* Applies the list of type arguments to the given type alias, expands it fully and returns the list of type arguments for the
* resulting type.
*/
private fun List<FirTypeProjection>.toExpandedTypeArguments(typeAliasSymbol: FirTypeAliasSymbol): List<FirTypeProjection> {
return typeAliasSymbol
.constructType(map { it.toConeTypeProjection() }.toTypedArray(), false)
.fullyExpandedType(session)
.typeArguments
.map { typeProjection ->
buildTypeProjectionWithVariance {
variance = when (typeProjection) {
is ConeKotlinTypeProjectionIn -> Variance.IN_VARIANCE
is ConeKotlinTypeProjectionOut -> Variance.OUT_VARIANCE
else -> Variance.INVARIANT
}
typeRef = (typeProjection as? ConeKotlinType)?.let {
buildResolvedTypeRef { type = it }
} ?: buildErrorTypeRef { }
}
}
}
private fun IrExpression.applyTypeArguments(
typeArguments: List<FirTypeProjection>?,
typeParameters: List<FirTypeParameter>?,
@@ -2904,6 +2904,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
runTest("compiler/testData/ir/irText/firProblems/timesInBuilder.kt");
}
@Test
@TestMetadata("TypeAliasConstructorParameterMapping.kt")
public void testTypeAliasConstructorParameterMapping() throws Exception {
runTest("compiler/testData/ir/irText/firProblems/TypeAliasConstructorParameterMapping.kt");
}
@Test
@TestMetadata("TypeParameterBounds.kt")
public void testTypeParameterBounds() throws Exception {
@@ -2904,6 +2904,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
runTest("compiler/testData/ir/irText/firProblems/timesInBuilder.kt");
}
@Test
@TestMetadata("TypeAliasConstructorParameterMapping.kt")
public void testTypeAliasConstructorParameterMapping() throws Exception {
runTest("compiler/testData/ir/irText/firProblems/TypeAliasConstructorParameterMapping.kt");
}
@Test
@TestMetadata("TypeParameterBounds.kt")
public void testTypeParameterBounds() throws Exception {
@@ -13,10 +13,7 @@ import org.jetbrains.kotlin.fir.declarations.builder.buildConstructorCopy
import org.jetbrains.kotlin.fir.declarations.builder.buildReceiverParameter
import org.jetbrains.kotlin.fir.declarations.utils.isInner
import org.jetbrains.kotlin.fir.languageVersionSettings
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.originalConstructorIfTypeAlias
import org.jetbrains.kotlin.fir.resolve.scope
import org.jetbrains.kotlin.fir.resolve.*
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.scopes.FakeOverrideTypeCalculator
import org.jetbrains.kotlin.fir.scopes.FirScope
@@ -264,6 +261,7 @@ private class TypeAliasConstructorsSubstitutingScope(
}.apply {
originalConstructorIfTypeAlias = originalConstructorSymbol.fir
typeAliasForConstructor = typeAliasSymbol
}.symbol
)
}
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.isLocal
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
import org.jetbrains.kotlin.fir.symbols.impl.LookupTagInternals
import org.jetbrains.kotlin.fir.types.*
@@ -88,6 +89,10 @@ var FirConstructor.originalConstructorIfTypeAlias: FirConstructor? by FirDeclara
val FirConstructorSymbol.isTypeAliasedConstructor: Boolean
get() = fir.originalConstructorIfTypeAlias != null
private object TypeAliasForConstructorKey : FirDeclarationDataKey()
var FirConstructor.typeAliasForConstructor: FirTypeAliasSymbol? by FirDeclarationDataRegistry.data(TypeAliasForConstructorKey)
interface FirCodeFragmentContext {
val towerDataContext: FirTowerDataContext
val variables: Map<FirBasedSymbol<*>, Set<ConeKotlinType>>
@@ -95,4 +100,4 @@ interface FirCodeFragmentContext {
private object CodeFragmentContextDataKey : FirDeclarationDataKey()
var FirCodeFragment.codeFragmentContext: FirCodeFragmentContext? by FirDeclarationDataRegistry.data(CodeFragmentContextDataKey)
var FirCodeFragment.codeFragmentContext: FirCodeFragmentContext? by FirDeclarationDataRegistry.data(CodeFragmentContextDataKey)
@@ -36,5 +36,5 @@ FILE fqName:<root> fileName:/specializedTypeAliasConstructorCall.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (): <root>.Cell<kotlin.Int> declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (value: T of <root>.Cell) declared in <root>.Cell' type=<root>.Cell<kotlin.Int> origin=null
<class: T>: <none>
<class: T>: kotlin.Int
value: CONST Int type=kotlin.Int value=42
@@ -13,5 +13,5 @@ class Cell<T : Any?> {
}
fun test(): Cell<Int> {
return Cell</* null */>(value = 42)
return Cell<Int>(value = 42)
}
@@ -0,0 +1,148 @@
FILE fqName:<root> fileName:/TypeAliasConstructorParameterMapping.kt
TYPEALIAS name:OneToOne visibility:public expandedType:<root>.Box1<A of <root>.OneToOne>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:OneToTwo visibility:public expandedType:<root>.Box2<A of <root>.OneToTwo, A of <root>.OneToTwo>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToTwo visibility:public expandedType:<root>.Box2<A of <root>.TwoToTwo, B of <root>.TwoToTwo>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToTwoReversed visibility:public expandedType:<root>.Box2<B of <root>.TwoToTwoReversed, A of <root>.TwoToTwoReversed>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToOne visibility:public expandedType:<root>.Box1<A of <root>.TwoToOne>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:OneToOneTransitive visibility:public expandedType:<root>.Box1<A of <root>.OneToOneTransitive>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToTwoTransitive visibility:public expandedType:<root>.Box2<A of <root>.TwoToTwoTransitive, A of <root>.TwoToTwoTransitive>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToTwoTransitive2 visibility:public expandedType:<root>.Box2<B of <root>.TwoToTwoTransitive2, B of <root>.TwoToTwoTransitive2>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
CLASS CLASS name:Box1 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Box1<T of <root>.Box1>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Box1<T of <root>.Box1> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Box1 modality:FINAL visibility:public 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 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 CLASS name:Box2 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Box2<T of <root>.Box2, R of <root>.Box2>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:R index:1 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Box2<T of <root>.Box2, R of <root>.Box2> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Box2 modality:FINAL visibility:public 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 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
PROPERTY name:test1 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test1 type:<root>.Box1<kotlin.Int> visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box1' type=<root>.Box1<kotlin.Int> origin=null
<class: T>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:<root>.Box1<kotlin.Int>
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test1> (): <root>.Box1<kotlin.Int> declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:<root>.Box1<kotlin.Int> visibility:private [final,static]' type=<root>.Box1<kotlin.Int> origin=null
PROPERTY name:test2 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test2 type:<root>.Box2<kotlin.Int, kotlin.Int> visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.Int, kotlin.Int> origin=null
<class: T>: kotlin.Int
<class: R>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.Int, kotlin.Int>
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test2> (): <root>.Box2<kotlin.Int, kotlin.Int> declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:<root>.Box2<kotlin.Int, kotlin.Int> visibility:private [final,static]' type=<root>.Box2<kotlin.Int, kotlin.Int> origin=null
PROPERTY name:test3 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test3 type:<root>.Box2<kotlin.Int, kotlin.String> visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.Int, kotlin.String> origin=null
<class: T>: kotlin.Int
<class: R>: kotlin.String
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test3> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.Int, kotlin.String>
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): <root>.Box2<kotlin.Int, kotlin.String> declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test3 type:<root>.Box2<kotlin.Int, kotlin.String> visibility:private [final,static]' type=<root>.Box2<kotlin.Int, kotlin.String> origin=null
PROPERTY name:test4 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test4 type:<root>.Box2<kotlin.String, kotlin.Int> visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.String, kotlin.Int> origin=null
<class: T>: kotlin.String
<class: R>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test4> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.String, kotlin.Int>
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test4> (): <root>.Box2<kotlin.String, kotlin.Int> declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:<root>.Box2<kotlin.String, kotlin.Int> visibility:private [final,static]' type=<root>.Box2<kotlin.String, kotlin.Int> origin=null
PROPERTY name:test5 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test5 type:<root>.Box1<kotlin.Int> visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box1' type=<root>.Box1<kotlin.Int> origin=null
<class: T>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test5> visibility:public modality:FINAL <> () returnType:<root>.Box1<kotlin.Int>
correspondingProperty: PROPERTY name:test5 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test5> (): <root>.Box1<kotlin.Int> declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test5 type:<root>.Box1<kotlin.Int> visibility:private [final,static]' type=<root>.Box1<kotlin.Int> origin=null
PROPERTY name:test6 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test6 type:<root>.Box1<kotlin.Int> visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box1' type=<root>.Box1<kotlin.Int> origin=null
<class: T>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test6> visibility:public modality:FINAL <> () returnType:<root>.Box1<kotlin.Int>
correspondingProperty: PROPERTY name:test6 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test6> (): <root>.Box1<kotlin.Int> declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test6 type:<root>.Box1<kotlin.Int> visibility:private [final,static]' type=<root>.Box1<kotlin.Int> origin=null
PROPERTY name:test7 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test7 type:<root>.Box2<kotlin.Int, kotlin.Int> visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.Int, kotlin.Int> origin=null
<class: T>: kotlin.Int
<class: R>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test7> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.Int, kotlin.Int>
correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test7> (): <root>.Box2<kotlin.Int, kotlin.Int> declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test7 type:<root>.Box2<kotlin.Int, kotlin.Int> visibility:private [final,static]' type=<root>.Box2<kotlin.Int, kotlin.Int> origin=null
PROPERTY name:test8 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test8 type:<root>.Box2<kotlin.String, kotlin.String> visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.String, kotlin.String> origin=null
<class: T>: kotlin.String
<class: R>: kotlin.String
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test8> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.String, kotlin.String>
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): <root>.Box2<kotlin.String, kotlin.String> declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test8 type:<root>.Box2<kotlin.String, kotlin.String> visibility:private [final,static]' type=<root>.Box2<kotlin.String, kotlin.String> origin=null
@@ -0,0 +1,57 @@
typealias OneToOne<A : Any?> = Box1<A>
typealias OneToTwo<A : Any?> = Box2<A, A>
typealias TwoToTwo<A : Any?, B : Any?> = Box2<A, B>
typealias TwoToTwoReversed<A : Any?, B : Any?> = Box2<B, A>
typealias TwoToOne<A : Any?, B : Any?> = Box1<A>
typealias OneToOneTransitive<A : Any?> = Box1<A>
typealias TwoToTwoTransitive<A : Any?, B : Any?> = Box2<A, A>
typealias TwoToTwoTransitive2<A : Any?, B : Any?> = Box2<B, B>
class Box1<T : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
class Box2<T : Any?, R : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
val test1: Box1<Int>
field = Box1<Int>()
get
val test2: Box2<Int, Int>
field = Box2<Int, Int>()
get
val test3: Box2<Int, String>
field = Box2<Int, String>()
get
val test4: Box2<String, Int>
field = Box2<String, Int>()
get
val test5: Box1<Int>
field = Box1<Int>()
get
val test6: Box1<Int>
field = Box1<Int>()
get
val test7: Box2<Int, Int>
field = Box2<Int, Int>()
get
val test8: Box2<String, String>
field = Box2<String, String>()
get
@@ -0,0 +1,148 @@
FILE fqName:<root> fileName:/TypeAliasConstructorParameterMapping.kt
CLASS CLASS name:Box1 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Box1<T of <root>.Box1>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Box1<T of <root>.Box1> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Box1 modality:FINAL visibility:public 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 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 CLASS name:Box2 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Box2<T of <root>.Box2, R of <root>.Box2>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:R index:1 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Box2<T of <root>.Box2, R of <root>.Box2> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Box2 modality:FINAL visibility:public 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 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
TYPEALIAS name:OneToOne visibility:public expandedType:<root>.Box1<A of <root>.OneToOne>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:OneToTwo visibility:public expandedType:<root>.Box2<A of <root>.OneToTwo, A of <root>.OneToTwo>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToTwo visibility:public expandedType:<root>.Box2<A of <root>.TwoToTwo, B of <root>.TwoToTwo>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToTwoReversed visibility:public expandedType:<root>.Box2<B of <root>.TwoToTwoReversed, A of <root>.TwoToTwoReversed>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToOne visibility:public expandedType:<root>.Box1<A of <root>.TwoToOne>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:OneToOneTransitive visibility:public expandedType:<root>.Box1<A of <root>.OneToOneTransitive>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToTwoTransitive visibility:public expandedType:<root>.Box2<A of <root>.TwoToTwoTransitive, A of <root>.TwoToTwoTransitive>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:TwoToTwoTransitive2 visibility:public expandedType:<root>.Box2<B of <root>.TwoToTwoTransitive2, B of <root>.TwoToTwoTransitive2>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] reified:false
PROPERTY name:test1 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test1 type:<root>.Box1<kotlin.Int>{ <root>.OneToOne<kotlin.Int> } visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box1' type=<root>.Box1<kotlin.Int> origin=null
<class: T>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:<root>.Box1<kotlin.Int>{ <root>.OneToOne<kotlin.Int> }
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test1> (): <root>.Box1<kotlin.Int>{ <root>.OneToOne<kotlin.Int> } declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:<root>.Box1<kotlin.Int>{ <root>.OneToOne<kotlin.Int> } visibility:private [final,static]' type=<root>.Box1<kotlin.Int>{ <root>.OneToOne<kotlin.Int> } origin=null
PROPERTY name:test2 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test2 type:<root>.Box2<kotlin.Int, kotlin.Int>{ <root>.OneToTwo<kotlin.Int> } visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.Int, kotlin.Int> origin=null
<class: T>: kotlin.Int
<class: R>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.Int, kotlin.Int>{ <root>.OneToTwo<kotlin.Int> }
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test2> (): <root>.Box2<kotlin.Int, kotlin.Int>{ <root>.OneToTwo<kotlin.Int> } declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:<root>.Box2<kotlin.Int, kotlin.Int>{ <root>.OneToTwo<kotlin.Int> } visibility:private [final,static]' type=<root>.Box2<kotlin.Int, kotlin.Int>{ <root>.OneToTwo<kotlin.Int> } origin=null
PROPERTY name:test3 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test3 type:<root>.Box2<kotlin.Int, kotlin.String>{ <root>.TwoToTwo<kotlin.Int, kotlin.String> } visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.Int, kotlin.String> origin=null
<class: T>: kotlin.Int
<class: R>: kotlin.String
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test3> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.Int, kotlin.String>{ <root>.TwoToTwo<kotlin.Int, kotlin.String> }
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): <root>.Box2<kotlin.Int, kotlin.String>{ <root>.TwoToTwo<kotlin.Int, kotlin.String> } declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test3 type:<root>.Box2<kotlin.Int, kotlin.String>{ <root>.TwoToTwo<kotlin.Int, kotlin.String> } visibility:private [final,static]' type=<root>.Box2<kotlin.Int, kotlin.String>{ <root>.TwoToTwo<kotlin.Int, kotlin.String> } origin=null
PROPERTY name:test4 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test4 type:<root>.Box2<kotlin.String, kotlin.Int>{ <root>.TwoToTwoReversed<kotlin.Int, kotlin.String> } visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.String, kotlin.Int> origin=null
<class: T>: kotlin.String
<class: R>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test4> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.String, kotlin.Int>{ <root>.TwoToTwoReversed<kotlin.Int, kotlin.String> }
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test4> (): <root>.Box2<kotlin.String, kotlin.Int>{ <root>.TwoToTwoReversed<kotlin.Int, kotlin.String> } declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:<root>.Box2<kotlin.String, kotlin.Int>{ <root>.TwoToTwoReversed<kotlin.Int, kotlin.String> } visibility:private [final,static]' type=<root>.Box2<kotlin.String, kotlin.Int>{ <root>.TwoToTwoReversed<kotlin.Int, kotlin.String> } origin=null
PROPERTY name:test5 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test5 type:<root>.Box1<kotlin.Int>{ <root>.TwoToOne<kotlin.Int, kotlin.String> } visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box1' type=<root>.Box1<kotlin.Int> origin=null
<class: T>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test5> visibility:public modality:FINAL <> () returnType:<root>.Box1<kotlin.Int>{ <root>.TwoToOne<kotlin.Int, kotlin.String> }
correspondingProperty: PROPERTY name:test5 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test5> (): <root>.Box1<kotlin.Int>{ <root>.TwoToOne<kotlin.Int, kotlin.String> } declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test5 type:<root>.Box1<kotlin.Int>{ <root>.TwoToOne<kotlin.Int, kotlin.String> } visibility:private [final,static]' type=<root>.Box1<kotlin.Int>{ <root>.TwoToOne<kotlin.Int, kotlin.String> } origin=null
PROPERTY name:test6 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test6 type:<root>.Box1<kotlin.Int>{ <root>.OneToOneTransitive<kotlin.Int> } visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box1' type=<root>.Box1<kotlin.Int> origin=null
<class: T>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test6> visibility:public modality:FINAL <> () returnType:<root>.Box1<kotlin.Int>{ <root>.OneToOneTransitive<kotlin.Int> }
correspondingProperty: PROPERTY name:test6 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test6> (): <root>.Box1<kotlin.Int>{ <root>.OneToOneTransitive<kotlin.Int> } declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test6 type:<root>.Box1<kotlin.Int>{ <root>.OneToOneTransitive<kotlin.Int> } visibility:private [final,static]' type=<root>.Box1<kotlin.Int>{ <root>.OneToOneTransitive<kotlin.Int> } origin=null
PROPERTY name:test7 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test7 type:<root>.Box2<kotlin.Int, kotlin.Int>{ <root>.TwoToTwoTransitive<kotlin.Int, kotlin.String> } visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.Int, kotlin.Int> origin=null
<class: T>: kotlin.Int
<class: R>: kotlin.Int
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test7> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.Int, kotlin.Int>{ <root>.TwoToTwoTransitive<kotlin.Int, kotlin.String> }
correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test7> (): <root>.Box2<kotlin.Int, kotlin.Int>{ <root>.TwoToTwoTransitive<kotlin.Int, kotlin.String> } declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test7 type:<root>.Box2<kotlin.Int, kotlin.Int>{ <root>.TwoToTwoTransitive<kotlin.Int, kotlin.String> } visibility:private [final,static]' type=<root>.Box2<kotlin.Int, kotlin.Int>{ <root>.TwoToTwoTransitive<kotlin.Int, kotlin.String> } origin=null
PROPERTY name:test8 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test8 type:<root>.Box2<kotlin.String, kotlin.String>{ <root>.TwoToTwoTransitive2<kotlin.Int, kotlin.String> } visibility:private [final,static]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Box2' type=<root>.Box2<kotlin.String, kotlin.String> origin=null
<class: T>: kotlin.String
<class: R>: kotlin.String
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test8> visibility:public modality:FINAL <> () returnType:<root>.Box2<kotlin.String, kotlin.String>{ <root>.TwoToTwoTransitive2<kotlin.Int, kotlin.String> }
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): <root>.Box2<kotlin.String, kotlin.String>{ <root>.TwoToTwoTransitive2<kotlin.Int, kotlin.String> } declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test8 type:<root>.Box2<kotlin.String, kotlin.String>{ <root>.TwoToTwoTransitive2<kotlin.Int, kotlin.String> } visibility:private [final,static]' type=<root>.Box2<kotlin.String, kotlin.String>{ <root>.TwoToTwoTransitive2<kotlin.Int, kotlin.String> } origin=null
@@ -0,0 +1,23 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
class Box1<T>()
class Box2<T, R>()
typealias OneToOne<A> = Box1<A>
typealias OneToTwo<A> = Box2<A, A>
typealias TwoToTwo<A, B> = Box2<A, B>
typealias TwoToTwoReversed<A, B> = Box2<B, A>
typealias TwoToOne<A, B> = Box1<A>
typealias OneToOneTransitive<A> = TwoToOne<A, A>
typealias TwoToTwoTransitive<A, B> = OneToTwo<A>
typealias TwoToTwoTransitive2<A, B> = OneToTwo<B>
val test1 = OneToOne<Int>()
val test2 = OneToTwo<Int>()
val test3 = TwoToTwo<Int, String>()
val test4 = TwoToTwoReversed<Int, String>()
val test5 = TwoToOne<Int, String>()
val test6 = OneToOneTransitive<Int>()
val test7 = TwoToTwoTransitive<Int, String>()
val test8 = TwoToTwoTransitive2<Int, String>()
@@ -0,0 +1,57 @@
class Box1<T : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
class Box2<T : Any?, R : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
typealias OneToOne<A : Any?> = Box1<A>
typealias OneToTwo<A : Any?> = Box2<A, A>
typealias TwoToTwo<A : Any?, B : Any?> = Box2<A, B>
typealias TwoToTwoReversed<A : Any?, B : Any?> = Box2<B, A>
typealias TwoToOne<A : Any?, B : Any?> = Box1<A>
typealias OneToOneTransitive<A : Any?> = Box1<A>
typealias TwoToTwoTransitive<A : Any?, B : Any?> = Box2<A, A>
typealias TwoToTwoTransitive2<A : Any?, B : Any?> = Box2<B, B>
val test1: Box1<Int>
field = Box1<Int>()
get
val test2: Box2<Int, Int>
field = Box2<Int, Int>()
get
val test3: Box2<Int, String>
field = Box2<Int, String>()
get
val test4: Box2<String, Int>
field = Box2<String, Int>()
get
val test5: Box1<Int>
field = Box1<Int>()
get
val test6: Box1<Int>
field = Box1<Int>()
get
val test7: Box2<Int, Int>
field = Box2<Int, Int>()
get
val test8: Box2<String, String>
field = Box2<String, String>()
get
@@ -0,0 +1,144 @@
// CHECK:
// Mangled name: {}test1
// Public signature: /test1|6005685442305498193[0]
// Public signature debug description: {}test1
val test1: Box1<Int>
// CHECK JVM_IR:
// Mangled name: #<get-test1>(){}Box1<kotlin.Int>
// Public signature: /test1.<get-test1>|-5747887246888681086[0]
// Public signature debug description: <get-test1>(){}Box1<kotlin.Int>
get
// CHECK:
// Mangled name: {}test2
// Public signature: /test2|2517758057000911509[0]
// Public signature debug description: {}test2
val test2: Box2<Int, Int>
// CHECK JVM_IR:
// Mangled name: #<get-test2>(){}Box2<kotlin.Int,kotlin.Int>
// Public signature: /test2.<get-test2>|-8093967936013127700[0]
// Public signature debug description: <get-test2>(){}Box2<kotlin.Int,kotlin.Int>
get
// CHECK:
// Mangled name: {}test3
// Public signature: /test3|7677556066983021166[0]
// Public signature debug description: {}test3
val test3: Box2<Int, String>
// CHECK JVM_IR:
// Mangled name: #<get-test3>(){}Box2<kotlin.Int,kotlin.String>
// Public signature: /test3.<get-test3>|7330124542622364329[0]
// Public signature debug description: <get-test3>(){}Box2<kotlin.Int,kotlin.String>
get
// CHECK:
// Mangled name: {}test4
// Public signature: /test4|-9115637610245762085[0]
// Public signature debug description: {}test4
val test4: Box2<String, Int>
// CHECK JVM_IR:
// Mangled name: #<get-test4>(){}Box2<kotlin.String,kotlin.Int>
// Public signature: /test4.<get-test4>|8274992131610048705[0]
// Public signature debug description: <get-test4>(){}Box2<kotlin.String,kotlin.Int>
get
// CHECK:
// Mangled name: {}test5
// Public signature: /test5|4734809624271551895[0]
// Public signature debug description: {}test5
val test5: Box1<Int>
// CHECK JVM_IR:
// Mangled name: #<get-test5>(){}Box1<kotlin.Int>
// Public signature: /test5.<get-test5>|-4135615187810921358[0]
// Public signature debug description: <get-test5>(){}Box1<kotlin.Int>
get
// CHECK:
// Mangled name: {}test6
// Public signature: /test6|-2606527149405855403[0]
// Public signature debug description: {}test6
val test6: Box1<Int>
// CHECK JVM_IR:
// Mangled name: #<get-test6>(){}Box1<kotlin.Int>
// Public signature: /test6.<get-test6>|4872700098972426138[0]
// Public signature debug description: <get-test6>(){}Box1<kotlin.Int>
get
// CHECK:
// Mangled name: {}test7
// Public signature: /test7|1362036650170262859[0]
// Public signature debug description: {}test7
val test7: Box2<Int, Int>
// CHECK JVM_IR:
// Mangled name: #<get-test7>(){}Box2<kotlin.Int,kotlin.Int>
// Public signature: /test7.<get-test7>|-3283424550561018351[0]
// Public signature debug description: <get-test7>(){}Box2<kotlin.Int,kotlin.Int>
get
// CHECK:
// Mangled name: {}test8
// Public signature: /test8|5640428216506241852[0]
// Public signature debug description: {}test8
val test8: Box2<String, String>
// CHECK JVM_IR:
// Mangled name: #<get-test8>(){}Box2<kotlin.String,kotlin.String>
// Public signature: /test8.<get-test8>|3315637717268921363[0]
// Public signature debug description: <get-test8>(){}Box2<kotlin.String,kotlin.String>
get
// CHECK:
// Mangled name: Box1
// Public signature: /Box1|null[0]
class Box1<T : Any?> {
// CHECK:
// Mangled name: Box1#<init>(){}
// Public signature: /Box1.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
}
// CHECK:
// Mangled name: Box2
// Public signature: /Box2|null[0]
class Box2<T : Any?, R : Any?> {
// CHECK:
// Mangled name: Box2#<init>(){}
// Public signature: /Box2.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
}
// CHECK:
// Mangled name: OneToOne
// Public signature: /OneToOne|null[0]
typealias OneToOne<A : Any?> = Box1<A>
// CHECK:
// Mangled name: OneToOneTransitive
// Public signature: /OneToOneTransitive|null[0]
typealias OneToOneTransitive<A : Any?> = Box1<A>
// CHECK:
// Mangled name: OneToTwo
// Public signature: /OneToTwo|null[0]
typealias OneToTwo<A : Any?> = Box2<A, A>
// CHECK:
// Mangled name: TwoToOne
// Public signature: /TwoToOne|null[0]
typealias TwoToOne<A : Any?, B : Any?> = Box1<A>
// CHECK:
// Mangled name: TwoToTwo
// Public signature: /TwoToTwo|null[0]
typealias TwoToTwo<A : Any?, B : Any?> = Box2<A, B>
// CHECK:
// Mangled name: TwoToTwoReversed
// Public signature: /TwoToTwoReversed|null[0]
typealias TwoToTwoReversed<A : Any?, B : Any?> = Box2<B, A>
// CHECK:
// Mangled name: TwoToTwoTransitive
// Public signature: /TwoToTwoTransitive|null[0]
typealias TwoToTwoTransitive<A : Any?, B : Any?> = Box2<A, A>
// CHECK:
// Mangled name: TwoToTwoTransitive2
// Public signature: /TwoToTwoTransitive2|null[0]
typealias TwoToTwoTransitive2<A : Any?, B : Any?> = Box2<B, B>
@@ -43,5 +43,5 @@ FILE fqName:<root> fileName:/typeAliasCtorForGenericClass.kt
q: CONST Int type=kotlin.Int value=2
VAR name:b2 type:<root>.A<<root>.A<kotlin.Int>> [val]
CONSTRUCTOR_CALL 'public constructor <init> (q: Q of <root>.A) declared in <root>.A' type=<root>.A<<root>.A<kotlin.Int>> origin=null
<class: Q>: kotlin.Int
<class: Q>: <root>.A<kotlin.Int>
q: GET_VAR 'val b: <root>.A<kotlin.Int> declared in <root>.bar' type=<root>.A<kotlin.Int> origin=null
@@ -15,5 +15,5 @@ class A<Q : Any?> {
fun bar() {
val b: A<Int> = A<Int>(q = 2)
val b2: A<A<Int>> = A<Int>(q = b)
val b2: A<A<Int>> = A<A<Int>>(q = b)
}
@@ -2904,6 +2904,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
runTest("compiler/testData/ir/irText/firProblems/timesInBuilder.kt");
}
@Test
@TestMetadata("TypeAliasConstructorParameterMapping.kt")
public void testTypeAliasConstructorParameterMapping() throws Exception {
runTest("compiler/testData/ir/irText/firProblems/TypeAliasConstructorParameterMapping.kt");
}
@Test
@TestMetadata("TypeParameterBounds.kt")
public void testTypeParameterBounds() throws Exception {