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

STC: non ambiguous method call reported ambiguous

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.1
    • 2.0.2
    • Static Type Checker
    • None

    Description

      import groovy.transform.*
      
      @TypeChecked
      class Bug1 {
          void m(byte[] bytes) {}
          void m(byte[] bytes, int i1, int i2) {}
          void test() {
              m("foo".bytes, 1, 2)
          }
      }
      
      new Bug1().test()
      

      In the example above, STC believes the call is ambiguous, although it doesn't really appear to be. This yields the following compilation error:

      [Static type checking] - Reference to method is ambiguous. Cannot choose between [MethodNode@18204363[void m([B, int, int)], MethodNode@864642116[void m([B)]]
       at line: 8, column: 9
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: