-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow Bytes[]
to construct an empty Bytes
#11897
Allow Bytes[]
to construct an empty Bytes
#11897
Conversation
Will it be consistent with the language? Of course all of this could be fixed in other PRs. |
For that matter, |
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.
Thanks! I think this is fine but I feel Bytes.empty
is clearer 🤷
I'd say |
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.
TIL: ArrayLiteral#splat
🤟
That's actually a limitation of the language. Actually, not for this particular call signature - it would be trivial to implement: |
It appears there are quite a lot of uses for |
It seems I added that method. The reason was:
But now with |
|
Bytes[]
in normal code fails to compile:But
Bytes
fully specifies the type of the constructed object, so allowingBytes[]
should not be problematic. This is similar to #10192 and also related to #11879 becauseinspect
ing an emptyBytes
producesBytes[]
.Slice[]
is still disallowed because the element type could not be inferred (it is technicallyNoReturn
, which is not very useful either).