GROOVY-5889: Type checker goes into infinite loop