(type record) returns its class-name string, not a symbol
(type r) returned a symbol user.TyR, so (= (symbol (str (type r))) (type r)) was true; the JVM's type is a Class (not a Symbol) so it's false. jolt models classes as strings, so a record's type is now its ns-qualified class-name string — equal to (class r), as on the JVM where type and class coincide for a record. The symbol-keyed print-method defmethods already fall through to the default record printing, so they're unaffected. Closes type-of-record.
This commit is contained in:
parent
ab96650fbb
commit
0e4ccc97e0
3 changed files with 9 additions and 8 deletions
|
|
@ -395,8 +395,8 @@
|
|||
{:suite "type" :expr "(type (with-meta {:a 1} {:type :rec}))" :expected ":rec"}
|
||||
{:suite "type" :expr "(type (with-meta [1] {:other 9}))" :expected ":vector"}
|
||||
{:suite "type" :expr "(do (defrecord TyR [a]) (type (->TyR 1)))" :expected "user.TyR"}
|
||||
{:suite "type" :expr "(do (defrecord TyR [a]) (= (symbol (str (type (->TyR 1)))) (type (->TyR 1))))" :expected "true"}
|
||||
{:suite "type" :expr "(do (defrecord TyR [a]) (symbol? (type (->TyR 1))))" :expected "true"}
|
||||
{:suite "type" :expr "(do (defrecord TyR [a]) (= (symbol (str (type (->TyR 1)))) (type (->TyR 1))))" :expected "false"}
|
||||
{:suite "type" :expr "(do (defrecord TyR [a]) (symbol? (type (->TyR 1))))" :expected "false"}
|
||||
{:suite "type" :expr "(type (atom 1))" :expected ":jolt/atom"}
|
||||
{:suite "type" :expr "(type (volatile! 1))" :expected ":jolt/volatile"}
|
||||
{:suite "type" :expr "(type #\"re\")" :expected ":jolt/regex"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue