Fix [_ _] inline method field binding + Var protocol dispatch
Two gaps reitit-core surfaced (now 322/0/1 -> 327/0/0): - A deftype/defrecord inline method with two _ params, (m [_ _] field), read the field as nil: mk-clause bound fields off (get _ :field) where _ was the first param, but the second _ shadowed it. Each _ param is now renamed to a fresh symbol so the instance is unambiguous. - A var did not dispatch to a protocol's clojure.lang.Var extension (reitit extends Expand to Var for a #'handler route): value-host-tags gained a var arm (Var/clojure.lang.Var/IDeref/IFn) and host-type-set gained Var/IDeref so the extension keys under Var. deftype/defrecord is a seed source, re-minted.
This commit is contained in:
parent
9404512b97
commit
6b99591266
5 changed files with 633 additions and 621 deletions
|
|
@ -450,6 +450,9 @@
|
|||
"Map" "java.util.Map" "Iterable" "java.lang.Iterable" "Object"))
|
||||
((pset? obj) '("PersistentHashSet" "APersistentSet" "IPersistentSet" "Set" "java.util.Set" "Collection" "Iterable" "java.lang.Iterable" "Object"))
|
||||
((or (cseq? obj) (empty-list-t? obj)) '("ASeq" "ISeq" "IPersistentCollection" "Sequential" "Collection" "Iterable" "java.lang.Iterable" "Object"))
|
||||
;; a var is clojure.lang.Var (also IDeref / IFn) — reitit's Expand protocol
|
||||
;; extends to Var so a #'handler route dispatches.
|
||||
((var-cell? obj) '("Var" "clojure.lang.Var" "IDeref" "IFn" "Object"))
|
||||
;; java.net.URI jhost — extend-protocol java.net.URI (hiccup ToURI/ToStr).
|
||||
((and (jhost? obj) (string=? (jhost-tag obj) "uri")) '("URI" "java.net.URI" "Object"))
|
||||
;; a ByteBuffer — extend-protocol java.nio.ByteBuffer (aws-api util).
|
||||
|
|
@ -560,7 +563,7 @@
|
|||
'("Long" "Integer" "Number" "Double" "Ratio" "BigInt" "BigInteger"
|
||||
"String" "CharSequence" "Boolean" "Character"
|
||||
"Keyword" "Symbol" "Named" "Object" "nil"
|
||||
"Fn" "IFn" "AFn" "URI"
|
||||
"Fn" "IFn" "AFn" "URI" "Var" "IDeref"
|
||||
"PersistentVector" "APersistentVector" "IPersistentVector"
|
||||
"PersistentArrayMap" "APersistentMap" "IPersistentMap"
|
||||
"PersistentHashSet" "APersistentSet" "IPersistentSet"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue