[FIR] Add default upper bound for java type parameters

This commit is contained in:
Dmitriy Novozhilov
2019-08-29 10:37:05 +03:00
parent 8ed1317839
commit ef4ef08b1d
8 changed files with 47 additions and 0 deletions
@@ -0,0 +1,12 @@
public abstract interface Diagnostic : R|kotlin/Any| {
}
public abstract interface DiagnosticWithParameters1<E, A> : R|jvm/Diagnostic| {
public abstract operator fun getA(): R|ft<A, A?>!|
}
public abstract interface DiagnosticWithParameters2<E, A, B> : R|jvm/Diagnostic| {
public abstract operator fun getA(): R|ft<A, A?>!|
public abstract operator fun getB(): R|ft<B, B?>!|
}
@@ -0,0 +1,3 @@
package jvm;
public interface Diagnostic {}
@@ -0,0 +1,5 @@
package jvm;
public interface DiagnosticWithParameters1<E, A> extends Diagnostic {
A getA();
}
@@ -0,0 +1,6 @@
package jvm;
public interface DiagnosticWithParameters2<E, A, B> extends Diagnostic {
A getA();
B getB();
}
@@ -0,0 +1,7 @@
package jvm;
fun <K> select(x: K, y: K): K = x
fun test(d1: DiagnosticWithParameters1<*, *>, d2: DiagnosticWithParameters2<*, *, *>) {
val res = select(d1.a, d2.b)
}
@@ -0,0 +1,7 @@
FILE: test.kt
public final fun <K> select(x: R|K|, y: R|K|): R|K| {
^select R|<local>/x|
}
public final fun test(d1: R|jvm/DiagnosticWithParameters1<*, *>|, d2: R|jvm/DiagnosticWithParameters2<*, *, *>|): R|kotlin/Unit| {
lval res: R|ft<kotlin/Any?, kotlin/Any?>?| = R|jvm/select|<R|ft<kotlin/Any?, kotlin/Any?>?|>(R|<local>/d1|.R|jvm/DiagnosticWithParameters1.a|, R|<local>/d2|.R|jvm/DiagnosticWithParameters2.b|)
}