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

0 votes
in Compiler by

extend-type works with non-constant expressions as its type:

(extend-type (class 1) proto (protof [this]))

However, in this case this will get tagged with (class 1), which is clearly wrong; the doc explicitely states that the args will be proberly type-hinted: "(link: ..) Propagates the class as a type hint on the first argument of all fns."

I don't know if extend-type is not supposed to work with non-constant Classes, in which case it should be stated in the doc or if the current behaviour is wrong.

2 Answers

0 votes
by

Comment made by: jafingerhut

Eastwood as of around version 0.2.1 (or maybe have to wait until not-yet-released 0.2.2) will warn about such incorrect tags, if the :wrong-tag linter is enabled -- it is by default. The section of Eastwood's documentation on this linter has a subsection specifically on extend-type and extend-protocol, primarily written so Andy can have a place to refer to this later after he forgets the details again.

https://github.com/jonase/eastwood#wrong-tag

(you have to scroll down a page or two to get to the subsection on extend-type / extend-protocol)

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