Skip to content

Upcoming feature flag ExistentialAny ignores missing any keyword when constraining a protocol #72588

@lukaskollmer

Description

@lukaskollmer

Description

No response

Reproduction

Compiling the following program with -enable-upcoming-feature ExistentialAny succeeds, even though it should fail since the constraint on f's parameter is written as P2 instead of any P2.

protocol P1<T> {
    associatedtype T
}

protocol P2 {}

func f(_: some P1<P2>) {} // <---

Expected behavior

The compiler should (when compiling with the ExistentialAny flag on) require that existential be explicitly spelled with any, as defined in SE-0335.

Environment

Apple Swift version 6.0-dev (LLVM 1ad249b55ef5cc0, Swift b10d97d)
Target: arm64-apple-macosx14.0

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfexistentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesparameterized protocolsFeature → protocol: protocols with primary associated typesprotocolFeature → type declarations: Protocol declarationsswift 6.0type checkerArea → compiler: Semantic analysistypesFeature: typesunexpected behaviorBug: Unexpected behavior or incorrect output

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions