Skip to content

Commit 7dcd26e

Browse files
committed
[cxx-interop] Import ObjCPropertyDecl of type NS_OPTIONS fields a struct type
Try importing ObjCPropertyDecl field types the C++-Interop-NS_OPTIONS way. This will fix cases such as: ``` import UIKit func f(gesture: UISwipeGestureRecognizer, direction: UISwipeGestureRecognizer.Direction) { gesture.direction = direction // error } ``` because it will make sure the field inside class UIGestureRecognizer is of the enum-struct type and not the typedef-rawValue type when importing an ObjC class.
1 parent d65115d commit 7dcd26e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5214,7 +5214,11 @@ namespace {
52145214
}
52155215
}
52165216

5217-
auto importedType = Impl.importPropertyType(decl, isInSystemModule(dc));
5217+
auto fieldType = decl->getType();
5218+
ImportedType importedType = tryImportOptionsTypeForField(fieldType, Impl);
5219+
5220+
if (!importedType)
5221+
importedType = Impl.importPropertyType(decl, isInSystemModule(dc));
52185222
if (!importedType) {
52195223
Impl.addImportDiagnostic(
52205224
decl, Diagnostic(diag::objc_property_not_imported, decl),

0 commit comments

Comments
 (0)