ckirkendall / enfocus

DOM manipulation and templating library for ClojureScript inspired by Enlive.
http://ckirkendall.github.com/enfocus-site/
370 stars 41 forks source link

Requiring enfocus.macros under Clojure 1.10 and above triggers an error #111

Open zane opened 5 years ago

zane commented 5 years ago

enfocus.macros appears to have a malformed :import in its ns form. This results in an error when it is required from versions of Clojure that enforce the ns macro's spec.

I believe this could be fixed by the following change:

- (:import [org.jsoup.Jsoup]))
+ (:import [org.jsoup Jsoup]))

If that looks good I'd be happy to submit a pull request. Just let me know!

Reproduction steps

With the clojure command line tools installed:

clojure -Srepro -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0"}, enfocus {:mvn/version "2.1.1"}}}' -e "(require 'enfocus.macros)" 

Expected results

clojure exits without triggering an error.

Actual results

Exception in thread "main" Syntax error macroexpanding clojure.core/ns at (enfocus/macros.clj:1:1).
Call to clojure.core/ns did not conform to spec.
    at clojure.lang.Compiler.checkSpecs(Compiler.java:6971)
    at clojure.lang.Compiler.macroexpand1(Compiler.java:6987)
    at clojure.lang.Compiler.macroexpand(Compiler.java:7074)
    at clojure.lang.Compiler.eval(Compiler.java:7160)
    at clojure.lang.Compiler.load(Compiler.java:7635)
    at clojure.lang.RT.loadResourceScript(RT.java:381)
    at clojure.lang.RT.loadResourceScript(RT.java:372)
    at clojure.lang.RT.load(RT.java:463)
    at clojure.lang.RT.load(RT.java:428)
    at clojure.core$load$fn__6824.invoke(core.clj:6126)
    at clojure.core$load.invokeStatic(core.clj:6125)
    at clojure.core$load.doInvoke(core.clj:6109)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5908)
    at clojure.core$load_one.invoke(core.clj:5903)
    at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
    at clojure.core$load_lib.invokeStatic(core.clj:5947)
    at clojure.core$load_lib.doInvoke(core.clj:5928)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$load_libs.invokeStatic(core.clj:5985)
    at clojure.core$load_libs.doInvoke(core.clj:5969)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$require.invokeStatic(core.clj:6007)
    at clojure.core$require.doInvoke(core.clj:6007)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at user$eval1.invokeStatic(NO_SOURCE_FILE:1)
    at user$eval1.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:7176)
    at clojure.lang.Compiler.eval(Compiler.java:7131)
    at clojure.core$eval.invokeStatic(core.clj:3214)
    at clojure.main$eval_opt.invokeStatic(main.clj:465)
    at clojure.main$eval_opt.invoke(main.clj:459)
    at clojure.main$initialize.invokeStatic(main.clj:485)
    at clojure.main$null_opt.invokeStatic(main.clj:519)
    at clojure.main$null_opt.invoke(main.clj:516)
    at clojure.main$main.invokeStatic(main.clj:598)
    at clojure.main$main.doInvoke(main.clj:561)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec. {:clojure.spec.alpha/problems ({:path [:ns-clauses :refer-clojure :clause], :pred #{:refer-clojure}, :val :import, :via [:clojure.core.specs.alpha/ns-form :clojure.core.specs.alpha/ns-refer-clojure :clojure.core.specs.alpha/ns-refer-clojure], :in [3 0]} {:path [:ns-clauses :require :clause], :pred #{:require}, :val :import, :via [:clojure.core.specs.alpha/ns-form :clojure.core.specs.alpha/ns-require :clojure.core.specs.alpha/ns-require], :in [3 0]} {:path [:ns-clauses :import :classes :class], :pred clojure.core/simple-symbol?, :val [org.jsoup.Jsoup], :via [:clojure.core.specs.alpha/ns-form :clojure.core.specs.alpha/ns-import :clojure.core.specs.alpha/ns-import :clojure.core.specs.alpha/import-list], :in [3 1]} {:path [:ns-clauses :import :classes :package-list :classes], :reason "Insufficient input", :pred clojure.core/simple-symbol?, :val (), :via [:clojure.core.specs.alpha/ns-form :clojure.core.specs.alpha/ns-import :clojure.core.specs.alpha/ns-import :clojure.core.specs.alpha/import-list :clojure.core.specs.alpha/package-list :clojure.core.specs.alpha/package-list], :in [3 1]} {:path [:ns-clauses :use :clause], :pred #{:use}, :val :import, :via [:clojure.core.specs.alpha/ns-form :clojure.core.specs.alpha/ns-use :clojure.core.specs.alpha/ns-use], :in [3 0]} {:path [:ns-clauses :refer :clause], :pred #{:refer}, :val :import, :via [:clojure.core.specs.alpha/ns-form :clojure.core.specs.alpha/ns-refer :clojure.core.specs.alpha/ns-refer], :in [3 0]} {:path [:ns-clauses :load :clause], :pred #{:load}, :val :import, :via [:clojure.core.specs.alpha/ns-form :clojure.core.specs.alpha/ns-load :clojure.core.specs.alpha/ns-load], :in [3 0]} {:path [:ns-clauses :gen-class :clause], :pred #{:gen-class}, :val :import, :via [:clojure.core.specs.alpha/ns-form :clojure.core.specs.alpha/ns-gen-class :clojure.core.specs.alpha/ns-gen-class], :in [3 0]}), :clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x764faa6 "clojure.spec.alpha$regex_spec_impl$reify__2509@764faa6"], :clojure.spec.alpha/value (enfocus.macros (:refer-clojure :exclude [filter delay]) (:require [clojure.java.io :as io] [enfocus.enlive.syntax :as syn]) (:import [org.jsoup.Jsoup])), :clojure.spec.alpha/args (enfocus.macros (:refer-clojure :exclude [filter delay]) (:require [clojure.java.io :as io] [enfocus.enlive.syntax :as syn]) (:import [org.jsoup.Jsoup]))}
    at clojure.spec.alpha$macroexpand_check.invokeStatic(alpha.clj:705)
    at clojure.spec.alpha$macroexpand_check.invoke(alpha.clj:697)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.lang.Compiler.checkSpecs(Compiler.java:6969)
    ... 41 more