[jira] [Comment Edited] (GROOVY-8539) Groovy fails to compile assignment operators on boolean array

2018-04-09 Thread Paul King (JIRA)

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

Paul King edited comment on GROOVY-8539 at 4/10/18 3:01 AM:


The alternative syntax for {{b[0] &= false}} is {{b[0] = b[0] & false}} but 
agreed the binary compound-assignment operators should work and currently 
don't. Strangely, Groovy seems to have some support for "&&=" plumbed into the 
codebase but not at the grammar level. That's a separate issue.


was (Author: paulk):
Groovy is like Java and C (but not Ruby) in that it doesn't have a &&= 
operator. So the alternative format is {{b[0] = b[0] & false}} but agreed the 
binary compound-assignment operators should work and currently don't.

> Groovy fails to compile assignment operators on boolean array
> -
>
> Key: GROOVY-8539
> URL: https://issues.apache.org/jira/browse/GROOVY-8539
> Project: Groovy
>  Issue Type: Bug
>  Components: class generator
>Affects Versions: 3.0.0-alpha-1, 2.4.15
>Reporter: Tony Yoshicedo
>Priority: Major
>
> Groovy fails to compile:
> boolean[] b = [true]; b[0] &= false;
> with an error:
> Caught: BUG! exception in phase 'class generation' in source unit 
> 'script_from_command_line' should not reach here
> BUG! exception in phase 'class generation' in source unit 
> 'script_from_command_line' should not reach here
> when running:
> groovy -e "boolean[] b = [true]; b[0] &= false;"
> Alternative formats work fine, such as:
> groovy -e "boolean[] b = [true]; b[0] = false && b[0];"
> Similarly affects |= and ^= operators.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-8539) Groovy fails to compile assignment operators on boolean array

2018-04-09 Thread Paul King (JIRA)

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

Paul King commented on GROOVY-8539:
---

Groovy is like Java and C (but not Ruby) in that it doesn't have a &&= 
operator. So the alternative format is {{b[0] = b[0] & false}} but agreed the 
binary compound-assignment operators should work and currently don't.

> Groovy fails to compile assignment operators on boolean array
> -
>
> Key: GROOVY-8539
> URL: https://issues.apache.org/jira/browse/GROOVY-8539
> Project: Groovy
>  Issue Type: Bug
>  Components: class generator
>Affects Versions: 3.0.0-alpha-1, 2.4.15
>Reporter: Tony Yoshicedo
>Priority: Major
>
> Groovy fails to compile:
> boolean[] b = [true]; b[0] &= false;
> with an error:
> Caught: BUG! exception in phase 'class generation' in source unit 
> 'script_from_command_line' should not reach here
> BUG! exception in phase 'class generation' in source unit 
> 'script_from_command_line' should not reach here
> when running:
> groovy -e "boolean[] b = [true]; b[0] &= false;"
> Alternative formats work fine, such as:
> groovy -e "boolean[] b = [true]; b[0] = false && b[0];"
> Similarly affects |= and ^= operators.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (GROOVY-8540) Bump antlr to 4.7.1

2018-04-09 Thread Daniel Sun (JIRA)
Daniel Sun created GROOVY-8540:
--

 Summary: Bump antlr to 4.7.1
 Key: GROOVY-8540
 URL: https://issues.apache.org/jira/browse/GROOVY-8540
 Project: Groovy
  Issue Type: Dependency upgrade
Reporter: Daniel Sun
Assignee: Daniel Sun
 Fix For: 3.0.0-alpha-2, 2.6.0-alpha-4






--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (GROOVY-8540) Bump antlr to 4.7.1

2018-04-09 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun resolved GROOVY-8540.

Resolution: Fixed

> Bump antlr to 4.7.1
> ---
>
> Key: GROOVY-8540
> URL: https://issues.apache.org/jira/browse/GROOVY-8540
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-2, 2.6.0-alpha-4
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (GROOVY-8539) Groovy fails to compile assignment operators on boolean array

2018-04-09 Thread Tony Yoshicedo (JIRA)
Tony Yoshicedo created GROOVY-8539:
--

 Summary: Groovy fails to compile assignment operators on boolean 
array
 Key: GROOVY-8539
 URL: https://issues.apache.org/jira/browse/GROOVY-8539
 Project: Groovy
  Issue Type: Bug
  Components: class generator
Affects Versions: 2.4.15, 3.0.0-alpha-1
Reporter: Tony Yoshicedo


Groovy fails to compile:

boolean[] b = [true]; b[0] &= false;

with an error:

Caught: BUG! exception in phase 'class generation' in source unit 
'script_from_command_line' should not reach here
BUG! exception in phase 'class generation' in source unit 
'script_from_command_line' should not reach here

when running:

groovy -e "boolean[] b = [true]; b[0] &= false;"

Alternative formats work fine, such as:

groovy -e "boolean[] b = [true]; b[0] = false && b[0];"

Similarly affects |= and ^= operators.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (GROOVY-8538) static type checking, generics, and collect

2018-04-09 Thread Ian (JIRA)
Ian created GROOVY-8538:
---

 Summary:  static type checking, generics, and collect 
 Key: GROOVY-8538
 URL: https://issues.apache.org/jira/browse/GROOVY-8538
 Project: Groovy
  Issue Type: Bug
Affects Versions: 2.2.2
 Environment: CentOS 7
Gradle 4.6
Reporter: Ian


Broken between 2.2.2 and 2.4.15 (the latest I have access to).

 
{code:java}
import groovy.transform.TypeChecked

@TypeChecked
class MyClass {
List> ii = []
List jj = ii.collect { Foo it -> it.get() }
}

interface Foo {
V get()
}

abstract class Bar {}
{code}
Fails to compile with error:

 

 
{code:java}
MyClass.groovy: 6: [Static type checking] - Incompatible generic argument 
types. Cannot assign java.util.List  to: java.util.List 
@ line 6, column 27.
List jj = ii.collect { Foo it -> it.get() }
  ^
{code}
Note that if the type of Foo is changed to  it compiles successfully:
{code:java}
...
interface Foo {
T get()
}

abstract class Bar {}
{code}
Also successfully compiles if the type of Bar is changed to anything else:
{code:java}
...
interface Foo {
V get()
}

abstract class Bar {}{code}
So it seems there is something special in the use of  specifically that 
makes this fail.

This also seems to hold true for classes defined in different files.

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)