Skip to content

Commit d90664c

Browse files
committed
Sema: Report public imports of private modules as errors by default
Align the behavior between release and debug compilers to always report this as an error. Downstream compilers already make this an error. rdar://136041870
1 parent 3aed095 commit d90664c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,16 +2411,9 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
24112411
} else
24122412
inFlight.fixItInsert(ID->getStartLoc(), "internal ");
24132413

2414-
#ifndef NDEBUG
2415-
static bool enableTreatAsError = true;
2416-
#else
2417-
static bool enableTreatAsError = getenv("ENABLE_PUBLIC_IMPORT_OF_PRIVATE_AS_ERROR");
2418-
#endif
2419-
24202414
bool isImportOfUnderlying = importer->getName() == target->getName();
24212415
auto *SF = ID->getDeclContext()->getParentSourceFile();
2422-
bool treatAsError = enableTreatAsError &&
2423-
!isImportOfUnderlying &&
2416+
bool treatAsError = !isImportOfUnderlying &&
24242417
SF->Kind != SourceFileKind::Interface;
24252418
if (!treatAsError)
24262419
inFlight.limitBehavior(DiagnosticBehavior::Warning);

0 commit comments

Comments
 (0)