docs/_docs/reference/error-codes/E083.md
This error is emitted when an expression is used where a stable path is required, but the expression is not an immutable path.
An immutable path is:
val), orthis, orPaths are required in certain contexts like singleton types, type projections, and some pattern matches.
var x = 1
def example: x.type = x
-- [E083] Type Error: example.scala:2:13 ---------------------------------------
2 |def example: x.type = x
| ^^^^^^
|(x : Int) is not a valid singleton type, since it is not an immutable path
|-----------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| An immutable path is
| - a reference to an immutable value, or
| - a reference to `this`, or
| - a selection of an immutable path with an immutable value.
-----------------------------------------------------------------------------
// Use val instead of var for stable paths
val x = 1
def example: x.type = x
// Or don't use singleton types for mutable values
var x = 1
def example: Int = x