Uploaded image for project: 'core.typed'
  1. CTYP-225

Intersections of value types broken

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: Backlog
    • Components: None
    • Labels:
      None

      Description

      https://gist.github.com/joerupen/efb104ea81fce9d3a77d

       
      ;; Does core.type intersection not work on values?
       
      (ns user-types.demo
        (:require [clojure.core.typed :as t]))
       
      (t/defalias week-days "mon-fri"
        (t/U (t/Val :mon) (t/Val :tue) (t/Val :wed) 
             (t/Val :thu) (t/Val :fri) ))
       
      (t/defalias party-days "days with party events"
        (t/U  (t/Val :fri) (t/Val :sat)))
       
      (t/defalias party-days-of-the-week "days in the week with party events"
        (t/I week-days party-days))
       
      (t/defn party-during-week [x :- party-days-of-the-week] x)
       
      ;; then in repl
      (check-ns 'user-types.demo)
       
      (t/cf (u/party-during-week :wed))
      ;; ups, no error? only friday should be allowed
      => [(t/I u/party-days u/week-days) {:then tt, :else ff}]
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ambrosebs Ambrose BS
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: