Closed
Description
Minimized example
type A = Any { var x: Int }
Output
1 | type A = Any { var x: Int }
| ^^^^^^^^^^
| refinement cannot be a mutable var.
| You can use an explicit getter x and setter x_= instead
Expectation
Expand the refinement to
type A = Any { def x: Int, def x_=($x: Int): Unit }
instead.
That's what Scala 2 does. See also: https://contributors.scala-lang.org/t/why-is-there-a-restriction-on-refinements-not-having-vars/6498/6
To fix this, we need to touch the following pieces of code:
- Both versions of syntax.md, to allow the new syntax
- The parser, make sure the new syntax also shows up as a doc comment of the parsing method
- Code in Desugar that does the expansion.