[
https://issues.apache.org/jira/browse/THRIFT-6342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-6342.
--------------------------------
Fix Version/s: 0.26.0
Assignee: Sylwester Lachiewicz
Resolution: Fixed
> Haxe generator renders i8 and i16 constants with C-style casts
> --------------------------------------------------------------
>
> Key: THRIFT-6342
> URL: https://issues.apache.org/jira/browse/THRIFT-6342
> Project: Thrift
> Issue Type: Bug
> Components: Haxe - Compiler
> Affects Versions: 0.25.0
> Reporter: Sylwester Lachiewicz
> Assignee: Sylwester Lachiewicz
> Priority: Minor
> Fix For: 0.26.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> [t_haxe_generator::render_const_value|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/generate/t_haxe_generator.cc#L593]
> writes {{(byte)N}} for an {{i8}} constant and {{(short)N}} for an {{i16}}
> constant. Haxe has no cast of that form, and the field they initialise is
> declared {{haxe.Int32}} anyway.
> {code}
> const i8 SMALL = 7
> const i16 MEDIUM = 300
> {code}
> {noformat}
> $ thrift --gen haxe repro.thrift && grep "SMALL\|MEDIUM"
> gen-haxe/ReproConstants.hx
> public static inline var SMALL : haxe.Int32 = (byte)7;
> public static inline var MEDIUM : haxe.Int32 = (short)300;
> {noformat}
> The same casts appear wherever an {{i8}} or {{i16}} value is rendered,
> including elements of container constants ({{tmp.add((byte)1)}},
> {{tmp.set((short)1, ...)}}), for example in {{test/DebugProtoTest.thrift}}.
> The generated file does not compile. Writing the plain integer, as the
> {{i32}} case does, is enough. Reproduced on master at 3af0cfff1.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)