Apparently this fails to line up the types -- try to sidestep the issue entirely by writing the code in a more reasonable way: Walk over the operands and perform a set lookup, rather than walking over the set and performing an operand scan.