~technomancy/fennel#251: 
(case) pattern matching edge case

The pattern (where (or [x &as y] [x &as y])) should compile. Even though the symbol &as appears in both the patterns, symbols-in-pattern should probably ignore it, like it does to or and nil symbols.

We also have the dual issue. If a symbol in (or) doesn't appear in all the patterns, case will never try to bind it, so invalid symbols can be present. Eg, the pattern (where (or &invalid&symbol& or 1)) pattern should not compile.

;; should compile but doesn't
(case [1]
  ;; &as is used in every subpattern: does not compile
  (where (or [x &as y] [x &as y])) y)
;; shouldn't compile, but does
(case 1
  ;; (or) sees that `&invalid&symbol&` isn't in all the patterns and never binds it
  (where (or &invalid&symbol& or 1)) 1)
Status
REPORTED
Submitter
~xerool
Assigned to
No-one
Submitted
a month ago
Updated
a month ago
Labels
bug macros