AA: ignore evaluating named reference (to avoid exceptions)
This commit is contained in:
committed by
Ilya Kirillov
parent
e36bf55807
commit
7ec7cc47a9
+6
@@ -40,6 +40,12 @@ public class Fe10CompileTimeConstantEvaluatorTestGenerated extends AbstractCompi
|
||||
runTest("analysis/analysis-api/testData/components/compileTimeConstantProvider/evaluate/binaryExpressionWithString.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("namedReference.kt")
|
||||
public void testNamedReference() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/compileTimeConstantProvider/evaluate/namedReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyInit_Byte.kt")
|
||||
public void testPropertyInit_Byte() throws Exception {
|
||||
|
||||
+5
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirEle
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWhenBranch
|
||||
import org.jetbrains.kotlin.fir.psi
|
||||
import org.jetbrains.kotlin.fir.references.FirNamedReference
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
|
||||
@@ -33,6 +34,10 @@ internal class KtFirCompileTimeConstantProvider(
|
||||
KtConstantValue.KtErrorConstantValue(e.localizedMessage, fir.psi as? KtElement)
|
||||
}
|
||||
}
|
||||
is FirNamedReference -> {
|
||||
// TODO: but... if it refers to a property with a constant initializer, we can retrieve that technically?
|
||||
null
|
||||
}
|
||||
// For invalid code like the following,
|
||||
// ```
|
||||
// when {
|
||||
|
||||
+6
@@ -40,6 +40,12 @@ public class FirCompileTimeConstantEvaluatorTestGenerated extends AbstractCompil
|
||||
runTest("analysis/analysis-api/testData/components/compileTimeConstantProvider/evaluate/binaryExpressionWithString.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("namedReference.kt")
|
||||
public void testNamedReference() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/compileTimeConstantProvider/evaluate/namedReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyInit_Byte.kt")
|
||||
public void testPropertyInit_Byte() throws Exception {
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
var bar : Int = 42
|
||||
}
|
||||
|
||||
fun box() {
|
||||
val t = Test()
|
||||
t.<expr>bar</expr>
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
expression: bar
|
||||
constant: NOT_EVALUATED
|
||||
constantValueKind: NOT_EVALUATED
|
||||
Reference in New Issue
Block a user