File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -2085,19 +2085,21 @@ void AttributeChecker::visitImplementsAttr(ImplementsAttr *attr) {
2085
2085
}
2086
2086
2087
2087
void AttributeChecker::visitFrozenAttr (FrozenAttr *attr) {
2088
- switch (D->getModuleContext ()->getResilienceStrategy ()) {
2088
+ auto *ED = cast<EnumDecl>(D);
2089
+
2090
+ switch (ED->getModuleContext ()->getResilienceStrategy ()) {
2089
2091
case ResilienceStrategy::Default:
2090
2092
diagnoseAndRemoveAttr (attr, diag::enum_frozen_nonresilient, attr);
2091
2093
return ;
2092
2094
case ResilienceStrategy::Resilient:
2093
2095
break ;
2094
2096
}
2095
2097
2096
- if (cast<EnumDecl>(D) ->getFormalAccess () >= AccessLevel::Public)
2097
- return ;
2098
- if (D-> getAttrs (). hasAttribute <UsableFromInlineAttr>())
2099
- return ;
2100
- diagnoseAndRemoveAttr (attr, diag::enum_frozen_nonpublic, attr);
2098
+ auto access = ED ->getFormalAccess (/* useDC= */ nullptr ,
2099
+ /* isUsageFromInline= */ true ) ;
2100
+ if (access < AccessLevel::Public) {
2101
+ diagnoseAndRemoveAttr (attr, diag::enum_frozen_nonpublic, attr) ;
2102
+ }
2101
2103
}
2102
2104
2103
2105
void TypeChecker::checkDeclAttributes (Decl *D) {
You can’t perform that action at this time.
0 commit comments