Skip to content

Commit 796d247

Browse files
committed
re-allow non-final classes to have move-only members
1 parent 71b0ea6 commit 796d247

File tree

3 files changed

+0
-44
lines changed

3 files changed

+0
-44
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6919,8 +6919,6 @@ NOTE(moveonly_copyable_type_that_contains_moveonly_type_location, none,
69196919
ERROR(moveonly_cannot_conform_to_type, none,
69206920
"move-only %0 %1 cannot conform to %2",
69216921
(DescriptiveDeclKind, DeclName, Type))
6922-
ERROR(moveonly_non_final_class_cannot_contain_moveonly_field, none,
6923-
"non-final classes containing move only fields is not yet supported", ())
69246922
ERROR(moveonly_parameter_missing_ownership, none,
69256923
"noncopyable parameter must specify its ownership", ())
69266924
NOTE(moveonly_parameter_ownership_suggestion, none,

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2968,15 +2968,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
29682968

29692969
diagnoseIncompatibleProtocolsForMoveOnlyType(CD);
29702970

2971-
// Ban non-final classes from having move only fields.
2972-
if (!CD->isFinal()) {
2973-
for (auto *field : CD->getStoredProperties()) {
2974-
if (field->getType()->isPureMoveOnly()) {
2975-
field->diagnose(
2976-
diag::moveonly_non_final_class_cannot_contain_moveonly_field);
2977-
}
2978-
}
2979-
}
29802971
}
29812972

29822973
void visitProtocolDecl(ProtocolDecl *PD) {

test/Sema/moveonly_nonfinal_class_restriction.swift

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)