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

Dialyzer output #98

Closed
johnkelly opened this issue May 13, 2016 · 11 comments
Closed

Dialyzer output #98

johnkelly opened this issue May 13, 2016 · 11 comments

Comments

@johnkelly
Copy link

mix.lock

"gettext": {:hex, :gettext, "0.11.0"},

Relevant mix.exs dialyzer configuration in project function

      dialyzer: [
        plt_add_deps: true,
        plt_file: ".local.plt"
      ]

On a brand new elixir 1.2.5 phoenix project, I get the following output from the dialyzer.

mix dialyzer

gettext.ex:1: The inferred type for the 1st argument of 'MACRO-dgettext'/3 ({_,_}) is not a supertype of #{}, which is expected type for this argument in the callback of the 'Elixir.Gettext.Backend' behaviour
gettext.ex:1: The inferred type for the 1st argument of 'MACRO-dgettext'/4 ({_,_}) is not a supertype of #{}, which is expected type for this argument in the callback of the 'Elixir.Gettext.Backend' behaviour
gettext.ex:1: The inferred type for the 1st argument of 'MACRO-dngettext'/5 ({_,_}) is not a supertype of #{}, which is expected type for this argument in the callback of the 'Elixir.Gettext.Backend' behaviour
gettext.ex:1: The inferred type for the 1st argument of 'MACRO-dngettext'/6 ({_,_}) is not a supertype of #{}, which is expected type for this argument in the callback of the 'Elixir.Gettext.Backend' behaviour
@whatyouhide
Copy link
Contributor

@josevalim any idea of what's going on here?

@josevalim
Copy link
Contributor

Not sure. :(

@johnkelly
Copy link
Author

When I search phoenix repo for dgettext or dngettext this turns up:

https://github.com/phoenixframework/phoenix/blob/bd4b9984397497a48b99c7b47d8b057c380af71b/installer/templates/new/web/views/error_helpers.ex#L35-L37

Is it because the first argument is an atom?

@josevalim
Copy link
Contributor

@johnkelly the typespecs for those seem correct though: https://github.com/elixir-lang/gettext/blob/master/lib/gettext.ex#L501

I am thinking then it may rather be an issue with the macros defined in the Gettext backend?

@whatyouhide
Copy link
Contributor

@josevalim is right, dialyzer is complaining about the macros defined by Gettext when you call use Gettext in your gettext module. As you can see, it mentions 'MACRO-dgettext'/3 and others but Gettext.*gettext (which you linked to above) are functions.

I really have no idea what's going on here 😕

@whatyouhide
Copy link
Contributor

@ericmj and @fishcakez, I'm gonna go ahead and ping you as well here cause I really don't know where to start. Any ideas?

@ericmj
Copy link
Contributor

ericmj commented Jul 3, 2016

Sorry, I don't use dialyzer.

@jeremyjh
Copy link

jeremyjh commented Jul 4, 2016

I put this in my gettext.ex module to silence these warnings.

   @dialyzer [{:nowarn_function, 'MACRO-dgettext': 3},
             {:nowarn_function, 'MACRO-dgettext': 4},
             {:nowarn_function, 'MACRO-dngettext': 5},
             {:nowarn_function, 'MACRO-dngettext': 6},
            ]

@whatyouhide
Copy link
Contributor

@josevalim do you think it would be reasonable to put that in Gettext backends when we use Gettext?

@josevalim
Copy link
Contributor

@whatyouhide I think we should rather fix this. @jeremyjh can you provide a simple app that reproduces those warnings so it makes it easier for us to fix this? Thank you!

@fishcakez
Copy link

fishcakez commented Jul 4, 2016

This is fixed on Elixir master and the v1.3 branch, so will be included in v1.4.0 and v1.3.2 whenever they happen.

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

No branches or pull requests

6 participants