
* Add compiler warnings Add include_type annotation to position Add warning for unused includes Add warning for unused stateful annotation Add warning for unused functions Add warning for shadowed variables Add division by zero warning Add warning for negative spends Add warning for unused variables Add warning for unused parameters Change the ets table type to set for unused vars Add warning for unused type defs Move unused variables warning to the top level Temporarily disable unused functions warnings Add all kinds of warnings to a single ets table Enable warnings separately through options Use when_option instead of enabled_warnings Turn warnings into type errors with warn_error option Enable warning package warn_all Re-enable unused functions warnings Report warnings as type errors in a separate function Make unused_function a recognized warning Report warnings as a result of compilation Fix tests and error for unknown warnings options Fix dialyzer warnings Do not show warning for variables called "_" Move warnings handling into a separate module Do not show warning for unused public functions in namespaces Add src file name to unused include warning Mark public functions in namespaces as used Add tests for added warnings Add warning for unused return value Add test for turning warnings into type errors * Update CHANGELOG
50 lines
1.0 KiB
Plaintext
50 lines
1.0 KiB
Plaintext
// Used include
|
|
include "Pair.aes"
|
|
// Unused include
|
|
include "Triple.aes"
|
|
|
|
namespace UnusedNamespace =
|
|
function f() = 1 + g()
|
|
|
|
// Used in f
|
|
private function g() = 2
|
|
|
|
// Unused
|
|
private function h() = 3
|
|
|
|
contract Warnings =
|
|
|
|
type state = int
|
|
|
|
type unused_type = bool
|
|
|
|
entrypoint init(p) = Pair.fst(p) + Pair.snd(p)
|
|
|
|
stateful entrypoint negative_spend(to : address) = Chain.spend(to, -1)
|
|
|
|
entrypoint shadowing() =
|
|
let x = 1
|
|
let x = 2
|
|
x
|
|
|
|
entrypoint division_by_zero(x) = x / 0
|
|
|
|
stateful entrypoint unused_stateful() = 1
|
|
stateful entrypoint used_stateful(x : int) = put(x)
|
|
|
|
entrypoint unused_variables(unused_arg : int) =
|
|
let unused_var = 10
|
|
let z = 20
|
|
z
|
|
|
|
// Unused functions
|
|
function unused_function() = ()
|
|
function recursive_unused_function() = recursive_unused_function()
|
|
function called_unused_function1() = called_unused_function2()
|
|
function called_unused_function2() = called_unused_function1()
|
|
|
|
function rv() = 1
|
|
entrypoint unused_return_value() =
|
|
rv()
|
|
2
|