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

Restore Note About Optionality Mismatch in Redeclared Functions Involving IUOs and Optionals

    XMLWordPrintable

    Details

      Description

      We currently consider functions that attempt to overload with an implicitly unwrapped optional and a plain optional to be redeclarations of each other and emit an error

      func test1(i: Int?) {} // 'test1(i:)' previously declared here
      func test1(i: Int!) {} // error: invalid redeclaration of 'test1(i:)'
      

      There used to be a note in Swift 4.1 about how these redeclarations only differed in optionality, but it was removed here https://github.com/apple/swift/commit/f08823757ae39ef7b6ad5b1eb2d7f50942b3f689

      We should really add it back, it was helpful.

        Attachments

          Activity

            People

            Assignee:
            saidhon Saidhon Orifov
            Reporter:
            rwidmann Robert Widmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: