Fix computation of erased receiver for intersection types

#KT-9630 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2016-12-26 18:07:38 +03:00
parent f7d64ac807
commit 38a2518498
14 changed files with 205 additions and 1 deletions
@@ -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()
}
@@ -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()
}
@@ -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()
}
@@ -0,0 +1,13 @@
public interface FirstTrait
public final class Foo {
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method bar(): java.lang.String
}
public final class IntersectionTypeMultipleBoundsImplicitReceiverKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method doSomething(@org.jetbrains.annotations.NotNull p0: FirstTrait): java.lang.String
}
public interface SecondTrait
@@ -0,0 +1,12 @@
public interface Bar
public final class Baz {
public method <init>(): void
}
public interface Foo
public final class IntersectionTypeWithMultipleBoundsAsReceiverKt {
public final static @org.jetbrains.annotations.NotNull method bip(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,12 @@
public interface A
public interface B
public final class C {
public method <init>(): void
}
public final class IntersectionTypeWithoutGenericsAsReceiverKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method foo(@org.jetbrains.annotations.NotNull p0: A): java.lang.String
}