-
Notifications
You must be signed in to change notification settings - Fork 158
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
Use BinaryPrimitives #366
Use BinaryPrimitives #366
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I wonder if we could reformat one pattern around collection expressions. Can merge once we resolve that question.
I'm spanifying the reader classes at the moment so please hold off on touching those in any significant way.
Thanks for the great PRs. They add clear value and are the perfect size for quick review.
@@ -49,8 +49,8 @@ public void UnderlyingInt() | |||
Assert.Equal(value.ToString(), _directory.GetString(tagType)); | |||
Assert.True(_directory.TryGetRational(tagType, out Rational rational)); | |||
Assert.Equal(new Rational(value, 1), rational); | |||
Assert.Equal([value], _directory.GetInt32Array(tagType)); | |||
Assert.Equal(new[] { unchecked((byte)value) }, _directory.GetByteArray(tagType)); | |||
Assert.Equal((int[])[value], _directory.GetInt32Array(tagType)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious. Did Visual Studio recommend the original conversation to a collection literal? If so I'll file a big against the analyser for suggesting code that changes semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on my phone so haven't investigated, but can we write this instead:
Assert.Equal<int>([1, 2], foo);
If not then maybe the original form would be more common.
new int[] { 1, 2 }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious. Did Visual Studio recommend the original conversation to a collection literal? If so I'll file a big against the analyser for suggesting code that changes semantics.
Yep, it was recommended by VS. I agree that we should update the analyzer rules here.
--
I'll update this call to use the original explicit form. This is the one call site that became ambiguous with the new collection expression target typing + xunit update (adding support for readonly span overloads on certain, but not all frameworks), that caused an ambiguous method call.
Ready for review.