-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: Support for record structs #7605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c17bd29
C#: Rename C# code file and update test.
michaelnebel dc76775
C#: Consider 'record' a type modifier in the extractor (it can be app…
michaelnebel 55cb2aa
C#: Use modifier to decide, if a type is a record like type and imple…
michaelnebel 9770f09
C#: Deprecate Record and introduce RecordClass instead. Also make fl…
michaelnebel 746fd60
C#: Add flow summary test for record struct constructors.
michaelnebel 6c1bb4a
C#: Add test case for record class and record structs.
michaelnebel b927aad
C#: Address review comments related to record structs.
michaelnebel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
csharp/ql/test/library-tests/csharp10/RecordTypeSealedToString.cs
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
public record MyEntry(string Name, string Address) | ||
{ | ||
sealed public override string ToString() => $"{Name} lives at {Address}"; | ||
}; | ||
|
||
public record class MyClassRecord(DateTime stuff) { } | ||
|
||
public readonly record struct MyReadonlyRecordStruct(string Stuff) { } | ||
|
||
public record struct MyRecordStruct(int Stuff) { } |
2 changes: 1 addition & 1 deletion
2
csharp/ql/test/library-tests/csharp10/recordTypeSealedToString.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
| RecordTypeSealedToString.cs:5:35:5:42 | ToString | | ||
| RecordTypes.cs:5:35:5:42 | ToString | |
11 changes: 11 additions & 0 deletions
11
csharp/ql/test/library-tests/csharp10/recordTypes.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
recordTypes | ||
| RecordTypes.cs:3:1:6:2 | MyEntry | | ||
| RecordTypes.cs:8:1:8:53 | MyClassRecord | | ||
| RecordTypes.cs:10:1:10:70 | MyReadonlyRecordStruct | | ||
| RecordTypes.cs:12:1:12:50 | MyRecordStruct | | ||
recordStructs | ||
| RecordTypes.cs:10:1:10:70 | MyReadonlyRecordStruct | | ||
| RecordTypes.cs:12:1:12:50 | MyRecordStruct | | ||
recordClass | ||
| RecordTypes.cs:3:1:6:2 | MyEntry | | ||
| RecordTypes.cs:8:1:8:53 | MyClassRecord | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import csharp | ||
|
||
query predicate recordTypes(RecordType rt) { any() } | ||
|
||
query predicate recordStructs(RecordStruct rs) { any() } | ||
|
||
query predicate recordClass(RecordClass r) { any() } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.