E0026
Name taken by a built-in
ErrorThe names i64, u8, f64, bool, char and string belong to the built-in types. A class, a function, an enum or a constant cannot take one. A variant cannot be called None, which is a keyword.
The names Option, Result, Some, Ok and Err are built in too: no class, function, enum, constant, variant, local or parameter can take one. A field or a method can, since it is always reached through a value.
Why
A type name stands where a type is expected, and u8(...), i64(...), f64(...) and char(...) convert a value. A class, a function or a constant with one of these names would make the same word mean two things. Option and Result name types, and Some(x), Ok(x) and Err(e) build their values, so they are kept for them.
Broken
class u8 {
n: i64
}
fn main() {
print(1)
}
What sisu says
error[E0026]: `u8` is a built-in type --> E0026.sisu:1:7 | 1 | class u8 { | ^^ sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0026
Fixed
class Byte {
n: i64
}
fn main() {
let b = Byte(n: 1)
print(b.n)
}
Sisu