Open JessyCatterwaul opened 3 weeks ago
The following also fails:
public protocol ConcurrentStream<Failure>: AnyObject {
associatedtype Failure: Error
}
extension ConcurrentStream {
public var sequence: Array<Int> {
get async throws(Failure) {
return []
}
}
}
private final class Foo: ConcurrentStream {
typealias Failure = Never
}
func call() async {
let stream = Foo()
await stream.sequence
}
However, if we modify the last expression to
func call() async throws {
let stream = Foo()
try await stream.sequence
}
It would compile and tell you that, No calls to throwing functions occur within 'try' expression.
The cause is also the typed throws, with Never
being the error.
$ swift --version
swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
Target: arm64-apple-macosx14.0
$ swift build
Building for debugging...
error: compile command failed due to signal 11 (use -v to see invocation)
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/vaida/Desktop/Swift6Playground/Sources/Swift6Playground/Swift6Playground.swift -emit-dependencies-path /Users/vaida/Desktop/Swift6Playground/.build/arm64-apple-macosx/debug/Swift6Playground.build/Swift6Playground.d -emit-reference-dependencies-path /Users/vaida/Desktop/Swift6Playground/.build/arm64-apple-macosx/debug/Swift6Playground.build/Swift6Playground.swiftdeps -target arm64-apple-macosx10.15 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -I /Users/vaida/Desktop/Swift6Playground/.build/arm64-apple-macosx/debug/Modules -I /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/vaida/Desktop/Swift6Playground/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Users/vaida/Desktop/Swift6Playground -Xcc -isysroot -Xcc /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -Xcc -F -Xcc /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name Swift6Playground -package-name swift6playground -disable-clang-spi -target-sdk-version 15.0 -target-sdk-name macosx15.0 -external-plugin-path /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -parse-as-library -o /Users/vaida/Desktop/Swift6Playground/.build/arm64-apple-macosx/debug/Swift6Playground.build/Swift6Playground.swift.o -index-store-path /Users/vaida/Desktop/Swift6Playground/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1. Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/vaida/Desktop/Swift6Playground/Sources/Swift6Playground/Swift6Playground.swift")
4. While silgen emitFunction SIL function "@$s16Swift6Playground4callyyYaF".
for 'call()' (at /Users/vaida/Desktop/Swift6Playground/Sources/Swift6Playground/Swift6Playground.swift:28:1)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000106822cd0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000106820f44 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x00000001068232d8 SignalHandler(int) + 352
3 libsystem_platform.dylib 0x000000018289b584 _sigtramp + 56
4 swift-frontend 0x0000000101d24370 swift::Lowering::SILGenFunction::emitThrow(swift::SILLocation, swift::Lowering::ManagedValue, bool) + 548
5 swift-frontend 0x0000000101d24070 swift::Lowering::SILGenFunction::getTryApplyErrorDest(swift::SILLocation, swift::CanTypeWrapper<swift::SILFunctionType>, swift::Lowering::ExecutorBreadcrumb, swift::SILResultInfo, swift::SILValue, bool) + 544
6 swift-frontend 0x0000000101c11310 emitRawApply(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::SubstitutionMap, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::optionset::OptionSet<swift::ApplyFlags, unsigned char>, llvm::ArrayRef<swift::SILValue>, swift::SILValue, llvm::SmallVectorImpl<swift::SILValue>&, swift::Lowering::ExecutorBreadcrumb) + 2708
7 swift-frontend 0x0000000101c11cc8 swift::Lowering::SILGenFunction::emitApply(std::__1::unique_ptr<swift::Lowering::ResultPlan, std::__1::default_delete<swift::Lowering::ResultPlan>>&&, swift::Lowering::ArgumentScope&&, swift::SILLocation, swift::Lowering::ManagedValue, swift::SubstitutionMap, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::Lowering::CalleeTypeInfo const&, swift::optionset::OptionSet<swift::ApplyFlags, unsigned char>, swift::Lowering::SGFContext, std::__1::optional<swift::ActorIsolation>) + 2280
8 swift-frontend 0x0000000101c18e18 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2244
9 swift-frontend 0x0000000101c1f93c swift::Lowering::SILGenFunction::emitGetAccessor(swift::SILLocation, swift::SILDeclRef, swift::SubstitutionMap, swift::Lowering::ArgumentSource&&, bool, bool, swift::Lowering::PreparedArguments&&, swift::Lowering::SGFContext, bool, std::__1::optional<swift::ActorIsolation>) + 804
10 swift-frontend 0x0000000101cd3464 (anonymous namespace)::GetterSetterComponent::get(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) && + 284
11 swift-frontend 0x0000000101cc5dc4 swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) + 652
12 swift-frontend 0x0000000101c95180 (anonymous namespace)::RValueEmitter::visitSubscriptExpr(swift::SubscriptExpr*, swift::Lowering::SGFContext) + 188
13 swift-frontend 0x0000000101c85d70 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 888
14 swift-frontend 0x0000000101d207c4 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 5532
15 swift-frontend 0x0000000101cb4aa4 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 492
16 swift-frontend 0x0000000101c033d0 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 8252
17 swift-frontend 0x0000000101c03c2c swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 212
18 swift-frontend 0x0000000101c01380 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 172
19 swift-frontend 0x0000000101c07200 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 1804
20 swift-frontend 0x0000000101d1ee68 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 196
21 swift-frontend 0x0000000101c0c0f4 swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 524
22 swift-frontend 0x00000001011ecfdc swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 744
23 swift-frontend 0x00000001011f1468 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1672
24 swift-frontend 0x00000001011ef438 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4752
25 swift-frontend 0x00000001011752d8 swift::mainEntry(int, char const**) + 2812
26 dyld 0x00000001824e20e0 start + 2360
Description
We're supposed to be able to avoid
rethrows
and overloads with similar ideas now, but this usage doesn't work yet:Reproduction
Given this:
This compiles:
But either of these crashes:
It doesn't matter whether the other generic placeholder is input or output. Same result.
Stack dump
Expected behavior
Never
should be usable as theError
.Environment
swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10) Target: arm64-apple-macosx14.0
Additional information
No response