Files
kotlin-fork/compiler/testData/diagnostics/tests/resolve/overloadConflicts/originalExamples.kt
T
Mikhail Zarechenskiy bcc8802014 [NI] Avoid constraints from expected type for effectively empty system
Expression will be checked against expected type later.

 Theoretically, this is not very good, but it aligns with the old
 inference, plus it helps avoiding multiple type mismatch diagnostics.
2019-04-17 12:55:12 +03:00

22 lines
618 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
object Right
object Wrong
fun overloadedFun1(c: Any = "", b: String = "", f: Any = "") = Right
fun overloadedFun1(b: Any = "", c: Any = "", e: String = "") = Wrong
val test1: Right = overloadedFun1(b = "")
val test1a: Wrong = <!TYPE_MISMATCH!>overloadedFun1(b = "")<!>
fun overloadedFun2(a: String, b: Any = "") = Right
fun overloadedFun2(a: Any, b: String = "") = Wrong
val test2: Right = overloadedFun2("")
fun overloadedFun2a(a: Any, b: String = "") = Wrong
fun overloadedFun2a(a: String, b: Any = "") = Right
val test2a: Right = overloadedFun2a("")