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.
feat[codegen]: changed the convert from bytes #5020
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
base: master
Are you sure you want to change the base?
feat[codegen]: changed the convert from bytes #5020
Changes from all commits
6502c1c0afb59e111b1f21cdc683b4c04d3af57b240ef9d80475525124a4a8ebea1841e9021031ab91c3f9814dd4c94532d7f001dadcff64f1fd92b273673b7d7da6aa18e6184d7d5bbb72d8bba8043e91c06eb828c3d81d74e3fd1ce1906File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Check notice
Code scanning / CodeQL
Cyclic import Note
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.
When is
arg.typdifferent fromin_typ?If the answer is "sometimes", this feels like something which should be fixed in the typer
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.
It should be only in the case the constant.
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.
In this example, what are the arg.typ and in_typ ?
Uh oh!
There was an error while loading. Please reload this page.
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.
arg.typwould beBytes[1]and andin_typwould beBytes[2], since the argument is reduced to theb'\xff'at the start.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.
https://github.com/vyperlang/vyper/pull/5020/changes#diff-4efb65bec529eac2b88ea939ea97f7a333a051988d8bf25d0352fb8fb3cc1f6dL471 here is that reduce
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 think it would be better to have
arg.typbeBytes[2], which makes sense since the arg isFOOand its type isBytes[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.
That would be some where in the typechecker I think. Do you think it should be done like that? Since there was discussion on what semantics the convert should have. Or maybe I could reduce it later in convert
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.
Note that your implementation also assumes a specific semantics !
I'm not sure what the semantics of
convertshould be, but I am 100% sure the following should be equivalent:Both
FOOs should have typeBytes[2]even if their expression has a stricter type.So we should fix this where appropriate, probably in the typer, since this is not related only to conversions.
(Conversions might be the only place for now where it produces an observable difference however)
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.
Wait, what I said is wrong, I am 100% sure the following should be equivalent:
Both FOOs should have type Bytes[2].
But in my previous example, both should still have type
Bytes[2]Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.