Sema: Allow overrides to be unavailable in the current Swift language mode.

Fixes a regression from https://github.com/swiftlang/swift/pull/83354.

Resolves rdar://158262522
This commit is contained in:
Allan Shortlidge
2025-08-13 16:45:50 -07:00
parent 31f344de84
commit 550d7bb754
3 changed files with 44 additions and 9 deletions

View File

@@ -239,7 +239,6 @@ func testOverrideOfUnavailableDeclFromUnavailableDerivedType() {
}
}
func testImplicitSuperInit() {
// FIXME: The diagnostics for the implicit call to super.init() could be
// relaxed since both initializers are unreachable and the developer cannot
@@ -256,3 +255,19 @@ func testImplicitSuperInit() {
// expected-note@-2 {{call to unavailable initializer 'init()' from superclass 'Base' occurs implicitly at the end of this initializer}}
}
}
func testUnavailableInSwiftOverrides() {
class Base {
func availableMethod() {}
}
class Derived1: Base {
@available(swift, introduced: 99)
override func availableMethod() {}
}
class Derived2: Base {
@available(swift, obsoleted: 1)
override func availableMethod() {}
}
}