LYR-SEM0005
a null operator on a value that is never null
A force-unwrap !, a ?? or a ??= is applied to a type that is not optional, so the null case it handles cannot happen. A bare type parameter counts as not optional.
Explanation
x!, x ?? d and x ??= d exist for optionals (?T). On a value of a non-optional type they do nothing, and writing one says the author believed the value could be null.
Drop the operator, or make the type optional where null is meant to be possible.
Wrong
fn main(): void {
let n: int = 3;
let _ = n ?? 0;
}
Right
fn main(): void {
let n: ?int = 3;
let _ = n ?? 0;
}