Completed
Details
Assignee
Nicola MomettoNicola MomettoReporter
Andy FingerhutAndy FingerhutPriority
Minor
Details
Details
Assignee
Nicola Mometto
Nicola MomettoReporter
Andy Fingerhut
Andy FingerhutPriority
Created December 5, 2013 at 5:28 AM
Updated August 9, 2014 at 4:10 PM
Resolved August 9, 2014 at 4:10 PM
While the Clojure Compiler silently ignores :tag metadata in some forms when it cannot be resolved to a class, c.t.a.passes.jvm/validate throws an exception every time.
Some libraries (test.generators) use :tag metadata to store instructions for generating test input data, those can be everything, from symbols to quoted clojure expressions – the Clojure Compiler allows for this but validate throws an exception.
Generally however, when :tag cannot be resolved to a class it's not beacause of a design choice, but because of a Clojure bug or a user-code bug.
Some examples are:
tagging a defn form in the fn name with a primitive type hint:
using extend-type with a run-time resolved class http://dev.clojure.org/jira/browse/CLJ-1308
type hinting a form in a namespace with an imported class doesn't qualify the class in :tag http://dev.clojure.org/jira/browse/CLJ-1232
A clojure-dev post has been opened asking whether tools.analyzer.jvm is correct in assuming that non class-resolvible tags are an error and thus an exception could be thrown, or if the current behaviour of the Cloure implementation of throwing in some special places and silently ignoring malformed :tag values is by design. It hasn't have received an official reply yet. https://groups.google.com/d/msg/clojure-dev/hRZFuaiB_50/mzKLirgZWmUJ