swiftc crash with nested generic functions using associated type in protocol extension

Originator:rix.rob
Number:rdar://23010642 Date Originated:07-Oct-2015 11:24 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.0.1 (7A1001)
Classification:Enhancement Reproducible:Always
 
Summary:
N/A


Steps to Reproduce:
This code:
extension SequenceType {
	func f<A>(a: A) -> Generator {
		func g<A>(a: A) -> Generator {}
	}
}


Expected Results:
shouldn’t crash swiftc


Actual Results:
but totally does:
rob@Resonance ~/Desktop> swiftc boom.swift; and ./boom
0  swift                    0x00000001066ccedb llvm::sys::PrintStackTrace(__sFILE*) + 43
1  swift                    0x00000001066cd61b SignalHandler(int) + 379
2  libsystem_platform.dylib 0x00007fff85b2c52a _sigtramp + 26
3  libsystem_c.dylib        0x00007fff850107fa vsprintf_l + 399
4  swift                    0x000000010495dc80 swift::Lowering::TypeConverter::getFunctionTypeWithCaptures(swift::CanTypeWrapper<swift::AnyFunctionType>, swift::AnyFunctionRef) + 272
5  swift                    0x000000010495e916 swift::Lowering::TypeConverter::makeConstantType(swift::SILDeclRef, bool) + 854
6  swift                    0x0000000104917e9a swift::Lowering::TypeConverter::getConstantInfo(swift::SILDeclRef) + 250
7  swift                    0x000000010493a943 swift::SILModule::getOrCreateFunction(swift::SILLocation, swift::SILDeclRef, swift::ForDefinition_t) + 147
8  swift                    0x000000010497aaf5 swift::Lowering::SILGenModule::getFunction(swift::SILDeclRef, swift::ForDefinition_t) + 117
9  swift                    0x000000010497afb7 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 375
10 swift                    0x00000001049f1ec9 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 425
11 swift                    0x00000001049f1d15 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
12 swift                    0x00000001049c2e7b swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 331
13 swift                    0x000000010497b01f swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 479
14 swift                    0x00000001049f752c swift::ASTVisitor<SILGenExtension, void, void, void, void, void, void>::visit(swift::Decl*) + 300
15 swift                    0x00000001049f718b SILGenExtension::emitExtension(swift::ExtensionDecl*) + 59
16 swift                    0x00000001049f6b35 swift::Lowering::SILGenModule::visitExtensionDecl(swift::ExtensionDecl*) + 21
17 swift                    0x000000010497e76b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 779
18 swift                    0x000000010497f330 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 944
19 swift                    0x000000010497f6dd swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 109
20 swift                    0x00000001047ddfd5 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 11445
21 swift                    0x00000001047db10a frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2682
22 swift                    0x00000001047d7797 main + 2247
23 libdyld.dylib            0x00007fff9494a5ad start + 1
24 libdyld.dylib            0x000000000000000f start + 1802197603
Stack dump:
0.	Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file boom.swift -target x86_64-apple-darwin15.0.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -color-diagnostics -module-name boom -o /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/boom-efc993.o 
1.	While emitting SIL for 'f' at boom.swift:2:2
2.	While emitting SIL for 'g' at boom.swift:3:3
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)


Regression:
Both functions have to be generic to crash.
Both functions have to reference an associated type to crash.
It has to be in a protocol extension to crash.

Notes:
N/A

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!