Fix AssertionError in CodegenUtil.getDelegates
Change getAllOverriddenDescriptors contracti, now it returns original (not substituted) descriptors without any duplicates. First of all it's necessary in CodegenUtil.getDelegates to avoid duplicates (see assertion there), but also it's convenient for all other usages of this method #KT-8154 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
interface A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
interface B<T> : A<T>
|
||||
|
||||
class BImpl<T>(a: A<T>) : B<T>, A<T> by a
|
||||
|
||||
fun box(): String {
|
||||
val b: B<String> = BImpl(object : A<String> {
|
||||
override fun foo() = "OK"
|
||||
})
|
||||
|
||||
if (b.foo() != "OK") return "fail 1"
|
||||
|
||||
val a: A<String> = b
|
||||
|
||||
return a.foo()
|
||||
}
|
||||
Reference in New Issue
Block a user