[FIR] Fix projection of Comparable supertype for ILT
#KT-39048 Fixed
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-39048
|
||||
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass<T extends Comparable<? super T>> {
|
||||
public JavaClass(T from) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class K<T : Comparable<T>>(t: T)
|
||||
fun main() {
|
||||
K(0)
|
||||
JavaClass(0)
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
FILE: main.kt
|
||||
public final class K<T : R|kotlin/Comparable<T>|> : R|kotlin/Any| {
|
||||
public constructor<T : R|kotlin/Comparable<T>|>(t: R|T|): R|K<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/K.K|<R|kotlin/Int|>(Int(0))
|
||||
R|/JavaClass.JavaClass|<R|ft<ILT: 0, ILT: 0?>!|>(Int(0))
|
||||
}
|
||||
Generated
+5
@@ -1479,6 +1479,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/extensionCallableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralAsComparable.kt")
|
||||
public void testIntegerLiteralAsComparable() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/integerLiteralAsComparable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionTypesInConstraints.kt")
|
||||
public void testIntersectionTypesInConstraints() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/intersectionTypesInConstraints.kt");
|
||||
|
||||
+5
@@ -1479,6 +1479,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/extensionCallableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralAsComparable.kt")
|
||||
public void testIntegerLiteralAsComparable() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/integerLiteralAsComparable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionTypesInConstraints.kt")
|
||||
public void testIntersectionTypesInConstraints() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inference/intersectionTypesInConstraints.kt");
|
||||
|
||||
@@ -59,7 +59,7 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType {
|
||||
override val supertypes: List<ConeClassLikeType> by lazy {
|
||||
listOf(
|
||||
NUMBER_TYPE,
|
||||
ConeClassLikeTypeImpl(COMPARABLE_TAG, arrayOf(ConeKotlinTypeProjectionOut(this)), false)
|
||||
ConeClassLikeTypeImpl(COMPARABLE_TAG, arrayOf(ConeKotlinTypeProjectionIn(this)), false)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
inline class GCmp<T>(val xc: Comparable<T>)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun foo(x: Int) = x
|
||||
|
||||
fun bar(x: Comparable<Int>) = if (x is Int) foo(x) else 0
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
|
||||
Reference in New Issue
Block a user