Conversation
When a definition has no body (e.g. `process foo`), the re-parse fails on the first token after the statement, so the error pointed at the next definition or past the end of the file. Ignore re-parse errors past the end of the statement and fall back to the generic error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: jorgee <jorge.ejarque@seqera.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #7675. It fixes one case from the review.
Problem: a definition with no body, e.g.
process foo, is parsed as a callprocess(foo). The re-parse then fails on the first token after the statement. So the error points at unrelated code:process foo, thenworkflow {at line 33:1 Unexpected input: 'workflow'1:1 Invalid process definition -- ...process fooas the last line (line 4)5:1 Unexpected input: '<EOF>'4:1 Invalid process definition -- ...This is a common state while typing in the editor.
Fix: in
reparseScriptDeclaration, ignore errors whose offending token is past the end of the statement, and fall back to the generic error. Errors inside the statement are unchanged, including theUnexpected input: '}'case for a missing section. The method now returns whether an error was actually reported, not whether the parse was cancelled.Test:
should report a generic error for a definition without a bodyinScriptAstBuilderTest. It fails on #7675 (Unexpected input: 'workflow' @ line 3) and passes with this change. All:nf-lang:testtests pass, plusScriptDslTestandWorkflowDefTest.🤖 Generated with Claude Code