- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
asSeenFrom
Mon, 2011-08-15, 15:33
Hi,
Given the type atp = (Int => Int){def apply(x$1: Int): Int @scala.annotation.effects.state.loc @scala.annotation.effects.pc.pc} // a RefinedType
and the symbol fun = method apply // with owner "trait Function1"
I'd like to find the type of the apply method in the refinement (the one with annotations onthe return type. I tried using asSeenFrom, i.e. val funTp = atp.memberType(fun)
But this gives me only "(v1: Int)Int"
Is there a way to get what I'm looking for?
Lukas
Given the type atp = (Int => Int){def apply(x$1: Int): Int @scala.annotation.effects.state.loc @scala.annotation.effects.pc.pc} // a RefinedType
and the symbol fun = method apply // with owner "trait Function1"
I'd like to find the type of the apply method in the refinement (the one with annotations onthe return type. I tried using asSeenFrom, i.e. val funTp = atp.memberType(fun)
But this gives me only "(v1: Int)Int"
Is there a way to get what I'm looking for?
Lukas
atp.member(fun.name).suchThat(m => m.overriddenSymbol(fun.owner) == fun || m == fun)
to get the method symbol in the refinement (or fun itself in case there's no refinement). Seems to work so far.
Lukas
On Mon, Aug 15, 2011 at 16:32, Lukas Rytz <lukas.rytz@epfl.ch> wrote: