Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ private void visitTypedOutputs(Statement outputs, String typeLabel) {
var output = es.getExpression();
VariableExpression target;
if( output instanceof VariableExpression ve ) {
visit(ve);
target = ve;
}
else if( output instanceof AssignmentExpression assign ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,54 @@ class ScriptResolveTest extends Specification {
errors[0].getStartLine() == 3
errors[0].getStartColumn() == 9
errors[0].getOriginalMessage() == 'Variables in a closure should be declared with `def`'

when:
errors = check(
'''\
workflow hello {
emit:
x
}
'''
)
then:
errors.size() == 1
errors[0].getStartLine() == 3
errors[0].getStartColumn() == 5
errors[0].getOriginalMessage() == '`x` is not defined'

when:
errors = check(
'''\
workflow hello {
emit:
x = y
}
'''
)
then:
errors.size() == 1
errors[0].getStartLine() == 3
errors[0].getStartColumn() == 9
errors[0].getOriginalMessage() == '`y` is not defined'

when:
errors = check(
'''\
workflow hello {
emit:
x + y
}
'''
)
then:
errors.size() == 2
errors[0].getStartLine() == 3
errors[0].getStartColumn() == 5
errors[0].getOriginalMessage() == '`x` is not defined'
errors[1].getStartLine() == 3
errors[1].getStartColumn() == 9
errors[1].getOriginalMessage() == '`y` is not defined'
}

def 'should report an error for an undefined function' () {
Expand Down
Loading