JVM IR: fix InterfaceLowering for $default methods from base interfaces

The first change here is swapping the isCompatibility and hasJvmDefault
checks. Otherwise behavior could be different depending on -Xjvm-default
mode even for non-JvmDefault declarations, which makes little sense.

Another change is avoiding generating $default stubs for fake overrides
in interfaces, which replicates the behavior of the current backend.
(Note that this change also fixes the first problem on the newly added
tests, but the first change seems useful anyway.)
This commit is contained in:
Alexander Udalov
2019-12-27 23:24:04 +01:00
parent 3848ac9cac
commit b48d7f4ba7
9 changed files with 70 additions and 10 deletions

View File

@@ -0,0 +1,15 @@
// FILE: I.kt
interface I {
fun foo(x: String = "OK"): String = x
}
// FILE: J.kt
interface J : I
// @I$DefaultImpls.class:
// 1 foo\$default
// @J$DefaultImpls.class:
// 0 foo\$default