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

Revert "Replace expression in ClosureCaptureSyntax with initializer clause" #2793

Closed
wants to merge 1 commit into from

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Aug 9, 2024

Reverts #2763

func test(expr: some ExprSyntaxProtocol) {
  _ = ClosureCaptureSyntax(expression: expr)
}

became ambiguous by this.

@ahoppen
Copy link
Member

ahoppen commented Aug 9, 2024

CC @MAJKFL Could you check why Rintaro’s example is ambiguous and how we can disambiguate it, eg. by adding @_disfavoredOverload to some declaration?

@MAJKFL
Copy link
Contributor

MAJKFL commented Aug 9, 2024

It's ambiguous because we have two deprecated initializers: one with assignToken and the other with equal and both are marked with @_disfavoredOverload. I think the easiest way to fix this would be to remove @_disfavoredOverload from one of them (I think from the one with equal parameter, as it's the most recent one). Should I open a PR?

@ahoppen
Copy link
Member

ahoppen commented Aug 9, 2024

I think the easiest way to fix this would be to remove @_disfavoredOverload from one of them (I think from the one with equal parameter, as it's the most recent one). Should I open a PR?

I think we need the @ _disfavoredOverload for some other ambiguity resolution. Let’s just remove the deprecated initializer with assignToken. That one has been deprecated since 509 (ie. for a year), so I don’t expect that many people still use it. If you could open a PR for that, that would be great!

@MAJKFL
Copy link
Contributor

MAJKFL commented Aug 9, 2024

Ok, I've created #2795 without the initializer and sorry for causing the trouble.

@rintaro
Copy link
Member Author

rintaro commented Aug 9, 2024

I don't think we need @ _disfavoredOverload for the equal: one because any other initializers don't accept equal: but I'm not 100% sure. Alternatively we could remove = nil from assignToken: TokenSyntax? = nil so it's resolved only when users call it with an explicit assignToken: argument.

But I'm totally fine with just removing the old deprecated one 👍

@rintaro rintaro closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants