You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2021/05/13 13:02:00 UTC

[jira] [Created] (GROOVY-10087) STC does not perform boxing on chars when encountering assignment and function call

Thodoris Sotiropoulos created GROOVY-10087:
----------------------------------------------

             Summary: STC does not perform boxing on chars when encountering assignment and function call
                 Key: GROOVY-10087
                 URL: https://issues.apache.org/jira/browse/GROOVY-10087
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


This is related to GROOVY-10079.

I have the following program
{code:java}
public class Main {
    public static void main(String[] args) {
      Character c = foo();
    }

    public static char foo() {
      'd' as char
    }
}
{code}
h3. Expected Behaviour

Compile successfully
h3. Actual Behaviour
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 3: [Static type checking] - Cannot assign value of type char to variable of type java.lang.Character
 @ line 3, column 21.
         Character c = foo();
                       ^1 error

{code}
Tested against master (https://github.com/apache/groovy/commit/2df019d3c93486e8a32d407d364913e7b65e1cba).



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