eval_non_numeric

Diagnostic `nanook::eval::non_numeric`

Summary

expected numeric expression

Help

only Arith, Neg, Sel, and Lit nodes evaluate to a number

Details

When this fires

A node that should produce a number didn't. Only Arith, Neg, Sel, and Lit nodes evaluate to a number, so feeding a comparison or boolean expression into an arithmetic slot trips this.

What to check

Don't nest a comparison inside arithmetic. Pull the comparison up to the root.

# broken: (a > b) is a bool, can't add it
expr = "(cpu.usage > 50) + 1 > 1"
# fixed
expr = "cpu.usage > 50"

Surfaces at runtime; nanook check catches most of these earlier through type rules.