Hello, World! A PSI / type resolution question. I'm implementing `visitCallExpression(expression: Kt...
b
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?
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
Youโ€™re always using Type Resolution right?
b
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...
(by the way if you know good resources about PSI in general and the Kt flavor specifically, this would be helpful!)
g
Sadly not. You should ask in the #compiler channel then ๐Ÿ‘
b
ooh thanks a lot!