[FIR] Add default upper bound for java type parameters
This commit is contained in:
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.addDefaultBoundIfNecessary
|
||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaConstructor
|
||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaField
|
||||
@@ -122,6 +123,7 @@ class JavaSymbolProvider(
|
||||
for (upperBound in javaTypeParameter.upperBounds) {
|
||||
bounds += upperBound.toFirResolvedTypeRef(this@JavaSymbolProvider.session, stack)
|
||||
}
|
||||
addDefaultBoundIfNecessary()
|
||||
}
|
||||
|
||||
private fun List<JavaTypeParameter>.convertTypeParameters(stack: JavaTypeParameterStack): List<FirTypeParameter> {
|
||||
|
||||
@@ -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 {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package jvm;
|
||||
|
||||
public interface DiagnosticWithParameters1<E, A> extends Diagnostic {
|
||||
A getA();
|
||||
}
|
||||
+6
@@ -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|)
|
||||
}
|
||||
+5
@@ -64,6 +64,11 @@ public class FirMultiModuleResolveTestGenerated extends AbstractFirMultiModuleRe
|
||||
runTest("idea/testData/fir/multiModule/fullWithJavaPredefinedSignature/");
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionTypesProblem")
|
||||
public void testIntersectionTypesProblem() throws Exception {
|
||||
runTest("idea/testData/fir/multiModule/intersectionTypesProblem/");
|
||||
}
|
||||
|
||||
@TestMetadata("javaGetPrefixConflict")
|
||||
public void testJavaGetPrefixConflict() throws Exception {
|
||||
runTest("idea/testData/fir/multiModule/javaGetPrefixConflict/");
|
||||
|
||||
Reference in New Issue
Block a user