GROOVY-6657: (backport from master) Fix generic placeholder type checking