T305
null arm on a value that cannot be null
Severity Warning
A match has a null arm, but the subject’s type is not nullable, so the arm can never run. This often happens after a value was already defaulted with ??.
Remove the null arm, or match on the original nullable value instead.
Failing example
script "OI direction"
data oi = subscribe(data.oi)
on oi.close {
let change = (oi.close ?? 0.0) - (oi.close[1] ?? 0.0)
let word = match change {
null => "unknown"
v if v > 0.0 => "rising"
_ => "falling"
}
log.debug(word)
}Fixed example
script "OI direction"
data oi = subscribe(data.oi)
on oi.close {
let change = oi.close - oi.close[1]
let word = match change {
null => "unknown"
v if v > 0.0 => "rising"
_ => "falling"
}
log.debug(word)
}