Skip to content

Commit f17c110

Browse files
authored
Merge pull request #7562 from michaelnebel/csharp/record-seal-tostring
C#: Record types are allowed to seal ToString (test only).
2 parents da4f1d8 + 56bc3db commit f17c110

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
using System;
2+
3+
public record MyEntry(string Name, string Address)
4+
{
5+
sealed public override string ToString() => $"{Name} lives at {Address}";
6+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| RecordTypeSealedToString.cs:5:35:5:42 | ToString |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import csharp
2+
3+
query predicate sealed(Modifiable m) { m.getDeclaringType().fromSource() and m.isSealed() }

0 commit comments

Comments
 (0)