-
-
Save swannodette/7599766 to your computer and use it in GitHub Desktop.
(let [x (cons 1 nil)] | |
(+ x 1)) | |
;; WARNING: cljs.core/+, all arguments must be numbers, got [cljs.core/Cons number] instead. | |
(let [x (interleave (repeat "foo") (repeat "bar"))] | |
(+ x 1)) | |
;; WARNING: cljs.core/+, all arguments must be numbers, got [cljs.core/LazySeq number] instead. |
@ericnormand interleave
returns a lazy sequence, of characters in this case.
Note none of this is a replacement for what core.typed does, it's really only designed to handle the common non-higher order cases. If you need something more powerful than that, you know where to look :)
Getting the primitive arithmetic check in was just a fun way to kick off having more type information in the AST, the real benefit will be around eliminating protocol overheads where we can.
(take 10 (interleave (repeat "foo") (repeat "bar"))) => ("foo" "bar" "foo" "bar" "foo" "bar" "foo" "bar" "foo" "bar")
It's definitely useful! Just wondering if it's a bug.
@ericnormand, sorry I understand the source of your confusion now, that vector is just the types of the argument list - the inference doesn't consider contents of collections - that's definitely outside the realm of what we want to handle in the ClojureScript compiler.
Is that last line correct? [cljs.core/LazySeq number] ? Should be string, no?