Skip to content

Commit e11d3d2

Browse files
committed
Try refining the logic here
1 parent c6a4dce commit e11d3d2

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -565,14 +565,16 @@ static void checkGenericParams(GenericContext *ownerCtx) {
565565
hasPack = true;
566566
}
567567

568-
if (gp->isValue()) {
569-
// Value generic nominal types require runtime support.
570-
//
571-
// Stdlib/libswiftCore carries support for this feature
572-
// Embedded doesn't require runtime support for this feature.
573-
if (isa<NominalTypeDecl>(decl) &&
574-
!decl->getModuleContext()->isStdlibModule() &&
575-
!ctx.LangOpts.hasFeature(Feature::Embedded)) {
568+
// Value generic nominal types require runtime support.
569+
if (gp->isValue() && isa<NominalTypeDecl>(decl)) {
570+
auto nomTypeDecl = cast<NominalTypeDecl>(decl);
571+
// But: Embedded doesn't require runtime support for this feature.
572+
// But: Stdlib/libswiftCore carries its own support,
573+
// so non-public stdlib declarations are safe
574+
if (!ctx.LangOpts.hasFeature(Feature::Embedded) &&
575+
!(decl->getModuleContext()->isStdlibModule() &&
576+
!nomTypeDecl->isAccessibleFrom(nullptr))) {
577+
// Everything else gets diagnosed for availability
576578
TypeChecker::checkAvailability(
577579
gp->getSourceRange(),
578580
ctx.getValueGenericTypeAvailability(),

0 commit comments

Comments
 (0)