Create a typealias with generic optional type, Xcode 8 b3 - b4 will crash with Segmentation Fault

Originator:francis
Number:rdar://27674510 Date Originated:03-Aug-2016
Status:Open Resolved:
Product:Xcode Product Version:Xcode 8 beta 4
Classification: Reproducible:Always
 
Summary:
Create a typealias with generic optional type, Xcode 8 b3 - b4 will crash with  Segmentation Fault.

Steps to Reproduce:
1. Define a typealias:

```
typealias CompletionHandler<T> = (T?, Error?) -> Void
```

2. Use the typealias in some protocol
3. Create class that implement the protocol

Expected Results:
It should compile.

Actual Results:
It does not compile. It fail with error like:

0  swift                    0x0000000109036e3d PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x0000000109036886 SignalHandler(int) + 470
2  libsystem_platform.dylib 0x00007fff94d6f52a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000109f55200 _sigtramp + 1964924144
4  swift                    0x00000001068d917d swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2301
5  swift                    0x00000001068d914c swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2252
6  swift                    0x00000001068d979a swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 3866
7  swift                    0x00000001068d8c72 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1010
8  swift                    0x00000001068d8dc2 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1346
9  swift                    0x00000001068d9168 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2280
10 swift                    0x00000001068d8c72 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1010
11 swift                    0x00000001068d8dc2 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1346
12 swift                    0x00000001068d8dd7 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1367
13 swift                    0x00000001068d6608 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 38216
14 swift                    0x00000001068e1637 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 647
15 swift                    0x0000000106c4842a (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 314
16 swift                    0x0000000106c4639a (anonymous namespace)::Traversal::doIt(swift::Decl*) + 234
17 swift                    0x000000010663538f swift::SILPassManager::SILPassManager(swift::SILModule*, llvm::StringRef) + 1439
18 swift                    0x000000010663a0df swift::runSILDiagnosticPasses(swift::SILModule&) + 159
19 swift                    0x000000010630b3d7 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 19079
20 swift                    0x0000000106304679 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 18137
21 swift                    0x00000001062c14a0 main + 10240
22 libdyld.dylib            0x00007fff8b1ad5ad start + 1
...
1.	While loading members for 'DefaultDocumentService' at <invalid loc>
2.	While deserializing 'create' (FuncDecl #4) 


Version:
Xcode 8 beta 3, beta 4

Notes:
Please see the attached sample project which reproduce the error.

Attachments:
https://github.com/siuying/SwiftGenericTypealias/archive/master.zip

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!