Skip to content

search: compute TextPatternInfo after results types, not vice versa

Administrator requested to merge backend-integration/rvt/rts-4 into main

Created by: rvantonder

Stacked on https://github.com/sourcegraph/sourcegraph/pull/32596.

This PR is really important. Before, what we did was:

  • Compute pattern info (the thing that internally tracks the pattern value for atomic queries, whether it's regexp, etc.)
  • Later realize we need to populate pattern info (mutate!) to also set PatternMatchesPath and PatternMatchesContent based on the result types (type:path etc.)

But computing result types, previous to this PR, depended on some of the state in pattern info (basically, the query. circular dependency. gross)

Now, after this:

  • Compute result types first from query and break dependency on pattern info
  • Compute pattern info, this time without mutating it, in the ToTextPatternInfo function (which is now more primed to go away).

The PR is a bit busy but this code is tested to heck, so review with confidence.

Test plan

Semantics-preserving.

Merge request reports

Loading