Swift 2: Different error in recursive type constraint crashes the compiler differently

Originator:rix.rob
Number:rdar://21373624 Date Originated:13-Jun-2015 07:19 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-7-beta (7A120f)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
Just like rdar://21373621 but with a slightly different stack trace.

Steps to Reproduce:
1. This:
protocol AlgebraicType {
	typealias Term
}

enum Expr<T>: AlgebraicType {
	typealias Term = T

	case Var(String)
	case Abstraction(String, T)
	case Application(T, T)
}

struct Term<E: AlgebraicType where E.Term == T> {
	let expression: E
}


Expected Results:
should not crash the compiler

Actual Results:
but totally does:
term.swift:14:46: error: use of undeclared type 'T'
struct Term<E: AlgebraicType where E.Term == T> {
                                             ^
0  swift                    0x0000000104c12e0b llvm::sys::PrintStackTrace(__sFILE*) + 43
1  swift                    0x0000000104c1354b SignalHandler(int) + 379
2  libsystem_platform.dylib 0x00007fff84de5f1a _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2065801472
4  swift                    0x00000001033cb487 swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 71
5  swift                    0x00000001033ca894 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2228
6  swift                    0x00000001033cd074 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 36
7  swift                    0x00000001032c609f swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 223
8  swift                    0x00000001032ef95d resolveIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, llvm::ArrayRef<swift::ComponentIdentTypeRepr*>, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*) + 2221
…
Stack dump:
0.	Program arguments: /Applications/Xcode-7-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file term.swift -target x86_64-apple-darwin14.3.0 -enable-objc-interop -module-name term -o /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/term-490201.o 
1.	While type-checking 'Term' at term.swift:14:1
2.	While resolving type E at [term.swift:15:18 - line:15:18] RangeText="E"
<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:
N/A

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!