# Buggy code
def _parse_returns(self, returns):
    assert returns[self.get_key()] == "ParameterList"

    if self.is_compact_ast:
        returns = returns["parameters"]
    else:
        returns = returns[self.get_children("children")]

    for ret in returns:
        assert ret[self.get_key()] == "VariableDeclaration"

        local_var = LocalVariableSolc(ret)

        local_var.set_function(self)
        local_var.set_offset(ret["src"], self.contract.slither)
        local_var.analyze(self)

        # see https://solidity.readthedocs.io/en/v0.4.24/types.html?highlight=storage%20location#data-location
        if local_var.location == "default":
            local_var.set_location("memory")

        self._variables[local_var.name] = local_var
        self._returns.append(local_var)


# Traceback (AssertionError)
ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 35, in process
slither = Slither(filename, args.solc, args.disable_solc_warnings, args.solc_args, ast)
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/slither.py", line 41, in __init__
self._analyze_contracts()
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/solc_parsing/slitherSolc.py", line 201, in _analyze_contracts
self._convert_to_slithir()
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/solc_parsing/slitherSolc.py", line 327, in _convert_to_slithir
contract.convert_expression_to_slithir()
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/solc_parsing/declarations/contract.py", line 374, in convert_expression_to_slithir
func.generate_slithir_ssa(all_ssa_state_variables_instances)
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/solc_parsing/declarations/function.py", line 935, in generate_slithir_ssa
add_ssa_ir(self, all_ssa_state_variables_instances)
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/slithir/utils/ssa.py", line 69, in add_ssa_ir
add_phi_origins(function.entry_point, init_definition, dict())
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/slithir/utils/ssa.py", line 363, in add_phi_origins
add_phi_origins(succ, local_variables_definition, state_variables_definition)
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/slithir/utils/ssa.py", line 363, in add_phi_origins
add_phi_origins(succ, local_variables_definition, state_variables_definition)
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/slithir/utils/ssa.py", line 363, in add_phi_origins
add_phi_origins(succ, local_variables_definition, state_variables_definition)
[Previous line repeated 2 more times]
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/slithir/utils/ssa.py", line 356, in add_phi_origins
phi_node.add_phi_origin_local_variable(variable, n)
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/core/cfg/node.py", line 215, in add_phi_origin_local_variable
assert v == variable
AssertionError

# Fixed code
def _parse_returns(self, returns):
    assert returns[self.get_key()] == "ParameterList"

    if self.is_compact_ast:
        returns = returns["parameters"]
    else:
        returns = returns[self.get_children("children")]

    for ret in returns:
        assert ret[self.get_key()] == "VariableDeclaration"

        local_var = LocalVariableSolc(ret)

        local_var.set_function(self)
        local_var.set_offset(ret["src"], self.contract.slither)
        local_var.analyze(self)

        # see https://solidity.readthedocs.io/en/v0.4.24/types.html?highlight=storage%20location#data-location
        if local_var.location == "default":
            local_var.set_location("memory")

        self._add_local_variable(local_var)
        self._returns.append(local_var)