threads / patch / 55240

patchAdd support for C# record types

Subject: [PATCH] Add support for C# record types

## tl;dr

2 messages between Mar 2, 2021 and Jun 15, 2021. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Julian Verdurmen via GitGitGadget· Mar 2, 2021, 00:58 UTC · lore
From: Julian Verdurmen <julian.verdurmen@outlook.com>
Records are added in C# 9
Code example :
    public record Person(string FirstName, string LastName);
For more information, see:
* https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9
Signed-off-by: Julian Verdurmen <julian.verdurmen@outlook.com>
---
    userdiff.c: Added support for record types in C#
    
    Support for C# 9 records. See
    https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/exploration/records
    
    I will try to use gitgitgadget [https://gitgitgadget.github.io/]
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-971%2F304NotModified%2Fcsharp-record-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-971/304NotModified/csharp-record-v1
Pull-Request: https://github.com/git/git/pull/971
 userdiff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to userdiff.c +1 −1
diff --git a/userdiff.c b/userdiff.c
index 3f81a2261c5e..2803683c3117 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -212,7 +212,7 @@ PATTERNS("csharp",
 	 /* Properties */
 	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
 	 /* Type definitions */
-	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
+	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct|record)[ \t]+.*)$\n"
 	 /* Namespace */
 	 "^[ \t]*(namespace[ \t]+.*)$",
 	 /* -- */

base-commit: 328c10930387d301560f7cbcd3351cc485a13381
-- 
gitgitgadget
Johannes Schindelin· Jun 15, 2021, 21:04 UTC · re: Julian Verdurmen via GitGitGadget · lore

Re: [PATCH] Add support for C# record types

Hi Julian,
On Tue, 2 Mar 2021, Julian Verdurmen via GitGitGadget wrote:
Show 12 quoted lines
> From: Julian Verdurmen <julian.verdurmen@outlook.com>
>
> Records are added in C# 9
>
> Code example :
>
>     public record Person(string FirstName, string LastName);
>
> For more information, see:
> * https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9
>
> Signed-off-by: Julian Verdurmen <julian.verdurmen@outlook.com>

I am not precisely a C# _expert_, but from what I understand this patch and commit message look good to me.

Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Thanks, Dscho

Show 34 quoted lines
> ---
>     userdiff.c: Added support for record types in C#
>
>     Support for C# 9 records. See
>     https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/exploration/records
>
>     I will try to use gitgitgadget [https://gitgitgadget.github.io/]
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-971%2F304NotModified%2Fcsharp-record-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-971/304NotModified/csharp-record-v1
> Pull-Request: https://github.com/git/git/pull/971
>
>  userdiff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/userdiff.c b/userdiff.c
> index 3f81a2261c5e..2803683c3117 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -212,7 +212,7 @@ PATTERNS("csharp",
>  	 /* Properties */
>  	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>  	 /* Type definitions */
> -	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
> +	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct|record)[ \t]+.*)$\n"
>  	 /* Namespace */
>  	 "^[ \t]*(namespace[ \t]+.*)$",
>  	 /* -- */
>
> base-commit: 328c10930387d301560f7cbcd3351cc485a13381
> --
> gitgitgadget
>
>

← back to recent threads