THRIFT-5992 THRIFT-5993 THRIFT-5994 haxe codegen issues#3478
Merged
Conversation
…nux test script Client: haxe - Add escape_haxe_keyword() to escape 45 Haxe reserved keywords as identifiers - Extend get_cap_name() to append _ when name conflicts with Haxe stdlib types - Fix haxe_thrift_add_import() to skip base-type typedefs (no Haxe class generated) - Fix generate_reflection_getters/setters FIELD_ID constant name mismatch - Fix run-Haxe-Codegen-Tests.ps1 for Linux/macOS path compatibility - Update $KNOWN_BUGS: JavaDeepCopyTest, JavaTypes (unfixable Java-specific fixtures), Thrift5320 (tracked as THRIFT-5993) - Result: 201/201 tests pass (3 FAIL_THRIFT skips, 3 known bugs) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Generated-by: Claude Sonnet 4.6
…shadowing Client: haxe - Fix haxe_thrift_add_import() to suppress imports whose short name matches the entity being defined (service/struct), preventing foreign same-named types from shadowing the local definition (THRIFT-5993) - Also suppress duplicate short-name imports to avoid unresolvable ambiguity when multiple packages export identically-named types - Add make_haxe_user_type_name() helper with extended reserved-type list that includes Haxe base type names (String, Bool, Float, Int, Void); applied at struct/enum file names, class headers, import generation, and type_name() branches so user-defined types named after Haxe built-ins are safely renamed - Remove Thrift5320.thrift from $KNOWN_BUGS (now fixed); update JavaTypes and JavaDeepCopyTest comments to reflect only the remaining ObjectMap<Float> key-type constraint issue Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Generated-by: Claude Sonnet 4.6
… names
Client: haxe
Extend the base-type-name collision fix to service-level naming sites.
All generate_service_{interface,client,server} and generate_service() calls
that previously used get_cap_name(service_name_) now use
make_haxe_user_type_name(service_name_), keeping service file names, class
and interface headers, _iface_ type annotations, and import lines consistent
with the renamed type as returned by type_name() for cross-package references.
No test IDL exercises this path (no service named String/Bool/Float/Int/Void
exists in the tree), but the fix ensures correctness for the edge case.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Generated-by: Claude Sonnet 4.6
…y types Client: haxe - Add BoolMap<T>/BoolSet: Bool key type encoded as 0/1 in IntMap/IntMap - Add FloatMap<T>/FloatSet: Float key type stored as 8-byte IEEE 754 hex in StringMap for exact equality semantics (correctly round-trips NaN, -0.0, infinities) - Add BytesMap<T>/BytesSet: Bytes key type stored as hex in StringMap for content equality (ObjectMap/ObjectSet would give reference equality) - Wire the new types in type_name(): map<bool,V> -> BoolMap, map<double,V> -> FloatMap, map<binary,V> -> BytesMap; set<bool> -> BoolSet, set<double> -> FloatSet, set<binary> -> BytesSet - Clear $KNOWN_BUGS: JavaTypes.thrift and JavaDeepCopyTest.thrift now pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Generated-by: Claude Sonnet 4.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes several Haxe code-generator bugs that caused generated Haxe code to fail compilation.
THRIFT-5992 — Keyword/stdlib-type escaping, typedef import fix, FIELD_ID fix
Compiler generator fixes in `t_haxe_generator.cc`:
THRIFT-5993 — Cross-package import shadowing and Haxe base-type name collisions
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/`:
Generator wiring: `map<bool,V>` → `BoolMap`, `map<double,V>` → `FloatMap`, `map<binary,V>` → `BytesMap`; same for `set`, `set`, `set`.
Test plan
🤖 Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com