[Fir2IR] Set correct module descriptors for builtins

^KT-64420
This commit is contained in:
Pavel Kunyavskiy
2024-01-03 11:09:20 +01:00
committed by Space Team
parent d665eb3575
commit 4080776fe3
17 changed files with 428 additions and 38 deletions
@@ -63,14 +63,14 @@ class Fir2IrDeclarationStorage(
) : Fir2IrComponents by components {
private val fragmentCache: ConcurrentHashMap<FqName, ExternalPackageFragments> = ConcurrentHashMap()
private val moduleDescriptorCache: ConcurrentHashMap<FirModuleData, FirModuleDescriptor> = ConcurrentHashMap()
private class ExternalPackageFragments(
val fragmentsForDependencies: ConcurrentHashMap<FirModuleData, IrExternalPackageFragment>,
val builtinFragmentsForDependencies: ConcurrentHashMap<FirModuleData, IrExternalPackageFragment>,
val fragmentForPrecompiledBinaries: IrExternalPackageFragment
)
private val builtInsFragmentCache: ConcurrentHashMap<FqName, IrExternalPackageFragment> = ConcurrentHashMap()
private val fileCache: ConcurrentHashMap<FirFile, IrFile> = ConcurrentHashMap()
private val scriptCache: ConcurrentHashMap<FirScript, IrScript> = ConcurrentHashMap()
@@ -183,40 +183,42 @@ class Fir2IrDeclarationStorage(
moduleData: FirModuleData,
firOrigin: FirDeclarationOrigin = FirDeclarationOrigin.Library
): IrExternalPackageFragment {
val fragments = fragmentCache.getOrPut(fqName) {
val fragmentForPrecompiledBinaries = callablesGenerator.createExternalPackageFragment(fqName, sourceModuleDescriptor)
ExternalPackageFragments(ConcurrentHashMap(), fragmentForPrecompiledBinaries)
}
// Make sure that external package fragments have a different module descriptor. The module descriptors are compared
// to determine if objects need regeneration because they are from different modules.
// But keep original module descriptor for the fragments coming from parts compiled on the previous incremental step
return when (firOrigin) {
FirDeclarationOrigin.Precompiled -> fragments.fragmentForPrecompiledBinaries
else -> fragments.fragmentsForDependencies.getOrPut(moduleData) {
val moduleDescriptor = FirModuleDescriptor.createDependencyModuleDescriptor(
moduleData,
sourceModuleDescriptor.builtIns
)
callablesGenerator.createExternalPackageFragment(fqName, moduleDescriptor)
}
}
return getIrExternalOrBuiltInsPackageFragment(fqName, moduleData, firOrigin, false)
}
private fun getIrExternalOrBuiltInsPackageFragment(
fqName: FqName,
moduleData: FirModuleData,
firOrigin: FirDeclarationOrigin,
allowBuiltins: Boolean
): IrExternalPackageFragment {
val isBuiltIn = fqName in BUILT_INS_PACKAGE_FQ_NAMES
return when (isBuiltIn) {
true -> getIrBuiltInsPackageFragment(fqName)
false -> getIrExternalPackageFragment(fqName, moduleData, firOrigin)
val isBuiltIn = allowBuiltins && fqName in BUILT_INS_PACKAGE_FQ_NAMES
val fragments = fragmentCache.getOrPut(fqName) {
val fragmentForPrecompiledBinaries = callablesGenerator.createExternalPackageFragment(fqName, sourceModuleDescriptor)
ExternalPackageFragments(ConcurrentHashMap(), ConcurrentHashMap(), fragmentForPrecompiledBinaries)
}
}
private fun getIrBuiltInsPackageFragment(fqName: FqName): IrExternalPackageFragment {
return builtInsFragmentCache.getOrPut(fqName) {
callablesGenerator.createExternalPackageFragment(FirBuiltInsPackageFragment(fqName, sourceModuleDescriptor))
// Make sure that external package fragments have a different module descriptor. The module descriptors are compared
// to determine if objects need regeneration because they are from different modules.
// But keep the original module descriptor for the fragments coming from parts compiled on the previous incremental step
return when (firOrigin) {
FirDeclarationOrigin.Precompiled -> fragments.fragmentForPrecompiledBinaries
else -> {
val moduleDescriptor = moduleDescriptorCache.getOrPut(moduleData) {
FirModuleDescriptor.createDependencyModuleDescriptor(
moduleData,
sourceModuleDescriptor.builtIns
)
}
if (isBuiltIn) {
fragments.builtinFragmentsForDependencies.getOrPut(moduleData) {
callablesGenerator.createExternalPackageFragment(FirBuiltInsPackageFragment(fqName, moduleDescriptor))
}
} else {
fragments.fragmentsForDependencies.getOrPut(moduleData) {
callablesGenerator.createExternalPackageFragment(fqName, moduleDescriptor)
}
}
}
}
}
@@ -1418,16 +1420,13 @@ class Fir2IrDeclarationStorage(
return classifierStorage.findIrClass(parentLookupTag)
}
val parentPackage = when (firBasedSymbol) {
is FirCallableSymbol<*> -> {
getIrExternalPackageFragment(packageFqName, firBasedSymbol.moduleData, firOrigin)
}
else -> {
// TODO: All classes from BUILT_INS_PACKAGE_FQ_NAMES are considered built-ins now,
// which is not exact and can lead to some problems
getIrExternalOrBuiltInsPackageFragment(packageFqName, firBasedSymbol.moduleData, firOrigin)
}
}
// TODO: All classes from BUILT_INS_PACKAGE_FQ_NAMES are considered built-ins now,
// which is not exact and can lead to some problems
val parentPackage = getIrExternalOrBuiltInsPackageFragment(
packageFqName, firBasedSymbol.moduleData, firOrigin,
allowBuiltins = firBasedSymbol !is FirCallableSymbol<*>
)
/**
* In `allowNonCachedDeclarations` mode there is a situation possible when we get source declaration
@@ -492,6 +492,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
@@ -492,6 +492,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
@@ -0,0 +1,96 @@
FILE fqName:<root> fileName:/internalStdlibOverride.kt
CLASS CLASS name:MyMap modality:FINAL visibility:public superTypes:[kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyMap
CONSTRUCTOR visibility:public <> () returnType:<root>.MyMap [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'protected constructor <init> () declared in kotlin.collections.AbstractMap'
<K>: kotlin.Int
<V>: kotlin.Int
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyMap modality:FINAL visibility:public superTypes:[kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>]'
PROPERTY name:entries visibility:public modality:OPEN [val]
overridden:
public abstract entries: kotlin.collections.Set<kotlin.collections.Map.Entry<K of kotlin.collections.AbstractMap, V of kotlin.collections.AbstractMap>>
FIELD PROPERTY_BACKING_FIELD name:entries type:kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> visibility:private [final]
EXPRESSION_BODY
CALL 'public final fun emptySet <T> (): kotlin.collections.Set<T of kotlin.collections.emptySet> declared in kotlin.collections' type=kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> origin=null
<T>: kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-entries> visibility:public modality:OPEN <> ($this:<root>.MyMap) returnType:kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>>
correspondingProperty: PROPERTY name:entries visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-entries> (): kotlin.collections.Set<kotlin.collections.Map.Entry<K of kotlin.collections.AbstractMap, V of kotlin.collections.AbstractMap>> declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:<root>.MyMap
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-entries> (): kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> declared in <root>.MyMap'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:entries type:kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> visibility:private [final]' type=kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> origin=null
receiver: GET_VAR '<this>: <root>.MyMap declared in <root>.MyMap.<get-entries>' type=<root>.MyMap origin=null
FUN name:containsEntry visibility:internal modality:FINAL <> ($this:<root>.MyMap, entry:kotlin.collections.Map.Entry<*, *>?) returnType:kotlin.Boolean
$this: VALUE_PARAMETER name:<this> type:<root>.MyMap
VALUE_PARAMETER name:entry index:0 type:kotlin.collections.Map.Entry<*, *>?
BLOCK_BODY
RETURN type=kotlin.Nothing from='internal final fun containsEntry (entry: kotlin.collections.Map.Entry<*, *>?): kotlin.Boolean declared in <root>.MyMap'
CONST Boolean type=kotlin.Boolean value=false
FUN FAKE_OVERRIDE name:containsKey visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>, key:kotlin.Int) returnType:kotlin.Boolean [fake_override]
overridden:
public open fun containsKey (key: K of kotlin.collections.AbstractMap): kotlin.Boolean declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:key index:0 type:kotlin.Int
FUN FAKE_OVERRIDE name:containsValue visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>, value:kotlin.Int) returnType:kotlin.Boolean [fake_override]
overridden:
public open fun containsValue (value: V of kotlin.collections.AbstractMap): kotlin.Boolean declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:value index:0 type:kotlin.Int
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>, key:kotlin.Int) returnType:kotlin.Int? [fake_override,operator]
overridden:
public open fun get (key: K of kotlin.collections.AbstractMap): V of kotlin.collections.AbstractMap? declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:key index:0 type:kotlin.Int
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.Boolean [fake_override]
overridden:
public open fun isEmpty (): kotlin.Boolean declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val]
overridden:
public open keys: kotlin.collections.Set<K of kotlin.collections.AbstractMap>
FUN FAKE_OVERRIDE name:<get-keys> visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.collections.Set<kotlin.Int> [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val]
overridden:
public open fun <get-keys> (): kotlin.collections.Set<K of kotlin.collections.AbstractMap> declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val]
overridden:
public open size: kotlin.Int
FUN FAKE_OVERRIDE name:<get-size> visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.Int [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val]
overridden:
public open fun <get-size> (): kotlin.Int declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val]
overridden:
public open values: kotlin.collections.Collection<V of kotlin.collections.AbstractMap>
FUN FAKE_OVERRIDE name:<get-values> visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.collections.Collection<kotlin.Int> [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val]
overridden:
public open fun <get-values> (): kotlin.collections.Collection<V of kotlin.collections.AbstractMap> declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
FUN FAKE_OVERRIDE name:getOrDefault visibility:public modality:OPEN <> ($this:kotlin.collections.Map<kotlin.Int, kotlin.Int>, key:kotlin.Int, defaultValue:kotlin.Int) returnType:kotlin.Int [fake_override]
annotations:
SinceKotlin(version = "1.1")
PlatformDependent
overridden:
public open fun getOrDefault (key: K of kotlin.collections.AbstractMap, defaultValue: V of kotlin.collections.AbstractMap): V of kotlin.collections.AbstractMap declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.Map<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:key index:0 type:kotlin.Int
VALUE_PARAMETER name:defaultValue index:1 type:kotlin.Int
@@ -0,0 +1,16 @@
class MyMap : AbstractMap<Int, Int> {
constructor() /* primary */ {
super/*AbstractMap*/<Int, Int>()
/* <init>() */
}
override val entries: Set<Entry<Int, Int>>
field = emptySet<Entry<Int, Int>>()
override get
internal fun containsEntry(entry: Entry<*, *>?): Boolean {
return false
}
}
@@ -0,0 +1,87 @@
FILE fqName:<root> fileName:/internalStdlibOverride.kt
CLASS CLASS name:MyMap modality:FINAL visibility:public superTypes:[kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyMap
CONSTRUCTOR visibility:public <> () returnType:<root>.MyMap [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'protected constructor <init> () declared in kotlin.collections.AbstractMap'
<K>: kotlin.Int
<V>: kotlin.Int
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyMap modality:FINAL visibility:public superTypes:[kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>]'
PROPERTY name:entries visibility:public modality:OPEN [val]
overridden:
public abstract entries: kotlin.collections.Set<kotlin.collections.Map.Entry<K of kotlin.collections.AbstractMap, V of kotlin.collections.AbstractMap>>
FIELD PROPERTY_BACKING_FIELD name:entries type:kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> visibility:private [final]
EXPRESSION_BODY
CALL 'public final fun emptySet <T> (): kotlin.collections.Set<T of kotlin.collections.emptySet> declared in kotlin.collections' type=kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> origin=null
<T>: kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-entries> visibility:public modality:OPEN <> ($this:<root>.MyMap) returnType:kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>>
correspondingProperty: PROPERTY name:entries visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-entries> (): kotlin.collections.Set<kotlin.collections.Map.Entry<K of kotlin.collections.AbstractMap, V of kotlin.collections.AbstractMap>> declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:<root>.MyMap
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-entries> (): kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> declared in <root>.MyMap'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:entries type:kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> visibility:private [final]' type=kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int, kotlin.Int>> origin=null
receiver: GET_VAR '<this>: <root>.MyMap declared in <root>.MyMap.<get-entries>' type=<root>.MyMap origin=null
FUN name:containsEntry visibility:public modality:FINAL <> ($this:<root>.MyMap, entry:kotlin.collections.Map.Entry<*, *>?) returnType:kotlin.Boolean
$this: VALUE_PARAMETER name:<this> type:<root>.MyMap
VALUE_PARAMETER name:entry index:0 type:kotlin.collections.Map.Entry<*, *>?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun containsEntry (entry: kotlin.collections.Map.Entry<*, *>?): kotlin.Boolean declared in <root>.MyMap'
CONST Boolean type=kotlin.Boolean value=false
PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val]
overridden:
public open keys: kotlin.collections.Set<K of kotlin.collections.AbstractMap>
FUN FAKE_OVERRIDE name:<get-keys> visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.collections.Set<kotlin.Int> [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val]
overridden:
public open fun <get-keys> (): kotlin.collections.Set<K of kotlin.collections.AbstractMap> declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val]
overridden:
public open size: kotlin.Int
FUN FAKE_OVERRIDE name:<get-size> visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.Int [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val]
overridden:
public open fun <get-size> (): kotlin.Int declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val]
overridden:
public open values: kotlin.collections.Collection<V of kotlin.collections.AbstractMap>
FUN FAKE_OVERRIDE name:<get-values> visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.collections.Collection<kotlin.Int> [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val]
overridden:
public open fun <get-values> (): kotlin.collections.Collection<V of kotlin.collections.AbstractMap> declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
FUN FAKE_OVERRIDE name:containsKey visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>, key:kotlin.Int) returnType:kotlin.Boolean [fake_override]
overridden:
public open fun containsKey (key: K of kotlin.collections.AbstractMap): kotlin.Boolean declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:key index:0 type:kotlin.Int
FUN FAKE_OVERRIDE name:containsValue visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>, value:kotlin.Int) returnType:kotlin.Boolean [fake_override]
overridden:
public open fun containsValue (value: V of kotlin.collections.AbstractMap): kotlin.Boolean declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:value index:0 type:kotlin.Int
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>, key:kotlin.Int) returnType:kotlin.Int? [fake_override,operator]
overridden:
public open fun get (key: K of kotlin.collections.AbstractMap): V of kotlin.collections.AbstractMap? declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
VALUE_PARAMETER name:key index:0 type:kotlin.Int
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.Boolean [fake_override]
overridden:
public open fun isEmpty (): kotlin.Boolean declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.collections.AbstractMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.AbstractMap<kotlin.Int, kotlin.Int>
@@ -0,0 +1,14 @@
// WITH_STDLIB
// ENABLE_IR_FAKE_OVERRIDE_GENERATION
// KT-64692
// MUTE_SIGNATURE_COMPARISON_K2: JVM_IR
// test data differs - no getOrDefault in AbstractMap for non-jvm.
// IGNORE_BACKEND: NATIVE, JS, JS_IR, JS_IR_ES6, WASM
class MyMap : AbstractMap<Int, Int>() {
override val entries = emptySet<Map.Entry<Int, Int>>()
// clash with stdlib internal function
fun containsEntry(entry: Map.Entry<*, *>?) = false
}
@@ -0,0 +1,16 @@
class MyMap : AbstractMap<Int, Int> {
constructor() /* primary */ {
super/*AbstractMap*/<Int, Int>()
/* <init>() */
}
override val entries: Set<Entry<Int, Int>>
field = emptySet<Entry<Int, Int>>()
override get
fun containsEntry(entry: Entry<*, *>?): Boolean {
return false
}
}
@@ -0,0 +1,103 @@
// CHECK:
// Mangled name: MyMap
// Public signature: /MyMap|null[0]
class MyMap : AbstractMap<Int, Int> {
// CHECK:
// Mangled name: MyMap{}entries
// Public signature: /MyMap.entries|-586096469347622282[0]
// Public signature debug description: {}entries
override val entries: Set<Entry<Int, Int>>
// CHECK JVM_IR:
// Mangled name: MyMap#<get-entries>(){}kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int,kotlin.Int>>
// Public signature: /MyMap.entries.<get-entries>|-4597126143979775364[0]
// Public signature debug description: <get-entries>(){}kotlin.collections.Set<kotlin.collections.Map.Entry<kotlin.Int,kotlin.Int>>
override get
// CHECK:
// Mangled name: MyMap#<init>(){}
// Public signature: /MyMap.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: MyMap#containsKey(kotlin.Int){}kotlin.Boolean
// Public signature: /MyMap.containsKey|4717472714078263338[0]
// Public signature debug description: containsKey(kotlin.Int){}kotlin.Boolean
/* fake */ override fun containsKey(key: Int): Boolean
// CHECK JVM_IR:
// Mangled name: MyMap#containsValue(kotlin.Int){}kotlin.Boolean
// Public signature: /MyMap.containsValue|-5922461699477978175[0]
// Public signature debug description: containsValue(kotlin.Int){}kotlin.Boolean
/* fake */ override fun containsValue(value: Int): Boolean
// CHECK JVM_IR:
// Mangled name: MyMap#equals(kotlin.Any?){}kotlin.Boolean
// Public signature: /MyMap.equals|722809408929142791[0]
// Public signature debug description: equals(kotlin.Any?){}kotlin.Boolean
/* fake */ override operator fun equals(other: Any?): Boolean
// CHECK JVM_IR:
// Mangled name: MyMap#get(kotlin.Int){}kotlin.Int?
// Public signature: /MyMap.get|3354880903083512916[0]
// Public signature debug description: get(kotlin.Int){}kotlin.Int?
/* fake */ override operator fun get(key: Int): Int?
// CHECK JVM_IR:
// Mangled name: MyMap#hashCode(){}kotlin.Int
// Public signature: /MyMap.hashCode|-8048879360829830756[0]
// Public signature debug description: hashCode(){}kotlin.Int
/* fake */ override fun hashCode(): Int
// CHECK JVM_IR:
// Mangled name: MyMap#isEmpty(){}kotlin.Boolean
// Public signature: /MyMap.isEmpty|-626562167393617703[0]
// Public signature debug description: isEmpty(){}kotlin.Boolean
/* fake */ override fun isEmpty(): Boolean
// CHECK JVM_IR:
// Mangled name: MyMap#toString(){}kotlin.String
// Public signature: /MyMap.toString|6958853723545266802[0]
// Public signature debug description: toString(){}kotlin.String
/* fake */ override fun toString(): String
// CHECK JVM_IR:
// Mangled name: MyMap#containsEntry(kotlin.collections.Map.Entry<*,*>?){}kotlin.Boolean
// Public signature: /MyMap.containsEntry|1332030881581204061[0]
// Public signature debug description: containsEntry(kotlin.collections.Map.Entry<*,*>?){}kotlin.Boolean
fun containsEntry(entry: Entry<*, *>?): Boolean
// CHECK:
// Mangled name: MyMap{}keys
// Public signature: /MyMap.keys|-1539062068328255324[0]
// Public signature debug description: {}keys
/* fake */ override val keys: Set<Int>
// CHECK JVM_IR:
// Mangled name: MyMap#<get-keys>(){}kotlin.collections.Set<kotlin.Int>
// Public signature: /MyMap.keys.<get-keys>|7233616665140484941[0]
// Public signature debug description: <get-keys>(){}kotlin.collections.Set<kotlin.Int>
/* fake */ override get(): Set<Int>
// CHECK:
// Mangled name: MyMap{}size
// Public signature: /MyMap.size|-6253659984320132064[0]
// Public signature debug description: {}size
/* fake */ override val size: Int
// CHECK JVM_IR:
// Mangled name: MyMap#<get-size>(){}kotlin.Int
// Public signature: /MyMap.size.<get-size>|-3941649985161900780[0]
// Public signature debug description: <get-size>(){}kotlin.Int
/* fake */ override get(): Int
// CHECK:
// Mangled name: MyMap{}values
// Public signature: /MyMap.values|-764749005844117249[0]
// Public signature debug description: {}values
/* fake */ override val values: Collection<Int>
// CHECK JVM_IR:
// Mangled name: MyMap#<get-values>(){}kotlin.collections.Collection<kotlin.Int>
// Public signature: /MyMap.values.<get-values>|-4796126854434898814[0]
// Public signature debug description: <get-values>(){}kotlin.collections.Collection<kotlin.Int>
/* fake */ override get(): Collection<Int>
}
@@ -492,6 +492,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
@@ -388,6 +388,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase {
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
runTest("compiler/testData/ir/irText/declarations/kt27005.kt");
@@ -438,6 +438,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
@@ -438,6 +438,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest {
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
@@ -438,6 +438,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest {
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
@@ -438,6 +438,12 @@ public class ClassicNativeIrTextTestGenerated extends AbstractClassicNativeIrTex
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
@@ -438,6 +438,12 @@ public class FirLightTreeNativeIrTextTestGenerated extends AbstractFirLightTreeN
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {
@@ -438,6 +438,12 @@ public class FirPsiNativeIrTextTestGenerated extends AbstractFirPsiNativeIrTextT
runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");
}
@Test
@TestMetadata("internalStdlibOverride.kt")
public void testInternalStdlibOverride() throws Exception {
runTest("compiler/testData/ir/irText/declarations/internalStdlibOverride.kt");
}
@Test
@TestMetadata("kt27005.kt")
public void testKt27005() throws Exception {