GROOVY-6627: Fixed regression in generics type checking