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

Assertion failure occurs with a sending subscript parameter through protocol conformance #79041

Open
stzn opened this issue Jan 30, 2025 · 0 comments · May be fixed by #79042
Open

Assertion failure occurs with a sending subscript parameter through protocol conformance #79041

stzn opened this issue Jan 30, 2025 · 0 comments · May be fixed by #79042
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

@stzn
Copy link
Contributor

stzn commented Jan 30, 2025

Description

When using the sending keyword in a subscript parameter through protocol conformance, it triggers an assertion failure when emitting SIL.

Reproduction

class NonSendable {}
protocol P {
    subscript(_: sending NonSendable) -> Bool { get }
}

struct S: P {
    subscript(_: sending NonSendable) -> Bool { true }
}

Stack dump

swift-frontend: /home/build-user/swift/lib/AST/ASTPrinter.cpp:3719: void printParameterFlags(swift::ASTPrinter &, const swift::PrintOptions &, const swift::ParamDecl *, swift::ParameterTypeFlags, bool): Assertion `flags.isSending() && "Only valid when sending is enabled"' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: /usr/bin/swift-frontend -emit-sil -swift-version 6 -
1.      Swift version 6.1-dev (LLVM 0f86f354a7bc883, Swift d3064c5fc64ba06)
2.      Compiling with the current language version
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 0x000061c2f9a44a17
1  swift-frontend 0x000061c2f9a425ce
2  swift-frontend 0x000061c2f9a450ba
3  libc.so.6      0x0000744a2aa08520
4  libc.so.6      0x0000744a2aa5c9fc pthread_kill + 300
5  libc.so.6      0x0000744a2aa08476 raise + 22
6  libc.so.6      0x0000744a2a9ee7f3 abort + 211
7  libc.so.6      0x0000744a2a9ee71b
8  libc.so.6      0x0000744a2a9ffe96
9  swift-frontend 0x000061c2f3f63c09
10 swift-frontend 0x000061c2f3f52e6f
11 swift-frontend 0x000061c2f3f6c144
12 swift-frontend 0x000061c2f3f52c95
13 swift-frontend 0x000061c2f3f6c90a
14 swift-frontend 0x000061c2f3f52c95
15 swift-frontend 0x000061c2f3f52c21
16 swift-frontend 0x000061c2f3699a69
17 swift-frontend 0x000061c2f369a1e0
18 swift-frontend 0x000061c2f3695d0c
19 swift-frontend 0x000061c2f23c866f
20 swift-frontend 0x000061c2f21c4d84
21 swift-frontend 0x000061c2f23c771f
22 swift-frontend 0x000061c2f23c3083
23 swift-frontend 0x000061c2f23c212c
24 swift-frontend 0x000061c2f23d3305
25 swift-frontend 0x000061c2f23c5290
26 swift-frontend 0x000061c2f23c3fc9
27 swift-frontend 0x000061c2f2198e0e
28 libc.so.6      0x0000744a2a9efd90
29 libc.so.6      0x0000744a2a9efe40 __libc_start_main + 128
30 swift-frontend 0x000061c2f2197ea5
timeout: the monitored command dumped core
Aborted

Expected behavior

The crash does not happen.

Environment

Swift version 6.1-dev (LLVM 0f86f354a7bc883, Swift d3064c5)
Target: x86_64-unknown-linux-gnu

swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0

Additional information

No response

@stzn stzn 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 30, 2025
@stzn stzn linked a pull request Jan 30, 2025 that will close this issue
@stzn stzn changed the title Assertion failure occurs with a sending subscript parameter via protocol conformance Assertion failure occurs with a sending subscript parameter through protocol conformance Jan 30, 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

Successfully merging a pull request may close this issue.

1 participant