-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect error message on missing comma #4085
Conversation
Signed-off-by: Ben Sherman <[email protected]>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
What about adding a unit test for capture this behavior |
Signed-off-by: Ben Sherman <[email protected]>
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]>
…ast] Signed-off-by: Ben Sherman <[email protected]> Signed-off-by: Paolo Di Tommaso <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]>
Close #3185
This PR fixes a particularly nasty error message that occurs with missing commas in process inputs/outputs.
Consider the following example:
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 toBaseParam
to 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.