forked from extern/nushell
Fix parser when def has missing params
This commit is contained in:
parent
db62bce6aa
commit
1f45304cf9
@ -1850,7 +1850,18 @@ pub fn parse_signature(
|
||||
|
||||
if bytes.starts_with(b"[") {
|
||||
start += 1;
|
||||
} else {
|
||||
error = error.or_else(|| {
|
||||
Some(ParseError::Expected(
|
||||
"[".into(),
|
||||
Span {
|
||||
start,
|
||||
end: start + 1,
|
||||
},
|
||||
))
|
||||
});
|
||||
}
|
||||
|
||||
if bytes.ends_with(b"]") {
|
||||
end -= 1;
|
||||
} else {
|
||||
|
@ -709,3 +709,8 @@ fn missing_column_error() -> TestResult {
|
||||
"cannot find column",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_parameters() -> TestResult {
|
||||
fail_test(r#"def foo {}"#, "expected [")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user