1
0
mirror of https://github.com/nushell/nushell.git synced 2025-08-20 12:22:11 +02:00
Files
.cargo
.githooks
.github
assets
benches
crates
nu-cli
nu-cmd-base
nu-cmd-dataframe
nu-cmd-extra
nu-cmd-lang
nu-color-config
nu-command
nu-engine
nu-explore
nu-glob
nu-json
nu-lsp
nu-parser
nu-path
nu-plugin
nu-pretty-hex
nu-protocol
nu-std
src
std
assert.nu
dirs.nu
dt.nu
formats.nu
help.nu
input.nu
iter.nu
log.nu
math.nu
mod.nu
testing.nu
xml.nu
tests
CONTRIBUTING.md
Cargo.toml
LICENSE
README.md
nu-system
nu-table
nu-term-grid
nu-test-support
nu-utils
nu_plugin_custom_values
nu_plugin_example
nu_plugin_formats
nu_plugin_gstat
nu_plugin_inc
nu_plugin_python
nu_plugin_query
README.md
devdocs
docker
scripts
src
tests
wix
.gitattributes
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Cargo.lock
Cargo.toml
Cross.toml
LICENSE
README.md
rust-toolchain.toml
toolkit.nu
nushell/crates/nu-std/std
WindSoilder 724818030d add type check during eval time ()
# Description
Fixes:  

Take the following as example:
```nushell
def spam [foo: string] {
    $'foo: ($foo | describe)'
}
def outer [--foo: string] {
    spam $foo
}

outer
```
When we call `outer`, type checker only check the all for `outer`, but
doesn't check inside the body of `outer`. This pr is trying to introduce
a type checking process through `Type::is_subtype()` during eval time.

## NOTE
I'm not really sure if it's easy to make a check inside the body of
`outer`. Adding an eval time type checker seems like an easier solution.
As a result: `outer` will be caught by runtime, not parse time type
checker

cc @kubouch 

# User-Facing Changes
After this pr the following call will failed:
```nushell
> outer
Error: nu:🐚:cant_convert

  × Can't convert to string.
   ╭─[entry #27:1:1]
 1 │ def outer [--foo: any] {
 2 │     spam $foo
   ·          ──┬─
   ·            ╰── can't convert nothing to string
 3 │ }
   ╰────
```

# Tests + Formatting
Done

# After Submitting
NaN
2024-01-12 23:48:53 +08:00
..
2023-11-03 10:09:33 -05:00
2023-11-03 10:09:33 -05:00
2023-11-03 10:09:33 -05:00
2023-11-03 10:09:33 -05:00
2023-10-08 13:12:46 +02:00
2024-01-08 21:46:10 +02:00
2023-12-02 13:15:47 +01:00
2023-11-03 10:09:33 -05:00