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

Spurious "enum element cannot be referenced as an instance member" error

    XMLWordPrintable

    Details

      Description

      func f1() {
          let okAction = UIAlertAction(
              title: "Undo All", style: .default, handler: {
                  _ in self.doUndoAll(nil)
              }
          )
      }
      func f2(_ sender: Any) { }
      

      This results in "Enum element 'default' cannot be referenced as an instance member". But the problem is not in the enum element; it's in the `nil` parameter inside the trailing closure.

      This may be related to https://bugs.swift.org/browse/SR-5069. The latter is marked closed, but perhaps it should not be.

        Attachments

          Activity

            People

            Assignee:
            mattneub Matt Neuburg
            Reporter:
            mattneub Matt Neuburg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: