Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

The compiler has a lot of assumptions about the possible types of IPersistentCollection literals and rightfully so. The strange thing with this case is, that taking the (constant) value works as soon as count is defined, but using it as an argument hits a closed dispatch for emitting the empty variants of the various literals.

> (deftype T [] clojure.lang.IPersistentCollection (count [_] 0) > (def ^:const t (T.)) > (meta t) java.lang.UnsupportedOperationException: Unknown Collection type Compiler.java:2860 clojure.lang.Compiler$EmptyExpr.emit Compiler.java:3632 clojure.lang.Compiler$InvokeExpr.emitArgsAndCall ...

EDIT updated the ticket after some investigation
NOTE attached test patch doesn't even implement (count (link: )) for the deftype, which just triggers a rightful AbstractMethodError

4 Answers

0 votes
by

Comment made by: bendlas

The test had a typo, sorry

0 votes
by

Comment made by: alexmiller

Looks like a variant of CLJ-1093.

0 votes
by

Comment made by: bendlas

This bug is still present in 1.8, even though CLJ-1093 has been marked fixed for 1.8.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1575 (reported by bendlas)
...