Swift 2: Correct recursive type constraint also crashes the compiler

Originator:rix.rob
Number:rdar://21373630 Date Originated:13-Jun-2015 07:21 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-7-beta (7A120f)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
Like rdar://21373621 and rdar://21373624 but this time there’s no error

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 == Term> {
	let expression: E
}


Expected Results:
should not crash the compiler

Actual Results:
but totally does:
0  swift                    0x000000010b172e0b llvm::sys::PrintStackTrace(__sFILE*) + 43
1  swift                    0x000000010b17354b SignalHandler(int) + 379
2  libsystem_platform.dylib 0x00007fff84de5f1a _sigtramp + 26
3  libsystem_platform.dylib 0x000000010bfa4000 _sigtramp + 2266751232
4  swift                    0x000000010985d12d swift::ArchetypeBuilder::resolveArchetype(swift::Type) + 29
5  swift                    0x000000010985f125 swift::ArchetypeBuilder::addSameTypeRequirement(swift::Type, swift::Type, swift::RequirementSource) + 37
6  swift                    0x000000010985f249 swift::ArchetypeBuilder::addRequirement(swift::RequirementRepr const&) + 89
7  swift                    0x00000001098236f6 checkGenericParameters(swift::TypeChecker&, swift::ArchetypeBuilder*, swift::GenericParamList*, swift::DeclContext*, swift::GenericTypeResolver&) + 950
8  swift                    0x0000000109822ffd swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::__1::function<bool (swift::ArchetypeBuilder&)>, bool&) + 141
…
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-446944.o 
1.	While type-checking 'Term' at term.swift:14:1
<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!