<@U2SG23BPU> <@UKPEELJCW> or others that may know,...
# arrow-meta
r
@dsavvinov @dmitriy.novozhilov or others that may know, I’m implementing the KEEP-87 as a compiler plugin to see if its possible in arrow meta. I’m attempting currently to get a hold of the resolver of the function injected with
@with
to enhance the scope resolution of that function so it takes in account the
Semigroup<A>
type to resolve
combine
without the need to wrap the body in
with (S) { a.combine(b) }
. What part of the compiler do I need to look into to avoid the
unresolved reference: combine
? In the actual Keep impl this happens in the
BodyResolver
but not sure how to get to that point in a compiler plugin. Any help or pointers in the right direction is appreciated.
d
To provide functionality that you want you need to change
context.scope
before entering to resolution and inference to new scope with new
ownerDescriptor
that should be some descriptor with receiver that you want (see
CallResolver.java:564
)
Copy code
object Contained {
    fun <A> add(S: Semigroup<A>, a: A, b: A): A {
        a.combine(b)  // 1
        with(S) {
            a.combine(b)  // 2
        }
    }
}
For that code for call 1 scope owner is
fun add
, for call 2 --
fun Semigroup<A>.<anonymous>()
. So, for call PsiCallResolver creates
ScopeTower
(
PSICallResolver.kt:91
) that looks for functions in appropriate member scopes.
But at this moment there is no extension points that can somehow affect resolution and inference algorithm, and I can't help you with that
r
thanks so much for the info, I’ll look into it.