FIR2IR: insert spread for named argument against primitive vararg
#KT-60312 Fixed
This commit is contained in:
committed by
Space Team
parent
4abce54748
commit
4913c38e98
+2
-1
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.*
|
|||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.util.dump
|
import org.jetbrains.kotlin.ir.util.dump
|
||||||
|
import org.jetbrains.kotlin.ir.util.isPrimitiveArray
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType
|
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
@@ -1075,7 +1076,7 @@ class CallAndReferenceGenerator(
|
|||||||
if (irVarargElement !is IrSpreadElement &&
|
if (irVarargElement !is IrSpreadElement &&
|
||||||
argument.arguments[i] is FirNamedArgumentExpression &&
|
argument.arguments[i] is FirNamedArgumentExpression &&
|
||||||
irVarargElement is IrExpression &&
|
irVarargElement is IrExpression &&
|
||||||
irVarargElement.type.isArray()
|
(irVarargElement.type.isArray() || irVarargElement.type.isPrimitiveArray())
|
||||||
) {
|
) {
|
||||||
elements[i] = IrSpreadElementImpl(irVarargElement.startOffset, irVarargElement.endOffset, irVarargElement)
|
elements[i] = IrSpreadElementImpl(irVarargElement.startOffset, irVarargElement.endOffset, irVarargElement)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
// IGNORE_BACKEND_K2: JS_IR, JS_IR_ES6
|
|
||||||
// IGNORE_BACKEND_K2: WASM
|
|
||||||
|
|
||||||
// Partial copy of js/js.translator/testData/box/native/vararg.kt
|
// Partial copy of js/js.translator/testData/box/native/vararg.kt
|
||||||
// With some additions for concrete number types, strings and function references
|
// With some additions for concrete number types, strings and function references
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
FILE fqName:<root> fileName:/IntArrayAsVararg.kt
|
|
||||||
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
|
||||||
BLOCK_BODY
|
|
||||||
CALL 'public final fun consumeVarargs (vararg arr: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
|
||||||
arr: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
|
|
||||||
CONST Int type=kotlin.Int value=1
|
|
||||||
CONST Int type=kotlin.Int value=2
|
|
||||||
CALL 'public final fun consumeVarargs (vararg arr: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
|
||||||
arr: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
|
|
||||||
CALL 'public final fun intArrayOf (vararg elements: kotlin.Int): kotlin.IntArray declared in kotlin' type=kotlin.IntArray origin=null
|
|
||||||
elements: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
|
|
||||||
CONST Int type=kotlin.Int value=41
|
|
||||||
CONST Int type=kotlin.Int value=42
|
|
||||||
FUN name:consumeVarargs visibility:public modality:FINAL <> (arr:kotlin.IntArray) returnType:kotlin.Unit
|
|
||||||
VALUE_PARAMETER name:arr index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg]
|
|
||||||
BLOCK_BODY
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fun main() {
|
|
||||||
consumeVarargs(arr = [1, 2])
|
|
||||||
consumeVarargs(arr = [intArrayOf(elements = [41, 42])])
|
|
||||||
}
|
|
||||||
|
|
||||||
fun consumeVarargs(vararg arr: Int) {
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
// ISSUE: KT-60312
|
// ISSUE: KT-60312
|
||||||
// SKIP_SIGNATURE_DUMP
|
// SKIP_SIGNATURE_DUMP
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// IGNORE_BACKEND: WASM
|
// IGNORE_BACKEND: WASM
|
||||||
// IGNORE_BACKEND_K2: JS_IR, JS_IR_ES6
|
|
||||||
// EXPECTED_REACHABLE_NODES: 1314
|
// EXPECTED_REACHABLE_NODES: 1314
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user