Fix computation of erased receiver for intersection types
#KT-9630 Fixed
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
interface FirstTrait
|
||||
interface SecondTrait
|
||||
|
||||
fun <T> T.doSomething(): String where T : FirstTrait, T : SecondTrait {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
class Foo : FirstTrait, SecondTrait {
|
||||
fun bar(): String {
|
||||
return doSomething()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Foo().bar()
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
interface Foo<T>
|
||||
interface Bar<T>
|
||||
|
||||
class Baz<T> : Foo<T>, Bar<T>
|
||||
|
||||
fun <T, S> S.bip(): String where S : Foo<T>, S: Bar<T> {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val baz = Baz<String>()
|
||||
return baz.bip()
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
interface A
|
||||
interface B
|
||||
|
||||
class C : A, B
|
||||
|
||||
fun <T> T.foo(): String where T : A, T : B {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return C().foo()
|
||||
}
|
||||
Reference in New Issue
Block a user