-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
When a local struct has the same name as an imported module (e.g., local struct
named 'user_types' when there's an imported module 'user_types.thrift'), thriftpy2
incorrectly resolves ALL qualified references like 'user_types.UserProfile' to
the local struct instead of accessing the struct from the imported module.
This makes it impossible to reference structs from an imported module when there's
a naming collision with a local struct.
EXPECTED BEHAVIOR:
- 'user_types.UserProfile' should resolve to UserProfile from user_types module
- 'user_types' (unqualified) should resolve to the local struct
ACTUAL BEHAVIOR:
- Both resolve to the local 'user_types' struct
- The qualified path is completely ignored
Ref files/tests:
// user_types.thrift
struct UserProfile {
1: required string user_id
2: required string username
3: optional string email
}// main.thrift
include "user_types.thrift"
struct UserProfile {
1: required string local_field1
2: optional i32 local_field2
}
struct ApplicationData {
// Case 1a: Reference to local struct that has same name as imported module
1: required user_types localUserTypes
// Case 1b: SHOULD reference user_types.UserProfile from imported module
// BUT will incorrectly resolve to local user_types struct
2: required user_types.UserProfile importedUserProfile
}
However it is okay (and it is expected to be okay) if the imported struct collides with the name of a local struct. It seems the issue only occurs if the imported module collides with the name of a local struct.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels