[FIR] Implement IR body generators for all FIR declarations generators in plugin prototype
This commit is contained in:
committed by
TeamCityServer
parent
9a0e73e132
commit
86404b8027
@@ -187,6 +187,8 @@ class NaiveSourceBasedFileEntryImpl(
|
||||
override val name: String,
|
||||
private val lineStartOffsets: IntArray = intArrayOf()
|
||||
) : IrFileEntry {
|
||||
val lineStartOffsetsAreEmpty: Boolean
|
||||
get() = lineStartOffsets.isEmpty()
|
||||
|
||||
private val MAX_SAVED_LINE_NUMBERS = 50
|
||||
|
||||
@@ -254,4 +256,4 @@ inline fun MemberScope.findFirstFunction(name: String, predicate: (CallableMembe
|
||||
|
||||
fun filterOutAnnotations(fqName: FqName, annotations: List<IrConstructorCall>): List<IrConstructorCall> {
|
||||
return annotations.filterNot { it.annotationClass.hasEqualFqName(fqName) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ fun IrFile.dumpTreesFromLineNumber(lineNumber: Int, normalizeNames: Boolean = fa
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
fun IrFile.shouldSkipDump(): Boolean {
|
||||
val entry = fileEntry as? NaiveSourceBasedFileEntryImpl ?: return false
|
||||
return entry.lineStartOffsetsAreEmpty
|
||||
}
|
||||
|
||||
class DumpIrTreeVisitor(
|
||||
out: Appendable,
|
||||
normalizeNames: Boolean = false,
|
||||
|
||||
+2
-4
@@ -13,10 +13,7 @@ import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerDesc
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.dump
|
||||
import org.jetbrains.kotlin.ir.util.dumpTreesFromLineNumber
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi2ir.generators.DeclarationStubGeneratorImpl
|
||||
@@ -68,6 +65,7 @@ class IrTextDumpHandler(testServices: TestServices) : AbstractIrHandler(testServ
|
||||
val builder = baseDumper.builderForModule(module)
|
||||
for ((testFile, irFile) in testFileToIrFile) {
|
||||
if (testFile?.directives?.contains(EXTERNAL_FILE) == true) continue
|
||||
if (irFile.shouldSkipDump()) continue
|
||||
var actualDump = irFile.dumpTreesFromLineNumber(lineNumber = 0, normalizeNames = true)
|
||||
if (actualDump.isEmpty()) {
|
||||
actualDump = irFile.dumpTreesFromLineNumber(lineNumber = UNDEFINED_OFFSET, normalizeNames = true)
|
||||
|
||||
+2
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.test.backend.handlers
|
||||
import org.jetbrains.kotlin.ir.IrVerifier
|
||||
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
|
||||
import org.jetbrains.kotlin.ir.util.dumpTreesFromLineNumber
|
||||
import org.jetbrains.kotlin.ir.util.shouldSkipDump
|
||||
import org.jetbrains.kotlin.test.backend.handlers.IrTextDumpHandler.Companion.groupWithTestFiles
|
||||
import org.jetbrains.kotlin.test.backend.ir.IrBackendInput
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
|
||||
@@ -29,6 +30,7 @@ class IrTreeVerifierHandler(testServices: TestServices) : AbstractIrHandler(test
|
||||
|
||||
IrVerifier(assertions).verifyWithAssert(irFile)
|
||||
|
||||
if (irFile.shouldSkipDump()) continue
|
||||
val actualDump = irFile.dumpTreesFromLineNumber(lineNumber = 0, normalizeNames = true)
|
||||
|
||||
val irFileCopy = irFile.deepCopyWithSymbols()
|
||||
|
||||
@@ -388,10 +388,6 @@ fun main(args: Array<String>) {
|
||||
model("diagnostics")
|
||||
}
|
||||
|
||||
testClass<AbstractFir2IrAllOpenTest> {
|
||||
model("fir2ir")
|
||||
}
|
||||
|
||||
testClass<AbstractAllOpenBlackBoxCodegenTest> {
|
||||
model("box")
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.plugin
|
||||
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPluginKey
|
||||
|
||||
object SomePluginKey : FirPluginKey() {
|
||||
override fun toString(): String {
|
||||
return "AllOpenPlugin"
|
||||
}
|
||||
}
|
||||
+20
-6
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.descriptors.EffectiveVisibility
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPluginKey
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunction
|
||||
@@ -23,10 +24,7 @@ import org.jetbrains.kotlin.fir.plugin.fqn
|
||||
import org.jetbrains.kotlin.fir.resolve.defaultType
|
||||
import org.jetbrains.kotlin.fir.scopes.kotlinScopeProvider
|
||||
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -59,7 +57,9 @@ class CompanionGenerator(session: FirSession) : FirDeclarationGenerationExtensio
|
||||
Visibilities.Public,
|
||||
Modality.FINAL,
|
||||
EffectiveVisibility.Public
|
||||
)
|
||||
).apply {
|
||||
isCompanion = true
|
||||
}
|
||||
name = SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT
|
||||
symbol = FirRegularClassSymbol(classId)
|
||||
superTypeRefs += session.builtinTypes.anyType
|
||||
@@ -86,8 +86,22 @@ class CompanionGenerator(session: FirSession) : FirDeclarationGenerationExtensio
|
||||
return listOf(function.symbol)
|
||||
}
|
||||
|
||||
override fun generateConstructors(owner: FirClassSymbol<*>): List<FirConstructorSymbol> {
|
||||
val constructor = buildConstructor(owner.classId, isInner = false, Key)
|
||||
return listOf(constructor.symbol)
|
||||
}
|
||||
|
||||
override fun getCallableNamesForClass(classSymbol: FirClassSymbol<*>): Set<Name> {
|
||||
return setOf(FOO_NAME)
|
||||
if (classSymbol.classKind != ClassKind.OBJECT) return emptySet()
|
||||
if (classSymbol !is FirRegularClassSymbol) return emptySet()
|
||||
val classId = classSymbol.classId
|
||||
if (!classId.isNestedClass || classId.shortClassName != SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT) return emptySet()
|
||||
val origin = classSymbol.origin as? FirDeclarationOrigin.Plugin
|
||||
return if (origin?.key == Key) {
|
||||
setOf(FOO_NAME, SpecialNames.INIT)
|
||||
} else {
|
||||
setOf(FOO_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(SymbolInternals::class)
|
||||
|
||||
+4
-5
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.descriptors.EffectiveVisibility
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPluginKey
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunction
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
|
||||
@@ -18,7 +19,6 @@ import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate
|
||||
import org.jetbrains.kotlin.fir.extensions.predicate.has
|
||||
import org.jetbrains.kotlin.fir.extensions.predicateBasedProvider
|
||||
import org.jetbrains.kotlin.fir.moduleData
|
||||
import org.jetbrains.kotlin.fir.plugin.SomePluginKey
|
||||
import org.jetbrains.kotlin.fir.plugin.fqn
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||
@@ -45,7 +45,7 @@ class TopLevelDeclarationsGenerator(session: FirSession) : FirDeclarationGenerat
|
||||
val matchedClassSymbol = findMatchedClassForFunction(callableId) ?: return emptyList()
|
||||
val function = buildSimpleFunction {
|
||||
moduleData = session.moduleData
|
||||
origin = key.origin
|
||||
origin = Key.origin
|
||||
status = FirResolvedDeclarationStatusImpl(
|
||||
Visibilities.Public,
|
||||
Modality.FINAL,
|
||||
@@ -54,7 +54,7 @@ class TopLevelDeclarationsGenerator(session: FirSession) : FirDeclarationGenerat
|
||||
returnTypeRef = session.builtinTypes.stringType
|
||||
valueParameters += buildValueParameter {
|
||||
moduleData = session.moduleData
|
||||
origin = key.origin
|
||||
origin = Key.origin
|
||||
returnTypeRef = buildResolvedTypeRef {
|
||||
type = ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(matchedClassSymbol.classId), emptyArray(), isNullable = false)
|
||||
}
|
||||
@@ -89,8 +89,7 @@ class TopLevelDeclarationsGenerator(session: FirSession) : FirDeclarationGenerat
|
||||
}
|
||||
}
|
||||
|
||||
private val key: SomePluginKey
|
||||
get() = SomePluginKey
|
||||
object Key : FirPluginKey()
|
||||
|
||||
override fun FirDeclarationPredicateRegistrar.registerPredicates() {
|
||||
register(PREDICATE)
|
||||
|
||||
-1
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunction
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
|
||||
import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension
|
||||
import org.jetbrains.kotlin.fir.moduleData
|
||||
import org.jetbrains.kotlin.fir.plugin.SomePluginKey
|
||||
import org.jetbrains.kotlin.fir.resolve.defaultType
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.plugin
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.fir.backend.IrPluginDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPluginKey
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.util.primaryConstructor
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||
|
||||
abstract class AbstractTransformerForGenerator(protected val context: IrPluginContext) : IrElementVisitorVoid {
|
||||
protected val irFactory = context.irFactory
|
||||
protected val irBuiltIns = context.irBuiltIns
|
||||
|
||||
abstract fun interestedIn(key: FirPluginKey): Boolean
|
||||
abstract fun generateBodyForFunction(function: IrSimpleFunction, key: FirPluginKey): IrBody?
|
||||
abstract fun generateBodyForConstructor(constructor: IrConstructor, key: FirPluginKey): IrBody?
|
||||
|
||||
final override fun visitElement(element: IrElement) {
|
||||
when (element) {
|
||||
is IrDeclaration,
|
||||
is IrFile,
|
||||
is IrModuleFragment -> element.acceptChildrenVoid(this)
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
final override fun visitSimpleFunction(declaration: IrSimpleFunction) {
|
||||
val origin = declaration.origin
|
||||
if (origin !is IrPluginDeclarationOrigin || !interestedIn(origin.pluginKey)) return
|
||||
require(declaration.body == null)
|
||||
declaration.body = generateBodyForFunction(declaration, origin.pluginKey)
|
||||
}
|
||||
|
||||
final override fun visitConstructor(declaration: IrConstructor) {
|
||||
val origin = declaration.origin
|
||||
if (origin !is IrPluginDeclarationOrigin || !interestedIn(origin.pluginKey)) return
|
||||
require(declaration.body == null)
|
||||
declaration.body = generateBodyForConstructor(declaration, origin.pluginKey)
|
||||
}
|
||||
|
||||
// ------------------------ utilities ------------------------
|
||||
|
||||
protected fun generateDefaultBodyForMaterializeFunction(function: IrSimpleFunction): IrBody? {
|
||||
val constructedType = function.returnType as? IrSimpleType ?: return null
|
||||
val constructedClassSymbol = constructedType.classifier
|
||||
val constructedClass = constructedClassSymbol.owner as? IrClass ?: return null
|
||||
val constructor = constructedClass.primaryConstructor ?: return null
|
||||
val constructorCall = IrConstructorCallImpl(
|
||||
-1,
|
||||
-1,
|
||||
constructedType,
|
||||
constructor.symbol,
|
||||
typeArgumentsCount = 0,
|
||||
constructorTypeArgumentsCount = 0,
|
||||
valueArgumentsCount = 0
|
||||
)
|
||||
val returnStatement = IrReturnImpl(-1, -1, irBuiltIns.nothingType, function.symbol, constructorCall)
|
||||
return irFactory.createBlockBody(-1, -1, listOf(returnStatement))
|
||||
}
|
||||
|
||||
protected fun generateBodyForDefaultConstructor(declaration: IrConstructor): IrBody? {
|
||||
val type = declaration.returnType as? IrSimpleType ?: return null
|
||||
|
||||
val delegatingAnyCall = IrDelegatingConstructorCallImpl(
|
||||
-1,
|
||||
-1,
|
||||
irBuiltIns.anyType,
|
||||
irBuiltIns.anyClass.owner.primaryConstructor?.symbol ?: return null,
|
||||
typeArgumentsCount = 0,
|
||||
valueArgumentsCount = 0
|
||||
)
|
||||
|
||||
val initializerCall = IrInstanceInitializerCallImpl(
|
||||
-1,
|
||||
-1,
|
||||
(declaration.parent as? IrClass)?.symbol ?: return null,
|
||||
type
|
||||
)
|
||||
|
||||
return irFactory.createBlockBody(-1, -1, listOf(delegatingAnyCall, initializerCall))
|
||||
}
|
||||
}
|
||||
|
||||
+10
-70
@@ -7,81 +7,21 @@ package org.jetbrains.kotlin.ir.plugin
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.fir.backend.IrPluginDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.plugin.generators.ExternalClassGenerator
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.util.primaryConstructor
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||
|
||||
class GeneratedDeclarationsIrBodyFiller : IrGenerationExtension {
|
||||
override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
|
||||
moduleFragment.acceptChildrenVoid(Transformer(pluginContext))
|
||||
}
|
||||
}
|
||||
val transformers = listOf(
|
||||
TransformerForExternalClassGenerator(pluginContext),
|
||||
TransformerForCompanionGenerator(pluginContext),
|
||||
TransformerForAdditionalMembersGenerator(pluginContext),
|
||||
TransformerForTopLevelDeclarationsGenerator(pluginContext),
|
||||
)
|
||||
|
||||
private class Transformer(val context: IrPluginContext) : IrElementVisitorVoid {
|
||||
private val irFactory = context.irFactory
|
||||
private val irBuiltIns = context.irBuiltIns
|
||||
|
||||
override fun visitElement(element: IrElement) {
|
||||
when (element) {
|
||||
is IrDeclaration,
|
||||
is IrFile,
|
||||
is IrModuleFragment -> element.acceptChildrenVoid(this)
|
||||
else -> {}
|
||||
for (transformer in transformers) {
|
||||
moduleFragment.acceptChildrenVoid(transformer)
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitSimpleFunction(declaration: IrSimpleFunction) {
|
||||
val origin = declaration.origin
|
||||
if (origin !is IrPluginDeclarationOrigin || origin.pluginKey != ExternalClassGenerator.Key) return
|
||||
require(declaration.body == null)
|
||||
val constructedType = declaration.returnType as? IrSimpleType ?: return
|
||||
val constructedClassSymbol = constructedType.classifier
|
||||
val constructedClass = constructedClassSymbol.owner as? IrClass ?: return
|
||||
val constructor = constructedClass.primaryConstructor ?: return
|
||||
val constructorCall = IrConstructorCallImpl(
|
||||
-1,
|
||||
-1,
|
||||
constructedType,
|
||||
constructor.symbol,
|
||||
typeArgumentsCount = 0,
|
||||
constructorTypeArgumentsCount = 0,
|
||||
valueArgumentsCount = 0
|
||||
)
|
||||
val returnStatement = IrReturnImpl(-1, -1, irBuiltIns.nothingType, declaration.symbol, constructorCall)
|
||||
declaration.body = irFactory.createBlockBody(-1, -1, listOf(returnStatement))
|
||||
}
|
||||
|
||||
override fun visitConstructor(declaration: IrConstructor) {
|
||||
val origin = declaration.origin
|
||||
if (origin !is IrPluginDeclarationOrigin || origin.pluginKey != ExternalClassGenerator.Key) return
|
||||
require(declaration.body == null)
|
||||
val type = declaration.returnType as? IrSimpleType ?: return
|
||||
|
||||
val delegatingAnyCall = IrDelegatingConstructorCallImpl(
|
||||
-1,
|
||||
-1,
|
||||
irBuiltIns.anyType,
|
||||
irBuiltIns.anyClass.owner.primaryConstructor?.symbol ?: return,
|
||||
typeArgumentsCount = 0,
|
||||
valueArgumentsCount = 0
|
||||
)
|
||||
|
||||
val initializerCall = IrInstanceInitializerCallImpl(
|
||||
-1,
|
||||
-1,
|
||||
(declaration.parent as? IrClass)?.symbol ?: return,
|
||||
type
|
||||
)
|
||||
|
||||
declaration.body = irFactory.createBlockBody(-1, -1, listOf(delegatingAnyCall, initializerCall))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.plugin
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPluginKey
|
||||
import org.jetbrains.kotlin.fir.plugin.generators.AdditionalMembersGenerator
|
||||
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
|
||||
class TransformerForAdditionalMembersGenerator(context: IrPluginContext) : AbstractTransformerForGenerator(context) {
|
||||
override fun interestedIn(key: FirPluginKey): Boolean {
|
||||
return key == AdditionalMembersGenerator.Key
|
||||
}
|
||||
|
||||
override fun generateBodyForFunction(function: IrSimpleFunction, key: FirPluginKey): IrBody? {
|
||||
return generateDefaultBodyForMaterializeFunction(function)
|
||||
}
|
||||
|
||||
override fun generateBodyForConstructor(constructor: IrConstructor, key: FirPluginKey): IrBody? {
|
||||
return generateBodyForDefaultConstructor(constructor)
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.plugin
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPluginKey
|
||||
import org.jetbrains.kotlin.fir.plugin.generators.CompanionGenerator
|
||||
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
|
||||
|
||||
class TransformerForCompanionGenerator(context: IrPluginContext) : AbstractTransformerForGenerator(context) {
|
||||
override fun interestedIn(key: FirPluginKey): Boolean {
|
||||
return key == CompanionGenerator.Key
|
||||
}
|
||||
|
||||
override fun generateBodyForFunction(function: IrSimpleFunction, key: FirPluginKey): IrBody {
|
||||
val const = IrConstImpl(-1, -1, irBuiltIns.intType, IrConstKind.Int, value = 10)
|
||||
val returnStatement = IrReturnImpl(-1, -1, irBuiltIns.nothingType, function.symbol, const)
|
||||
return irFactory.createBlockBody(-1, -1, listOf(returnStatement))
|
||||
}
|
||||
|
||||
override fun generateBodyForConstructor(constructor: IrConstructor, key: FirPluginKey): IrBody? {
|
||||
return generateBodyForDefaultConstructor(constructor)
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.plugin
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPluginKey
|
||||
import org.jetbrains.kotlin.fir.plugin.generators.ExternalClassGenerator
|
||||
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
|
||||
class TransformerForExternalClassGenerator(context: IrPluginContext) : AbstractTransformerForGenerator(context) {
|
||||
override fun interestedIn(key: FirPluginKey): Boolean {
|
||||
return key == ExternalClassGenerator.Key
|
||||
}
|
||||
|
||||
override fun generateBodyForFunction(function: IrSimpleFunction, key: FirPluginKey): IrBody? {
|
||||
return generateDefaultBodyForMaterializeFunction(function)
|
||||
}
|
||||
|
||||
override fun generateBodyForConstructor(constructor: IrConstructor, key: FirPluginKey): IrBody? {
|
||||
return generateBodyForDefaultConstructor(constructor)
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.plugin
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPluginKey
|
||||
import org.jetbrains.kotlin.fir.plugin.generators.TopLevelDeclarationsGenerator
|
||||
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
|
||||
import org.jetbrains.kotlin.ir.types.classFqName
|
||||
|
||||
class TransformerForTopLevelDeclarationsGenerator(context: IrPluginContext) : AbstractTransformerForGenerator(context) {
|
||||
override fun interestedIn(key: FirPluginKey): Boolean {
|
||||
return key == TopLevelDeclarationsGenerator.Key
|
||||
}
|
||||
|
||||
override fun generateBodyForFunction(function: IrSimpleFunction, key: FirPluginKey): IrBody {
|
||||
val className = function.valueParameters.single().type.classFqName?.asString() ?: "<error>"
|
||||
val const = IrConstImpl(-1, -1, irBuiltIns.stringType, IrConstKind.String, className)
|
||||
val returnExpression = IrReturnImpl(-1, -1, irBuiltIns.nothingType, function.symbol, const)
|
||||
return irFactory.createBlockBody(-1, -1, listOf(returnExpression))
|
||||
}
|
||||
|
||||
override fun generateBodyForConstructor(constructor: IrConstructor, key: FirPluginKey): IrBody? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
FILE: classWithCompanionObject.kt
|
||||
@R|org/jetbrains/kotlin/fir/plugin/CompanionWithFoo|() public final class SomeClass : R|kotlin/Any| {
|
||||
public constructor(): R|SomeClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final companion object Companion : R|kotlin/Any| {
|
||||
public final fun foo(): R|kotlin/Int|
|
||||
|
||||
public constructor(): R|SomeClass.Companion|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun takeInt(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(R|<local>/x|, Int(10)) -> {
|
||||
throw R|java/lang/IllegalArgumentException.IllegalArgumentException|()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/takeInt|(Q|SomeClass|.R|/SomeClass.Companion.foo|())
|
||||
R|/takeInt|(Q|SomeClass.Companion|.R|/SomeClass.Companion.foo|())
|
||||
}
|
||||
public final fun box(): R|kotlin/String| {
|
||||
R|/test|()
|
||||
^box String(OK)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import org.jetbrains.kotlin.fir.plugin.CompanionWithFoo
|
||||
|
||||
@CompanionWithFoo
|
||||
class SomeClass
|
||||
|
||||
fun takeInt(x: Int) {
|
||||
if (x != 10) throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
takeInt(SomeClass.foo())
|
||||
takeInt(SomeClass.Companion.foo())
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
test()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+8
-1
@@ -11,6 +11,9 @@ FILE: classWithGeneratedMembersAndNestedClass.kt
|
||||
|
||||
}
|
||||
|
||||
public final val result: R|kotlin/String| = String(OK)
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final fun materialize(): R|Foo|
|
||||
|
||||
public final class Nested : R|kotlin/Any| {
|
||||
@@ -25,7 +28,11 @@ FILE: classWithGeneratedMembersAndNestedClass.kt
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_1(foo: R|Foo|): R|kotlin/Unit| {
|
||||
public final fun test(foo: R|Foo|): R|kotlin/String| {
|
||||
lval foo2: R|Foo| = R|<local>/foo|.R|/Foo.materialize|()
|
||||
lval nested: R|Foo.Nested| = Q|Foo|.R|/Foo.Nested|()
|
||||
^test R|<local>/foo2|.R|/Foo.result|
|
||||
}
|
||||
public final fun box(): R|kotlin/String| {
|
||||
^box R|/test|(R|/Foo.Foo|())
|
||||
}
|
||||
+8
-1
@@ -3,11 +3,18 @@ import org.jetbrains.kotlin.fir.plugin.NestedClassAndMaterializeMember
|
||||
@NestedClassAndMaterializeMember
|
||||
class Foo {
|
||||
class MyNested
|
||||
|
||||
val result = "OK"
|
||||
}
|
||||
|
||||
class Bar
|
||||
|
||||
fun test_1(foo: Foo) {
|
||||
fun test(foo: Foo): String {
|
||||
val foo2: Foo = foo.materialize()
|
||||
val nested = Foo.Nested()
|
||||
return foo2.result
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return test(Foo())
|
||||
}
|
||||
Vendored
+4
-48
@@ -12,15 +12,15 @@ FILE fqName:bar fileName:/generatedClassWithMembersAndNestedClasses.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in bar.Foo'
|
||||
CONST String type=kotlin.String value="OK"
|
||||
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: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 [operator] 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
|
||||
@@ -42,47 +42,3 @@ FILE fqName:bar fileName:/generatedClassWithMembersAndNestedClasses.kt
|
||||
CALL 'public final fun testConstructor (): kotlin.Unit declared in bar' type=kotlin.Unit origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in bar'
|
||||
CALL 'public final fun testNestedClasses (): kotlin.String declared in bar' type=kotlin.String origin=null
|
||||
FILE fqName:foo fileName:__GENERATED DECLARATIONS__.kt
|
||||
CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:AllOpenGenerated modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.AllOpenGenerated
|
||||
CONSTRUCTOR GENERATED[AllOpenClassGeneratorKey] visibility:public <> () returnType:foo.AllOpenGenerated [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:AllOpenGenerated modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:NestedFoo modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.AllOpenGenerated.NestedFoo
|
||||
CONSTRUCTOR GENERATED[AllOpenClassGeneratorKey] visibility:public <> () returnType:foo.AllOpenGenerated.NestedFoo [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:NestedFoo modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN GENERATED[AllOpenClassGeneratorKey] name:materialize visibility:public modality:FINAL <> ($this:foo.AllOpenGenerated.NestedFoo) returnType:bar.Foo
|
||||
$this: VALUE_PARAMETER name:<this> type:foo.AllOpenGenerated.NestedFoo
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun materialize (): bar.Foo declared in foo.AllOpenGenerated.NestedFoo'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in bar.Foo' type=bar.Foo origin=null
|
||||
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: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 [operator] 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: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
|
||||
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: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 [operator] 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: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,38 @@
|
||||
FILE: newSupertype.kt
|
||||
package foo
|
||||
|
||||
public abstract interface MyInterface : R|kotlin/Any| {
|
||||
public open fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
@R|org/jetbrains/kotlin/fir/plugin/MyInterfaceSupertype|() public final class FinalClassWithOverride : R|kotlin/Any|, R|foo/MyInterface| {
|
||||
public constructor(): R|foo/FinalClassWithOverride| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final override fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
@R|org/jetbrains/kotlin/fir/plugin/MyInterfaceSupertype|() public final class AnnotatedClassWithExplicitInheritance : R|foo/MyInterface| {
|
||||
public constructor(): R|foo/AnnotatedClassWithExplicitInheritance| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final override fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(x: R|foo/MyInterface|): R|kotlin/Unit| {
|
||||
R|<local>/x|.R|foo/MyInterface.foo|()
|
||||
}
|
||||
public final fun box(): R|kotlin/String| {
|
||||
lval x: R|foo/FinalClassWithOverride| = R|foo/FinalClassWithOverride.FinalClassWithOverride|()
|
||||
R|<local>/x|.R|foo/FinalClassWithOverride.foo|()
|
||||
R|foo/test|(R|<local>/x|)
|
||||
lval y: R|foo/AnnotatedClassWithExplicitInheritance| = R|foo/AnnotatedClassWithExplicitInheritance.AnnotatedClassWithExplicitInheritance|()
|
||||
R|<local>/y|.R|foo/AnnotatedClassWithExplicitInheritance.foo|()
|
||||
R|foo/test|(R|<local>/y|)
|
||||
^box String(OK)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package foo
|
||||
|
||||
import org.jetbrains.kotlin.fir.plugin.MyInterfaceSupertype
|
||||
|
||||
interface MyInterface {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
@MyInterfaceSupertype
|
||||
class FinalClassWithOverride {
|
||||
override fun foo() {}
|
||||
}
|
||||
|
||||
@MyInterfaceSupertype
|
||||
class AnnotatedClassWithExplicitInheritance : MyInterface {
|
||||
override fun foo() {}
|
||||
}
|
||||
|
||||
fun test(x: MyInterface) {
|
||||
x.foo()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val x = FinalClassWithOverride()
|
||||
x.foo()
|
||||
test(x)
|
||||
|
||||
val y = AnnotatedClassWithExplicitInheritance()
|
||||
y.foo()
|
||||
test(y)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
FILE: topLevelCallables.kt
|
||||
package foo
|
||||
|
||||
@R|org/jetbrains/kotlin/fir/plugin/DummyFunction|() public final class First : R|kotlin/Any| {
|
||||
public constructor(): R|foo/First| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@R|org/jetbrains/kotlin/fir/plugin/DummyFunction|() public final class Second : R|kotlin/Any| {
|
||||
public constructor(): R|foo/Second| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun box(): R|kotlin/String| {
|
||||
lval result1: R|kotlin/String| = R|foo/dummyFirst|(R|foo/First.First|())
|
||||
when () {
|
||||
!=(R|<local>/result1|, String(foo.First)) -> {
|
||||
^box <strcat>(String(Error: ), R|<local>/result1|)
|
||||
}
|
||||
}
|
||||
|
||||
lval result2: R|kotlin/String| = R|foo/dummySecond|(R|foo/Second.Second|())
|
||||
when () {
|
||||
!=(R|<local>/result2|, String(foo.Second)) -> {
|
||||
^box <strcat>(String(Error: ), R|<local>/result2|)
|
||||
}
|
||||
}
|
||||
|
||||
^box String(OK)
|
||||
}
|
||||
FILE: __GENERATED DECLARATIONS__.kt
|
||||
package foo
|
||||
|
||||
public final fun dummyFirst(value: R|foo/First|): R|kotlin/String|
|
||||
public final fun dummySecond(value: R|foo/Second|): R|kotlin/String|
|
||||
@@ -0,0 +1,19 @@
|
||||
package foo
|
||||
|
||||
import org.jetbrains.kotlin.fir.plugin.DummyFunction
|
||||
|
||||
@DummyFunction
|
||||
class First
|
||||
|
||||
@DummyFunction
|
||||
class Second
|
||||
|
||||
fun box(): String {
|
||||
val result1 = dummyFirst(First())
|
||||
if (result1 != "foo.First") return "Error: $result1"
|
||||
|
||||
val result2 = dummySecond(Second())
|
||||
if (result2 != "foo.Second") return "Error: $result2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+3
-1
@@ -4,9 +4,11 @@ FILE: classWithCompanionObject.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final object Companion : R|kotlin/Any| {
|
||||
public final companion object Companion : R|kotlin/Any| {
|
||||
public final fun foo(): R|kotlin/Int|
|
||||
|
||||
public constructor(): R|SomeClass.Companion|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-86
@@ -1,86 +0,0 @@
|
||||
FILE fqName:<root> fileName:/classWithGeneratedMembersAndNestedClass.kt
|
||||
CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
NestedClassAndMaterializeMember
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Foo [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
CLASS CLASS name:MyNested modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo.MyNested
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Foo.MyNested [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyNested modality:FINAL visibility:public superTypes:[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: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 [operator] 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: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
|
||||
FUN GENERATED[AllOpenMembersGeneratorKey] name:materialize visibility:public modality:FINAL <> ($this:<root>.Foo) returnType:<root>.Foo
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Foo
|
||||
CLASS GENERATED[AllOpenMembersGeneratorKey] CLASS name:Nested modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo.Nested
|
||||
CONSTRUCTOR GENERATED[AllOpenMembersGeneratorKey] visibility:public <> () returnType:<root>.Foo.Nested [primary]
|
||||
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: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 [operator] 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: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
|
||||
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: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 [operator] 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: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:Bar modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Bar
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Bar [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:FINAL visibility:public superTypes:[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: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 [operator] 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: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
|
||||
FUN name:test_1 visibility:public modality:FINAL <> (foo:<root>.Foo) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:foo index:0 type:<root>.Foo
|
||||
BLOCK_BODY
|
||||
VAR name:foo2 type:<root>.Foo [val]
|
||||
CALL 'public final fun materialize (): <root>.Foo declared in <root>.Foo' type=<root>.Foo origin=null
|
||||
$this: GET_VAR 'foo: <root>.Foo declared in <root>.test_1' type=<root>.Foo origin=null
|
||||
VAR name:nested type:<root>.Foo.Nested [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Foo.Nested' type=<root>.Foo.Nested origin=null
|
||||
-133
@@ -1,133 +0,0 @@
|
||||
FILE fqName:bar fileName:/generatedClassWithMembersAndNestedClasses.kt
|
||||
CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
ExternalClassWithNested
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:bar.Foo
|
||||
CONSTRUCTOR visibility:public <> () returnType:bar.Foo [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:foo visibility:public modality:FINAL <> ($this:bar.Foo) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:bar.Foo
|
||||
BLOCK_BODY
|
||||
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: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 [operator] 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: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:Bar modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
ExternalClassWithNested
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:bar.Bar
|
||||
CONSTRUCTOR visibility:public <> () returnType:bar.Bar [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:bar visibility:public modality:FINAL <> ($this:bar.Bar) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:bar.Bar
|
||||
BLOCK_BODY
|
||||
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: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 [operator] 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: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
|
||||
FUN name:testConstructor visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:generatedClass type:foo.AllOpenGenerated [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in foo.AllOpenGenerated' type=foo.AllOpenGenerated origin=null
|
||||
FUN name:testNestedClasses visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:nestedFoo type:foo.AllOpenGenerated.NestedFoo [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in foo.AllOpenGenerated.NestedFoo' type=foo.AllOpenGenerated.NestedFoo origin=null
|
||||
CALL 'public final fun foo (): kotlin.Unit declared in bar.Foo' type=kotlin.Unit origin=null
|
||||
$this: CALL 'public final fun materialize (): bar.Foo declared in foo.AllOpenGenerated.NestedFoo' type=bar.Foo origin=null
|
||||
$this: GET_VAR 'val nestedFoo: foo.AllOpenGenerated.NestedFoo [val] declared in bar.testNestedClasses' type=foo.AllOpenGenerated.NestedFoo origin=null
|
||||
VAR name:nestedBar type:foo.AllOpenGenerated.NestedBar [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in foo.AllOpenGenerated.NestedBar' type=foo.AllOpenGenerated.NestedBar origin=null
|
||||
CALL 'public final fun bar (): kotlin.Unit declared in bar.Bar' type=kotlin.Unit origin=null
|
||||
$this: CALL 'public final fun materialize (): bar.Bar declared in foo.AllOpenGenerated.NestedBar' type=bar.Bar origin=null
|
||||
$this: GET_VAR 'val nestedBar: foo.AllOpenGenerated.NestedBar [val] declared in bar.testNestedClasses' type=foo.AllOpenGenerated.NestedBar origin=null
|
||||
FILE fqName:foo fileName:__GENERATED DECLARATIONS__.kt
|
||||
CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:AllOpenGenerated modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.AllOpenGenerated
|
||||
CONSTRUCTOR GENERATED[AllOpenClassGeneratorKey] visibility:public <> () returnType:foo.AllOpenGenerated [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:AllOpenGenerated modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:NestedFoo modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.AllOpenGenerated.NestedFoo
|
||||
CONSTRUCTOR GENERATED[AllOpenClassGeneratorKey] visibility:public <> () returnType:foo.AllOpenGenerated.NestedFoo [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:NestedFoo modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN GENERATED[AllOpenClassGeneratorKey] name:materialize visibility:public modality:FINAL <> ($this:foo.AllOpenGenerated.NestedFoo) returnType:bar.Foo
|
||||
$this: VALUE_PARAMETER name:<this> type:foo.AllOpenGenerated.NestedFoo
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun materialize (): bar.Foo declared in foo.AllOpenGenerated.NestedFoo'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in bar.Foo' type=bar.Foo origin=null
|
||||
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: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 [operator] 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: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 GENERATED[AllOpenClassGeneratorKey] CLASS name:NestedBar modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.AllOpenGenerated.NestedBar
|
||||
CONSTRUCTOR GENERATED[AllOpenClassGeneratorKey] visibility:public <> () returnType:foo.AllOpenGenerated.NestedBar [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[AllOpenClassGeneratorKey] CLASS name:NestedBar modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN GENERATED[AllOpenClassGeneratorKey] name:materialize visibility:public modality:FINAL <> ($this:foo.AllOpenGenerated.NestedBar) returnType:bar.Bar
|
||||
$this: VALUE_PARAMETER name:<this> type:foo.AllOpenGenerated.NestedBar
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun materialize (): bar.Bar declared in foo.AllOpenGenerated.NestedBar'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in bar.Bar' type=bar.Bar origin=null
|
||||
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: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 [operator] 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: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
|
||||
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: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 [operator] 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: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
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
FILE: generatedClassWithMembersAndNestedClasses.kt
|
||||
package bar
|
||||
|
||||
@R|org/jetbrains/kotlin/fir/plugin/ExternalClassWithNested|() public final class Foo : R|kotlin/Any| {
|
||||
public constructor(): R|bar/Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
@R|org/jetbrains/kotlin/fir/plugin/ExternalClassWithNested|() public final class Bar : R|kotlin/Any| {
|
||||
public constructor(): R|bar/Bar| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun testConstructor(): R|kotlin/Unit| {
|
||||
lval generatedClass: R|foo/AllOpenGenerated| = R|foo/AllOpenGenerated|()
|
||||
}
|
||||
public final fun testNestedClasses(): R|kotlin/Unit| {
|
||||
lval nestedFoo: R|foo/AllOpenGenerated.NestedFoo| = Q|foo/AllOpenGenerated|.R|foo/AllOpenGenerated.NestedFoo|()
|
||||
R|<local>/nestedFoo|.R|foo/AllOpenGenerated.NestedFoo.materialize|().R|bar/Foo.foo|()
|
||||
lval nestedBar: R|foo/AllOpenGenerated.NestedBar| = Q|foo/AllOpenGenerated|.R|foo/AllOpenGenerated.NestedBar|()
|
||||
R|<local>/nestedBar|.R|foo/AllOpenGenerated.NestedBar.materialize|().R|bar/Bar.bar|()
|
||||
}
|
||||
FILE: __GENERATED DECLARATIONS__.kt
|
||||
package foo
|
||||
|
||||
public final class AllOpenGenerated : R|kotlin/Any| {
|
||||
public constructor(): R|foo/AllOpenGenerated|
|
||||
|
||||
public final class NestedFoo : R|kotlin/Any| {
|
||||
public final fun materialize(): R|bar/Foo|
|
||||
|
||||
public constructor(): R|foo/AllOpenGenerated.NestedFoo|
|
||||
|
||||
}
|
||||
|
||||
public final class NestedBar : R|kotlin/Any| {
|
||||
public final fun materialize(): R|bar/Bar|
|
||||
|
||||
public constructor(): R|foo/AllOpenGenerated.NestedBar|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package bar
|
||||
|
||||
import foo.AllOpenGenerated
|
||||
import org.jetbrains.kotlin.fir.plugin.ExternalClassWithNested
|
||||
|
||||
@ExternalClassWithNested
|
||||
class Foo {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
@ExternalClassWithNested
|
||||
class Bar {
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
fun testConstructor() {
|
||||
val generatedClass: AllOpenGenerated = AllOpenGenerated()
|
||||
}
|
||||
|
||||
fun testNestedClasses() {
|
||||
val nestedFoo = AllOpenGenerated.NestedFoo()
|
||||
nestedFoo.materialize().foo()
|
||||
|
||||
val nestedBar = AllOpenGenerated.NestedBar()
|
||||
nestedBar.materialize().bar()
|
||||
}
|
||||
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
FILE fqName:foo fileName:/topLevelCallables.kt
|
||||
CLASS CLASS name:MySuperClass modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
DummyFunction
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.MySuperClass
|
||||
CONSTRUCTOR visibility:public <> () returnType:foo.MySuperClass [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MySuperClass modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:test visibility:public modality:FINAL <> ($this:foo.MySuperClass) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:foo.MySuperClass
|
||||
BLOCK_BODY
|
||||
VAR name:s type:kotlin.String [val]
|
||||
CALL 'public final fun dummyMySuperClass (value: foo.MySuperClass): kotlin.String declared in foo' type=kotlin.String origin=null
|
||||
value: GET_VAR '<this>: foo.MySuperClass declared in foo.MySuperClass.test' type=foo.MySuperClass origin=null
|
||||
CALL 'public final fun takeString (s: kotlin.String): kotlin.Unit declared in foo' type=kotlin.Unit origin=null
|
||||
s: GET_VAR 'val s: kotlin.String [val] declared in foo.MySuperClass.test' type=kotlin.String origin=null
|
||||
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: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 [operator] 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: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
|
||||
FUN name:takeString visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:s index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
FILE fqName:foo fileName:__GENERATED DECLARATIONS__.kt
|
||||
FUN GENERATED[AllOpenPlugin] name:dummyMySuperClass visibility:public modality:FINAL <> (value:foo.MySuperClass) returnType:kotlin.String
|
||||
VALUE_PARAMETER GENERATED[AllOpenPlugin] name:value index:0 type:foo.MySuperClass
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
FILE: topLevelCallables.kt
|
||||
package foo
|
||||
|
||||
@R|org/jetbrains/kotlin/fir/plugin/DummyFunction|() public final class MySuperClass : R|kotlin/Any| {
|
||||
public constructor(): R|foo/MySuperClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval s: R|kotlin/String| = R|foo/dummyMySuperClass|(this@R|foo/MySuperClass|)
|
||||
R|foo/takeString|(R|<local>/s|)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun takeString(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
FILE: __GENERATED DECLARATIONS__.kt
|
||||
package foo
|
||||
|
||||
public final fun dummyMySuperClass(value: R|foo/MySuperClass|): R|kotlin/String|
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package foo
|
||||
|
||||
import org.jetbrains.kotlin.fir.plugin.DummyFunction
|
||||
|
||||
@DummyFunction
|
||||
class MySuperClass {
|
||||
fun test() {
|
||||
val s = dummyMySuperClass(this)
|
||||
takeString(s)
|
||||
}
|
||||
}
|
||||
|
||||
fun takeString(s: String) {}
|
||||
+24
@@ -25,9 +25,33 @@ public class AllOpenBlackBoxCodegenTestGenerated extends AbstractAllOpenBlackBox
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/fir/fir-plugin-prototype/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classWithCompanionObject.kt")
|
||||
public void testClassWithCompanionObject() throws Exception {
|
||||
runTest("plugins/fir/fir-plugin-prototype/testData/box/classWithCompanionObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classWithGeneratedMembersAndNestedClass.kt")
|
||||
public void testClassWithGeneratedMembersAndNestedClass() throws Exception {
|
||||
runTest("plugins/fir/fir-plugin-prototype/testData/box/classWithGeneratedMembersAndNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("generatedClassWithMembersAndNestedClasses.kt")
|
||||
public void testGeneratedClassWithMembersAndNestedClasses() throws Exception {
|
||||
runTest("plugins/fir/fir-plugin-prototype/testData/box/generatedClassWithMembersAndNestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("newSupertype.kt")
|
||||
public void testNewSupertype() throws Exception {
|
||||
runTest("plugins/fir/fir-plugin-prototype/testData/box/newSupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelCallables.kt")
|
||||
public void testTopLevelCallables() throws Exception {
|
||||
runTest("plugins/fir/fir-plugin-prototype/testData/box/topLevelCallables.kt");
|
||||
}
|
||||
}
|
||||
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.plugin.runners;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("plugins/fir/fir-plugin-prototype/testData/fir2ir")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Fir2IrAllOpenTestGenerated extends AbstractFir2IrAllOpenTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInFir2ir() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/fir/fir-plugin-prototype/testData/fir2ir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("plugins/fir/fir-plugin-prototype/testData/fir2ir/memberGen")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class MemberGen {
|
||||
@Test
|
||||
public void testAllFilesPresentInMemberGen() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/fir/fir-plugin-prototype/testData/fir2ir/memberGen"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classWithGeneratedMembersAndNestedClass.kt")
|
||||
public void testClassWithGeneratedMembersAndNestedClass() throws Exception {
|
||||
runTest("plugins/fir/fir-plugin-prototype/testData/fir2ir/memberGen/classWithGeneratedMembersAndNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("generatedClassWithMembersAndNestedClasses.kt")
|
||||
public void testGeneratedClassWithMembersAndNestedClasses() throws Exception {
|
||||
runTest("plugins/fir/fir-plugin-prototype/testData/fir2ir/memberGen/generatedClassWithMembersAndNestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelCallables.kt")
|
||||
public void testTopLevelCallables() throws Exception {
|
||||
runTest("plugins/fir/fir-plugin-prototype/testData/fir2ir/memberGen/topLevelCallables.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.plugin.runners
|
||||
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.backend.handlers.IrTextDumpHandler
|
||||
import org.jetbrains.kotlin.test.backend.handlers.IrTreeVerifierHandler
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.builders.fir2IrStep
|
||||
import org.jetbrains.kotlin.test.builders.irHandlersStep
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.DUMP_IR
|
||||
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerWithTargetBackendTest
|
||||
|
||||
open class AbstractFir2IrAllOpenTest : AbstractKotlinCompilerWithTargetBackendTest(TargetBackend.JVM_IR) {
|
||||
override fun TestConfigurationBuilder.configuration() {
|
||||
defaultDirectives {
|
||||
+DUMP_IR
|
||||
}
|
||||
|
||||
commonFirWithPluginFrontendConfiguration()
|
||||
fir2IrStep()
|
||||
irHandlersStep {
|
||||
useHandlers(
|
||||
::IrTextDumpHandler,
|
||||
::IrTreeVerifierHandler,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user