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

Don't treat func signatures as being the same when they are in fact different

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Duplicate
    • Component/s: Compiler
    • Labels:
      None

      Description

      Swift should properly distinguish between single-tuple and multiple-argument function types.
      But it isn't, as demonstrated below.
      The following is the behavior of swift-DEVELOPMENT-SNAPSHOT-2017-06-05-a-osx (-swift-version 4):

      // The second func results in error: "Invalid redeclaration of 'foo'"
      func foo(_ fn: (Int, Int) -> ()) { print("I got a func of two ints!") }
      func foo(_ fn: ((Int, Int)) -> ()) { print("I got a func of a tuple of two ints!") }
      // I would expect this to compile since the args of the two
      // foo functions are of different types.
      

      (Reported as requested by Mark Lacey here:
      https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170605/037013.html
      )

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rudkx Mark Lacey
              Reporter:
              jens Jens Persson
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: