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
Switch override checking over to access scopes. (#4508)
The class version of f65ad81. Fixes some incorrect diagnostics.
We really do need https://bugs.swift.org/browse/SR-2209 to make
this all cleaner.
rdar://problem/27820665
(cherry picked from commit 8b1ce7d)
Copy file name to clipboardExpand all lines: test/attr/open.swift
+46Lines changed: 46 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,52 @@ class SubClass : ExternalOpenClass {
77
77
}
78
78
}
79
79
80
+
openclassInvalidOpenSubClass:ExternalOpenClass{
81
+
publicoverridefunc openMethod(){} // expected-error {{overriding instance method must be as accessible as the declaration it overrides}} {{3-9=open}}
82
+
publicoverridevaropenProperty:Int{get{return0}set{}} // expected-error {{overriding var must be as accessible as the declaration it overrides}} {{3-9=open}}
83
+
publicoverride subscript(index:MarkerForOpenSubscripts)->Int{ // expected-error {{overriding subscript must be as accessible as the declaration it overrides}} {{3-9=open}}
84
+
get{return0}
85
+
set{}
86
+
}
87
+
}
88
+
89
+
openclassInvalidOpenSubClass2:ExternalOpenClass{
90
+
internaloverridefunc openMethod(){} // expected-error {{overriding instance method must be as accessible as the declaration it overrides}} {{3-11=open}}
91
+
internaloverridevaropenProperty:Int{get{return0}set{}} // expected-error {{overriding var must be as accessible as the declaration it overrides}} {{3-11=open}}
92
+
internaloverride subscript(index:MarkerForOpenSubscripts)->Int{ // expected-error {{overriding subscript must be as accessible as the declaration it overrides}} {{3-11=open}}
finalinternaloverridefunc openMethod(){} // expected-error {{overriding instance method must be as accessible as its enclosing type}} {{9-17=public}}
109
+
finalinternaloverridevaropenProperty:Int{get{return0}set{}} // expected-error {{overriding var must be as accessible as its enclosing type}} {{9-17=public}}
110
+
finalinternaloverride subscript(index:MarkerForOpenSubscripts)->Int{ // expected-error {{overriding subscript must be as accessible as its enclosing type}} {{9-17=public}}
0 commit comments