You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent error highlighting for type mismatches on binary operations #7289
A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)category:inconsistent-behaviorBehavior between different commands or types inconsistent/unexpectedpolishthis problem makes nu feel unpolishedstatus:needs-designthis feature requires design
When trying to evaluate a binary addition with mismatched types, e.g.: int + string, the ordering of the types affects the preventative error highlighting.
Attempting to evaluate string + int highlights the +, whereas int + string highlights $var.
How to reproduce
nu
let $val = 10
let $var = "10"
$val + $var
$var + $val
Expected behavior
Both operations highlight the right most term, xor the operator.
changed the title [-]Inconsistent error messages for type mismatches on binary operations[/-][+]Inconsistent error highlighting for type mismatches on binary operations[/+]on Nov 30, 2022
Behaves as expected for T - U and U - T, as well as /, mod and **, I assume this goes for all other operators and this is perhaps related to the different implementations of string + string and int + int.
A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)category:inconsistent-behaviorBehavior between different commands or types inconsistent/unexpectedpolishthis problem makes nu feel unpolishedstatus:needs-designthis feature requires design
Activity
[-]Inconsistent error messages for type mismatches on binary operations[/-][+]Inconsistent error highlighting for type mismatches on binary operations[/+]epbuennig commentedon Nov 30, 2022
Behaves as expected for

T - UandU - T, as well as/,modand**, I assume this goes for all other operators and this is perhaps related to the different implementations ofstring + stringandint + int.kronberger-droid commentedon Nov 13, 2026
Operator type errors got reworked in #14429.
$val + $varand$var + $valhighlight both operands and the operator in the same way now.