From 5afb9355be417f163e7c420d9a7e556a676b1070 Mon Sep 17 00:00:00 2001 From: Simone Date: Mon, 24 Apr 2023 21:13:37 +0200 Subject: [PATCH] Improve tuple analysis --- .../operations/unused_return_values.py | 42 ++++++++++++------ ...turnValues_0_4_25_unused_return_sol__0.txt | 8 +++- ...turnValues_0_5_16_unused_return_sol__0.txt | 8 +++- ...turnValues_0_6_11_unused_return_sol__0.txt | 8 +++- ...eturnValues_0_7_6_unused_return_sol__0.txt | 8 +++- .../unused-return/0.4.25/unused_return.sol | 8 ++++ .../0.4.25/unused_return.sol-0.4.25.zip | Bin 3212 -> 3637 bytes .../unused-return/0.5.16/unused_return.sol | 8 ++++ .../0.5.16/unused_return.sol-0.5.16.zip | Bin 3223 -> 3651 bytes .../unused-return/0.6.11/unused_return.sol | 8 ++++ .../0.6.11/unused_return.sol-0.6.11.zip | Bin 3116 -> 3540 bytes .../unused-return/0.7.6/unused_return.sol | 8 ++++ .../0.7.6/unused_return.sol-0.7.6.zip | Bin 3039 -> 3465 bytes 13 files changed, 84 insertions(+), 22 deletions(-) diff --git a/slither/detectors/operations/unused_return_values.py b/slither/detectors/operations/unused_return_values.py index 93dda274aa..80be98b45d 100644 --- a/slither/detectors/operations/unused_return_values.py +++ b/slither/detectors/operations/unused_return_values.py @@ -3,7 +3,7 @@ """ from typing import List -from slither.core.cfg.node import Node +from slither.core.cfg.node import Node, NodeType from slither.core.declarations import Function from slither.core.declarations.function_contract import FunctionContract from slither.core.variables.state_variable import StateVariable @@ -12,8 +12,8 @@ DetectorClassification, DETECTOR_INFO, ) -from slither.slithir.operations import HighLevelCall -from slither.slithir.operations.operation import Operation +from slither.slithir.operations import HighLevelCall, Assignment, Unpack, Operation +from slither.slithir.variables import TupleVariable from slither.utils.output import Output @@ -50,13 +50,18 @@ class UnusedReturnValues(AbstractDetector): WIKI_RECOMMENDATION = "Ensure that all the return values of the function calls are used." def _is_instance(self, ir: Operation) -> bool: # pylint: disable=no-self-use - return isinstance(ir, HighLevelCall) and ( - ( - isinstance(ir.function, Function) - and ir.function.solidity_signature - not in ["transfer(address,uint256)", "transferFrom(address,address,uint256)"] + return ( + isinstance(ir, HighLevelCall) + and ( + ( + isinstance(ir.function, Function) + and ir.function.solidity_signature + not in ["transfer(address,uint256)", "transferFrom(address,address,uint256)"] + ) + or not isinstance(ir.function, Function) ) - or not isinstance(ir.function, Function) + or ir.node.type == NodeType.TRY + and isinstance(ir, (Assignment, Unpack)) ) def detect_unused_return_values( @@ -71,18 +76,27 @@ def detect_unused_return_values( """ values_returned = [] nodes_origin = {} + # pylint: disable=too-many-nested-blocks for n in f.nodes: for ir in n.irs: if self._is_instance(ir): # if a return value is stored in a state variable, it's ok if ir.lvalue and not isinstance(ir.lvalue, StateVariable): - values_returned.append(ir.lvalue) + values_returned.append((ir.lvalue, None)) nodes_origin[ir.lvalue] = ir + if isinstance(ir.lvalue, TupleVariable): + # we iterate the number of elements the tuple has + # and add a (variable, index) in values_returned for each of them + for index in range(len(ir.lvalue.type)): + values_returned.append((ir.lvalue, index)) for read in ir.read: - if read in values_returned: - values_returned.remove(read) - - return [nodes_origin[value].node for value in values_returned] + remove = (read, ir.index) if isinstance(ir, Unpack) else (read, None) + if remove in values_returned: + # this is needed to remove the tuple variable when the first time one of its element is used + if remove[1] is not None and (remove[0], None) in values_returned: + values_returned.remove((remove[0], None)) + values_returned.remove(remove) + return [nodes_origin[value].node for (value, _) in values_returned] def _detect(self) -> List[Output]: """Detect high level calls which return a value that are never used""" diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_4_25_unused_return_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_4_25_unused_return_sol__0.txt index ec28fa9e54..2d70ddd1cf 100644 --- a/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_4_25_unused_return_sol__0.txt +++ b/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_4_25_unused_return_sol__0.txt @@ -1,4 +1,8 @@ -User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#17-29) ignores return value by t.f() (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#18) +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#18-37) ignores return value by t.g() (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#31) -User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#17-29) ignores return value by a.add(0) (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#22) +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#18-37) ignores return value by t.f() (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#19) + +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#18-37) ignores return value by a.add(0) (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#23) + +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#18-37) ignores return value by (e) = t.g() (tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol#36) diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_5_16_unused_return_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_5_16_unused_return_sol__0.txt index 0cf04d2833..5a651712e5 100644 --- a/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_5_16_unused_return_sol__0.txt +++ b/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_5_16_unused_return_sol__0.txt @@ -1,4 +1,8 @@ -User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#17-29) ignores return value by t.f() (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#18) +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#18-37) ignores return value by (e) = t.g() (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#36) -User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#17-29) ignores return value by a.add(0) (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#22) +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#18-37) ignores return value by a.add(0) (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#23) + +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#18-37) ignores return value by t.g() (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#31) + +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#18-37) ignores return value by t.f() (tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol#19) diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_6_11_unused_return_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_6_11_unused_return_sol__0.txt index be0a8c6875..5f1d751b7c 100644 --- a/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_6_11_unused_return_sol__0.txt +++ b/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_6_11_unused_return_sol__0.txt @@ -1,4 +1,8 @@ -User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#17-29) ignores return value by a.add(0) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#22) +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#18-37) ignores return value by t.f() (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#19) -User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#17-29) ignores return value by t.f() (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#18) +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#18-37) ignores return value by a.add(0) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#23) + +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#18-37) ignores return value by t.g() (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#31) + +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#18-37) ignores return value by (e) = t.g() (tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol#36) diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_7_6_unused_return_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_7_6_unused_return_sol__0.txt index ec74a9458d..4780c79057 100644 --- a/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_7_6_unused_return_sol__0.txt +++ b/tests/e2e/detectors/snapshots/detectors__detector_UnusedReturnValues_0_7_6_unused_return_sol__0.txt @@ -1,4 +1,8 @@ -User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#17-29) ignores return value by a.add(0) (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#22) +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#18-37) ignores return value by t.g() (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#31) -User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#17-29) ignores return value by t.f() (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#18) +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#18-37) ignores return value by a.add(0) (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#23) + +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#18-37) ignores return value by t.f() (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#19) + +User.test(Target) (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#18-37) ignores return value by (e) = t.g() (tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol#36) diff --git a/tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol b/tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol index d1c1895987..ef22b63aed 100644 --- a/tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol +++ b/tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol @@ -8,6 +8,7 @@ library SafeMath{ contract Target{ function f() public returns(uint); + function g() public returns(uint, uint); } contract User{ @@ -26,5 +27,12 @@ contract User{ // As the value returned by the call is stored // (unused local variable should be another issue) uint b = a.add(1); + + t.g(); + + (uint c, uint d) = t.g(); + + // Detected as unused return + (uint e,) = t.g(); } } diff --git a/tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol-0.4.25.zip b/tests/e2e/detectors/test_data/unused-return/0.4.25/unused_return.sol-0.4.25.zip index bfe469a89abf4895a2d531565516f73cb9def65c..8f64587ae63b2629918c62601162154b7f26daf6 100644 GIT binary patch delta 3527 zcmV;&4LI_Q8MPc6P)h>@KL7#%4gk8Qm{vy$A=ilw008}V001SEP7ElKLn?puLq3k% z8(|US<+$<-R-TXbNE-97FH-K9mq@1&+0=A#oo)!e&BRa?>@UL&m{xMKPC59HRBdp% z=21uU`e(J)nIK!A@2|0&c!lEy*`$6J@bTzR0++%X74&wZn6#h1kMh|O&&#|HOPZzP z?s)rBa!^9#l^HqFf@jTvRq%i5>+3|7Hil_%eVaDMR#?X^H&0Yavt#$y6EKvE4+B{s zFi3}ejZhr^w$(<3f=3T4)m`eAP;V9yck3iq4W1K}q1jJ{!8a7{9=czXP!utLcg*TV zWW6(wO>AzzE*)r@_ZV|!?})rGms+0SKBXm_3nVkYAUF?D&0P&AW&VG*nqB-F(W8@5 zm(Dmgu;zlW(Rm)0Z-I7Q*}$sKs$f_y)(r)x9qZVw?whau461w^e4gIt!aYG~1mcZQ zM{Uqdj^iuRgI|NgsOA>TZ~d#9oQM1}vOJ1mw!&fxQilO<-sc6h7*Pv!O)`%YcK$Y* z&_h^s9)jv!Mm*b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+Q=RsK?h&Y;<)w6X?Hd2qQc-W;I*s zsVz%5=EIzK(4=_4Bvohraml_eNzj$lRnwbCy+SX_zt`chf#tqhZVx-7t!Uj(?uZYC z!Z9sM$4bDCMX7HHv_i^k8m7N<(b69b-FCx&At`!=J4vWd>OdC3^irux{d%2m!tQM! zDkl{)*t{hStuJ1t(7E+>##{OfJsxWZ1EdirwvR_Ci2f&O_a`?t8zr%)4r;b^8&Y6G zt=;czV{eL1`7!c-ZS~zg)g7?Yt`04B;U9H8S#0G!yX1{i;JT-lTI8rY9Huloxn#?K zoh(?TORuzP3)SfSd*ROJJDMp>E1zS~K;Cn&^sUBw#*d$g0;jlbwHm);$6_ehBePxj z4*U`Y*KMnxqNrInS;kQuw+NFCcQ?CpKQpo0)Dbqq5n)jl&@Yh4)e-Nt>H+~AJWtGd z4sT`Ugh*DEt7^TYELaM=tD1LZYOA+@pGOP;1l~$Mma(xSLhM2wcVpT0((k%tx+E$u zwizYiW1UMhXv3YZp5Hy@F)oy}ei;hGN=F z%pVO=27Mx0axcIxPTxhf@Xxq5`<>0adML>fwO=MJhCKKfJ3{k7Y5CX&FOH{wFmnN` zK|0Ds7RG5iJ-qbK;G$?2Q8W6NqwTmF00U-#!~{ra#vs@R%JS#tYCWxI?T$n=n_^UN zz^|ZMq${BkDp)&-7Z3uq>p!&N*e}L*SY0|>QmPF)k)&SHfzPhf4bixDUQeSxNRCsQ zx;a~o_L0i&Jo$1_%AShj(1r1TBzr2NK*%21tCIhg?FiL|dy3UJs$vq}Qrcdl(aDMy zn~Ypz&Xu5-1APrcHsI~Vq!3rH35}a?w!q3g${u)Yn=;+rTrBVW|8+b708mQ-0zU&k z00ICG06dL%R`uV#Y2XV00Nqgl03`qb00000000000Du7i0001WZgq2${tYn(BMbll F001Tf2>}2A diff --git a/tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol b/tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol index d1c1895987..ef22b63aed 100644 --- a/tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol +++ b/tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol @@ -8,6 +8,7 @@ library SafeMath{ contract Target{ function f() public returns(uint); + function g() public returns(uint, uint); } contract User{ @@ -26,5 +27,12 @@ contract User{ // As the value returned by the call is stored // (unused local variable should be another issue) uint b = a.add(1); + + t.g(); + + (uint c, uint d) = t.g(); + + // Detected as unused return + (uint e,) = t.g(); } } diff --git a/tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol-0.5.16.zip b/tests/e2e/detectors/test_data/unused-return/0.5.16/unused_return.sol-0.5.16.zip index 90d77686955906a58c0d3cdc78f60a622bd82581..13d0d7a3237383a7148422b90c85faf13a7ddc0e 100644 GIT binary patch delta 3534 zcmV;<4KebU8N(bHP)h>@KL7#%4gkBRm{#0i?t7OF000wnkr-8f^+P_6+Z$mKi;1jb1=*y27Vz=tPXd?18Wr?*qL{RwzK`Feu6l{SWHaDAIL##UIzEjLe8NwZ`3*Ap<5iw^@?ATUUWeT`5Y z{X_F0d^9)SSxp!*Npl&7GqIh7^fewUeP#R9Gy3G5b*N(d)XSor;ORgFOSE zgboMb7Ol2GucTF60?#6rACD+q3?Q&)8J5ibGHv3s<$EGXNeMNq9hsh5#Y+hqeLa=E zU0QL15KNg{&oWYoNUzqpQuRMWyoPNKkc&iYp4-Wg0+@Gq`xNz zq%nuU>Q&Z%6OTYs?X?PSEg_neQR=xG_>59UQDK!)uWRYSY3Ljelw&6@b8@LK4B6hp zAo5_28c+Wr>vpdiMGT++ggOi!ii5H>LQ% z z?@w!=>8c4j1;Cd(M%S#74ED`e{J(^GtM=o68#1SWvL`_M1TM_0RMdgL>&`XOB%zaF zX^JI?XV%Mz-ZE@93f{(!`ML2Md4lArFPP=G=9KRWWBBDn=)ZP-Rc1#H|3YBIvpox3 zLHsa(B3fHmzrmi*AIF_I}C6A55rvm?(H8on~aDUfwVn(V(>}b_XE@ zNVw@RPCG<{l7HE>H-k0?N_u`V_e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F$Fc1H{ zsFTMhZ`zf5eFiRnf7QT*86Zv?Gw+({=nFA3e`s9J>APHz6Gjf>4@DcaIo#kQulCLC z5Z`2a@6j1n7B{cld4PG*yFOL&0xUTpgOU5p0JNyq?;o)vPWon)F1T-z4eZAHLeo6q zYb1voYO0khA5vql!lxd2Vp77LK;?jXwIsHCIY8L)tx)mZ z5Xj_hjd+58IYt4_OQFwL1n7+W)I|K*VR$W*Ca8B&BmDm5yDj%NfvvZ3Lv6F4O!&Up%dWZ#s@t|-zi@uxpPkSH`0NI3z2IEGu|+Lb;O*Qb(kXdQl-x3f7C zAckk~uq#ppNx8y@ht#2fym>5?KNFjnJ_9h?<0b6~hDd%t9fUxJ1wjuypm^}zm5h-F zdTUJTQUfkhQf_}~dv=-7Q=>m*VN=TXQ!urivjoTuqJ1+kwaB6>Plv#N`3>ham%&yn zYIqTU?l?h()I}Rq3=jU#lZd6N9^P?(IUB8_zt&zrNLApeNitfg*uj10Dc9s|6j-DI z6c-=tsD4$JRIi+l7m`qW7TOl^EApc0R)D5P#M4H}-rh-12aWz6tK2HbV@Sj7q+rHt z+20mx5F)DZ0q6#}@|CF?eu_Sga}2Yk;Glnh;&fJuSw!2AAt@V7?L+XY&Cti--?q4j z385)R=@NzkCmoy@1>%EI0eit#7ELdTEsKR_VG=UL^2q)U^Su@q$-> z$`0Wov0tOo0OIG5g=p^^|3120R84PW>u1xdLQW_s-_D!QO6)OYcSdYU3H4+ z`{;5KP)h*k9w?I!^!qB>(^b000000001!0S-I{E(`zw F003#d{7(P? diff --git a/tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol b/tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol index 08d0eb3a59..279ac627e7 100644 --- a/tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol +++ b/tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol @@ -8,6 +8,7 @@ library SafeMath{ abstract contract Target{ function f() public virtual returns(uint); + function g() public virtual returns(uint, uint); } contract User{ @@ -26,5 +27,12 @@ contract User{ // As the value returned by the call is stored // (unused local variable should be another issue) uint b = a.add(1); + + t.g(); + + (uint c, uint d) = t.g(); + + // Detected as unused return + (uint e,) = t.g(); } } diff --git a/tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol-0.6.11.zip b/tests/e2e/detectors/test_data/unused-return/0.6.11/unused_return.sol-0.6.11.zip index 5f04b6a004272faa5ec877d604f9918a52156b31..30ae730404a451514b5337af4a27929e64888887 100644 GIT binary patch delta 3429 zcmV-r4Vv<-7}OgZP)h>@KL7#%4gkHTm{xXwPoF3a003ih001SE?h7c9Ln?puLq3k% z8(|US<+$<-R-TXbNE-97FH-K9mq@1&+0=A#oo)!e&BRa?>@UL&m{xMKPC59HRBdp% z=21uU`e(J)nIK!(HdN@ZpgDj!Zz#V(sF4mjP(^MRXIpxf8U(#FSCfg0H(o$B97XW0 zByIwGjl5Q2A_lTDW+`Ep7sY>L8KDRdTbHieTaLmd1eFZPea^@O=1`B-86Bj zKG0}d`wLIH#m~|e*oQ?oTmEIin$|w3Pi{l>`(!3NIJRzyU|>+W7;Oa?1sXG;OKEq- zIIcPPWf1}^;PJYh|4y3?`+F=qT{_>%B{oJejhr?EnOT{&jC*_uR;%EJ#3f!3n}lTn zT3)mNGrXz6mL8BG5kG$fc-wg!K&hhmAY&EWM&0BX0Ryzp+*HvnXWr5+t7Vg^WhzmB zHfkeJ0?q4-j@G)%^cq$Yi^T^yr8DJ0#P;532|ttV8*+Zle_%9|(!I($rXJ&uUhCSM zv?t(5(QQ{gUpc}O!rGnZe?1LDmF_caD|CWm^~w@{{3l*vq40mP_Kmg%O6fnxc1R6f zp@Eal(*nm^vs!IU4DJ)jWJ7BU9w8`*Y`l(qmZ(+T8T*lQ(1{@FDD_Io1&Bg@UfgeM z<9x>lleC~NJmw5wN+frAsa1Uyoz;dViED`ueL)1<;Sk-A?%bn|b40z~4F@ZyQZ;!_ ztUx>|wgR0e zhw;#PhwQrglS!fs&Nb|rc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H>-G7z4H1E69uL^5tt(kUE$FYikV zDv8{9bCntTQu5+A?3L&_xr5P5te9`QM;q#vJUo7QF>7*;^@e;|j$(lHQhM_+u);BE z7u^?Mrhu{nc2Il1F8e`O(GlBLJB%h@Pqa^x(3)B0{z zOB!veRWE5(g~98035-hdHpfDP$=#VfWE@~2%K^`Ib|4PK+DNr`%!zK{lrlN=#+O!U z9s&V67#41bhbxPj#5GH1(@E>u#l}^#Zd#UevwmE>$r)h03NsNoIOhhqqhZDW-%rnq pP)h*w0LM;~g$+pt!wUca005Zqy5ax; diff --git a/tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol b/tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol index 08d0eb3a59..279ac627e7 100644 --- a/tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol +++ b/tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol @@ -8,6 +8,7 @@ library SafeMath{ abstract contract Target{ function f() public virtual returns(uint); + function g() public virtual returns(uint, uint); } contract User{ @@ -26,5 +27,12 @@ contract User{ // As the value returned by the call is stored // (unused local variable should be another issue) uint b = a.add(1); + + t.g(); + + (uint c, uint d) = t.g(); + + // Detected as unused return + (uint e,) = t.g(); } } diff --git a/tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol-0.7.6.zip b/tests/e2e/detectors/test_data/unused-return/0.7.6/unused_return.sol-0.7.6.zip index ac668ccc923fd53f8f875d8ab49578e6bf687e0a..08ecd82e6a2d57b269fc16e1d584da2977283575 100644 GIT binary patch delta 3353 zcmV+!4d(LS7l|7iP)h>@KL7#%4gkHTm{!joAOYPB005h9001SEp$jOHLn?puLq3k% z8(|US<+$<-R-TXbNE-97FH-K9mq@1&+0=A#oo)!e&BRa?>@UL&m{xMKPC59HRBdp% z=21uU`e(J)nIK#AT4R|*FWeiD&+Y?Ave31|46Q0KES;`b=fNRGaLZ|0;Jl!d1$N!@ zA&T>N7~*l6y)OKi)Bo~=0vUgMdgmvKe)q3~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