Closed
Description
scala> trait HasType{ var `type`: String }
defined trait HasType
Would be nice if that compiled:
scala> new HasType{ var Some(`type`) = Some("foo") }
<console>:10: error: stable identifier required, but $anon.this.`type` found.
new HasType{ var Some(`type`) = Some("foo") }
^
Workaround:
scala> new HasType{ var Some(t) = Some("foo"); var `type`= t }
res7: HasType{def t: String; def t_=(x$1: String): Unit} = $anon$1@38c60a18
I am programmatically generating Scala code, so the workaround means a corner case in the code generator.