[FIR] Add opt-in annotation which prevents from using symbol.fir

This commit is contained in:
Dmitriy Novozhilov
2021-07-07 17:51:01 +03:00
committed by teamcityserver
parent c99a02796f
commit e94d75d433
5 changed files with 45 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
val projectsAllowedToUseFirFromSymbol = listOf(
"analysis-tests",
"dump",
"fir-deserialization",
"fir-serialization",
"fir2ir",
"java",
"jvm",
"raw-fir",
"resolve",
"tree",
"jvm-backend",
"light-tree2fir",
"psi2fir",
"raw-fir.common"
)
subprojects {
if (name in projectsAllowedToUseFirFromSymbol) {
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.fir.symbols.SymbolInternals"
}
}
}
}

View File

@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
abstract class FirBasedSymbol<E : FirDeclaration> {
private var _fir: E? = null
@SymbolInternals
val fir: E
get() = _fir
?: error("Fir is not initialized for $this")
@@ -30,3 +31,6 @@ abstract class FirBasedSymbol<E : FirDeclaration> {
val moduleData: FirModuleData
get() = fir.moduleData
}
@RequiresOptIn
annotation class SymbolInternals

View File

@@ -14,3 +14,9 @@ sourceSets {
"main" { projectDefault() }
"test" { }
}
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.fir.symbols.SymbolInternals"
}
}

View File

@@ -62,6 +62,13 @@ projectTest(jUnit5Enabled = true) {
testsJar()
allprojects {
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.fir.symbols.SymbolInternals"
}
}
}
val generatorClasspath by configurations.creating

View File

@@ -262,7 +262,8 @@ include ":benchmarks",
":wasm:wasm.ir"
include ":compiler:fir:cones",
include ":compiler:fir",
":compiler:fir:cones",
":compiler:fir:tree",
":compiler:fir:tree:tree-generator",
":compiler:fir:raw-fir:raw-fir.common",