Skip to content

Conversation

michalmuskala
Copy link
Member

With changes to OTP 19, dialyzer started emitting warnings for
the struct update syntax where variable could only be that struct.
For example:

def foo(%Foo{} = struct), do: %Foo{struct | bar: :baz}

I'm not 100% sure this is the correct fix. I'm not sure how to test this properly. Do we have some way of testing for dialyzer warnings?

@josevalim
Copy link
Member

There is a file called dialyzer_test. :)

@michalmuskala
Copy link
Member Author

The obvious answer is sometimes the hardest to find 😄 I'll add a test

With changes to OTP 19, dialyzer started emitting warnings for
the struct update syntax where variable could only be that struct.
For example:

    def foo(%Foo{} = struct), do: %Foo{struct | bar: :baz}
@michalmuskala
Copy link
Member Author

@josevalim added test, and amended the fix. It was not fixing anything before 😞

@josevalim josevalim merged commit 270c983 into elixir-lang:master Jul 27, 2016
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

@dokie
Copy link

dokie commented Jul 27, 2016

Many thanks for this super rapid turnaround.
👍 😄

josevalim pushed a commit that referenced this pull request Aug 4, 2016
With changes to OTP 19, dialyzer started emitting warnings for
the struct update syntax where variable could only be that struct.
For example:

    def foo(%Foo{} = struct), do: %Foo{struct | bar: :baz}

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants