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-15854] Compiler thinks function closure parameter default value "throws" when it's not #58128

Closed
mattyoung opened this issue Feb 12, 2022 · 0 comments

Comments

@mattyoung
Copy link

mattyoung commented Feb 12, 2022

Previous ID SR-15854
Radar None
Original Reporter @mattyoung
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode Version 13.3 beta 2 (13E5095k)

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

md5: 4c20bc25d194caaf0caaa25c7402115b

duplicates:

  • SR-1534 Error: Call is to rethrows function, but a defaulted argument function can throw

Issue Description:

func f<Target: Comparable>(_ a: Target, _ b: Target, areInIncreasingOrder: (Target, Target) throws -> Bool = (<)) rethrows -> Bool {
    try areInIncreasingOrder(a, b)
}

#warning("Compiler bug: compiler think this is throws but it's not")
f(1, 2)    // !! Call can throw but is not marked with 'try'

see: https://forums.swift.org/t/how-to-give-the-last-parameter-its-default-to-operator-func-f-target-comparable-a-target-b-target-areinincreasingorder-target-target-throws-bool-target-rethrows/44967/2

@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
Projects
None yet
Development

No branches or pull requests

1 participant