I have X behavior and callback function with parameter type:
%{a: any}
Module Y implements the behavior of X, and the callback function in the implementing module Y has the parameter type:
%{a: any, b: any}
Dialyzer dislikes and complains:
(#{'a':=_, 'b':=_, _=>_}) is not a supertype of #{'a':=_}
This means that the dialyzer is trying to determine whether the type of the callback parameter in the implementation of module Y is a supertype of type param in the behavior of X. In other words, it asks:
Is the behavior of the callback type X a %{a: any}subtype implementing the module Y parameter type %{a: any, b: any}?
Why does the dialyzer expect the paramback type of the behavior callback to be a subtype instead of a supertype?
:
S T, S <: T, S , T. , S masquerade T.
, T, - S. - . , , .
T
S
, .
. , SO Erlang (Elixir) Dialyzer - .
. X %{a: any}, , , , . %{a: 1}. %{a: any, b: any}, %{a: any}, , %{a: 1}, .
X
%{a: 1}
, %{a: any, b: any}, %{a: any}, , %{a: any} %{a: any, b: any}, %{a: 1, b: 2} - .
%{a: 1, b: 2}
Source: https://habr.com/ru/post/1685777/More articles:Is there a way to create a nonzero array from a range? - arraysOverriding the instance method of the parent class (non-static) javascript - javascriptAngular 2 lazy loading modules using aot and another pipeline - angularErlang (Elixir) Dialyzer - confusing supertype error - erlangСписок правильных слов из картографирования телефона - javascriptThe Game X Game Center icon is at the top of the notch - ioshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1685779/overflowing-stack-when-composing-lots-of-functions-together&usg=ALkJrhhD9rnRFIf2OYP2RK59HmsmesTVQABuild an application on Xcode 9 that focuses on iOS 11 but has compatibility mode on iPhone X - iosChange html svg cricle fill css when clicking on - htmlhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1685782/how-to-convert-letters-to-numbers-in-javascript&usg=ALkJrhh9ClXaL41dq1oJMoJYpqyCsEYKGQAll Articles