Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter pack assertion failure: This isn't an lvalue #78693

Open
stephencelis opened this issue Jan 16, 2025 · 0 comments
Open

Parameter pack assertion failure: This isn't an lvalue #78693

stephencelis opened this issue Jan 16, 2025 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels

Comments

@stephencelis
Copy link
Contributor

stephencelis commented Jan 16, 2025

Description

Trying out some code related to #78671 on the 01/10/2025 developer snapshot that compiles fine in the 6.0.2 release, I'm hitting an assertion failure:

Reproduction

protocol To<T> {
  associatedtype T
  func t() -> T
}

protocol Fro<T>: To {
  func f(_ t: T)
}

struct Foo<each T> {
  struct Bar<each U>: To {
    func t() -> (repeat each T, repeat each U) {
      fatalError()
    }
  }
}

// This extension causes the crash.
extension Foo.Bar: Fro {
  func f(_ t: (repeat each T, repeat each U)) {
  }
}

Stack dump

Assertion failed: (isLValue() && "This isn't an lvalue"), function getLValueAddress, file ManagedValue.h, line 319.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
1.	Apple Swift version 6.2-dev (LLVM 81859ac55f8d09a, Swift 8ec8a1229a7ea14)
2.	Compiling with the current language version
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for module Parsing)
4.	While generating SIL witness table protocol conformance Foo<repeat each T>.Bar<repeat each U>: Fro at extension of Foo.Bar (at /Users/stephen/Developer/pointfreeco/swift-experiments/swift-parsing-2/Sources/Parsing/Builders/ParserBuilder.swift:451:1)
5.	While generating protocol witness thunk SIL function "@$s7Parsing3FooV3BarVyxxQp_QP_qd__qd__Qp_QPGAA3FroA2aGP1fyy1TQzFTW".
 for 'f(_:)' (at /Users/stephen/Developer/pointfreeco/swift-experiments/swift-parsing-2/Sources/Parsing/Builders/ParserBuilder.swift:452:3)
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           0x000000010acfdf60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x000000010acfc644 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x000000010acfe5bc SignalHandler(int) + 304
3  libsystem_platform.dylib 0x00000001877aae04 _sigtramp + 56
4  libsystem_pthread.dylib  0x0000000187773f70 pthread_kill + 288
5  libsystem_c.dylib        0x0000000187680908 abort + 128
6  libsystem_c.dylib        0x000000018767fc1c err + 0
7  swift-frontend           0x000000010ae4180c (anonymous namespace)::TranslateArguments::expandSingleOuterInnerTuple(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::TupleType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::TupleType>, swift::Lowering::ManagedValue) (.cold.35) + 0
8  swift-frontend           0x0000000105598158 (anonymous namespace)::TranslateArguments::expandSingleOuterInnerTuple(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::TupleType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::TupleType>, swift::Lowering::ManagedValue) + 1876
9  swift-frontend           0x0000000105595ce0 (anonymous namespace)::ExpanderBase<(anonymous namespace)::TranslateArguments, (anonymous namespace)::ParamInfo>::expand(swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType) + 616
10 swift-frontend           0x000000010559c2e4 (anonymous namespace)::TranslateArguments::expandParam(swift::Lowering::AbstractionPattern, swift::AnyFunctionType::CanParam, swift::Lowering::AbstractionPattern, swift::AnyFunctionType::CanParam) + 224
11 swift-frontend           0x000000010558f64c (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) + 2992
12 swift-frontend           0x0000000105591aec 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>) + 2496
13 swift-frontend           0x00000001055bedc8 swift::Lowering::SILGenModule::emitProtocolWitness(swift::ProtocolConformanceRef, swift::SILLinkage, swift::SerializedKind_t, swift::SILDeclRef, swift::SILDeclRef, swift::Lowering::IsFreeFunctionWitness_t, swift::Witness) + 3340
14 swift-frontend           0x00000001055c13e4 (anonymous namespace)::SILGenWitnessTable<(anonymous namespace)::SILGenConformance>::addMethodImplementation(swift::SILDeclRef, swift::SILDeclRef, swift::Witness) + 528
15 swift-frontend           0x00000001055c0d5c (anonymous namespace)::SILGenWitnessTable<(anonymous namespace)::SILGenConformance>::addMethod(swift::SILDeclRef) + 532
16 swift-frontend           0x00000001055c08b8 swift::SILWitnessVisitor<(anonymous namespace)::SILGenConformance>::visitProtocolDecl(swift::ProtocolDecl*) + 1872
17 swift-frontend           0x00000001055bdf4c swift::Lowering::SILGenModule::getWitnessTable(swift::NormalProtocolConformance*) + 324
18 swift-frontend           0x00000001055c010c SILGenExtension::emitExtension(swift::ExtensionDecl*) + 400
19 swift-frontend           0x00000001055bff70 swift::Lowering::SILGenModule::visitExtensionDecl(swift::ExtensionDecl*) + 24
20 swift-frontend           0x00000001054a99f8 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 176
21 swift-frontend           0x00000001054a9f14 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 632
22 swift-frontend           0x00000001055ad280 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           0x00000001054af424 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           0x00000001054aa294 swift::performASTLowering(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 144
25 swift-frontend           0x0000000104e4591c swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1184
26 swift-frontend           0x0000000104e516a4 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
27 swift-frontend           0x0000000104e47418 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 716
28 swift-frontend           0x0000000104e46c34 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2208
29 swift-frontend           0x0000000104bf91b8 swift::mainEntry(int, char const**) + 3100
30 dyld                     0x00000001873f4274 start + 2840

Expected behavior

I expect no crash (and I expect to be able to destructure the parameter pack in the tuple provided to f).

Environment

Apple Swift version 6.2-dev (LLVM 81859ac55f8d09a, Swift 8ec8a12)

Additional information

No response

@stephencelis stephencelis added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant