tools.analyzer

potemkin has unusual macro invocation that causes tools.analyzer.jvm to throw exception

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

I am not sure whether tools.analyzer(.jvm) could/should analyze this kind of code successfully or not.

Steps to reproduce, using latest tools.analyzer(.jvm) and Eastwood as of Jan 6 2014 12:05am PST:

% git clone https://github.com/ztellman/potemkin.git
% cd potemkin

# The following gives no exception while analyzing namespace potemkin
% lein eastwood '{:namespaces [ potemkin ]}'

# The following does throw an exception while analyzing namespace potemkin
% lein eastwood '{:namespaces [ potemkin.namespaces potemkin ]}'

Activity

Hide
Andy Fingerhut added a comment -

With this change, I now get an exception on many namespaces I did not before. I believe that the common denominator is that whenever a function calls itself, there is an exception similar to the following, where this particular example is from project stencil's namespace stencil.utils:

% git clone https://github.com/davidsantiago/stencil.git
% cd stencil
% lein eastwood
== Linting stencil.utils ==
Exception thrown during phase :analyze of linting namespace stencil.utils
UnsupportedOperationException count not supported on this type: Symbol
	clojure.lang.RT.countFrom (RT.java:556)
	clojure.lang.RT.count (RT.java:530)
	clojure.core/count (core.clj:832)
	clojure.core/sort-by/fn--4299 (core.clj:2769)
	clojure.lang.AFunction.compare (AFunction.java:49)
	java.util.TimSort.countRunAndMakeAscending (TimSort.java:324)
	java.util.TimSort.sort (TimSort.java:189)
	java.util.TimSort.sort (TimSort.java:173)
	java.util.Arrays.sort (Arrays.java:659)
	clojure.core/sort (core.clj:2754)
	clojure.core/sort-by (core.clj:2769)
	clojure.core/sort-by (core.clj:2767)
	clojure.tools.analyzer.utils/arglist-for-arity (utils.clj:87)
	clojure.tools.analyzer.passes.jvm.infer-tag/eval1970/fn--1972 (infer_tag.clj:221)
Show
Andy Fingerhut added a comment - With this change, I now get an exception on many namespaces I did not before. I believe that the common denominator is that whenever a function calls itself, there is an exception similar to the following, where this particular example is from project stencil's namespace stencil.utils:
% git clone https://github.com/davidsantiago/stencil.git
% cd stencil
% lein eastwood
== Linting stencil.utils ==
Exception thrown during phase :analyze of linting namespace stencil.utils
UnsupportedOperationException count not supported on this type: Symbol
	clojure.lang.RT.countFrom (RT.java:556)
	clojure.lang.RT.count (RT.java:530)
	clojure.core/count (core.clj:832)
	clojure.core/sort-by/fn--4299 (core.clj:2769)
	clojure.lang.AFunction.compare (AFunction.java:49)
	java.util.TimSort.countRunAndMakeAscending (TimSort.java:324)
	java.util.TimSort.sort (TimSort.java:189)
	java.util.TimSort.sort (TimSort.java:173)
	java.util.Arrays.sort (Arrays.java:659)
	clojure.core/sort (core.clj:2754)
	clojure.core/sort-by (core.clj:2769)
	clojure.core/sort-by (core.clj:2767)
	clojure.tools.analyzer.utils/arglist-for-arity (utils.clj:87)
	clojure.tools.analyzer.passes.jvm.infer-tag/eval1970/fn--1972 (infer_tag.clj:221)
Hide
Nicola Mometto added a comment -

I should make a habit of running the eastwood crucible before closing a ticket.
Should be fixed with https://github.com/clojure/tools.analyzer.jvm/commit/339abfa780fdef0de96100eedd0fbe3101dc26ad

Show
Nicola Mometto added a comment - I should make a habit of running the eastwood crucible before closing a ticket. Should be fixed with https://github.com/clojure/tools.analyzer.jvm/commit/339abfa780fdef0de96100eedd0fbe3101dc26ad
Hide
Andy Fingerhut added a comment -

Looking much better after the second fix. You are welcome to use the eastwood crucible for testing, but if you don't, I will The whole list of projects takes over 30 mins on a reasonably recent laptop, and does not give pass/fail results, but a lot of output. I typically only notice things when the saved output of a previous lint.sh run is significantly different than the latest one.

Show
Andy Fingerhut added a comment - Looking much better after the second fix. You are welcome to use the eastwood crucible for testing, but if you don't, I will The whole list of projects takes over 30 mins on a reasonably recent laptop, and does not give pass/fail results, but a lot of output. I typically only notice things when the saved output of a previous lint.sh run is significantly different than the latest one.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: