throw parser error when multiple short flags are defined without whitespace (#6000)

* throw error when multiple short flags are defined without whitespace

* add tests
This commit is contained in:
pwygab
2022-07-10 16:32:52 +08:00
committed by GitHub
parent 121e8678b6
commit f85a1d003c
2 changed files with 17 additions and 1 deletions

View File

@ -3126,6 +3126,10 @@ pub fn parse_signature_helper(
var_id: Some(var_id),
default_value: None,
}));
} else if flags.len() >= 3 {
error = error.or_else(|| {
Some(ParseError::Expected("one short flag".into(), span))
});
} else {
let short_flag = &flags[1];
let short_flag = if !short_flag.starts_with(b"-")