[FIR] Unwrap vararg array types for diagnostic rendering

#KT-65770 Fixed
This commit is contained in:
Kirill Rakhman
2024-02-13 14:38:04 +01:00
committed by Space Team
parent eae72eac54
commit 33648e1f44
13 changed files with 79 additions and 50 deletions
@@ -0,0 +1,5 @@
/AmbiguousVararg.kt:7:5: error: overload resolution ambiguity:
public fun foo(vararg t: String): String defined in root package in file AmbiguousVararg.kt
public fun foo(vararg t: Int): String defined in root package in file AmbiguousVararg.kt
foo()
^^^
@@ -0,0 +1 @@
/AmbiguousVararg.kt:(128,131): error: Overload resolution ambiguity between candidates: [fun foo(vararg t: String): String, fun foo(vararg t: Int): String]
@@ -1,4 +1,5 @@
// FIR_IDENTICAL
// RENDER_DIAGNOSTICS_FULL_TEXT
fun foo(vararg t : String) = ""
fun foo(vararg t : Int) = ""
@@ -5,13 +5,13 @@ build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 2 source files to [Temp]/classes
[javac] Compiling [[TestData]] => [[Temp]/classes]
[javac] [TestData]/literals.kt:9:9: error: overload resolution ambiguity between candidates: [fun intArrayOf(vararg elements: IntArray): IntArray, fun intArrayOf(vararg elements: IntArray): IntArray]
[javac] [TestData]/literals.kt:9:9: error: overload resolution ambiguity between candidates: [fun intArrayOf(vararg elements: Int): IntArray, fun intArrayOf(vararg elements: Int): IntArray]
[javac] @AnnInt(intArrayOf(1, 2))
[javac] ^^^^^^^^^^
[javac] [TestData]/myArrayOf.kt:3:1: error: conflicting overloads: [fun intArrayOf(vararg elements: IntArray): IntArray]
[javac] [TestData]/myArrayOf.kt:3:1: error: conflicting overloads: [fun intArrayOf(vararg elements: Int): IntArray]
[javac] public fun intArrayOf(vararg elements: Int): IntArray = TODO()
[javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[javac] [TestData]/myArrayOf.kt:4:1: error: conflicting overloads: [fun intArrayOf(vararg elements: IntArray): IntArray]
[javac] [TestData]/myArrayOf.kt:4:1: error: conflicting overloads: [fun intArrayOf(vararg elements: Int): IntArray]
[javac] public fun intArrayOf(vararg elements: Int): IntArray = TODO()
[javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -88,11 +88,11 @@ actual fun f16(s: String = "") {}
^^^^^^^^^^^^^^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:28:12: error: 'actual fun f17(s: Array<out String>): Unit' has no corresponding expected declaration
The following declaration is incompatible because some value parameter is vararg in one declaration and non-vararg in the other:
expect fun f17(vararg s: Array<out String>): Unit
expect fun f17(vararg s: String): Unit
actual fun f17(s: Array<out String>) {}
^^^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:29:12: error: 'actual fun f18(vararg s: Array<out String>): Unit' has no corresponding expected declaration
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:29:12: error: 'actual fun f18(vararg s: String): Unit' has no corresponding expected declaration
The following declaration is incompatible because some value parameter is vararg in one declaration and non-vararg in the other:
expect fun f18(s: Array<out String>): Unit