1

So I tried to declare this simple case class

case class Association(id: Option[Long], type: String, name: String, description: Option[String], uri: URI, additonalInfo: String){

}

but it does not compile with this message:

- identifier expected but    'type' found.

It is of course because "type" is a reserved Scala keyword. I thought for some reasons that I can resolve this by providing a 'type (Symbol) instead but it still does not compile.

So how I can really label my parameter as a "type"? Please do not disappoint me telling this cannot be done in Scala :)

Alexander Arendar
  • 3,365
  • 2
  • 26
  • 38

1 Answers1

5

Just use thick quotes:

case class Association(id: Option[Long], `type`: String, name: String, description: Option[String], uri: URI, additonalInfo: String)
om-nom-nom
  • 62,329
  • 13
  • 183
  • 228