Affects Version/s: Release 1.2
Fix Version/s: Approved Backlog
If you call a protocol function but pass the wrong arity (forget an argument for example), you currently a message that says "No single method ... of interface ... found for function ... of protocol ...". The code in question is getting matching methods from the Reflector and creates this message if the number of matches != 1.
There are really two cases there:
- matches == 0 - this happens frequently due to typos
- matches > 1 - this presumably happens infrequently
I propose that the == 0 case instead should have slightly different text at the beginning and a hint as to the intended arity within it:
"No method: ... of interface ... with arity ... found for function ... of protocol ...".
The >1 case should have similar changes: "Multiple methods: ... of interface ... with arity ... found for function ... of protocol ...".
Patch is attached. I used case which presumably should have better performance than a nested if/else. I was not sure whether the reported arity should match the actual Java method arity or Clojure protocol function arity (including the target). I did the former.
I did not add a test as I wasn't sure whether checking error messages in tests was appropriate or not. Happy to add that if requested.