i have simple unit test, like
"foo" in { val probe = testprobe() val actor = testactorref(props(new myactor("blabla")) { override def createactor: actorref = probe.ref })) }
however, class myactor
contains field named probe
hence override reference fields instead of local test variable. code not compile (as probe
field not have ref
member). can of course rename variable, how - mean how reference variable local context, how solve 'name clash'?
there similar question asked here: scala: how access shadowed function variable object although wouldn't consider duplicate.
but same answer applies:
no, not possible. there no way reference outer variable without renaming it, because there no identify outer block.