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-14537] Invalid warning when compiling SwiftNIO #56889

Closed
Lukasa opened this issue Apr 27, 2021 · 2 comments
Closed

[SR-14537] Invalid warning when compiling SwiftNIO #56889

Lukasa opened this issue Apr 27, 2021 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@Lukasa
Copy link
Contributor

Lukasa commented Apr 27, 2021

Previous ID SR-14537
Radar rdar://problem/77202996
Original Reporter @Lukasa
Type Bug
Status Closed
Resolution Cannot Reproduce
Environment

swift-driver version: 1.14 Apple Swift version 5.4 (swiftlang-1300.0.5.225 clang-1300.0.6.6)
Target: x86_64-apple-macosx11.0

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

md5: a21247429b5e4137da60f0cd3ff312fa

Issue Description:

The code in SwiftNIO's EventLoopFuture produces an invalid warning. Reproducing the code here:

loop: while true {
    let cbl = onlyCallback()
    switch (cbl.firstCallback, cbl.furtherCallbacks) {
    case (.none, _):
        break loop
    case (.some(let ocb), .none):
        onlyCallback = ocb
        continue loop
    case (.some(_), .some(_)):
        var pending = cbl._allCallbacks()
        while let f = pending.popFirst() {
            let next = f()
            next.appendAllCallbacks(&pending)
        }
        break loop
    }
}

This emits the following incorrect warning:

swift-nio/Sources/NIO/EventLoopFuture.swift:88:13: warning: will never be executed
            loop: while true {
            ^
swift-nio/Sources/NIO/EventLoopFuture.swift:88:25: note: condition always evaluates to true
            loop: while true {
                        ^
@Lukasa
Copy link
Contributor Author

Lukasa commented Apr 27, 2021

@swift-ci create

@eeckstein
Copy link
Member

I cannot reproduce this anymore with a recent Swift 5.5 compiler.
Please reopen this issue if you still see the problem with a recent compiler

@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

2 participants