[FIR] Expand type of vararg parameter before constructing array type
This helps to have a primitive array instead of an array of primitives
as the type of vararg value parameter. Also, this prevents
ABI-incompatibility with the libraries (KLIBs) compiled with K1.
^KT-65588
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java
index 06bef94..f774b78 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java
@@ -618,6 +618,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
index afeb521..3823a50 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
@@ -618,6 +618,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt
index 81795e3..68b8ff2 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt
@@ -208,8 +208,8 @@
.transformAnnotations(this, data)
if (property.isFromVararg == true) {
- property.transformTypeToArrayType()
- property.backingField?.transformTypeToArrayType()
+ property.transformTypeToArrayType(session)
+ property.backingField?.transformTypeToArrayType(session)
setAccessorTypesByPropertyType(property)
}
@@ -339,7 +339,7 @@
withDeclaration(valueParameter) {
valueParameter.transformReturnTypeRef(this, data)
valueParameter.transformAnnotations(this, data)
- valueParameter.transformVarargTypeToArrayType()
+ valueParameter.transformVarargTypeToArrayType(session)
valueParameter
}
}
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/TransformUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/TransformUtils.kt
index cb40dfd..27f9250 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/TransformUtils.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/TransformUtils.kt
@@ -6,23 +6,25 @@
package org.jetbrains.kotlin.fir.resolve.transformers
import org.jetbrains.kotlin.KtFakeSourceElementKind
+import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.copyWithNewSourceKind
import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration
import org.jetbrains.kotlin.fir.declarations.FirClass
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
+import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.types.ConeKotlinTypeProjectionOut
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
import org.jetbrains.kotlin.fir.types.coneType
import org.jetbrains.kotlin.fir.types.createArrayType
-internal fun FirValueParameter.transformVarargTypeToArrayType() {
+internal fun FirValueParameter.transformVarargTypeToArrayType(session: FirSession) {
if (isVararg) {
- this.transformTypeToArrayType()
+ this.transformTypeToArrayType(session)
}
}
-internal fun FirCallableDeclaration.transformTypeToArrayType() {
+internal fun FirCallableDeclaration.transformTypeToArrayType(session: FirSession) {
val returnTypeRef = this.returnTypeRef
require(returnTypeRef is FirResolvedTypeRef)
// If the delegated type is already resolved, it means we have already created a resolved array type for this vararg type declaration.
@@ -30,7 +32,7 @@
if (returnTypeRef.delegatedTypeRef is FirResolvedTypeRef &&
returnTypeRef.delegatedTypeRef?.source?.kind == KtFakeSourceElementKind.ArrayTypeFromVarargParameter
) return
- val returnType = returnTypeRef.coneType
+ val returnType = returnTypeRef.coneType.fullyExpandedType(session)
replaceReturnTypeRef(
buildResolvedTypeRef {
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt
index 1de9b01..5263fb9 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt
@@ -94,7 +94,7 @@
if (callableMember is FirFunction) {
callableMember.valueParameters.forEach {
it.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent)
- it.transformVarargTypeToArrayType()
+ it.transformVarargTypeToArrayType(transformer.session)
}
}
}
diff --git a/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.ir.txt b/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.ir.txt
new file mode 100644
index 0000000..1af3dfc
--- /dev/null
+++ b/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.ir.txt
@@ -0,0 +1,133 @@
+FILE fqName:<root> fileName:/typeAliasOfPrimitiveTypeInVarargArgument.kt
+ TYPEALIAS name:MyByte visibility:public expandedType:kotlin.Byte
+ TYPEALIAS name:MyShort visibility:public expandedType:kotlin.Short
+ TYPEALIAS name:MyInt visibility:public expandedType:kotlin.Int
+ TYPEALIAS name:MyLong visibility:public expandedType:kotlin.Long
+ TYPEALIAS name:MyUByte visibility:public expandedType:kotlin.UByte
+ TYPEALIAS name:MyUShort visibility:public expandedType:kotlin.UShort
+ TYPEALIAS name:MyUInt visibility:public expandedType:kotlin.UInt
+ TYPEALIAS name:MyULong visibility:public expandedType:kotlin.ULong
+ TYPEALIAS name:MyFloat visibility:public expandedType:kotlin.Float
+ TYPEALIAS name:MyDouble visibility:public expandedType:kotlin.Double
+ TYPEALIAS name:MyChar visibility:public expandedType:kotlin.Char
+ TYPEALIAS name:MyBoolean visibility:public expandedType:kotlin.Boolean
+ FUN name:checkByte visibility:public modality:FINAL <> (values:kotlin.ByteArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.ByteArray varargElementType:kotlin.Byte [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkByte (vararg values: kotlin.Byte): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkShort visibility:public modality:FINAL <> (values:kotlin.ShortArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.ShortArray varargElementType:kotlin.Short [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkShort (vararg values: kotlin.Short): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkInt visibility:public modality:FINAL <> (values:kotlin.IntArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkInt (vararg values: kotlin.Int): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkLong visibility:public modality:FINAL <> (values:kotlin.LongArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.LongArray varargElementType:kotlin.Long [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkLong (vararg values: kotlin.Long): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyByte visibility:public modality:FINAL <> (values:kotlin.ByteArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.ByteArray varargElementType:kotlin.Byte [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyByte (vararg values: kotlin.Byte): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyShort visibility:public modality:FINAL <> (values:kotlin.ShortArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.ShortArray varargElementType:kotlin.Short [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyShort (vararg values: kotlin.Short): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyInt visibility:public modality:FINAL <> (values:kotlin.IntArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyInt (vararg values: kotlin.Int): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyLong visibility:public modality:FINAL <> (values:kotlin.LongArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.LongArray varargElementType:kotlin.Long [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyLong (vararg values: kotlin.Long): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkUByte visibility:public modality:FINAL <> (values:kotlin.UByteArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.UByteArray varargElementType:kotlin.UByte [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkUByte (vararg values: kotlin.UByte): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkUShort visibility:public modality:FINAL <> (values:kotlin.UShortArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.UShortArray varargElementType:kotlin.UShort [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkUShort (vararg values: kotlin.UShort): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkUInt visibility:public modality:FINAL <> (values:kotlin.UIntArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.UIntArray varargElementType:kotlin.UInt [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkUInt (vararg values: kotlin.UInt): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkULong visibility:public modality:FINAL <> (values:kotlin.ULongArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.ULongArray varargElementType:kotlin.ULong [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkULong (vararg values: kotlin.ULong): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyUByte visibility:public modality:FINAL <> (values:kotlin.UByteArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.UByteArray varargElementType:kotlin.UByte [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyUByte (vararg values: kotlin.UByte): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyUShort visibility:public modality:FINAL <> (values:kotlin.UShortArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.UShortArray varargElementType:kotlin.UShort [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyUShort (vararg values: kotlin.UShort): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyUInt visibility:public modality:FINAL <> (values:kotlin.UIntArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.UIntArray varargElementType:kotlin.UInt [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyUInt (vararg values: kotlin.UInt): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyULong visibility:public modality:FINAL <> (values:kotlin.ULongArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.ULongArray varargElementType:kotlin.ULong [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyULong (vararg values: kotlin.ULong): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkFloat visibility:public modality:FINAL <> (values:kotlin.FloatArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.FloatArray varargElementType:kotlin.Float [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkFloat (vararg values: kotlin.Float): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkDouble visibility:public modality:FINAL <> (values:kotlin.DoubleArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.DoubleArray varargElementType:kotlin.Double [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkDouble (vararg values: kotlin.Double): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyFloat visibility:public modality:FINAL <> (values:kotlin.FloatArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.FloatArray varargElementType:kotlin.Float [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyFloat (vararg values: kotlin.Float): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyDouble visibility:public modality:FINAL <> (values:kotlin.DoubleArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.DoubleArray varargElementType:kotlin.Double [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyDouble (vararg values: kotlin.Double): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkChar visibility:public modality:FINAL <> (values:kotlin.CharArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.CharArray varargElementType:kotlin.Char [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkChar (vararg values: kotlin.Char): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkBoolean visibility:public modality:FINAL <> (values:kotlin.BooleanArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.BooleanArray varargElementType:kotlin.Boolean [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkBoolean (vararg values: kotlin.Boolean): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyChar visibility:public modality:FINAL <> (values:kotlin.CharArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.CharArray varargElementType:kotlin.Char [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyChar (vararg values: kotlin.Char): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
+ FUN name:checkMyBoolean visibility:public modality:FINAL <> (values:kotlin.BooleanArray) returnType:kotlin.Unit
+ VALUE_PARAMETER name:values index:0 type:kotlin.BooleanArray varargElementType:kotlin.Boolean [vararg]
+ BLOCK_BODY
+ RETURN type=kotlin.Nothing from='public final fun checkMyBoolean (vararg values: kotlin.Boolean): kotlin.Unit declared in <root>'
+ GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
diff --git a/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt b/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt
new file mode 100644
index 0000000..9f55f72
--- /dev/null
+++ b/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt
@@ -0,0 +1,50 @@
+// FIR_IDENTICAL
+// WITH_STDLIB
+
+typealias MyByte = Byte
+typealias MyShort = Short
+typealias MyInt = Int
+typealias MyLong = Long
+
+typealias MyUByte = UByte
+typealias MyUShort = UShort
+typealias MyUInt = UInt
+typealias MyULong = ULong
+
+typealias MyFloat = Float
+typealias MyDouble = Double
+
+typealias MyChar = Char
+typealias MyBoolean = Boolean
+
+fun checkByte(vararg values: Byte) = Unit
+fun checkShort(vararg values: Short) = Unit
+fun checkInt(vararg values: Int) = Unit
+fun checkLong(vararg values: Long) = Unit
+
+fun checkMyByte(vararg values: MyByte) = Unit
+fun checkMyShort(vararg values: MyShort) = Unit
+fun checkMyInt(vararg values: MyInt) = Unit
+fun checkMyLong(vararg values: MyLong) = Unit
+
+fun checkUByte(vararg values: UByte) = Unit
+fun checkUShort(vararg values: UShort) = Unit
+fun checkUInt(vararg values: UInt) = Unit
+fun checkULong(vararg values: ULong) = Unit
+
+fun checkMyUByte(vararg values: MyUByte) = Unit
+fun checkMyUShort(vararg values: MyUShort) = Unit
+fun checkMyUInt(vararg values: MyUInt) = Unit
+fun checkMyULong(vararg values: MyULong) = Unit
+
+fun checkFloat(vararg values: Float) = Unit
+fun checkDouble(vararg values: Double) = Unit
+
+fun checkMyFloat(vararg values: MyFloat) = Unit
+fun checkMyDouble(vararg values: MyDouble) = Unit
+
+fun checkChar(vararg values: Char) = Unit
+fun checkBoolean(vararg values: Boolean) = Unit
+
+fun checkMyChar(vararg values: MyChar) = Unit
+fun checkMyBoolean(vararg values: MyBoolean) = Unit
diff --git a/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt.txt b/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt.txt
new file mode 100644
index 0000000..0d465a0
--- /dev/null
+++ b/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt.txt
@@ -0,0 +1,107 @@
+typealias MyByte = Byte
+typealias MyShort = Short
+typealias MyInt = Int
+typealias MyLong = Long
+typealias MyUByte = UByte
+typealias MyUShort = UShort
+typealias MyUInt = UInt
+typealias MyULong = ULong
+typealias MyFloat = Float
+typealias MyDouble = Double
+typealias MyChar = Char
+typealias MyBoolean = Boolean
+fun checkByte(vararg values: Byte) {
+ return Unit
+}
+
+fun checkShort(vararg values: Short) {
+ return Unit
+}
+
+fun checkInt(vararg values: Int) {
+ return Unit
+}
+
+fun checkLong(vararg values: Long) {
+ return Unit
+}
+
+fun checkMyByte(vararg values: Byte) {
+ return Unit
+}
+
+fun checkMyShort(vararg values: Short) {
+ return Unit
+}
+
+fun checkMyInt(vararg values: Int) {
+ return Unit
+}
+
+fun checkMyLong(vararg values: Long) {
+ return Unit
+}
+
+fun checkUByte(vararg values: UByte) {
+ return Unit
+}
+
+fun checkUShort(vararg values: UShort) {
+ return Unit
+}
+
+fun checkUInt(vararg values: UInt) {
+ return Unit
+}
+
+fun checkULong(vararg values: ULong) {
+ return Unit
+}
+
+fun checkMyUByte(vararg values: UByte) {
+ return Unit
+}
+
+fun checkMyUShort(vararg values: UShort) {
+ return Unit
+}
+
+fun checkMyUInt(vararg values: UInt) {
+ return Unit
+}
+
+fun checkMyULong(vararg values: ULong) {
+ return Unit
+}
+
+fun checkFloat(vararg values: Float) {
+ return Unit
+}
+
+fun checkDouble(vararg values: Double) {
+ return Unit
+}
+
+fun checkMyFloat(vararg values: Float) {
+ return Unit
+}
+
+fun checkMyDouble(vararg values: Double) {
+ return Unit
+}
+
+fun checkChar(vararg values: Char) {
+ return Unit
+}
+
+fun checkBoolean(vararg values: Boolean) {
+ return Unit
+}
+
+fun checkMyChar(vararg values: Char) {
+ return Unit
+}
+
+fun checkMyBoolean(vararg values: Boolean) {
+ return Unit
+}
diff --git a/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.sig.kt.txt b/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.sig.kt.txt
new file mode 100644
index 0000000..b86fcf2
--- /dev/null
+++ b/compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.sig.kt.txt
@@ -0,0 +1,192 @@
+// CHECK:
+// Mangled name: #checkBoolean(kotlin.BooleanArray...){}
+// Public signature: /checkBoolean|-8900573306860743345[0]
+// Public signature debug description: checkBoolean(kotlin.BooleanArray...){}
+fun checkBoolean(vararg values: Boolean): Unit
+
+// CHECK:
+// Mangled name: #checkByte(kotlin.ByteArray...){}
+// Public signature: /checkByte|-1236162224121318215[0]
+// Public signature debug description: checkByte(kotlin.ByteArray...){}
+fun checkByte(vararg values: Byte): Unit
+
+// CHECK:
+// Mangled name: #checkChar(kotlin.CharArray...){}
+// Public signature: /checkChar|4028794436901682784[0]
+// Public signature debug description: checkChar(kotlin.CharArray...){}
+fun checkChar(vararg values: Char): Unit
+
+// CHECK:
+// Mangled name: #checkDouble(kotlin.DoubleArray...){}
+// Public signature: /checkDouble|8290238685806222977[0]
+// Public signature debug description: checkDouble(kotlin.DoubleArray...){}
+fun checkDouble(vararg values: Double): Unit
+
+// CHECK:
+// Mangled name: #checkFloat(kotlin.FloatArray...){}
+// Public signature: /checkFloat|-8155707993237274223[0]
+// Public signature debug description: checkFloat(kotlin.FloatArray...){}
+fun checkFloat(vararg values: Float): Unit
+
+// CHECK:
+// Mangled name: #checkInt(kotlin.IntArray...){}
+// Public signature: /checkInt|4583739980796207[0]
+// Public signature debug description: checkInt(kotlin.IntArray...){}
+fun checkInt(vararg values: Int): Unit
+
+// CHECK:
+// Mangled name: #checkLong(kotlin.LongArray...){}
+// Public signature: /checkLong|-8989236926718089499[0]
+// Public signature debug description: checkLong(kotlin.LongArray...){}
+fun checkLong(vararg values: Long): Unit
+
+// CHECK:
+// Mangled name: #checkMyBoolean(kotlin.BooleanArray...){}
+// Public signature: /checkMyBoolean|-5890207970004559376[0]
+// Public signature debug description: checkMyBoolean(kotlin.BooleanArray...){}
+fun checkMyBoolean(vararg values: Boolean): Unit
+
+// CHECK:
+// Mangled name: #checkMyByte(kotlin.ByteArray...){}
+// Public signature: /checkMyByte|8598509431667985710[0]
+// Public signature debug description: checkMyByte(kotlin.ByteArray...){}
+fun checkMyByte(vararg values: Byte): Unit
+
+// CHECK:
+// Mangled name: #checkMyChar(kotlin.CharArray...){}
+// Public signature: /checkMyChar|5192351702236597298[0]
+// Public signature debug description: checkMyChar(kotlin.CharArray...){}
+fun checkMyChar(vararg values: Char): Unit
+
+// CHECK:
+// Mangled name: #checkMyDouble(kotlin.DoubleArray...){}
+// Public signature: /checkMyDouble|5543709509339167549[0]
+// Public signature debug description: checkMyDouble(kotlin.DoubleArray...){}
+fun checkMyDouble(vararg values: Double): Unit
+
+// CHECK:
+// Mangled name: #checkMyFloat(kotlin.FloatArray...){}
+// Public signature: /checkMyFloat|-6679219747753787079[0]
+// Public signature debug description: checkMyFloat(kotlin.FloatArray...){}
+fun checkMyFloat(vararg values: Float): Unit
+
+// CHECK:
+// Mangled name: #checkMyInt(kotlin.IntArray...){}
+// Public signature: /checkMyInt|-2811351994369715293[0]
+// Public signature debug description: checkMyInt(kotlin.IntArray...){}
+fun checkMyInt(vararg values: Int): Unit
+
+// CHECK:
+// Mangled name: #checkMyLong(kotlin.LongArray...){}
+// Public signature: /checkMyLong|3940126759026537730[0]
+// Public signature debug description: checkMyLong(kotlin.LongArray...){}
+fun checkMyLong(vararg values: Long): Unit
+
+// CHECK:
+// Mangled name: #checkMyShort(kotlin.ShortArray...){}
+// Public signature: /checkMyShort|-7805523702921298983[0]
+// Public signature debug description: checkMyShort(kotlin.ShortArray...){}
+fun checkMyShort(vararg values: Short): Unit
+
+// CHECK:
+// Mangled name: #checkMyUByte(kotlin.UByteArray...){}
+// Public signature: /checkMyUByte|7955300320297277795[0]
+// Public signature debug description: checkMyUByte(kotlin.UByteArray...){}
+fun checkMyUByte(vararg values: UByte): Unit
+
+// CHECK:
+// Mangled name: #checkMyUInt(kotlin.UIntArray...){}
+// Public signature: /checkMyUInt|-2622635368460611797[0]
+// Public signature debug description: checkMyUInt(kotlin.UIntArray...){}
+fun checkMyUInt(vararg values: UInt): Unit
+
+// CHECK:
+// Mangled name: #checkMyULong(kotlin.ULongArray...){}
+// Public signature: /checkMyULong|9072087205927442218[0]
+// Public signature debug description: checkMyULong(kotlin.ULongArray...){}
+fun checkMyULong(vararg values: ULong): Unit
+
+// CHECK:
+// Mangled name: #checkMyUShort(kotlin.UShortArray...){}
+// Public signature: /checkMyUShort|1511662805791199330[0]
+// Public signature debug description: checkMyUShort(kotlin.UShortArray...){}
+fun checkMyUShort(vararg values: UShort): Unit
+
+// CHECK:
+// Mangled name: #checkShort(kotlin.ShortArray...){}
+// Public signature: /checkShort|7593907512713404632[0]
+// Public signature debug description: checkShort(kotlin.ShortArray...){}
+fun checkShort(vararg values: Short): Unit
+
+// CHECK:
+// Mangled name: #checkUByte(kotlin.UByteArray...){}
+// Public signature: /checkUByte|-3348320895831596048[0]
+// Public signature debug description: checkUByte(kotlin.UByteArray...){}
+fun checkUByte(vararg values: UByte): Unit
+
+// CHECK:
+// Mangled name: #checkUInt(kotlin.UIntArray...){}
+// Public signature: /checkUInt|-2411050561765822747[0]
+// Public signature debug description: checkUInt(kotlin.UIntArray...){}
+fun checkUInt(vararg values: UInt): Unit
+
+// CHECK:
+// Mangled name: #checkULong(kotlin.ULongArray...){}
+// Public signature: /checkULong|-6184558403322521435[0]
+// Public signature debug description: checkULong(kotlin.ULongArray...){}
+fun checkULong(vararg values: ULong): Unit
+
+// CHECK:
+// Mangled name: #checkUShort(kotlin.UShortArray...){}
+// Public signature: /checkUShort|3472066239065680351[0]
+// Public signature debug description: checkUShort(kotlin.UShortArray...){}
+fun checkUShort(vararg values: UShort): Unit
+
+// CHECK:
+// Mangled name: MyBoolean
+// Public signature: /MyBoolean|null[0]
+typealias MyBoolean = Boolean
+// CHECK:
+// Mangled name: MyByte
+// Public signature: /MyByte|null[0]
+typealias MyByte = Byte
+// CHECK:
+// Mangled name: MyChar
+// Public signature: /MyChar|null[0]
+typealias MyChar = Char
+// CHECK:
+// Mangled name: MyDouble
+// Public signature: /MyDouble|null[0]
+typealias MyDouble = Double
+// CHECK:
+// Mangled name: MyFloat
+// Public signature: /MyFloat|null[0]
+typealias MyFloat = Float
+// CHECK:
+// Mangled name: MyInt
+// Public signature: /MyInt|null[0]
+typealias MyInt = Int
+// CHECK:
+// Mangled name: MyLong
+// Public signature: /MyLong|null[0]
+typealias MyLong = Long
+// CHECK:
+// Mangled name: MyShort
+// Public signature: /MyShort|null[0]
+typealias MyShort = Short
+// CHECK:
+// Mangled name: MyUByte
+// Public signature: /MyUByte|null[0]
+typealias MyUByte = UByte
+// CHECK:
+// Mangled name: MyUInt
+// Public signature: /MyUInt|null[0]
+typealias MyUInt = UInt
+// CHECK:
+// Mangled name: MyULong
+// Public signature: /MyULong|null[0]
+typealias MyULong = ULong
+// CHECK:
+// Mangled name: MyUShort
+// Public signature: /MyUShort|null[0]
+typealias MyUShort = UShort
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java
index 6b048f9..878c127 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java
@@ -618,6 +618,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
diff --git a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java
index a818a29..6767f0d 100644
--- a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java
+++ b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java
@@ -468,6 +468,11 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java
index 7568d1b..e5987bb 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java
@@ -534,6 +534,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java
index 59585c1..e07791d 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java
@@ -534,6 +534,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java
index bb9bf22..6ff01b5 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java
@@ -534,6 +534,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/ClassicNativeIrTextTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/ClassicNativeIrTextTestGenerated.java
index 3841d8b..aec6b2b 100644
--- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/ClassicNativeIrTextTestGenerated.java
+++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/ClassicNativeIrTextTestGenerated.java
@@ -534,6 +534,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirLightTreeNativeIrTextTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirLightTreeNativeIrTextTestGenerated.java
index e359914..33abc36 100644
--- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirLightTreeNativeIrTextTestGenerated.java
+++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirLightTreeNativeIrTextTestGenerated.java
@@ -534,6 +534,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")
diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirPsiNativeIrTextTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirPsiNativeIrTextTestGenerated.java
index 9ce8b56..4c04cca 100644
--- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirPsiNativeIrTextTestGenerated.java
+++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirPsiNativeIrTextTestGenerated.java
@@ -534,6 +534,12 @@
runTest("compiler/testData/ir/irText/declarations/typeAlias.kt");
}
+ @Test
+ @TestMetadata("typeAliasOfPrimitiveTypeInVarargArgument.kt")
+ public void testTypeAliasOfPrimitiveTypeInVarargArgument() throws Exception {
+ runTest("compiler/testData/ir/irText/declarations/typeAliasOfPrimitiveTypeInVarargArgument.kt");
+ }
+
@Nested
@TestMetadata("compiler/testData/ir/irText/declarations/annotations")
@TestDataPath("$PROJECT_ROOT")