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-2024] REPL doesn't show warning/error when try is redundant or required #4517

Closed
benrimmington opened this issue Jul 8, 2016 · 2 comments
Labels
bug Something isn't working LLDB for Swift

Comments

@benrimmington
Copy link

Previous ID SR-2024
Radar None
Original Reporter @benrimmington
Type Bug
Environment

Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: e14913509b81209ac40e8596206668dc

Issue Description:

Xcode playground shows the expected warning/error:

func test1() {
    do {
        try print("foo") // ⚠️ No calls to throwing functions occur within 'try' expression
    } catch {            // ⚠️ 'catch' block is unreachable because no errors are thrown in 'do' block
        fatalError()
    }
}

func test2() throws {
    try print("foo") // ⚠️ No calls to throwing functions occur within 'try' expression
}

try test1() // ⚠️ No calls to throwing functions occur within 'try' expression

test2() // ⛔️ Call can throw but is not marked with 'try'

REPL doesn't show any warning/error for the above code.

https://forums.swift.org/t/discussion-try-for-function-that-does-not-throw/3328

@Dante-Broggi
Copy link

Is this resolved, or no longer valid? If either, this should be closed.

@benrimmington
Copy link
Author

Tested with Swift 5.3-dev REPL (master branch). Still no warnings or errors.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
@benrimmington benrimmington closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

2 participants