Skip to content

Qualified symbols from macro expansion use wrong namespaces with aliases #783

@willcohen

Description

@willcohen

version

HEAD

problem

Syntax-quoted symbols in macros expand to namespace/symbol, but that doesn't line up with the runtime aliases, and there also appears to be some kind of mismatch between helper functions and macros.

repro

mkdir squint-macro-bug && cd squint-macro-bug

cat > macros.cljc << 'EOF'
(ns macros)

(defn add-100 [x] (+ x 100))

(defmacro with-add-100 [x]
  `(add-100 ~x))
EOF

cat > main.cljs << 'EOF'
(ns main
  (:require-macros [macros :refer [with-add-100]])
  (:require [macros :as mac]))

(println (with-add-100 42))
EOF

cat > squint.edn << 'EOF'
{:paths ["."]}
EOF

npx squint compile
node main.mjs

expected behavior

Expected: 142
Actual: (macros/add-100 42)100

PR forthcoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions