[jira] [Commented] (GROOVY-7870) Implicit returns of transformed binary expressions do not have line numbers when statically compiled

2016-07-02 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15360217#comment-15360217
 ] 

ASF GitHub Bot commented on GROOVY-7870:


GitHub user shils opened a pull request:

https://github.com/apache/groovy/pull/362

GROOVY-7870: BinaryExpressionTransformer: Set line numbers on transfo…

…rmed binary expressions

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shils/groovy GROOVY-7870

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/groovy/pull/362.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #362


commit 388a6ca39a709e60c245baa5705efd82de305dd9
Author: Shil Sinha 
Date:   2016-07-02T15:29:21Z

GROOVY-7870: BinaryExpressionTransformer: Set line numbers on transformed 
binary expressions




> 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 above 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 is occurs because 1) BinaryExpressionTransformer does not copy the 
> source position of the original expression to the transformed expression in 
> some cases, and 2) ReturnAdder set the source position of the generated 
> return for an expression statement with that of the expression.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7870) Implicit returns of transformed binary expressions do not have line numbers when statically compiled

2016-07-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15365520#comment-15365520
 ] 

ASF GitHub Bot commented on GROOVY-7870:


Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/362


> 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 above 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 is occurs because 1) BinaryExpressionTransformer does not copy the 
> source position of the original expression to the transformed expression in 
> some cases, and 2) ReturnAdder set the source position of the generated 
> return for an expression statement with that of the expression.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7870) Implicit returns of transformed binary expressions do not have line numbers when statically compiled

2016-06-23 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345965#comment-15345965
 ] 

Paul King commented on GROOVY-7870:
---

Shil Sinha, were you planning on looking into this?

> 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 above 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 is occurs because 1) BinaryExpressionTransformer does not copy the 
> source position of the original expression to the transformed expression in 
> some cases, and 2) ReturnAdder set the source position of the generated 
> return for an expression statement with that of the expression.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7870) Implicit returns of transformed binary expressions do not have line numbers when statically compiled

2016-06-23 Thread Shil Sinha (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15346592#comment-15346592
 ] 

Shil Sinha commented on GROOVY-7870:


I have code ready for a PR, but I haven't had a chance to push it yet. It 
should be up later today (eastern U.S. time.) 

> 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 above 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 is occurs because 1) BinaryExpressionTransformer does not copy the 
> source position of the original expression to the transformed expression in 
> some cases, and 2) ReturnAdder set the source position of the generated 
> return for an expression statement with that of the expression.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7870) Implicit returns of transformed binary expressions do not have line numbers when statically compiled

2016-06-23 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15347362#comment-15347362
 ] 

Paul King commented on GROOVY-7870:
---

Cool! No rush at all. I was just wondering whether I should look at the issue. 
But seems you have it well in hand.

> 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 above 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 is occurs because 1) BinaryExpressionTransformer does not copy the 
> source position of the original expression to the transformed expression in 
> some cases, and 2) ReturnAdder set the source position of the generated 
> return for an expression statement with that of the expression.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)