mirror of
https://github.com/nushell/nushell
synced 2024-12-28 14:03:09 +00:00
6a274b860a
This is a follow-up to https://github.com/nushell/nushell/pull/8379 and https://github.com/nushell/nushell/discussions/8502. This PR makes it so that the new `?` syntax for marking a path member as optional short-circuits, as voted on in the [8502](https://github.com/nushell/nushell/discussions/8502) poll. Previously, `{ foo: 123 }.bar?.baz` would raise an error: ``` > { foo: 123 }.bar?.baz × Data cannot be accessed with a cell path ╭─[entry #15:1:1] 1 │ { foo: 123 }.bar?.baz · ─┬─ · ╰── nothing doesn't support cell paths ╰──── ``` Here's what was happening: 1. The `bar?` path member access returns `nothing` because there is no field named `bar` on the record 2. The `baz` path member access fails when trying to access a `baz` field on that `nothing` value After this change, `{ foo: 123 }.bar?.baz` returns `nothing`; the failed `bar?` access immediately returns `nothing` and the `baz` access never runs. |
||
---|---|---|
.. | ||
ast | ||
engine | ||
value | ||
alias.rs | ||
cli_error.rs | ||
config.rs | ||
example.rs | ||
exportable.rs | ||
id.rs | ||
lev_distance.rs | ||
lib.rs | ||
module.rs | ||
pipeline_data.rs | ||
plugin_signature.rs | ||
shell_error.rs | ||
signature.rs | ||
span.rs | ||
syntax_shape.rs | ||
ty.rs | ||
util.rs | ||
variable.rs |