-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[SE-0293] Extend property wrappers to function and closure parameters #34272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
376a859
[Property Wrappers] Handle property wrappers on parameters in
hborla 8325a52
[ConstraintSystem] Teach the constraint system about property wrapper
hborla f57180a
[Property Wrappers] Don't allow property wrapper attributes to have
hborla d9951be
[Property Wrappers] Add a request to synthesize the local wrapped value
hborla 5bdb4dc
[Sema] Visit auxiliary decls on parameters in the decl checker.
hborla c5bed94
[SILGen] Teach SILGen to emit property wrapper parameters.
hborla aa573c0
[Property Wrappers] Allow property wrapper attributes to be applied
hborla 4bdeed5
[ConstraintSystem] Use a wrapped value placeholder when matching prop…
hborla cf25fff
[Property Wrappers] Set the interface type of the synthesized local
hborla 8bdc8f9
[Property Wrappers] Use the TypeExpr instead of the TypeRepr of the
hborla 9afa7ba
[Property Wrappers] Determine the mutability of a property wrapper pa…
hborla 19a4f93
[Property Wrappers] Teach the constraint system to build init(project…
hborla 6aee012
[CSApply] Add buildPropertyWrapperFnThunk, which builds a thunk around
hborla 78b202c
[ASTWalker] Support configurating whether or not to visit the original
hborla 31f7b1a
[ConstraintSystem] Change the type of an unapplied function reference
hborla 6a8232e
[PreCheckExpr] Strip $ prefixes out from compound decl names for unqu…
hborla 1486352
[Property Wrappers] Don't include the $ prefix in synthesized propert…
hborla 140cbaa
[Parser] Allow $ prefixes on argument labels and closure parameter
hborla a4e3968
[Property Wrappers] Don't allow property wrappers applied to parameters
hborla ea3fe03
[Property Wrappers] Add a constraint fix and diagnostic for the case
hborla 12161fa
[Sema] Diagnose invalid $ prefixes on closure parameters after the
hborla 522eedc
[ConstraintSystem] Emit an error message when trying to pass a property
hborla 36008a1
[NFC][Property Wrappers] Start to add Sema tests for SE-0293.
hborla 2c2d671
[Property Wrappers] Add an unsupported error message for property wra…
hborla 96f4315
[Property Wrappers] Implement support for parameters with an implicit
hborla 133dec0
[ConstraintSystem] Implement implicit property wrapper attribute
hborla e40d7eb
[NFC][Property Wrappers] Start to add SILGen tests for SE-0293.
hborla aa0da03
[CSGen] Move generateWrappedPropertyTypeConstraints back to its original
hborla 13692fe
[Property Wrappers] Store property wrapper "init from projection" exp…
hborla 648c575
[SILGen] Teach SILGen to emit property wrapper generator functions that
hborla b821c8d
[Sema] Add an implicit applied property wrapper expression and a new
hborla 9cdecf4
[Property Wrappers] Compute generic wrapped-value and projected-value
hborla 99e0666
[ConstraintSystem] Inject implicit applied property wrapper expressions
hborla bea89c6
[SILGen] Serialize and give PublicNonABI linkage to property wrapper
hborla c29eecd
[Property Wrappers] Store the callee in AppliedPropertyWrapperExpr to…
hborla db38727
[ConstraintSystem] Don't allow dollar prefixes in argument labels unless
hborla b7a170c
[NFC][ConstraintSystem] Rename applyPropertyWrapperParameter.
hborla b3d54b6
[Property Wrappers] Don't allow parameters with attached property wra…
hborla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4228,6 +4228,62 @@ class PropertyWrapperValuePlaceholderExpr : public Expr { | |
} | ||
}; | ||
|
||
/// An implicit applied property wrapper expression. | ||
class AppliedPropertyWrapperExpr final : public Expr { | ||
public: | ||
enum class ValueKind { | ||
|
||
WrappedValue, | ||
ProjectedValue | ||
}; | ||
|
||
private: | ||
/// The concrete callee which owns the property wrapper. | ||
ConcreteDeclRef Callee; | ||
|
||
/// The owning declaration. | ||
const ParamDecl *Param; | ||
|
||
/// The source location of the argument list. | ||
SourceLoc Loc; | ||
|
||
/// The value to which the property wrapper is applied for initialization. | ||
Expr *Value; | ||
|
||
/// The kind of value that the property wrapper is applied to. | ||
ValueKind Kind; | ||
|
||
AppliedPropertyWrapperExpr(ConcreteDeclRef callee, const ParamDecl *param, SourceLoc loc, | ||
Type Ty, Expr *value, ValueKind kind) | ||
: Expr(ExprKind::AppliedPropertyWrapper, /*Implicit=*/true, Ty), | ||
Callee(callee), Param(param), Loc(loc), Value(value), Kind(kind) {} | ||
|
||
public: | ||
static AppliedPropertyWrapperExpr * | ||
create(ASTContext &ctx, ConcreteDeclRef callee, const ParamDecl *param, SourceLoc loc, | ||
Type Ty, Expr *value, ValueKind kind); | ||
|
||
SourceRange getSourceRange() const { return Loc; } | ||
|
||
ConcreteDeclRef getCallee() { return Callee; } | ||
|
||
/// Returns the parameter declaration with the attached property wrapper. | ||
const ParamDecl *getParamDecl() const { return Param; }; | ||
|
||
/// Returns the value that the property wrapper is applied to. | ||
Expr *getValue() { return Value; } | ||
|
||
/// Sets the value that the property wrapper is applied to. | ||
void setValue(Expr *value) { Value = value; } | ||
hborla marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
/// Returns the kind of value, between wrapped value and projected | ||
/// value, the property wrapper is applied to. | ||
ValueKind getValueKind() const { return Kind; } | ||
|
||
static bool classof(const Expr *E) { | ||
return E->getKind() == ExprKind::AppliedPropertyWrapper; | ||
} | ||
}; | ||
|
||
/// An expression referring to a default argument left unspecified at the | ||
/// call site. | ||
/// | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer used - I'll remove it