Skip to content

Compiler crash when converting a KeyPath on a non-copyable type to a closure: "Invalid conformance in type-checked AST" #84150

@porglezomp

Description

@porglezomp

Description

While implementing a non-copyable container, I encountered a crash while trying to use my map method on a keypath.
Passing a KeyPath based at a non-copyable type to a parameter that expects a closure consistently crashes.
Passing a closure which does the equivalent field access does not crash.
Using any ownership convention (borrowing, inout, consuming) all crash the same way.

Reproduction

struct HasID: ~Copyable {
    let id: Int
}

func map(_ operation: (consuming HasID) -> Int) {}

func example() {
    map(\.id)
}

Compile with:

$ swiftc -c Example.swift

Stack dump

<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
<unknown>:0: note: Invalid conformance in type-checked AST
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: swift-frontend -frontend -c -primary-file CrashKeyPath.swift -target arm64-apple-darwin24.6.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -color-diagnostics -in-process-plugin-server-path /Users/cassie/Development/oss/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Users/cassie/Development/oss/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/lib/swift/host/plugins -plugin-path /Users/cassie/Development/oss/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/local/lib/swift/host/plugins -dwarf-version=5 -module-name CrashKeyPath -o CrashKeyPath.o
1.	Swift version 6.3-dev (LLVM 73f0f4667f22bd1, Swift c987ea9c8e684c2)
2.	Compiling with effective version 5.10
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "CrashKeyPath.swift")
4.	While silgen emitFunction SIL function "@$s12CrashKeyPath7exampleyyF".
 for 'example()' (at CrashKeyPath.swift:7:1)
