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

CompileStatic can't cast int to char

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.5
    • 2.0.6
    • Static compilation
    • None

    Description

      This code

      @groovy.transform.CompileStatic
      def f() {
        (65..90).collect { int it -> (char)it }
      }
      
      f()
      

      Throws

      [Static type checking] - Inconvertible types: cannot cast int to char
      

      Remove the CompileStatic annotation, and it works again...

      Attachments

        Issue Links

          Activity

            People

              melix Cédric Champeau
              tim_yates Tim Yates
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: