Skip to content
New issue

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

Wrong type in receive...after Timeout #551

Open
arcusfelis opened this issue Aug 1, 2023 · 0 comments
Open

Wrong type in receive...after Timeout #551

arcusfelis opened this issue Aug 1, 2023 · 0 comments

Comments

@arcusfelis
Copy link

arcusfelis commented Aug 1, 2023

Hi,

Code:

-spec wait_response(non_neg_integer() | infinity) -> _.
wait_response(Timeout) ->
    receive
       some_message ->
            ok
    after Timeout -> % Line 80
        erlang:demonitor(Mon, [flush]),
        error(timeout)
    end.

Fails with:

    The variable on line 80 at column 11 is expected to have type integer() but it has type non_neg_integer() | infinity

But Timeout = infinity is a pretty common way to disable timeouts (or allow the caller to wait forever).

Also the same issue if I use a built-in type timeout() in the spec.

@arcusfelis arcusfelis changed the title Wrong type in receive...after Tiemout Wrong type in receive...after Timeout Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant