ClojureDart
ClojureDart copied to clipboard
Invalid token error with qualified keywords
i'm writing a macro that uses spec to parse input. qualified keywords are causing cljd to compilation to fail.
few things i've noticed
- if i comment out the code, run watch, and then added gradually sometimes it compiles 🤷
- but if code is there on fresh startup, then it errors out predictably
reproduction: https://github.com/aleedmanath/repro-cljd-macros-err note: this reproduction can also be used to test out issue #129
exception that is shown:
error {
:cause Invalid token: ::spec/example
:via
[{:type clojure.lang.ExceptionInfo
:message Error while host-compiling (ns example.main (:require [example.macros-shim :as m]) (:host-ns (:require [example.macros :as m])))
:data #:cljd.compiler{:emit-stack [(ns example.main (:require [example.macros-shim :as m]) (:host-ns (:require [example.macros :as m])))]}
:at [cljd.compiler$host_eval invokeStatic compiler.cljc 2905]}
{:type clojure.lang.Compiler$CompilerException
:message Syntax error reading source at (example/macros.clj:7:41).
:data #:clojure.error{:phase :read-source, :line 7, :column 41, :source example/macros.clj}
:at [clojure.lang.Compiler load Compiler.java 7643]}
{:type java.lang.RuntimeException
:message Invalid token: ::spec/example
:at [clojure.lang.Util runtimeException Util.java 221]}]
Thanks for the report ! I’ll take a look on Friday, (maybe tomorrow if I find some time)
more info: :ns/key
seems to work, so issue seems to be qualified namespaces, i.e. ::ns/key
(notice the double ::
)
I took a look and confirm the error, before diving into the compiler, @cgrand do you have anything that comes to mind ?
Getting back to this