Assertion instead of a proper message

Swift (on Linux) complains about certain unmet expectations too loudly. Maybe make a proper message and exit instead of just asserting?

Assertion failed: Executable products should have exactly one executable target.: file .../Sources/PackageModel/Product.swift, line 77
Current stack trace:
0 libswiftCore.so 0x00007f1d0eb95ebb + 3792571
1 libswiftCore.so 0x00007f1d0ebd76d0 swift_stdlib_reportFatalErrorInFile + 221
2 libswiftCore.so 0x00007f1d0e9463dc + 1369052
3 libswiftCore.so 0x00007f1d0eb80342 + 3703618
4 libswiftCore.so 0x00007f1d0eb817a9 + 3708841
5 libswiftCore.so 0x00007f1d0e945ad6 + 1366742
6 libswiftCore.so 0x00007f1d0eb8010b + 3703051
7 libswiftCore.so 0x00007f1d0e945ad6 + 1366742
8 libswiftCore.so 0x00007f1d0eab3119 + 2863385
9 libswiftCore.so 0x00007f1d0e945440 assertionFailure(:
:file:line:flags:) + 44
10 swift-test 0x0000556e1de0a06f + 3530863
11 swift-test 0x0000556e1de09afa + 3529466
12 swift-test 0x0000556e1ddaf507 + 3159303
13 swift-test 0x0000556e1ddaa7eb + 3139563
14 swift-test 0x0000556e1dd530bd + 2781373
15 swift-test 0x0000556e1dd5939e + 2806686
16 swift-test 0x0000556e1deba996 + 4254102
17 swift-test 0x0000556e1dd50ab1 + 2771633
18 swift-test 0x0000556e1df710d1 + 5001425
19 swift-test 0x0000556e1dc9f21d + 2044445
20 swift-test 0x0000556e1dc6fb3d + 1850173
21 swift-test 0x0000556e1dc9e528 + 2041128
22 swift-test 0x0000556e1de79ef9 + 3989241
23 libc.so.6 0x00007f1d0c860740 __libc_start_main + 240
24 swift-test 0x0000556e1daf8c49 + 314441
Illegal instruction (core dumped)

1 Like

Yeah, we shouldn't assert and instead emit a proper diagnostic here. We use JIRA to track bugs in the package manager. Here are instructions on how to file one: https://github.com/apple/swift-package-manager/blob/master/Documentation/Resources.md#reporting-a-good-swiftpm-bug

Thank you, filed [SR-7279] User-friendly expectations reporting instead of relying on assert · Issue #4895 · apple/swift-package-manager · GitHub

2 Likes