Open
Description
Description
If parameter of foo
is repeat each T
the compiler doesn't crash. When using repeat Foo<each T>
it crashes.
Note that if I remove the conformance declaration it works as well.
Reproduction
struct Foo<T> { }
protocol Bar {
func foo<each T>(
_ foos: repeat Foo<each T>
)
}
struct BarImpl: Bar {
func foo<each T>(
_ foos: repeat Foo<each T>
) {
}
}
Stack dump
Assertion failed: (canForwardOutput == (outputElt.isInContext() || outputElt.isPlusOneOrTrivial(*this)) && "transformation produced a value of the wrong ownership"), function operator(), file SILGenPack.cpp, line 1122.
Stack dump:
0. Program arguments: ${HOME}/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -interpret Reproducer.swift -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -color-diagnostics -swift-version 6 -empty-abi-descriptor -resource-dir ${HOME}/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift -module-name Reproducer -in-process-plugin-server-path ${HOME}/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path ${HOME}/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/host/plugins -plugin-path ${HOME}/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.4 -target-sdk-name macosx15.4 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server
1. Apple Swift version 6.1 (swift-6.1-RELEASE)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module Reproducer)
4. While generating SIL witness table protocol conformance BarImpl: Bar at 'BarImpl' (at Reproducer.swift:9:1)
5. While generating protocol witness thunk SIL function "@$s10Reproducer7BarImplVAA0B0A2aDP3fooyyAA3FooVyqd__Gqd__QpRvd__lFTW".
for 'foo(_:)' (at Reproducer.swift:10:5)
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 0x0000000109dcb884 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000109dc9fb0 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000109dcbec8 SignalHandler(int) + 292
3 libsystem_platform.dylib 0x000000018f268624 _sigtramp + 56
4 libsystem_pthread.dylib 0x000000018f22e88c pthread_kill + 296
5 libsystem_c.dylib 0x000000018f137c60 abort + 124
6 libsystem_c.dylib 0x000000018f136eec err + 0
7 swift-frontend 0x0000000109e809d4 swift::Lowering::SILGenFunction::emitSwitchStmt(swift::SwitchStmt*) (.cold.3) + 0
8 swift-frontend 0x00000001051483e0 void llvm::function_ref<void (swift::SILValue, swift::SILValue, swift::SILValue)>::callback_fn<swift::Lowering::SILGenFunction::emitPackTransform(swift::SILLocation, swift::Lowering::ManagedValue, swift::CanTypeWrapper<swift::PackType>, unsigned int, swift::SILValue, swift::CanTypeWrapper<swift::PackType>, unsigned int, bool, bool, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::ManagedValue, swift::SILType, swift::Lowering::SGFContext)>)::$_0>(long, swift::SILValue, swift::SILValue, swift::SILValue) + 1188
9 swift-frontend 0x0000000105144230 swift::Lowering::SILGenFunction::emitDynamicPackLoop(swift::SILLocation, swift::CanTypeWrapper<swift::PackType>, unsigned int, swift::SILValue, swift::SILValue, swift::GenericEnvironment*, bool, llvm::function_ref<void (swift::SILValue, swift::SILValue, swift::SILValue)>, swift::SILBasicBlock*) + 1676
10 swift-frontend 0x00000001051457f4 swift::Lowering::SILGenFunction::emitPackTransform(swift::SILLocation, swift::Lowering::ManagedValue, swift::CanTypeWrapper<swift::PackType>, unsigned int, swift::SILValue, swift::CanTypeWrapper<swift::PackType>, unsigned int, bool, bool, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::ManagedValue, swift::SILType, swift::Lowering::SGFContext)>) + 808
11 swift-frontend 0x000000010515ed98 (anonymous namespace)::TranslateArguments::process(swift::Lowering::AbstractionPattern, swift::ArrayRefView<swift::AnyFunctionType::Param, swift::AnyFunctionType::CanParam, swift::AnyFunctionType::CanParam::getFromParam(swift::AnyFunctionType::Param const&), true>, swift::Lowering::AbstractionPattern, swift::ArrayRefView<swift::AnyFunctionType::Param, swift::AnyFunctionType::CanParam, swift::AnyFunctionType::CanParam::getFromParam(swift::AnyFunctionType::Param const&), true>, bool) + 1820
12 swift-frontend 0x00000001051617f8 swift::Lowering::SILGenFunction::emitProtocolWitness(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILDeclRef, swift::SubstitutionMap, swift::SILDeclRef, swift::SubstitutionMap, swift::Lowering::IsFreeFunctionWitness_t, bool, bool, std::__1::optional<swift::ActorIsolation>) + 2700
13 swift-frontend 0x000000010518b1f4 swift::Lowering::SILGenModule::emitProtocolWitness(swift::ProtocolConformanceRef, swift::SILLinkage, swift::SerializedKind_t, swift::SILDeclRef, swift::SILDeclRef, swift::Lowering::IsFreeFunctionWitness_t, swift::Witness) + 3308
14 swift-frontend 0x000000010518d8fc (anonymous namespace)::SILGenWitnessTable<(anonymous namespace)::SILGenConformance>::addMethodImplementation(swift::SILDeclRef, swift::SILDeclRef, swift::Witness) + 496
15 swift-frontend 0x000000010518d408 (anonymous namespace)::SILGenWitnessTable<(anonymous namespace)::SILGenConformance>::addMethod(swift::SILDeclRef) + 856
16 swift-frontend 0x000000010518ce64 swift::SILWitnessVisitor<(anonymous namespace)::SILGenConformance>::visitProtocolDecl(swift::ProtocolDecl*) + 2148
17 swift-frontend 0x000000010518a398 swift::Lowering::SILGenModule::getWitnessTable(swift::NormalProtocolConformance*) + 324
18 swift-frontend 0x000000010518c2b4 (anonymous namespace)::SILGenType::emitType() + 1568
19 swift-frontend 0x000000010518bc88 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 24
20 swift-frontend 0x0000000105084f10 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 176
21 swift-frontend 0x000000010508542c swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 632
22 swift-frontend 0x000000010517a238 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 148
23 swift-frontend 0x0000000105089434 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'()) + 340
24 swift-frontend 0x0000000105085798 swift::performASTLowering(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 136
25 swift-frontend 0x0000000104adcd70 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1288
26 swift-frontend 0x0000000104ae8b50 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 164
27 swift-frontend 0x0000000104ade74c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 716
28 swift-frontend 0x0000000104addf68 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2228
29 swift-frontend 0x00000001048c18f0 swift::mainEntry(int, char const**) + 3064
30 dyld 0x000000018ee8eb98 start + 6076
Expected behavior
Code should compile without the compiler crashing.
Environment
Apple Swift version 6.1 (swift-6.1-RELEASE)
Target: arm64-apple-macosx15.0
Additional information
No response