Produce errors when records are initialized incorrectly

Description

There are a couple of wrong ways you can use a record initializer that don't produce errors in ClojureScript, just nils:

1 2 3 4 5 6 7 8 ClojureScript:cljs.user> (defrecord Thing [foo bar]) cljs.user/Thing ClojureScript:cljs.user> (Thing. 1 2) ; correct usage #cljs.user.Thing{:foo 1, :bar 2} ClojureScript:cljs.user> (Thing. 1) ; wrong number of fields #cljs.user.Thing{:foo 1, :bar nil} ClojureScript:cljs.user> (Thing 1 2) ; forgetting the dot nil

Compare Clojure:

1 2 3 4 5 6 7 8 9 10 user=> (defrecord Thing [foo bar]) user.Thing user=> (Thing. 1 2) #user.Thing{:foo 1, :bar 2} user=> (Thing. 1) CompilerException java.lang.IllegalArgumentException: No matching ctor found for class user.Thing, compiling:(/tmp/form-init7089728177345913731.clj:1:1) user=> (Thing 1 2) RuntimeException Expecting var, but Thing is mapped to class user.Thing clojure.lang.Util.runtimeException (Util.java:219)

It would make debugging easier if ClojureScript followed Clojure's example here and gave a useful error immediately in case of the last 2 examples.

Environment

None

Status

Assignee

Unassigned

Reporter

import

Labels

Approval

None

Patch

None

Priority

Minor
Configure