Skip to content

sort-by {length} on list of strings doesn't result in error #14462

@YPares

Description

@YPares

Describe the bug

The following should result in a type error, or at least a runtime error:

["hello" "bye"] | sort-by {length}

Because length cannot be applied on strings.

Worse, it just silently returns the original list, making the user believe the code is okay when they should have written:

["hello" "bye"] | sort-by {str length}

How to reproduce

Just run the code excerpt above

Expected behavior

I expected a runtime error telling me that length cannot be applied to strings.

Configuration

key value
version 0.100.0
major 0
minor 100
patch 0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.82.0 (f6e511eec 2024-10-15) (built from a source tarball)
cargo_version cargo 1.82.0 (8f40fc59f 2024-08-21)
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash
installed_plugins httpserve 0.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-silent-failCases where nothing or something bad happens and an error would be helpful and expectedstatus:needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions