merlin
merlin copied to clipboard
Occurrences of `None` returns invalid matches from default parameter
Consider the file:
(* test case *)
let f ?(x=1) () = 2 ;;
None
Occurrences on the location of None
returns a match at that same position as well as one at an invalid position (line 0, column -1). It appears to be linked to the default argument somehow.
Of course we can filter out matches at invalid positions, either in merlin proper or in whatever code making use of the output (like the Emacs lisp code), but it would be better to to generate them in the first place. Maybe there are more such cases that become apparent if the source of them is found.
Thank you for the report! I added a test illustrating the issue. A major rework of that feature is planned in a not-so-distant future...
Thanks – I added a simple filter to the Emacs Xref PR (#1385) for the time being.
I presume you were thinking about making Occurrence project-wide? That would be really nice to have.
Yes, that is part of the plan :-)