We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have the following code:
{dx, dy} = Matrex.size(matrix) elems = dx * dy
Matrex.size/1 has a spec of size(matrex()) :: {index(), index()} where index() is an alias for pos_integer().
Matrex.size/1
size(matrex()) :: {index(), index()}
index()
pos_integer()
When I use elems later on in code that expects an index(), gradient incorrectly complains that it has type integer():
elems
integer()
lib/noise/printer.ex: Matrex.reshape()/3 call arguments on line 11 don't match the function type: (list(matrex()), index(), index() -> matrex()) (list(element()), index(), index() -> matrex()) (matrex(), index(), index() -> matrex()) (Range.t(), index(), index() -> matrex()) (Enumerable.t(), index(), index() -> matrex()) Inferred argument types: %{required(:__struct__) => Matrex, required(:data) => binary()}, 1, integer()
for now im working around this with this function:
@compile {:inline, hack_to_make_gradient_realize_that_pos_int_times_pos_int_is_always_pos_int: 2} @spec hack_to_make_gradient_realize_that_pos_int_times_pos_int_is_always_pos_int( pos_integer(), pos_integer() ) :: pos_integer() defp hack_to_make_gradient_realize_that_pos_int_times_pos_int_is_always_pos_int(a, b), do: a * b
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have the following code:
Matrex.size/1
has a spec ofsize(matrex()) :: {index(), index()}
whereindex()
is an alias forpos_integer()
.When I use
elems
later on in code that expects anindex()
, gradient incorrectly complains that it has typeinteger()
:for now im working around this with this function:
The text was updated successfully, but these errors were encountered: