[
https://issues.apache.org/jira/browse/THRIFT-5993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer reassigned THRIFT-5993:
----------------------------------
Assignee: Jens Geyer
> Haxe generator: cross-package import shadowing and Haxe base-type name
> collisions
> ---------------------------------------------------------------------------------
>
> Key: THRIFT-5993
> URL: https://issues.apache.org/jira/browse/THRIFT-5993
> Project: Thrift
> Issue Type: Bug
> Components: Haxe - Compiler
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Priority: Major
>
> The Haxe code generator has two related type-naming issues:
> 1. *Cross-package import shadowing*: When a struct or service references a
> same-named type from another package (e.g. struct {{Foo}} in package A
> imports {{B.Foo}}), the generator emits {{import B.Foo;}} inside the file
> that defines {{Foo}}. This causes the Haxe compiler to reject the file
> because the import name collides with the enclosing class name. Additionally,
> when multiple referenced packages each export an identically-named type, the
> generator emits multiple {{import}} statements with the same short name,
> producing an unresolvable ambiguity error. Fix: {{haxe_thrift_add_import()}}
> now suppresses any import whose short name matches either the entity being
> defined or an already-imported short name.
> 2. *Haxe built-in base-type name collision*: When a Thrift struct, enum, or
> service is named {{String}}, {{Bool}}, {{Float}}, {{Int}}, or {{Void}}, the
> generated Haxe file uses that name verbatim as the class/enum identifier and
> file name. This shadows the corresponding Haxe built-in type throughout the
> file, causing compilation failures in any generated code that uses those
> built-ins. Fix: add {{make_haxe_user_type_name()}} which extends
> {{get_cap_name()}} to append {{_}} when the result is one of the five Haxe
> base-type names. Apply it at all struct/enum/service file-name, class-header,
> import, and {{type_name()}} sites.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)