Sylwester Lachiewicz created THRIFT-6339:
--------------------------------------------
Summary: Kotlin generator emits a constant declared through a
typedef with no value
Key: THRIFT-6339
URL: https://issues.apache.org/jira/browse/THRIFT-6339
Project: Thrift
Issue Type: Bug
Components: Kotlin - Compiler
Affects Versions: 0.25.0
Reporter: Sylwester Lachiewicz
[t_kotlin_generator::generate_consts|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/generate/t_kotlin_generator.cc#L279]
tests {{is_base_type()}} and {{is_enum()}} on the constant's declared type
rather than on {{get_true_type()}}, so a constant whose type is a typedef
matches neither branch and is written without its value.
{code}
typedef i32 MyInt
const MyInt ANSWER = 42
{code}
{noformat}
$ thrift --gen kotlin -out kt repro.thrift && cat kt/reproConstants.kt
...
val ANSWER: kotlin.Int =
{noformat}
The generated file does not compile. The Java generator resolves the typedef
first; Kotlin should do the same. Reproduced on master at 3af0cfff1.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)