Adds unit tests for syntactic usages#63900
Conversation
b31dbbd to
43dbc8d
Compare
There was a problem hiding this comment.
I bet it felt exhilirating to use global mutable state :D
There was a problem hiding this comment.
I've read the ancient scrolls (and so has Claude apparently):
What are the oldest references to the gensym function
A\ The concept of "gensym" (short for "generate symbol") has been around in programming for quite a long time, particularly in the Lisp family of languages. Here are some of the oldest known references to gensym:
- Lisp 1.5 (1962): While not called "gensym" explicitly, the concept of generating unique symbols was present in the original Lisp 1.5 manual by John McCarthy. The function was called "GENSYM" in later Lisp implementations.
- MacLisp (late 1960s): MacLisp, developed at MIT's Project MAC, included a gensym function. It was one of the earliest widely-used implementations to feature gensym.
- Interlisp (early 1970s): Interlisp, developed at Xerox PARC, also included a gensym function.
- Common Lisp (1984): The Common Lisp language specification, which aimed to standardize various Lisp dialects, included gensym as a standard function.
- Scheme (1975): While not called "gensym", Scheme (a Lisp dialect) introduced the concept of hygiene in macros, which addresses similar concerns as gensym.
- PL/I (1964): While not called "gensym", PL/l had a built-in function UNSPEC which could be used to generate unique identifiers.
The gensym function became particularly important in macro systems and symbolic computation, where generating unique symbols is crucial to avoid name conflicts. Its widespread use in Lisp dialects made it a well-known concept in the programming language community by the 1970s.
It's worth noting that while these are some of the earliest references, the exact origin of the term "gensym" is somewhat obscure, and it may have been in use informally before appearing in official documentation or implementations.
There was a problem hiding this comment.
there's a require.NoErrorf which can do this
There was a problem hiding this comment.
Can you explain/add a comment about what exactly is being etsted here? I don't think I understand by reading the assertions and the test name
There was a problem hiding this comment.
What's being tested here, is that when search returns two matches, and we have a syntactic occurrence overlapping with one of them, then search-based usages will only return the one non-overlapping match.
There's some confusing naming here, I should call the refRange something like comment or search range.
Definitely need to be clearer here, thanks!
keynmol
left a comment
There was a problem hiding this comment.
I was able to follow all the test cases 👍
e99e409 to
14a7e04
Compare
Closes https://linear.app/sourcegraph/issue/GRAPH-735/test-syntactic-usages
Uses the new MappedIndex abstraction from #63781 to implement some proper unit tests for
syntacticUsagesImpl.Test plan
PR adds a bunch of tests