dstebila / pygamehop

[work in progress] Python framework for supporting cryptographic game-hopping proofs
13 stars 0 forks source link

Update canonicalise #27

Closed mckaguem closed 3 years ago

mckaguem commented 3 years ago

Mange changes to init.py in canonicalize functions, plus changes to associated tests and support stuff.

Tried to preserve overall functionality. In some cases (eg. collapse_useless_assigns) the replacement function doesn't do as much, but other canonicalize functions (eg. canonicalize_line_order) take care of this anyway.

In most cases the new code is more general and should work for inner functions, in if bodies, class defs, etc. but these cases are generally not in the unit tests, so there are probably still bugs for some of these nested structures.

mckaguem commented 3 years ago

I created this branch I think before you merged in the other branches, so I needed to merge in game-as-classes. Now you should be able to merge without conflicts, but many of the commits in this branch are from before. I think the commit "simplify uptaded to use NewNodeTransformer" is the last one that you merged. Everything after that should be new.

dstebila commented 3 years ago

I get a typechecking error:

make typecheck_library
'mypy' --ignore-missing-imports -p gamehop.inlining
gamehop/utils.py:172: error: "AST" has no attribute "targets"
gamehop/utils.py:173: error: "AST" has no attribute "value"
Found 2 errors in 1 file (checked 2 source files)
make: *** [typecheck_library] Error 1

Not sure why this isn't being caught by the continuous integration though...

dstebila commented 3 years ago

I get a typechecking error:

make typecheck_library
'mypy' --ignore-missing-imports -p gamehop.inlining
gamehop/utils.py:172: error: "AST" has no attribute "targets"
gamehop/utils.py:173: error: "AST" has no attribute "value"
Found 2 errors in 1 file (checked 2 source files)
make: *** [typecheck_library] Error 1

Not sure why this isn't being caught by the continuous integration though...

I managed to fix it.