thrift
thrift copied to clipboard
THRIFT-5911: Inconsistent UUID constants compilation for aliased types
For aliased types, UUID constants retain their curly braces, while direct UUID constants do not:
typedef uuid myUUID
const uuid GEN_UUID = '00000000-4444-CCCC-ffff-0123456789ab'
const uuid GEN_GUID = '{00112233-4455-6677-8899-aaBBccDDeeFF}'
const myUUID MY_UUID = '00000000-4444-CCCC-ffff-0123456789ab'
const myUUID MY_GUID = '{00112233-4455-6677-8899-aaBBccDDeeFF}'
When uuid is compiled, it produces a string without curly braces, but for alias myUUID the curly braces stay:
GEN_UUID = %q"00000000-4444-CCCC-ffff-0123456789ab"
GEN_GUID = %q"00112233-4455-6677-8899-aaBBccDDeeFF"
MY_UUID = %q"00000000-4444-CCCC-ffff-0123456789ab"
MY_GUID = %q"{00112233-4455-6677-8899-aaBBccDDeeFF}"
This change ensures that the type is properly resolved to its true type before validation, resulting in consistent handling of UUID constants regardless of whether they are defined using the base type or an alias.
After:
GEN_UUID = %q"00000000-4444-CCCC-ffff-0123456789ab"
GEN_GUID = %q"00112233-4455-6677-8899-aaBBccDDeeFF"
MY_UUID = %q"00000000-4444-CCCC-ffff-0123456789ab"
MY_GUID = %q"00112233-4455-6677-8899-aaBBccDDeeFF"
- [x] Did you create an Apache Jira ticket? THRIFT-5911
- [x] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
- [x] Did you squash your changes to a single commit? (not required, but preferred)
- [x] Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
- [ ] If your change does not involve any code, include
[skip ci]anywhere in the commit message to free up build resources.