KT-3500: ClassFormatError: Duplicate method name&signature in class file && KT-3429: Traits override bug

This commit is contained in:
Mikhael Bogdanov
2013-04-16 18:32:24 +04:00
parent 3da3f94b4e
commit 57b161b08a
15 changed files with 166 additions and 30 deletions
@@ -0,0 +1,21 @@
trait A<T> {
val property : T
open fun a() : T {
return property
}
}
open class B : A<Any> {
override val property: Any = "fail"
}
open class C : B(), A<Any> {
override val property: Any = "OK"
}
fun box() : String {
return C().a() as String
}
@@ -0,0 +1,17 @@
open class Base {
open fun sayHello(): String{
return "fail"
}
}
trait Trait: Base {
override fun sayHello(): String {
return "OK"
}
}
class Derived(): Base(), Trait
fun box() : String {
return Derived().sayHello()
}
@@ -0,0 +1,15 @@
trait BK {
fun foo(): String = 10.toString()
}
trait KTrait: BK {
override fun foo() = 30.toString()
}
class A : BK, KTrait {
}
fun box(): String {
return if (A().foo() == "30") "OK" else "fail"
}
@@ -1,16 +1,18 @@
open class Base {
open fun foo() { }
open fun foo() : String {
return "fail"
}
}
trait Derived : Base {
override fun foo() {
super.foo()
override fun foo() : String {
//super.foo()
return "OK"
}
}
class DerivedImpl : Derived, Base()
fun box(): String {
DerivedImpl().foo()
return "OK"
return DerivedImpl().foo()
}
@@ -1,12 +1,14 @@
open class Base {
open fun foo() { }
open fun foo2() { }
}
trait Derived : Base {
override fun foo() {
object {
fun bar() {
super<Base>@Derived.foo()
//super<Base>@Derived.foo2()
this@Derived.foo2()
}
}.bar()
}