[FakeOverrideBuilder] Fix referencing a local type from a return type

Copying tree part happens in two stages.
1. Collect all symbols to copy and create new version of them
2. Do copy tree, replacing collected symbols

For f/o builder 1-st stage traversed more nodes, than seconds.
This led to unbound symbols in tree.

^KT-65273 Fixed
This commit is contained in:
Pavel Kunyavskiy
2024-02-06 15:15:19 +01:00
committed by Space Team
parent 90db7cd685
commit 831ef0f909
19 changed files with 509 additions and 22 deletions
@@ -552,6 +552,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
runTest("compiler/testData/ir/irText/declarations/kt65236.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("kt65432.kt")
public void testKt65432() throws Exception {
@@ -552,6 +552,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
runTest("compiler/testData/ir/irText/declarations/kt65236.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("kt65432.kt")
public void testKt65432() throws Exception {
@@ -5,10 +5,11 @@
package org.jetbrains.kotlin.ir.overrides
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrOverridableMember
import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.*
@@ -98,6 +99,17 @@ class CopyIrTreeWithSymbolsForFakeOverrides(
private val typeArguments: Map<IrTypeParameterSymbol, IrType>,
descriptorsRemapper: DescriptorsRemapper
) : DeepCopySymbolRemapper(descriptorsRemapper) {
// We need to avoid visiting parts of the tree that would not be visited by [FakeOverrideCopier]
// Otherwise, we can record symbols inside them for rebinding, but would not actually copy them.
// Normally, this is not important, as these local symbols would not be used anyway
// But they can be used in return values of functions/accessors if it is effectively a private declaration,
// e.g. public declaration inside a private class.
override fun visitField(declaration: IrField) {} // don't visit property backing field
override fun visitBlockBody(body: IrBlockBody) {} // don't visit function body and parameter default values
override fun visitExpressionBody(body: IrExpressionBody) {} // don't visit function body and parameter default values
override fun getReferencedClassifier(symbol: IrClassifierSymbol): IrClassifierSymbol {
val result = super.getReferencedClassifier(symbol)
if (result !is IrTypeParameterSymbol)
@@ -53,10 +53,6 @@ open class DeepCopySymbolRemapper(
element.acceptChildrenVoid(this)
}
override fun visitCall(expression: IrCall) {
expression.acceptChildrenVoid(this)
}
protected inline fun <D : DeclarationDescriptor, B : IrSymbolOwner, reified S : IrBindableSymbol<D, B>>
remapSymbol(map: MutableMap<S, S>, owner: B, createNewSymbol: (S) -> S) {
val symbol = owner.symbol as S
@@ -67,98 +63,98 @@ open class DeepCopySymbolRemapper(
remapSymbol(classes, declaration) {
IrClassSymbolImpl(descriptorsRemapper.remapDeclaredClass(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitClass(declaration)
}
override fun visitScript(declaration: IrScript) {
remapSymbol(scripts, declaration) {
IrScriptSymbolImpl(descriptorsRemapper.remapDeclaredScript(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitScript(declaration)
}
override fun visitConstructor(declaration: IrConstructor) {
remapSymbol(constructors, declaration) {
IrConstructorSymbolImpl(descriptorsRemapper.remapDeclaredConstructor(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitConstructor(declaration)
}
override fun visitEnumEntry(declaration: IrEnumEntry) {
remapSymbol(enumEntries, declaration) {
IrEnumEntrySymbolImpl(descriptorsRemapper.remapDeclaredEnumEntry(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitEnumEntry(declaration)
}
override fun visitExternalPackageFragment(declaration: IrExternalPackageFragment) {
remapSymbol(externalPackageFragments, declaration) {
IrExternalPackageFragmentSymbolImpl(descriptorsRemapper.remapDeclaredExternalPackageFragment(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitExternalPackageFragment(declaration)
}
override fun visitField(declaration: IrField) {
remapSymbol(fields, declaration) {
IrFieldSymbolImpl(descriptorsRemapper.remapDeclaredField(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitField(declaration)
}
override fun visitFile(declaration: IrFile) {
remapSymbol(files, declaration) {
IrFileSymbolImpl(descriptorsRemapper.remapDeclaredFilePackageFragment(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitFile(declaration)
}
override fun visitSimpleFunction(declaration: IrSimpleFunction) {
remapSymbol(functions, declaration) {
IrSimpleFunctionSymbolImpl(descriptorsRemapper.remapDeclaredSimpleFunction(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitSimpleFunction(declaration)
}
override fun visitProperty(declaration: IrProperty) {
remapSymbol(properties, declaration) {
IrPropertySymbolImpl(descriptorsRemapper.remapDeclaredProperty(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitProperty(declaration)
}
override fun visitTypeParameter(declaration: IrTypeParameter) {
remapSymbol(typeParameters, declaration) {
IrTypeParameterSymbolImpl(descriptorsRemapper.remapDeclaredTypeParameter(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitTypeParameter(declaration)
}
override fun visitValueParameter(declaration: IrValueParameter) {
remapSymbol(valueParameters, declaration) {
IrValueParameterSymbolImpl(descriptorsRemapper.remapDeclaredValueParameter(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitValueParameter(declaration)
}
override fun visitVariable(declaration: IrVariable) {
remapSymbol(variables, declaration) {
IrVariableSymbolImpl(descriptorsRemapper.remapDeclaredVariable(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitVariable(declaration)
}
override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty) {
remapSymbol(localDelegatedProperties, declaration) {
IrLocalDelegatedPropertySymbolImpl(descriptorsRemapper.remapDeclaredLocalDelegatedProperty(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitLocalDelegatedProperty(declaration)
}
override fun visitTypeAlias(declaration: IrTypeAlias) {
remapSymbol(typeAliases, declaration) {
IrTypeAliasSymbolImpl(descriptorsRemapper.remapDeclaredTypeAlias(it.descriptor))
}
declaration.acceptChildrenVoid(this)
super.visitTypeAlias(declaration)
}
override fun visitBlock(expression: IrBlock) {
@@ -167,7 +163,7 @@ open class DeepCopySymbolRemapper(
IrReturnableBlockSymbolImpl()
}
}
expression.acceptChildrenVoid(this)
super.visitBlock(expression)
}
private fun <T : IrSymbol> Map<T, T>.getDeclared(symbol: T) =
@@ -0,0 +1,97 @@
FILE fqName:<root> fileName:/kt65273.kt
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
$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 kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
CLASS CLASS name:B modality:ABSTRACT visibility:private superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.B
CONSTRUCTOR visibility:public <> () returnType:<root>.A.B [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:ABSTRACT visibility:private superTypes:[kotlin.Any]'
PROPERTY name:s visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:s type:<root>.A.B.s.<no name provided> visibility:private [final]
EXPRESSION_BODY
BLOCK type=<root>.A.B.s.<no name provided> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.B.s.<no name provided>
CONSTRUCTOR visibility:public <> () returnType:<root>.A.B.s.<no name provided> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]'
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 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 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 kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.A.B.s.<no name provided>' type=<root>.A.B.s.<no name provided> origin=OBJECT_LITERAL
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-s> visibility:public modality:FINAL <> ($this:<root>.A.B) returnType:<root>.A.B.s.<no name provided>
correspondingProperty: PROPERTY name:s visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-s> (): <root>.A.B.s.<no name provided> declared in <root>.A.B'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:<root>.A.B.s.<no name provided> visibility:private [final]' type=<root>.A.B.s.<no name provided> origin=null
receiver: GET_VAR '<this>: <root>.A.B declared in <root>.A.B.<get-s>' type=<root>.A.B 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 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 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 kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:C modality:FINAL visibility:private superTypes:[<root>.A.B]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.C
CONSTRUCTOR visibility:public <> () returnType:<root>.A.C [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.A.B'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:private superTypes:[<root>.A.B]'
PROPERTY FAKE_OVERRIDE name:s visibility:public modality:FINAL [fake_override,val]
overridden:
public final s: <root>.A.B.s.<no name provided>
FUN FAKE_OVERRIDE name:<get-s> visibility:public modality:FINAL <> ($this:<root>.A.B) returnType:<root>.A.B.s.<no name provided> [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:s visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-s> (): <root>.A.B.s.<no name provided> declared in <root>.A.B
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
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>.A.B
$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>.A.B
$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>.A.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
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 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 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 kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -0,0 +1,41 @@
class A {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
private abstract class B {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
val s: <no name provided>
field = { // BLOCK
local class <no name provided> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
<no name provided>()
}
get
}
private class C : B {
constructor() /* primary */ {
super/*B*/()
/* <init>() */
}
}
}
@@ -0,0 +1,68 @@
// CHECK:
// Mangled name: A
// Public signature: /A|null[0]
class A {
// CHECK:
// Mangled name: A.B
// Public signature: /A.B|null[0]
private abstract class B {
// CHECK:
// Mangled name: A.B{}s
// Public signature: /A.B.s|7217541905509134881[0]
// Public signature debug description: {}s
val s: <no name provided>
// CHECK JS_IR NATIVE:
// Mangled name: A.B#<get-s>(){}
// Public signature: /A.B.s.<get-s>|-1662172381559511151[0]
// Public signature debug description: <get-s>(){}
// CHECK JVM_IR:
// Mangled name (compatible mode: false): A.B#<get-s>(){}A.B{}s.<no name provided>
// Mangled name (compatible mode: true): A.B#<get-s>(){}A.B.s.<no name provided>
// Public signature: /A.B.s.<get-s>|769786868112455262[0]
// Public signature debug description: <get-s>(){}A.B{}s.<no name provided>
get
// CHECK:
// Mangled name: A.B#<init>(){}
// Public signature: /A.B.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
}
// CHECK:
// Mangled name: A.C
// Public signature: /A.C|null[0]
private class C : B {
// CHECK:
// Mangled name: A.C#<init>(){}
// Public signature: /A.C.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: A.C{}s
// Public signature: /A.C.s|7217541905509134881[0]
// Public signature debug description: {}s
/* fake */ override val s: <no name provided>
// CHECK JS_IR NATIVE:
// Mangled name: A.C#<get-s>(){}
// Public signature: /A.C.s.<get-s>|-1662172381559511151[0]
// Public signature debug description: <get-s>(){}
// CHECK JVM_IR:
// Mangled name (compatible mode: false): A.C#<get-s>(){}A.B{}s.<no name provided>
// Mangled name (compatible mode: true): A.C#<get-s>(){}A.B.s.<no name provided>
// Public signature: /A.C.s.<get-s>|769786868112455262[0]
// Public signature debug description: <get-s>(){}A.B{}s.<no name provided>
/* fake */ override get(): <no name provided>
}
// CHECK:
// Mangled name: A#<init>(){}
// Public signature: /A.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
}
+97
View File
@@ -0,0 +1,97 @@
FILE fqName:<root> fileName:/kt65273.kt
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
$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 kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
CLASS CLASS name:B modality:ABSTRACT visibility:private superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.B
CONSTRUCTOR visibility:public <> () returnType:<root>.A.B [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:ABSTRACT visibility:private superTypes:[kotlin.Any]'
PROPERTY name:s visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.Any visibility:private [final]
EXPRESSION_BODY
BLOCK type=<root>.A.B.s.<no name provided> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.B.s.<no name provided>
CONSTRUCTOR visibility:public <> () returnType:<root>.A.B.s.<no name provided> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]'
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 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 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 kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.A.B.s.<no name provided>' type=<root>.A.B.s.<no name provided> origin=OBJECT_LITERAL
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-s> visibility:public modality:FINAL <> ($this:<root>.A.B) returnType:kotlin.Any
correspondingProperty: PROPERTY name:s visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-s> (): kotlin.Any declared in <root>.A.B'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null
receiver: GET_VAR '<this>: <root>.A.B declared in <root>.A.B.<get-s>' type=<root>.A.B 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 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 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 kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:C modality:FINAL visibility:private superTypes:[<root>.A.B]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.C
CONSTRUCTOR visibility:public <> () returnType:<root>.A.C [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.A.B'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:private superTypes:[<root>.A.B]'
PROPERTY FAKE_OVERRIDE name:s visibility:public modality:FINAL [fake_override,val]
overridden:
public final s: kotlin.Any
FUN FAKE_OVERRIDE name:<get-s> visibility:public modality:FINAL <> ($this:<root>.A.B) returnType:kotlin.Any [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:s visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-s> (): kotlin.Any declared in <root>.A.B
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
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>.A.B
$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>.A.B
$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>.A.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
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 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 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 kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
+10
View File
@@ -0,0 +1,10 @@
// SEPARATE_SIGNATURE_DUMP_FOR_K2
// ^ Different type of s - KT-65603
class A {
private abstract class B {
val s = object {}
}
private class C : B()
}
+41
View File
@@ -0,0 +1,41 @@
class A {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
private abstract class B {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
val s: Any
field = { // BLOCK
local class <no name provided> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
<no name provided>()
}
get
}
private class C : B {
constructor() /* primary */ {
super/*B*/()
/* <init>() */
}
}
}
@@ -0,0 +1,66 @@
// CHECK:
// Mangled name: A
// Public signature: /A|null[0]
class A {
// CHECK:
// Mangled name: A.B
// Public signature: /A.B|null[0]
private abstract class B {
// CHECK:
// Mangled name: A.B{}s
// Public signature: /A.B.s|7217541905509134881[0]
// Public signature debug description: {}s
val s: Any
// CHECK JVM_IR:
// Mangled name: A.B#<get-s>(){}kotlin.Any
// Public signature: /A.B.s.<get-s>|-6355491283316321221[0]
// Public signature debug description: <get-s>(){}kotlin.Any
// CHECK JS_IR NATIVE:
// Mangled name: A.B#<get-s>(){}
// Public signature: /A.B.s.<get-s>|-1662172381559511151[0]
// Public signature debug description: <get-s>(){}
get
// CHECK:
// Mangled name: A.B#<init>(){}
// Public signature: /A.B.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
}
// CHECK:
// Mangled name: A.C
// Public signature: /A.C|null[0]
private class C : B {
// CHECK:
// Mangled name: A.C#<init>(){}
// Public signature: /A.C.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: A.C{}s
// Public signature: /A.C.s|7217541905509134881[0]
// Public signature debug description: {}s
/* fake */ override val s: Any
// CHECK JVM_IR:
// Mangled name: A.C#<get-s>(){}kotlin.Any
// Public signature: /A.C.s.<get-s>|-6355491283316321221[0]
// Public signature debug description: <get-s>(){}kotlin.Any
// CHECK JS_IR NATIVE:
// Mangled name: A.C#<get-s>(){}
// Public signature: /A.C.s.<get-s>|-1662172381559511151[0]
// Public signature debug description: <get-s>(){}
/* fake */ override get(): Any
}
// CHECK:
// Mangled name: A#<init>(){}
// Public signature: /A.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
}
@@ -552,6 +552,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
runTest("compiler/testData/ir/irText/declarations/kt65236.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("kt65432.kt")
public void testKt65432() throws Exception {
@@ -423,6 +423,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase {
runTest("compiler/testData/ir/irText/declarations/kt52677.kt");
}
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@TestMetadata("localClassWithOverrides.kt")
public void testLocalClassWithOverrides() throws Exception {
runTest("compiler/testData/ir/irText/declarations/localClassWithOverrides.kt");
@@ -480,6 +480,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT
runTest("compiler/testData/ir/irText/declarations/kt52677.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("localClassWithOverrides.kt")
public void testLocalClassWithOverrides() throws Exception {
@@ -480,6 +480,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest {
runTest("compiler/testData/ir/irText/declarations/kt52677.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("localClassWithOverrides.kt")
public void testLocalClassWithOverrides() throws Exception {
@@ -480,6 +480,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest {
runTest("compiler/testData/ir/irText/declarations/kt52677.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("localClassWithOverrides.kt")
public void testLocalClassWithOverrides() throws Exception {
@@ -480,6 +480,12 @@ public class ClassicNativeIrTextTestGenerated extends AbstractClassicNativeIrTex
runTest("compiler/testData/ir/irText/declarations/kt52677.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("localClassWithOverrides.kt")
public void testLocalClassWithOverrides() throws Exception {
@@ -480,6 +480,12 @@ public class FirLightTreeNativeIrTextTestGenerated extends AbstractFirLightTreeN
runTest("compiler/testData/ir/irText/declarations/kt52677.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("localClassWithOverrides.kt")
public void testLocalClassWithOverrides() throws Exception {
@@ -480,6 +480,12 @@ public class FirPsiNativeIrTextTestGenerated extends AbstractFirPsiNativeIrTextT
runTest("compiler/testData/ir/irText/declarations/kt52677.kt");
}
@Test
@TestMetadata("kt65273.kt")
public void testKt65273() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt65273.kt");
}
@Test
@TestMetadata("localClassWithOverrides.kt")
public void testLocalClassWithOverrides() throws Exception {