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. --- .../controlFlow/unreachableCode/while_continue.sol | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol (limited to 'test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol') diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol new file mode 100644 index 00000000..55f98f67 --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol @@ -0,0 +1,11 @@ +contract C { + function f() public pure { + while(true) { + continue; + return; + } + return; // this is unreachable as well, but currently undetected (needs to consider constant condition "true") + } +} +// ---- +// Warning: (100-107): Unreachable code. -- cgit v1.2.3