Skip to main content

W0075 - ?UNCHECKED_CAST macro usage

Example

-module(main).
-include("eqwalizer.hrl").
-export([test/1]).

-spec test(atom()) -> ok.
test(A) ->
?UNCHECKED_CAST(A, ok).
%%^^^^^^^^^^^^^^^^^^^^^^ 💡 warning: W0075: Avoid `?UNCHECKED_CAST`: this macro bypasses eqwalizer type checking.

Explanation

This diagnostic reports occurrences of the ?UNCHECKED_CAST macro in the codebase. This macro bypasses eqwalizer's type checking by asserting that a value has a specific type without any runtime verification.

Avoid using ?UNCHECKED_CAST — fix the underlying type issue, or use ?CHECKED_CAST as a type-safe alternative.

See also