KT-2498 Bridge method is not generated for method when generic parameters are substituted in superclass
#KT-2498 Fixed generateBridgeIfNeeded() now works as follows: for a given method, find which declared methods does this method override via breadth-first search. For each such declared method, generate a bridge if and only if its signature is different. Keep different methods' signatures in a set to avoid duplicated bridge signatures.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
open enum class A<T> {
|
||||
open fun foo(t: T) = "A"
|
||||
}
|
||||
|
||||
open enum class B : A<String>()
|
||||
|
||||
enum class Z(val name: String) : B() {
|
||||
Z1 : Z("Z1")
|
||||
Z2 : Z("Z2")
|
||||
override fun foo(t: String) = name
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
return when {
|
||||
Z.Z1.foo("") != "Z1" -> "Fail #1"
|
||||
Z.Z2.foo("") != "Z2" -> "Fail #2"
|
||||
(Z.Z1 : B).foo("") != "Z1" -> "Fail #3"
|
||||
(Z.Z2 : B).foo("") != "Z2" -> "Fail #4"
|
||||
(Z.Z1 : A<String>).foo("") != "Z1" -> "Fail #5"
|
||||
(Z.Z2 : A<String>).foo("") != "Z2" -> "Fail #6"
|
||||
else -> "OK"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user