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

Namespace map syntax prevents duplicate key check

Description

1 2 user> #::{:a 1 :a 2} #:user{:a 2}

Cause: In the namespace map reader, a map is built by repeated assoc rather than via createWithCheck. Thus, assoc of same key replaces prior key rather than throwing an error.

Approach: Build an array and invoke RT.map(a), to echo same code path without namespace map literal syntax.

After:

1 2 user=> #::{:a 1 :a 2} IllegalArgumentException Duplicate key: :user/a clojure.lang.PersistentArrayMap.createWithCheck (PersistentArrayMap.java:71)

Patch: clj-2142-3.patch

Environment

None

Status

Assignee

Unassigned

Reporter

import

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.9

Priority

Major