Jens-G opened a new pull request, #3478:
URL: https://github.com/apache/thrift/pull/3478

   ## Summary
   
   Fixes several Haxe code-generator bugs that caused generated Haxe code to 
fail compilation. All changes are covered by the existing 201-file codegen test 
suite (0 failures).
   
   ### THRIFT-5992 — Keyword/stdlib-type escaping, typedef import fix, FIELD_ID 
fix, test script
   
   Compiler generator fixes in \`t_haxe_generator.cc\`:
   
   - **Keyword escaping** (\`escape_haxe_keyword()\`): appends \`_\` to any of 
45 Haxe reserved keywords used as IDL field/function/parameter names; 
wire-format strings left unchanged
   - **Standard-library type collision** (\`get_cap_name()\` extended): appends 
\`_\` when a capitalized IDL type name matches a Haxe stdlib type (\`Array\`, 
\`Class\`, \`Dynamic\`, \`Enum\`, \`Lambda\`, \`Map\`, \`Type\`, etc.)
   - **Typedef import fix**: skips base-type typedefs (no Haxe class is 
generated for them, so the import was unresolvable)
   - **FIELD\_ID constant name fix**: uses escaped field name consistently for 
the \`FIELD_ID\` constant reference — fixes double-underscore error when field 
name is a reserved keyword
   - **Test script Linux/macOS compatibility** 
(\`run-Haxe-Codegen-Tests.ps1\`): fixed path handling; cmake build output 
priority for \`FindThriftExe()\`
   
   ### THRIFT-5993 — Cross-package import shadowing and Haxe base-type name 
collisions
   
   - **Import shadowing fix** (\`haxe_thrift_add_import()\` exclude): 
suppresses imports whose short name matches the entity being defined, 
preventing same-named foreign types from shadowing the local interface/class; 
also suppresses duplicate short-name imports across packages
   - **Base-type-named user types** (\`make_haxe_user_type_name()\`): new 
helper extends the reserved check to Haxe base type names (\`String\`, 
\`Bool\`, \`Float\`, \`Int\`, \`Void\`); applied at struct/enum/service file 
names, class headers, import short-names, and \`type_name()\` return values — 
without affecting base-type annotations in field declarations
   
   ### THRIFT-5994 — \`map<bool,V>\`, \`map<double,V>\`, \`map<binary,V>\` and 
set equivalents
   
   The Haxe generator previously emitted \`ObjectMap<Bool,V>\`, 
\`ObjectMap<Float,V>\`, \`ObjectMap<Bytes,V>\` for these IDL types. \`Bool\` 
and \`Float\` are value types that fail the \`K:{}\` constraint; \`Bytes\` 
satisfies the constraint but gives reference equality, producing semantically 
incorrect map/set behaviour.
   
   New library helpers in \`lib/haxe/src/org/apache/thrift/helper/\`:
   
   - \`BoolMap.hx\` / \`BoolSet.hx\` — Bool keys backed by \`IntMap\` (0=false, 
1=true)
   - \`FloatMap.hx\` / \`FloatSet.hx\` — Float keys stored as 8-byte IEEE 754 
hex in \`StringMap\`; correctly round-trips NaN, -0.0, infinities
   - \`BytesMap.hx\` / \`BytesSet.hx\` — Bytes keys stored as hex in 
\`StringMap\` for content equality
   
   Generator wiring: \`map<bool,V>\` → \`BoolMap<V>\`, \`map<double,V>\` → 
\`FloatMap<V>\`, \`map<binary,V>\` → \`BytesMap<V>\`; same for \`set<bool>\`, 
\`set<double>\`, \`set<binary>\`.
   
   ## Test plan
   
   - [x] Verified on Linux with separate test script (not part of the PR) 
**201/201 tests pass**
   
   🤖 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to