{"push_id":986357365,"size":5,"distinct_size":5,"ref":"refs/heads/master","head":"d4fdc1e7a83fd00facc0a40438ece32c4fad4c3c","before":"3921517d36c51fc9165577ce2fa5bb34fe4540ef","commits":[{"sha":"26e55ce4655bfc61c25bc8655d5b460d442d92b5","author":{"email":"91dccd030be6e82ab0e4ef623cb66353c149a982@apple.com","name":"Joe Groff"},"message":"Sema: Initial parsing and synthesis for properties with behaviors.\n\nParse 'var [behavior] x: T', and when we see it, try to instantiate the property's\nimplementation in terms of the given behavior. To start out, behaviors are modeled\nas protocols. If the protocol follows this pattern:\n\n  ```\n  protocol behavior {\n    associatedtype Value\n  }\n  extension behavior {\n    var value: Value { ... }\n  }\n  ```\n\nthen the property is instantiated by forming a conformance to `behavior` where\n`Self` is bound to the enclosing type and `Value` is bound to the property's\ndeclared type, and invoking the accessors of the `value` implementation:\n\n  ```\n  struct Foo {\n    var [behavior] foo: Int\n  }\n\n  /* behaves like */\n\n  extension Foo: private behavior {\n    @implements(behavior.Value)\n    private typealias `[behavior].Value` = Int\n\n    var foo: Int {\n      get { return value }\n      set { value = newValue }\n    }\n  }\n  ```\n\nIf the protocol requires a `storage` member, and provides an `initStorage` method\nto provide an initial value to the storage:\n\n  ```\n  protocol storageBehavior {\n    associatedtype Value\n\n    var storage: Something<Value> { ... }\n  }\n  extension storageBehavior {\n    var value: Value { ... }\n\n    static func initStorage() -> Something<Value> { ... }\n  }\n  ```\n\nthen a stored property of the appropriate type is instantiated to witness the\nrequirement, using `initStorage` to initialize:\n\n  ```\n  struct Foo {\n    var [storageBehavior] foo: Int\n  }\n\n  /* behaves like */\n\n  extension Foo: private storageBehavior {\n    @implements(storageBehavior.Value)\n    private typealias `[storageBehavior].Value` = Int\n    @implements(storageBehavior.storage)\n    private var `[storageBehavior].storage`: Something<Int> = initStorage()\n\n    var foo: Int {\n      get { return value }\n      set { value = newValue }\n    }\n  }\n  ```\n\nIn either case, the `value` and `storage` properties should support any combination\nof get-only/settable and mutating/nonmutating modifiers. The instantiated property\nfollows the settability and mutating-ness of the `value` implementation. The\nprotocol can also impose requirements on the `Self` and `Value` types.\n\nBells and whistles such as initializer expressions, accessors,\nout-of-line initialization, etc. are not implemented. Additionally, behaviors\nthat instantiate storage are currently only supported on instance properties.\nThis also hasn't been tested past sema yet; SIL and IRGen will likely expose\nadditional issues.","distinct":true,"url":"https://api.github.com/repos/gottesmm/swift/commits/26e55ce4655bfc61c25bc8655d5b460d442d92b5"},{"sha":"a1ef41281524531640c3fc95885c22bbebc500fb","author":{"email":"91dccd030be6e82ab0e4ef623cb66353c149a982@apple.com","name":"Joe Groff"},"message":"Sema/SILGen: Get property behavior implementations to codegen.\n\nFix some interface type/context type confusion in the AST synthesis from the previous patch, add a unique private mangling for behavior protocol conformances, and set up SILGen to emit the conformances when property declarations with behaviors are visited. Disable synthesis of the struct memberwise initializer if any instance properties use behaviors; codegen will need to be redesigned here.","distinct":true,"url":"https://api.github.com/repos/gottesmm/swift/commits/a1ef41281524531640c3fc95885c22bbebc500fb"},{"sha":"89a0578eae2c6ceadd99a497d1ea97be2a420c89","author":{"email":"91dccd030be6e82ab0e4ef623cb66353c149a982@apple.com","name":"Joe Groff"},"message":"Add an interpreter test for \"delayed\" property behavior.\n\nWe have enough implementation to do \"delayed\" now.","distinct":true,"url":"https://api.github.com/repos/gottesmm/swift/commits/89a0578eae2c6ceadd99a497d1ea97be2a420c89"},{"sha":"e49a50bbee836229369d916906cd9c1523765a32","author":{"email":"91dccd030be6e82ab0e4ef623cb66353c149a982@apple.com","name":"Joe Groff"},"message":"Sema: Fix crash when behavior protocol is missing `initStorage` requirement.\n\nWould be nice to have `guard` in C++...","distinct":true,"url":"https://api.github.com/repos/gottesmm/swift/commits/e49a50bbee836229369d916906cd9c1523765a32"},{"sha":"d4fdc1e7a83fd00facc0a40438ece32c4fad4c3c","author":{"email":"91dccd030be6e82ab0e4ef623cb66353c149a982@apple.com","name":"Joe Groff"},"message":"Conditionally enable behaviors by a frontend flag.\n\nSince the feature is incomplete and yet to be accepted or implemented as proposed, hide it behind an -enable-experimental-property-behaviors frontend flag.","distinct":true,"url":"https://api.github.com/repos/gottesmm/swift/commits/d4fdc1e7a83fd00facc0a40438ece32c4fad4c3c"}]}