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

Infinite loop of for-in

    XMLWordPrintable

    Details

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

      Description

       

      This simple for-in clause causes an infinite loop:

      var array = ["hi"]
      for text: String? in array {
          print("hello")
      }
      

       

      It'll be resolved if you change String? to String.

      See also the attached GIF.

      However, I'm not really sure this is a bug or an expected behaviour.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              typesanitizer Varun Gandhi
              Reporter:
              mshibanami Manabu Nakazawa
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: