@storageRestrictions(initializes: self.__myVar) in init-accessors is rejected by the compiler, but @storageRestrictions(initializes: __myVar) is accepted.
I expect the compiler to be fine with the explicit self so I also filed this issue.
This is not the current behavior so it still causes SwiftFormat make the code un-buildable when --self insert is present in the SwiftFormat configuration file.
Example that works:
struct MyStruct {
private var __myVar: String
var myVar: String {
@storageRestrictions(initializes: __myVar)
init {
self.__myVar = newValue /// Original code makes some adjustments here
}
set {
self.__myVar = newValue /// Original code makes some adjustments here
}
get {
self.__myVar
}
}
}
@storageRestrictions(initializes: self.__myVar)
in init-accessors is rejected by the compiler, but@storageRestrictions(initializes: __myVar)
is accepted. I expect the compiler to be fine with the explicitself
so I also filed this issue. This is not the current behavior so it still causes SwiftFormat make the code un-buildable when--self insert
is present in the SwiftFormat configuration file.Example that works:
This doesn't work:
So SwiftFormat should not add
self
s in@storageRestrictions
.