[FE] Prohibit expect fun interface to have non-fun actual counterpart

In K1 .isFun is always false for Java classes, so extra check
is added for that. This is not needed for K2, because .isFun is
true for all Java classes. Here it is not necessary to check
that interface has only one method, because such check will be
done in the place where interface implementation is created.

^KT-39362 Fixed
This commit is contained in:
Roman Efremov
2023-04-04 16:02:39 +02:00
committed by Space Team
parent 59d126abc5
commit 456d3e0f42
12 changed files with 170 additions and 1 deletions
@@ -0,0 +1,54 @@
// MODULE: m1-common
// FILE: common.kt
expect fun interface F1 {
fun run()
}
expect fun interface F2 {
fun run()
}
expect fun interface F3 {
fun run()
}
expect interface F4 {
fun run()
}
expect fun interface F5 {
fun run()
}
expect fun interface F6 {
fun run()
}
// MODULE: m2-jvm()()(m1-common)
actual fun interface F1 {
actual fun run()
}
<!ACTUAL_WITHOUT_EXPECT!>actual interface F2 {
actual fun run()
}<!>
actual typealias F3 = java.lang.Runnable
actual fun interface F4 {
actual fun run()
}
fun interface F5Typealias {
fun run()
}
actual typealias F5 = F5Typealias
interface F6Typealias {
fun run()
}
<!ACTUAL_WITHOUT_EXPECT!>actual typealias F6 = F6Typealias<!>
@@ -0,0 +1,54 @@
// MODULE: m1-common
// FILE: common.kt
expect fun interface F1 {
fun run()
}
expect fun interface F2 {
fun run()
}
expect fun interface F3 {
fun run()
}
expect interface F4 {
fun run()
}
expect fun interface F5 {
fun run()
}
expect fun interface F6 {
fun run()
}
// MODULE: m2-jvm()()(m1-common)
actual fun interface F1 {
actual fun run()
}
<!ACTUAL_WITHOUT_EXPECT!>actual<!> interface F2 {
actual fun run()
}
actual typealias F3 = java.lang.Runnable
actual fun interface F4 {
actual fun run()
}
fun interface F5Typealias {
fun run()
}
actual typealias F5 = F5Typealias
interface F6Typealias {
fun run()
}
<!ACTUAL_WITHOUT_EXPECT!>actual<!> typealias F6 = F6Typealias