core.typed

Filters inferred from `and` macro are not useful

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: 0.2.0
  • Fix Version/s: None
  • Component/s: None
  • 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__))))

Activity

Ambrose Bonnaire-Sergeant made changes -
Field Original Value New Value
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.

{code:clojure}
(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__))))
{code}
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.

{code:lisp}
(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__))))
{code}
Affects Version/s 0.2.0 [ 10158 ]
Ambrose Bonnaire-Sergeant made changes -
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.

{code:lisp}
(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__))))
{code}
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.

{code}
(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__))))
{code}
Ambrose Bonnaire-Sergeant made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Ambrose Bonnaire-Sergeant made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: