[Clang importer] Don't bridge blocks to Swift functions in ObjC generic args.

While the compiler can bridge C block types to Swift function types,
the Swift runtime cannot. Don't bridge block types to Swift function
types in Objective-C generic arguments, so

  NSArray<some-block-type>

will get imported as

  [@convention(block) (...) -> Whatever]

rather than

  [(...) -> Whatever]

Fixes rdar://problem/40879067 in a fairly narrow way; the Clang
importer's approach to adjusting types based on context needs a
cleanup, but this is the safe, localized fix suitable for 4.2.
This commit is contained in:
Doug Gregor
2018-06-15 11:46:56 -07:00
parent e3d69d1c2a
commit d529002009
5 changed files with 36 additions and 8 deletions

View File

@@ -113,3 +113,10 @@ typedef id <Fungible> FungibleObject;
@interface Third : Second<Third *>
@end
typedef void (^ _Nonnull BlockPointerType)(void);
@interface HasBlockArray : NSObject
- (NSArray<BlockPointerType> * _Nonnull)blockArray;
- (BlockPointerType)blockPointerType;
@end