From 0dfd4a726eb7e6fa8a5e886a0d80bb5bf3d9b7dc Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 8 Jan 2019 19:33:46 +0100 Subject: Warn about unreachable code. --- .../syntaxTests/controlFlow/unreachableCode/while_break.sol | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol (limited to 'test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol') diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol new file mode 100644 index 00000000..2d1ddd4f --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol @@ -0,0 +1,12 @@ +contract C { + function f() public pure { + uint a = 0; + while (a < 100) { + a++; + break; + a--; + } + } +} +// ---- +// Warning: (138-141): Unreachable code. -- cgit v1.2.3