[FIR] Fix Disappeared ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT
^KT-59942 Fixed
This commit is contained in:
committed by
Space Team
parent
c860de6600
commit
7b3e661776
+10
@@ -99,6 +99,16 @@ internal fun checkConstantArguments(
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
expression is FirArrayLiteral -> {
|
||||
for (exp in expression.arguments) {
|
||||
checkConstantArguments(exp, session)?.let {
|
||||
return it
|
||||
}
|
||||
}
|
||||
}
|
||||
expression is FirThisReceiverExpression -> {
|
||||
return ConstantArgumentKind.NOT_CONST
|
||||
}
|
||||
expressionSymbol == null -> {
|
||||
//DO NOTHING
|
||||
}
|
||||
|
||||
compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.fir.kt
Vendored
-23
@@ -1,23 +0,0 @@
|
||||
const val ONE = 1
|
||||
|
||||
annotation class Foo(
|
||||
val a: IntArray = [ONE],
|
||||
val b: IntArray = [ONE, 2, 3]
|
||||
)
|
||||
|
||||
val TWO = 2
|
||||
|
||||
fun getOne() = ONE
|
||||
fun getTwo() = TWO
|
||||
|
||||
annotation class Bar(
|
||||
val a: IntArray = [TWO],
|
||||
val b: IntArray = [1, TWO],
|
||||
val c: IntArray = [getOne(), getTwo()]
|
||||
)
|
||||
|
||||
annotation class Baz(
|
||||
val a: IntArray = [<!NULL_FOR_NONNULL_TYPE!>null<!>],
|
||||
val b: IntArray = [1, <!NULL_FOR_NONNULL_TYPE!>null<!>, 2],
|
||||
val c: IntArray = [<!NO_THIS!>this<!>]
|
||||
)
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
const val ONE = 1
|
||||
|
||||
annotation class Foo(
|
||||
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class Ann(
|
||||
val a: Array<String> = arrayOf(readOnly),
|
||||
val b: Array<String> = arrayOf(withGetter),
|
||||
val c: Array<String> = arrayOf(func()),
|
||||
val d: IntArray = intArrayOf(ONE, twoWithGetter),
|
||||
val e: IntArray = intArrayOf(ONE + twoWithGetter),
|
||||
val f: Array<String> = arrayOf(mutable),
|
||||
val g: Array<String> = arrayOf(mutableWithGetter),
|
||||
val h: Array<KClass<*>> = arrayOf(WithLateinit.kClass)
|
||||
)
|
||||
|
||||
const val ONE = 1
|
||||
|
||||
val twoWithGetter
|
||||
get() = 2
|
||||
|
||||
val readOnly = ""
|
||||
|
||||
val withGetter
|
||||
get() = ""
|
||||
|
||||
fun func() = ""
|
||||
|
||||
var mutable = ""
|
||||
|
||||
var mutableWithGetter
|
||||
get() = ""
|
||||
set(x) = TODO()
|
||||
|
||||
object WithLateinit {
|
||||
lateinit var kClass: KClass<*>
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
Reference in New Issue
Block a user