forked from extern/nushell
e427c68731
# 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 |
||
---|---|---|
.. | ||
deparse.rs | ||
flatten.rs | ||
known_external.rs | ||
lex.rs | ||
lib.rs | ||
lite_parser.rs | ||
parse_keywords.rs | ||
parse_patterns.rs | ||
parse_shape_specs.rs | ||
parser_path.rs | ||
parser.rs | ||
type_check.rs |