[ https://issues.apache.org/jira/browse/GROOVY-7870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shil Sinha updated GROOVY-7870: ------------------------------- Description: If certain transformed binary expressions (<=>, ==, <<, >>, >>>) are implicitly returned, their line numbers are not reported. Example: {code} @groovy.transform.CompileStatic def test() { def l = [] l << 3 } {code} The code is compiled to the following bytecode (as seen using GroovyConsole): {code} public test()Ljava/lang/Object; L0 LINENUMBER 3 L0 ICONST_0 ANEWARRAY java/lang/Object INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; ASTORE 1 L1 ALOAD 1 POP ALOAD 1 ICONST_3 INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; INVOKESTATIC org/codehaus/groovy/runtime/DefaultGroovyMethods.leftShift (Ljava/util/List;Ljava/lang/Object;)Ljava/util/List; ARETURN L2 ACONST_NULL ARETURN LOCALVARIABLE this Lscript1466525199339; L0 L2 0 LOCALVARIABLE l Ljava/util/List; L1 L2 1 MAXSTACK = 2 MAXLOCALS = 2 {code} There is no line number corresponding to L1, which includes the leftShift call (should be line number 4.) was: If certain transformed binary expressions (<=>, ==, <<, >>, >>>) are implicitly returned, their line numbers are not reported. Example: {code} @groovy.transform.CompileStatic def test() { def l = [] l << 3 } {code} The code is compiled to the following bytecode (as seen using GroovyConsole): {code} public test()Ljava/lang/Object; L0 LINENUMBER 3 L0 ICONST_0 ANEWARRAY java/lang/Object INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; ASTORE 1 L1 ALOAD 1 POP ALOAD 1 ICONST_3 INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; INVOKESTATIC org/codehaus/groovy/runtime/DefaultGroovyMethods.leftShift (Ljava/util/List;Ljava/lang/Object;)Ljava/util/List; ARETURN L2 ACONST_NULL ARETURN LOCALVARIABLE this Lscript1466525199339; L0 L2 0 LOCALVARIABLE l Ljava/util/List; L1 L2 1 MAXSTACK = 2 MAXLOCALS = 2 {code} There is no line number corresponding to L2, which includes the leftShift call (should be line number 4.) > Implicit returns of transformed binary expressions do not have line numbers > when statically compiled > ---------------------------------------------------------------------------------------------------- > > Key: GROOVY-7870 > URL: https://issues.apache.org/jira/browse/GROOVY-7870 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.4.7 > Reporter: Shil Sinha > > If certain transformed binary expressions (<=>, ==, <<, >>, >>>) are > implicitly returned, their line numbers are not reported. Example: > {code} > @groovy.transform.CompileStatic > def test() { > def l = [] > l << 3 > } > {code} > The code is compiled to the following bytecode (as seen using GroovyConsole): > {code} > public test()Ljava/lang/Object; > L0 > LINENUMBER 3 L0 > ICONST_0 > ANEWARRAY java/lang/Object > INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList > ([Ljava/lang/Object;)Ljava/util/List; > ASTORE 1 > L1 > ALOAD 1 > POP > ALOAD 1 > ICONST_3 > INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; > INVOKESTATIC org/codehaus/groovy/runtime/DefaultGroovyMethods.leftShift > (Ljava/util/List;Ljava/lang/Object;)Ljava/util/List; > ARETURN > L2 > ACONST_NULL > ARETURN > LOCALVARIABLE this Lscript1466525199339; L0 L2 0 > LOCALVARIABLE l Ljava/util/List; L1 L2 1 > MAXSTACK = 2 > MAXLOCALS = 2 > {code} > There is no line number corresponding to L1, which includes the leftShift > call (should be line number 4.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)