mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Skip serializing non-public accessors of @backDeployed properties.
Avoids a crash in SILGen when skipping non-inlinable function bodies. Resolves rdar://136853454.
This commit is contained in:
@@ -34,6 +34,18 @@ public struct TopLevelStruct {
|
||||
set(newValue) {}
|
||||
}
|
||||
|
||||
@backDeployed(before: macOS 12.0)
|
||||
public private(set) var readWritePropertyPrivateSet: Int {
|
||||
get { 42 }
|
||||
set(newValue) {}
|
||||
}
|
||||
|
||||
@backDeployed(before: macOS 12.0)
|
||||
public internal(set) var readWritePropertyInternalSet: Int {
|
||||
get { 42 }
|
||||
set(newValue) {}
|
||||
}
|
||||
|
||||
@backDeployed(before: macOS 12.0)
|
||||
public subscript(at index: Int) -> Int {
|
||||
get { 42 }
|
||||
@@ -234,7 +246,6 @@ public final class CannotBackDeployClassDeinit {
|
||||
deinit {}
|
||||
}
|
||||
|
||||
// Ok, final decls in a non-final, derived class
|
||||
public class CannotBackDeployOverride: TopLevelClass {
|
||||
@backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be combined with 'override'}}
|
||||
final public override func hook() {}
|
||||
@@ -293,6 +304,40 @@ public func cannotBackDeployFuncWithOpaqueResultType() -> some TopLevelProtocol
|
||||
return ConformsToTopLevelProtocol()
|
||||
}
|
||||
|
||||
public struct CannotBackDeployNonPublicAccessors {
|
||||
private var privateVar: Int {
|
||||
@backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on private declarations}}
|
||||
get { 0 }
|
||||
|
||||
@backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on private declarations}}
|
||||
set { }
|
||||
}
|
||||
|
||||
internal var internalVar: Int {
|
||||
@backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on internal declarations}}
|
||||
get { 0 }
|
||||
|
||||
@backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on internal declarations}}
|
||||
set { }
|
||||
}
|
||||
|
||||
public private(set) var publicVarPrivateSet: Int {
|
||||
@backDeployed(before: macOS 12.0)
|
||||
get { 0 }
|
||||
|
||||
@backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on private declarations}}
|
||||
set { }
|
||||
}
|
||||
|
||||
public internal(set) var publicVarInternalSet: Int {
|
||||
@backDeployed(before: macOS 12.0)
|
||||
get { 0 }
|
||||
|
||||
@backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on internal declarations}}
|
||||
set { }
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Function body diagnostics
|
||||
|
||||
public struct FunctionBodyDiagnostics {
|
||||
|
||||
Reference in New Issue
Block a user