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

Type checker doesn't find constructor if generic placeholder name doesn't match

    XMLWordPrintableJSON

Details

    Description

      The following code fails compilation:

      class Helper<V> {
          public Helper(Closure<V> cl) {}
      }
      
      static <C> void extensionMethod(Closure<C> cl) {
          new Helper<C>(cl)
      }
      
      extensionMethod {
          'string'
      }
      

      The type checker incorrectly tries to match the placeholder name, even if it's not defined at the same level. It's a regression, this used to compile in 2.2.1.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: