I'm writing a small simulation program in Scala. It is actor-based so I've created a file messages.scala
that contains all of the messages that are valid in the system.
Outside of this, I have a management component, management.scala
and a file that defines the nodes and links classes nodes.scala
. Management and node files both import sim.messages._
and then management does import sim.nodes._
as it needs to be able to instantiate things from that file.
The problem comes with one message type Tick
that is used by both management.scala
and nodes.scala
. Upon compiling the management component, I get:
error: reference to Tick is ambiguous;
it is imported twice in the same scope by
import sim.nodes._
and import sim.messages._
I tried removing the import of messages in the management component since they were apparently already imported in to this scope but then they couldn't find them anymore. Ideas?
Try
import sim.nodes._
import sim.nodes.{ Tick => NodesTick }
and/or
import sim.messages._
import sim.messages.{ Tick => MessagesTick }
Of course, you will have to rename the references to Tick
with the right one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With