An expression in Specter that causes t.a.j/analyze+eval to throw exception, but Clojure compiles OK

Description

Steps to reproduce:

% git clone https://github.com/nathanmarz/specter % cd specter % git checkout 92caabbb32e1524c27e00f95d7a2a007ee5b0c00

Edit project.clj to add `[org.clojure/tools.analyzer.jvm "0.7.1"]` to vector at `face with tonguerofiles :dev :dependencies`

% lein repl user=> (require '[com.rpl.specter :as s]) nil user=> (require '[clojure.tools.analyzer.jvm :as j]) nil user=> (def x (j/analyze+eval '(let [a :b] #_=> (s/select #_=> (s/view #_=> (fn [v] #_=> (s/select [(s/keypath v) (s/keypath a)] #_=> {:a {:b 1}}))) #_=> :a)))) CompilerException clojure.lang.ExceptionInfo: var not found: a {:var a}, compiling:(form-init3889265569495085919.clj:1:8)

The expression which causes `j/analyze+eval` to throw an exception is adapted from inside a Specter test file, where the latest development version of Eastwood gets the same exception when trying to lint the similar expression in that file: https://github.com/nathanmarz/specter/blob/master/test/com/rpl/specter/core_test.cljc#L931-L939

Environment

None

Activity

Show:

Nicola MomettoOctober 14, 2017 at 4:08 PM

Not something we can fix, unfortuantely

Nicola MomettoOctober 14, 2017 at 4:05 PM

After 20 more seconds, I found out that specter also uses riddley's macroexpander, which is a library known to break using tools.analyzer as it uses &env's internals

Nicola MomettoOctober 14, 2017 at 4:02 PM

I just started looking into this, but it seems like specter does some funky stuff with `&env`, so that might be part of the reason why this fails

Andy FingerhutOctober 13, 2017 at 10:58 PM

A warning: Specter can turn small expressions like the example in the description into fairly large expressions after macro expansion. I haven't tried to understand all of the things being done in the macro-expanded version. Good luck! slightly smiling face

Declined

Details

Assignee

Reporter

Priority

Created October 12, 2017 at 4:27 AM
Updated October 14, 2017 at 4:08 PM
Resolved October 14, 2017 at 4:08 PM