Fix incorrect compile_to_assembly call args#1619
Conversation
|
Would this have been caught with MyPy? |
Probably - |
|
Nice fix, thanks. While we're at it, could you please change the assertions to |
charles-cooper
left a comment
There was a problem hiding this comment.
These two asserts could be CompilerPanic
|
@charles-cooper good call 👍 see new commit |
| if withargs is None: | ||
| withargs = {} | ||
| assert isinstance(withargs, dict) | ||
| elif not isinstance(withargs, dict): |
There was a problem hiding this comment.
kind of a nitpick but to preserve the semantics I think these should be standalone if statements, not elif statements. Somebody could come in later and change the body of the previous branch to read withargs = [] and then we would no longer have the guarantee after this line that withargs is a dict.
| if existing_labels is None: | ||
| existing_labels = set() | ||
| assert isinstance(existing_labels, set) | ||
| elif not isinstance(existing_labels, set): |
e83a6e5 to
7f63da6
Compare
charles-cooper
left a comment
There was a problem hiding this comment.
LGTM, will merge once CI passes
The Issue
As discovered by @michwill and reported on Gitter, the following code was not compiling due to an assertion error:
The issue was in
vyper/compile_lll.py- several calls tocompile_to_assemblywere not including theexisting_labelsargument:https://github.com/ethereum/vyper/blob/089d0c4046a5e71412b46205788a89e76d7646ea/vyper/compile_lll.py#L273-L275
What I did
Added
existing_labelsas an argument incompile_to_assemblycalls where it was missing.How to verify it
See the new test cases in
tests/parser/features/test_assert.py. I also added checks for proper behavior of the iterated assertions.Cute Animal Picture