You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2015/06/01 13:59:17 UTC
[jira] [Created] (GROOVY-7446) setting list values via slicing not
working with @TypeChecked
Paul King created GROOVY-7446:
---------------------------------
Summary: setting list values via slicing not working with @TypeChecked
Key: GROOVY-7446
URL: https://issues.apache.org/jira/browse/GROOVY-7446
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Affects Versions: 2.4.3
Reporter: Paul King
Assignee: Cédric Champeau
As a follow on from GROOVY-6212, the following code:
{code}
@groovy.transform.TypeChecked
def myMethod() {
def orig = 'a'..'f'
def items = orig.toList()
items[1..2] = 'X'
assert items == ['a', 'X', 'd', 'e', 'f']
items = orig.toList()
items[*1..2] = 'X'
assert items == ['a', 'X', 'X', 'd', 'e', 'f']
items = orig.toList()
items[*1..2, 4] = 'X'
assert items == ['a', 'X', 'X', 'd', 'X', 'f']
}
myMethod()
{code}
throws the following errors:
{noformat}
[Static type checking] - Cannot assign value of type java.lang.String to variable of type java.util.List <java.lang.String>
at line: 18, column: 17
[Static type checking] - Cannot assign value of type java.lang.String to variable of type java.util.List <java.lang.String>
at line: 22, column: 18
[Static type checking] - Cannot assign value of type java.lang.String to variable of type java.util.List <java.lang.String>
at line: 26, column: 21
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)