Revert "Revert "optimize exhaustive one-case matches (closes #2019)""

This reverts commit b7775a713d52b9127c0e1edc8bafa88b10c733b2.
closes issue #2059