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

Ban autoclosure forwarding

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:
      None
    • Environment:

      Xcode 8.3.3

      Description

      func autoclosureFoo(_ c: @autoclosure () -> Int) {
      	print(c())
      }
      
      func autoclosureBar(_ c: @autoclosure () -> Int) {
      	autoclosureFoo(c) // <-- This one here
      	autoclosureFoo(c())
      }
      
      func baz(_ c: () -> Int) {
      	autoclosureFoo(c) // does not work as expected
      }
      
      autoclosureBar(42)
      

      If this requires a full review on the evolution side, let me know, I'll start a new thread.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              DevAndArtist Adrian Meister
              Reporter:
              DevAndArtist Adrian Meister
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: