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(VertexDefinitions.name)
<console>:48: error: type mismatch;
 found   : VertexDefinitions.Vertex
 required: VertexDefinitions.Vertex
        showme(VertexDefinitions.name)


 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)}
 showme(VertexDefinitions.name)

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 https://github.com/scala/bug/issues/11940 and for example https://issues.apache.org/jira/browse/SPARK-9621 for some details.

1 Like