Commit Graph

28 Commits

Author SHA1 Message Date
Hamish Knight
ccd32eb452 NFC: Remove ClangModuleLoader.h include from ExtInfo.h
This was unnecessarily pulling in a whole bunch
of Clang headers when all was needed was a
forward declaration.
2023-10-09 20:29:03 +01:00
Konrad `ktoso` Malawski
38a43a481e [TaskLocals] Enforce @TaskLocal may only be used on static props 2021-04-29 21:44:48 +09:00
Holly Borla
215936d72a [NFC][Property Wrappers] Move PropertyWrapperWrappedValueVarRequest into
PropertyWrapperAuxiliaryVariablesRequest.
2021-03-19 13:03:14 -07:00
Holly Borla
21a86b5d2f [NFC][Property Wrappers] Split PropertyWrapperBackingPropertyInfoRequest into
two separate requests - one to synthesize the auxiliary declarations, and
another to compute how the backing storage is initialized.
2021-03-19 13:03:13 -07:00
Holly Borla
99e066683c [ConstraintSystem] Inject implicit applied property wrapper expressions
around arguments to property wrapper parameters.
2021-02-25 18:35:14 -08:00
Holly Borla
9cdecf4703 [Property Wrappers] Compute generic wrapped-value and projected-value
initialization expressions for parameters with attached property wrappers.
2021-02-25 18:35:14 -08:00
Holly Borla
648c5753df [SILGen] Teach SILGen to emit property wrapper generator functions that
take in a projected value.
2021-02-25 18:35:14 -08:00
Holly Borla
13692fefde [Property Wrappers] Store property wrapper "init from projection" expressions
in PropertyWrapperBackingPropertyInfo.
2021-02-25 18:35:14 -08:00
Holly Borla
19a4f93586 [Property Wrappers] Teach the constraint system to build init(projectedValue:)
calls.
2021-02-25 18:35:13 -08:00
Holly Borla
3fd882cadf [NFC] Rename "storage wrapper var" to "projection var" or "projected value"
in property wrapper-related code.
2020-09-02 18:07:40 -07:00
Holly Borla
a6c33a9611 [Property Wrappers] Use autoclosure information from CSApply to compute
`VarDecl::getPropertyWrapperInitValueInterfaceType`.
2020-07-13 17:22:29 -07:00
Holly Borla
b27b8cfb1f [Property Wrappers] Consider willSet mutability when deciding if a wrapped
property setter is mutating, and address other PR feedback
2020-04-17 17:45:04 -07:00
Holly Borla
8785454ce2 [Property Wrappers] Simplify PropertyWrapperLValuenessRequest::evaluate
by computing the lvalue sequence in reverse order.
2020-04-16 17:13:35 -07:00
Roopesh Chander
149a1f40aa [Property wrappers] Fix l-value computation when composing wrappers
This fixes l-value computation in buildStorageReference when composing property
wrappers.

The l-value-ness required for each instance in a property wrapper chain is
computed through a request and returned as an instance of
PropertyWrapperLValueness.
2020-04-14 13:50:30 -07:00
Holly Borla
65105f3a26 [Property Wrappers] Introduce a new Expr node for the property wrapper
wrapped value placeholder in an init(wrappedValue:) call that was previously
injected as an OpaqueValueExpr. This commit also restores the old design of
OpaqueValueExpr.
2020-04-09 16:00:57 -07:00
Holly Borla
bbfcb55e9e [Property Wrappers] Inject the opaque value placeholder for a property
wrapper original wrapped value expression inside of CSApply.

This prevents type checking the synthesized backing storage initializer
twice - once with the original expression and again with the placeholder.
2020-04-05 19:02:37 -07:00
Holly Borla
fd1dcf72d6 [NFC] Correct code blocks in property wrapper doc comments 2020-04-03 11:47:04 -07:00
Roopesh Chander
9c2dca7d6a [Property wrappers] Fix handling of @autoclosure in init(wrappedValue:)
If the 'wrappedValue:' parameter is an escaping autoclosure, and a
struct property is marked with that property wrapper, the memberwise
initializer of the struct is now synthesized with an escaping
autoclosure for that property.
2020-03-20 12:20:52 -07:00
Suyash Srijan
370f47c27a [PropertyWrappers] Merge 'findDefaultInit' and 'findInitialValueInit' methods into a single 'findSuitableWrapperInit' method 2019-10-11 22:25:46 +01:00
Doug Gregor
81c0a0ea93 [Property wrappers] Allow init(wrappedValue:) initializers with defaulted args
Generalize the type checking when searching for "wrappedValue"
initializers to also allow initializers that have other, defaulted
parameters as well.
2019-09-24 09:11:53 -07:00
Sasha Krassovsky
1e414f7fb6 Fix warnings in AST 2019-09-13 09:57:48 -07:00
David Ungar
b38076490b Address review comments re clarity
setOrigInit -> setOriginalInit
2019-08-05 13:42:35 -07:00
David Ungar
1011998a97 Fix PatternBindingEntry::getSourceRange 2019-08-01 16:59:40 -07:00
Joe Groff
fa4dd15612 Sema: Correct composition of property wrappers.
Fixes rdar://problem/53407949 | SR-11138. Previously, we'd only look at the outermost property wrapper to decide whether the wrapped property's getter and setter were `mutating` (or exist at all). In reality, this requires considering the semantics of the composed accesses of each wrapper layer's
`wrappedValue` property. Fixing this systematically addresses a number of issues:

- As SR-11138 reported, composing a nonmutating-get-set wrapper ought to produce a composed wrapper
  that's nonmutating.

- We would previously allow a property wrapper with a mutating getter to be nested inside one with
  only a getter, even though the resulting implementation was unsound (because there's no mutable
  context for the inner wrapper to execute its get on.)

- Similarly, we would construct unsound setters in cases where the setter can't exist, such as when
  the nested wrapper isn't settable but the outer wrapper is.
2019-07-26 16:09:54 -07:00
Doug Gregor
1284878ad8 [SE-0258] Rename init(initialValue:) --> init(wrappedValue:).
Addresses core team decision on acceptance of property wrappers.

Fixes rdar://problem/48871069.
2019-07-10 14:26:53 -07:00
Doug Gregor
bc2e605b31 [Property wrappers] Improve enclosing-self subscript handling.
Extend handling of enclosing-self subscripts by differentiating
between the original wrapped property (which now goes through
`subscript(_enclosingInstance:wrapped:storage:)`) and the projected
property (which goes through
`subscript(_enclosingInstance:projected:storage:)`). The new middle
argument provides a key path to the property that was accessed,
allowing one to distinguish the property being updated.
2019-06-29 23:22:01 -07:00
Doug Gregor
db5440bdef [SE-0258] Rename wrapperValue to projectedValue. 2019-06-26 07:39:01 -07:00
Doug Gregor
c02ecf9859 [SE-0258] Rename to Property Wrappers 2019-05-29 22:17:50 -07:00