diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt index 1ea0276fd73..3d1c7d0aff2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveUtils.kt @@ -58,7 +58,7 @@ internal fun remapArgumentsWithVararg( ) { arguments += arg if (this.source == null) { - this.source = arg.source + this.source = arg.source?.fakeElement(FirFakeSourceElementKind.VarargArgument) } } else if (arguments.isEmpty()) { // `arg` is BEFORE the vararg arguments. diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index 64951b8468d..b546acbe5c4 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -150,6 +150,10 @@ sealed class FirFakeSourceElementKind : FirSourceElementKind() { // super.foo() --> super.foo() // where `Supertype` has a fake source object SuperCallImplicitType : FirFakeSourceElementKind() + + // fun foo(vararg args: Int) {} + // fun bar(1, 2, 3) --> [resolved] fun bar(VarargArgument(1, 2, 3)) + object VarargArgument : FirFakeSourceElementKind() } sealed class FirSourceElement {