Yeahhh I ran into that same issue.
getReferences()
only works in the context of an IDE plugin, and it has no value when dealing with the Kotlin Frontend. You can see an example of how to do it
over at my repo (the code might not make too much sense though) but the quick TL;DR is that you need an
AnalysisHandlerExtension
and then in its
analysisCompleted
function use the
bindingTrace.bindingContext
to call
KtCallElement.getResolvedCall(BindingContext)
and that'll simply get you a
ResolvedCall
object that has a
resultingDescriptor
property that then simply has all the info and data about the function that the call element is referring to.
(Also if you do check the repo make sure to check out and possibly vote for
KT-44530 because the whole repo is a POC of that issue. The TL;DR of that issue is that the Kotlin compiler currently can't, but should, be able to inline some lambda returning functions. if that issue does get implemented, that can result in things as crazy as actual zero-overhead structs being possible idiomatically)