From 52ec0a87b5dec500f5f1022d9266484f2cd9d9a9 Mon Sep 17 00:00:00 2001 From: Chris Willmore Date: Mon, 21 Mar 2016 21:45:41 -0700 Subject: [PATCH] [SE-0054] Add section on effect of IUO removal on typedefs. --- proposals/0054-abolish-iuo.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/proposals/0054-abolish-iuo.md b/proposals/0054-abolish-iuo.md index 08c91b3e56..b827fdcfc9 100644 --- a/proposals/0054-abolish-iuo.md +++ b/proposals/0054-abolish-iuo.md @@ -101,6 +101,23 @@ Because IUOs are an attribute on declarations rather than on types, the `ImplicitlyUnwrappedOptional` syntax, is removed. Types with nested IUOs are no longer allowed. This includes types such as `[Int!]` and `(Int!, Int!)`. +Type aliases may not have IUO information associated with them. Thus the +statement `typealias X = Int!` is illegal. This includes type aliases resulting +from imported `typedef` statements. For example, the Objective-C type +declaration + +```Objective-C +typedef void (^ViewHandler)(NSView *); +``` + +... is imported as the Swift type declaration + +```Swift +typealias ViewHandler = (NSView?) -> () +``` + +Note that the parameter type is `NSView?`, not `NSView!`. + ## Examples ```Swift