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

fix Issue 15785 - spurious warning when calling protected super #5530

Merged
merged 1 commit into from
Mar 19, 2016

Conversation

MartinNowak
Copy link
Member

  • allow access to protected symbols accessible through base class
  • need to check visibility for qualified lookups from the current scope

- allow access to protected symbols accessible through base class
- need to check visibility for qualified lookups from the current scope
@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
15785 [DMD HEAD] Spurious warning when calling protected super

@MartinNowak
Copy link
Member Author

What I missed in #5472 is that checking visibility of a symbol based on the module is sufficient for unqualified lookup b/c base classes are searched via the scope chain and can allow access to protected symbols (see here), but for qualified lookups the visibility needs to be explicitly checked from the lookup scope in order to correctly handle protected symbols.

* s = symbol to check for visibility
* Returns: true if s is visible by origin
*/
extern (C++) bool symbolIsVisible(Scope *sc, Dsymbol s)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we'd pass the current scope from Scope.search to Dsymbol.search, then it might be possible to replace the above overloads w/ this newly added function, but I'd like to try that separately of this regression fix.

@9rnsr
Copy link
Contributor

9rnsr commented Mar 19, 2016

LGTM.

@9rnsr
Copy link
Contributor

9rnsr commented Mar 19, 2016

Auto-merge toggled on

9rnsr added a commit that referenced this pull request Mar 19, 2016
fix Issue 15785 - spurious warning when calling protected super
@9rnsr 9rnsr merged commit a0514fb into dlang:master Mar 19, 2016
@MartinNowak MartinNowak deleted the fix15785 branch March 19, 2016 12:14
@MartinNowak
Copy link
Member Author

Thanks

@CyberShadow
Copy link
Member

This pull request may have introduced a regression:
https://issues.dlang.org/show_bug.cgi?id=17643

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.

4 participants