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

STC: incorrect error for actual vs inferred closure parameter type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1, 3.0.6
    • None
    • None

    Description

      Follow up from GROOVY-9570. When the method is not a DGM, there is a slightly different path through STC and the same error is currently given.

      import groovy.transform.stc.*
      @groovy.transform.TypeChecked
      class C<I extends Item> {
        Queue<I> queue
        def c = { ->
          x(queue) { I item ->
            println item
          }
        }
        def m() {
          x(queue) { I item ->
            println item
          }
        }
        def <T> T x(Collection<T> y, @ClosureParams(FirstParam.FirstGenericType) Closure<?> z) {
        }
      }
      interface Item {}
      new C()
      

      Both instances of "I item" are flagged with the same error described in GROOVY-9570

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 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 - 20m
                20m