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

Fix types in queue #8094

Open
wants to merge 2 commits into
base: maint
Choose a base branch
from

Conversation

gilbertwong96
Copy link
Contributor

As I introduced the WhatsApp/eqwalizer along with the function queue:delete/2 usage in my project, eqwalizer reports the error:

eqWAlizer [incompatible_types]: `Q2`.
Expression has type:   queue:queue(term())
Context expected type: queue:queue(number())

  queue:queue(term()) is not compatible with queue:queue(number())
  because
  term() is not compatible with number()
        See https://fb.me/eqwalizer_errors#incompatible_types

Here is the example:

image

After I replace the queue:delete/2 with the queue:in/2 in above example, the error report disappears.

image

I suppose it is caused by the specification of the queue:delete/2:

-spec delete(Item, Q1) -> Q2 when
      Item :: T,
      Q1 :: queue(T),
      Q2 :: queue(T),
      T :: term().

The T should not be specified as term() here.

Copy link
Contributor

github-actions bot commented Feb 7, 2024

CT Test Results

    2 files     89 suites   34m 49s ⏱️
1 929 tests 1 881 ✅ 48 💤 0 ❌
2 223 runs  2 173 ✅ 50 💤 0 ❌

Results for commit 5f45aea.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

lib/stdlib/src/queue.erl Outdated Show resolved Hide resolved
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Feb 7, 2024
@jhogberg
Copy link
Contributor

jhogberg commented Feb 13, 2024

Hi, thanks for the PR and sorry for the delay in getting back to you!

We're currently working on cleaning up the type language and will send in an EEP for that in the near future (hopefully within a few weeks). This PR is in line with the changes we have in mind and we'd really like to have it, but we need to hold off on merging this until the EEP has been accepted. :-)

@jhogberg jhogberg added the stalled waiting for input by the Erlang/OTP team label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stalled waiting for input by the Erlang/OTP team team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants