diff --git a/setup.py b/setup.py index 68cd1e7d12..374a9aa1e6 100644 --- a/setup.py +++ b/setup.py @@ -11,10 +11,10 @@ install_requires=[ "prettytable>=0.7.2", "pysha3>=1.0.2", - # "crytic-compile>=0.1.10", - "crytic-compile", + "crytic-compile>=0.1.11", + # "crytic-compile", ], - dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"], + # dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"], license="AGPL-3.0", long_description=open("README.md").read(), entry_points={ diff --git a/slither/detectors/statements/boolean_constant_equality.py b/slither/detectors/statements/boolean_constant_equality.py index a8d5e6e0a8..17df74e988 100644 --- a/slither/detectors/statements/boolean_constant_equality.py +++ b/slither/detectors/statements/boolean_constant_equality.py @@ -12,7 +12,7 @@ class BooleanEquality(AbstractDetector): """ - Boolean constant misuse + Boolean constant equality """ ARGUMENT = "boolean-equal" @@ -72,17 +72,16 @@ def _detect(self): results = [] for contract in self.contracts: boolean_constant_misuses = self._detect_boolean_equality(contract) - if boolean_constant_misuses: - for (func, nodes) in boolean_constant_misuses: - for node in nodes: - info = [ - func, - " compares to a boolean constant:\n\t-", - node, - "\n", - ] + for (func, nodes) in boolean_constant_misuses: + for node in nodes: + info = [ + func, + " compares to a boolean constant:\n\t-", + node, + "\n", + ] - res = self.generate_result(info) - results.append(res) + res = self.generate_result(info) + results.append(res) return results diff --git a/slither/detectors/statements/boolean_constant_misuse.py b/slither/detectors/statements/boolean_constant_misuse.py index 3b77ba02d5..7bba5a3e63 100644 --- a/slither/detectors/statements/boolean_constant_misuse.py +++ b/slither/detectors/statements/boolean_constant_misuse.py @@ -67,39 +67,35 @@ def _detect_boolean_constant_misuses(contract): # pylint: disable=too-many-bran results = [] # Loop for each function and modifier. - for function in contract.functions_declared: # pylint: disable=too-many-nested-blocks + for function in contract.functions_declared: f_results = set() # Loop for every node in this function, looking for boolean constants for node in function.nodes: # Do not report "while(true)" - if node.type == NodeType.IFLOOP: - if node.irs: - if len(node.irs) == 1: - ir = node.irs[0] - if isinstance(ir, Condition) and ir.value == Constant( - "True", ElementaryType("bool") - ): - continue + if node.type == NodeType.IFLOOP and node.irs and len(node.irs) == 1: + ir = node.irs[0] + if isinstance(ir, Condition) and ir.value == Constant( + "True", ElementaryType("bool") + ): + continue for ir in node.irs: if isinstance(ir, (Assignment, Call, Return, InitArray)): # It's ok to use a bare boolean constant in these contexts continue - if isinstance(ir, Binary): - if ir.type in [ - BinaryType.ADDITION, - BinaryType.EQUAL, - BinaryType.NOT_EQUAL, - ]: - # Comparing to a Boolean constant is dubious style, but harmless - # Equal is catch by another detector (informational severity) - continue + if isinstance(ir, Binary) and ir.type in [ + BinaryType.ADDITION, + BinaryType.EQUAL, + BinaryType.NOT_EQUAL, + ]: + # Comparing to a Boolean constant is dubious style, but harmless + # Equal is catch by another detector (informational severity) + continue for r in ir.read: - if isinstance(r, Constant): - if isinstance(r.value, bool): - f_results.add(node) + if isinstance(r, Constant) and isinstance(r.value, bool): + f_results.add(node) results.append((function, f_results)) # Return the resulting set of nodes with improper uses of Boolean constants @@ -112,17 +108,16 @@ def _detect(self): results = [] for contract in self.contracts: boolean_constant_misuses = self._detect_boolean_constant_misuses(contract) - if boolean_constant_misuses: - for (func, nodes) in boolean_constant_misuses: - for node in nodes: - info = [ - func, - " uses a Boolean constant improperly:\n\t-", - node, - "\n", - ] - - res = self.generate_result(info) - results.append(res) + for (func, nodes) in boolean_constant_misuses: + for node in nodes: + info = [ + func, + " uses a Boolean constant improperly:\n\t-", + node, + "\n", + ] + + res = self.generate_result(info) + results.append(res) return results diff --git a/slither/solc_parsing/declarations/event.py b/slither/solc_parsing/declarations/event.py index f480e3974f..29fee7b4ab 100644 --- a/slither/solc_parsing/declarations/event.py +++ b/slither/solc_parsing/declarations/event.py @@ -29,13 +29,15 @@ def __init__(self, event: Event, event_data: Dict, contract_parser: "ContractSol self._elemsNotParsed = elems["parameters"] else: self._event.name = event_data["attributes"]["name"] - elems = event_data["children"][0] - - assert elems["name"] == "ParameterList" - if "children" in elems: - self._elemsNotParsed = elems["children"] - else: - self._elemsNotParsed = [] + for elem in event_data["children"]: + # From Solidity 0.6.3 to 0.6.10 (included) + # Comment above a event might be added in the children + # of an event for the legacy ast + if elem["name"] == "ParameterList": + if "children" in elem: + self._elemsNotParsed = elem["children"] + else: + self._elemsNotParsed = [] @property def is_compact_ast(self) -> bool: diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index 5a8cde5324..ae772dfdd6 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -258,8 +258,16 @@ def analyze_params(self): returns = self._functionNotParsed["returnParameters"] else: children = self._functionNotParsed[self.get_children("children")] - params = children[0] - returns = children[1] + # It uses to be + # params = children[0] + # returns = children[1] + # But from Solidity 0.6.3 to 0.6.10 (included) + # Comment above a function might be added in the children + child_iter = iter( + [child for child in children if child[self.get_key()] == "ParameterList"] + ) + params = next(child_iter) + returns = next(child_iter) if params: self._parse_params(params) diff --git a/slither/solc_parsing/declarations/modifier.py b/slither/solc_parsing/declarations/modifier.py index 1bd5d17411..158cc82638 100644 --- a/slither/solc_parsing/declarations/modifier.py +++ b/slither/solc_parsing/declarations/modifier.py @@ -37,7 +37,11 @@ def analyze_params(self): params = self._functionNotParsed["parameters"] else: children = self._functionNotParsed["children"] - params = children[0] + # It uses to be + # params = children[0] + # But from Solidity 0.6.3 to 0.6.10 (included) + # Comment above a function might be added in the children + params = next(child for child in children if child[self.get_key()] == "ParameterList") if params: self._parse_params(params) @@ -60,9 +64,11 @@ def analyze_content(self): self._function.is_implemented = False if len(children) > 1: - assert len(children) == 2 - block = children[1] - assert block["name"] == "Block" + # It uses to be + # params = children[1] + # But from Solidity 0.6.3 to 0.6.10 (included) + # Comment above a function might be added in the children + block = next(child for child in children if child[self.get_key()] == "Block") self._function.is_implemented = True self._parse_cfg(block) diff --git a/slither/tools/properties/properties/ercs/erc20/properties/mint.py b/slither/tools/properties/properties/ercs/erc20/properties/mint.py index 4aafa907e2..1549e7e643 100644 --- a/slither/tools/properties/properties/ercs/erc20/properties/mint.py +++ b/slither/tools/properties/properties/ercs/erc20/properties/mint.py @@ -10,7 +10,7 @@ name="crytic_supply_constant_ERC20PropertiesNotMintable()", description="The total supply does not increase.", content=""" -\t\treturn initialTotalSupply >= totalSupply();""", +\t\treturn initialTotalSupply >= this.totalSupply();""", type=PropertyType.MEDIUM_SEVERITY, return_type=PropertyReturn.SUCCESS, is_unit_test=True, diff --git a/slither/tools/properties/properties/ercs/erc20/properties/transfer.py b/slither/tools/properties/properties/ercs/erc20/properties/transfer.py index 5e199a49c0..540b8e2954 100644 --- a/slither/tools/properties/properties/ercs/erc20/properties/transfer.py +++ b/slither/tools/properties/properties/ercs/erc20/properties/transfer.py @@ -37,7 +37,7 @@ name="crytic_less_than_total_ERC20Properties()", description="Balance of one user must be less or equal to the total supply.", content=""" -\t\treturn this.balanceOf(msg.sender) <= totalSupply();""", +\t\treturn this.balanceOf(msg.sender) <= this.totalSupply();""", type=PropertyType.MEDIUM_SEVERITY, return_type=PropertyReturn.SUCCESS, is_unit_test=True, @@ -48,7 +48,7 @@ name="crytic_totalSupply_consistant_ERC20Properties()", description="Balance of the crytic users must be less or equal to the total supply.", content=""" -\t\treturn this.balanceOf(crytic_owner) + this.balanceOf(crytic_user) + this.balanceOf(crytic_attacker) <= totalSupply();""", +\t\treturn this.balanceOf(crytic_owner) + this.balanceOf(crytic_user) + this.balanceOf(crytic_attacker) <= this.totalSupply();""", type=PropertyType.MEDIUM_SEVERITY, return_type=PropertyReturn.SUCCESS, is_unit_test=True, diff --git a/tests/ast-parsing/comment-all.sol b/tests/ast-parsing/comment-all.sol new file mode 100644 index 0000000000..3a1ebfb5c3 --- /dev/null +++ b/tests/ast-parsing/comment-all.sol @@ -0,0 +1,7 @@ +contract A{ + /*** Events ***/ + event E(); + + /*** Function ***/ + function f() public{} +} diff --git a/tests/ast-parsing/expected/comment-0.4.0-legacy.json b/tests/ast-parsing/expected/comment-0.4.0-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.0-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.1-legacy.json b/tests/ast-parsing/expected/comment-0.4.1-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.1-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.10-legacy.json b/tests/ast-parsing/expected/comment-0.4.10-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.10-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.11-legacy.json b/tests/ast-parsing/expected/comment-0.4.11-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.11-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.12-compact.json b/tests/ast-parsing/expected/comment-0.4.12-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.12-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.12-legacy.json b/tests/ast-parsing/expected/comment-0.4.12-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.12-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.13-compact.json b/tests/ast-parsing/expected/comment-0.4.13-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.13-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.13-legacy.json b/tests/ast-parsing/expected/comment-0.4.13-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.13-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.14-compact.json b/tests/ast-parsing/expected/comment-0.4.14-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.14-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.14-legacy.json b/tests/ast-parsing/expected/comment-0.4.14-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.14-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.15-compact.json b/tests/ast-parsing/expected/comment-0.4.15-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.15-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.15-legacy.json b/tests/ast-parsing/expected/comment-0.4.15-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.15-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.16-compact.json b/tests/ast-parsing/expected/comment-0.4.16-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.16-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.16-legacy.json b/tests/ast-parsing/expected/comment-0.4.16-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.16-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.17-compact.json b/tests/ast-parsing/expected/comment-0.4.17-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.17-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.17-legacy.json b/tests/ast-parsing/expected/comment-0.4.17-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.17-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.18-compact.json b/tests/ast-parsing/expected/comment-0.4.18-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.18-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.18-legacy.json b/tests/ast-parsing/expected/comment-0.4.18-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.18-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.19-compact.json b/tests/ast-parsing/expected/comment-0.4.19-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.19-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.19-legacy.json b/tests/ast-parsing/expected/comment-0.4.19-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.19-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.2-legacy.json b/tests/ast-parsing/expected/comment-0.4.2-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.2-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.20-compact.json b/tests/ast-parsing/expected/comment-0.4.20-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.20-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.20-legacy.json b/tests/ast-parsing/expected/comment-0.4.20-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.20-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.21-compact.json b/tests/ast-parsing/expected/comment-0.4.21-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.21-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.21-legacy.json b/tests/ast-parsing/expected/comment-0.4.21-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.21-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.22-compact.json b/tests/ast-parsing/expected/comment-0.4.22-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.22-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.22-legacy.json b/tests/ast-parsing/expected/comment-0.4.22-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.22-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.23-compact.json b/tests/ast-parsing/expected/comment-0.4.23-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.23-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.23-legacy.json b/tests/ast-parsing/expected/comment-0.4.23-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.23-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.24-compact.json b/tests/ast-parsing/expected/comment-0.4.24-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.24-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.24-legacy.json b/tests/ast-parsing/expected/comment-0.4.24-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.24-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.25-compact.json b/tests/ast-parsing/expected/comment-0.4.25-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.25-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.25-legacy.json b/tests/ast-parsing/expected/comment-0.4.25-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.25-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.26-compact.json b/tests/ast-parsing/expected/comment-0.4.26-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.26-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.26-legacy.json b/tests/ast-parsing/expected/comment-0.4.26-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.26-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.3-legacy.json b/tests/ast-parsing/expected/comment-0.4.3-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.3-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.4-legacy.json b/tests/ast-parsing/expected/comment-0.4.4-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.4-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.5-legacy.json b/tests/ast-parsing/expected/comment-0.4.5-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.5-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.6-legacy.json b/tests/ast-parsing/expected/comment-0.4.6-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.6-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.7-legacy.json b/tests/ast-parsing/expected/comment-0.4.7-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.7-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.8-legacy.json b/tests/ast-parsing/expected/comment-0.4.8-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.8-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.4.9-legacy.json b/tests/ast-parsing/expected/comment-0.4.9-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.4.9-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.0-compact.json b/tests/ast-parsing/expected/comment-0.5.0-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.0-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.0-legacy.json b/tests/ast-parsing/expected/comment-0.5.0-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.0-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.1-compact.json b/tests/ast-parsing/expected/comment-0.5.1-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.1-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.1-legacy.json b/tests/ast-parsing/expected/comment-0.5.1-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.1-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.10-compact.json b/tests/ast-parsing/expected/comment-0.5.10-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.10-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.10-legacy.json b/tests/ast-parsing/expected/comment-0.5.10-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.10-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.11-compact.json b/tests/ast-parsing/expected/comment-0.5.11-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.11-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.11-legacy.json b/tests/ast-parsing/expected/comment-0.5.11-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.11-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.12-compact.json b/tests/ast-parsing/expected/comment-0.5.12-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.12-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.12-legacy.json b/tests/ast-parsing/expected/comment-0.5.12-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.12-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.13-compact.json b/tests/ast-parsing/expected/comment-0.5.13-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.13-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.13-legacy.json b/tests/ast-parsing/expected/comment-0.5.13-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.13-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.14-compact.json b/tests/ast-parsing/expected/comment-0.5.14-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.14-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.14-legacy.json b/tests/ast-parsing/expected/comment-0.5.14-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.14-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.15-compact.json b/tests/ast-parsing/expected/comment-0.5.15-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.15-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.15-legacy.json b/tests/ast-parsing/expected/comment-0.5.15-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.15-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.16-compact.json b/tests/ast-parsing/expected/comment-0.5.16-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.16-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.16-legacy.json b/tests/ast-parsing/expected/comment-0.5.16-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.16-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.17-compact.json b/tests/ast-parsing/expected/comment-0.5.17-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.17-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.17-legacy.json b/tests/ast-parsing/expected/comment-0.5.17-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.17-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.2-compact.json b/tests/ast-parsing/expected/comment-0.5.2-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.2-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.2-legacy.json b/tests/ast-parsing/expected/comment-0.5.2-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.2-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.3-compact.json b/tests/ast-parsing/expected/comment-0.5.3-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.3-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.3-legacy.json b/tests/ast-parsing/expected/comment-0.5.3-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.3-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.4-compact.json b/tests/ast-parsing/expected/comment-0.5.4-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.4-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.4-legacy.json b/tests/ast-parsing/expected/comment-0.5.4-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.4-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.5-compact.json b/tests/ast-parsing/expected/comment-0.5.5-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.5-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.5-legacy.json b/tests/ast-parsing/expected/comment-0.5.5-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.5-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.6-compact.json b/tests/ast-parsing/expected/comment-0.5.6-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.6-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.6-legacy.json b/tests/ast-parsing/expected/comment-0.5.6-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.6-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.7-compact.json b/tests/ast-parsing/expected/comment-0.5.7-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.7-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.7-legacy.json b/tests/ast-parsing/expected/comment-0.5.7-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.7-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.8-compact.json b/tests/ast-parsing/expected/comment-0.5.8-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.8-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.8-legacy.json b/tests/ast-parsing/expected/comment-0.5.8-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.8-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.9-compact.json b/tests/ast-parsing/expected/comment-0.5.9-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.9-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.5.9-legacy.json b/tests/ast-parsing/expected/comment-0.5.9-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.5.9-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.0-compact.json b/tests/ast-parsing/expected/comment-0.6.0-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.0-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.0-legacy.json b/tests/ast-parsing/expected/comment-0.6.0-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.0-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.1-compact.json b/tests/ast-parsing/expected/comment-0.6.1-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.1-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.1-legacy.json b/tests/ast-parsing/expected/comment-0.6.1-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.1-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.10-compact.json b/tests/ast-parsing/expected/comment-0.6.10-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.10-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.10-legacy.json b/tests/ast-parsing/expected/comment-0.6.10-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.10-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.11-compact.json b/tests/ast-parsing/expected/comment-0.6.11-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.11-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.11-legacy.json b/tests/ast-parsing/expected/comment-0.6.11-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.11-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.12-compact.json b/tests/ast-parsing/expected/comment-0.6.12-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.12-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.12-legacy.json b/tests/ast-parsing/expected/comment-0.6.12-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.12-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.2-compact.json b/tests/ast-parsing/expected/comment-0.6.2-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.2-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.2-legacy.json b/tests/ast-parsing/expected/comment-0.6.2-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.2-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.3-compact.json b/tests/ast-parsing/expected/comment-0.6.3-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.3-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.3-legacy.json b/tests/ast-parsing/expected/comment-0.6.3-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.3-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.4-compact.json b/tests/ast-parsing/expected/comment-0.6.4-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.4-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.4-legacy.json b/tests/ast-parsing/expected/comment-0.6.4-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.4-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.5-compact.json b/tests/ast-parsing/expected/comment-0.6.5-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.5-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.5-legacy.json b/tests/ast-parsing/expected/comment-0.6.5-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.5-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.6-compact.json b/tests/ast-parsing/expected/comment-0.6.6-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.6-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.6-legacy.json b/tests/ast-parsing/expected/comment-0.6.6-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.6-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.7-compact.json b/tests/ast-parsing/expected/comment-0.6.7-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.7-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.7-legacy.json b/tests/ast-parsing/expected/comment-0.6.7-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.7-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.8-compact.json b/tests/ast-parsing/expected/comment-0.6.8-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.8-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.8-legacy.json b/tests/ast-parsing/expected/comment-0.6.8-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.8-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.9-compact.json b/tests/ast-parsing/expected/comment-0.6.9-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.9-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.6.9-legacy.json b/tests/ast-parsing/expected/comment-0.6.9-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.6.9-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.0-compact.json b/tests/ast-parsing/expected/comment-0.7.0-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.0-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.0-legacy.json b/tests/ast-parsing/expected/comment-0.7.0-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.0-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.1-compact.json b/tests/ast-parsing/expected/comment-0.7.1-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.1-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.1-legacy.json b/tests/ast-parsing/expected/comment-0.7.1-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.1-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.2-compact.json b/tests/ast-parsing/expected/comment-0.7.2-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.2-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.2-legacy.json b/tests/ast-parsing/expected/comment-0.7.2-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.2-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.3-compact.json b/tests/ast-parsing/expected/comment-0.7.3-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.3-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.3-legacy.json b/tests/ast-parsing/expected/comment-0.7.3-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.3-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.4-compact.json b/tests/ast-parsing/expected/comment-0.7.4-compact.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.4-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.7.4-legacy.json b/tests/ast-parsing/expected/comment-0.7.4-legacy.json new file mode 100644 index 0000000000..a53745acd0 --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.7.4-legacy.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/detectors/boolean-constant-equality/boolean-constant-equality.sol b/tests/detectors/boolean-constant-equality/boolean-constant-equality.sol new file mode 100644 index 0000000000..799f433357 --- /dev/null +++ b/tests/detectors/boolean-constant-equality/boolean-constant-equality.sol @@ -0,0 +1,27 @@ +contract MyConc { + function bad0(bool foo) public pure returns (bool) { + if (foo) { + return true; + } + } + function bad1(bool b) public pure returns (bool) { + return (b == true); + } + + function bad2(bool x, uint8 y) public pure returns (bool) { + if (x == (y > 0)) { + return true; + } + } + + function bad3() public pure returns (bool) { + uint256 a; + if (a == 10) { + return true; + } + } + + function good(uint8 a) public pure returns (bool) { + return a >= 1; + } +} \ No newline at end of file diff --git a/tests/detectors/boolean-constant-equality/boolean-constant-equality.sol.0.4.25.BooleanEquality.json b/tests/detectors/boolean-constant-equality/boolean-constant-equality.sol.0.4.25.BooleanEquality.json new file mode 100644 index 0000000000..72c1bcbbe2 --- /dev/null +++ b/tests/detectors/boolean-constant-equality/boolean-constant-equality.sol.0.4.25.BooleanEquality.json @@ -0,0 +1,170 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 139, + "length": 84, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "is_dependency": false, + "lines": [ + 7, + 8, + 9 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "MyConc", + "source_mapping": { + "start": 0, + "length": 578, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad1(bool)" + } + }, + { + "type": "node", + "name": "(b == true)", + "source_mapping": { + "start": 198, + "length": 18, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "is_dependency": false, + "lines": [ + 8 + ], + "starting_column": 9, + "ending_column": 27 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 139, + "length": 84, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "is_dependency": false, + "lines": [ + 7, + 8, + 9 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "MyConc", + "source_mapping": { + "start": 0, + "length": 578, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad1(bool)" + } + } + } + } + ], + "description": "MyConc.bad1(bool) (tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#8)\n", + "markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#L8)\n", + "id": "4a53e773c88b730f07c2e4106545df03b44679c56ee0d9dbd75dca010320e69c", + "check": "boolean-equal", + "impact": "Informational", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol b/tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol new file mode 100644 index 0000000000..6d3df44f32 --- /dev/null +++ b/tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol @@ -0,0 +1,46 @@ +contract MyConc { + function bad0(bool foo) public pure returns (bool) { + if (foo) { + return true; + } + return false; + } + + function bad1(bool b) public pure returns (bool) { + return (b || true); + } + + function bad2(bool x, uint8 y) public pure returns (bool) { + while (x == (y > 0)) { + return true; + } + return false; + } + + function bad3(bool a) public pure returns (bool) { + uint256 b = 0; + while (a) { + b++; + } + return true; + } + + function bad4() public pure returns (bool) { + uint256 b = 0; + while (true) { + b++; + } + return true; + } + + function bad5() public pure returns (bool) { + while (true) { + return true; + } + return false; + } + + function good() public pure returns (bool) { + return true; + } +} \ No newline at end of file diff --git a/tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol.0.6.0.BooleanConstantMisuse.json b/tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol.0.6.0.BooleanConstantMisuse.json new file mode 100644 index 0000000000..a4bf8607d3 --- /dev/null +++ b/tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol.0.6.0.BooleanConstantMisuse.json @@ -0,0 +1,208 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 162, + "length": 84, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "MyConc", + "source_mapping": { + "start": 0, + "length": 923, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad1(bool)" + } + }, + { + "type": "node", + "name": "(b || true)", + "source_mapping": { + "start": 221, + "length": 18, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "is_dependency": false, + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 27 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 162, + "length": 84, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "MyConc", + "source_mapping": { + "start": 0, + "length": 923, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "bad1(bool)" + } + } + } + } + ], + "description": "MyConc.bad1(bool) (tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#10)\n", + "markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#L10)\n", + "id": "12517fed0ec8f0a2232b467a6add9fd94a6a84325017e02e8a48794fc9112c6b", + "check": "boolean-cst", + "impact": "Medium", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/test_detectors.py b/tests/test_detectors.py index bc1780c3f5..33d72d015f 100644 --- a/tests/test_detectors.py +++ b/tests/test_detectors.py @@ -37,6 +37,8 @@ from slither.detectors.shadowing.state import StateShadowing from slither.detectors.source.rtlo import RightToLeftOverride from slither.detectors.statements.assembly import Assembly +from slither.detectors.statements.boolean_constant_misuse import BooleanConstantMisuse +from slither.detectors.statements.boolean_constant_equality import BooleanEquality from slither.detectors.statements.calls_in_loop import MultipleCallsInLoop from slither.detectors.statements.controlled_delegatecall import ControlledDelegateCall from slither.detectors.statements.incorrect_strict_equality import IncorrectStrictEquality @@ -91,6 +93,16 @@ def id_test(test_item: Test): ALL_TESTS = [ + Test( + BooleanEquality, + "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol", + "0.4.25", + ), + Test( + BooleanConstantMisuse, + "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol", + "0.6.0", + ), Test(UncheckedLowLevel, "tests/detectors/unchecked-lowlevel/unchecked_lowlevel.sol", "0.4.25"), Test( UncheckedLowLevel,