nushell/src/tests
Stefan Holderbach e427c68731
Relax type-check of key-less table/record (#10629)
# Description
Relax typechecking of key-less `table`/`record`

Assume that they are acceptable for more narrowly specified
`table<...>`/`record<...>` where `...` specifies keys and potentially
types for those keys/columns.

This ensures that you can use commands that specify general return
values statically with more specific input-/args-type requirements.

Reduces the power of the type-check a bit but unlocks you to actually
use the specific annotations in more places.
Incompatibilities will only be raised if an output type declares
specific columns/keys.

Closes #9702

Supersedes #10594 as a simpler solution requiring no extra distinction.

h/t @1kinoti, @NotLebedev
# User-Facing Changes
Now legal at type-check time

```nu
def foo []: nothing -> table { [] }
def foo []: nothing -> table<> { ls }
def bar []: table<a:int,b:string> -> nothing {}

foo | bar 
```

# Tests + Formatting
- 1 explicit test with specified relaxed return type passed to concrete
expected input type
- 1 test leveraging the general output type of a built-in command
- 1 test wrapping a general built-in command and verifying the type
inference in the function body
2023-10-08 13:26:36 +02:00
..
test_bits.rs Input output checking (#9680) 2023-07-14 15:20:35 +12:00
test_cell_path.rs remove the $nothing variable (#10478) 2023-09-26 18:49:28 +02:00
test_commandline.rs Use int type name consistently (#10579) 2023-10-03 18:24:32 +02:00
test_conditionals.rs Add OneOf shape to fix else (#7385) 2022-12-08 08:58:54 +13:00
test_config_path.rs Clippy in tests (#10394) 2023-09-16 21:49:10 +02:00
test_config.rs Add config mutation tests (#7437) 2022-12-12 12:46:25 -06:00
test_converters.rs Fix to json escape logic (#4478) 2022-02-15 06:55:57 -05:00
test_custom_commands.rs differentiating between --x and --x: bool (#10456) 2023-09-23 10:20:48 +02:00
test_engine.rs Add long options for filters (#10641) 2023-10-08 13:12:46 +02:00
test_env.rs Remove the 'env' command, as we have the variable (#8185) 2023-03-01 21:20:00 +13:00
test_help.rs Add long options for filters (#10641) 2023-10-08 13:12:46 +02:00
test_hiding.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
test_ide.rs limit the ide-check error amount (#8875) 2023-04-13 12:53:18 -05:00
test_iteration.rs Remove deprecated --numbered flag from four commands (#7777) 2023-02-02 16:59:58 -06:00
test_known_external.rs Add --env and --wrapped flags to def (#10566) 2023-10-02 21:13:31 +03:00
test_math.rs Change comparison operators to allow nulls (#8617) 2023-03-26 12:10:09 +13:00
test_modules.rs Module: support defining const and use const variables inside of function (#9773) 2023-08-01 07:09:52 +08:00
test_parser.rs Parse custom completer annotation only in args (#10581) 2023-10-05 22:39:37 +02:00
test_ranges.rs improve operation mismatch errors (#8800) 2023-04-08 09:32:44 +12:00
test_regex.rs improve operation mismatch errors (#8800) 2023-04-08 09:32:44 +12:00
test_signatures.rs allow tables to have annotations (#9613) 2023-07-07 11:06:09 +02:00
test_stdlib.rs split $nu variable into scope commands and simpler $nu (#9487) 2023-06-21 09:33:01 +12:00
test_strings.rs improve operation mismatch errors (#8800) 2023-04-08 09:32:44 +12:00
test_table_operations.rs remove the $nothing variable (#10478) 2023-09-26 18:49:28 +02:00
test_type_check.rs Relax type-check of key-less table/record (#10629) 2023-10-08 13:26:36 +02:00