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
Cant append list<type> in list<any> using ++= operator #8153
I created a mutable list which contains strings and paths at initialisation.
I want to append more items in the list using the ++= operator but the script won't compile, nu telling me it cant append list in list.
How to reproduce
Compile this :
mut args = [
hello # string type
("hello" | path join world) # path type
]
# => args is list<any>
$args ++= [ foo bar ] # only strings
Nushell raise an error :
Error: nu::parser::type_mismatch (link)
× Type mismatch during operation.
╭─[C:\Users\glitc\Projects\scripts-util\test.nu:8:1]
8 │ ]
9 │ $args ++= [ foo bar ]
· ─────┬─────
· ╰── expected list<any>, found list<string>
10 │ $args
╰────
Expected behavior
Being able to append list of any fixed type (e.g. list<string>, list<int>, list<path>, ...) in a list<any>
Activity
allow different types of lists to be appended (#8157)