[FIR] Remove FirNamedArgumentExpressions during completion

They are mostly necessary for argument mapping during resolution.
To support a couple checkers, we transform named args for varargs
into "fake" spread expressions.

Other than that, named arguments aren't needed for anything and often
lead to bugs where we forget to unwrap them for something, so it's
better to get rid of them.

#KT-66124
This commit is contained in:
Kirill Rakhman
2024-03-01 16:00:11 +01:00
committed by Space Team
parent 03fc0fd381
commit 8443daf78d
54 changed files with 249 additions and 117 deletions
@@ -9,15 +9,15 @@ FILE: default.kt
R|/foo|(Int(1))
R|/foo|(Int(1), Double(2.0))
R|/foo|(Int(1), Double(2.0), Boolean(true))
R|/foo|(Int(1), third = Boolean(true))
R|/foo|(Int(1), Boolean(true))
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|()
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(Int(0), Double(0.0), Boolean(false), String())
R|/bar|(Int(1), third = Boolean(true))
R|/bar|(Int(1), Boolean(true))
R|/bar|(Int(1), Double(2.0), Boolean(true))
R|/bar|(Int(1), Double(2.0), Boolean(true), String(my))
R|/bar<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /bar>#|(Int(1), Boolean(true))
R|/baz|(Int(1))
R|/baz|(Int(1), vararg(String(my), String(yours)))
R|/baz|(Int(1), z = Boolean(true))
R|/baz|(Int(1), Boolean(true))
R|/baz<Inapplicable(INAPPLICABLE): /baz>#|(Int(0), String(), Boolean(false))
}
@@ -24,6 +24,6 @@ FILE: defaultFromOverrides.kt
R|<local>/a|.R|/A.foo|(Int(1))
R|<local>/a|.R|/A.bar<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /A.bar>#|()
R|<local>/a|.R|/A.bar<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /A.bar>#|(String())
R|<local>/a|.R|/A.bar|(y = Int(1))
R|<local>/a|.R|/A.bar|(Int(1))
R|<local>/a|.R|/A.bar|(String(), Int(2))
}
@@ -22,7 +22,7 @@ FILE: lambda.kt
^@foo Unit
}
)
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(f = foo@fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(foo@fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
^@foo Unit
}
, <L> = foo@fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
@@ -33,7 +33,7 @@ FILE: lambda.kt
^@bar Unit
}
)
R|/bar|(x = Int(1), <L> = bar@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
R|/bar|(Int(1), <L> = bar@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
^@bar Unit
}
)
@@ -41,7 +41,7 @@ FILE: lambda.kt
^@bar Unit
}
)
R|/bar|(x = Int(1), f = bar@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
R|/bar|(Int(1), bar@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
^@bar Unit
}
)
@@ -53,7 +53,7 @@ FILE: lambda.kt
^@bar Unit
}
)
R|/baz|(other = Boolean(false), f = baz@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
R|/baz|(Boolean(false), baz@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
^@baz Unit
}
)
@@ -69,7 +69,7 @@ FILE: lambda.kt
^@baz Unit
}
)
R|/baz<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /baz>#|(other = Boolean(false), <L> = baz@fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
R|/baz<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /baz>#|(Boolean(false), <L> = baz@fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
^@baz Unit
}
)
@@ -8,7 +8,7 @@ FILE: namedArrayInAnnotation.kt
public get(): R|kotlin/Array<out kotlin/String>|
}
@R|Ann|(strings = vararg(strings = <implicitArrayOf>(String(hello)))) public final class A : R|kotlin/Any| {
@R|Ann|(strings = vararg(*<implicitArrayOf>(String(hello)))) public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
@@ -2,5 +2,5 @@ FILE: noParameterForName.kt
public final fun foo(x: R|kotlin/Int|): R|kotlin/Unit| {
}
public final fun bar(): R|kotlin/Unit| {
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(y = Int(1))
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(Int(1))
}
@@ -3,15 +3,15 @@ FILE: simple.kt
}
public final fun test(): R|kotlin/Unit| {
R|/foo|(Int(1), Double(2.0), Boolean(true), String())
R|/foo|(Int(1), Double(2.0), Boolean(true), fourth = String(!))
R|/foo|(Int(1), Double(2.0), fourth = String(???), third = Boolean(false))
R|/foo|(Int(1), second = Double(3.14), third = Boolean(false), fourth = String(!?))
R|/foo|(third = Boolean(false), second = Double(2.71), fourth = String(?!), first = Int(0))
R|/foo|(Int(1), Double(2.0), Boolean(true), String(!))
R|/foo|(Int(1), Double(2.0), String(???), Boolean(false))
R|/foo|(Int(1), Double(3.14), Boolean(false), String(!?))
R|/foo|(Boolean(false), Double(2.71), String(?!), Int(0))
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|()
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(Double(0.0), Boolean(false), Int(0), String())
R|/foo|(Int(1), Double(2.0), third = Boolean(true), String())
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(second = Double(0.0), first = Int(0), fourth = String())
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(first = Double(0.0), second = Int(0), third = String(), fourth = Boolean(false))
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(first = Int(0), second = Double(0.0), third = Boolean(false), fourth = String(), first = Int(1))
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(Int(0), Double(0.0), Boolean(false), foth = String())
R|/foo|(Int(1), Double(2.0), Boolean(true), String())
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(Double(0.0), Int(0), String())
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(Double(0.0), Int(0), String(), Boolean(false))
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(Int(0), Double(0.0), Boolean(false), String(), Int(1))
R|/foo<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /foo>#|(Int(0), Double(0.0), Boolean(false), String())
}
@@ -10,8 +10,8 @@ FILE: vararg.kt
R|/foo|(Int(1), vararg(*R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(my), String(yours)))))
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(String())
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(Int(1), Int(2))
R|/bar|(Int(1), z = Boolean(true), vararg(y = *R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(my), String(yours)))))
R|/bar<Inapplicable(INAPPLICABLE): /bar>#|(Int(0), z = Boolean(false), y = String(), y = String(other))
R|/bar|(Int(1), Boolean(true), vararg(*R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(my), String(yours)))))
R|/bar<Inapplicable(INAPPLICABLE): /bar>#|(Int(0), Boolean(false), *String(), String(other))
R|/bar<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /bar>#|(Int(0), String(), Boolean(true))
R|/bar<Inapplicable(INAPPLICABLE): /bar>#|(Int(0), z = Boolean(false), y = String(), y = String(other), y = String(yet other))
R|/bar<Inapplicable(INAPPLICABLE): /bar>#|(Int(0), Boolean(false), *String(), String(other), String(yet other))
}