GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — Adjusted MsgPack004 to support records by N-Olbert · Pull Request #1946 · MessagePack-CSharp/MessagePack-CSharp Conversation
|
|
@AArnott, have there been any changes or decisions regarding records with primary constructors? The second merged test flags a MsgPack007 for the record that has what I believe is a valid primary constructor. Is this intended behavior or a bug? I annotated this in the source. I will proceed based on your response. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| string input = Preamble + /* lang=c#-test */ @" | ||
| [MessagePackObject] | ||
| public record {|MsgPack007:Foo|}( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@AArnott : Here
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think this is a false-positive for records (but a correct one for normal classes, since the semantics of a „class“- primary ctor are different)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I like the test as you have it here. Primary constructors for records convert parameters to properties and thus should be serialized. Primary constructors on classes do not convert their parameters to properties and thus should not be serialized. That appears to be what you're asserting here, and all the tests pass, so I'm satisfied. Thank you.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I merged the contents of the original PR. However, I believe that MsgPack007 is incorrect for records (but not for classes). If that’s the case, I can provide a fix in another PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| string input = Preamble + /* lang=c#-test */ @" | ||
| [MessagePackObject] | ||
| public record {|MsgPack007:Foo|}( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I like the test as you have it here. Primary constructors for records convert parameters to properties and thus should be serialized. Primary constructors on classes do not convert their parameters to properties and thus should not be serialized. That appears to be what you're asserting here, and all the tests pass, so I'm satisfied. Thank you.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This merge adds no content because the change in question was already brought in by #1946.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.