diff options
Diffstat (limited to 'luxc/src')
-rw-r--r-- | luxc/src/lux/analyser.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/analyser/lux.clj | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj index 116102f37..2d029155e 100644 --- a/luxc/src/lux/analyser.clj +++ b/luxc/src/lux/analyser.clj @@ -145,7 +145,7 @@ (&&lux/analyse-program analyse optimize compile-program ?args ?body))) "lux case" - (|let [(&/$Cons ?value ?branches) parameters] + (|let [(&/$Cons ?value (&/$Cons [_ (&/$Record ?branches)] (&/$Nil))) parameters] (&/with-analysis-meta cursor exo-type (&&lux/analyse-case analyse exo-type ?value ?branches))) diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj index 8dc13680d..d6e82481d 100644 --- a/luxc/src/lux/analyser/lux.clj +++ b/luxc/src/lux/analyser/lux.clj @@ -393,9 +393,7 @@ ) (defn analyse-case [analyse exo-type ?value ?branches] - (|do [:let [num-branches (&/|length ?branches)] - _ (&/assert! (> num-branches 0) "[Analyser Error] Cannot have empty branches in \"case\" expression.") - _ (&/assert! (even? num-branches) "[Analyser Error] Unbalanced branches in \"case\" expression.") + (|do [_ (&/assert! (> (&/|length ?branches) 0) "[Analyser Error] Cannot have empty branches in \"case\" expression.") =value (&&/analyse-1+ analyse ?value) :let [var?? (|case =value [_ (&&/$var =var-kind)] @@ -403,7 +401,7 @@ _ &/$None)] - =match (&&case/analyse-branches analyse exo-type var?? (&&/expr-type* =value) (&/|as-pairs ?branches)) + =match (&&case/analyse-branches analyse exo-type var?? (&&/expr-type* =value) ?branches) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor (&&/$case =value =match) |