diff --git a/src/dev/onionpancakes/chassis/compiler.clj b/src/dev/onionpancakes/chassis/compiler.clj index 68c0a3a..7442bc9 100644 --- a/src/dev/onionpancakes/chassis/compiler.clj +++ b/src/dev/onionpancakes/chassis/compiler.clj @@ -111,9 +111,11 @@ #'clojure.core/update-vals}) (defn attrs-invocation? - [[sym & _]] - (and (symbol? sym) - (contains? attrs-invocable-vars (resolve sym)))) + [[sym & _ :as this]] + (and (seq? this) + (symbol? sym) + (bound? #'*env*) + (contains? attrs-invocable-vars (resolve *env* sym)))) (defn attrs-type? [clazz] diff --git a/test/dev/onionpancakes/chassis/tests/test_compiler.clj b/test/dev/onionpancakes/chassis/tests/test_compiler.clj index a14ccae..6057c16 100644 --- a/test/dev/onionpancakes/chassis/tests/test_compiler.clj +++ b/test/dev/onionpancakes/chassis/tests/test_compiler.clj @@ -212,6 +212,14 @@ (doseq [[elem warning] @ambig-attrs-warnings] (is false (str "Ambig attrs with elem: " elem)))) +(deftest test-compile-shadow-attrs-core-fns + (let [assoc (fn [& _] "assoc-shadowed") + merge (fn [& _] "merge-shadowed")] + (is (= (c/html (cc/compile [:div (assoc {} :foo :bar)])) + "
assoc-shadowed
")) + (is (= (c/html (cc/compile [:div (merge {} {:foo :bar})])) + "
merge-shadowed
")))) + ;; Alias (defmethod c/resolve-alias ::TestAliasContent