Skip to content

[5.7][ConstraintSystem] Allow injecting callAsFunction after defaulted a… #59732

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

Merged
merged 1 commit into from
Jun 28, 2022

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jun 27, 2022

…rguments

Cherry-pick of #59432


  • Adjust argument matching to be less aggressive while matching misplaced trailing closures
    against defaulted parameters that do not accept trailing closures.

    For example:

    func test(a: Int? = 42, b: String? = nil) {}
    
    test {
      ...
    }

    Trailing closure in this case should be marked as "extraneous" instead of matched
    against parameter a:.

  • If trailing closure is extraneous in a call to .init on callable type, let's not attempt to
    to fix it and allow solver to inject .callAsFunction first.

Resolves: rdar://problem/94959816

(cherry picked from commit ea4ac2c)
(cherry picked from commit 2750e69)

…rguments

- Adjust argument matching to be less aggressive while matching misplaced trailing closures
   against defaulted parameters that do not accept trailing closures.

   For example:

   ```swift
   func test(a: Int? = 42, b: String? = nil) {}

   test {
     ...
   }
   ```

  Trailing closure in this case should be marked as "extraneous" instead of matched
   against parameter `a:`.

- If trailing closure is extraneous in a call to `.init` on callable type, let's not attempt to
   to fix it and allow solver to inject `.callAsFunction` first.

Resolves: rdar://problem/94959816

(cherry picked from commit ea4ac2c)
(cherry picked from commit 2750e69)
@xedin xedin added the r5.7 label Jun 27, 2022
@xedin xedin requested a review from hborla June 27, 2022 20:34
@xedin xedin requested a review from a team as a code owner June 27, 2022 20:34
@xedin xedin changed the title [ConstraintSystem] Allow injecting callAsFunction after defaulted a… [5.7][ConstraintSystem] Allow injecting callAsFunction after defaulted a… Jun 27, 2022
@xedin
Copy link
Contributor Author

xedin commented Jun 27, 2022

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jun 28, 2022

@swift-ci please test macOS platform

@xedin xedin merged commit 6142c3c into swiftlang:release/5.7 Jun 28, 2022
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.7 labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants