[FIX] XQuery, typeswitch: handle identical branches. Closes #661.