Use int type name consistently (#10579)

# Description
When referring to the type use `int` consistently. Only when referring
to the concept of integer numbers use `integer`.

- Fix `random integer` to `random int` tests
  - Forgot in #10520
- Use int instead of integer in error messages
- Use int type name in bits commands
- Fix messages in `for` examples
- Use int typename in `into` commands
- Use int typename in rest of commands
- Report errors in `nu-protocol` with int typename

Work for #10332 

# User-Facing Changes
User errorrs should now use `int` so you can easily find the necessary
commands or type annotations.

# Tests + Formatting
Only two tests found that needed updating
This commit is contained in:
Stefan Holderbach
2023-10-03 18:24:32 +02:00
committed by GitHub
parent 2cc4191ec9
commit 7c1487e18d
36 changed files with 77 additions and 93 deletions

View File

@ -26,7 +26,7 @@ impl FromValue for Spanned<i64> {
Value::Duration { val, .. } => Ok(Spanned { item: *val, span }),
v => Err(ShellError::CantConvert {
to_type: "integer".into(),
to_type: "int".into(),
from_type: v.get_type().to_string(),
span: v.span(),
help: None,
@ -43,7 +43,7 @@ impl FromValue for i64 {
Value::Duration { val, .. } => Ok(*val),
v => Err(ShellError::CantConvert {
to_type: "integer".into(),
to_type: "int".into(),
from_type: v.get_type().to_string(),
span: v.span(),
help: None,
@ -123,7 +123,7 @@ impl FromValue for Spanned<usize> {
}
v => Err(ShellError::CantConvert {
to_type: "non-negative integer".into(),
to_type: "non-negative int".into(),
from_type: v.get_type().to_string(),
span: v.span(),
help: None,
@ -159,7 +159,7 @@ impl FromValue for usize {
}
v => Err(ShellError::CantConvert {
to_type: "non-negative integer".into(),
to_type: "non-negative int".into(),
from_type: v.get_type().to_string(),
span: v.span(),
help: None,

View File

@ -255,7 +255,7 @@ impl Value {
match self {
Value::Int { val, .. } => Ok(*val),
x => Err(ShellError::CantConvert {
to_type: "integer".into(),
to_type: "int".into(),
from_type: x.get_type().to_string(),
span: self.span(),
help: None,