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

cannot reconstruct metatype of protocol composition existential #78802

Open
tayloraswift opened this issue Jan 22, 2025 · 1 comment
Open

cannot reconstruct metatype of protocol composition existential #78802

tayloraswift opened this issue Jan 22, 2025 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software demangling Area → compiler: The `libswiftDemangling` library existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values protocol compositions Feature → types: protocol composition types regression Swift 6.2-dev types Feature: types

Comments

@tayloraswift
Copy link
Member

tayloraswift commented Jan 22, 2025

Description

the test program below crashes on swift-DEVELOPMENT-SNAPSHOT-2025-01-10. this only happens when using -g, which SwiftPM uses

it also crashes on Fiddle

Reproduction

var x:any (Sequence<String> & Sendable).Type

Stack dump

$ /swift/swift-DEVELOPMENT-SNAPSHOT-2025-01-10-a-ubuntu24.04/usr/bin/swiftc _crash.swift -g
error: compile command failed due to signal 6 (use -v to see invocation)
Failed to reconstruct type for $ss8Sendable_STpSS7ElementSTRts_XPXmTD
Original type:
(existential_metatype_type thick
  (protocol_composition_type
    (protocol_type decl="Swift.(file).Sendable")
    (parameterized_protocol_type
      (base=protocol_type decl="Swift.(file).Sequence")
      (struct_type decl="Swift.(file).String"))))
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Pass '-Xfrontend -disable-round-trip-debug-types' to disable this assertion.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: /swift/swift-DEVELOPMENT-SNAPSHOT-2025-01-10-a-ubuntu24.04/usr/bin/swift-frontend -frontend -c -primary-file _crash.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -empty-abi-descriptor -resource-dir /swift/swift-DEVELOPMENT-SNAPSHOT-2025-01-10-a-ubuntu24.04/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /swift/swift-bson -module-name _crash -in-process-plugin-server-path /swift/swift-DEVELOPMENT-SNAPSHOT-2025-01-10-a-ubuntu24.04/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /swift/swift-DEVELOPMENT-SNAPSHOT-2025-01-10-a-ubuntu24.04/usr/lib/swift/host/plugins -plugin-path /swift/swift-DEVELOPMENT-SNAPSHOT-2025-01-10-a-ubuntu24.04/usr/local/lib/swift/host/plugins -o /tmp/TemporaryDirectory.cRQLhm/_crash-2.o
1.      Swift version 6.2-dev (LLVM 81859ac55f8d09a, Swift 8ec8a1229a7ea14)
2.      Compiling with effective version 5.10
3.      While evaluating request IRGenRequest(IR Generation for file "_crash.swift")
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 0x000057933084d4d8
1  swift-frontend 0x000057933084b07e
2  swift-frontend 0x000057933084db78
3  libc.so.6      0x00007e7660445320
4  libc.so.6      0x00007e766049eb1c pthread_kill + 284
5  libc.so.6      0x00007e766044526e gsignal + 30
6  libc.so.6      0x00007e76604288ff abort + 223
7  swift-frontend 0x0000579329467ee2
8  swift-frontend 0x000057932946141c
9  swift-frontend 0x0000579329323b64
10 swift-frontend 0x0000579329324810
11 swift-frontend 0x00005793293a3e8f
12 swift-frontend 0x000057932931a864
13 swift-frontend 0x0000579329199675
14 swift-frontend 0x000057932920ac2c
15 swift-frontend 0x000057932920ab89
16 swift-frontend 0x00005793291a3a84
17 swift-frontend 0x000057932919bdf8
18 swift-frontend 0x0000579328d153d6
19 swift-frontend 0x0000579328d10ed5
20 swift-frontend 0x0000579328d0f9b8
21 swift-frontend 0x0000579328d20cca
22 swift-frontend 0x0000579328d1298e
23 swift-frontend 0x0000579328d11b3d
24 swift-frontend 0x0000579328aaaf1a
25 libc.so.6      0x00007e766042a1ca
26 libc.so.6      0x00007e766042a28b __libc_start_main + 139
27 swift-frontend 0x0000579328aa9f15

Expected behavior

this compiled successfully on the 6.0.3 release toolchain

Environment

$ /swift/swift-DEVELOPMENT-SNAPSHOT-2025-01-10-a-ubuntu24.04/usr/bin/swiftc --version
Swift version 6.2-dev (LLVM 81859ac55f8d09a, Swift 8ec8a12)
Target: x86_64-unknown-linux-gnu

Additional information

No response

@tayloraswift tayloraswift 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 22, 2025
@MaxDesiatov MaxDesiatov added type checker Area → compiler: Semantic analysis existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values swift 6.0 Swift 6.2-dev and removed triage needed This issue needs more specific labels swift 6.0 labels Jan 22, 2025
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler itself demangling Area → compiler: The `libswiftDemangling` library regression protocol compositions Feature → types: protocol composition types types Feature: types and removed type checker Area → compiler: Semantic analysis labels Jan 24, 2025
@slavapestov
Copy link
Contributor

This isn't implemented yet because we disallow any Sequence<Int> & Sendable. It's an oversight that you can write this metatype in the first place. I have an in-progress implementation in #76705 but ASTDemangler support isn't done yet.

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. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software demangling Area → compiler: The `libswiftDemangling` library existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values protocol compositions Feature → types: protocol composition types regression Swift 6.2-dev types Feature: types
Projects
None yet
Development

No branches or pull requests

4 participants