You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The expected() function will format the message in accordance with format!("Expected: {expected}, found: {found}"). However, when expected() is called by parse_prefix() at line 1254 in mod.rs, the parameter is "an expression:". Consequently, the formatted message is "Expected: an expression:, found: EOF". The ":," appears redundant.
Related code:
/// Report `found` was encountered instead of `expected`pubfnexpected<T>(&self,expected:&str,found:TokenWithLocation) -> Result<T,ParserError>{parser_err!(
format!("Expected: {expected}, found: {found}"),
found.location
)}// in parse_prefix()
_ => self.expected("an expression:", next_token),
Activity
Fischer0522 commentedon Sep 19, 2024
Perhaps “Expected: an expression, found: EOF” is a more appropriate format. Please review it @alamb
git-hulk commentedon Sep 19, 2024
It should be good to remove the redundant
:. Also, maybe you can check if other places which useexpecthave similar issues.Fischer0522 commentedon Sep 19, 2024
I have checked all places that use
expect. This is the only place where this problem occurs. please check this pr #1434git-hulk commentedon Sep 23, 2024
@Fischer0522 This issue can be closed now.