Skip to content

Commit 05f5e51

Browse files
committed
Diags: say "actors" cannot be ~Copyable
rdar://130450351
1 parent 80c9997 commit 05f5e51

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7719,8 +7719,8 @@ ERROR(inverse_associatedtype_restriction, none,
77197719
"cannot suppress '%0' requirement of an associated type",
77207720
(StringRef))
77217721
ERROR(inverse_on_class, none,
7722-
"classes cannot be '~%0'",
7723-
(StringRef))
7722+
"%select{classes|actors}1 cannot be '~%0'",
7723+
(StringRef, bool))
77247724
ERROR(inverse_with_class_constraint, none,
77257725
"composition involving %select{class requirement %2|'AnyObject'}0 "
77267726
"cannot contain '~%1'",

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3349,7 +3349,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
33493349

33503350
ctx.Diags.diagnose(decl->getLoc(),
33513351
diag::inverse_on_class,
3352-
getProtocolName(getKnownProtocolKind(ip)));
3352+
getProtocolName(getKnownProtocolKind(ip)),
3353+
decl->isAnyActor());
33533354
}
33543355
}
33553356

test/Generics/inverse_classes2.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
// RUN: %target-typecheck-verify-swift \
2-
// RUN: -parse-stdlib -module-name Swift
3-
4-
// NOTE: -parse-stdlib is a transitional workaround and should not be required.
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking
52

63
@_moveOnly // expected-error {{'@_moveOnly' attribute is only valid on structs or enums}}
74
class KlassLegacy {}
85

96
class KlassModern: ~Copyable {} // expected-error {{classes cannot be '~Copyable'}}
107

8+
actor FamousPerson: ~Copyable {} // expected-error{{actors cannot be '~Copyable'}}
9+
1110
class Konditional<T: ~Copyable> {}
1211

1312
func checks<T: ~Copyable, C>(

0 commit comments

Comments
 (0)