GROOVY-6676: The type checker doesn't use the right receiver type to perform return type inference