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

Expected parameter of type XXX but got YYY static compile error

    XMLWordPrintableJSON

Details

    Description

      The following code report a compilation error:

      @CompileStatic
      class Test {
        List<Foo> foo() {
          return []
        }
      
        List<String> bar() {
          return foo().collect { Foo it -> it.instanceId }
        }
      }
      
      @CompileStatic
      class Foo {
        String instanceId
      }

       

      Error message

      Test.groovy: 36: Expected parameter of type java.lang.String but got nextflow.Foo
      
      @ line 36, column 32.
      
                 return foo().collect { Foo it -> it.instanceId }
      
                                        ^
      
      Test.groovy: 36: [Static type checking] - No such property: instanceId for class: java.lang.String
      
      @ line 36, column 42.
      
         urn foo().collect { Foo it -> it.instanc

      Attachments

        Issue Links

          Activity

            People

              jwagenleitner John Wagenleitner
              pablo72 paolo di tommaso
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: