Sisu
E0063

Field or method that does not exist

ErrorUnsafe fix

Built from the repository at commit a8614dc.

A field read or a method call must name a member of the receiver's type: a field or method of its class, the array methods len(), sum() and contains(x), the string methods len(), chars(), bytes() and words(), or the methods of f64 and i64, such as x.sqrt() and n.max(m). A built-in type's name takes a constant: f64.pi, f64.tau, f64.e, f64.infinity, f64.nan, f64.max, f64.min_positive and f64.epsilon. No other type has any, so i64.max is this error too. A method of f64 is no method of i64: n.sqrt() with an i64 n is this error too. A constructor's labels must name fields of its class, or of the labeled payload of its variant. The methods of an enum count as methods of its type, but its value has no fields: that is E0121.

When a member of the receiver's type has a similar name, the error offers it as an unsafe fix. The unsafe fix may be wrong: the name could be a member that was never written. For let x = 2.5 and x.sqrtt(), the unsafe fix is sqrt; for f64.PI, it is pi.

Why

Sisu does not resolve a misspelled member name on its own. A misspelled name would otherwise read some other value or run some other code.

Broken

class Point {
    x: i64
}

fn main() {
    let p = Point(x: 1)
    print(p.y)
}

What sisu says

error[E0063]: `Point` has no field `y`
 --> E0063.sisu:7:13
  |
7 |     print(p.y)
  |             ^
  |
help: a field with a similar name exists: `x`
  |
7 -     print(p.y)
7 +     print(p.x)
  |

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

Fixed

class Point {
    x: i64
}

fn main() {
    let p = Point(x: 1)
    print(p.x)
}