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-4697] Damned if you do... (access control) #47274

Open
dabrahams opened this issue Apr 25, 2017 · 3 comments
Open

[SR-4697] Damned if you do... (access control) #47274

dabrahams opened this issue Apr 25, 2017 · 3 comments
Assignees
Labels
access control Feature → modifiers: Access control and access levels bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-4697
Radar rdar://problem/31821368
Original Reporter @dabrahams
Type Bug
Status Reopened
Resolution
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, AccessControl, DiagnosticsQoI
Assignee @belkadan
Priority Medium

md5: 9347038bf2369f58d64565a76cde71a6

duplicates:

  • SR-697 Compiler wants protocol extension method to be both private and public at the same time

Issue Description:

...and damned if you don't.

This might be the same as SR-4695, but I wanted to use the issue title 😉

public protocol P {
  associatedtype A
  func f()
}

internal protocol Q : P {}

extension Q where A == ()  {
  public func f() {  }
}

public struct X : Q {
  public typealias A = ()
}
/tmp/x.swift:9:3: error: cannot declare a public instance method in an extension with internal requirements
  public func f() {  }
  ^~~~~~
  internal
/tmp/x.swift:9:15: error: method 'f()' must be declared public because it matches a requirement in public protocol 'P'
  public func f() {  }
              ^
         public 
@dabrahams
Copy link
Collaborator Author

@swift-ci create

@belkadan
Copy link
Contributor

I think this is a very old request of yours. :-) We're still not doing it any time soon.

(This could be considered a separate request to detect that you're in this situation and give a better diagnostic.)

@dabrahams
Copy link
Collaborator Author

Yes, of course this is about the diagnostic. We tell the user, "you can't make this public… oh, and by the way, you have to make this public." The diagnostics should not appear to be self-contradictory. Even better, they should offer a prescription for fixing the problem.

@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
access control Feature → modifiers: Access control and access levels bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

2 participants