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

Eric Milles updated GROOVY-11387:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
void test() {
  def map = new HashMap()
  def xxx = map.table
  def yyy = map.with{
    def z = table
  }
  print xxx
  print yyy
}
test()
{code}

The script should output "nullnull" -- which it does without STC -- and the 
inferred types of "xxx", "yyy" and "z" should be String.  However, the script 
throws IllegalAccessError for the "z" line and the inferred type of the 
variables is "Node<String,String>[]".

GROOVY-11367

  was:
Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
void test() {
  def map = new HashMap()
  def xxx = map.table
  def yyy = map.with{
    def z = table
  }
  print xxx
  print yyy
}
test()
{code}

The script should output "nullnull" and the inferred types of "xxx", "yyy" and 
"z" should be String.  However, the script throws IllegalAccessError for the 
"z" line and the inferred type of the variables is "Node<String,String>[]".

GROOVY-11367


> STC: entry vs field for map-based types
> ---------------------------------------
>
>                 Key: GROOVY-11387
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11387
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 3.0.21, 4.0.21
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
>   def map = new HashMap()
>   def xxx = map.table
>   def yyy = map.with{
>     def z = table
>   }
>   print xxx
>   print yyy
> }
> test()
> {code}
> The script should output "nullnull" -- which it does without STC -- and the 
> inferred types of "xxx", "yyy" and "z" should be String.  However, the script 
> throws IllegalAccessError for the "z" line and the inferred type of the 
> variables is "Node<String,String>[]".
> GROOVY-11367



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to