[FIR] Fix nullability of types produced by ConeRawScopeSubstitutor
#KT-66067 Fixed
This commit is contained in:
committed by
Space Team
parent
b6a6b12f0f
commit
5bca945d05
+6
@@ -33438,6 +33438,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -33438,6 +33438,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -33307,6 +33307,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -33307,6 +33307,12 @@ public class FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGener
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -33307,6 +33307,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -2728,6 +2728,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
|
||||
runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/ir/irText/fakeOverrides/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("setterVisibliity.kt")
|
||||
public void testSetterVisibliity() {
|
||||
|
||||
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
Generated
+6
@@ -2728,6 +2728,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/ir/irText/fakeOverrides/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("setterVisibliity.kt")
|
||||
public void testSetterVisibliity() {
|
||||
|
||||
@@ -200,7 +200,7 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound(
|
||||
// Given `C<T : X>`, `C` -> `C<X>..C<*>?`.
|
||||
when {
|
||||
mode.insideAnnotation -> Array(classifier.allTypeParametersNumber()) { ConeStarProjection }
|
||||
else -> typeParameterSymbols?.getProjectionsForRawType(session)
|
||||
else -> typeParameterSymbols?.getProjectionsForRawType(session, makeNullable = false)
|
||||
?: Array(classifier.allTypeParametersNumber()) { ConeStarProjection }
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -281,7 +281,7 @@ class ConeRawScopeSubstitutor(
|
||||
return when {
|
||||
type is ConeTypeParameterType -> {
|
||||
substituteOrSelf(
|
||||
listOf(type.lookupTag.symbol).getProjectionsForRawType(useSiteSession)[0] as ConeKotlinType
|
||||
listOf(type.lookupTag.symbol).getProjectionsForRawType(useSiteSession, makeNullable = type.isNullable)[0]
|
||||
)
|
||||
}
|
||||
type is ConeClassLikeType && type.typeArguments.isNotEmpty() -> {
|
||||
@@ -296,7 +296,7 @@ class ConeRawScopeSubstitutor(
|
||||
|
||||
val firClass = type.fullyExpandedType(useSiteSession).lookupTag.toFirRegularClassSymbol(useSiteSession) ?: return null
|
||||
ConeRawType.create(
|
||||
type.withArguments(firClass.typeParameterSymbols.getProjectionsForRawType(useSiteSession)),
|
||||
type.withArguments(firClass.typeParameterSymbols.getProjectionsForRawType(useSiteSession, makeNullable = type.isNullable)),
|
||||
type.replaceArgumentsWithStarProjections()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.fir.utils.exceptions.withConeTypeEntry
|
||||
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.applyIf
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.butIf
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
@@ -688,12 +689,12 @@ fun List<FirTypeParameterSymbol>.eraseToUpperBoundsAssociated(
|
||||
}
|
||||
}
|
||||
|
||||
fun List<FirTypeParameterSymbol>.getProjectionsForRawType(session: FirSession): Array<ConeTypeProjection> {
|
||||
fun List<FirTypeParameterSymbol>.getProjectionsForRawType(session: FirSession, makeNullable: Boolean): Array<ConeKotlinType> {
|
||||
val cache = mutableMapOf<FirTypeParameter, ConeKotlinType>()
|
||||
return Array(size) { index ->
|
||||
this[index].fir.eraseToUpperBound(
|
||||
session, cache, mode = EraseUpperBoundMode.FOR_RAW_TYPE_ERASURE
|
||||
)
|
||||
).applyIf(makeNullable) { withNullability(ConeNullability.NULLABLE, session.typeContext) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// ISSUE: KT-66067
|
||||
// FILE: Java1.java
|
||||
public class Java1<T extends Number> {
|
||||
public int foo(T t) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Java2.java
|
||||
public class Java2 extends KotlinClass {
|
||||
public int foo(Object t) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
class A : Java2() // Kotlin ← Java ← Kotlin ← Java
|
||||
|
||||
open class KotlinClass<T> : Java1<T>() where T: Number
|
||||
|
||||
fun box(): String {
|
||||
if (A().foo(null) != 1) return "FAIL 1";
|
||||
if (A().foo(null as Number?) != 1) return "FAIL 1";
|
||||
if (A().foo("") != 2) return "FAIL 1";
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
FILE fqName:<root> fileName:/1.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<root>.Java2]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java2'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<root>.Java2]'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java1<kotlin.Any>, t:@[FlexibleNullability] kotlin.Number?) returnType:kotlin.Unit [fake_override]
|
||||
overridden:
|
||||
public open fun foo (t: @[FlexibleNullability] kotlin.Number?): kotlin.Unit declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Java1<kotlin.Any>
|
||||
VALUE_PARAMETER name:t index:0 type:@[FlexibleNullability] kotlin.Number?
|
||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java2, t:@[FlexibleNullability] kotlin.Any?) returnType:kotlin.Unit [fake_override]
|
||||
overridden:
|
||||
public open fun foo (t: @[FlexibleNullability] kotlin.Any?): kotlin.Unit declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Java2
|
||||
VALUE_PARAMETER name:t index:0 type:@[FlexibleNullability] kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:KotlinClass modality:OPEN visibility:public superTypes:[<root>.Java1<T of <root>.KotlinClass>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KotlinClass<T of <root>.KotlinClass>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Number] reified:false
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.KotlinClass<T of <root>.KotlinClass> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
|
||||
<T>: T of <root>.KotlinClass
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:KotlinClass modality:OPEN visibility:public superTypes:[<root>.Java1<T of <root>.KotlinClass>]'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java1
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java1<T of <root>.KotlinClass>, t:@[FlexibleNullability] T of <root>.KotlinClass?) returnType:kotlin.Unit [fake_override]
|
||||
overridden:
|
||||
public open fun foo (t: @[FlexibleNullability] T of <root>.Java1?): kotlin.Unit declared in <root>.Java1
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Java1<T of <root>.KotlinClass>
|
||||
VALUE_PARAMETER name:t index:0 type:@[FlexibleNullability] T of <root>.KotlinClass?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in <root>.Java1
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in <root>.Java1
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
@@ -0,0 +1,17 @@
|
||||
class A : Java2 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java2*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class KotlinClass<T : Number> : Java1<T> {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/<T>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// CHECK:
|
||||
// Mangled name: A
|
||||
// Public signature: /A|null[0]
|
||||
class A : Java2 {
|
||||
// CHECK:
|
||||
// Mangled name: A#<init>(){}
|
||||
// Public signature: /A.<init>|-5645683436151566731[0]
|
||||
// Public signature debug description: <init>(){}
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: A#foo(kotlin.Number?){}
|
||||
// Public signature: /A.foo|2831167016207060641[0]
|
||||
// Public signature debug description: foo(kotlin.Number?){}
|
||||
/* fake */ override fun foo(t: Number?): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: A#foo(kotlin.Any?){}
|
||||
// Public signature: /A.foo|-6211124056249407422[0]
|
||||
// Public signature debug description: foo(kotlin.Any?){}
|
||||
/* fake */ override fun foo(t: Any?): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: KotlinClass
|
||||
// Public signature: /KotlinClass|null[0]
|
||||
open class KotlinClass<T : Number> : Java1<T> {
|
||||
// CHECK:
|
||||
// Mangled name: KotlinClass#<init>(){}
|
||||
// Public signature: /KotlinClass.<init>|-5645683436151566731[0]
|
||||
// Public signature debug description: <init>(){}
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: KotlinClass#foo(1:0?){}
|
||||
// Public signature: /KotlinClass.foo|-131141195414545503[0]
|
||||
// Public signature debug description: foo(1:0?){}
|
||||
/* fake */ override fun foo(t: T?): Unit
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
FILE fqName:<root> fileName:/1.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<root>.Java2]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java2'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<root>.Java2]'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java2, t:@[FlexibleNullability] kotlin.Any?) returnType:kotlin.Unit [fake_override]
|
||||
overridden:
|
||||
public open fun foo (t: @[FlexibleNullability] kotlin.Any?): kotlin.Unit declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Java2
|
||||
VALUE_PARAMETER name:t index:0 type:@[FlexibleNullability] kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:@[RawType] <root>.Java1<@[FlexibleNullability] kotlin.Number?>, t:@[FlexibleNullability] kotlin.Number?) returnType:kotlin.Unit [fake_override]
|
||||
overridden:
|
||||
public open fun foo (t: @[FlexibleNullability] kotlin.Number?): kotlin.Unit declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:@[RawType] <root>.Java1<@[FlexibleNullability] kotlin.Number?>
|
||||
VALUE_PARAMETER name:t index:0 type:@[FlexibleNullability] kotlin.Number?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in <root>.Java2
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:KotlinClass modality:OPEN visibility:public superTypes:[<root>.Java1<T of <root>.KotlinClass>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KotlinClass<T of <root>.KotlinClass>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Number] reified:false
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.KotlinClass<T of <root>.KotlinClass> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Java1'
|
||||
<T>: @[FlexibleNullability] T of <root>.KotlinClass?
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:KotlinClass modality:OPEN visibility:public superTypes:[<root>.Java1<T of <root>.KotlinClass>]'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Java1
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Java1<T of <root>.KotlinClass>, t:@[FlexibleNullability] T of <root>.KotlinClass?) returnType:kotlin.Unit [fake_override]
|
||||
overridden:
|
||||
public open fun foo (t: @[FlexibleNullability] T of <root>.Java1?): kotlin.Unit declared in <root>.Java1
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Java1<T of <root>.KotlinClass>
|
||||
VALUE_PARAMETER name:t index:0 type:@[FlexibleNullability] T of <root>.KotlinClass?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in <root>.Java1
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in <root>.Java1
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// ISSUE: KT-66067
|
||||
// SCOPE_DUMP: A:foo
|
||||
// SEPARATE_SIGNATURE_DUMP_FOR_K2
|
||||
// FILE: Java1.java
|
||||
public class Java1<T extends Number> {
|
||||
public void foo(T t) {
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Java2.java
|
||||
public class Java2 extends KotlinClass {
|
||||
public void foo(Object t) {
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
class A : Java2() // Kotlin ← Java ← Kotlin ← Java
|
||||
|
||||
open class KotlinClass<T> : Java1<T>() where T: Number
|
||||
@@ -0,0 +1,17 @@
|
||||
class A : Java2 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java2*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class KotlinClass<T : Number> : Java1<T> {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/<@FlexibleNullability T?>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
A:
|
||||
[Enhancement]: public open fun foo(t: R|kotlin/Any!|): R|kotlin/Unit| from Use site scope of /A [id: 0]
|
||||
[Enhancement]: public open fun foo(t: R|kotlin/Any!|): R|kotlin/Unit| from Java enhancement scope for /Java2 [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(t: R|kotlin/Number!|): R|kotlin/Unit| from Use site scope of /A [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(t: R|kotlin/Number!|): R|kotlin/Unit| from Java enhancement scope for /Java2 [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(t: R|kotlin/Number!|): R|kotlin/Unit| from Substitution scope for [Use site scope of /KotlinClass] for type Java2 [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(t: R|ft<T & Any, T?>|): R|kotlin/Unit| from Use site scope of /KotlinClass [id: 1]
|
||||
[SubstitutionOverride(DeclarationSite)]: public open override fun foo(t: R|ft<T & Any, T?>|): R|kotlin/Unit| from Substitution scope for [Java enhancement scope for /Java1] for type KotlinClass<T> [id: 1]
|
||||
[Enhancement]: public open fun foo(t: R|ft<T & Any, T?>|): R|kotlin/Unit| from Java enhancement scope for /Java1 [id: 2]
|
||||
@@ -0,0 +1,42 @@
|
||||
// CHECK:
|
||||
// Mangled name: A
|
||||
// Public signature: /A|null[0]
|
||||
class A : Java2 {
|
||||
// CHECK:
|
||||
// Mangled name: A#<init>(){}
|
||||
// Public signature: /A.<init>|-5645683436151566731[0]
|
||||
// Public signature debug description: <init>(){}
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: A#foo(kotlin.Any?){}
|
||||
// Public signature: /A.foo|-6211124056249407422[0]
|
||||
// Public signature debug description: foo(kotlin.Any?){}
|
||||
/* fake */ override fun foo(t: Any?): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: A#foo(kotlin.Number?){}
|
||||
// Public signature: /A.foo|2831167016207060641[0]
|
||||
// Public signature debug description: foo(kotlin.Number?){}
|
||||
/* fake */ override fun foo(t: Number?): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: KotlinClass
|
||||
// Public signature: /KotlinClass|null[0]
|
||||
open class KotlinClass<T : Number> : Java1<T> {
|
||||
// CHECK:
|
||||
// Mangled name: KotlinClass#<init>(){}
|
||||
// Public signature: /KotlinClass.<init>|-5645683436151566731[0]
|
||||
// Public signature debug description: <init>(){}
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: KotlinClass#foo(1:0?){}
|
||||
// Public signature: /KotlinClass.foo|-131141195414545503[0]
|
||||
// Public signature debug description: foo(1:0?){}
|
||||
/* fake */ override fun foo(t: T?): Unit
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -33307,6 +33307,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -33307,6 +33307,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -33307,6 +33307,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -33307,6 +33307,12 @@ public class FirBlackBoxCodegenTestWithInlineScopesGenerated extends AbstractFir
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
|
||||
+6
@@ -2728,6 +2728,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
|
||||
runTest("compiler/testData/ir/irText/fakeOverrides/intersectionWithRawType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/ir/irText/fakeOverrides/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("setterVisibliity.kt")
|
||||
public void testSetterVisibliity() {
|
||||
|
||||
+5
@@ -28229,6 +28229,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaTypeFromSameModuleWithRawTypedWildcardBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kjkWithRawTypes.kt")
|
||||
public void testKjkWithRawTypes() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kjkWithRawTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt43217.kt")
|
||||
public void testKt43217() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/kt43217.kt");
|
||||
|
||||
Reference in New Issue
Block a user