
* 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
28 lines
609 B
Erlang
28 lines
609 B
Erlang
-module(aeso_warnings).
|
|
|
|
-record(warn, { pos :: aeso_errors:pos()
|
|
, message :: iolist()
|
|
}).
|
|
|
|
-opaque warning() :: #warn{}.
|
|
|
|
-export_type([warning/0]).
|
|
|
|
-export([ new/1
|
|
, new/2
|
|
, warn_to_err/2
|
|
, pp/1
|
|
]).
|
|
|
|
new(Msg) ->
|
|
new(aeso_errors:pos(0, 0), Msg).
|
|
|
|
new(Pos, Msg) ->
|
|
#warn{ pos = Pos, message = Msg }.
|
|
|
|
warn_to_err(Kind, #warn{ pos = Pos, message = Msg }) ->
|
|
aeso_errors:new(Kind, Pos, lists:flatten(Msg)).
|
|
|
|
pp(#warn{ pos = Pos, message = Msg }) ->
|
|
lists:flatten(io_lib:format("Warning~s:\n~s", [aeso_errors:pp_pos(Pos), Msg])).
|