<< Back to previous view

[CTYP-23] Filters inferred from `and` macro are not useful Created: 25/Mar/13  Updated: 15/Sep/13  Resolved: 25/Mar/13

Status: Closed
Project: core.typed
Component/s: None
Affects Version/s: 0.2.0
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Ambrose Bonnaire-Sergeant Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

We aren't handling `and`'s macroexpansion well. This probably has something to do with the composite filter constructors -and and -or, and how they simplify their members.

(deftest let-filter-unscoping-test
  (is (cf (fn [a]
            (and (< 1 2) a))
          [(U nil Number) -> Any :filters {:then (is Number 0)}])))


ERROR in (let-filter-unscoping-test) (subtype.clj:24)
expected: (cf (fn [a] (and (< 1 2) a)) [(U nil Number) -> Any :filters {:then (is Number 0)}])
  actual: java.lang.Exception: Type Error, REPL:3

Actual type
	(Fn [(U java.lang.Number nil) -> (U java.lang.Number false nil) {:then (| (! (U false nil) 0) tt), :else (| (is (U false nil) 0) tt)}])
is not a subtype of Expected type
	(Fn [(U java.lang.Number nil) -> Any {:then (is java.lang.Number 0), :else tt}])

Form: (fn* ([a] (let* [and__3941__auto__ (clojure.lang.Numbers/lt 1 2)] (if and__3941__auto__ a and__3941__auto__))))


 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 25/Mar/13 9:46 AM ]

Fixed. https://github.com/clojure/core.typed/commit/87040592b383436bf37bd3908727335f3d29e2b3

Generated at Wed Aug 20 09:47:17 CDT 2014 using JIRA 4.4#649-r158309.