You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by "ocs@ocs.cz" <oc...@ocs.cz> on 2020/05/19 20:36:06 UTC

misplaced else inside a closure causes wrong (or at least pretty weird) error placement with Parrot

Hi there,

perhaps this is a known or well-understand issue, but worth reporting IMHO (not sure whether worth a ticket; let me please know should I create one for this):

===
281 ocs /tmp> <q.groovy 
class q {
  def foo(val) {
    10.times {
      println "Essentially anything..."
      


      println "... can be here, the longer this code, the worse"
      else println "This is wrong, but see the error report!"
    }
  }
}
282 ocs /tmp> /usr/local/groovy-2.4.17/bin/groovyc q.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
q.groovy: 9: unexpected token: else @ line 9, column 7.
         else println "This is wrong, but see the error report!"
         ^
1 error
283 ocs /tmp> /usr/local/groovy-3.0.3/bin/groovyc q.groovy 
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
q.groovy: 3: Unexpected input: '{'; Expecting RBRACE @ line 3, column 14.
       10.times {
                ^
1 error
284 ocs /tmp> 
===

All the best,
OC