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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

OCsite
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