Hello, World! A PSI / type resolution question. I'm implementing
visitCallExpression(expression: KtCallExpression)
, trying to find calls to a specific extension function.
When calling
expression.getResolvedCall(bindingContext)
on a regular function, I'm correctly getting the corresponding descriptor.
However, when the call is an extension function, this returns
null
.
Any idea if there's a known limitation or another way to do this?
bod
11/21/2022, 11:09 AM
never mind - it works in certain cases ๐ So my issue is not regular fun vs extension fun, it's just that the target of the call can't be resolved in certain cases
g
gammax
11/21/2022, 2:57 PM
Youโre always using Type Resolution right?
b
bod
11/21/2022, 3:02 PM
well this is a bit off-topic, sorry, because I'm not actually doing this with Detekt ๐ I'm at the early stages of building a tool to manipulate bits of code using kotlin-compiler-embedded and Detekt is a great source of inspiration. My issue with type resolution is that for it to work you need knowledge of the whole classpath of your module, and it's a bit difficult outside of Gradle. So for now on my little project it works in simple cases only...
bod
11/21/2022, 3:05 PM
(by the way if you know good resources about PSI in general and the Kt flavor specifically, this would be helpful!)
g
gammax
11/21/2022, 3:18 PM
Sadly not. You should ask in the #compiler channel then ๐