Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: 1.10.238
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:ClojureScript 1.10.126
Description
I encountered this problem when trying the pre-release 1.10.126 against a production codebase.
If you do `(:refer-clojure :exclude [MapEntry])` in your namespace declaration and define a record, the record's `seq` implementation is broken. Consider the following code:
(ns cljs.defrecord-test (:refer-clojure :exclude [MapEntry]) (:require [cljs.test :refer-macros [deftest is]])) (defrecord Foo [a]) (deftest foo-test (= '([:a "test"]) (seq (Foo. "test"))))
You'll get the following compiler warnings:
WARNING: Use of undeclared Var cljs.defrecord-test/MapEntry at line 5 /Users/miikka/code/clojurescript/src/test/cljs/cljs/defrecord_test.cljs WARNING: Use of undeclared Var cljs.defrecord-test/MapEntry at line 5 /Users/miikka/code/clojurescript/src/test/cljs/cljs/defrecord_test.cljs
The test fails:
Testing cljs.defrecord-test ERROR in (foo-test) (TypeError:NaN:NaN) Uncaught exception, not in assertion. expected: nil actual: #object[TypeError TypeError: kRa.Rh is not a constructor]
If you run the same test without the exclusion, the test passes as expected. In practice this bug prevents the prismatic/schema library from working with the upcoming ClojureScript release.
Here's a suggested fix and a test. I've also verified that it fixes the prismatic/schema problem in practice.