nushell/crates/nu-command
WindSoilder bf40f035f6
don't overrite arg's type if it's annotated explicitly (#10424)
# Description
Fixes: #10410 

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
..
src Remove str replace --string after deprecation (#10064) 2023-09-19 15:54:20 +02:00
tests don't overrite arg's type if it's annotated explicitly (#10424) 2023-09-21 03:58:29 +12:00
Cargo.toml Bump to 0.85.1 development version (#10431) 2023-09-20 18:38:42 +12:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00