You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/decl/protocol/protocols.swift
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ protocol Test {
17
17
var subminor :Int // expected-error {{property in protocol must have explicit { get } or { get set } specifier}} {{21-21= { get <#set#> \}}}
18
18
staticvar staticProperty:Int // expected-error{{property in protocol must have explicit { get } or { get set } specifier}} {{33-33= { get <#set#> \}}}
19
19
20
-
let bugfix // expected-error {{type annotation missing in pattern}} expected-error {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}}
20
+
let bugfix // expected-error {{type annotation missing in pattern}} expected-error {{protocols cannot require properties to be immutable; declare read-only properties by using 'var' with a '{ get }' specifier}}
21
21
var comment // expected-error {{type annotation missing in pattern}} expected-error {{property in protocol must have explicit { get } or { get set } specifier}}
22
22
}
23
23
@@ -458,7 +458,7 @@ protocol ShouldntCrash {
458
458
letfullName:String{get} // expected-error {{'let' declarations cannot be computed properties}} {{3-6=var}}
459
459
460
460
// <rdar://problem/17200672> Let in protocol causes unclear errors and crashes
461
-
let fullName2:String // expected-error {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}} {{3-6=var}} {{24-24= { get \}}}
461
+
let fullName2:String // expected-error {{protocols cannot require properties to be immutable; declare read-only properties by using 'var' with a '{ get }' specifier}} {{3-6=var}} {{24-24= { get \}}}
462
462
463
463
// <rdar://problem/16789886> Assert on protocol property requirement without a type
464
464
varpropertyWithoutType{get} // expected-error {{type annotation missing in pattern}}
@@ -514,7 +514,7 @@ class C4 : P4 { // expected-error {{type 'C4' does not conform to protocol 'P4'}
514
514
// <rdar://problem/25185722> Crash with invalid 'let' property in protocol
515
515
protocolLetThereBeCrash{
516
516
let x:Int
517
-
// expected-error@-1 {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}} {{13-13= { get \}}}
517
+
// expected-error@-1 {{protocols cannot require properties to be immutable; declare read-only properties by using 'var' with a '{ get }' specifier}} {{13-13= { get \}}}
vara:Int{ didSet willSet } // expected-error {{property in protocol must have explicit { get } or { get set } specifier}} {{14-32={ get <#set#> \}}} expected-error 2 {{expected get or set in a protocol property}}
885
885
}
886
886
protocolProtocolWillSetDidSet5{
887
-
leta:Int{ didSet willSet } // expected-error {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}} {{3-6=var}} {{13-13= { get \}}} {{none}} expected-error 2 {{expected get or set in a protocol property}} expected-error {{'let' declarations cannot be computed properties}} {{3-6=var}}
887
+
leta:Int{ didSet willSet } // expected-error {{protocols cannot require properties to be immutable; declare read-only properties by using 'var' with a '{ get }' specifier}} {{3-6=var}} {{13-13= { get \}}} {{none}} expected-error 2 {{expected get or set in a protocol property}} expected-error {{'let' declarations cannot be computed properties}} {{3-6=var}}
888
888
}
889
889
890
890
varglobalDidsetWillSet:Int{ // expected-error {{non-member observing properties require an initializer}}
Copy file name to clipboardExpand all lines: test/decl/var/static_var.swift
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -177,8 +177,8 @@ protocol P { // expected-note{{extended type declared here}}
177
177
classvarv2:Int{get} // expected-error {{class properties are only allowed within classes; use 'static' to declare a requirement fulfilled by either a static or class property}} {{3-8=static}}
178
178
staticfinalvarv3:Int{get} // expected-error {{only classes and class members may be marked with 'final'}}
179
179
180
-
staticlet l1:Int // expected-error {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}}
181
-
classlet l2:Int // expected-error {{class properties are only allowed within classes; use 'static' to declare a requirement fulfilled by either a static or class property}} {{3-8=static}} expected-error {{immutable property requirement must be declared as 'var' with a '{ get }' specifier}}
180
+
staticlet l1:Int // expected-error {{protocols cannot require properties to be immutable; declare read-only properties by using 'var' with a '{ get }' specifier}}
181
+
classlet l2:Int // expected-error {{class properties are only allowed within classes; use 'static' to declare a requirement fulfilled by either a static or class property}} {{3-8=static}} expected-error {{protocols cannot require properties to be immutable; declare read-only properties by using 'var' with a '{ get }' specifier}}
0 commit comments