Raise an error when multiple when_* statements are provided

Fixes #1994.