Skip to content

return statement weird behaviour in version 0.77 #8472

Closed

Description

@presidento

Describe the bug

I cannot parse the breaking change from release notes, but it seems that the behaviour of return command has changed.

How to reproduce

Save this to test-return.nu file:

def get_a_number [] { return 222 }

def example_command [] {
    if (get_a_number) > 10 {
        echo "Big"
    } else {
        echo "Small"
    }
}

example_command

With 0.76

❯ nu --version; nu test-return.nu
0.76.0
Big

With 0.77

❯ nu --version; nu test-return.nu
0.77.0
222

Expected behavior

I expected nu 0.77 work as in 0.76. Or have a big warning about this braking change in relese notes.

Screenshots

No response

Configuration

0.76

key value
version 0.76.0
branch
commit_hash bc38a6a
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.67.1 (d5a82bbd2 2023-02-07)
cargo_version cargo 1.67.1 (8ecd4f20a 2023-01-10)
pkg_version 0.76.0
build_time 2023-02-23 08:03:29 -06:00
build_rust_channel release
features database, default, trash, which, zip
installed_plugins

0.77

key value
version 0.77.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.68.0 (2c8cc3432 2023-03-06) (built from a source tarball)
cargo_version cargo 1.68.0 (115f34552 2023-02-26)
build_time 2023-03-14 18:46:42 +00:00
build_rust_channel release
features default, zip
installed_plugins

Additional context

No response

Activity

  1. sophiajt commented on Mar 16, 2023

    @sophiajt
    Contributor

    Looks like this was broken in #8204 cc @WindSoilder

  2. WindSoilder commented on Mar 16, 2023

    @WindSoilder
    Contributor

    Yeah, sorry for that, I've created a pr to revert that commit

  3. added
    category:bug
    on Mar 16, 2023
  4. added a commit that references this issue on Mar 16, 2023
    31d9c08
  5. added this to the v0.78.0 milestone on Mar 17, 2023
  6. added a commit that references this issue on Mar 17, 2023
    716c144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions