You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that some programs parse which perhaps should not, including assigning to a global-style declaration in function bodies. These programs then behave unexpectedly. Below is a minimal example:
from ethereum.tools import tester as t
from ethereum.slogging import configure_logging
#configure_logging(':trace')
s = t.Chain()
from viper import com
piler
code = """
def foo() -> num:
q:num = 1
return q
def foo2() -> num:
q = 1
return q
"""
t.languages['viper'] = compiler.Compiler()
c = s.contract(code, language='viper')
print(c.foo()) # Should not parse? returns 0
print(c.foo2()) # Should return 1; returns 1
What's your issue about?
It appears that some programs parse which perhaps should not, including assigning to a global-style declaration in function bodies. These programs then behave unexpectedly. Below is a minimal example:
This bug was discovered by Yi Zhang of the KEVM project. (@yzhang90)
How can it be fixed?
Make parsing consistent with what is specified in the old README.
Specifically, the offending statement can parse under these top-level rules:
with "q:num" being neither a valid varname or var (assuming varnames cannot contain colons, which would be sane).
Parsing should therefore likely fail in this case.
Cute Animal Picture
The text was updated successfully, but these errors were encountered: