Skip to content

Ignore -enable-testing when compiling for the debugger on getEffectiv… #78486

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4656,13 +4656,19 @@ AccessLevel ValueDecl::getEffectiveAccess() const {
getAdjustedFormalAccess(this, /*useDC=*/nullptr,
/*treatUsableFromInlineAsPublic=*/true);

const bool debuggerSupport = getASTContext().LangOpts.DebuggerSupport;

// Handle @testable/@_private(sourceFile:)
switch (effectiveAccess) {
case AccessLevel::Open:
case AccessLevel::Package:
case AccessLevel::Public:
case AccessLevel::Internal:
if (getModuleContext()->isTestingEnabled() ||
// When compiling code for the debugger, ignore if testing is enabled for
// the purposes of calculating the effective access, otherwise the generated
// code might access a property through a dispatch thunk even if the
// property is private, and the thunk doesn't exist.
if ((getModuleContext()->isTestingEnabled() && !debuggerSupport) ||
getModuleContext()->arePrivateImportsEnabled())
effectiveAccess = getMaximallyOpenAccessFor(this);
break;
Expand Down