fix Issue 16085 - wrong visibility warning for overloaded alias symbol#5847
fix Issue 16085 - wrong visibility warning for overloaded alias symbol#5847WalterBright merged 1 commit intodlang:stablefrom
Conversation
|
src/access.d
Outdated
| // alias name = sym; | ||
| // private void name(int) {} | ||
| else if (auto ad = s.isAliasDeclaration()) | ||
| next = ad.overnext; |
There was a problem hiding this comment.
Doesn't seem to work that way, seem like the function is overloadInserted into the aliasee instead.
There was a problem hiding this comment.
Seriously, who came up with the stupid term overnext for nextOverload? It makes thinking about this already messy implementation even harder.
- mark OverDeclaration as overloadable - mark AliasDeclaration as overloadable (depends on aliasee) - replace overloadApply with a custom iteration b/c aliases must not be resolved for visibility checks (i.e. public aliases to private symbols are public) - deal with the messy overloading of aliasees (see comments)
77ca7e1 to
22dc481
Compare
|
I'm a little concerned about this. Consider: Overloading is done before access checking, but this change seems to do it after. Overloading is not supposed to be affected by public/private. |
No, this does not affect overloading! Please compare w/ DIP22 We've discussed this before (at least I mentioned this behavior several times to you) and it was part of the DIP22 PR. |
|
Properly determining the visibility of overloads w/ mixed protection is the point of this PR. |
| * but doesn't recurse nor resolve aliases because protection/visibility is an | ||
| * attribute of the alias not the aliasee. | ||
| */ | ||
| private Dsymbol mostVisibleOverload(Dsymbol s) |
There was a problem hiding this comment.
As the name and comment say, this is just used to determine the combined visibility of overloads. It does not perform any overload resolution.
There was a problem hiding this comment.
I plan some refactoring to merge the new visibility mechanism with the old one (limiting visibility of private imports). When this is done, the signature would become bool hasVisibleOverload(Dsymbol s, Scope* sc, Prot visibility), but right now we need to dig out an actual symbol to check.
|
Thanks |
must not be resolved for visibility checks (i.e. public aliases to
private symbols are public)