5.	While silgen closureexpr SIL function "@$s12CrashKeyPath7exampleyyFSiAA5HasIDVcfu_".
 for expression at [CrashKeyPath.swift:8:9 - line:8:11] RangeText="\."
  #0 0x000000010b7d29d4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (swift-frontend+0x1093529d4)
  #1 0x000000010b7d0f28 llvm::sys::RunSignalHandlers() (swift-frontend+0x109350f28)
  #2 0x000000010b7d302c SignalHandler(int, __siginfo*, void*) (swift-frontend+0x10935302c)
  #3 0x000000018e9556a4 (/usr/lib/system/libsystem_platform.dylib+0x1804ad6a4)
  #4 0x000000018e91b88c (/usr/lib/system/libsystem_pthread.dylib+0x18047388c)
  #5 0x000000018e824a3c (/usr/lib/system/libsystem_c.dylib+0x18037ca3c)
  #6 0x0000000102d3fc80 swift::DiagnosticHelper::Implementation::diagnoseFatalError(char const*, bool) (swift-frontend+0x1008bfc80)
  #7 0x0000000102d3ffdc swift::DiagnosticHelper::diagnoseFatalError(char const*, bool) (swift-frontend+0x1008bffdc)
  #8 0x00000001028b95e8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_0::operator()(void*, char const*, bool) const (swift-frontend+0x1004395e8)
  #9 0x00000001028b95a4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_0::__invoke(void*, char const*, bool) (swift-frontend+0x1004395a4)
 #10 0x000000010b73be88 llvm::report_fatal_error(llvm::Twine const&, bool) (swift-frontend+0x1092bbe88)
 #11 0x000000010b73bd88 llvm::report_fatal_error(llvm::Twine const&, bool) (swift-frontend+0x1092bbd88)
 #12 0x00000001038530e4 swift::Lowering::SILGenModule::useConformance(swift::ProtocolConformanceRef) (swift-frontend+0x1013d30e4)
 #13 0x000000010385344c swift::Lowering::SILGenModule::useConformancesFromSubstitutions(swift::SubstitutionMap) (swift-frontend+0x1013d344c)
 #14 0x0000000103859d00 swift::Lowering::SILGenModule::useConformancesFromType(swift::CanType)::$_0::operator()(swift::Type) const (swift-frontend+0x1013d9d00)
 #15 0x0000000103859bc8 void llvm::function_ref<void (swift::CanType)>::callback_fn<swift::Lowering::SILGenModule::useConformancesFromType(swift::CanType)::$_0>(long, swift::CanType) (swift-frontend+0x1013d9bc8)
 #16 0x000000010312e714 llvm::function_ref<void (swift::CanType)>::operator()(swift::CanType) const (swift-frontend+0x100cae714)
 #17 0x000000010312e6d0 swift::CanType::visit(llvm::function_ref<void (swift::CanType)>) const::'lambda'(swift::Type)::operator()(swift::Type) const (swift-frontend+0x100cae6d0)
 #18 0x000000010312e684 bool llvm::function_ref<bool (swift::CanType)>::callback_fn<swift::CanType::visit(llvm::function_ref<void (swift::CanType)>) const::'lambda'(swift::Type)>(long, swift::CanType) (swift-frontend+0x100cae684)
 #19 0x0000000102ee6228 llvm::function_ref<bool (swift::CanType)>::operator()(swift::CanType) const (swift-frontend+0x100a66228)
 #20 0x0000000102ee61ec swift::CanType::findIf(llvm::function_ref<bool (swift::CanType)>) const::'lambda'(swift::Type)::operator()(swift::Type) const (swift-frontend+0x100a661ec)
 #21 0x0000000102ee61a0 bool llvm::function_ref<bool (swift::Type)>::callback_fn<swift::CanType::findIf(llvm::function_ref<bool (swift::CanType)>) const::'lambda'(swift::Type)>(long, swift::Type) (swift-frontend+0x100a661a0)
 #22 0x0000000105360780 llvm::function_ref<bool (swift::Type)>::operator()(swift::Type) const (swift-frontend+0x102ee0780)
 #23 0x0000000106ddecd8 swift::Type::findIf(llvm::function_ref<bool (swift::Type)>) const::Walker::walkToTypePre(swift::Type) (swift-frontend+0x10495ecd8)
 #24 0x0000000106e618ac (anonymous namespace)::Traversal::doIt(swift::Type) (swift-frontend+0x1049e18ac)
 #25 0x0000000106e61834 swift::Type::walk(swift::TypeWalker&) const (swift-frontend+0x1049e1834)
 #26 0x0000000102c65d60 swift::Type::walk(swift::TypeWalker&&) const (swift-frontend+0x1007e5d60)
 #27 0x0000000106dba054 swift::Type::findIf(llvm::function_ref<bool (swift::Type)>) const (swift-frontend+0x10493a054)
 #28 0x0000000102ee5b54 swift::CanType::findIf(llvm::function_ref<bool (swift::CanType)>) const (swift-frontend+0x100a65b54)
 #29 0x00000001031103cc swift::CanType::visit(llvm::function_ref<void (swift::CanType)>) const (swift-frontend+0x100c903cc)
 #30 0x0000000103853664 swift::Lowering::SILGenModule::useConformancesFromType(swift::CanType) (swift-frontend+0x1013d3664)
 #31 0x000000010385ad54 LazyConformanceEmitter::visitCopyValueInst(swift::CopyValueInst*) (swift-frontend+0x1013dad54)
 #32 0x0000000103853e20 swift::SILInstructionVisitor<LazyConformanceEmitter, void>::visit(swift::SILInstruction*) (swift-frontend+0x1013d3e20)
 #33 0x00000001038538dc swift::Lowering::SILGenModule::emitLazyConformancesForFunction(swift::SILFunction*) (swift-frontend+0x1013d38dc)
 #34 0x00000001036de2e4 swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) (swift-frontend+0x10125e2e4)
 #35 0x00000001036dc1bc swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) (swift-frontend+0x10125c1bc)
 #36 0x00000001037013ac swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&)::$_0::operator()() const (swift-frontend+0x1012813ac)
 #37 0x0000000103701298 void llvm::function_ref<void ()>::callback_fn<swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&)::$_0>(long) (swift-frontend+0x101281298)
 #38 0x00000001025f1cf8 llvm::function_ref<void ()>::operator()() const (swift-frontend+0x100171cf8)
 #39 0x0000000104054d64 swift::Lowering::TypeConverter::withClosureTypeInfo(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&, llvm::function_ref<void ()>) (swift-frontend+0x101bd4d64)
 #40 0x00000001036e0c28 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&) (swift-frontend+0x101260c28)
 #41 0x0000000103817fb8 (anonymous namespace)::RValueEmitter::emitClosureReference(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&) (swift-frontend+0x101397fb8)
 #42 0x0000000103817a8c (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) (swift-frontend+0x101397a8c)
 #43 0x00000001038178b0 (anonymous namespace)::RValueEmitter::visitCaptureListExpr(swift::CaptureListExpr*, swift::Lowering::SGFContext)::$_0::operator()(swift::AbstractClosureExpr*) const (swift-frontend+0x1013978b0)
 #44 0x0000000103817818 swift::Lowering::ManagedValue llvm::function_ref<swift::Lowering::ManagedValue (swift::AbstractClosureExpr*)>::callback_fn<(anonymous namespace)::RValueEmitter::visitCaptureListExpr(swift::CaptureListExpr*, swift::Lowering::SGFContext)::$_0>(long, swift::AbstractClosureExpr*) (swift-frontend+0x101397818)
 #45 0x0000000103817590 llvm::function_ref<swift::Lowering::ManagedValue (swift::AbstractClosureExpr*)>::operator()(swift::AbstractClosureExpr*) const (swift-frontend+0x101397590)
 #46 0x00000001038173fc emitCaptureListExpr(swift::Lowering::SILGenFunction&, swift::CaptureListExpr*, llvm::function_ref<swift::Lowering::ManagedValue (swift::AbstractClosureExpr*)>) (swift-frontend+0x1013973fc)
 #47 0x000000010380a114 (anonymous namespace)::RValueEmitter::visitCaptureListExpr(swift::CaptureListExpr*, swift::Lowering::SGFContext) (swift-frontend+0x10138a114)
 #48 0x00000001037f7db4 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) (swift-frontend+0x101377db4)
 #49 0x00000001037ea858 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) (swift-frontend+0x10136a858)
 #50 0x00000001037ee670 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) (swift-frontend+0x10136e670)
 #51 0x00000001037b1cac swift::Lowering::SILGenFunction::emitConvertedRValue(swift::Expr*, swift::Lowering::Conversion const&, swift::Lowering::SGFContext)::$_0::operator()(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext) const (swift-frontend+0x101331cac)
 #52 0x00000001037b1c10 swift::Lowering::ManagedValue llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>::callback_fn<swift::Lowering::SILGenFunction::emitConvertedRValue(swift::Expr*, swift::Lowering::Conversion const&, swift::Lowering::SGFContext)::$_0>(long, swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext) (swift-frontend+0x101331c10)
 #53 0x00000001037a3318 llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>::operator()(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext) const (swift-frontend+0x101323318)
 #54 0x00000001037a6644 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) (swift-frontend+0x101326644)
 #55 0x00000001037a677c swift::Lowering::SILGenFunction::emitConvertedRValue(swift::Expr*, swift::Lowering::Conversion const&, swift::Lowering::SGFContext) (swift-frontend+0x10132677c)
 #56 0x000000010380cd40 (anonymous namespace)::RValueEmitter::visitFunctionConversionExpr(swift::FunctionConversionExpr*, swift::Lowering::SGFContext) (swift-frontend+0x10138cd40)
 #57 0x00000001037f81cc swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) (swift-frontend+0x1013781cc)
 #58 0x00000001037ea858 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) (swift-frontend+0x10136a858)
 #59 0x00000001037ee670 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) (swift-frontend+0x10136e670)
 #60 0x0000000103727068 (anonymous namespace)::ArgEmitter::emitDirect(swift::Lowering::ArgumentSource&&, swift::SILType, swift::Lowering::AbstractionPattern, swift::SILParameterInfo, std::__1::optional<swift::AnyFunctionType::Param>) (swift-frontend+0x1012a7068)
 #61 0x0000000103724364 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, bool, std::__1::optional<swift::AnyFunctionType::Param>) (swift-frontend+0x1012a4364)
 #62 0x00000001037115b8 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, bool, std::__1::optional<swift::AnyFunctionType::Param>) (swift-frontend+0x1012915b8)
 #63 0x000000010371d18c (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern, llvm::ArrayRef<swift::LifetimeDependenceInfo>) (swift-frontend+0x10129d18c)
 #64 0x0000000103745f74 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::LifetimeDependenceInfo>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && (swift-frontend+0x1012c5f74)
 #65 0x0000000103744b7c (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::LifetimeDependenceInfo>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) (swift-frontend+0x1012c4b7c)
 #66 0x0000000103744028 (anonymous namespace)::CallEmission::applyNormalCall(swift::Lowering::SGFContext) (swift-frontend+0x1012c4028)
 #67 0x0000000103742f68 (anonymous namespace)::CallEmission::applyFirstLevelCallee(swift::Lowering::SGFContext) (swift-frontend+0x1012c2f68)
 #68 0x0000000103713c7c (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) (swift-frontend+0x101293c7c)
 #69 0x00000001037137d0 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) (swift-frontend+0x1012937d0)
 #70 0x0000000103820238 (anonymous namespace)::RValueEmitter::visitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) (swift-frontend+0x1013a0238)
 #71 0x000000010380c2a0 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visitCallExpr(swift::CallExpr*, swift::Lowering::SGFContext) (swift-frontend+0x10138c2a0)
 #72 0x00000001037f808c swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) (swift-frontend+0x10137808c)
 #73 0x00000001037ea858 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) (swift-frontend+0x10136a858)
 #74 0x00000001037ef020 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) (swift-frontend+0x10136f020)
 #75 0x000000010393f4a8 (anonymous namespace)::StmtEmitter::visitBraceStmt(swift::BraceStmt*) (swift-frontend+0x1014bf4a8)
 #76 0x000000010393a2b4 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) (swift-frontend+0x1014ba2b4)
 #77 0x000000010393a214 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) (swift-frontend+0x1014ba214)
 #78 0x000000010383ea4c swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) (swift-frontend+0x1013bea4c)
 #79 0x00000001036dc45c swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) (swift-frontend+0x10125c45c)
 #80 0x00000001036df0a4 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) (swift-frontend+0x10125f0a4)
 #81 0x00000001036db77c swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) (swift-frontend+0x10125b77c)
 #82 0x00000001036db5e8 swift::Lowering::SILGenModule::visitFuncDecl(swift::FuncDecl*) (swift-frontend+0x10125b5e8)
 #83 0x00000001036db340 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) (swift-frontend+0x10125b340)
 #84 0x00000001036dafc8 swift::Lowering::SILGenModule::visit(swift::Decl*) (swift-frontend+0x10125afc8)
 #85 0x00000001036e3780 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) (swift-frontend+0x101263780)
 #86 0x00000001036e40cc swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const (swift-frontend+0x1012640cc)
 #87 0x0000000103939528 std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)17>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const (swift-frontend+0x1014b9528)
 #88 0x0000000103939474 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&) (swift-frontend+0x1014b9474)
 #89 0x0000000103702da8 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'()) (swift-frontend+0x101282da8)
 #90 0x0000000103702cac swift::ASTLoweringRequest::OutputType swift::Evaluator::operator()<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'(), (void*)0>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) (swift-frontend+0x101282cac)
 #91 0x00000001036e4834 swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest) (swift-frontend+0x101264834)
 #92 0x00000001036e4ac0 swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) (swift-frontend+0x101264ac0)
 #93 0x000000010289e104 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) (swift-frontend+0x10041e104)
 #94 0x00000001028c8ed4 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_6::operator()(swift::CompilerInstance&) const (swift-frontend+0x100448ed4)
 #95 0x00000001028c8e3c bool llvm::function_ref<bool (swift::CompilerInstance&)>::callback_fn<performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_6>(long, swift::CompilerInstance&) (swift-frontend+0x100448e3c)
 #96 0x00000001028c8384 llvm::function_ref<bool (swift::CompilerInstance&)>::operator()(swift::CompilerInstance&) const (swift-frontend+0x100448384)
 #97 0x00000001028c7074 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) (swift-frontend+0x100447074)
 #98 0x00000001028c1210 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*) (swift-frontend+0x100441210)
 #99 0x00000001028a1ad8 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) (swift-frontend+0x100421ad8)
#100 0x000000010289fa88 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (swift-frontend+0x10041fa88)
#101 0x00000001024b90ac run_driver(llvm::StringRef, llvm::ArrayRef<char const*>, llvm::ArrayRef<char const*>) (swift-frontend+0x1000390ac)
#102 0x00000001024b84d8 swift::mainEntry(int, char const**) (swift-frontend+0x1000384d8)
#103 0x00000001024b7c68 main (swift-frontend+0x100037c68)
#104 0x000000018e57ab98 

Expected behavior

Using map { $0.id } instead of map(\.id) works correctly and does not encounter a crash.

Environment

$ swiftly use
main-snapshot-2025-09-04 (default)
$ swiftc --version
Apple Swift version 6.2-dev (LLVM d04575f608ab42f, Swift cbcef93a5469a1a)
Target: arm64-apple-macosx15.0
Build config: +assertions

Tested on macOS 24E263 but that is probably not relevant.

Re-verified with a local debug build to get a symbolicated backtrace:

Swift version 6.3-dev (LLVM 73f0f4667f22bd1, Swift c987ea9c8e684c2)

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwarekey pathsFeature: key paths (both native and Objective-C)noncopyable struct/enumFeature → declarations: Noncopyable value type declarationstriage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions