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-420] Incorrect Code Coverage for Optional Binding with Else Statement #43037

Closed
swift-ci opened this issue Dec 30, 2015 · 1 comment · Fixed by #60579
Closed

[SR-420] Incorrect Code Coverage for Optional Binding with Else Statement #43037

swift-ci opened this issue Dec 30, 2015 · 1 comment · Fixed by #60579
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code coverage Area → source tooling: code coverage compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-420
Radar None
Original Reporter Ben-G (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode 7.2 (7C68), Mac OS X 10.11.1 (15B42)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CodeCoverage
Assignee None
Priority Medium

md5: ad23358574c29bc8befa81db8e7bb3e6

Issue Description:

When testing code that involves an optional binding statement and an else statement, the swift compiler (or at least Xcode) reports that a statement, that should not be reachable, is not covered.

Example to reproduce:

func testFunction(input: String?) -> String? {
    if let input = input {
        return input
    } else {
        return input
    }
}

When testing the code above by calling it twice, once with a string instance and once with nil, code coverage will indicate that a statement after the else statement is untested (see attached screenshot).

You can find the full example project on GitHub: https://github.com/Ben-G/AppleBugProjects/tree/master/CodeCoverageIssue.

@Dante-Broggi
Copy link
Contributor

Has this been resolved? If so, it should be 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. code coverage Area → source tooling: code coverage compiler The Swift compiler in itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants