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

Unused function-typed return values result in a hard error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:
    • Environment:

      OS X 10.10.5, swiftc version 2.1 (swiftlang-700.1.101.6 clang-700.1.76)

      Description

      If a function returns a function, and the return value of the former is unused, a compilation error occurs:

          public func foo(x: Int) -> () -> Int {
              return { x }
          }
      
          foo(42) // ignored return value errors out: "expression resolves to an unused function"
      

      For consistency (and convenience of testing, where I found this problem), such unused return values should yield a warning only.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              H2CO3 Árpád Goretity
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: