[FIR2IR] Unwrap call-site substitution overrides
Generating IR declarations for use-site substitution overrides leads to IR that is different from K1 as well as problems in signature generation which relies on mangling. Use-site substitutions can contain references to type parameters from the call-site which aren't handled in mangling. #KT-57022 Fixed
This commit is contained in:
committed by
Space Team
parent
bcdd85758e
commit
86836e69e9
@@ -173,17 +173,24 @@ fun FirReference.toSymbolForCall(
|
||||
explicitReceiver: FirExpression?,
|
||||
preferGetter: Boolean = true,
|
||||
isDelegate: Boolean = false,
|
||||
isReference: Boolean = false
|
||||
isReference: Boolean = false,
|
||||
): IrSymbol? {
|
||||
return when (this) {
|
||||
is FirResolvedNamedReference ->
|
||||
resolvedSymbol.toSymbolForCall(
|
||||
is FirResolvedNamedReference -> {
|
||||
var symbol = resolvedSymbol
|
||||
|
||||
if (symbol is FirCallableSymbol<*> && symbol.origin == FirDeclarationOrigin.SubstitutionOverride.CallSite) {
|
||||
symbol = symbol.fir.unwrapUseSiteSubstitutionOverrides<FirCallableDeclaration>().symbol
|
||||
}
|
||||
|
||||
symbol.toSymbolForCall(
|
||||
dispatchReceiver,
|
||||
preferGetter,
|
||||
explicitReceiver,
|
||||
isDelegate,
|
||||
isReference
|
||||
)
|
||||
}
|
||||
|
||||
is FirThisReference -> {
|
||||
when (val boundSymbol = boundSymbol) {
|
||||
|
||||
@@ -67,11 +67,11 @@ private object IsNewPlaceForBodyGeneration : FirDeclarationDataKey()
|
||||
var FirRegularClass.isNewPlaceForBodyGeneration: Boolean? by FirDeclarationDataRegistry.data(IsNewPlaceForBodyGeneration)
|
||||
|
||||
val FirCallableDeclaration.isIntersectionOverride: Boolean get() = origin == FirDeclarationOrigin.IntersectionOverride
|
||||
val FirCallableDeclaration.isSubstitutionOverride: Boolean get() = origin == FirDeclarationOrigin.SubstitutionOverride
|
||||
val FirCallableDeclaration.isSubstitutionOverride: Boolean get() = origin is FirDeclarationOrigin.SubstitutionOverride
|
||||
val FirCallableDeclaration.isSubstitutionOrIntersectionOverride: Boolean get() = isSubstitutionOverride || isIntersectionOverride
|
||||
|
||||
val FirCallableSymbol<*>.isIntersectionOverride: Boolean get() = origin == FirDeclarationOrigin.IntersectionOverride
|
||||
val FirCallableSymbol<*>.isSubstitutionOverride: Boolean get() = origin == FirDeclarationOrigin.SubstitutionOverride
|
||||
val FirCallableSymbol<*>.isSubstitutionOverride: Boolean get() = origin is FirDeclarationOrigin.SubstitutionOverride
|
||||
val FirCallableSymbol<*>.isSubstitutionOrIntersectionOverride: Boolean get() = isSubstitutionOverride || isIntersectionOverride
|
||||
|
||||
inline val <reified D : FirCallableDeclaration> D.originalForSubstitutionOverride: D?
|
||||
@@ -132,6 +132,16 @@ inline fun <reified D : FirCallableDeclaration> D.unwrapSubstitutionOverrides():
|
||||
} while (true)
|
||||
}
|
||||
|
||||
inline fun <reified D : FirCallableDeclaration> D.unwrapUseSiteSubstitutionOverrides(): D {
|
||||
var current = this
|
||||
|
||||
do {
|
||||
if (current.origin != FirDeclarationOrigin.SubstitutionOverride.CallSite) return current
|
||||
val next = current.originalForSubstitutionOverride ?: return current
|
||||
current = next
|
||||
} while (true)
|
||||
}
|
||||
|
||||
inline fun <reified S : FirCallableSymbol<*>> S.unwrapFakeOverrides(): S = fir.unwrapFakeOverrides().symbol as S
|
||||
|
||||
inline fun <reified S : FirCallableSymbol<*>> S.unwrapSubstitutionOverrides(): S = fir.unwrapSubstitutionOverrides().symbol as S
|
||||
|
||||
+5
-5
@@ -11,7 +11,7 @@ open annotation class Test1<T : Any?> : Annotation {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: ann.Test1#<get-x>(){}kotlin.Int
|
||||
// Public signature: ann/Test1.x.<get-x>|4966956098150895696[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: ann.Test1#<get-x>(){}
|
||||
// Public signature: ann/Test1.x.<get-x>|1482705010654679335[0]
|
||||
get
|
||||
@@ -34,7 +34,7 @@ open annotation class Test2<T1 : Any, T2 : Any?> : Annotation {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: ann.Test2#<get-x>(){}kotlin.Int
|
||||
// Public signature: ann/Test2.x.<get-x>|4966956098150895696[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: ann.Test2#<get-x>(){}
|
||||
// Public signature: ann/Test2.x.<get-x>|1482705010654679335[0]
|
||||
get
|
||||
@@ -57,7 +57,7 @@ open annotation class Test3<T1 : Any?, T2 : I<T1>> : Annotation {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: ann.Test3#<get-x>(){}ann.Test1<ann.I<1:1>>
|
||||
// Public signature: ann/Test3.x.<get-x>|-476605448158023096[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: ann.Test3#<get-x>(){}
|
||||
// Public signature: ann/Test3.x.<get-x>|1482705010654679335[0]
|
||||
get
|
||||
@@ -80,7 +80,7 @@ open annotation class Test4 : Annotation {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: ann.Test4#<get-x>(){}kotlin.Array<ann.Test3<kotlin.Int,ann.C<kotlin.Int>>>
|
||||
// Public signature: ann/Test4.x.<get-x>|-4754126975303916738[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: ann.Test4#<get-x>(){}
|
||||
// Public signature: ann/Test4.x.<get-x>|1482705010654679335[0]
|
||||
get
|
||||
@@ -103,7 +103,7 @@ open annotation class Test5<T : Any?> : Annotation {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: ann.Test5#<get-xs>(){}kotlin.Array<out|ann.Test3<1:0,ann.C<1:0>>>
|
||||
// Public signature: ann/Test5.xs.<get-xs>|-4480240150602494549[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: ann.Test5#<get-xs>(){}
|
||||
// Public signature: ann/Test5.xs.<get-xs>|-6958094100501701183[0]
|
||||
get
|
||||
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
FILE fqName:<root> fileName:/test.kt
|
||||
CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[<root>.J<T of <root>.Test>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test<T of <root>.Test>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
CONSTRUCTOR visibility:public <> (x:T of <root>.Test) returnType:<root>.Test<T of <root>.Test> [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.Test
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J'
|
||||
<T>: T of <root>.Test
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[<root>.J<T of <root>.Test>]'
|
||||
PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Test visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: T of <root>.Test declared in <root>.Test.<init>' type=T of <root>.Test origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Test<T of <root>.Test>) returnType:T of <root>.Test
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test<T of <root>.Test>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-x> (): T of <root>.Test declared in <root>.Test'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Test visibility:private [final]' type=T of <root>.Test origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Test<T of <root>.Test> declared in <root>.Test.<get-x>' type=<root>.Test<T of <root>.Test> origin=null
|
||||
FUN name:test visibility:public modality:FINAL <> ($this:<root>.Test<T of <root>.Test>, b:<root>.J.B<T of <root>.Test>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test<T of <root>.Test>
|
||||
VALUE_PARAMETER name:b index:0 type:<root>.J.B<T of <root>.Test>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun output (x: @[EnhancedNullability] T of <root>.Test): kotlin.Unit declared in <root>.J.B' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'b: <root>.J.B<T of <root>.Test> declared in <root>.Test.test' type=<root>.J.B<T of <root>.Test> origin=null
|
||||
x: CALL 'public final fun <get-x> (): T of <root>.Test declared in <root>.Test' type=T of <root>.Test origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.Test<T of <root>.Test> declared in <root>.Test.test' type=<root>.Test<T of <root>.Test> origin=null
|
||||
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>.J
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type: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>.J
|
||||
$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>.J
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
class Test<T : Any?> : J<T> {
|
||||
constructor(x: T) /* primary */ {
|
||||
super/*J*/<T>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val x: T
|
||||
field = x
|
||||
get
|
||||
|
||||
fun test(b: B<T>) {
|
||||
b.output(x = <this>.<get-x>())
|
||||
}
|
||||
|
||||
}
|
||||
+97
-25
@@ -1,42 +1,114 @@
|
||||
FILE fqName:<root> fileName:/test.kt
|
||||
CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[<root>.J<T of <root>.Test>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test<T of <root>.Test>
|
||||
CLASS CLASS name:Inv modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Inv<T of <root>.Inv>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
CONSTRUCTOR visibility:public <> (x:T of <root>.Test) returnType:<root>.Test<T of <root>.Test> [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.Test
|
||||
CONSTRUCTOR visibility:public <> (x:T of <root>.Inv) returnType:<root>.Inv<T of <root>.Inv> [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.Inv
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J'
|
||||
<T>: T of <root>.Test
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[<root>.J<T of <root>.Test>]'
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inv modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Test visibility:private [final]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Inv visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: T of <root>.Test declared in <root>.Test.<init>' type=T of <root>.Test origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Test<T of <root>.Test>) returnType:T of <root>.Test
|
||||
GET_VAR 'x: T of <root>.Inv declared in <root>.Inv.<init>' type=T of <root>.Inv origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Inv<T of <root>.Inv>) returnType:T of <root>.Inv
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test<T of <root>.Test>
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Inv<T of <root>.Inv>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-x> (): T of <root>.Test declared in <root>.Test'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Test visibility:private [final]' type=T of <root>.Test origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Test<T of <root>.Test> declared in <root>.Test.<get-x>' type=<root>.Test<T of <root>.Test> origin=null
|
||||
FUN name:test visibility:public modality:FINAL <> ($this:<root>.Test<T of <root>.Test>, b:<root>.J.B<T of <root>.Test>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test<T of <root>.Test>
|
||||
VALUE_PARAMETER name:b index:0 type:<root>.J.B<T of <root>.Test>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun output (x: @[EnhancedNullability] T of <root>.J): kotlin.Unit declared in <root>.J.B' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'b: <root>.J.B<T of <root>.Test> declared in <root>.Test.test' type=<root>.J.B<T of <root>.Test> origin=null
|
||||
x: CALL 'public final fun <get-x> (): T of <root>.Test declared in <root>.Test' type=T of <root>.Test origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.Test<T of <root>.Test> declared in <root>.Test.test' type=<root>.Test<T of <root>.Test> origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-x> (): T of <root>.Inv declared in <root>.Inv'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Inv visibility:private [final]' type=T of <root>.Inv origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Inv<T of <root>.Inv> declared in <root>.Inv.<get-x>' type=<root>.Inv<T of <root>.Inv> origin=null
|
||||
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>.J
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type: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>.J
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$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>.J
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:Test_1 modality:FINAL visibility:public superTypes:[<root>.JavaClass1<TT of <root>.Test_1>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test_1<TT of <root>.Test_1>
|
||||
TYPE_PARAMETER name:TT index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
CONSTRUCTOR visibility:public <> (x:TT of <root>.Test_1) returnType:<root>.Test_1<TT of <root>.Test_1> [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:TT of <root>.Test_1
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.JavaClass1'
|
||||
<T>: TT of <root>.Test_1
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test_1 modality:FINAL visibility:public superTypes:[<root>.JavaClass1<TT of <root>.Test_1>]'
|
||||
PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:TT of <root>.Test_1 visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: TT of <root>.Test_1 declared in <root>.Test_1.<init>' type=TT of <root>.Test_1 origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Test_1<TT of <root>.Test_1>) returnType:TT of <root>.Test_1
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test_1<TT of <root>.Test_1>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-x> (): TT of <root>.Test_1 declared in <root>.Test_1'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:TT of <root>.Test_1 visibility:private [final]' type=TT of <root>.Test_1 origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Test_1<TT of <root>.Test_1> declared in <root>.Test_1.<get-x>' type=<root>.Test_1<TT of <root>.Test_1> origin=null
|
||||
FUN name:test visibility:public modality:FINAL <> ($this:<root>.Test_1<TT of <root>.Test_1>, b:<root>.JavaClass1.B<TT of <root>.Test_1>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test_1<TT of <root>.Test_1>
|
||||
VALUE_PARAMETER name:b index:0 type:<root>.JavaClass1.B<TT of <root>.Test_1>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun output (x: @[EnhancedNullability] T of <root>.JavaClass1): kotlin.Unit declared in <root>.JavaClass1.B' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'b: <root>.JavaClass1.B<TT of <root>.Test_1> declared in <root>.Test_1.test' type=<root>.JavaClass1.B<TT of <root>.Test_1> origin=null
|
||||
x: CALL 'public final fun <get-x> (): TT of <root>.Test_1 declared in <root>.Test_1' type=TT of <root>.Test_1 origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.Test_1<TT of <root>.Test_1> declared in <root>.Test_1.test' type=<root>.Test_1<TT of <root>.Test_1> origin=null
|
||||
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>.JavaClass1
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type: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>.JavaClass1
|
||||
$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>.JavaClass1
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:Test_2 modality:FINAL visibility:public superTypes:[<root>.JavaClass2<TT of <root>.Test_2, <root>.Inv<TT of <root>.Test_2>>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test_2<TT of <root>.Test_2>
|
||||
TYPE_PARAMETER name:TT index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Test_2<TT of <root>.Test_2> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.JavaClass2'
|
||||
<T>: TT of <root>.Test_2
|
||||
<R>: <root>.Inv<TT of <root>.Test_2>
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test_2 modality:FINAL visibility:public superTypes:[<root>.JavaClass2<TT of <root>.Test_2, <root>.Inv<TT of <root>.Test_2>>]'
|
||||
FUN name:process visibility:public modality:FINAL <> ($this:<root>.Test_2<TT of <root>.Test_2>, b:<root>.JavaClass2.B<TT of <root>.Test_2, <root>.Inv<TT of <root>.Test_2>>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Test_2<TT of <root>.Test_2>
|
||||
VALUE_PARAMETER name:b index:0 type:<root>.JavaClass2.B<TT of <root>.Test_2, <root>.Inv<TT of <root>.Test_2>>
|
||||
BLOCK_BODY
|
||||
CALL 'public abstract fun output (output: @[EnhancedNullability] R of <root>.JavaClass2): kotlin.Unit declared in <root>.JavaClass2.B' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'b: <root>.JavaClass2.B<TT of <root>.Test_2, <root>.Inv<TT of <root>.Test_2>> declared in <root>.Test_2.process' type=<root>.JavaClass2.B<TT of <root>.Test_2, <root>.Inv<TT of <root>.Test_2>> origin=null
|
||||
output: CONSTRUCTOR_CALL 'public constructor <init> (x: T of <root>.Inv) declared in <root>.Inv' type=<root>.Inv<TT of <root>.Test_2> origin=null
|
||||
<class: T>: TT of <root>.Test_2
|
||||
x: CALL 'public abstract fun element (): @[EnhancedNullability] T of <root>.JavaClass2 declared in <root>.JavaClass2.B' type=@[EnhancedNullability] TT of <root>.Test_2 origin=null
|
||||
$this: GET_VAR 'b: <root>.JavaClass2.B<TT of <root>.Test_2, <root>.Inv<TT of <root>.Test_2>> declared in <root>.Test_2.process' type=<root>.JavaClass2.B<TT of <root>.Test_2, <root>.Inv<TT of <root>.Test_2>> origin=null
|
||||
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>.JavaClass2
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type: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>.JavaClass2
|
||||
$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>.JavaClass2
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test_3 visibility:public modality:FINAL <R> (jb:<root>.JavaClass1.B<R of <root>.test_3>, r:R of <root>.test_3) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
VALUE_PARAMETER name:jb index:0 type:<root>.JavaClass1.B<R of <root>.test_3>
|
||||
VALUE_PARAMETER name:r index:1 type:R of <root>.test_3
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun output (x: @[EnhancedNullability] T of <root>.JavaClass1): kotlin.Unit declared in <root>.JavaClass1.B' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'jb: <root>.JavaClass1.B<R of <root>.test_3> declared in <root>.test_3' type=<root>.JavaClass1.B<R of <root>.test_3> origin=null
|
||||
x: GET_VAR 'r: R of <root>.test_3 declared in <root>.test_3' type=R of <root>.test_3 origin=null
|
||||
|
||||
+33
-7
@@ -1,21 +1,47 @@
|
||||
// FIR_IDENTICAL
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// ISSUE: KT-57022
|
||||
|
||||
// MUTE_SIGNATURE_COMPARISON_K2: ANY
|
||||
// ^ KT-57022
|
||||
|
||||
// FILE: J.java
|
||||
// FILE: JavaClass1.java
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class J<T extends @Nullable Object> {
|
||||
public class JavaClass1<T extends @Nullable Object> {
|
||||
public class A {
|
||||
public void output(T x) {}
|
||||
}
|
||||
public class B extends A {}
|
||||
public class B extends A {
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: JavaClass2.java
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class JavaClass2<T extends @Nullable Object, R extends @Nullable Object> {
|
||||
|
||||
public abstract class A {
|
||||
public abstract void output(R output);
|
||||
}
|
||||
|
||||
public abstract class B extends A {
|
||||
public abstract T element();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
class Test<T>(val x: T) : J<T>() {
|
||||
class Inv<T>(val x: T)
|
||||
|
||||
class Test_1<TT>(val x: TT) : JavaClass1<TT>() {
|
||||
fun test(b: B) { b.output(x) }
|
||||
}
|
||||
|
||||
class Test_2<TT> : JavaClass2<TT, Inv<TT>>() {
|
||||
fun process(b: B) {
|
||||
b.output(Inv(b.element()))
|
||||
}
|
||||
}
|
||||
|
||||
fun <R> test_3(jb: JavaClass1<R>.B, r: R) {
|
||||
jb.output(r)
|
||||
}
|
||||
|
||||
+33
-3
@@ -1,6 +1,6 @@
|
||||
class Test<T : Any?> : J<T> {
|
||||
class Inv<T : Any?> {
|
||||
constructor(x: T) /* primary */ {
|
||||
super/*J*/<T>()
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
@@ -9,8 +9,38 @@ class Test<T : Any?> : J<T> {
|
||||
field = x
|
||||
get
|
||||
|
||||
fun test(b: B<T>) {
|
||||
}
|
||||
|
||||
class Test_1<TT : Any?> : JavaClass1<TT> {
|
||||
constructor(x: TT) /* primary */ {
|
||||
super/*JavaClass1*/<TT>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val x: TT
|
||||
field = x
|
||||
get
|
||||
|
||||
fun test(b: B<TT>) {
|
||||
b.output(x = <this>.<get-x>())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Test_2<TT : Any?> : JavaClass2<TT, Inv<TT>> {
|
||||
constructor() /* primary */ {
|
||||
super/*JavaClass2*/<TT, Inv<TT>>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun process(b: B<TT, Inv<TT>>) {
|
||||
b.output(output = Inv<TT>(x = b.element()))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <R : Any?> test_3(jb: B<R>, r: R) {
|
||||
jb.output(x = r)
|
||||
}
|
||||
|
||||
+54
-14
@@ -1,25 +1,65 @@
|
||||
// CHECK:
|
||||
// Mangled name: Test
|
||||
// Public signature: /Test|null[0]
|
||||
class Test<T : Any?> : J<T> {
|
||||
// Mangled name: Inv
|
||||
// Public signature: /Inv|null[0]
|
||||
class Inv<T : Any?> {
|
||||
// CHECK:
|
||||
// Mangled name: Test{}x
|
||||
// Public signature: /Test.x|-8060530855978347579[0]
|
||||
// Mangled name: Inv{}x
|
||||
// Public signature: /Inv.x|-8060530855978347579[0]
|
||||
val x: T
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Test#<get-x>(){}1:0
|
||||
// Public signature: /Test.x.<get-x>|-8893883356128097563[0]
|
||||
// Mangled name: Inv#<get-x>(){}1:0
|
||||
// Public signature: /Inv.x.<get-x>|-8893883356128097563[0]
|
||||
get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Test#<init>(1:0){}
|
||||
// Public signature: /Test.<init>|-8731461708390519279[0]
|
||||
// Mangled name: Inv#<init>(1:0){}
|
||||
// Public signature: /Inv.<init>|-8731461708390519279[0]
|
||||
constructor(x: T) /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Test#test(J.B<1:0>){}
|
||||
// Public signature: /Test.test|7386642793853999047[0]
|
||||
fun test(b: B<T>): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Test_1
|
||||
// Public signature: /Test_1|null[0]
|
||||
class Test_1<TT : Any?> : JavaClass1<TT> {
|
||||
// CHECK:
|
||||
// Mangled name: Test_1{}x
|
||||
// Public signature: /Test_1.x|-8060530855978347579[0]
|
||||
val x: TT
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Test_1#<get-x>(){}1:0
|
||||
// Public signature: /Test_1.x.<get-x>|-8893883356128097563[0]
|
||||
get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Test_1#<init>(1:0){}
|
||||
// Public signature: /Test_1.<init>|-8731461708390519279[0]
|
||||
constructor(x: TT) /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Test_1#test(JavaClass1.B<1:0>){}
|
||||
// Public signature: /Test_1.test|-4347685660863074857[0]
|
||||
fun test(b: B<TT>): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Test_2
|
||||
// Public signature: /Test_2|null[0]
|
||||
class Test_2<TT : Any?> : JavaClass2<TT, Inv<TT>> {
|
||||
// CHECK:
|
||||
// Mangled name: Test_2#<init>(){}
|
||||
// Public signature: /Test_2.<init>|-5645683436151566731[0]
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Test_2#process(JavaClass2.B<1:0,Inv<1:0>>){}
|
||||
// Public signature: /Test_2.process|4196267472785317094[0]
|
||||
fun process(b: B<TT, Inv<TT>>): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test_3(JavaClass1.B<0:0>;0:0){0§<kotlin.Any?>}
|
||||
// Public signature: /test_3|8017402258673595148[0]
|
||||
fun <R : Any?> test_3(jb: B<R>, r: R): Unit
|
||||
|
||||
@@ -78,7 +78,7 @@ class Derived1<T : Any?> : Base<T> {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Derived1#<get-bar>(){}1:0
|
||||
// Public signature: /Derived1.bar.<get-bar>|7899956589744407340[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: Derived1#<get-bar>(){}
|
||||
// Public signature: /Derived1.bar.<get-bar>|6880642144337645699[0]
|
||||
override get
|
||||
@@ -95,7 +95,7 @@ class Derived1<T : Any?> : Base<T> {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Derived1#foo(0:0){0§<kotlin.Any?>}1:0
|
||||
// Public signature: /Derived1.foo|8673945311830780726[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: Derived1#foo(0:0){0§<kotlin.Any?>}
|
||||
// Public signature: /Derived1.foo|-6838606926256314363[0]
|
||||
override fun <Y : Any?> foo(y: Y): T
|
||||
@@ -107,7 +107,7 @@ class Derived1<T : Any?> : Base<T> {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Derived1#<get-x>(){}1:0
|
||||
// Public signature: /Derived1.x.<get-x>|-8893883356128097563[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: Derived1#<get-x>(){}
|
||||
// Public signature: /Derived1.x.<get-x>|1482705010654679335[0]
|
||||
/* fake */ override get(): T
|
||||
@@ -119,7 +119,7 @@ class Derived1<T : Any?> : Base<T> {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Derived1#<get-exn>@0:0(){0§<kotlin.Any?>}1:0
|
||||
// Public signature: /Derived1.exn.<get-exn>|6217753676739394662[0]
|
||||
// CHECK JS_IR:
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: Derived1#<get-exn>@0:0(){0§<kotlin.Any?>}
|
||||
// Public signature: /Derived1.exn.<get-exn>|-202876889853335253[0]
|
||||
override get(): T
|
||||
|
||||
Reference in New Issue
Block a user