Closed
Description
Previous ID | SR-488 |
Radar | rdar://problem/21473547 |
Original Reporter | @JadenGeller |
Type | Bug |
Status | Resolved |
Resolution | Done |
Attachment: Download
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, CompilerCrash |
Assignee | @slavapestov |
Priority | Medium |
md5: 4cc3ecb039495bae0b76cbb3c7e41251
is duplicated by:
- SR-493 Compiler crashes when Implementing ArrayLitteralConvertible In a generic struct
relates to:
- SR-493 Compiler crashes when Implementing ArrayLitteralConvertible In a generic struct
Issue Description:
When a generic type Blah<Value>
contains a generic property with a default value, such as var backing: Value? = nil
, the compiler will crash if an initializer is placed in an extension (even in the same file).
struct Blah<Value> {
var backing: Value?
}
extension Blah {
init(test: Int) {
// crash when emitting implicit store "backing = nil"
}
}
The stack trace is:
#​4 llvm_unreachable("unexpected storage type that differs from type-of-rvalue");
#​5 emitStoreOfSemanticRValue(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::SILValue, swift::SILValue, swift::Lowering::TypeLowering const&, swift::IsInitialization_t)
#​6 swift::Lowering::SILGenFunction::emitSemanticStore(swift::SILLocation, swift::SILValue, swift::SILValue, swift::Lowering::TypeLowering const&, swift::IsInitialization_t)
#​7 swift::Lowering::ManagedValue::assignInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::SILValue)
#​8 assignRecursive(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::CanType, llvm::ArrayRef<swift::Lowering::ManagedValue>&, swift::SILValue)
#​9 swift::Lowering::RValue::assignInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::SILValue) &&
#​10 swift::Lowering::SILGenFunction::emitAssignToLValue(swift::SILLocation, swift::Lowering::RValue&&, swift::Lowering::LValue&&)
#​11 emitMemberInit(swift::Lowering::SILGenFunction&, swift::VarDecl*, swift::Pattern*, swift::Lowering::RValue&&)
#​12 emitMemberInit(swift::Lowering::SILGenFunction&, swift::VarDecl*, swift::Pattern*, swift::Lowering::RValue&&)
#​13 swift::Lowering::SILGenFunction::emitMemberInitializers(swift::VarDecl*, swift::NominalTypeDecl*)
#​14 swift::Lowering::SILGenFunction::emitValueConstructor(swift::ConstructorDecl*)
#​15 swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*)::$_4::operator()(swift::SILFunction*) const
#​16 void emitOrDelayFunction<swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*)::$_4>(swift::Lowering::SILGenModule&, swift::SILDeclRef, swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*)::$_4&&)
#​17 swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*)
#​18 SILGenExtension::visitConstructorDecl(swift::ConstructorDecl*)