You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2023/03/06 23:09:00 UTC

[jira] [Resolved] (THRIFT-5690) Constant expects type to be defined before

     [ https://issues.apache.org/jira/browse/THRIFT-5690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer resolved THRIFT-5690.
--------------------------------
    Fix Version/s: 0.19.0
         Assignee: Jens Geyer
       Resolution: Won't Fix

A good solution to this that covers all cases is not really easy due to the way it was designed. 

The main reason is that the step where constants are resolved and validated already happens in the middle of the parsing. Because of that design choice, we have a somewhat unclear situation w/regard to (especially nested) types that may or may not be fully defined at this stage. It would be way better if that step is performed after the parsing is done, but before code generation, to make sure we have a well-defined situation where any sorts of guesswork or "lazy execution" workarounds are not necessary, 

If anyone wants to come up with a well-tested PR, feel free to take over, but make sure you cover all edge cases properly.

> Constant expects type to be defined before
> ------------------------------------------
>
>                 Key: THRIFT-5690
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5690
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General)
>            Reporter: Bogdan Drutu
>            Assignee: Jens Geyer
>            Priority: Major
>             Fix For: 0.19.0
>
>
> {code}
> struct Test {
> 10: optional Foo foo = {};
> }
> struct Foo {
> 10: optional string bar;
> }
> {code}
> Tried with thrift 0.18.0/0.18.1
> {code}
> [ERROR] thrift failed output: Type "Foo" not defined
> {code} 
> Best guess can be related with https://issues.apache.org/jira/browse/THRIFT-5626



--
This message was sent by Atlassian Jira
(v8.20.10#820010)