Skip to content

Instantly share code, notes, and snippets.

@frenchy64
Created November 25, 2012 17:08
Show Gist options
  • Select an option

  • Save frenchy64/4144347 to your computer and use it in GitHub Desktop.

Select an option

Save frenchy64/4144347 to your computer and use it in GitHub Desktop.
(ns cljs-test.core
(:require [typed.internal :refer [print-env]])
(:require-macros [typed.core :as t]))
(t/cljs-ann occurrence-t [(U nil [-> BooleanCLJS]) -> BooleanCLJS])
(defn occurrence-t [x]
(if x
(do
(print-env "then branch")
(x))
(do
(print-env "else branch")
false)))
; ClojureScript:cljs-test.core> (t/check-cljs-ns)
; "then branch"
; {:env {x (Fn [-> BooleanCLJS]),
; occurencet (Fn [(U (Fn [-> BooleanCLJS]) nil) -> BooleanCLJS])},
; :props ((! (U false nil) x))}
; "else branch"
; {:env {x nil,
; occurencet (Fn [(U (Fn [-> BooleanCLJS]) nil) -> BooleanCLJS])},
; :props ((is (U false nil) x))}
; nil
; ClojureScript:cljs-test.core>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment