Scala 2.11 - mismatch where found == required

My goal is to create an Enum with one constructor and use it later in a method , and I am trying to understand what this error means and how can I fix it :

scala>  showme(
<console>:48: error: type mismatch;
 found   : VertexDefinitions.Vertex
 required: VertexDefinitions.Vertex

 object VertexDefinitions extends Enumeration {

  sealed case class Vertex(name: String, uniqueIDs: Seq[String], fields: Seq[String]) extends Val(name) {

  val name = Vertex("name",Seq("name"),Seq("last_name"))


 def showme(v : VertexDefinitions.Vertex): Unit = {println(v.fields)}

I tried the same code in Scala 2.12 and it did not fail , so I am not sure if there is any differences between versions. I am running that code using the spark-shell which is using the scala RPL

Edit: This only happens when running the code using the shell. I am not sure why is that
Edit2: Importing the package(with :paste raw) does not create this issue , I still don’t understand the error message though

This is a problem in the class based repl that spark uses. See and for example for some details.

1 Like