Commit a288422
committed
Sema: Fix override availability checking for protocols.
Given the following test case, override availability checking produced an
erroneus diagnostic:
```
@available(macOS 10.15, *)
protocol P {
associatedtype A
var a: A { get set }
}
@available(macOS 13.0, *)
protocol Q: P {
// error: overriding _modify accessor for 'a' must be as available as
// declaration it overrides
var a: A { get set }
}
```
The synthesized `_modify` accessor in `Q` is explicitly marked available in
macOS 13, which is less available than the `_modify` accessor in `P`. The
availability of `Q` should limit the required availability of the override and
prevent the diagnostic, but the implementation had a bug where it checked the
availability of the context's type instead of the contextual self type's
declaration. In the example, the context's type is `Self` which does not have
annotated availability.
Resolves rdar://133573707.1 parent 4229a91 commit a288422
File tree
2 files changed
+41
-3
lines changed- lib/Sema
- test/Sema
2 files changed
+41
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1774 | 1774 | | |
1775 | 1775 | | |
1776 | 1776 | | |
1777 | | - | |
1778 | | - | |
1779 | | - | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
1780 | 1780 | | |
1781 | 1781 | | |
1782 | 1782 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
221 | 259 | | |
222 | 260 | | |
223 | 261 | | |
| |||
0 commit comments