refactor(tvix/eval): rename UnexpectedArgument{,Formals}
There's other places where unexpected arguments can be provided, like in builtins. Make space for that error type. Change-Id: Ic831497a3a1dd36a3a184bedadcf1374bf0ae6db Reviewed-on: https://cl.tvl.fyi/c/depot/+/11876 Reviewed-by: Connor Brewster <cbrewster@hey.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
ea6f511241
commit
970e2a045b
2 changed files with 6 additions and 6 deletions
|
@ -185,7 +185,7 @@ pub enum ErrorKind {
|
||||||
FromTomlError(String),
|
FromTomlError(String),
|
||||||
|
|
||||||
/// An unexpected argument was supplied to a function that takes formal parameters
|
/// An unexpected argument was supplied to a function that takes formal parameters
|
||||||
UnexpectedArgument {
|
UnexpectedArgumentFormals {
|
||||||
arg: NixString,
|
arg: NixString,
|
||||||
formals_span: Span,
|
formals_span: Span,
|
||||||
},
|
},
|
||||||
|
@ -487,7 +487,7 @@ to a missing value in the attribute set(s) included via `with`."#,
|
||||||
write!(f, "Error converting TOML to a Nix value: {msg}")
|
write!(f, "Error converting TOML to a Nix value: {msg}")
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorKind::UnexpectedArgument { arg, .. } => {
|
ErrorKind::UnexpectedArgumentFormals { arg, .. } => {
|
||||||
write!(f, "Unexpected argument `{arg}` supplied to function",)
|
write!(f, "Unexpected argument `{arg}` supplied to function",)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,7 +778,7 @@ impl Error {
|
||||||
ErrorKind::DuplicateAttrsKey { .. } => "in this attribute set",
|
ErrorKind::DuplicateAttrsKey { .. } => "in this attribute set",
|
||||||
ErrorKind::InvalidAttributeName(_) => "in this attribute set",
|
ErrorKind::InvalidAttributeName(_) => "in this attribute set",
|
||||||
ErrorKind::RelativePathResolution(_) => "in this path literal",
|
ErrorKind::RelativePathResolution(_) => "in this path literal",
|
||||||
ErrorKind::UnexpectedArgument { .. } => "in this function call",
|
ErrorKind::UnexpectedArgumentFormals { .. } => "in this function call",
|
||||||
ErrorKind::UnexpectedContext => "in this string",
|
ErrorKind::UnexpectedContext => "in this string",
|
||||||
|
|
||||||
// The spans for some errors don't have any more descriptive stuff
|
// The spans for some errors don't have any more descriptive stuff
|
||||||
|
@ -853,7 +853,7 @@ impl Error {
|
||||||
ErrorKind::ImportCompilerError { .. } => "E028",
|
ErrorKind::ImportCompilerError { .. } => "E028",
|
||||||
ErrorKind::IO { .. } => "E029",
|
ErrorKind::IO { .. } => "E029",
|
||||||
ErrorKind::JsonError { .. } => "E030",
|
ErrorKind::JsonError { .. } => "E030",
|
||||||
ErrorKind::UnexpectedArgument { .. } => "E031",
|
ErrorKind::UnexpectedArgumentFormals { .. } => "E031",
|
||||||
ErrorKind::RelativePathResolution(_) => "E032",
|
ErrorKind::RelativePathResolution(_) => "E032",
|
||||||
ErrorKind::DivisionByZero => "E033",
|
ErrorKind::DivisionByZero => "E033",
|
||||||
ErrorKind::FromTomlError(_) => "E035",
|
ErrorKind::FromTomlError(_) => "E035",
|
||||||
|
@ -898,7 +898,7 @@ impl Error {
|
||||||
spans_for_parse_errors(&file, errors)
|
spans_for_parse_errors(&file, errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorKind::UnexpectedArgument { formals_span, .. } => {
|
ErrorKind::UnexpectedArgumentFormals { formals_span, .. } => {
|
||||||
vec![
|
vec![
|
||||||
SpanLabel {
|
SpanLabel {
|
||||||
label: self.span_label(),
|
label: self.span_label(),
|
||||||
|
|
|
@ -797,7 +797,7 @@ where
|
||||||
if !formals.contains(arg) {
|
if !formals.contains(arg) {
|
||||||
return frame.error(
|
return frame.error(
|
||||||
self,
|
self,
|
||||||
ErrorKind::UnexpectedArgument {
|
ErrorKind::UnexpectedArgumentFormals {
|
||||||
arg: arg.clone(),
|
arg: arg.clone(),
|
||||||
formals_span: formals.span,
|
formals_span: formals.span,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue