Fix warnings reporting and stdlib warnings (#367)

* Fix stdlib warnings

* Mark unused includes when used from non-included files

* Do not mark indirectly included files as unused

* Show unused include warning only for files that are never used

* Remove unused include from Option.aes

* Consider functions passed as args as used

* Return warnings as a sorted list

* Fix failing tests

* Fix dialyzer warning

* Fix warning in Func.aes
This commit is contained in:
Gaith Hallak
2022-06-14 12:22:32 +04:00
committed by GitHub
parent b3767071a8
commit b599d581ee
13 changed files with 75 additions and 56 deletions
+6 -2
View File
@@ -264,7 +264,9 @@ warnings() ->
<<?PosW(44, 3)
"The function `called_unused_function2` is defined but never used.">>,
<<?PosW(48, 5)
"Unused return value.">>
"Unused return value.">>,
<<?PosW(60, 5)
"The function `dec` is defined but never used.">>
]).
failing_contracts() ->
@@ -831,7 +833,9 @@ failing_contracts() ->
<<?Pos(44, 3)
"The function `called_unused_function2` is defined but never used.">>,
<<?Pos(48, 5)
"Unused return value.">>
"Unused return value.">>,
<<?Pos(60, 5)
"The function `dec` is defined but never used.">>
])
].
+1 -1
View File
@@ -1,4 +1,4 @@
// This should include Lists.aes implicitly, since Option.aes does.
include "List.aes"
include "Option.aes"
contract Test =
+11
View File
@@ -47,3 +47,14 @@ contract Warnings =
entrypoint unused_return_value() =
rv()
2
namespace FunctionsAsArgs =
function f() = g()
private function g() = h(inc)
private function h(fn : (int => int)) = fn(1)
// Passed as arg to h in g
private function inc(n : int) : int = n + 1
// Never used
private function dec(n : int) : int = n - 1