-
Notifications
You must be signed in to change notification settings - Fork 10.5k
C++ Interop: import namespace aliases #37443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,35 @@ struct BasicStruct { | |
}; | ||
} // namespace ClassesNS3 | ||
|
||
namespace GlobalAliasToNS1 = ClassesNS1; | ||
|
||
namespace ClassesNS4 { | ||
namespace AliasToGlobalNS1 = ::ClassesNS1; | ||
namespace AliasToGlobalNS2 = ::ClassesNS1::ClassesNS2; | ||
|
||
namespace ClassesNS5 { | ||
struct BasicStruct {}; | ||
} // namespace ClassesNS5 | ||
|
||
namespace AliasToInnerNS5 = ClassesNS5; | ||
namespace AliasToNS2 = ClassesNS1::ClassesNS2; | ||
|
||
namespace AliasChainToNS1 = GlobalAliasToNS1; | ||
namespace AliasChainToNS2 = AliasChainToNS1::ClassesNS2; | ||
} // namespace ClassesNS4 | ||
|
||
Comment on lines
+43
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are more complex test cases covered by other tests? For example, consider code with namespaces that are shadowed
or code with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There wasn't a test for such case, but I've added it now. Also added a test for an alias pointing to its parent namespace, and a couple of other similar cases. Using-directives & using-declarations currently aren't imported at all (these C++ constructs, along with inline namespaces, are among those that I don't know how to express ergonomically in Swift). |
||
namespace ClassesNS5 { | ||
struct BasicStruct {}; | ||
namespace AliasToAnotherNS5 = ClassesNS4::ClassesNS5; | ||
|
||
namespace ClassesNS5 { | ||
struct BasicStruct {}; | ||
namespace AliasToNS5NS5 = ClassesNS5; | ||
} // namespace ClassesNS5 | ||
|
||
namespace AliasToGlobalNS5 = ::ClassesNS5; | ||
namespace AliasToLocalNS5 = ClassesNS5; | ||
namespace AliasToNS5 = ::ClassesNS5::ClassesNS5; | ||
} // namespace ClassesNS5 | ||
|
||
#endif // TEST_INTEROP_CXX_NAMESPACE_INPUTS_CLASSES_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to suggest a test that references a namespace in another module, but I think we need to sort out SR-14214 first.