nushell/crates/nu-parser/src
JT 0b9fc4ff3a
give better error when a numberlike is used for strings (#8706)
# Description

Before:
```
  × Type mismatch during operation.
   ╭─[source:1:1]
 1 │               def 7zup [] {} 
   ·                   ──┬─
   ·                     ╰── expected string
   ╰────
```

Now:
```
  × Type mismatch during operation.
   ╭─[source:1:1]
 1 │               def 7zup [] {} 
   ·                   ──┬─
   ·                     ╰── expected string, found number-like value (hint: use quotes or backticks)
   ╰────
```

# User-Facing Changes

_(List of all changes that impact the user experience here. This helps
us keep track of breaking changes.)_

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-utils/standard_library/tests.nu` to run the
tests for the standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2023-04-02 07:48:45 +12:00
..
deparse.rs Use variable names directly in the format strings (#7906) 2023-01-29 19:37:54 -06:00
errors.rs Improve inferred record types and type compat (#8649) 2023-03-29 10:23:10 +13:00
eval.rs Optional members in cell paths: Attempt 2 (#8379) 2023-03-15 20:50:58 -07:00
flatten.rs Add rest and ignore-rest patterns (#8681) 2023-03-31 11:08:53 +13:00
known_external.rs Document and critically review ShellError variants - Ep. 3 (#8340) 2023-03-06 18:33:09 +01:00
lex.rs allow lists to have type annotations (#8529) 2023-03-24 12:54:06 +01:00
lib.rs allow lists to have type annotations (#8529) 2023-03-24 12:54:06 +01:00
lite_parser.rs Fix multi-line redirection inside a block (#7808) 2023-01-23 06:32:56 +13:00
parse_keywords.rs Disable alias recursion (for real) (#8557) 2023-03-22 23:16:06 +02:00
parse_patterns.rs Add rest and ignore-rest patterns (#8681) 2023-03-31 11:08:53 +13:00
parser.rs give better error when a numberlike is used for strings (#8706) 2023-04-02 07:48:45 +12:00
type_check.rs Improve inferred record types and type compat (#8649) 2023-03-29 10:23:10 +13:00