SMAT-Lab/Scalpel

Error in SSA.const

Closed this issue · 1 comments

inferred = infferer.get_types()

SSA module gives an error when testing typeinfer, the error can be reproduced by running the python file linked above.

The traceback is as follows:
Traceback (most recent call last):
File "xxxx\Scalpel/tests/test_typeinfer_with_real_libs.py", line 155, in
test_pytest_case4()
File "xxxx\Scalpel/tests/test_typeinfer_with_real_libs.py", line 135, in test_pytest_case4
infferer.infer_types()
File "xxxx\Scalpel\scalpel\typeinfer\typeinfer.py", line 128, in infer_types
processed_file = self.process_file(node.source)
File "xxxx\Scalpel\scalpel\typeinfer\typeinfer.py", line 382, in process_file
return_visitor.visit(function_node)
File "xxxx\AppData\Local\Programs\Python\Python38-32\Lib\ast.py", line 360, in visit
return visitor(node)
File "xxxx\Scalpel\scalpel\typeinfer\analysers.py", line 593, in visit_FunctionDef
self.type_infer_CFG(node)
File "xxxx\Scalpel\scalpel\typeinfer\analysers.py", line 721, in type_infer_CFG
ssa_results, ident_const_dict = ssa_analyzer.compute_SSA(cfg)
File "xxxx\Scalpel\scalpel\SSA\const.py", line 123, in compute_SSA
stored_idents, loaded_idents, func_names = self.get_stmt_idents_ctx(stmt, const_dict=tmp_const_dict)
File "xxxx\Scalpel\scalpel\SSA\const.py", line 208, in get_stmt_idents_ctx
left_name = stmt.targets[0].id
AttributeError: 'AnnAssign' object has no attribute 'targets'

Jarvx commented

The test case now gives no error.