File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -191,10 +191,13 @@ enum class Bridgeability {
191
191
Full
192
192
};
193
193
194
+ // / Controls whether a typedef for \p type should name the fully-bridged Swift
195
+ // / type or the original Clang type.
196
+ // /
197
+ // / In either case we end up losing sugar at some uses sites, so this is more
198
+ // / about what the right default is.
194
199
static inline Bridgeability getTypedefBridgeability (clang::QualType type) {
195
- return (type->isBlockPointerType () || type->isFunctionType ())
196
- ? Bridgeability::Full
197
- : Bridgeability::None;
200
+ return type->isBlockPointerType () ? Bridgeability::Full : Bridgeability::None;
198
201
}
199
202
200
203
// / \brief Describes the kind of the C type that can be mapped to a stdlib
Original file line number Diff line number Diff line change @@ -209,3 +209,6 @@ typedef NSArray<NSString *> *NSStringArray;
209
209
@interface BridgedTypedefs : NSObject
210
210
@property (readonly ,nonnull ) NSArray <NSStringArray> *arrayOfArrayOfStrings;
211
211
@end
212
+
213
+ typedef NSString * _Nonnull (*FPTypedef)(NSString * _Nonnull);
214
+ extern FPTypedef _Nonnull getFP (void );
Original file line number Diff line number Diff line change @@ -643,3 +643,9 @@ func testTypeAndValue() {
643
643
func testBridgedTypedef( bt: BridgedTypedefs ) {
644
644
let _: Int = bt. arrayOfArrayOfStrings // expected-error{{'[[String]]'}}
645
645
}
646
+
647
+ func testBridgeFunctionPointerTypedefs( fptrTypedef: FPTypedef ) {
648
+ // See also print_clang_bool_bridging.swift.
649
+ let _: Int = fptrTypedef // expected-error{{'@convention(c) (String) -> String'}}
650
+ let _: Int = getFP ( ) // expected-error{{'@convention(c) (String) -> String'}}
651
+ }
You can’t perform that action at this time.
0 commit comments