<< Back to previous view

[CLJ-1173] One-arg protocol functions whose name begins in a dash generates a call to a wrong field in the emitted code Created: 01/Mar/13  Updated: 17/May/13  Resolved: 17/May/13

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.4
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Meikel Brandmeyer Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Clojure 1.4



 Description   
(defprotocol P (-foo [this]))

This code generates a reflective call to a non-existing foo field instead of the correct -foo method.

I was told by Christophe Grand that changing the line 557 in core_deftype.clj from:

(. ~(with-meta target {:tag on-interface}) ~(or on-method method) ~@(rest gargs))

to

(. ~(with-meta target {:tag on-interface}) (~(or on-method method) ~@(rest gargs)))

is a quick fix. However I don't know too much about the compilation specifics of . to judge whether this is the correct fix.

Issue reproduction:

Clojure
user=> (set! *warn-on-reflection* true)
true
user=> (defprotocol P (-foo [this]))
P
Reflection warning, REPL:4 - reference to field foo can't be resolved.


 Comments   
Comment by Gabriel Horner [ 17/May/13 1:36 PM ]

CLJ-1202 addresses this exact issue with the same fix and includes tests

Generated at Thu Apr 24 22:07:33 CDT 2014 using JIRA 4.4#649-r158309.