https://kotlinlang.org logo
Title
m

mdepies

01/05/2020, 5:48 PM
I'm trying to resolve the type of an variable declaration where the type is implicit from the initializer
var x = 0
. I'm using the quote template dsl to do some manipulations with the type information. Any direction?
r

raulraja

01/05/2020, 7:15 PM
What does the PSI Viewer say for that constant?
Constants can be evaluated with the compiler and it's possible it already knows that is an Int in PSI
You can also partially analyze with partial body resolution Wich will give you typed values portions of the tree given a parent scope such as the file or the class
That is a compiler API on resolution utils
m

mdepies

01/05/2020, 7:20 PM
It wont necessarily be a constant expression ( did some wonky constant resolution early on and realized how futile that was going to scale)