SI-7290 Discard duplicates in switchable alternative patterns.

The pattern matcher must not allow duplicates to hit the
backend when generating switches. It already eliminates then
if they appear on different cases (with an unreachability warning.)

This commit does the same for duplicated literal patterns in an
alternative pattern: discard and warn.
SI-7290 Minor cleanups driven by review comments.

  - make a def a val, we only need to compute it once
  - add a clarifying comment
  - only report the first duplicate
Merge pull request #2291 from retronym/ticket/7290

SI-7290 Discard duplicates in switchable alternative patterns.