Skip to content

Commit d2cb1aa

Browse files
authored
Merge pull request #9218 from igfoo/igfoo/geninst
Kotlin: Avoid "generic specialisation" label collisions
2 parents 9844ae7 + e153f30 commit d2cb1aa

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ class KotlinExtractorExtension(
160160
}
161161

162162
class KotlinExtractorGlobalState {
163-
val genericSpecialisationsExtracted = HashSet<String>()
164163
// These three record mappings of classes, functions and fields that should be replaced wherever they are found.
165164
// As of now these are only used to fix IR generated by the Gradle Android Extensions plugin, hence e.g. IrProperty
166165
// doesn't have a map as that plugin doesn't generate them. If and when these are used more widely additional maps

java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ open class KotlinUsesExtractor(
420420
extractorWithCSource.extractClassInstance(c, argsIncludingOuterClasses)
421421
}
422422

423-
if (inReceiverContext && globalExtensionState.genericSpecialisationsExtracted.add(classLabelResult.classLabel)) {
423+
if (inReceiverContext && tw.lm.genericSpecialisationsExtracted.add(classLabelResult.classLabel)) {
424424
val supertypeMode = if (argsIncludingOuterClasses == null) ExtractSupertypesMode.Raw else ExtractSupertypesMode.Specialised(argsIncludingOuterClasses)
425425
extractorWithCSource.extractClassSupertypes(c, classLabel, supertypeMode, true)
426426
extractorWithCSource.extractNonPrivateMemberPrototypes(c, argsIncludingOuterClasses, classLabel)

java/kotlin-extractor/src/main/kotlin/TrapWriter.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ class TrapLabelManager {
4040
val anonymousTypeMapping: MutableMap<IrClass, TypeResults> = mutableMapOf()
4141

4242
val locallyVisibleFunctionLabelMapping: MutableMap<IrFunction, LocallyVisibleFunctionLabels> = mutableMapOf()
43+
44+
/**
45+
* The set of labels of generic specialisations that we have extracted
46+
* in this TRAP file.
47+
* We can't easily avoid duplication between TRAP files, as the labels
48+
* contain references to other labels, so we just accept this
49+
* duplication.
50+
*/
51+
val genericSpecialisationsExtracted = HashSet<String>()
4352
}
4453

4554
/**

0 commit comments

Comments
 (0)