Fix incorrect error message on missing comma#4085
Merged
pditommaso merged 3 commits intomasterfrom Jul 29, 2023
Merged
Conversation
Signed-off-by: Ben Sherman <[email protected]>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
Member
Author
Member
|
What about adding a unit test for capture this behavior |
Signed-off-by: Ben Sherman <[email protected]>
Member
Author
|
I added a unit test for process inputs. As for outputs, I modified the example to have a tuple output with missing comma: process foo {
debug true
output:
tuple val(x) val(y) // missing comma
script:
"""
echo "foo ${task.index} ${task.workDir}"
"""
}
workflow {
foo()
}Which produces this syntax: this._out_tuple(new nextflow.script.TokenValCall(new nextflow.script.TokenVar('x'))).val(y)And finally this error: Since outputs are not wrapped in a TokenVar, the Groovy shell encounters a missing variable before it reaches the |
Signed-off-by: Paolo Di Tommaso <[email protected]>
pditommaso
approved these changes
Jul 29, 2023
This was referenced Aug 31, 2023
abhi18av
pushed a commit
to abhi18av/nextflow
that referenced
this pull request
Oct 28, 2023
…ast] Signed-off-by: Ben Sherman <[email protected]> Signed-off-by: Paolo Di Tommaso <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]>
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.
Close #3185
This PR fixes a particularly nasty error message that occurs with missing commas in process inputs/outputs.
Consider the following example:
process foo { debug true input: tuple val(x) val(y) // missing comma script: """ echo "foo ${task.index} ${task.workDir}" """ } workflow { foo(['x', 'y']) }Currently, the script compiles despite the missing comma but then Nextflow reports that the process has been used twice:
The transpiled Groovy code looks like this:
So I just add a
methodMissing()implementation toBaseParamto catch the incorrect.val()call. With that change, the error now looks like this:The error message is correctly called a syntax error and it gives the exact line where it happened.
Note however that it doesn't catch all missing comma errors. For example if you forget a comma before
emit: ..., the script fails to compile so we can't catch the error.