-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
Defining sum types does not work when aliasing types or predicates in match expressions, in ClojureScript at least:
(require '[active.clojure.sum-type :as st :include-macros true])
(require '[active.clojure.cljs.record :as rec :include-macros true])
(rec/define-record-type T {:rtd-record? true} (make-t) t? [])
(st/define-sum-type S1 s? [T])
(def S2 S1)
(st/define-sum-type S2 s? [T])
(def T2 T)
(st/define-sum-type S2 s? [T2])
Compile Exception: rtd-record or sum-type required, found: T2
A similar error is raised when using an alias of t? in a match expression.
This is quite a burden for code reuse/abstraction, and should be fixed if possible.