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

Invalid type check warning #14092

Closed
lpgauth opened this issue Dec 20, 2024 · 2 comments
Closed

Invalid type check warning #14092

lpgauth opened this issue Dec 20, 2024 · 2 comments

Comments

@lpgauth
Copy link

lpgauth commented Dec 20, 2024

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.18.0 (compiled with Erlang/OTP 27)

Operating system

MacOS 15.2

Current behavior

The following code:

case name_to_table(params["name"]) do
      nil ->
        send_resp(conn, :not_found, "")

      table ->
        ...
        dimensions =
          params_list(params, "dimensions", table.default_dimensions(), table.dimensions())
        ...
end

triggers the following warnings:

    warning: nil.default_dimensions/0 is undefined (module nil is not available or is yet to be defined)
    │
 27 │           params_list(params, "dimensions", table.default_dimensions(), table.dimensions())
    │                                                   ~
    │
    └─ lib/console_web/controllers/api/v1/report_controller.ex:27:51: ConsoleWeb.Api.V1.ReportController.show/2

    warning: nil.dimensions/0 is undefined (module nil is not available or is yet to be defined)
    │
 27 │           params_list(params, "dimensions", table.default_dimensions(), table.dimensions())
    │                                                                               ~
    │
    └─ lib/console_web/controllers/api/v1/report_controller.ex:27:79: ConsoleWeb.Api.V1.ReportController.show/2

Expected behavior

I expect no warnings since table cannot be nil.

@josevalim
Copy link
Member

Dup of #14058. It will be fixed on v1.19 but until then a tagged tuple should work!

@josevalim josevalim closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2024
@lpgauth
Copy link
Author

lpgauth commented Dec 20, 2024

@josevalim ah sorry, missed it. thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants