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

@CompileStatic fails to unify types

    XMLWordPrintableJSON

    Details

      Description

      @CompileStatic
      class A {
          static <U> void foo(U a, U b) {}
      
          static void main(String[] args) {
              foo(1, "")
          }
      }
      

      The following code fails to compile with error

      Groovyc: [Static type checking] - Cannot call <U> A#foo(U, U) with arguments [int, java.lang.String]

      U should be inferred to LUB(Integer, String), hence the call should be successful.

        Attachments

          Activity

            People

            • Assignee:
              emilles Eric Milles
              Reporter:
              knisht Konstantin Nisht
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h