FIR mangler: handle situation with invisible type in f/o signature
Before this commit, FIR mangler effectively dropped f/o parameter with invisible type from this module. It could lead to signature clashes. Now we insert classId in mangler string instead. This fixes FIR bootstrap.
This commit is contained in:
+5
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.resolve.firProvider
|
|||||||
import org.jetbrains.kotlin.fir.resolve.symbolProvider
|
import org.jetbrains.kotlin.fir.resolve.symbolProvider
|
||||||
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
||||||
@@ -214,6 +215,10 @@ open class FirJvmMangleComputer(
|
|||||||
}
|
}
|
||||||
is FirClassSymbol -> symbol.fir.accept(copy(MangleMode.FQNAME), false)
|
is FirClassSymbol -> symbol.fir.accept(copy(MangleMode.FQNAME), false)
|
||||||
is FirTypeParameterSymbol -> tBuilder.mangleTypeParameterReference(symbol.fir)
|
is FirTypeParameterSymbol -> tBuilder.mangleTypeParameterReference(symbol.fir)
|
||||||
|
// This is performed for a case with invisible class-like symbol in fake override
|
||||||
|
null -> (type.lookupTag as? ConeClassLikeLookupTag)?.let {
|
||||||
|
tBuilder.append(it.classId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type.typeArguments.asList().ifNotEmpty {
|
type.typeArguments.asList().ifNotEmpty {
|
||||||
|
|||||||
+6
@@ -15662,6 +15662,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt");
|
runTest("compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("SamWithReceiverMavenProjectImportHandler.kt")
|
||||||
|
public void testSamWithReceiverMavenProjectImportHandler() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("SuspendExtension.kt")
|
@TestMetadata("SuspendExtension.kt")
|
||||||
public void testSuspendExtension() throws Exception {
|
public void testSuspendExtension() throws Exception {
|
||||||
|
|||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
// MODULE: maven
|
||||||
|
// FILE: MavenProject.kt
|
||||||
|
|
||||||
|
interface MavenProject
|
||||||
|
|
||||||
|
// MODULE: lib(maven)
|
||||||
|
// FILE: lib.kt
|
||||||
|
|
||||||
|
abstract class AbstractMavenImportHandler {
|
||||||
|
abstract fun getOptions(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<String>?
|
||||||
|
|
||||||
|
protected open fun getOptions(
|
||||||
|
mavenProject: MavenProject,
|
||||||
|
enabledCompilerPlugins: List<String>,
|
||||||
|
compilerPluginOptions: List<String>
|
||||||
|
): List<String>? = getOptions(enabledCompilerPlugins, compilerPluginOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: sam.kt
|
||||||
|
|
||||||
|
class SamWithReceiverMavenProjectImportHandler : AbstractMavenImportHandler() {
|
||||||
|
override fun getOptions(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<String>? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val result = SamWithReceiverMavenProjectImportHandler()
|
||||||
|
return result.getOptions(emptyList(), emptyList())?.get(0) ?: "OK"
|
||||||
|
}
|
||||||
+6
@@ -15662,6 +15662,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt");
|
runTest("compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("SamWithReceiverMavenProjectImportHandler.kt")
|
||||||
|
public void testSamWithReceiverMavenProjectImportHandler() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("SuspendExtension.kt")
|
@TestMetadata("SuspendExtension.kt")
|
||||||
public void testSuspendExtension() throws Exception {
|
public void testSuspendExtension() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user