This page is no longer maintained — Please continue to the home page at www.scala-lang.org

asSeenFrom

1 reply
rytz
Joined: 2008-07-01,
User offline. Last seen 45 weeks 5 days ago.
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
rytz
Joined: 2008-07-01,
User offline. Last seen 45 weeks 5 days ago.
Re: asSeenFrom
OK, for now, I did 
  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:
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

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland