You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwareLinuxPlatform: Linuxregressionswift 3.0
import Foundation
public enum Result<T, Error: Swift.Error> {
case success(T)
case failure(Error)
/// Returns the value from `Success` Results or `throw`s the error.
public func dematerialize() throws -> T {
switch self {
case let .success(value):
return value
case let .failure(error):
throw error
}
}
}
And build output:
$ swift build
Compile Swift Module 'Result' (1 sources)
/Result/Result/Result.swift:13:10: error: unable to find implicit conversion function 'Swift._stdlib_getErrorEmbeddedNSError'
throw error
^
SIL verification failed: Basic blocks cannot be empty: !BB.empty()
In function:
sil_scope 1 { loc "/Result/Result/Result.swift":8:14 parent @_TFO6Result6Result13dematerializefzT_x : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 : Error> (@in_guaranteed Result<τ_0_0, τ_0_1>) -> (@out τ_0_0, @error Error) }
sil_scope 2 { loc "/Result/Result/Result.swift":15:2 parent 1 }
sil_scope 3 { loc "/Result/Result/Result.swift":14:3 parent 2 }
sil_scope 4 { loc "/Result/Result/Result.swift":14:3 parent 3 }
sil_scope 5 { loc "/Result/Result/Result.swift":11:11 parent 4 }
sil_scope 6 { loc "/Result/Result/Result.swift":14:3 parent 3 }
sil_scope 7 { loc "/Result/Result/Result.swift":13:10 parent 6 }
// Result.dematerialize() throws -> A
sil @_TFO6Result6Result13dematerializefzT_x : $@convention(method) <T, Error where Error : Error> (@in_guaranteed Result<T, Error>) -> (@out T, @error Error) {
// %0 // user: %9
// %1 // users: %4, %2
bb0(%0 : $*T, %1 : $*Result<T, Error>):
debug_value_addr %1 : $*Result<T, Error>, let, name "self", argno 1, loc "/Result/Result/Result.swift":8:14, scope 1 // id: %2
%3 = alloc_stack $Result<T, Error>, loc "/Result/Result/Result.swift":9:10, scope 2 // users: %20, %14, %11, %6, %5, %4
copy_addr %1 to [initialization] %3 : $*Result<T, Error>, loc "/Result/Result/Result.swift":9:10, scope 2 // id: %4
switch_enum_addr %3 : $*Result<T, Error>, case #Result.success!enumelt.1: bb1, case #Result.failure!enumelt.1: bb2, loc "/Result/Result/Result.swift":10:12, scope 3 // id: %5
bb1: // Preds: bb0
%6 = unchecked_take_enum_data_addr %3 : $*Result<T, Error>, #Result.success!enumelt.1, loc "/Result/Result/Result.swift":10:12, scope 3 // user: %8
%7 = alloc_stack $T, let, name "value", loc "/Result/Result/Result.swift":10:21, scope 4 // users: %10, %9, %8
copy_addr [take] %6 to [initialization] %7 : $*T, loc "/Result/Result/Result.swift":10:21, scope 4 // id: %8
copy_addr [take] %7 to [initialization] %0 : $*T, loc "/Result/Result/Result.swift":11:11, scope 5 // id: %9
dealloc_stack %7 : $*T, loc "/Result/Result/Result.swift":15:2, scope 5 // id: %10
dealloc_stack %3 : $*Result<T, Error>, loc "/Result/Result/Result.swift":15:2, scope 5 // id: %11
%12 = tuple (), loc "/Result/Result/Result.swift":15:2, scope 2 // user: %13
return %12 : $(), loc "/Result/Result/Result.swift":11:4, scope 2 // id: %13
bb2: // Preds: bb0
%14 = unchecked_take_enum_data_addr %3 : $*Result<T, Error>, #Result.failure!enumelt.1, loc "/Result/Result/Result.swift":12:12, scope 3 // user: %16
%15 = alloc_stack $Error, let, name "error", loc "/Result/Result/Result.swift":12:21, scope 6 // users: %19, %18, %16
copy_addr [take] %14 to [initialization] %15 : $*Error, loc "/Result/Result/Result.swift":12:21, scope 6 // id: %16
%17 = builtin "willThrow"(undef : $Error) : $(), loc "/Result/Result/Result.swift":13:4, scope 7
destroy_addr %15 : $*Error, loc "/Result/Result/Result.swift":15:2, scope 7 // id: %18
dealloc_stack %15 : $*Error, loc "/Result/Result/Result.swift":15:2, scope 7 // id: %19
dealloc_stack %3 : $*Result<T, Error>, loc "/Result/Result/Result.swift":15:2, scope 7 // id: %20
throw undef : $Error, loc "/Result/Result/Result.swift":13:4, scope 2 // id: %21
bb3:
bb4:
bb5:
}
0 swift 0x0000000003349ae8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x00000000033482e6 llvm::sys::RunSignalHandlers() + 54
2 swift 0x000000000334a616
3 libpthread.so.0 0x00007fc1fc2a8d10
4 libc.so.6 0x00007fc1fabf01c7 gsignal + 55
5 libc.so.6 0x00007fc1fabf1e2a abort + 362
6 swift 0x0000000000d03e06
7 swift 0x0000000000d014e8
8 swift 0x0000000000cff708 swift::SILFunction::verify(bool) const + 40
9 swift 0x0000000000938ce8
10 swift 0x00000000009427bd
11 swift 0x0000000000938a71
12 swift 0x00000000009de91c
13 swift 0x00000000009de42d
14 swift 0x000000000093f37b
15 swift 0x0000000000940082 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 482
16 swift 0x0000000000940616 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 118
17 swift 0x00000000007e0d8d
18 swift 0x00000000007dcc51 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2833
19 swift 0x00000000007a738b main + 2715
20 libc.so.6 0x00007fc1fabdbac0 __libc_start_main + 240
21 swift 0x00000000007a4e99 _start + 41
Stack dump:
0. Program arguments: /swift-development/build/buildbot_linux/none-swift_package_sandbox_linux-x86_64/usr/bin/swift -frontend -c -primary-file /Result/Result/Result.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /Result/.build/debug -enable-testing -g -module-cache-path /Result/.build/debug/ModuleCache -D SWIFT_PACKAGE -emit-module-doc-path /Result/.build/debug/Result.build/Result~partial.swiftdoc -Onone -parse-as-library -module-name Result -emit-module-path /Result/.build/debug/Result.build/Result~partial.swiftmodule -emit-dependencies-path /Result/.build/debug/Result.build/Result.d -emit-reference-dependencies-path /Result/.build/debug/Result.build/Result.swiftdeps -num-threads 8 -o /Result/.build/debug/Result.build/Result.swift.o
1. While emitting SIL for 'dematerialize' at /Result/Result/Result.swift:8:9
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
swift-build: error: exit(1): /swift-development/build/buildbot_linux/none-swift_package_sandbox_linux-x86_64/usr/bin/swift-build-tool -f /Result/.build/debug.yaml
This compiles successfully if I remove {code:none}import Foundation
The text was updated successfully, but these errors were encountered:
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwareLinuxPlatform: Linuxregressionswift 3.0
Environment
Swift version 3.0-dev (LLVM 17c4c6cf7a, Clang 4ca9e01a7c, Swift fc001e9)
Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
md5: e4decf91fca97883bc7aa04682c6ef16
Issue Description:
When attempting to build Result (https://github.com/antitypical/Result) with the latest Swift master.
Here's a minimal repro:
And build output:
This compiles successfully if I remove {code:none}import Foundation
The text was updated successfully, but these errors were encountered: