From dev-return-52111-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Thu Mar 22 01:59:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id EF6E0180651 for ; Thu, 22 Mar 2018 01:59:03 +0100 (CET) Received: (qmail 68134 invoked by uid 500); 22 Mar 2018 00:59:02 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 68123 invoked by uid 99); 22 Mar 2018 00:59:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2018 00:59:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 38F001A0A1F for ; Thu, 22 Mar 2018 00:59:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -101.511 X-Spam-Level: X-Spam-Status: No, score=-101.511 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id U6AJbnhCuQud for ; Thu, 22 Mar 2018 00:59:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 4829C5FDC3 for ; Thu, 22 Mar 2018 00:59:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B81BAE0D4B for ; Thu, 22 Mar 2018 00:59:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 76DB4214D3 for ; Thu, 22 Mar 2018 00:59:00 +0000 (UTC) Date: Thu, 22 Mar 2018 00:59:00 +0000 (UTC) From: "James E. King, III (JIRA)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (THRIFT-4495) Erlang records should allow 'undefined' for non-required fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-4495?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] James E. King, III resolved THRIFT-4495. ---------------------------------------- Resolution: Fixed Fix Version/s: 0.12.0 > Erlang records should allow 'undefined' for non-required fields > --------------------------------------------------------------- > > Key: THRIFT-4495 > URL: https://issues.apache.org/jira/browse/THRIFT-4495 > Project: Thrift > Issue Type: Improvement > Components: Erlang - Compiler > Affects Versions: 0.11.0 > Reporter: David Hull > Assignee: David Hull > Priority: Major > Fix For: 0.12.0 > > > The Erlang records created by the Erlang code generator allow only the ty= pe declared by the Thrift definition file. If a field is not required, howe= ver, the Erlang record should also allow the value=C2=A0{{undefined}} (this= is similar to a null value in other languages). > Erlang includes a tool, dialyzer, that does type analysis of Erlang code.= Until Erlang 19, dialyzer implicitly added `undefined` as an allowed type = for all record fields, but as of Erlang 19 it no longer does. This means th= at dialyzer now emits error messages whenever a record is constructed and i= nitial values are not specified for all of its fields. > So, for example, the following thrift definition > {noformat} > struct Test { > 1: required i32 a > 2: i32 b > 3: optional i32 c > }{noformat} > currently produced the following Erlang record: > {noformat} > -record('Test', {'a' :: integer(), > 'b' :: integer(), > 'c' :: integer()}).{noformat} > =C2=A0However it should produce the following: > {noformat} > -record('Test', {'a' :: integer(), > 'b' :: integer() | undefined, > 'c' :: integer() | undefined}).{noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)