Skip to content

cannot reconstruct metatype of protocol composition existential #78802

@tayloraswift

Description

@tayloraswift

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfconstrained existentialsFeature → existentials: constrained existentials such as 'any Collection<Int>'crashBug: A crash, i.e., an abnormal termination of softwaredemanglingArea → compiler: The `libswiftDemangling` libraryexistentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesgenericsFeature: generic declarations and typesprotocol compositionsFeature → types: protocol composition typesregressionswift 6.2typesFeature: types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions