Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

While implementing some demunging code(link: 1) for cljs-devtools, I stumbled upon inconsistency in type->str. It works for deftypes but not for defrecords.

The problem is that defrecord does not set! cljs$lang$ctorStr field for some reason. This has been likely overlooked, because type->str is not used often, just for some rare error exceptions as far I can see.

Anyways, this patch fixes it by copy&pasting it from deftype. A better solution to avoid future problems like this would be to extract shared code between deftypes and defrecords, but that seems to be a lot of work.

The patch also adds some tests. I had to add some utility macros to run those tests only in simple mode, because type->str is not supposed to work under advanced builds.
Also test for CLJS-1722 was added to be uncommented after potentially merging it.

(link: 1) https://github.com/binaryage/cljs-devtools/blob/52899e61e33373df36be8dcb23c69377936821b2/src/lib/devtools/munging.cljs#L56-L60

2 Answers

0 votes
by

Comment made by: mfikes

Patch no longer applies; needs re-baseline.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-1725 (reported by darwin)
...