JS: support case when class inherits method from superclass and both implements same method (but with optional parameter) from superinterface.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// TARGET_BACKEND: JS
|
||||
// This test causes JVM to generate incorrect bytecode
|
||||
// Could not use IGNORE_BACKEND directive, since it makes LightAnalysisModeCodegenTestsGenerated fail on this test
|
||||
|
||||
interface I<T> {
|
||||
val prop: T
|
||||
|
||||
fun f(x: String = "1"): String
|
||||
|
||||
fun g(x: String = "2"): String
|
||||
|
||||
fun h(x: T = prop): T
|
||||
}
|
||||
|
||||
open class A<T> {
|
||||
open fun f(x: String) = x
|
||||
|
||||
open fun g(x: T) = x
|
||||
|
||||
open fun h(x: String) = x
|
||||
}
|
||||
|
||||
class B : A<String>(), I<String> {
|
||||
override val prop
|
||||
get() = "3"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val i: I<String> = B()
|
||||
var result = i.f() + i.g() + i.h()
|
||||
if (result != "123") return "fail1: $result"
|
||||
|
||||
val b = B()
|
||||
result = b.f() + b.g() + b.h()
|
||||
if (result != "123") return "fail2: $result"
|
||||
|
||||
val a: A<String> = B()
|
||||
result = a.f("q") + a.g("w") + a.h("e")
|
||||
if (result != "qwe") return "fail3: $result"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
public class A {
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.NotNull method f(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public method g(p0: java.lang.Object): java.lang.Object
|
||||
public @org.jetbrains.annotations.NotNull method h(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
}
|
||||
|
||||
public final class B {
|
||||
public method <init>(): void
|
||||
public synthetic method g(p0: java.lang.String): java.lang.String
|
||||
public synthetic method getProp(): java.lang.Object
|
||||
public @org.jetbrains.annotations.NotNull method getProp(): java.lang.String
|
||||
public synthetic method h(p0: java.lang.Object): java.lang.Object
|
||||
}
|
||||
|
||||
public interface I {
|
||||
inner class I/DefaultImpls
|
||||
public abstract @org.jetbrains.annotations.NotNull method f(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public abstract @org.jetbrains.annotations.NotNull method g(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public abstract method getProp(): java.lang.Object
|
||||
public abstract method h(p0: java.lang.Object): java.lang.Object
|
||||
}
|
||||
|
||||
public final class I/DefaultImpls {
|
||||
inner class I/DefaultImpls
|
||||
public synthetic static method f$default(p0: I, p1: java.lang.String, p2: int, p3: java.lang.Object): java.lang.String
|
||||
public synthetic static method g$default(p0: I, p1: java.lang.String, p2: int, p3: java.lang.Object): java.lang.String
|
||||
public synthetic static method h$default(p0: I, p1: java.lang.Object, p2: int, p3: java.lang.Object): java.lang.Object
|
||||
}
|
||||
|
||||
public final class ImplementedByFakeKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Reference in New Issue
Block a user