groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (GROOVY-8882) CS: Loop over elements of String has different element type
Date Wed, 21 Nov 2018 00:12:00 GMT

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

Paul King edited comment on GROOVY-8882 at 11/21/18 12:11 AM:
--------------------------------------------------------------

Seems like an inconsistency to me but has been that way since the early days of CS:
https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L1934
The good news is that no tests break changing it from Character_TYPE to STRING_TYPE.


was (Author: paulk):
Seems like an inconsistency to me but has been that way since the early days of CS:
https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L1934

> CS: Loop over elements of String has different element type
> -----------------------------------------------------------
>
>                 Key: GROOVY-8882
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8882
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.4.15
>            Reporter: Eric Milles
>            Priority: Minor
>
> When the method below is executed as-is, the output is "java.lang.String" x3.  When {{@CompileStatic}}
is uncommented, the output is "java.lang.Character" x3.  Is it possible to have dynamic groovy
match the static compilation result?
> {code:groovy}
> //@groovy.transform.CompileStatic
> void meth() {
>   for (c in 'abc')
>     println c.class.name
> }
> {code}
> Similarly, {{'abc'*.anything}} applies to Strings of length one instead of Characters.
 Although, spread-dot is not supported against strings under static compilation.  Is it possible
to add that support?



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

Mime
View raw message