Skip to content

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

Closed
rintaro wants to merge 1 commit into
mainfrom
revert-2763-closure-capture-syntax-node-update
Closed

Revert "Replace expression in ClosureCaptureSyntax with initializer clause"#2793
rintaro wants to merge 1 commit into
mainfrom
revert-2763-closure-capture-syntax-node-update

Conversation

@rintaro

@rintaro rintaro commented Aug 9, 2024

Copy link
Copy Markdown
Member

Reverts #2763

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

became ambiguous by this.

@ahoppen

ahoppen commented Aug 9, 2024

Copy link
Copy Markdown
Member

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

MAJKFL commented Aug 9, 2024

Copy link
Copy Markdown
Member

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

ahoppen commented Aug 9, 2024

Copy link
Copy Markdown
Member

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

MAJKFL commented Aug 9, 2024

Copy link
Copy Markdown
Member

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

@rintaro

rintaro commented Aug 9, 2024

Copy link
Copy Markdown
Member Author

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