feat: Recover from commutative merging failures #568

Merged
wetneb merged 2 commits from commutative_merging_recovery into main 2025-09-03 10:16:16 +02:00

View file

@ -0,0 +1,11 @@
class MyClass {
public:
int field_1;
<<<<<<< LEFT
private:
size_t field_2;
||||||| BASE
=======
char field_3;
>>>>>>> RIGHT
}

View file

@ -0,0 +1,11 @@
my_struct_t instance = {
<<<<<<< LEFT
"hello",
"merhaba",
||||||| BASE
"hello"
=======
"hello",
"salut",
>>>>>>> RIGHT
};

View file

@ -28,7 +28,7 @@ public partial class MyClass : IMyInterface
/// </summary>
[MyCustomAttribute]
public string? MyProp { get; set; }
>>>>>>> RIGHT
private record MyPrivateRecord(bool Foo);
}

View file

@ -9,8 +9,8 @@ class App {
||||||| BASE
=======
public function baz(string $param) {}
>>>>>>> RIGHT
public function bar() {}
}
?>

View file

@ -258,15 +258,14 @@ impl<'a, 'b> TreeBuilder<'a, 'b> {
if let PCSNode::Node { node: leader, .. } = node
&& let Some(commutative_parent) = leader.commutative_parent_definition()
{
// knowing that the order of all elements of the conflict does not matter, solve the conflict
let solved_conflict = self.commutatively_merge_lists(
&& let Ok(solved_conflict) = self.commutatively_merge_lists(
&base,
&left,
&right,
commutative_parent,
visiting_state,
)?;
)
{
children.extend(solved_conflict);
} else {
children.extend(MergedTree::new_conflict(