Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Add support for default enum values that reference the original enum. #69

Merged
merged 1 commit into from
Dec 20, 2014

Conversation

mikekap
Copy link
Contributor

@mikekap mikekap commented Dec 20, 2014

e.g. 1: PhoneType phone_type = PhoneType.MOBILE;

e.g. 1: PhoneType phone_type = PhoneType.MOBILE;
@hit9
Copy link
Contributor

hit9 commented Dec 20, 2014

LGTM

lxyu added a commit that referenced this pull request Dec 20, 2014
Add support for default enum values that reference the original enum.
@lxyu lxyu merged commit 5576c38 into Thriftpy:develop Dec 20, 2014
@lxyu
Copy link
Contributor

lxyu commented Dec 20, 2014

Thanks!

@hit9
Copy link
Contributor

hit9 commented Jan 13, 2015

@mikekap Is the following legal?

struct Person {
    1: string name,
    2: i32 age
    3: Country country = Country.US
}

enum Country {
    US = 1,
    UK = 2,
    CA = 3,
}

I mean when the referenced enum is defined after the referencer (here 'struct Person').

@hit9
Copy link
Contributor

hit9 commented Jan 13, 2015

I have tested the following thrift file:

struct Person {
    1: Country country = Country.US
}

enum Country {
    US = 1
}

Apache thrift gives out:

[ERROR:/Users/hit9/spam/testth/hello.thrift:2] (last token was 'Country')
Type "Country" has not been defined.

@hit9
Copy link
Contributor

hit9 commented Jan 13, 2015

So, we should replace the real value in the ply parsing progress.

This was referenced Jan 13, 2015
@hit9 hit9 mentioned this pull request Jan 23, 2015
@hit9
Copy link
Contributor

hit9 commented Jan 24, 2015

Parser has been rebuilt, but this feature was included.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants