[FIR] Support of ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS diagnostic

^KT-56522 Fixed
This commit is contained in:
Ivan Kochurkin
2023-02-11 22:10:02 +01:00
committed by Space Team
parent f1fef62f76
commit c418a7a7bf
7 changed files with 51 additions and 96 deletions
@@ -1,22 +0,0 @@
// MODULE: m1-common
// FILE: common.kt
expect class Ok(x: Int, y: String = "")
expect class FailX(x: Int, y: String = "")
expect class FailY(x: Int, y: String = "")
fun test() {
Ok(42)
Ok(42, "OK")
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual class Ok actual constructor(x: Int, y: String)
actual class FailX actual constructor(x: Int = 0, y: String)
actual class FailY actual constructor(x: Int, y: String = "")
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
@@ -1,40 +0,0 @@
// MODULE: m1-common
// FILE: common.kt
expect fun ok(x: Int, y: String = "")
expect fun failX(x: Int, y: String = "")
expect fun failY(x: Int, y: String = "")
expect open class Foo {
fun ok(x: Int, y: String = "")
fun failX(x: Int, y: String = "")
fun failY(x: Int, y: String = "")
}
fun test(foo: Foo) {
ok(42)
ok(42, "OK")
foo.ok(42)
foo.ok(42, "OK")
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual fun ok(x: Int, y: String) {}
actual fun failX(x: Int = 0, y: String) {}
actual fun failY(x: Int, y: String = "") {}
actual open class Foo {
actual fun ok(x: Int, y: String) {}
actual fun failX(x: Int = 0, y: String) {}
actual fun failY(x: Int, y: String = "") {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
@@ -29,8 +29,8 @@ fun test(foo: Foo, bar: Bar) {
actual class Bar : Foo {
actual override fun ok(x: Int, y: String) {}
actual override fun failX(x: Int = 0, y: String) {}
actual override fun failY(x: Int, y: String = "") {}
actual override fun failX(<!ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS!>x: Int = 0<!>, y: String) {}
actual override fun failY(x: Int, <!ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS!>y: String = ""<!>) {}
}
@@ -29,7 +29,7 @@ fun test(foo: Foo, bar: Bar) {
actual class Bar : Foo {
actual override fun ok(x: Int, y: String) {}
actual override fun failX(<!ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS!>x: Int = <!DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE!>0<!><!>, y: String) {}
actual override fun failY(x: Int, <!ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS!>y: String = <!DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE!>""<!><!>) {}