Skip to content

Bad diagnostic for generic parameter list on enum case #69036

Open
@mininny

Description

@mininny

Description

enum Foo {
    case bar<T>(baz: T)
}

above code results in

Consecutive declarations on a line must be separated by ';'
Expected declaration

which is not very helpful for informing the user that generics are not available as a case in enums.

Something like generic parameter 'T' cannot be used in an enum case. did you mean to attach it to enum declaration? could be emitted for better guidance to the users.

Environment

  • Swift compiler version info: swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1) Target: arm64-apple-macosx14.0
  • Xcode version info Xcode 15.0 Build version 15A240d

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdeclarationsFeature: declarationsdiagnostics QoIBug: Diagnostics Quality of Implementationenum casesFeature → enums: Enum casesgenericsFeature: generic declarations and typesparserArea → compiler: The legacy C++ parserswift 6.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions