[FIR] Fix IrInlineBodiesHandler
Validate that inline function actually is present in at least on of the modules, not in all of them. That enables support of MODULE directive in boxInline tests for FIR. Also, hide a few minor style fixes in this commit
This commit is contained in:
committed by
Space
parent
3a2d69225c
commit
2fcef7af89
@@ -197,6 +197,7 @@ object FirSessionFactory : FirAbstractSessionFactory() {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(SessionConfiguration::class)
|
||||
@TestOnly
|
||||
fun createEmptySession(): FirSession {
|
||||
return object : FirSession(null, Kind.Source) {}.apply {
|
||||
|
||||
+3
-5
@@ -52,7 +52,7 @@ private class EnumClassLowering(private val context: JvmBackendContext) : ClassL
|
||||
* ```
|
||||
* enum MyEnum extends Enum<MyEnum> {
|
||||
* private static final synthetic MyEnum[] $VALUES
|
||||
* private static final synthetic List<MyEnum> $ENTRIES;
|
||||
* private static final synthetic EnumEntries<MyEnum> $ENTRIES;
|
||||
*
|
||||
* <clinit> {
|
||||
* A = new MyEnum("A", 0);
|
||||
@@ -66,7 +66,7 @@ private class EnumClassLowering(private val context: JvmBackendContext) : ClassL
|
||||
* }
|
||||
*
|
||||
* // Should be RO property from Kotlin standpoint
|
||||
* public static List<MyEnum> getEntries() {
|
||||
* public static EnumEntries<MyEnum> getEntries() {
|
||||
* return $ENTRIES;
|
||||
* }
|
||||
*
|
||||
@@ -351,9 +351,7 @@ internal fun IrBuilderWithScope.irCreateEnumEntriesIndy(
|
||||
putValueArgument(3, irVararg(context.irBuiltIns.anyType, emptyList()))
|
||||
putValueArgument(4, irBoolean(false))
|
||||
}
|
||||
// Bind it to temp var and pass to ctor
|
||||
val supplier = createTmpVariable(indyCall, "supplier")
|
||||
+irCall(symbols.createEnumEntries).apply {
|
||||
putValueArgument(0, irGet(supplier))
|
||||
putValueArgument(0, indyCall)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -55,7 +55,7 @@ class JvmSymbols(
|
||||
private val kotlinJvmPackage: IrPackageFragment = createPackage(FqName("kotlin.jvm"))
|
||||
private val kotlinJvmInternalPackage: IrPackageFragment = createPackage(FqName("kotlin.jvm.internal"))
|
||||
private val kotlinJvmFunctionsPackage: IrPackageFragment = createPackage(FqName("kotlin.jvm.functions"))
|
||||
private val kotlinEnumPackage: IrPackageFragment = createPackage(FqName("kotlin.enums"))
|
||||
private val kotlinEnumsPackage: IrPackageFragment = createPackage(FqName("kotlin.enums"))
|
||||
private val kotlinReflectPackage: IrPackageFragment = createPackage(FqName("kotlin.reflect"))
|
||||
private val javaLangPackage: IrPackageFragment = createPackage(FqName("java.lang"))
|
||||
private val javaLangInvokePackage: IrPackageFragment = createPackage(FqName("java.lang.invoke"))
|
||||
@@ -97,7 +97,7 @@ class JvmSymbols(
|
||||
"kotlin" -> kotlinPackage
|
||||
"kotlin.coroutines" -> kotlinCoroutinesPackage
|
||||
"kotlin.coroutines.jvm.internal" -> kotlinCoroutinesJvmInternalPackage
|
||||
"kotlin.enums" -> kotlinEnumPackage
|
||||
"kotlin.enums" -> kotlinEnumsPackage
|
||||
"kotlin.jvm.internal" -> kotlinJvmInternalPackage
|
||||
"kotlin.jvm.functions" -> kotlinJvmFunctionsPackage
|
||||
"kotlin.jvm" -> kotlinJvmPackage
|
||||
|
||||
+1
-2
@@ -23,13 +23,12 @@ class IrInlineBodiesHandler(testServices: TestServices) : AbstractIrHandler(test
|
||||
override fun processModule(module: TestModule, info: IrBackendInput) {
|
||||
val irModule = info.irModuleFragment
|
||||
irModule.acceptChildrenVoid(InlineFunctionsCollector())
|
||||
assertions.assertTrue(declaredInlineFunctionSignatures.isNotEmpty())
|
||||
irModule.acceptChildrenVoid(InlineCallBodiesCheck())
|
||||
assertions.assertTrue((info as IrBackendInput.JvmIrBackendInput).backendInput.symbolTable.allUnbound.isEmpty())
|
||||
}
|
||||
|
||||
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {
|
||||
// TODO("Not yet implemented")
|
||||
assertions.assertTrue(declaredInlineFunctionSignatures.isNotEmpty())
|
||||
}
|
||||
|
||||
inner class InlineFunctionsCollector : IrElementVisitorVoid {
|
||||
|
||||
Reference in New Issue
Block a user