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

Bad fix suggestion for changing value of capture list constants

    XMLWordPrintable

    Details

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

      Description

      When trying to change the value of capture list constants compiler suggests "change 'let' to 'var' to make it mutable". But that's impossible for capture list.

      Here is the code:

      var a = 1
      
      let f = {
          [a] in
          a = 3
          print(a)
      }
      

        Attachments

          Activity

            People

            • Assignee:
              greg Greg Titus
              Reporter:
              an0 Ling Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: