-
-
Notifications
You must be signed in to change notification settings - Fork 905
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
Open
HodanPlodky
wants to merge
27
commits into
vyperlang:master
Choose a base branch
from
HodanPlodky:feat/codegen/changed_the_convert_from_bytes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+206
−66
Open
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
6502c1c
sar -> shr
HodanPlodky 0afb59e
tests
HodanPlodky 111b1f2
Revert "sar -> shr"
HodanPlodky 1cdc683
Merge branch 'master' into feat/codegen/changed_the_convert_from_bytes
HodanPlodky b4c04d3
change for venom codegen
HodanPlodky af57b24
legacy fix
HodanPlodky 0ef9d80
added stray return from test
HodanPlodky 4755251
propagate input type in legacy
HodanPlodky 24a4a8e
small fix
HodanPlodky bea1841
full propagete
HodanPlodky e902103
literal bytes to int fix legacy
HodanPlodky 1ab91c3
lint
HodanPlodky f9814dd
more expansive test
HodanPlodky 4c94532
Merge branch 'master' into feat/codegen/changed_the_convert_from_bytes
HodanPlodky d7f001d
first widen test
HodanPlodky adcff64
legacy fix
HodanPlodky f1fd92b
venom codegen
HodanPlodky 273673b
decimal fix
HodanPlodky 7d7da6a
convert in tests
HodanPlodky a18e618
Merge branch 'master' into feat/codegen/changed_the_convert_from_bytes
HodanPlodky 4d7d5bb
used bits
HodanPlodky b72d8bb
Merge branch 'master' into feat/codegen/changed_the_convert_from_bytes
HodanPlodky a8043e9
did in for other bytes
HodanPlodky 1c06eb8
small opt for info we know at compile time
HodanPlodky 28c3d81
lint
HodanPlodky d74e3fd
venom codegen match legacy
HodanPlodky 1ce1906
lint
HodanPlodky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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]