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-12070] Private typealias used in a private extension, reports that the function needs to be private #54506

Open
swift-ci opened this issue Jan 23, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12070
Radar rdar://problem/58997218
Original Reporter totidev (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 5692a2324d53870d2bf0000c250f75ef

Issue Description:

Assume that you have a private typealias for service results, and you wish to use them in a private extension, then you are presented with an error that the function inside the private extension, needs to be marked as private. It seems that the compiler is not recognising that the code within the extension is already private.

Here is a code example showing the problem:

struct SomeStruct {
  private typealias ServiceResult<T: Decodable> = Result<T, Error>? 
}

private extension SomeStruct {
  // Error reported that 'process' function needs to be private, even though it is within a private extension.
  func process(result: ServiceResult<Int>) { }

  // Works correctly
  private func process2(result: ServiceResult<Int>) { }
}

The same also occurs if you were to declare

private  struct  PrivateStruct { }

Inside of SomeStruct, and then have this as a parameter in a function inside the extension.

@beccadax
Copy link
Contributor

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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
Projects
None yet
Development

No branches or pull requests

2 participants