Skip to main content

Module patterns

Module patterns 

Source
Expand description

Pattern-based DSL resolution rules.

Implements a domain-specific language for common merge conflict resolution patterns, inspired by the program synthesis approach from Svyatkovskiy et al. (ICSE 2021) which found that ~28% of merge conflicts follow repetitive patterns and ~41% of 1-2 line changes can be resolved by a DSL.

Instead of learning patterns via synthesis, we encode the most common resolution patterns as declarative rules. Each rule has:

  • A predicate that checks if the conflict matches the pattern
  • A transform that produces the resolution

Common patterns from the literature:

  1. Both sides add imports/includes → keep both (union)
  2. Both sides modify the same value → prefer longer/more specific
  3. One side adds, other modifies → combine additions
  4. Adjacent-line edits (false conflict) → concatenate
  5. Whitespace/formatting only differences → pick either
  6. Both sides add to a list → interleave or concatenate
  7. Identical deletions → accept deletion

Structs§

PatternRegistry
Registry of all pattern rules.

Traits§

PatternRule
A pattern rule that can match and resolve a conflict.