-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[cxx-interop] Support nested classes in reverse interop #79045
base: main
Are you sure you want to change the base?
Conversation
Turns out we already had most of the building blocks given we already support nested structs. rdar://143343490
@swift-ci please smoke test |
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.
This change looks good to me, my comments are mostly about testing. I'm glad that the mechanical mechanisms were already in place for this to work without any big changes.
int main() { | ||
using namespace Classes; | ||
auto x = makeRecordConfig(); | ||
RecordConfig::File::Gate y = x.getGate(); | ||
RecordConfig::AudioFormat z = x.getFile().getFormat(); | ||
} |
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.
Can you do more in this test here? Some things I can think of:
- Directly instantiate nested classes (i.e., referring to constructors)
- Call some methods and computed properties of nested classes (which you'll need to define)
- Assert some things about the values of
y.prop
(should be equal to-80
) andz
(should beRecordConfig::AudioFormat::ALAC
).
@@ -0,0 +1,31 @@ | |||
// RUN: %empty-directory(%t) | |||
// RUN: %target-swift-frontend %s -enable-library-evolution -typecheck -module-name Classes -clang-header-expose-decls=all-public -emit-clang-header-path %t/classes.h | |||
// RN: %FileCheck %s < %t/structs.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.
Is this a typo?
// RN: %FileCheck %s < %t/structs.h | |
// RUN: %FileCheck %s < %t/classes.h |
And I don't see any // CHECK
statements in this file. What is this supposed to do?
I was also going to ask whether there's any way to check the textual contents of the C++ header file generated from this Swift code (similar to the -module-interface.swift
files for many forward interop test cases), but I suspect that's what you mean to do here.
Turns out we already had most of the building blocks given we already support nested structs.
rdar://143343490