Skip to content

Commit 1c0d187

Browse files
authored
Merge pull request swiftlang#39931 from gottesmm/pr-57f4f1ba982c2b00e79684744768c9241be4f4c5
[moveOnly] Simplify some code as per DougG's review in a589b4a
2 parents d012208 + 28b61b8 commit 1c0d187

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,17 +285,15 @@ void AttributeChecker::visitNoImplicitCopyAttr(NoImplicitCopyAttr *attr) {
285285
return;
286286
}
287287

288-
if (vd->hasStorage()) {
289-
// We do not support fields of nominal types now.
290-
if (isa<NominalTypeDecl>(dc)) {
291-
auto error = diag::noimplicitcopy_attr_valid_only_on_local_let;
292-
diagnoseAndRemoveAttr(attr, error);
293-
return;
294-
}
288+
// We only support local lets.
289+
if (!dc->isLocalContext()) {
290+
auto error = diag::noimplicitcopy_attr_valid_only_on_local_let;
291+
diagnoseAndRemoveAttr(attr, error);
292+
return;
295293
}
296294

297-
// We do not support static or global vars either yet.
298-
if (dc->isModuleScopeContext() || (dc->isTypeContext() && vd->isStatic())) {
295+
// We do not support static vars either yet.
296+
if (dc->isTypeContext() && vd->isStatic()) {
299297
auto error = diag::noimplicitcopy_attr_valid_only_on_local_let;
300298
diagnoseAndRemoveAttr(attr, error);
301299
return;

0 commit comments

Comments
 (0)