Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompilerException when macroexpanding an ns containing reader-condtional requires #208

Open
chr15m opened this issue Nov 5, 2021 · 1 comment

Comments

@chr15m
Copy link

chr15m commented Nov 5, 2021

I am trying to generate docs for Sitefox and running into the following error when it encounters deps.cljc.

> ( echo '# Readme'; cat README.md ) > codox-readme.md && clojure -X:codox

Could not generate clojure documentation for sitefox.deps - root cause: clojure.lang.Compiler$CompilerException Syntax error macroexpanding clojure.core/ns at (sitefox/deps.cljc:1:1).
Syntax error macroexpanding clojure.core/ns at (sitefox/deps.cljc:1:1).
Call to clojure.core/ns did not conform to spec.
	at clojure.lang.Compiler.checkSpecs(Compiler.java:6976)
	at clojure.lang.Compiler.macroexpand1(Compiler.java:6992)
	at clojure.lang.Compiler.macroexpand(Compiler.java:7079)
	at clojure.lang.Compiler.eval(Compiler.java:7165)
	at clojure.lang.Compiler.load(Compiler.java:7640)
	at clojure.lang.RT.loadResourceScript(RT.java:381)
	at clojure.lang.RT.loadResourceScript(RT.java:372)
	at clojure.lang.RT.load(RT.java:459)
	at clojure.lang.RT.load(RT.java:424)
	at clojure.core$load$fn__6856.invoke(core.clj:6115)
	at clojure.core$load.invokeStatic(core.clj:6114)
	at clojure.core$load.doInvoke(core.clj:6098)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.core$load_one.invokeStatic(core.clj:5897)
	at clojure.core$load_one.invoke(core.clj:5892)
	at clojure.core$load_lib$fn__6796.invoke(core.clj:5937)
	at clojure.core$load_lib.invokeStatic(core.clj:5936)
	at clojure.core$load_lib.doInvoke(core.clj:5917)
	at clojure.lang.RestFn.applyTo(RestFn.java:142)
	at clojure.core$apply.invokeStatic(core.clj:669)
	at clojure.core$load_libs.invokeStatic(core.clj:5974)
	at clojure.core$load_libs.doInvoke(core.clj:5958)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invokeStatic(core.clj:669)
	at clojure.core$require.invokeStatic(core.clj:5996)
	at clojure.core$require.doInvoke(core.clj:5996)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at codox.reader.clojure$read_ns.invokeStatic(clojure.clj:95)
	at codox.reader.clojure$read_ns.invoke(clojure.clj:90)
	at codox.reader.clojure$read_namespaces$fn__779$fn__780.invoke(clojure.clj:153)
	at clojure.core$map$fn__5884.invoke(core.clj:2759)
	at clojure.lang.LazySeq.sval(LazySeq.java:42)
	at clojure.lang.LazySeq.seq(LazySeq.java:51)
	at clojure.lang.RT.seq(RT.java:535)
	at clojure.core$seq__5419.invokeStatic(core.clj:139)
	at clojure.core$apply.invokeStatic(core.clj:662)
	at clojure.core$mapcat.invokeStatic(core.clj:2787)
	at clojure.core$mapcat.doInvoke(core.clj:2787)
	at clojure.lang.RestFn.invoke(RestFn.java:423)
	at codox.reader.clojure$read_namespaces$fn__779.invoke(clojure.clj:153)
	at clojure.core$map$fn__5884.invoke(core.clj:2757)
	at clojure.lang.LazySeq.sval(LazySeq.java:42)
	at clojure.lang.LazySeq.seq(LazySeq.java:51)
	at clojure.lang.RT.seq(RT.java:535)
	at clojure.core$seq__5419.invokeStatic(core.clj:139)
	at clojure.core$apply.invokeStatic(core.clj:662)
	at clojure.core$mapcat.invokeStatic(core.clj:2787)
	at clojure.core$mapcat.doInvoke(core.clj:2787)
	at clojure.lang.RestFn.invoke(RestFn.java:423)
	at codox.reader.clojure$read_namespaces.invokeStatic(clojure.clj:150)
	at codox.reader.clojure$read_namespaces.invoke(clojure.clj:122)
	at codox.main$read_macro_namespaces.invokeStatic(main.clj:26)
	at codox.main$read_macro_namespaces.invoke(main.clj:25)
	at codox.main$cljs_read_namespaces.invokeStatic(main.clj:40)
	at codox.main$cljs_read_namespaces.invoke(main.clj:34)
	at codox.main$read_namespaces.invokeStatic(main.clj:83)
	at codox.main$read_namespaces.invoke(main.clj:80)
	at codox.main$generate_docs.invokeStatic(main.clj:123)
	at codox.main$generate_docs.invoke(main.clj:116)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.core$apply.invoke(core.clj:662)
	at clojure.run.exec$exec.invokeStatic(exec.clj:45)
	at clojure.run.exec$exec.doInvoke(exec.clj:39)
	at clojure.lang.RestFn.invoke(RestFn.java:423)
	at clojure.run.exec$_main$fn__203.invoke(exec.clj:177)
	at clojure.run.exec$_main.invokeStatic(exec.clj:173)
	at clojure.run.exec$_main.doInvoke(exec.clj:138)
	at clojure.lang.RestFn.invoke(RestFn.java:397)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.main$main_opt.invokeStatic(main.clj:514)
	at clojure.main$main_opt.invoke(main.clj:510)
	at clojure.main$main.invokeStatic(main.clj:664)
	at clojure.main$main.doInvoke(main.clj:616)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.main.main(main.java:40)
Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec. #:clojure.spec.alpha{:problems [{:path [], :reason "Extra input", :pred (clojure.spec.alpha/cat :docstring (clojure.spec.alpha/? clojure.core/string?) :attr-map (clojure.spec.alpha/? clojure.core/map?) :ns-clauses :clojure.core.specs.alpha/ns-clauses), :val ((:require)), :via [:clojure.core.specs.alpha/ns-form], :in [1]}], :spec #object[clojure.spec.alpha$regex_spec_impl$reify__2510 0x5abf9a76 "clojure.spec.alpha$regex_spec_impl$reify__2510@5abf9a76"], :value (sitefox.deps (:require)), :args (sitefox.deps (:require))}
	at clojure.spec.alpha$macroexpand_check.invokeStatic(alpha.clj:712)
	at clojure.spec.alpha$macroexpand_check.invoke(alpha.clj:704)
	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:6974)
	... 81 more
Execution error (IllegalArgumentException) at codox.main/ns-matches? (main.clj:73).
no conversion to symbol

You can find deps.cljc here - it could be the non-standard reader conditionals that are causing this.

To reproduce this issue locally check out the Sitefox repo and then run npm run docs (which runs ( echo '# Readme'; cat README.md ) > codox-readme.md && clojure -X:codox if you don't have npm installed).

@chr15m
Copy link
Author

chr15m commented Apr 14, 2022

@weavejester I managed to work around this by removing the offending deps.cljc and replacing it with a simple stub like (ns sitefox.deps).

chr15m added a commit to chr15m/sitefox that referenced this issue Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant