2
0
Fork 0
mirror of https://github.com/nushell/nushell synced 2025-02-19 07:28:32 +00:00
nushell/crates/nu-command/tests
WindSoilder bf40f035f6
don't overrite arg's type if it's annotated explicitly ()
# Description
Fixes:  

So the following script is possible:
```nushell
def a [b: any = null] { let b = ($b | default "default_b"); }
a "given_b"
```

## About the change
When parsing signature, and nushell meets something like `a: any`, it
force the parser to treat `a` as `any` type. This is what
`arg_explicit_type` means, it's only set when we goes into
`ParseMode::TypeMode`, and it will be reset to `false` if the token goes
to next argument.

so, when we have something like this: `def a [b: any = null] { $b }`,
the type of `$b` won't be overwritten.

But if we have something like this: `def a [b = null] { $b }`, the type
of `$b` is not annotated, so we make it to be `nothing`(which is the
type of null)
2023-09-21 03:58:29 +12:00
..
commands don't overrite arg's type if it's annotated explicitly () 2023-09-21 03:58:29 +12:00
format_conversions Simplify rawstrings in tests () 2023-09-01 00:08:27 +02:00
main.rs Rename misused "deprecation" to removal () 2023-08-15 07:17:31 +12:00