Uploaded image for project: 'Swift'
  1. Swift
  2. SR-14883

Consider `must` in diagnostic error message for empty `switch` cases

    XMLWordPrintable

    Details

      Description

      When compiling something like:

      ```
      import Darwin

      switch getpid()

      { case 1: default: }

      ```

      compilation fails with the following errors:

      ```
      test.swift:4:1: error: 'case' label in a 'switch' should have at least one executable statement
      case 1:
      ^~~~~~~
      break
      test.swift:5:1: error: 'default' label in a 'switch' should have at least one executable statement
      default:
      ^~~~~~~~
      break
      ```

      Given that these are errors, it seems sensible (to me) to change the wording from `should` to `must`.

        Attachments

          Activity

            People

            Assignee:
            wongzigii Zigii Wong
            Reporter:
            msbit Tom Sullivan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: