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-15091] Can't refer to a subscript in the renamed: field of a deprecation #57417

Closed
lorentey opened this issue Aug 19, 2021 · 3 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser

Comments

@lorentey
Copy link
Member

Previous ID SR-15091
Radar rdar://problem/82141064
Original Reporter @lorentey
Type Bug
Status Resolved
Resolution Done
Environment

Swift 5.5

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Parser
Assignee @lorentey
Priority Medium

md5: acef0dcda495bb440a5b5d69c2acfa3f

Issue Description:

There seems to be no way to deprecate a member and retarget its invocations to a subscript. The `renamed:` argument of a deprecation doesn't accept a reference to a subscript member.

I expected something like this would work:

struct Foo {
  subscript(_ index: Int) -> String { "hello" }

  @available(*, deprecated, renamed: "subscript(_:)")
  subscript(offset offset: Int) -> String { "hello" }
}

Unfortunately, the resulting fix-it changes `self[42]` into `self.subscript`, which loses information, and doesn't even compile.

@typesanitizer
Copy link

@swift-ci create

@swift-ci
Copy link
Collaborator

Comment by Minhyuk Kim (JIRA)

Created a PR here! : #39091

@xedin
Copy link
Member

xedin commented Aug 31, 2021

Fixed by #39091

Please verify using the next available main branch snapshot.

@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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

4 participants