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

SAM trait coercion via middle interface

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.10
    • 3.0.11, 4.0.2, 2.5.19
    • None

    Description

      trait T {
          abstract def foo(int i)
      
          def bar(double j) {
              println "bar $j"
          }
      }
      interface F extends T {}
      
      F t = { println "closure $it" }
      t.foo(42) // `closure 42`
      t.bar(43) // `closure 43.0`; should be `bar 43.0`
      

      Changing variable type to T works as expected.

      Attachments

        Activity

          People

            emilles Eric Milles
            daniilo Daniil Ovchinnikov
            Votes:
            0 Vote for this issue
            Watchers:
            4 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