core.typed

(first (filter ...)) type checks in Clojure, not ClojureScript

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    [[org.clojure/clojure "1.6.0"]
    [org.clojure/core.typed "0.2.67"]
    [org.clojure/clojurescript "0.0-2322"]]

Description

This code type check in Clojure:

Unable to find source-code formatter for language: clj. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(ann ffilter
  (All [a]
       [[a -> Any] (Option (Seqable a)) -> (Option a)]))

(defn ffilter
  [pred coll]
  (first (filter pred coll)))

But fails under ClojureScript with:

Type Error (typed-playground.clojurescript:26:3) Polymorphic function cljs.core/first could not be applied to arguments:
Polymorphic Variables:
x

Domains:
(clojure.core.typed/HSequential [x clojure.core.typed/Any *])
(cljs.core.typed/Option (cljs.core.typed/EmptySeqable x))
(cljs.core.typed/NonEmptySeqable x)
(cljs.core.typed/Option (cljs.core.typed/Seqable x))

Arguments:
(cljs.core/ASeq a)

Ranges:
x :object {:path [(Nth 0)], :id 0}
nil
x
(cljs.core.typed/Option x)

with expected type:
(cljs.core.typed/Option a)

in: (cljs.core/first (cljs.core/filter pred coll))
in: (cljs.core/first (cljs.core/filter pred coll))

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: