You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Sylwester Lachiewicz (Jira)" <ji...@apache.org> on 2026/09/08 13:46:00 UTC

[jira] [Comment Edited] (THRIFT-182) Compiler should check for name collisions

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

Sylwester Lachiewicz edited comment on THRIFT-182 at 9/8/26 1:45 PM:
---------------------------------------------------------------------

Duplicate field names are rejected at parse time: {{t_struct::append}} returns false when {{get_field_by_name}} already holds the name ([t_struct.h:97|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/parse/t_struct.h#L97]), and [thrifty.yy:808|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/thrifty.yy#L808] turns that into a hard error, "field identifier/name has already been used". Resolving as Fixed.


was (Author: slachiewicz):
The compiler performs typename collision detection ([compiler/cpp/src/thrift/parse/t_program.h|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/parse/t_program.h] lines 135-138, {{validate_unique_members()}}). Resolving as Fixed.

> Compiler should check for name collisions
> -----------------------------------------
>
>                 Key: THRIFT-182
>                 URL: https://issues.apache.org/jira/browse/THRIFT-182
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General)
>            Reporter: Bryan Duxbury
>            Priority: Minor
>
> It'd be nice if the Thrift compiler checked for struct field name collisions at compile time. Right now, you have to wait for the compilation/execution of the generated code to throw some error. It should be simple to check names simultaneously.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)