Skip to content

Existential spelling diagnostic missing for catch #77553

Closed
@hamishknight

Description

@hamishknight

This is an error:

protocol P {
  associatedtype X
}

func foo(_ x: Any) {
  switch x {
  case is P: // error: use of protocol 'P' as a type must be written 'any P'
    break
  default:
    break
  }
}

but this is currently allowed:

do {

} catch is P {}

We ought to raise the same error.

Metadata

Metadata

Assignees

Labels

accepts invalidBug: Accepts invalidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysis

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions