Swift 2: Compiler crash with public enum with case holding type parameter and recursive instance indirectly via function

Originator:rix.rob
Number:rdar://21326786 Date Originated:10-Jun-2015 04:26 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-7-beta (7A120f)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
I think the subject line says it all, really.


Steps to Reproduce:
1. Compiling this:
public enum E<P> {
	case C(P, () -> E)
}


Expected Results:
should not crash


Actual Results:
but totally does:

Assertion failed: (CachedTy == DITy && "conflicting types for one UID"), function getOrCreateType, file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.38.1/src/swift/lib/IRGen/IRGenDebugInfo.cpp, line 1881.
0  swift                    0x000000010c320e0b llvm::sys::PrintStackTrace(__sFILE*) + 43
1  swift                    0x000000010c32154b SignalHandler(int) + 379
2  libsystem_platform.dylib 0x00007fff88493f1a _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2008465664
4  libsystem_c.dylib        0x00007fff86f90b53 abort + 129
5  libsystem_c.dylib        0x00007fff86f58c39 basename + 0
6  swift                    0x000000010a4510fe swift::irgen::IRGenDebugInfo::getOrCreateType(swift::irgen::DebugTypeInfo) + 1694
7  swift                    0x000000010a453a5e swift::irgen::IRGenDebugInfo::getTupleElements(swift::TupleType*, llvm::DIScope*, llvm::DIFile*, unsigned int, swift::DeclContext*, unsigned int&) + 462
8  swift                    0x000000010a456375 swift::irgen::IRGenDebugInfo::createType(swift::irgen::DebugTypeInfo, llvm::StringRef, llvm::DIScope*, llvm::DIFile*) + 5125
9  swift                    0x000000010a450dbb swift::irgen::IRGenDebugInfo::getOrCreateType(swift::irgen::DebugTypeInfo) + 859
10 swift                    0x000000010a45475d swift::irgen::IRGenDebugInfo::getEnumElements(swift::irgen::DebugTypeInfo, swift::EnumDecl*, llvm::DIScope*, llvm::DIFile*, unsigned int) + 941
11 swift                    0x000000010a454ad3 swift::irgen::IRGenDebugInfo::createEnumType(swift::irgen::DebugTypeInfo, swift::EnumDecl*, llvm::StringRef, llvm::DIScope*, llvm::DIFile*, unsigned int, unsigned int) + 451
…
Stack dump:
0.	Program arguments: /Applications/Xcode-7-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret ./recur.swift -target x86_64-apple-darwin14.3.0 -enable-objc-interop -sdk /Applications/Xcode-7-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -module-name recur 
1.	While emitting IR SIL function @_TFO5recur1E1CurfMGS0_q__FTq_FT_GS0_q___GS0_q__ for 'C' at ./recur.swift:4:7


Regression:
Didn’t crash in Swift 1.2.

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!