Introduce experimental FIR compiler #KT-31265 Fixed
This commit also includes several FIR2IR fixes which helps FIR compiler to produce normal results
This commit is contained in:
+2
-1
@@ -256,7 +256,8 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:fir:resolve",
|
||||
":compiler:fir:tree",
|
||||
":compiler:fir:psi2fir",
|
||||
":compiler:fir:fir2ir"
|
||||
":compiler:fir:fir2ir",
|
||||
":compiler:fir:java"
|
||||
)
|
||||
|
||||
val coreLibProjects = listOfNotNull(
|
||||
|
||||
@@ -20,6 +20,10 @@ dependencies {
|
||||
compile(project(":js:js.translator"))
|
||||
compile(commonDep("org.fusesource.jansi", "jansi"))
|
||||
compile(commonDep("org.jline", "jline"))
|
||||
compile(project(":compiler:fir:psi2fir"))
|
||||
compile(project(":compiler:fir:resolve"))
|
||||
compile(project(":compiler:fir:java"))
|
||||
compile(project(":compiler:fir:fir2ir"))
|
||||
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }
|
||||
|
||||
+6
@@ -286,6 +286,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
)
|
||||
var checkStickyPhaseConditions: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-fir",
|
||||
description = "Compile using Front-end IR. Warning: this feature is far from being production-ready"
|
||||
)
|
||||
var useFir: Boolean by FreezableVar(false)
|
||||
|
||||
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||
return HashMap<AnalysisFlag<*>, Any>().apply {
|
||||
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
|
||||
|
||||
@@ -22,6 +22,7 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
|
||||
createMetadataVersion: ((IntArray) -> BinaryVersion)? = null
|
||||
) {
|
||||
put(CommonConfigurationKeys.DISABLE_INLINE, arguments.noInline)
|
||||
put(CommonConfigurationKeys.USE_FIR, arguments.useFir)
|
||||
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
|
||||
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
|
||||
|
||||
|
||||
+171
-3
@@ -16,16 +16,21 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.jvm.compiler
|
||||
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.psi.PsiElementFinder
|
||||
import com.intellij.psi.PsiJavaModule
|
||||
import com.intellij.psi.search.DelegatingGlobalSearchScope
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.search.ProjectScope
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.asJava.FilteredJvmDiagnostics
|
||||
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection
|
||||
import org.jetbrains.kotlin.backend.common.output.SimpleOutputFileCollection
|
||||
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
||||
@@ -47,15 +52,28 @@ import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationStateEventCallback
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.backend.Fir2IrConverter
|
||||
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
|
||||
import org.jetbrains.kotlin.fir.java.FirJavaModuleBasedSession
|
||||
import org.jetbrains.kotlin.fir.java.FirLibrarySession
|
||||
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.FirProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
|
||||
import org.jetbrains.kotlin.fir.service
|
||||
import org.jetbrains.kotlin.idea.MainFunctionDetector
|
||||
import org.jetbrains.kotlin.javac.JavacWrapper
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.modules.TargetId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
import org.jetbrains.kotlin.utils.newLinkedHashMapWithExpectedSize
|
||||
import org.jetbrains.kotlin.utils.tryConstructClassFromStringArgs
|
||||
import java.io.File
|
||||
@@ -102,8 +120,6 @@ object KotlinToJVMBytecodeCompiler {
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
|
||||
val moduleVisibilityManager = ModuleVisibilityManager.SERVICE.getInstance(environment.project)
|
||||
|
||||
val projectConfiguration = environment.configuration
|
||||
for (module in chunk) {
|
||||
moduleVisibilityManager.addModule(module)
|
||||
}
|
||||
@@ -113,6 +129,11 @@ object KotlinToJVMBytecodeCompiler {
|
||||
moduleVisibilityManager.addFriendPath(path)
|
||||
}
|
||||
|
||||
val projectConfiguration = environment.configuration
|
||||
if (projectConfiguration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||
return compileModulesUsingFrontendIR(environment, buildFile, chunk)
|
||||
}
|
||||
|
||||
val targetDescription = "in targets [" + chunk.joinToString { input -> input.getModuleName() + "-" + input.getModuleType() } + "]"
|
||||
|
||||
val result = repeatAnalysisIfNeeded(analyze(environment, targetDescription), environment, targetDescription)
|
||||
@@ -164,6 +185,15 @@ object KotlinToJVMBytecodeCompiler {
|
||||
outputs[module] = generate(environment, moduleConfiguration, result, ktFiles, module)
|
||||
}
|
||||
|
||||
return writeOutputs(environment, projectConfiguration, chunk, outputs)
|
||||
}
|
||||
|
||||
private fun writeOutputs(
|
||||
environment: KotlinCoreEnvironment,
|
||||
projectConfiguration: CompilerConfiguration,
|
||||
chunk: List<Module>,
|
||||
outputs: Map<Module, GenerationState>
|
||||
): Boolean {
|
||||
try {
|
||||
for ((_, state) in outputs) {
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
@@ -238,6 +268,143 @@ object KotlinToJVMBytecodeCompiler {
|
||||
configuration.addAll(JVMConfigurationKeys.MODULES, chunk)
|
||||
}
|
||||
|
||||
private fun compileModulesUsingFrontendIR(environment: KotlinCoreEnvironment, buildFile: File?, chunk: List<Module>): Boolean {
|
||||
val project = environment.project
|
||||
Extensions.getArea(project)
|
||||
.getExtensionPoint(PsiElementFinder.EP_NAME)
|
||||
.unregisterExtension(JavaElementFinder::class.java)
|
||||
|
||||
val projectConfiguration = environment.configuration
|
||||
val localFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL)
|
||||
val outputs = newLinkedHashMapWithExpectedSize<Module, GenerationState>(chunk.size)
|
||||
for (module in chunk) {
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
|
||||
val ktFiles = if (chunk.size > 1) {
|
||||
// filter out source files from other modules
|
||||
assert(buildFile != null) { "Compiling multiple modules, but build file is null" }
|
||||
val (moduleSourceDirs, moduleSourceFiles) =
|
||||
getBuildFilePaths(buildFile, module.getSourceFiles())
|
||||
.mapNotNull(localFileSystem::findFileByPath)
|
||||
.partition(VirtualFile::isDirectory)
|
||||
|
||||
environment.getSourceFiles().filter { file ->
|
||||
val virtualFile = file.virtualFile
|
||||
virtualFile in moduleSourceFiles || moduleSourceDirs.any { dir ->
|
||||
VfsUtilCore.isAncestor(dir, virtualFile, true)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
environment.getSourceFiles()
|
||||
}
|
||||
|
||||
if (!checkKotlinPackageUsage(environment, ktFiles)) return false
|
||||
|
||||
val moduleConfiguration = projectConfiguration.copy().apply {
|
||||
if (buildFile != null) {
|
||||
fun checkKeyIsNull(key: CompilerConfigurationKey<*>, name: String) {
|
||||
assert(get(key) == null) { "$name should be null, when buildFile is used" }
|
||||
}
|
||||
|
||||
checkKeyIsNull(JVMConfigurationKeys.OUTPUT_DIRECTORY, "OUTPUT_DIRECTORY")
|
||||
checkKeyIsNull(JVMConfigurationKeys.OUTPUT_JAR, "OUTPUT_JAR")
|
||||
put(JVMConfigurationKeys.OUTPUT_DIRECTORY, File(module.getOutputDirectory()))
|
||||
}
|
||||
}
|
||||
|
||||
val scope = GlobalSearchScope.filesScope(project, ktFiles.map { it.virtualFile })
|
||||
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project))
|
||||
val provider = FirProjectSessionProvider(project)
|
||||
|
||||
class FirJvmModuleInfo(override val name: Name) : ModuleInfo {
|
||||
constructor(moduleName: String) : this(Name.identifier(moduleName))
|
||||
|
||||
val dependencies: MutableList<ModuleInfo> = mutableListOf()
|
||||
|
||||
override val platform: TargetPlatform? get() = JvmPlatform
|
||||
|
||||
override fun dependencies(): List<ModuleInfo> {
|
||||
return dependencies
|
||||
}
|
||||
}
|
||||
|
||||
val moduleInfo = FirJvmModuleInfo(module.getModuleName())
|
||||
val session: FirSession = FirJavaModuleBasedSession(moduleInfo, provider, scope).also {
|
||||
val dependenciesInfo = FirJvmModuleInfo(Name.special("<dependencies>"))
|
||||
moduleInfo.dependencies.add(dependenciesInfo)
|
||||
val librariesScope = ProjectScope.getLibrariesScope(project)
|
||||
FirLibrarySession.create(
|
||||
dependenciesInfo, provider, librariesScope,
|
||||
project, environment.createPackagePartProvider(librariesScope)
|
||||
)
|
||||
|
||||
}
|
||||
val builder = RawFirBuilder(session, stubMode = false)
|
||||
val resolveTransformer = FirTotalResolveTransformer()
|
||||
val firFiles = ktFiles.map {
|
||||
val firFile = builder.buildFirFile(it)
|
||||
(session.service<FirProvider>() as FirProviderImpl).recordFile(firFile)
|
||||
firFile
|
||||
}.also {
|
||||
try {
|
||||
resolveTransformer.processFiles(it)
|
||||
} catch (e: Exception) {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
val (moduleFragment, symbolTable, sourceManager) =
|
||||
Fir2IrConverter.createModuleFragment(session, firFiles, moduleConfiguration.languageVersionSettings)
|
||||
val dummyBindingContext = NoScopeRecordCliBindingTrace().bindingContext
|
||||
|
||||
val codegenFactory = JvmIrCodegenFactory(moduleConfiguration.get(CLIConfigurationKeys.PHASE_CONFIG) ?: PhaseConfig(jvmPhases))
|
||||
val generationState = GenerationState.Builder(
|
||||
environment.project, ClassBuilderFactories.BINARIES,
|
||||
moduleFragment.descriptor, dummyBindingContext, ktFiles,
|
||||
moduleConfiguration
|
||||
).codegenFactory(
|
||||
codegenFactory
|
||||
).withModule(
|
||||
module
|
||||
).onIndependentPartCompilationEnd(
|
||||
createOutputFilesFlushingCallbackIfPossible(moduleConfiguration)
|
||||
).build()
|
||||
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
|
||||
val performanceManager = environment.configuration.get(CLIConfigurationKeys.PERF_MANAGER)
|
||||
performanceManager?.notifyGenerationStarted()
|
||||
generationState.beforeCompile()
|
||||
codegenFactory.generateModule(
|
||||
generationState, moduleFragment, CompilationErrorHandler.THROW_EXCEPTION, symbolTable, sourceManager
|
||||
)
|
||||
CodegenFactory.doCheckCancelled(generationState)
|
||||
generationState.factory.done()
|
||||
performanceManager?.notifyGenerationFinished(
|
||||
ktFiles.size,
|
||||
environment.countLinesOfCode(ktFiles),
|
||||
additionalDescription = "target " + module.getModuleName() + "-" + module.getModuleType() + " "
|
||||
)
|
||||
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
|
||||
AnalyzerWithCompilerReport.reportDiagnostics(
|
||||
FilteredJvmDiagnostics(
|
||||
generationState.collectedExtraJvmDiagnostics,
|
||||
dummyBindingContext.diagnostics
|
||||
),
|
||||
environment.messageCollector
|
||||
)
|
||||
|
||||
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
|
||||
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector
|
||||
)
|
||||
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
outputs[module] = generationState
|
||||
}
|
||||
return writeOutputs(environment, projectConfiguration, chunk, outputs)
|
||||
}
|
||||
|
||||
private fun getBuildFilePaths(buildFile: File?, sourceFilePaths: List<String>): List<String> =
|
||||
if (buildFile == null) sourceFilePaths
|
||||
else sourceFilePaths.map { path ->
|
||||
@@ -447,7 +614,8 @@ object KotlinToJVMBytecodeCompiler {
|
||||
sourceFiles: List<KtFile>,
|
||||
module: Module?
|
||||
): GenerationState {
|
||||
val isIR = configuration.getBoolean(JVMConfigurationKeys.IR)
|
||||
val isIR = configuration.getBoolean(JVMConfigurationKeys.IR) ||
|
||||
configuration.getBoolean(CommonConfigurationKeys.USE_FIR)
|
||||
val generationState = GenerationState.Builder(
|
||||
environment.project,
|
||||
ClassBuilderFactories.BINARIES,
|
||||
|
||||
@@ -17,6 +17,8 @@ import org.jetbrains.kotlin.ir.util.ConstantValueGenerator
|
||||
import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.TypeTranslator
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi2ir.PsiSourceManager
|
||||
|
||||
object Fir2IrConverter {
|
||||
|
||||
@@ -25,7 +27,7 @@ object Fir2IrConverter {
|
||||
firFiles: List<FirFile>,
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
fakeOverrideMode: FakeOverrideMode = FakeOverrideMode.NORMAL
|
||||
): IrModuleFragment {
|
||||
): Fir2IrResult {
|
||||
val moduleDescriptor = FirModuleDescriptor(session)
|
||||
val symbolTable = SymbolTable()
|
||||
val constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable)
|
||||
@@ -33,15 +35,19 @@ object Fir2IrConverter {
|
||||
constantValueGenerator.typeTranslator = typeTranslator
|
||||
typeTranslator.constantValueGenerator = constantValueGenerator
|
||||
val builtIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
|
||||
val fir2irTransformer = Fir2IrVisitor(session, moduleDescriptor, symbolTable, builtIns, fakeOverrideMode)
|
||||
val sourceManager = PsiSourceManager()
|
||||
val fir2irTransformer = Fir2IrVisitor(session, moduleDescriptor, symbolTable, sourceManager, builtIns, fakeOverrideMode)
|
||||
val irFiles = mutableListOf<IrFile>()
|
||||
for (firFile in firFiles) {
|
||||
irFiles += firFile.accept(fir2irTransformer, null) as IrFile
|
||||
val irFile = firFile.accept(fir2irTransformer, null) as IrFile
|
||||
val fileEntry = sourceManager.getOrCreateFileEntry(firFile.psi as KtFile)
|
||||
sourceManager.putFileEntry(irFile, fileEntry)
|
||||
irFiles += irFile
|
||||
}
|
||||
|
||||
val irModuleFragment = IrModuleFragmentImpl(moduleDescriptor, builtIns, irFiles)
|
||||
generateUnboundSymbolsAsDependencies(irModuleFragment, symbolTable, builtIns)
|
||||
return irModuleFragment
|
||||
return Fir2IrResult(irModuleFragment, symbolTable, sourceManager)
|
||||
}
|
||||
|
||||
private fun generateUnboundSymbolsAsDependencies(
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.backend
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.psi2ir.PsiSourceManager
|
||||
|
||||
data class Fir2IrResult(val irModuleFragment: IrModuleFragment, val symbolTable: SymbolTable, val sourceManager: PsiSourceManager)
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.backend
|
||||
|
||||
import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
@@ -60,6 +59,7 @@ internal class Fir2IrVisitor(
|
||||
private val session: FirSession,
|
||||
private val moduleDescriptor: FirModuleDescriptor,
|
||||
private val symbolTable: SymbolTable,
|
||||
private val sourceManager: PsiSourceManager,
|
||||
private val irBuiltIns: IrBuiltIns,
|
||||
private val fakeOverrideMode: FakeOverrideMode
|
||||
) : FirVisitor<IrElement, Any?>() {
|
||||
@@ -140,7 +140,7 @@ internal class Fir2IrVisitor(
|
||||
|
||||
override fun visitFile(file: FirFile, data: Any?): IrFile {
|
||||
return IrFileImpl(
|
||||
PsiSourceManager.PsiFileEntry(file.psi as PsiFile),
|
||||
sourceManager.getOrCreateFileEntry(file.psi as KtFile),
|
||||
moduleDescriptor.findPackageFragmentForFile(file)
|
||||
).withParent {
|
||||
file.declarations.forEach {
|
||||
@@ -680,7 +680,7 @@ internal class Fir2IrVisitor(
|
||||
|
||||
private fun IrExpression.applyCallArguments(call: FirCall): IrExpression {
|
||||
return when (this) {
|
||||
is IrCallImpl -> {
|
||||
is IrCallWithIndexedArgumentsBase -> {
|
||||
val argumentsCount = call.arguments.size
|
||||
if (argumentsCount <= valueArgumentsCount) {
|
||||
apply {
|
||||
@@ -690,9 +690,10 @@ internal class Fir2IrVisitor(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val name = if (this is IrCallImpl) symbol.owner.name else "???"
|
||||
IrErrorCallExpressionImpl(
|
||||
startOffset, endOffset, type,
|
||||
"Cannot bind $argumentsCount arguments to ${symbol.owner.name} call with $valueArgumentsCount parameters"
|
||||
"Cannot bind $argumentsCount arguments to $name call with $valueArgumentsCount parameters"
|
||||
).apply {
|
||||
for (argument in call.arguments) {
|
||||
addArgument(argument.toIrExpression())
|
||||
|
||||
@@ -69,6 +69,6 @@ class FirModuleDescriptor(val session: FirSession) : ModuleDescriptor {
|
||||
}
|
||||
|
||||
override val annotations: Annotations
|
||||
get() = TODO("not implemented")
|
||||
get() = Annotations.EMPTY
|
||||
|
||||
}
|
||||
+2
-2
@@ -18,7 +18,7 @@ class FirPackageFragmentDescriptor(override val fqName: FqName, val moduleDescri
|
||||
|
||||
|
||||
override fun getMemberScope(): MemberScope {
|
||||
TODO("not implemented")
|
||||
return MemberScope.Empty
|
||||
}
|
||||
|
||||
override fun getOriginal(): DeclarationDescriptorWithSource {
|
||||
@@ -42,6 +42,6 @@ class FirPackageFragmentDescriptor(override val fqName: FqName, val moduleDescri
|
||||
}
|
||||
|
||||
override val annotations: Annotations
|
||||
get() = TODO("not implemented")
|
||||
get() = Annotations.EMPTY
|
||||
|
||||
}
|
||||
+4
-2
@@ -17,9 +17,11 @@ class FirPackageViewDescriptor(override val fqName: FqName, val moduleDescriptor
|
||||
}
|
||||
|
||||
override val memberScope: MemberScope
|
||||
get() = TODO("not implemented")
|
||||
get() = MemberScope.Empty
|
||||
|
||||
override val module: ModuleDescriptor
|
||||
get() = moduleDescriptor
|
||||
|
||||
override val fragments: List<PackageFragmentDescriptor>
|
||||
get() = listOf(FirPackageFragmentDescriptor(fqName, moduleDescriptor))
|
||||
|
||||
@@ -40,6 +42,6 @@ class FirPackageViewDescriptor(override val fqName: FqName, val moduleDescriptor
|
||||
}
|
||||
|
||||
override val annotations: Annotations
|
||||
get() = TODO("not implemented")
|
||||
get() = Annotations.EMPTY
|
||||
|
||||
}
|
||||
@@ -91,6 +91,8 @@ abstract class AbstractFir2IrTextTest : AbstractIrTextTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
return Fir2IrConverter.createModuleFragment(session, firFiles, myEnvironment.configuration.languageVersionSettings)
|
||||
return Fir2IrConverter.createModuleFragment(
|
||||
session, firFiles, myEnvironment.configuration.languageVersionSettings
|
||||
).irModuleFragment
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,9 @@ object CommonConfigurationKeys {
|
||||
|
||||
@JvmField
|
||||
val METADATA_VERSION = CompilerConfigurationKey.create<BinaryVersion>("metadata version")
|
||||
|
||||
@JvmField
|
||||
val USE_FIR = CompilerConfigurationKey.create<Boolean>("front-end IR")
|
||||
}
|
||||
|
||||
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
|
||||
|
||||
@@ -10,8 +10,10 @@ import org.jetbrains.kotlin.codegen.CompilationErrorHandler
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi2ir.Psi2IrTranslator
|
||||
import org.jetbrains.kotlin.psi2ir.PsiSourceManager
|
||||
import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext
|
||||
|
||||
object JvmBackendFacade {
|
||||
@@ -34,15 +36,28 @@ object JvmBackendFacade {
|
||||
irModuleFragment: IrModuleFragment,
|
||||
psi2irContext: GeneratorContext,
|
||||
phaseConfig: PhaseConfig
|
||||
) {
|
||||
doGenerateFilesInternal(
|
||||
state, errorHandler, irModuleFragment, psi2irContext.symbolTable, psi2irContext.sourceManager, phaseConfig
|
||||
)
|
||||
}
|
||||
|
||||
internal fun doGenerateFilesInternal(
|
||||
state: GenerationState,
|
||||
errorHandler: CompilationErrorHandler,
|
||||
irModuleFragment: IrModuleFragment,
|
||||
symbolTable: SymbolTable,
|
||||
sourceManager: PsiSourceManager,
|
||||
phaseConfig: PhaseConfig
|
||||
) {
|
||||
val jvmBackendContext = JvmBackendContext(
|
||||
state, psi2irContext.sourceManager, psi2irContext.irBuiltIns, irModuleFragment, psi2irContext.symbolTable, phaseConfig
|
||||
state, sourceManager, irModuleFragment.irBuiltins, irModuleFragment, symbolTable, phaseConfig
|
||||
)
|
||||
//TODO
|
||||
ExternalDependenciesGenerator(
|
||||
irModuleFragment.descriptor,
|
||||
psi2irContext.symbolTable,
|
||||
psi2irContext.irBuiltIns,
|
||||
symbolTable,
|
||||
irModuleFragment.irBuiltins,
|
||||
JvmGeneratorExtensions.externalDeclarationOrigin
|
||||
).generateUnboundSymbolsAsDependencies()
|
||||
|
||||
|
||||
@@ -20,9 +20,12 @@ import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi2ir.Psi2IrTranslator
|
||||
import org.jetbrains.kotlin.psi2ir.PsiSourceManager
|
||||
|
||||
class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory {
|
||||
|
||||
@@ -33,6 +36,16 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
||||
JvmBackendFacade.doGenerateFilesInternal(state, errorHandler, irModuleFragment, psi2irContext, phaseConfig)
|
||||
}
|
||||
|
||||
fun generateModule(
|
||||
state: GenerationState,
|
||||
irModuleFragment: IrModuleFragment,
|
||||
errorHandler: CompilationErrorHandler,
|
||||
symbolTable: SymbolTable,
|
||||
sourceManager: PsiSourceManager
|
||||
) {
|
||||
JvmBackendFacade.doGenerateFilesInternal(state, errorHandler, irModuleFragment, symbolTable, sourceManager, phaseConfig)
|
||||
}
|
||||
|
||||
override fun createPackageCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName): PackageCodegen {
|
||||
val impl = PackageCodegenImpl(state, files, fqName)
|
||||
|
||||
|
||||
+1
@@ -43,6 +43,7 @@ where advanced options include:
|
||||
-Xreport-perf Report detailed performance statistics
|
||||
-Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes)
|
||||
-Xuse-experimental=<fq.name> Enable, but don't propagate usages of experimental API for marker annotation with the given fully qualified name
|
||||
-Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready
|
||||
-Xverbose-phases Be verbose while performing these backend phases
|
||||
|
||||
Advanced options are non-standard and may be changed or removed without any notice.
|
||||
|
||||
+1
@@ -107,6 +107,7 @@ where advanced options include:
|
||||
-Xreport-perf Report detailed performance statistics
|
||||
-Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes)
|
||||
-Xuse-experimental=<fq.name> Enable, but don't propagate usages of experimental API for marker annotation with the given fully qualified name
|
||||
-Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready
|
||||
-Xverbose-phases Be verbose while performing these backend phases
|
||||
|
||||
Advanced options are non-standard and may be changed or removed without any notice.
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
$TESTDATA_DIR$/firHello.kt
|
||||
-Xuse-fir
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun box(): String = "OK"
|
||||
|
||||
|
||||
class E(s: String) : Exception(s) {
|
||||
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (box() == "OK") {
|
||||
throw E("Hello")
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
OK
|
||||
+3
-3
@@ -55,7 +55,7 @@ FILE fqName:<root> fileName:/classLiteralInAnnotation.kt
|
||||
BLOCK type=<root>.test2.<no name provided> origin=OBJECT_LITERAL
|
||||
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
A(klass = <null>)
|
||||
A(klass = GET_CLASS type=kotlin.reflect.KClass<IrErrorType>)
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.test2.<no name provided>
|
||||
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
||||
BLOCK_BODY
|
||||
@@ -70,7 +70,7 @@ FILE fqName:<root> fileName:/classLiteralInAnnotation.kt
|
||||
BLOCK type=<root>.<get-test3>.<no name provided> origin=OBJECT_LITERAL
|
||||
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
A(klass = <null>)
|
||||
A(klass = GET_CLASS type=kotlin.reflect.KClass<IrErrorType>)
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.<get-test3>.<no name provided>
|
||||
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
||||
BLOCK_BODY
|
||||
@@ -84,7 +84,7 @@ FILE fqName:<root> fileName:/classLiteralInAnnotation.kt
|
||||
BLOCK type=<root>.<set-test3>.<no name provided> origin=OBJECT_LITERAL
|
||||
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
A(klass = <null>)
|
||||
A(klass = GET_CLASS type=kotlin.reflect.KClass<IrErrorType>)
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.<set-test3>.<no name provided>
|
||||
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
||||
BLOCK_BODY
|
||||
|
||||
+6
-6
@@ -29,7 +29,7 @@ FILE fqName:<root> fileName:/classesWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:TestClass modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'class')
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestClass
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.TestClass [primary]
|
||||
BLOCK_BODY
|
||||
@@ -50,7 +50,7 @@ FILE fqName:<root> fileName:/classesWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:TestInterface modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'interface')
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestInterface
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
overridden:
|
||||
@@ -67,7 +67,7 @@ FILE fqName:<root> fileName:/classesWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS OBJECT name:TestObject modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'object')
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestObject
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.TestObject [primary]
|
||||
BLOCK_BODY
|
||||
@@ -94,7 +94,7 @@ FILE fqName:<root> fileName:/classesWithAnnotations.kt
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
CLASS OBJECT name:TestCompanion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'companion')
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Host.TestCompanion
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.Host.TestCompanion [primary]
|
||||
BLOCK_BODY
|
||||
@@ -128,7 +128,7 @@ FILE fqName:<root> fileName:/classesWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS ENUM_CLASS name:TestEnum modality:FINAL visibility:public superTypes:[kotlin.Enum]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'enum')
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.TestEnum [primary]
|
||||
BLOCK_BODY
|
||||
@@ -158,7 +158,7 @@ FILE fqName:<root> fileName:/classesWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Enum
|
||||
CLASS ANNOTATION_CLASS name:TestAnnotation modality:FINAL visibility:public superTypes:[kotlin.Annotation]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'annotation')
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestAnnotation
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.TestAnnotation [primary]
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
|
||||
+4
-4
@@ -83,7 +83,7 @@ FILE fqName:<root> fileName:/delegatedPropertyAccessorsWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
PROPERTY name:test1 visibility:public modality:FINAL [delegated,val]
|
||||
annotations:
|
||||
A(x = <null>)
|
||||
A(x = 'test1.get')
|
||||
FIELD PROPERTY_BACKING_FIELD name:test1 type:IrErrorType visibility:public [final,static]
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [delegated,val]
|
||||
@@ -92,9 +92,9 @@ FILE fqName:<root> fileName:/delegatedPropertyAccessorsWithAnnotations.kt
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:IrErrorType visibility:public [final,static] ' type=IrErrorType origin=null
|
||||
PROPERTY name:test2 visibility:public modality:FINAL [delegated,var]
|
||||
annotations:
|
||||
A(x = <null>)
|
||||
A(x = <null>)
|
||||
A(x = <null>)
|
||||
A(x = 'test2.get')
|
||||
A(x = 'test2.set')
|
||||
A(x = 'test2.set.param')
|
||||
FIELD PROPERTY_BACKING_FIELD name:test2 type:IrErrorType visibility:public [static]
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [delegated,var]
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ FILE fqName:<root> fileName:/enumEntriesWithAnnotations.kt
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestEnum modality:FINAL visibility:public superTypes:[kotlin.Enum]'
|
||||
CLASS ENUM_ENTRY name:ENTRY1 modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'ENTRY1')
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum.ENTRY1
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.TestEnum.ENTRY1 [primary]
|
||||
BLOCK_BODY
|
||||
@@ -56,7 +56,7 @@ FILE fqName:<root> fileName:/enumEntriesWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS ENUM_ENTRY name:ENTRY2 modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'ENTRY2')
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum.ENTRY2
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.TestEnum.ENTRY2 [primary]
|
||||
BLOCK_BODY
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ FILE fqName:<root> fileName:/fieldsWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
PROPERTY name:testVal visibility:public modality:FINAL [val]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'testVal.field')
|
||||
FIELD PROPERTY_BACKING_FIELD name:testVal type:kotlin.String visibility:public [final,static]
|
||||
EXPRESSION_BODY
|
||||
CONST String type=kotlin.String value="a val"
|
||||
@@ -40,7 +40,7 @@ FILE fqName:<root> fileName:/fieldsWithAnnotations.kt
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVal type:kotlin.String visibility:public [final,static] ' type=kotlin.String origin=null
|
||||
PROPERTY name:testVar visibility:public modality:FINAL [var]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'testVar.field')
|
||||
FIELD PROPERTY_BACKING_FIELD name:testVar type:kotlin.String visibility:public [static]
|
||||
EXPRESSION_BODY
|
||||
CONST String type=kotlin.String value="a var"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
FILE fqName:test fileName:/fileAnnotations.kt
|
||||
annotations:
|
||||
A(x = <null>)
|
||||
A(x = 'File annotation')
|
||||
CLASS ANNOTATION_CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Annotation]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR visibility:public <> (x:kotlin.String) returnType:test.A [primary]
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ FILE fqName:<root> fileName:/propertiesWithAnnotations.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
PROPERTY name:testVal visibility:public modality:FINAL [val]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'testVal.property')
|
||||
FIELD PROPERTY_BACKING_FIELD name:testVal type:kotlin.String visibility:public [final,static]
|
||||
EXPRESSION_BODY
|
||||
CONST String type=kotlin.String value=""
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ FILE fqName:<root> fileName:/propertyAccessorsFromClassHeaderWithAnnotations.kt
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
annotations:
|
||||
A(x = <null>)
|
||||
A(x = 'C.x.get')
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: kotlin.Int declared in <root>.C.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
@@ -50,8 +50,8 @@ FILE fqName:<root> fileName:/propertyAccessorsFromClassHeaderWithAnnotations.kt
|
||||
receiver: GET_VAR '<this>: <root>.C declared in <root>.C.<get-x>' type=<root>.C origin=null
|
||||
PROPERTY name:y visibility:public modality:FINAL [var]
|
||||
annotations:
|
||||
A(x = <null>)
|
||||
A(x = <null>)
|
||||
A(x = 'C.y.get')
|
||||
A(x = 'C.y.set')
|
||||
FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:public
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'y: kotlin.Int declared in <root>.C.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
|
||||
Vendored
+3
-3
@@ -45,7 +45,7 @@ FILE fqName:<root> fileName:/propertyAccessorsWithAnnotations.kt
|
||||
BLOCK_BODY
|
||||
PROPERTY name:test3 visibility:public modality:FINAL [val]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'test3.get')
|
||||
FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.String visibility:public [final,static]
|
||||
EXPRESSION_BODY
|
||||
CONST String type=kotlin.String value=""
|
||||
@@ -56,8 +56,8 @@ FILE fqName:<root> fileName:/propertyAccessorsWithAnnotations.kt
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.String visibility:public [final,static] ' type=kotlin.String origin=null
|
||||
PROPERTY name:test4 visibility:public modality:FINAL [var]
|
||||
annotations:
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = <null>)
|
||||
TestAnn(x = 'test4.get')
|
||||
TestAnn(x = 'test4.set')
|
||||
FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.String visibility:public [static]
|
||||
EXPRESSION_BODY
|
||||
CONST String type=kotlin.String value=""
|
||||
|
||||
@@ -62,7 +62,8 @@ FILE fqName:<root> fileName:/local.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun provideDelegate (thisRef: kotlin.Any?, property: kotlin.Any?): <root>.Delegate declared in <root>.DelegateProvider'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (value: kotlin.String) [primary] declared in <root>.Delegate' type=<root>.Delegate origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
value: CALL 'public final fun <get-value> (): kotlin.String declared in <root>.DelegateProvider' type=kotlin.String origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
|
||||
@@ -62,7 +62,8 @@ FILE fqName:<root> fileName:/member.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun provideDelegate (thisRef: kotlin.Any?, property: kotlin.Any?): <root>.Delegate declared in <root>.DelegateProvider'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (value: kotlin.String) [primary] declared in <root>.Delegate' type=<root>.Delegate origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
value: CALL 'public final fun <get-value> (): kotlin.String declared in <root>.DelegateProvider' type=kotlin.String origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
|
||||
+2
-1
@@ -51,7 +51,8 @@ FILE fqName:<root> fileName:/memberExtension.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun provideDelegate (host: kotlin.Any?, p: kotlin.Any): <root>.Host.StringDelegate declared in <root>.Host'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (s: kotlin.String) [primary] declared in <root>.Host.StringDelegate' type=<root>.Host.StringDelegate origin=null
|
||||
PROPERTY name:plusK visibility:public modality:FINAL [delegated,val]
|
||||
s: ERROR_CALL 'Unresolved reference: this#' type=kotlin.String
|
||||
PROPERTY name:plusK visibility:public modality:FINAL [delegated,val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:plusK type:IrErrorType visibility:public [final]
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-plusK> visibility:public modality:FINAL <> ($this:<root>.Host) returnType:IrErrorType
|
||||
correspondingProperty: PROPERTY name:plusK visibility:public modality:FINAL [delegated,val]
|
||||
|
||||
@@ -62,7 +62,8 @@ FILE fqName:<root> fileName:/topLevel.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun provideDelegate (thisRef: kotlin.Any?, property: kotlin.Any?): <root>.Delegate declared in <root>.DelegateProvider'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (value: kotlin.String) [primary] declared in <root>.Delegate' type=<root>.Delegate origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
value: CALL 'public final fun <get-value> (): kotlin.String declared in <root>.DelegateProvider' type=kotlin.String origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
|
||||
@@ -64,7 +64,8 @@ FILE fqName:<root> fileName:/forWithImplicitReceivers.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun iterator (): <root>.IntCell declared in <root>.IReceiver'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (value: kotlin.Int) [primary] declared in <root>.IntCell' type=<root>.IntCell origin=null
|
||||
FUN name:hasNext visibility:public modality:OPEN <> ($this:<root>.IReceiver) returnType:kotlin.Boolean
|
||||
value: CONST Int type=kotlin.Int value=5
|
||||
FUN name:hasNext visibility:public modality:OPEN <> ($this:<root>.IReceiver) returnType:kotlin.Boolean
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.IReceiver
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun hasNext (): kotlin.Boolean declared in <root>.IReceiver'
|
||||
|
||||
+7
@@ -12,6 +12,13 @@ FILE fqName:<root> fileName:/genericConstructorCallWithTypeArguments.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testArray <T> (n: kotlin.Int, block: kotlin.Function0<T of <root>.testArray>): kotlin.Array<T of <root>.testArray> [inline] declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (size: kotlin.Int, init: kotlin.Function1<kotlin.Int, T of <uninitialized parent>>) declared in kotlin.Array' type=kotlin.Array<T of <root>.testArray> origin=null
|
||||
size: GET_VAR 'n: kotlin.Int declared in <root>.testArray' type=kotlin.Int origin=null
|
||||
init: BLOCK type=T of <uninitialized parent> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:T of <uninitialized parent>
|
||||
VALUE_PARAMETER name:it index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: block>#' type=IrErrorType
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (it: kotlin.Int): T of <uninitialized parent> declared in <root>.testArray' type=T of <uninitialized parent> origin=LAMBDA
|
||||
CLASS CLASS name:Box modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Box
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[]
|
||||
|
||||
@@ -25,7 +25,8 @@ FILE fqName:<root> fileName:/memberTypeArguments.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun withNewValue (newValue: T of <root>.GenericClass): <root>.GenericClass<T of <root>.GenericClass> declared in <root>.GenericClass'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (value: T of <uninitialized parent>) [primary] declared in <root>.GenericClass' type=<root>.GenericClass<T of <root>.GenericClass> origin=null
|
||||
<class: T>: <none>
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
value: GET_VAR 'newValue: T of <root>.GenericClass declared in <root>.GenericClass.withNewValue' type=T of <root>.GenericClass origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
|
||||
+1
@@ -36,3 +36,4 @@ FILE fqName:<root> fileName:/specializedTypeAliasConstructorCall.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun test (): <root>.Cell<kotlin.Int> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (value: T of <uninitialized parent>) [primary] declared in <root>.Cell' type=<root>.Cell<kotlin.Int> origin=null
|
||||
<class: T>: <none>
|
||||
value: CONST Int type=kotlin.Int value=42
|
||||
|
||||
@@ -3,7 +3,8 @@ FILE fqName:<root> fileName:/coercionInLoop.kt
|
||||
BLOCK_BODY
|
||||
VAR name:a type:kotlin.DoubleArray [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (size: kotlin.Int) [primary] declared in kotlin.DoubleArray' type=kotlin.DoubleArray origin=null
|
||||
VAR name:x type:kotlin.collections.DoubleIterator [val]
|
||||
size: CONST Int type=kotlin.Int value=5
|
||||
VAR name:x type:kotlin.collections.DoubleIterator [val]
|
||||
CALL 'public final fun iterator (): kotlin.collections.DoubleIterator declared in kotlin.DoubleArray' type=kotlin.collections.DoubleIterator origin=null
|
||||
VAR name:i type:kotlin.Int [var]
|
||||
CONST Int type=kotlin.Int value=0
|
||||
|
||||
@@ -36,6 +36,8 @@ FILE fqName:<root> fileName:/typeAliasCtorForGenericClass.kt
|
||||
VAR name:b type:<root>.A<kotlin.Int> [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (q: Q of <uninitialized parent>) [primary] declared in <root>.A' type=<root>.A<kotlin.Int> origin=null
|
||||
<class: Q>: <none>
|
||||
q: CONST Int type=kotlin.Int value=2
|
||||
VAR name:b2 type:<root>.A<<root>.A<kotlin.Int>> [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (q: Q of <uninitialized parent>) [primary] declared in <root>.A' type=<root>.A<<root>.A<kotlin.Int>> origin=null
|
||||
<class: Q>: <none>
|
||||
q: GET_VAR 'val b: <root>.A<kotlin.Int> [val] declared in <root>.bar' type=<root>.A<kotlin.Int> origin=null
|
||||
|
||||
+2
-1
@@ -7,7 +7,8 @@ FILE fqName:<root> fileName:/javaConstructorWithTypeParameters.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test2 (): <root>.J1<kotlin.Int> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (x1: X1 of <uninitialized parent>?) declared in <root>.J1' type=<root>.J1<kotlin.Int> origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <> (j1:<root>.J1<kotlin.Any>) returnType:IrErrorType
|
||||
x1: CONST Int type=kotlin.Int value=1
|
||||
FUN name:test3 visibility:public modality:FINAL <> (j1:<root>.J1<kotlin.Any>) returnType:IrErrorType
|
||||
VALUE_PARAMETER name:j1 index:0 type:<root>.J1<kotlin.Any>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (j1: <root>.J1<kotlin.Any>): IrErrorType declared in <root>'
|
||||
|
||||
@@ -256,6 +256,11 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
runTest("compiler/testData/cli/jvm/fileClassClashMultipleFiles.args");
|
||||
}
|
||||
|
||||
@TestMetadata("firHello.args")
|
||||
public void testFirHello() throws Exception {
|
||||
runTest("compiler/testData/cli/jvm/firHello.args");
|
||||
}
|
||||
|
||||
@TestMetadata("flagAllowingResultAsReturnType.args")
|
||||
public void testFlagAllowingResultAsReturnType() throws Exception {
|
||||
runTest("compiler/testData/cli/jvm/flagAllowingResultAsReturnType.args");
|
||||
|
||||
@@ -118,6 +118,7 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:fir:tree",
|
||||
":compiler:fir:psi2fir",
|
||||
":compiler:fir:fir2ir",
|
||||
":compiler:fir:java",
|
||||
":compiler:frontend",
|
||||
":compiler:frontend.common",
|
||||
":compiler:frontend.java",
|
||||
|
||||
Reference in New Issue
Block a user