Can someone help me make the right type declaration?
I’d like an occurrence of the word Map in my program to mean scala.collection.concurrent.Map rather than scala.collection.immutable.Map. I’m not sure how to do this.
The following code gives a compilation error.
def main(argv:Array[String]):Unit = {
import scala.collection.concurrent.Map
trait Trait1
trait Trait2
val tds = Seq(SEmpty,
STop,
SAtomic(classOf[Trait1]),
SNot(classOf[Trait1]),
SEql(42),
SMember(1,2,3),
evenType, // SCustom(evenp)
SAnd(classOf[Trait1],classOf[Trait2]),
SOr(classOf[Trait1],classOf[Trait2]))
val tdToInt = Map[SimpleTypeD,Int]()
tds.foreach{td => println(SimpleTypeDtoBdd(td,tdToInt))} // compilation error on this line
}
/Users/jimka/Repos/regular-type-expression/cl-robdd-scala/src/main/scala/genusbdd/GenusBdd.scala:64:51
type mismatch;
found : Map[genus.SimpleTypeD,Int] (in scala.collection.immutable)
required: Map[genus.SimpleTypeD,Int] (in scala.collection.concurrent)
tds.foreach{td => println(SimpleTypeDtoBdd(td,tdToInt))}
And if I change the declaration as follows, I get a different compiler error.
def main(argv:Array[String]):Unit = {
import scala.collection.concurrent.Map
trait Trait1
trait Trait2
val tds = Seq(SEmpty,
STop,
SAtomic(classOf[Trait1]),
SNot(classOf[Trait1]),
SEql(42),
SMember(1,2,3),
evenType, // SCustom(evenp)
SAnd(classOf[Trait1],classOf[Trait2]),
SOr(classOf[Trait1],classOf[Trait2]))
val tdToInt = scala.collection.concurrent.Map[SimpleTypeD,Int]() // compilation error on this line
tds.foreach{td => println(SimpleTypeDtoBdd(td,tdToInt))}
}
/Users/jimka/Repos/regular-type-expression/cl-robdd-scala/src/main/scala/genusbdd/GenusBdd.scala:63:47
object Map is not a member of package scala.collection.concurrent
Note: trait Map exists, but it has no companion object.
val tdToInt = scala.collection.concurrent.Map[SimpleTypeD,Int]()