You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Anthony Molinaro (Commented) (JIRA)" <ji...@apache.org> on 2012/03/05 19:21:57 UTC

[jira] [Commented] (THRIFT-1532) The type specifications in the generated Erlang code should include "undefined" where it's used as a default value

    [ https://issues.apache.org/jira/browse/THRIFT-1532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13222483#comment-13222483 ] 

Anthony Molinaro commented on THRIFT-1532:
------------------------------------------

So I can't quite get dialyzer to cause errors on a generated file, do you happen to have a small .thrift file and test code which will fail.

Also, I have a feeling that the real fix it to get rid of '= undefined' in the struct definition.  You only need '=' when you have a default value and should leave off 'undefined'.
                
> The type specifications in the generated Erlang code should include "undefined" where it's used as a default value
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1532
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1532
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>    Affects Versions: 0.8
>         Environment: Erlang/OTP R15B.
>            Reporter: Björn Bylander
>            Priority: Minor
>              Labels: compiler, dialyzer, erlang, specification, type
>         Attachments: THRIFT-1532_type_allows_undefined.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The Erlang code generated by the compiler for, for example, an integer field of a struct sets a default value of 'undefined' but the type to just 'integer()' which doesn't include the default value. This makes Dialyzer complain if the field has not been initialized as it gets set to 'undefined' instead of an integer value.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira