Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-1635] [T!] iterates forever in for-in loop #44244

Closed
swift-ci opened this issue May 28, 2016 · 3 comments
Closed

[SR-1635] [T!] iterates forever in for-in loop #44244

swift-ci opened this issue May 28, 2016 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1635
Radar None
Original Reporter austin (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Tested on latest swift-3.0-preview-1 branch (e51c883), latest master branch (52de534), OS X 10.11.4

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 2c7a6b664acd2daaf353938274f7c36e

Issue Description:

A for-in loop iterating over an array of implicitly unwrapped optional type (e.g. [Int!]) will iterate forever, even though there are a finite number of elements in the array.

var firstInt : Int!
var secondInt : Int!
var thirdInt : Int!

firstInt = 10
secondInt = 20
thirdInt = 30

let someArray = [firstInt, secondInt, thirdInt]

// Expected: prints three values
// Actual: loops forever, prints 'nil' after the three values in the array
for anObject in someArray {
    print(anObject)
}
@CodaFi
Copy link
Member

CodaFi commented Jun 7, 2016

Reproducible on IBMs boxes running 3.0, but not on master anymore (not sure where exactly, but my guess would be 778a4ee). Looks like it was a problem with type inference and the new IUO restrictions.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jun 7, 2016

Comment by Austin Zheng (JIRA)

Thanks CodaFi (JIRA User)! I'll verify on OS X and Linux tonight and close the ticket if the problem's gone.

@slavapestov
Copy link
Member

Works fine in Xcode 8.3.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants