Eric Milles created GROOVY-9896:
-----------------------------------

             Summary: Switch return statement transformation misses last case 
without break
                 Key: GROOVY-9896
                 URL: https://issues.apache.org/jira/browse/GROOVY-9896
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 4.0.0-alpha-2, 3.0.7, 2.5.14
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
def test(str) {
  switch(str) {
   case 'foo':
   case 'bar':
    'value'
  //break
  }
}
println test('foo')
println test('bar')
println test('baz')
{code}

When this script is executed, it prints "null" three times.  If the break 
statement is added, it prints "value", "value", "null" as expected.  
{{ReturnAdder}} only transforms case blocks that end with break.  This is 
possibly the reason GROOVY-4727 fails.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to