9 times out of 10, just using Map and Set behave as I expected, but sometimes I am suddenly struck
error: type mismatch; [INFO] found : scala.collection.Set[String] [INFO] required: Set[String]
As an example, from REPL:
scala> case class Calculator[+T](name: String, parameters: Set[String]) defined class Calculator scala> val binding=Map.empty[String, String] binding: scala.collection.immutable.Map[String,String] = Map() scala> Calculator("Hello",binding.keySet) <console>:9: error: type mismatch; found : scala.collection.Set[String] required: Set[String] Calculator("Hello",binding.keySet) ^
I think I understand the error, that is, a function call for aliases returns the actual types.
And so it seems to me that the solution is to import non-smoothed types. After that, every other file in my project will now generate type mismatch errors, so I will have to import it into each file. Which leads to the question I ask in the title - what was the purpose of the alias in Predef if I ultimately need to import the actual package?
Is my understanding wrong, or my use case is not typical, or both?
scala
Jim
source share