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> {
26522652 // @_staticExclusiveOnly types cannot be put into 'var's, only 'let'.
26532653 if (auto SD = VD->getInterfaceType ()->getStructOrBoundGenericStruct ()) {
26542654 if (SD->getAttrs ().hasAttribute <StaticExclusiveOnlyAttr>()) {
2655- auto isProtocolContext = DC-> getSelfProtocolDecl () != nullptr ;
2655+ auto isProtocolContext = isa<ProtocolDecl>(DC) ;
26562656
26572657 if (isProtocolContext && !VD->supportsMutation ()) {
26582658 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}}
1111 // expected-note@-4 {{'B' is a non-mutable type}}
1212 // expected-note@-5 {{'B' is a non-mutable type}}
1313 // expected-note@-6 {{'B' is a non-mutable type}}
14+ // expected-note@-7 {{'B' is a non-mutable type}}
1415 mutating func change( ) { // expected-error {{type 'B' cannot have mutating function 'change()'}}
1516 print ( " 123 " )
1617 }
@@ -92,3 +93,9 @@ extension W: U {
9293struct X : ~ Copyable, U {
9394 let v : B // OK
9495}
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