Tensegritics / Tensegritics/ClojureDart

Invalid token error with qualified keywords

Open
#131 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
1.6k
Forks
119
PR merge metrics
No merged PRs in 30d

Description

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]}]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked repro and the failure reported at example/macros.clj:7:41, then trace the host-compiling path mentioned at compiler.cljc:2905. Done means the reproduction compiles successfully when using qualified keywords such as ::spec/example, including on a fresh startup.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.