Swift: Compiler crashes when adding conformance to Collection, enumerating Sequence, etc.

Originator:rix.rob
Number:rdar://17411805 Date Originated:22-Jun-2014 02:52 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode6-Beta2 (6A216f)
Classification:Serious Bug Reproducible:Always
 
Summary:
I’m getting reproducible crashes in the compiler with a Set type I’m writing. The starting code is available in this gist: https://gist.github.com/robrix/e9e6c6693382a579c62a


Steps to Reproduce:
1. Add (or if you’re using the gist, uncomment) this extension:

extension Set : Collection {
	var startIndex: DictionaryIndex<Element, Void> { return _dictionary.startIndex }
	var endIndex: DictionaryIndex<Element, Void> { return _dictionary.endIndex }
	
	subscript(index: DictionaryIndex<Element, Void>) -> Element {
		let (element, _) = _dictionary[index]
		return element
	}
}

2. Alternatively, change the definition of extend to use sequence directly by replacing:

for each in Element[](sequence)

with:

for each in sequence



Expected Results:
I expected both of these to work.


Actual Results:
The compiler crashes every time.


Regression:
N/A


Notes:
3  libsystem_platform.dylib 0x00007fff5ca034d0 _sigtramp + 3486641984
4  swift                    0x00000001033dc296 swift::serialization::Serializer::writeConformance(swift::ProtocolDecl const*, swift::ProtocolConformance const*, swift::Decl const*, std::__1::array<unsigned int, 256ul> const&, bool) + 1366
5  swift                    0x00000001033dd194 swift::serialization::Serializer::writeSubstitutions(llvm::ArrayRef<swift::Substitution>, std::__1::array<unsigned int, 256ul> const&) + 1252
6  swift                    0x00000001033dcb76 swift::serialization::Serializer::writeConformance(swift::ProtocolDecl const*, swift::ProtocolConformance const*, swift::Decl const*, std::__1::array<unsigned int, 256ul> const&, bool) + 3638
7  swift                    0x00000001033df7eb swift::serialization::Serializer::writeDecl(swift::Decl const*) + 2427
8  swift                    0x00000001033e81b5 swift::serialization::Serializer::writeAllDeclsAndTypes() + 8837
9  swift                    0x00000001033e8b1e swift::serialization::Serializer::writeAST(llvm::PointerUnion<swift::Module*, swift::SourceFile*>) + 1182
10 swift                    0x00000001033e98cb swift::serialization::Serializer::writeToStream(llvm::raw_ostream&, llvm::PointerUnion<swift::Module*, swift::SourceFile*>, swift::SILModule const*, bool, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::StringRef, llvm::StringRef, bool) + 187
11 swift                    0x00000001033ea24e swift::serialize(llvm::PointerUnion<swift::Module*, swift::SourceFile*>, char const*, char const*, swift::SILModule const*, bool, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::StringRef, llvm::StringRef, bool) + 398
12 swift                    0x00000001031ff679 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 4105

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!