Files
swift-mirror/test/Interop/Cxx/objc-correctness/ns-options-mangling.swift
Puyan Lotfi fe6ccd7a29 [cxx-interop] Add fix for corner case where NS_OPTIONS typedef has to be desugared
This patch is an add-on to https://github.com/apple/swift/pull/64043.
Essentially when encountering NS_OPTIONS enums, in C++-Interop mode
if they are not specially handled then they can mangle differently than
they do without C++-Interop. This patch adds logic to handle when a
typedef and enum have additional clang::ElaboratedType sugar, but
otherwise it does the same as the existing 64043 patch.

The test case provided was encountered in a real app build. The problem
came from when two modules are each compiled one with and one without
C++-Interop. For the test case code provided the mangling of the
protocol conformance is not consistent and the code in
SILGenLazyConformance.cpp crashes on an invalid conformance with reason
"Invalid conformance in type-checked AST".
2023-06-15 11:17:25 -07:00

12 lines
501 B
Swift

// RUN: %target-swift-frontend -I %S/Inputs -c -cxx-interoperability-mode=swift-5.9 %s -S -o - | %FileCheck %s
// RUN: %target-swift-frontend -I %S/Inputs -c %s -S -o - | %FileCheck %s
// REQUIRES: objc_interop
// CHECK: _$sSo14UIControlStateV4main7FooableACMc
// The following check is to ensure the conformance is mangled properly:
// protocol conformance descriptor for __C.UIControlState : main.Fooable in main
import NSOptionsMangling
protocol Fooable { }
extension UIControl.State: Fooable {}