[IR] Introduce & use DescriptorBasedIr OptIn
This commit is contained in:
@@ -16,3 +16,11 @@ sourceSets {
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks {
|
||||
val compileKotlin by existing(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.ir.DescriptorBasedIr"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,3 +20,11 @@ sourceSets {
|
||||
}
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks {
|
||||
val compileKotlin by existing(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.ir.DescriptorBasedIr"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,3 +16,11 @@ sourceSets {
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks {
|
||||
val compileKotlin by existing(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.ir.DescriptorBasedIr"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,4 +13,12 @@ dependencies {
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks {
|
||||
val compileKotlin by existing(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.ir.DescriptorBasedIr"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* 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.ir
|
||||
|
||||
@RequiresOptIn(message = "Please use IR declaration properties and not its descriptor properties", level = RequiresOptIn.Level.ERROR)
|
||||
annotation class DescriptorBasedIr
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.ir.declarations
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.Visibility
|
||||
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
@@ -34,7 +35,7 @@ interface IrMetadataSourceOwner : IrElement {
|
||||
}
|
||||
|
||||
interface IrDeclaration : IrStatement, IrMutableAnnotationContainer, IrMetadataSourceOwner {
|
||||
@Deprecated("Please use IR declaration properties and not its descriptor properties")
|
||||
@DescriptorBasedIr
|
||||
val descriptor: DeclarationDescriptor
|
||||
|
||||
var origin: IrDeclarationOrigin
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.ir.symbols
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.IrScript
|
||||
import org.jetbrains.kotlin.ir.expressions.IrReturnableBlock
|
||||
@@ -28,7 +29,7 @@ import org.jetbrains.kotlin.types.model.TypeParameterMarker
|
||||
interface IrSymbol {
|
||||
val owner: IrSymbolOwner
|
||||
|
||||
@Deprecated("Please use IR declaration properties and not its descriptor properties")
|
||||
@DescriptorBasedIr
|
||||
val descriptor: DeclarationDescriptor
|
||||
|
||||
val isBound: Boolean
|
||||
|
||||
@@ -25,3 +25,11 @@ sourceSets {
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks {
|
||||
val compileKotlin by existing(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.ir.DescriptorBasedIr"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,4 +17,12 @@ sourceSets {
|
||||
projectDefault()
|
||||
}
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks {
|
||||
val compileKotlin by existing(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.ir.DescriptorBasedIr"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,6 +179,7 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() {
|
||||
element.acceptChildrenVoid(this)
|
||||
}
|
||||
|
||||
@OptIn(DescriptorBasedIr::class)
|
||||
override fun visitDeclaration(declaration: IrDeclaration) {
|
||||
if (declaration is IrSymbolOwner) {
|
||||
declaration.symbol.checkBinding("decl", declaration)
|
||||
|
||||
Reference in New Issue
Block a user