Skip to content

Fix parsePattern to return Ok when iterator empty with named param#641

Open
cuiweixie wants to merge 1 commit intoValeLang:masterfrom
cuiweixie:fix/pattern-parser-return-ok-empty-iter
Open

Fix parsePattern to return Ok when iterator empty with named param#641
cuiweixie wants to merge 1 commit intoValeLang:masterfrom
cuiweixie:fix/pattern-parser-return-ok-empty-iter

Conversation

@cuiweixie
Copy link
Copy Markdown

Summary

In parsePattern, when !iter.hasNext and maybeNameFromParameter is Some, the branch built an Ok(PatternPP(...)) but did not return. In Scala that value is only the result of the inner match; execution then fell through and continued parsing, which is wrong for this exhausted-input case.

Add return so the function exits with the intended Ok result.

Testing

  • ParsingPass / existing CI

Without return, the Ok(...) in the !iter.hasNext branch was discarded and
parsing continued past the early-exit case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant