FIR2IR: Fix mapping for intersection overrides of deserialized functions
This commit is contained in:
+6
@@ -13712,6 +13712,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/fir/ExtensionAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FakeOverrideBuilder.kt")
|
||||
public void testFakeOverrideBuilder() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/FakeOverrideBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("IrBuiltIns.kt")
|
||||
public void testIrBuiltIns() throws Exception {
|
||||
|
||||
+1
-1
@@ -1026,7 +1026,7 @@ class Fir2IrDeclarationStorage(
|
||||
val irFunction = fir.convertWithOffsets { startOffset, endOffset ->
|
||||
symbolTable.declareSimpleFunction(signature, { symbol }) {
|
||||
val isFakeOverride =
|
||||
firFunctionSymbol is FirNamedFunctionSymbol && fir.isSubstitutionOverride &&
|
||||
firFunctionSymbol is FirNamedFunctionSymbol && fir.isSubstitutionOrIntersectionOverride &&
|
||||
firFunctionSymbol.dispatchReceiverClassOrNull() !=
|
||||
firFunctionSymbol.originalForSubstitutionOverride?.dispatchReceiverClassOrNull()
|
||||
Fir2IrLazySimpleFunction(
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: FakeOverrideBuilder_lib.kt
|
||||
|
||||
class IrPropertySymbolImpl :
|
||||
IrBindableSymbolBase<IrProperty>(),
|
||||
IrPropertySymbol
|
||||
|
||||
abstract class IrBindableSymbolBase<B : IrSymbolOwner> :
|
||||
IrBindableSymbol<B>, IrSymbolBase() {
|
||||
|
||||
private var _owner: B? = null
|
||||
override val owner: B
|
||||
get() = _owner ?: throw IllegalStateException("")
|
||||
|
||||
override fun bind(owner: B) {
|
||||
if (_owner == null) {
|
||||
_owner = owner
|
||||
} else {
|
||||
throw IllegalStateException("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class IrSymbolBase : IrSymbol
|
||||
|
||||
interface IrPropertySymbol : IrBindableSymbol<IrProperty>
|
||||
|
||||
interface IrBindableSymbol<B : IrSymbolOwner> : IrSymbol {
|
||||
override val owner: B
|
||||
|
||||
fun bind(owner: B)
|
||||
}
|
||||
|
||||
interface IrSymbol {
|
||||
val owner: IrSymbolOwner
|
||||
}
|
||||
|
||||
interface IrSymbolOwner {
|
||||
val symbol: IrSymbol
|
||||
}
|
||||
|
||||
class IrProperty(override val symbol: IrPropertySymbol, val name: String) : IrSymbolOwner
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: FakeOverrideBuilder_main.kt
|
||||
|
||||
fun link(declaration: IrSymbolOwner) {
|
||||
val tempSymbol = IrPropertySymbolImpl()
|
||||
tempSymbol.bind(declaration as IrProperty)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val symbol = IrPropertySymbolImpl()
|
||||
val property = IrProperty(symbol, "OK")
|
||||
symbol.bind(property)
|
||||
link(property)
|
||||
return symbol.owner.name
|
||||
}
|
||||
@@ -271,12 +271,12 @@ FILE fqName:<root> fileName:/MultiList.kt
|
||||
FUN FAKE_OVERRIDE name:parallelStream visibility:public modality:OPEN <> ($this:java.util.Collection<E of java.util.Collection>) returnType:@[FlexibleNullability] java.util.stream.Stream<<root>.Some<T of <root>.SomeList>?> [fake_override]
|
||||
overridden:
|
||||
public open fun parallelStream (): @[FlexibleNullability] java.util.stream.Stream<<root>.Some<T of <root>.MyList>?> [fake_override] declared in <root>.MyList
|
||||
public open fun parallelStream (): @[FlexibleNullability] java.util.stream.Stream<@[FlexibleNullability] E of java.util.ArrayList?> declared in java.util.ArrayList
|
||||
public open fun parallelStream (): @[FlexibleNullability] java.util.stream.Stream<@[FlexibleNullability] E of java.util.ArrayList?> [fake_override] declared in java.util.ArrayList
|
||||
$this: VALUE_PARAMETER name:<this> type:java.util.Collection<E of java.util.Collection>
|
||||
FUN FAKE_OVERRIDE name:stream visibility:public modality:OPEN <> ($this:java.util.Collection<E of java.util.Collection>) returnType:@[FlexibleNullability] java.util.stream.Stream<<root>.Some<T of <root>.SomeList>?> [fake_override]
|
||||
overridden:
|
||||
public open fun stream (): @[FlexibleNullability] java.util.stream.Stream<<root>.Some<T of <root>.MyList>?> [fake_override] declared in <root>.MyList
|
||||
public open fun stream (): @[FlexibleNullability] java.util.stream.Stream<@[FlexibleNullability] E of java.util.ArrayList?> declared in java.util.ArrayList
|
||||
public open fun stream (): @[FlexibleNullability] java.util.stream.Stream<@[FlexibleNullability] E of java.util.ArrayList?> [fake_override] declared in java.util.ArrayList
|
||||
$this: VALUE_PARAMETER name:<this> type:java.util.Collection<E of java.util.Collection>
|
||||
FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.lang.Iterable<T of java.lang.Iterable>, p0:java.util.function.Consumer<in <root>.Some<T of <root>.SomeList>?>?) returnType:kotlin.Unit [fake_override]
|
||||
overridden:
|
||||
@@ -287,18 +287,18 @@ FILE fqName:<root> fileName:/MultiList.kt
|
||||
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 [operator] declared in kotlin.Any
|
||||
public open fun equals (p0: @[FlexibleNullability] kotlin.Any?): kotlin.Boolean [operator] declared in java.util.ArrayList
|
||||
public open fun equals (p0: @[FlexibleNullability] kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in java.util.ArrayList
|
||||
$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 kotlin.Any
|
||||
public open fun hashCode (): kotlin.Int declared in java.util.ArrayList
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in java.util.ArrayList
|
||||
$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 kotlin.Any
|
||||
public open fun toString (): @[FlexibleNullability] kotlin.String declared in java.util.ArrayList
|
||||
public open fun toString (): @[FlexibleNullability] kotlin.String [fake_override] declared in java.util.ArrayList
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:elementData visibility:public/*package*/ modality:OPEN <> ($this:java.util.ArrayList<E of java.util.ArrayList>, p0:kotlin.Int) returnType:<root>.Some<T of <root>.SomeList>? [fake_override]
|
||||
overridden:
|
||||
@@ -493,18 +493,18 @@ FILE fqName:<root> fileName:/MultiList.kt
|
||||
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 [operator] declared in kotlin.Any
|
||||
public open fun equals (p0: @[FlexibleNullability] kotlin.Any?): kotlin.Boolean [operator] declared in java.util.ArrayList
|
||||
public open fun equals (p0: @[FlexibleNullability] kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in java.util.ArrayList
|
||||
$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 kotlin.Any
|
||||
public open fun hashCode (): kotlin.Int declared in java.util.ArrayList
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in java.util.ArrayList
|
||||
$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 kotlin.Any
|
||||
public open fun toString (): @[FlexibleNullability] kotlin.String declared in java.util.ArrayList
|
||||
public open fun toString (): @[FlexibleNullability] kotlin.String [fake_override] declared in java.util.ArrayList
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:elementData visibility:public/*package*/ modality:OPEN <> ($this:java.util.ArrayList<E of java.util.ArrayList>, p0:kotlin.Int) returnType:<root>.Some<kotlin.String>? [fake_override]
|
||||
overridden:
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ FILE fqName:<root> fileName:/builtinMap.kt
|
||||
$receiver: VALUE_PARAMETER name:<this> type:java.util.LinkedHashMap<K1 of <root>.plus?, V1 of <root>.plus?>
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public open fun put (p0: @[FlexibleNullability] K of java.util.LinkedHashMap?, p1: @[FlexibleNullability] V of java.util.LinkedHashMap?): @[FlexibleNullability] V of java.util.LinkedHashMap? declared in java.util.LinkedHashMap' type=V1 of <root>.plus? origin=null
|
||||
CALL 'public open fun put (p0: @[FlexibleNullability] K of java.util.LinkedHashMap?, p1: @[FlexibleNullability] V of java.util.LinkedHashMap?): @[FlexibleNullability] V of java.util.LinkedHashMap? [fake_override] declared in java.util.LinkedHashMap' type=V1 of <root>.plus? origin=null
|
||||
$this: GET_VAR '<this>: java.util.LinkedHashMap<K1 of <root>.plus?, V1 of <root>.plus?> declared in <root>.plus.<anonymous>' type=java.util.LinkedHashMap<K1 of <root>.plus?, V1 of <root>.plus?> origin=null
|
||||
p0: CALL 'public final fun <get-first> (): A of kotlin.Pair declared in kotlin.Pair' type=K1 of <root>.plus origin=GET_PROPERTY
|
||||
$this: GET_VAR 'pair: kotlin.Pair<K1 of <root>.plus, V1 of <root>.plus> declared in <root>.plus' type=kotlin.Pair<K1 of <root>.plus, V1 of <root>.plus> origin=null
|
||||
|
||||
+6
@@ -13712,6 +13712,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/fir/ExtensionAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FakeOverrideBuilder.kt")
|
||||
public void testFakeOverrideBuilder() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/FakeOverrideBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("IrBuiltIns.kt")
|
||||
public void testIrBuiltIns() throws Exception {
|
||||
|
||||
+6
@@ -13712,6 +13712,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/fir/ExtensionAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FakeOverrideBuilder.kt")
|
||||
public void testFakeOverrideBuilder() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/FakeOverrideBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("IrBuiltIns.kt")
|
||||
public void testIrBuiltIns() throws Exception {
|
||||
|
||||
+5
@@ -12052,6 +12052,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/fir/ExtensionAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FakeOverrideBuilder.kt")
|
||||
public void testFakeOverrideBuilder() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/FakeOverrideBuilder.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IrBuiltIns.kt")
|
||||
public void testIrBuiltIns() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||
|
||||
Reference in New Issue
Block a user