Nushell 0.114.1
Today, we're releasing version 0.114.1 of Nu. This patch release fixes issues found after enforce-runtime-annotations became opt-out in the last version, improving runtime type checks and error reporting.
Where to get it
Nu 0.114.1 is available as pre-built binaries or from crates.io. If you have Rust installed you can install it using cargo install nu.
As part of this release, we also publish a set of optional plugins you can install and use with Nushell.
Table of contents
Highlights and themes of this release [toc]
Follow-up fixes for runtime annotation checks [toc]
In Nushell 0.114.0, we promoted enforce-runtime-annotations from an opt-in experimental option to an opt-out experimental option. That is the usual path for experimental options: more people try them, we get better feedback, and the feature gets closer to being stable.
As expected, that wider testing found some rough edges. Some came from invalid signatures, some from type checks that were too strict, and some from checks that were simply not accurate enough. We are tracking those reports in issue #18528, and this patch release fixes a number of them, mostly thanks to @Bahex. Thank you!
More issues may still turn up. Please report them if you run into anything suspicious. If enforce-runtime-annotations blocks your workflow, you can disable just that option before Nushell starts:
NU_EXPERIMENTAL_OPTIONS=enforce-runtime-annotations=false nuOr pass it as a command-line flag:
nu --experimental-options enforce-runtime-annotations=falseSee the nu-experimental user documentation for more details.
We still encourage everyone to keep as many experimental options enabled as possible. It helps us find bugs earlier and make Nushell better for future releases.
Changes [toc]
Bug fixes [toc]
More helpful errors for failed assignments with enforce-runtime-annotations [toc]
With enforce-runtime-annotations enabled, assignments with incorrect types raise errors.
Previously this error was nu::shell::cant_convert originally used for unsuccessful type coercions of command arguments. Unfortunately, this error only pointed at the assigned values origin and not at the failed assignment.
This error has been switched to nu::shell::type_mismatch and now points to the failed assignment in addition to the value's origin.
Example 1
| Code | |
| Before | |
| After | |
Example 2
| Code | |
| Before | |
| After | |
Closure's input type is not inherited from the surrounding scope [toc]
With last release, pipeline input type and how it affects various expressions are being tracked in a lot more cases.
In fact, at least one too many:
def mk-add-suffix [suffix: string]: nothing -> closure {
{|| $in ++ $suffix }
}Error: nu::parser::operator_unsupported_type
× The '++' operator does not work on values of type 'nothing'.
╭─[repl_entry #8:2:5]
1 │ def mk-add-suffix [suffix: string]: nothing -> closure {
2 │ {|| $in ++ $suffix }}
· ─┬─ ─┬
· │ ╰── does not support 'nothing'
· ╰── nothing
╰────This is now fixed, and closures' input type will be inferred as any, the way it was before 0.114.0.
Add list input type to more date commands [toc]
Allow more date commands to have a list as input -> output. These are the commands that were updated:
date humanizedate from-humandate to-timezoneformat dateinto datetime
Other fixes [toc]
- Fixed
input listen's output type signature to match actual returned value. With the incorrect signature (andenforce-runtime-annotationson)let x = input listenwould raise an error due to$x's inferred type (based oninput listen's signature) not matching the value assigned to it. (#18535) - Type checking treats
tableandlist<record>as compatible (provided the columns aren't disjoint), but that did not extend tolist<oneof<record, ...>>. This has been fixed. (#18560) - Runtime type checking of non-stream pipeline data is now more accurate. (#18560)
- Fixed
uname's output type signature to match its actual output. Previously it wastable, now it'srecord<...>and also includes its columns. (#18568) - Fixed an issue where
run script.nu --some-flagcould bind the value to the wrong flag of the script'smainwhenmaindeclared multiple flags, causing shifted positional arguments or a value being accepted into a flag of the wrong type. Flags passed torunare now matched tomainparameters by name. (#18533) - Fixed an incorrect
idx search --helpexample. (#18550) - Type checking of lists are relaxed. (#18555)
- Fixed an issue in
forloops where type of the looping variable was inferred incorrectly when iterating over a value/stream with a union type (oneof<list, table, binary>). This could manifest as a runtime type checking error withenforce-runtime-annotationsenabled. (#18551)
Hall of fame [toc]
Thanks to all the contributors below for helping us solve issues, improve documentation, refactor code, and more! 🙏
| author | change | link |
|---|---|---|
| @cptpiepmatz | cargo update crossbeam crates | #18554 |
| @Juhan280 | Initialize start_time for MCP only in MCP mode to avoid cargo warning | #18530 |
Full changelog [toc]
| author | title | link |
|---|---|---|
| @Alb-O | fix(idx): correct search context help example | #18550 |
| @Alb-O | fix(parser): infer for loop items from iterable unions | #18551 |
| @Bahex | fix: assignment errors point to the assignment | #18531 |
| @Bahex | fix: input listen's output type | #18535 |
| @Bahex | fix: closure's input type shouldn't be inherited from scope | #18540 |
| @Bahex | fix: relax assignability of list types | #18555 |
| @Bahex | fix type comparisons between table and list<oneof> | #18560 |
| @Bahex | fix: uname signature, and add detailed column info | #18568 |
| @Juhan280 | fix(mcp): initialize start_time for MCP only in MCP mode to avoid cargo warning | #18530 |
| @cptpiepmatz | cargo update crossbeam crates | #18554 |
| @fdncred | add list input type to more date commands | #18536 |
| @hexbinoct | Fix run binding forwarded flags to the wrong parameter | #18533 |