[FIR] varargs: do not leak source of value parameter to the call site

when source for compiled fir elements is set, it leaks e.g. to diagnostics,
which is then filtered

see `TestsWithStdLib.Experimental.testImplicitUsages`
This commit is contained in:
Anna Kozlova
2023-04-14 14:43:00 +02:00
committed by teamcity
parent e94946d8df
commit 1f4e4f94a7
2 changed files with 4 additions and 3 deletions
@@ -44,8 +44,9 @@ internal fun remapArgumentsWithVararg(
var indexAfterVarargs = argumentList.size
val newArgumentMapping = linkedMapOf<FirExpression, FirValueParameter>()
val varargArgument = buildVarargArgumentsExpression {
this.varargElementType = varargParameterTypeRef.withReplacedConeType(varargElementType)
this.typeRef = varargParameterTypeRef.withReplacedConeType(varargArrayType)
//todo ideally we should use here a source from the use-site and not from the declaration-site
this.varargElementType = varargParameterTypeRef.withReplacedConeType(varargElementType, KtFakeSourceElementKind.VarargArgument)
this.typeRef = varargParameterTypeRef.withReplacedConeType(varargArrayType, KtFakeSourceElementKind.VarargArgument)
for ((i, arg) in argumentList.withIndex()) {
val valueParameter = argumentMapping.getValue(arg)
// Collect arguments if `arg` is a vararg argument of interest or other vararg arguments.
@@ -36,7 +36,7 @@ fun takeUInt(@ImplicitIntegerCoercion u: UInt) {}
fun takeULong(@ImplicitIntegerCoercion u: ULong) {}
@ExperimentalUnsignedTypes
fun takeUBytes(@ImplicitIntegerCoercion vararg u: <!OPT_IN_USAGE!>UByte<!>) {}
fun takeUBytes(@ImplicitIntegerCoercion vararg u: UByte) {}
fun takeLong(@ImplicitIntegerCoercion l: Long) {}