Skip to content

Update macro_log typespec #10010

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lukaszsamson
Copy link
Contributor

log_allowed which is called by macro_log actually accepts location() or #{}. I noticed this issue when running dialyzer on elixir codebase. There are justified usages of macro_log with an empty map argument and dialyzer emits:

lib/logger.ex:1005:41: The call 'Elixir.Logger':'__do_log__'
         (_level@2 ::
              'alert' | 'critical' | 'debug' | 'emergency' | 'error' |
              'info' | 'notice' | 'warning',
          _message_or_fun@1 :: any(),
          #{},
          map()) will never return since it differs in the 3rd argument from the success typing arguments: 
         ('alert' | 'critical' | 'debug' | 'emergency' | 'error' |
          'info' | 'notice' | 'warning',
          any(),
          #{'file' := string(),
            'line' := non_neg_integer(),
            'mfa' := {atom(), atom(), non_neg_integer()}},
          map())

`log_allowed` which is called by `macro_log` actually accepts `location()` or `#{}`. I noticed this issue when running dialyzer on elixir codebase. There are justified usages of `macro_log` with an empty map argument and dialyzer emits:

```
lib/logger.ex:1005:41: The call 'Elixir.Logger':'__do_log__'
         (_level@2 ::
              'alert' | 'critical' | 'debug' | 'emergency' | 'error' |
              'info' | 'notice' | 'warning',
          _message_or_fun@1 :: any(),
          #{},
          map()) will never return since it differs in the 3rd argument from the success typing arguments: 
         ('alert' | 'critical' | 'debug' | 'emergency' | 'error' |
          'info' | 'notice' | 'warning',
          any(),
          #{'file' := string(),
            'line' := non_neg_integer(),
            'mfa' := {atom(), atom(), non_neg_integer()}},
          map())
```
Copy link
Contributor

github-actions bot commented Jul 1, 2025

CT Test Results

    2 files     70 suites   1h 6m 22s ⏱️
1 588 tests 1 333 ✅ 254 💤 1 ❌
1 840 runs  1 527 ✅ 312 💤 1 ❌

For more details on these failures, see this check.

Results for commit 8063623.

♻️ 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

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants