Skip to content

Parameter packs cannot return zero or single-element tuples from protocols #79010

@JessyCatterwaul

Description

@JessyCatterwaul

Description

This may be related to #79008.

Reproduction

protocol Protocol {
  static func ƒ<each T>() -> (repeat each T)
  static subscript<each T>() -> (repeat each T) { get }
}

A pack of multiple values is fine:

func ƒ<P: Protocol>(_: P.Type) {
  _ = P.ƒ() as (Void, Never)
  _ = P[] as (Void, Never)
}

But fewer than that is a problem. These crash the compiler:

_ = P.ƒ() as Void
_ = P[] as Never

Expected behavior

All arities are usable.

Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.parameter packsFeature → generics: Parameter packs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions