SILGen: Fix SILGen for accessor functions with @_backDeploy. Previously, the @_backDeploy attribute was ignored when generating SIL for accessors on declarations with the attribute since the accessor decls themselves were not directly annotated.

Also, emit an error when `@_backDeploy` is applied to coroutine accessors since they are not supported yet.

Resolves rdar://90112441
This commit is contained in:
Allan Shortlidge
2022-03-10 18:13:03 -08:00
parent 25370d2530
commit c1e326cbb0
8 changed files with 127 additions and 9 deletions

View File

@@ -45,27 +45,23 @@ public struct TopLevelStruct {
// CHECK: @_backDeploy(macOS 12.0)
// FROMSOURCE: public var backDeployedPropertyWithAccessors: Swift.Int {
// FROMSOURCE: get { 45 }
// FROMSOURCE: set(newValue) { print("set property") }
// FROMSOURCE: }
// FROMMODULE: public var backDeployedPropertyWithAccessors: Swift.Int
@available(macOS 11.0, *)
@_backDeploy(macOS 12.0)
public var backDeployedPropertyWithAccessors: Int {
get { 45 }
set(newValue) { print("set property") }
}
// CHECK: @_backDeploy(macOS 12.0)
// FROMSOURCE: public subscript(index: Swift.Int) -> Swift.Int {
// FROMSOURCE: get { 46 }
// FROMSOURCE: set(newValue) { print("set subscript") }
// FROMSOURCE: }
// FROMMODULE: public subscript(index: Swift.Int) -> Swift.Int
@available(macOS 11.0, *)
@_backDeploy(macOS 12.0)
public subscript(index: Int) -> Int {
get { 46 }
set(newValue) { print("set subscript") }
}
}