File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2652,7 +2652,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2652
2652
// @_staticExclusiveOnly types cannot be put into 'var's, only 'let'.
2653
2653
if (auto SD = VD->getInterfaceType ()->getStructOrBoundGenericStruct ()) {
2654
2654
if (SD->getAttrs ().hasAttribute <StaticExclusiveOnlyAttr>()) {
2655
- auto isProtocolContext = DC-> getSelfProtocolDecl () != nullptr ;
2655
+ auto isProtocolContext = isa<ProtocolDecl>(DC) ;
2656
2656
2657
2657
if (isProtocolContext && !VD->supportsMutation ()) {
2658
2658
return ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ struct B: ~Copyable { // expected-note {{'B' is a non-mutable type}}
11
11
// expected-note@-4 {{'B' is a non-mutable type}}
12
12
// expected-note@-5 {{'B' is a non-mutable type}}
13
13
// expected-note@-6 {{'B' is a non-mutable type}}
14
+ // expected-note@-7 {{'B' is a non-mutable type}}
14
15
mutating func change( ) { // expected-error {{type 'B' cannot have mutating function 'change()'}}
15
16
print ( " 123 " )
16
17
}
@@ -92,3 +93,9 @@ extension W: U {
92
93
struct X : ~ Copyable, U {
93
94
let v : B // OK
94
95
}
96
+
97
+ extension U {
98
+ var y : B { // expected-error {{variable of type 'B' must be declared with a 'let'}}
99
+ B ( )
100
+ }
101
+ }
You can’t perform that action at this time.
0 commit comments