fix: Restrict commutativity in C# #375
7 changed files with 161 additions and 1 deletions
20
examples/csharp/failing/methods_with_comments/Base.cs
Normal file
20
examples/csharp/failing/methods_with_comments/Base.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright header
|
||||
|
||||
using System;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public partial class MyClass : IMyInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Ctor docs
|
||||
/// </summary>
|
||||
/// <param name="ctorArg">Param docs</param>
|
||||
public MyClass(IThing1 thing1, IThing2 thing2)
|
||||
{
|
||||
_thing1 = thing1;
|
||||
_thing2 = thing2;
|
||||
}
|
||||
|
||||
private record MyPrivateRecord(bool Foo);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright header
|
||||
|
||||
using System;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public partial class MyClass : IMyInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Ctor docs
|
||||
/// </summary>
|
||||
/// <param name="ctorArg">Param docs</param>
|
||||
public MyClass(IThing1 thing1, IThing2 thing2)
|
||||
{
|
||||
_thing1 = thing1;
|
||||
_thing2 = thing2;
|
||||
}
|
||||
|
||||
<<<<<<< LEFT
|
||||
/// <summary>
|
||||
/// Record docs
|
||||
/// </summary>
|
||||
/// <param name="Foo">Bool arg docs</param>
|
||||
||||||| BASE
|
||||
=======
|
||||
/// <summary>
|
||||
/// Prop docs
|
||||
/// </summary>
|
||||
[MyCustomAttribute]
|
||||
public string? MyProp { get; set; }
|
||||
|
||||
>>>>>>> RIGHT
|
||||
private record MyPrivateRecord(bool Foo);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright header
|
||||
|
||||
using System;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public partial class MyClass : IMyInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Ctor docs
|
||||
/// </summary>
|
||||
/// <param name="ctorArg">Param docs</param>
|
||||
public MyClass(IThing1 thing1, IThing2 thing2)
|
||||
{
|
||||
_thing1 = thing1;
|
||||
_thing2 = thing2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prop docs
|
||||
/// </summary>
|
||||
[MyCustomAttribute]
|
||||
public string? MyProp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Record docs
|
||||
/// </summary>
|
||||
/// <param name="Foo">Bool arg docs</param>
|
||||
private record MyPrivateRecord(bool Foo);
|
||||
}
|
24
examples/csharp/failing/methods_with_comments/Left.cs
Normal file
24
examples/csharp/failing/methods_with_comments/Left.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright header
|
||||
|
||||
using System;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public partial class MyClass : IMyInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Ctor docs
|
||||
/// </summary>
|
||||
/// <param name="ctorArg">Param docs</param>
|
||||
public MyClass(IThing1 thing1, IThing2 thing2)
|
||||
{
|
||||
_thing1 = thing1;
|
||||
_thing2 = thing2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Record docs
|
||||
/// </summary>
|
||||
/// <param name="Foo">Bool arg docs</param>
|
||||
private record MyPrivateRecord(bool Foo);
|
||||
}
|
3
examples/csharp/failing/methods_with_comments/README
Normal file
3
examples/csharp/failing/methods_with_comments/README
Normal file
|
@ -0,0 +1,3 @@
|
|||
Commutativity is restricted because comments are involved.
|
||||
See https://codeberg.org/mergiraf/mergiraf/issues/224,
|
||||
https://codeberg.org/mergiraf/mergiraf/issues/322.
|
26
examples/csharp/failing/methods_with_comments/Right.cs
Normal file
26
examples/csharp/failing/methods_with_comments/Right.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright header
|
||||
|
||||
using System;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public partial class MyClass : IMyInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Ctor docs
|
||||
/// </summary>
|
||||
/// <param name="ctorArg">Param docs</param>
|
||||
public MyClass(IThing1 thing1, IThing2 thing2)
|
||||
{
|
||||
_thing1 = thing1;
|
||||
_thing2 = thing2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prop docs
|
||||
/// </summary>
|
||||
[MyCustomAttribute]
|
||||
public string? MyProp { get; set; }
|
||||
|
||||
private record MyPrivateRecord(bool Foo);
|
||||
}
|
|
@ -473,7 +473,30 @@ pub static SUPPORTED_LANGUAGES: LazyLock<Vec<LangProfile>> = LazyLock::new(|| {
|
|||
atomic_nodes: vec![],
|
||||
commutative_parents: vec![
|
||||
CommutativeParent::without_delimiters("compilation_unit", "\n"),
|
||||
CommutativeParent::new("declaration_list", "{", "\n", "}"),
|
||||
CommutativeParent::new("declaration_list", "{", "\n", "}").restricted_to_groups(&[
|
||||
&["using_directive"],
|
||||
&[
|
||||
"field_declaration",
|
||||
"property_declaration",
|
||||
"event_declaration",
|
||||
"event_field_declaration",
|
||||
],
|
||||
&[
|
||||
"class_declaration",
|
||||
"struct_declaration",
|
||||
"enum_declaration",
|
||||
"delegate_declaration",
|
||||
"method_declaration",
|
||||
"record_declaration",
|
||||
"constructor_declaration",
|
||||
"destructor_declaration",
|
||||
"indexer_declaration",
|
||||
"interface_declaration",
|
||||
"namespace_declaration",
|
||||
"operator_declaration",
|
||||
"conversion_operator_declaration",
|
||||
],
|
||||
]),
|
||||
CommutativeParent::new("enum_member_declaration_list", "{", ",\n", "}"),
|
||||
],
|
||||
signatures: vec![
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue