Swift: Compiler crash when assigning AnyObject? to Any?

Originator:dieter.komendera
Number:rdar://19552365 Date Originated:21-Jan-2015 09:34 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-Beta (6C107a)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
This crashes the swift compiler.

func anything() -> AnyObject? {
  return nil
}
func someting() -> Int? {
  let s: Any? = anything()
  return nil
}

0   com.apple.LLDB.framework      	0x000000010c64afc4 llvm::Type::getScalarType() + 4
1   com.apple.LLDB.framework      	0x000000010c6296ca llvm::GetElementPtrInst::getIndexedType(llvm::Type*, llvm::ArrayRef<llvm::Value*>) + 26
2   com.apple.LLDB.framework      	0x000000010ccd024a llvm::GetElementPtrInst::Create(llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::Instruction*) + 90
3   com.apple.LLDB.framework      	0x000000010ccf2713 llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreateConstInBoundsGEP2_32(llvm::Value*, unsigned int, unsigned int, llvm::Twine const&) + 163
4   com.apple.LLDB.framework      	0x000000010ccaaaa9 swift::irgen::emitOpaqueExistentialContainerUpcast(swift::irgen::IRGenFunction&, swift::irgen::Address, swift::SILType, swift::irgen::Address, swift::SILType, bool) + 169
5   com.apple.LLDB.framework      	0x000000010cce9a65 swift::SILVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::ValueBase*) + 22869
6   com.apple.LLDB.framework      	0x000000010cce34cb swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9195
7   com.apple.LLDB.framework      	0x000000010cc5d310 swift::irgen::IRGenModule::emitGlobalTopLevel() + 208
8   com.apple.LLDB.framework      	0x000000010ccd117c performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1900
9   com.apple.LLDB.framework      	0x000000010ccd09fa swift::performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&) + 42

Steps to Reproduce:
Open and run the attached playground

Expected Results:
No compile error

Actual Results:
Compiler crashes

Regression:
¯\_(ツ)_/¯

Notes:

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!