[AA-FIR] Add support for constant evaluation of string templates.
Support FirStringConcatenationCall in FirCompileTimeConstantEvaluator.
This allows string templates ("foo${bar}") to be evaluated as constants,
assuming the interpolated expressions are themselves constant.
In addition, fixes some handling bugs with KtConstantEvaluationMode,
where some expressions that are not valid in a `const val` declaration
were being supported for `CONSTANT_EXPRESSION_EVALUATION`, including
non-static final Java fields in FIR, and composite expressions of
non-const properties in FE1.0.
This commit is contained in:
committed by
Ilya Kirillov
parent
0193c83b05
commit
fa517180b7
+12
@@ -232,6 +232,18 @@ public class FirStandaloneNormalAnalysisSourceModuleCompileTimeConstantEvaluator
|
||||
runTest("analysis/analysis-api/testData/components/compileTimeConstantProvider/evaluate/string_plusTwice.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("string_templateConst.kt")
|
||||
public void testString_templateConst() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/compileTimeConstantProvider/evaluate/string_templateConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("string_templateNonConst.kt")
|
||||
public void testString_templateNonConst() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/compileTimeConstantProvider/evaluate/string_templateNonConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("string_toString.kt")
|
||||
public void testString_toString() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user