Skip to content

Instantly share code, notes, and snippets.

@therealbnut
Created June 17, 2015 13:12
Show Gist options
  • Save therealbnut/34fdb328fddf0511e1b5 to your computer and use it in GitHub Desktop.
Save therealbnut/34fdb328fddf0511e1b5 to your computer and use it in GitHub Desktop.
Assertion failed: (fn->getLoweredFunctionType() == type), function getOrCreateFunction, file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.38.1/src/swift/lib/SIL/SILModule.cpp, line 231.
import Nimble
import Quick
public func errorOf<T>(expression: () throws -> T?) -> ErrorType? {
do {
try expression()
}
catch {
return error
}
return nil
}
enum TestError : ErrorType {
case Fail
}
func failing(a : Int) throws -> Int {
throw TestError.Fail
}
func test() {
let e = errorOf({
return try failing(1)
}) as? TestError
print("error: \(e)", appendNewline: true)
}
class SomeClass {
func foo() {
let t = try! failing(3)
expect(t)
}
}
Assertion failed: (fn->getLoweredFunctionType() == type), function getOrCreateFunction, file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.38.1/src/swift/lib/SIL/SILModule.cpp, line 231.
0 swift 0x0000000110f5de0b llvm::sys::PrintStackTrace(__sFILE*) + 43
1 swift 0x0000000110f5e54b SignalHandler(int) + 379
2 libsystem_platform.dylib 0x00007fff8c72bf1a _sigtramp + 26
3 libsystem_platform.dylib 0x00007fa9549833d0 _sigtramp + 3357897936
4 libsystem_c.dylib 0x00007fff8c8edb53 abort + 129
5 libsystem_c.dylib 0x00007fff8c8b5c39 basename + 0
6 swift 0x000000010f0fcdd8 swift::SILModule::getOrCreateFunction(swift::SILLocation, llvm::StringRef, swift::SILLinkage, swift::CanTypeWrapper<swift::SILFunctionType>, swift::IsBare_t, swift::IsTransparent_t, swift::IsFragile_t, swift::IsThunk_t, swift::SILFunction::ClassVisibility_t) + 472
7 swift 0x000000010f0fd6c8 swift::SILModule::getOrCreateSharedFunction(swift::SILLocation, llvm::StringRef, swift::CanTypeWrapper<swift::SILFunctionType>, swift::IsBare_t, swift::IsTransparent_t, swift::IsFragile_t, swift::IsThunk_t) + 88
8 swift 0x000000010f1a1341 swift::Lowering::SILGenModule::getOrCreateReabstractionThunk(swift::GenericParamList*, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::IsFragile_t) + 689
9 swift 0x000000010f1f3664 createThunk(swift::Lowering::SILGenFunction&, swift::SILLocation, TranslationKind, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::TypeLowering const&) + 324
10 swift 0x000000010f1f50e5 (anonymous namespace)::SubstToOrig::transformFunction(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>) + 277
11 swift 0x000000010f1ede83 (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 1427
12 swift 0x000000010f1eedab swift::Lowering::SILGenFunction::emitSubstToOrigValue(swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 91
13 swift 0x000000010f187c6a (anonymous namespace)::ArgEmitter::emitDirect(swift::SILLocation, swift::Lowering::RValue&&, swift::Lowering::AbstractionPattern, swift::SILParameterInfo, swift::Lowering::SGFContext) + 362
14 swift 0x000000010f18462f (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 991
15 swift 0x000000010f186811 (anonymous namespace)::ArgEmitter::emitShuffle(swift::Expr*, swift::Expr*, llvm::ArrayRef<swift::TupleTypeElt>, swift::ConcreteDeclRef, llvm::ArrayRef<swift::Expr*>, llvm::ArrayRef<int>, swift::Type, swift::Lowering::AbstractionPattern) + 3425
16 swift 0x000000010f18580a (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 1274
17 swift 0x000000010f1846a6 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 1110
18 swift 0x000000010f183b04 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<std::__1::pair<swift::Lowering::LValue, swift::SILLocation> >&, llvm::Optional<swift::ForeignErrorConvention> const&) && + 244
19 swift 0x000000010f174b70 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3120
20 swift 0x000000010f173a0a swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 58
21 swift 0x000000010f1b2c57 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 87
22 swift 0x000000010f1b09dd swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 445
23 swift 0x000000010f1ff2a8 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 536
24 swift 0x000000010f1ff085 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
25 swift 0x000000010f1c7136 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 390
26 swift 0x000000010f16a3ed swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 253
27 swift 0x000000010f20533c (anonymous namespace)::SILGenType::emitType() + 956
28 swift 0x000000010f204ede swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30
29 swift 0x000000010f16d28b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 571
30 swift 0x000000010f16e06f swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 703
31 swift 0x000000010f16e28b swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 123
32 swift 0x000000010ef77691 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 9153
33 swift 0x000000010ef750b3 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2515
34 swift 0x000000010ef7128f main + 1983
35 libdyld.dylib 0x00007fff876c55c9 start + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment