We're updating the issue view to help you get more done. 

Sequential destructuring of map gives confusing error message

Description

The following broken code:

1 (let [[x y] {}] x)

provides the following stack trace:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Exception in thread "main" java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap (test.clj:0) at clojure.lang.Compiler.eval(Compiler.java:4543) at clojure.lang.Compiler.load(Compiler.java:4857) at clojure.lang.Compiler.loadFile(Compiler.java:4824) at clojure.main$load_script__5833.invoke(main.clj:206) at clojure.main$script_opt__5864.invoke(main.clj:258) at clojure.main$main__5888.doInvoke(main.clj:333) at clojure.lang.RestFn.invoke(RestFn.java:413) at clojure.lang.Var.invoke(Var.java:346) at clojure.lang.AFn.applyToHelper(AFn.java:173) at clojure.lang.Var.applyTo(Var.java:463) at clojure.main.main(main.java:39) Caused by: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap at clojure.lang.RT.nth(RT.java:800) at clojure.core$nth__3578.invoke(core.clj:873) at user$eval__1.invoke(test.clj:1) at clojure.lang.Compiler.eval(Compiler.java:4532) ... 10 more

The message "nth not supported on this type" while correct doesn't make the cause of the error very clear. Better error messages when destructuring would be very helpful.

Environment

None

Status

Assignee

Unassigned

Reporter

import

Approval

Triaged

Patch

Code and Test

Priority

Minor