Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10087

STC does not perform boxing on chars when encountering assignment and function call

    XMLWordPrintableJSON

Details

    Description

      This is related to GROOVY-10079.

      I have the following program

      public class Main {
          public static void main(String[] args) {
            Character c = foo();
          }
      
          public static char foo() {
            'd' as char
          }
      }
      

      Expected Behaviour

      Compile successfully

      Actual Behaviour

      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
      
      

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

      Attachments

        Activity

          People

            emilles Eric Milles
            theosot Thodoris Sotiropoulos
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: