FIR: Fix hanging inference case with intersection types

This commit is contained in:
Denis Zharkov
2020-04-07 14:18:55 +03:00
parent 81d9cf76f2
commit 65e90743df
5 changed files with 69 additions and 0 deletions
@@ -0,0 +1,16 @@
// FILE: MyList.java
public interface MyList<E> extends java.util.List<E>, I {}
// FILE: main.kt
fun <R> elemAndList(r: R, t: MutableList<R>): R = TODO()
interface I
class A : Comparable<A>, I
class B : Comparable<B>, I
fun test() {
elemAndList(A(), list(B()))
}
fun <T> list(value: T): MyList<T> = TODO()
@@ -0,0 +1,24 @@
FILE: main.kt
public final fun <R> elemAndList(r: R|R|, t: R|kotlin/collections/MutableList<R>|): R|R| {
^elemAndList R|kotlin/TODO|()
}
public abstract interface I : R|kotlin/Any| {
}
public final class A : R|kotlin/Comparable<A>|, R|I| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
}
public final class B : R|kotlin/Comparable<B>|, R|I| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
}
public final fun test(): R|kotlin/Unit| {
R|/elemAndList|<R|ft<it(kotlin/Comparable<it(A & B)> & I), it(kotlin/Comparable<it(A & B)>? & I?)>|>(R|/A.A|(), R|/list|<R|ft<it(kotlin/Comparable<it(A & B)> & I), it(kotlin/Comparable<it(A & B)>? & I?)>|>(R|/B.B|()))
}
public final fun <T> list(value: R|T|): R|MyList<T>| {
^list R|kotlin/TODO|()
}