You could also match on the common superclass of these two, ImplDef, but I'm not sure if it makes the code easier.