core: defprotocol accepts docstring + keyword options (honeysql)

Clojure's defprotocol takes an optional docstring and leading keyword
options (:extend-via-metadata true) before the signatures; jolt's macro
fed the option keyword to (first sig). honeysql declares its InlineValue
protocol exactly that way — with the fix, all four honeysql namespaces
load unmodified from git and the formatter produces correct sqlvecs for
selects/inserts/updates/deletes/joins/:inline. Listed in libraries.md.
This commit is contained in:
Yogthos 2026-06-11 22:56:12 -04:00
parent b2c9970583
commit e1a6d77b0c
3 changed files with 19 additions and 1 deletions

View file

@ -48,3 +48,11 @@
"(do (deftype P [n]) (.-n (P. 5)))"]
["dot ctor + method" "5"
"(do (defprotocol G (val-of [_])) (deftype P [n] G (val-of [_] n)) (val-of (P. 5)))"])
# defprotocol accepts Clojure's optional docstring + leading keyword options
# before the signatures (honeysql: :extend-via-metadata true).
(defspec "protocols / defprotocol options"
["docstring + option + method" ":hi"
"(do (defprotocol Pdoc \"docs\" :extend-via-metadata true (greet [x])) (extend-protocol Pdoc String (greet [s] :hi)) (greet \"x\"))"]
["option only" "3"
"(do (defprotocol Popt :extend-via-metadata true (plus2 [x])) (extend-protocol Popt Long (plus2 [n] (+ n 2))) (plus2 1))"])