Fix parser when def has missing params

This commit is contained in:
JT 2021-10-12 09:58:38 +13:00
parent db62bce6aa
commit 1f45304cf9
2 changed files with 16 additions and 0 deletions

View File

@ -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 {

View File

@ -709,3 +709,8 @@ fn missing_column_error() -> TestResult {
"cannot find column",
)
}
#[test]
fn missing_parameters() -> TestResult {
fail_test(r#"def foo {}"#, "expected [")
}