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

Build configuration directives can not wrap switch cases

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:

      Description

      This code should be accepted, but it is rejected now:

      switch 10 {
        case 10:
          break
      #if FOO
        case 20:
          break
      #endif
      }
      
      $ swiftc /tmp/a.swift
      /tmp/a.swift:5:3: error: 'case' label can only appear inside a 'switch' statement
        case 20:
        ^
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rintaro Rintaro Ishizaki
                Reporter:
                jpamer Joe Pamer
              • Votes:
                5 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: