diff --git a/slither/utils/expression_manipulations.py b/slither/utils/expression_manipulations.py index 753778be9..75d97042c 100644 --- a/slither/utils/expression_manipulations.py +++ b/slither/utils/expression_manipulations.py @@ -21,7 +21,7 @@ from slither.core.expressions.new_array import NewArray from slither.core.expressions.new_contract import NewContract from slither.core.expressions.tuple_expression import TupleExpression from slither.core.expressions.type_conversion import TypeConversion - +from slither.core.expressions.new_elementary_type import NewElementaryType # pylint: disable=protected-access def f_expressions( @@ -100,7 +100,14 @@ class SplitTernaryExpression: if isinstance( expression, - (Literal, Identifier, NewArray, NewContract, ElementaryTypeNameExpression), + ( + Literal, + Identifier, + NewArray, + NewContract, + ElementaryTypeNameExpression, + NewElementaryType, + ), ): return diff --git a/tests/unit/slithir/test_data/ternary_expressions.sol b/tests/unit/slithir/test_data/ternary_expressions.sol index c73a2b6b3..ebfb96e80 100644 --- a/tests/unit/slithir/test_data/ternary_expressions.sol +++ b/tests/unit/slithir/test_data/ternary_expressions.sol @@ -49,4 +49,8 @@ contract C { myIntegers[cond ? a : b] ); } + + function i(bool cond) public { + bytes memory a = new bytes(cond ? 1 : 2); + } }