oakes / Nightlight

An embedded editor for Clojure
https://sekao.net/nightlight/
The Unlicense
788 stars 35 forks source link

Macro expand error under clojure 1.10 #53

Closed yellowbean closed 5 years ago

yellowbean commented 5 years ago

Great project, I wish i could try this new stuff . But seems that I have some trouble to install . My project profile (basically from scratch ):

(defproject sandbox "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "https://www.eclipse.org/legal/epl-2.0/"}
  :dependencies [[org.clojure/clojure "1.10.0"]]
  :plugins [
            [cider/cider-nrepl "0.21.0"]
            [nightlight/lein-nightlight "2.4.0"]            
            ]  
  :repl-options {:init-ns sandbox.core})

my command to start nightlight, the console show error

clojure.lang.Compiler$CompilerException: Syntax error macroexpanding clojure.core/fn at (clojure/core/unify.clj:83:18).
#:clojure.error{:phase :macro-syntax-check, :line 83, :column 18, :source "clojure/core/unify.clj", :symbol clojure.core/fn}
 at clojure.lang.Compiler.checkSpecs (Compiler.java:6971)
    clojure.lang.Compiler.macroexpand1 (Compiler.java:6987)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:7092)
    clojure.lang.Compiler.analyze (Compiler.java:6789)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:7094)
    clojure.lang.Compiler.analyze (Compiler.java:6789)
    clojure.lang.Compiler.access$300 (Compiler.java:38)

Any advice will be appreciated ,thank you very much !
oakes commented 5 years ago

I tried a project with that project.clj and it worked for me. Do you have anything extra being added by your ~/.lein/profiles.clj? Try running lein deps :tree in your project and see if you can spot what is pulling in core.unify (I've never heard of that before).

yellowbean commented 5 years ago

Thanks for your prompt reply, Mr Oakes, I've deleted the profiles.clj ,the error persists

here is output from my console after lein deps :tree

[cider/cider-nrepl "0.21.0"]
[clojure-complete "0.2.5" :exclusions [[org.clojure/clojure]]]
[nrepl "0.6.0" :exclusions [[org.clojure/clojure]]]
[org.clojure/clojure "1.10.0"]
  [org.clojure/core.specs.alpha "0.2.44"]
  [org.clojure/spec.alpha "0.2.176"]
oakes commented 5 years ago

That...is weird. What version of leiningen are you using? You can find out with lein --version. You can also try adding the latest core.unify dependency with [org.clojure/core.unify "0.5.7"], maybe that will fix it. It is weird that it isn't showing up in the dependency tree.

tldrblt commented 5 years ago

I received the same error, and also replicated it in a fresh Clojure docker container. I have attached a text file with all the info I could think to gather to help solve the problem. If you need any other info, let me know.

projects# lein -version
Leiningen 2.9.0 on Java 1.8.0_181 OpenJDK 64-Bit Server VM

projects/my-test-app# lein nightlight
clojure.lang.Compiler$CompilerException: Syntax error macroexpanding clojure.core/fn at (clojure/core/unify.clj:83:18).
#:clojure.error{:phase :macro-syntax-check, :line 83, :column 18, :source "clojure/core/unify.clj", :symbol clojure.core/fn}
 at clojure.lang.Compiler.checkSpecs (Compiler.java:6971)
    clojure.lang.Compiler.macroexpand1 (Compiler.java:6987)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:7092)
    clojure.lang.Compiler.analyze (Compiler.java:6789)
(...)
Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/fn did not conform to spec.
#:clojure.spec.alpha{:problems ({:path [:fn-tail :arity-1 :params], :pred clojure.core/vector?, :val clojure.core.unify/var-unify, :via [:clojure.core.specs.alpha/params+body :clojure.core.specs.alpha/param-list :clojure.core.specs.alpha/param-list], :in [0]} {:path [:fn-tail :arity-n], :pred (clojure.core/fn [%] (clojure.core/or (clojure.core/nil? %) (clojure.core/sequential? %))), :val clojure.core.unify/var-unify, :via [:clojure.core.specs.alpha/params+body :clojure.core.specs.alpha/params+body], :in [0]}), :spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0xaba625 "clojure.spec.alpha$regex_spec_impl$reify__2509@aba625"], :value (clojure.core.unify/var-unify [G__794 G__795 G__796 G__797] (clojure.core/if-let [vb__787__auto__ (G__797 G__795)] (clojure.core.unify/garner-unifiers G__794 vb__787__auto__ G__796 G__797) (clojure.core/if-let [vexpr__788__auto__ (clojure.core/and (G__794 G__796) (G__797 G__796))] (clojure.core.unify/garner-unifiers G__794 G__795 vexpr__788__auto__ G__797) (if (clojure.core.unify/occurs? G__794 G__795 G__796 G__797) (throw (java.lang.IllegalStateException. (clojure.core/str "Cycle found in the path " G__796))) (clojure.core.unify/bind-phase G__797 G__795 G__796))))), :args (clojure.core.unify/var-unify [G__794 G__795 G__796 G__797] (clojure.core/if-let [vb__787__auto__ (G__797 G__795)] (clojure.core.unify/garner-unifiers G__794 vb__787__auto__ G__796 G__797) (clojure.core/if-let [vexpr__788__auto__ (clojure.core/and (G__794 G__796) (G__797 G__796))] (clojure.core.unify/garner-unifiers G__794 G__795 vexpr__788__auto__ G__797) (if (clojure.core.unify/occurs? G__794 G__795 G__796 G__797) (throw (java.lang.IllegalStateException. (clojure.core/str "Cycle found in the path " G__796))) (clojure.core.unify/bind-phase G__797 G__795 G__796)))))}
 at clojure.spec.alpha$macroexpand_check.invokeStatic (alpha.clj:705)
    clojure.spec.alpha$macroexpand_check.invoke (alpha.clj:697)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.AFn.applyTo (AFn.java:144)

nightlight_error_info.txt

oakes commented 5 years ago

OK it looks like the cause is the new version of Leiningen. I had lein 2.8.1 which worked fine. After upgrading I can now see this error. I will look into this today, thanks.

tldrblt commented 5 years ago

Thanks for the info. As a temporary workaround, given what you said, I downgraded my Leiningen installation to 2.8.1, and now nightlight works fine.

jbwyatt4 commented 5 years ago

I got this error today with lein 2.9.1 with Clojure 1.10.0 on Java 11.0.2.

Changing ~/.lein/profiles.clj to {:user {:plugins [ [org.clojure/core.unify "0.5.7"] [nightlight/lein-nightlight "RELEASE"] ]}} Did fix it.

yochannah commented 5 years ago

Upgrading unify in the plugins section just fixed my build - thanks @jbwyatt4!

yellowbean commented 5 years ago

it works by @jbwyatt4 's config ! Thanks !