Commit Graph

18 Commits

Author SHA1 Message Date
Anna Kozlova f80ed4592d [AA] Handle KtTypeReference children in CompileTimeConstantProvider
CompileTimeConstantProvider could receive a reference expression,
whose grandparent is KtTypeReference (seen that in UAST inspection).
FIR would not contain anything explicit for this reference,
FirResolvedTypeRef would be received as the nearest parent.
Of course, in this case, there could be no compile time constant anyway.
2023-06-15 07:06:41 +00:00
Justin Paupore fa517180b7 [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.
2023-02-15 16:45:22 +01:00
Anna Kozlova 3590c4ea35 [Analysis API FIR] support generated temp properties
KTIJ-23492 (array index expression), KTIJ-23138 (inc/dec desugaring)
2022-11-11 17:39:53 +01:00
Ilya Kirillov 4ae1cb74dd [Analysis API FIR] fix constant evaluation for incomplete call when compiler produces IntegerLiteralType
^KTIJ-21531 fixed
2022-09-30 12:19:51 +02:00
Jinseong Jeon dd7fc7f4ae AA FIR: avoid unsafe argument retrieval during const evaluation 2022-09-18 17:22:02 +02:00
Jinseong Jeon 836b6dae9f AA FIR: constant evaluation for String 2022-09-14 12:52:08 +02:00
Jinseong Jeon 25f7554a31 AA FIR: constant evaluation for Java field 2022-08-20 00:50:09 +02:00
Jinseong Jeon 61cca31b6b AA: special handling for converted constants 2022-04-22 18:55:30 +02:00
Jinseong Jeon faf6939515 AA: showcase strange const evaluation for -1 2022-04-22 18:55:30 +02:00
Jinseong Jeon 46707b0426 AA: test evaluation mode with same test inputs 2022-03-11 13:51:16 +01:00
Jinseong Jeon 606033e1e6 AA: introduce KtConstantEvaluationMode 2022-03-11 13:51:15 +01:00
Jinseong Jeon 1f93630a9c AA: evaluate constant property initializers 2022-03-11 13:51:14 +01:00
Jinseong Jeon 7ec7cc47a9 AA: ignore evaluating named reference (to avoid exceptions) 2022-03-11 13:51:14 +01:00
Jinseong Jeon e36bf55807 AA: avoid NPE while evaluating operations with non-numbers 2022-03-11 13:51:13 +01:00
Ilya Kirillov 7919dae558 Analysis API: improve rendering of constant values 2021-12-02 20:09:17 +01:00
Ilya Kirillov 673459580c Analysis API: introduce annotation value for KClass 2021-12-02 20:09:16 +01:00
Ilya Kirillov f722a54c78 Analysis API: separate constant values from annotation values 2021-12-02 20:09:16 +01:00
Ilya Kirillov 6f6a33e852 Analysis API: move testdata to corresponding components folders 2021-11-17 20:55:08 +01:00