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

protocol fns with dashes may get compiled into property access when used higher order

Description

Problem: Protocol functions with leading hyphens may be incorrectly compiled into field accesses.

Demonstration:

1 2 3 4 5 6 7 (defprotocol Foo (-foo [x])) (deftype Bar [] Foo (-foo [_] "foo")) (map -foo (repeatedly 3 ->Bar)) ;; IllegalArgumentException No matching field found: foo for class user.Bar ;; clojure.lang.Reflector.getInstanceField (Reflector.java:271)

Cause: This was caused by CLJ-872, dash property support.

Solution: Emit forms like (. foo (bar)) instead of (. foo bar), so that names starting with a - don't look like field accesses.

Patch: CLJ-1202.patch

Environment

None

Status

Assignee

Unassigned

Reporter

David Nolen

Labels

None

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.5

Priority

Major