<< Back to previous view

[CLJ-1308] extend-type doesn't type-hint correctly as promised by the doc when the class is determined at run-time Created: 15/Dec/13  Updated: 06/Jan/15

Status: Open
Project: Clojure
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Nicola Mometto Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: typehints


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: "[..] 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.

Comment by Andy Fingerhut [ 06/Jan/15 4:37 PM ]

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.


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

Generated at Sat Nov 28 19:52:03 CST 2015 using JIRA 4.4#649-r158309.