Fix for KT-2789: NoSuchMethodError when calling trait function with default arguments that returns generic type, KT-9428 Abstract method with one parameter and one default parameter produces NoSuchMethodError, KT-9924 NoSuchMethod when replacing generic with specific type
#KT-2789 Fixed #KT-9428 Fixed #KT-9924 Fixed
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
interface FooTrait<T> {
|
||||
fun make(size: Int = 16) : T
|
||||
|
||||
fun makeFromTraitImpl() : T = make()
|
||||
}
|
||||
|
||||
class FooClass : FooTrait<String> {
|
||||
override fun make(size: Int): String {
|
||||
return "$size"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val explicitParam = FooClass().make(16)
|
||||
val defaultRes = FooClass().make()
|
||||
val defaultTraitRes = FooClass().makeFromTraitImpl()
|
||||
if (explicitParam != defaultRes) return "fail 1: ${explicitParam} != ${defaultRes}"
|
||||
if (explicitParam != "16") return "fail 2: ${explicitParam}"
|
||||
|
||||
if (explicitParam != defaultTraitRes) return "fail 3: ${explicitParam} != ${defaultTraitRes}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user