Sisu
E0116

Local named like an enum

Error

Built from the repository at commit a8614dc.

A local, a parameter or a binding cannot take the name of an enum: let Shape = 1 is an error when Shape is an enum.

Why

Shape.Circle builds a variant of the enum Shape. If a local could take the name Shape, the same text could mean a method call on that local, and a reader would have to look for the binding to know which. A rule that rejects the name now can be relaxed later; a shadowing rule cannot be taken back. There is no fix, since the new name is yours to choose.

Broken

enum Shape {
    Dot
}

fn main() {
    let Shape = Shape.Dot
    print(Shape == Shape.Dot)
}

What sisu says

error[E0116]: `Shape` names an enum
 --> E0116.sisu:6:9
  |
6 |     let Shape = Shape.Dot
  |         ^^^^^

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0116

Fixed

enum Shape {
    Dot
}

fn main() {
    let shape = Shape.Dot
    print(shape == Shape.Dot)
}