aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Arias <yo@elopio.net>2018-09-16 13:25:35 +0800
committerLeo Arias <yo@elopio.net>2018-09-16 14:38:08 +0800
commitaae385031f0f3d2d4281f1905616e59450e7c3ae (patch)
tree6be385b2be97db48035908f9a9c9a0349b08ca46
parent5f4a2d2cad56dee3f7f350d65d24b98d1f4b2b07 (diff)
downloaddexon-solidity-aae385031f0f3d2d4281f1905616e59450e7c3ae.tar.gz
dexon-solidity-aae385031f0f3d2d4281f1905616e59450e7c3ae.tar.zst
dexon-solidity-aae385031f0f3d2d4281f1905616e59450e7c3ae.zip
Add a missing tests for yul inliner optimization
When the statement has two return values, the function is not inlinable. When the function has one statement but it is not an assignment to the return variable, the function is not inlinable. l
-rw-r--r--test/libjulia/Inliner.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/libjulia/Inliner.cpp b/test/libjulia/Inliner.cpp
index 2f5b7cff..43a7d757 100644
--- a/test/libjulia/Inliner.cpp
+++ b/test/libjulia/Inliner.cpp
@@ -116,6 +116,9 @@ BOOST_AUTO_TEST_CASE(negative)
BOOST_CHECK_EQUAL(inlinableFunctions("{ function f() -> x:u256 { x := f() } }"), "");
BOOST_CHECK_EQUAL(inlinableFunctions("{ function f() -> x:u256 { x := x } }"), "");
BOOST_CHECK_EQUAL(inlinableFunctions("{ function f() -> x:u256, y:u256 { x := 2:u256 } }"), "");
+ BOOST_CHECK_EQUAL(inlinableFunctions(
+ "{ function g() -> x:u256, y:u256 {} function f(y:u256) -> x:u256 { x,y := g() } }"), "");
+ BOOST_CHECK_EQUAL(inlinableFunctions("{ function f(y:u256) -> x:u256 { y := 2:u256 } }"), "");
}