Commit Graph

22 Commits

Author SHA1 Message Date
Hamish Knight
e30e5a7539 [Sema] Fix optional chaining behavior with postfix operators
Postfix operators can further be chained within an optional binding
chain, so we need to make sure they're handled in
`getMemberChainSubExpr`. Unresolved member chains still don't allow
them, so we need to add a new `kind` parameter to differentiate the
behavior here.

rdar://147826988
2025-03-26 15:02:42 +00:00
Hamish Knight
fd795d09e4 [Sema] NFC: Factor out PreCheckTarget::wrapMemberChainIfNeeded 2025-03-26 15:02:42 +00:00
Hamish Knight
738c70e8c8 [AST] Always walk folded SequenceExpr if available
Expand the special-cased ASTWalker behavior for folded SequenceExprs
such that we always walk the folded expression when available. This
ensures that we don't attempt to add the same node multiple times
when expanding ASTScopes during pre-checking.

rdar://147751795
2025-03-24 20:18:34 +00:00
Holly Borla
be670da373 Merge pull request #79980 from hborla/closure-body-macro
[Macros] Implement support for function body macros on closures.
2025-03-21 06:19:36 -07:00
Gábor Horváth
ddd36a7cfc Merge pull request #79662 from swiftlang/gaborh/dynamic-self-frt
[cxx-interop] Interpret Self as a static shorthand for FRTs
2025-03-20 17:54:35 +00:00
Amritpan Kaur
86d456e4eb [Sema] Block inout method arguments. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
0c614e09d1 [Expr/AST] Add unresolvedApply component to handle method arguments. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
811d54901b [NFC] Rename unresolvedProperty to unresolvedMember
to generalize for both properties and method members.
2025-03-19 08:53:18 -07:00
Gabor Horvath
b632534528 [cxx-interop] Interpret Self as a static shorthand for FRTs
We do not have dynamic self metadata for foreign reference types.

rdar://145066864
2025-03-19 12:56:56 +00:00
Pavel Yaskevich
42ccd182f6 [PreCheckTarget] Move closure body expansion into PreCheckTarget::walkToClosureExprPre
If closure body is expanded in expression context we need to do
some special handling to make sure that source ranges are not
completely broken.
2025-03-18 20:50:47 -07:00
Alejandro Alonso
15c32e117b Directly store GTPD in TypeValueExpr 2025-02-25 14:11:55 -08:00
Allan Shortlidge
87308e37f1 AST: Avoid creating duplicate AvailabilityScopes under SequenceExprs.
Since availability scopes may be built at arbitrary times, the builder may
encounter ASTs where SequenceExprs still exist and have not been folded, or it
may encounter folded SequenceExprs that have not been removed from the AST.

To avoid a double visit, track whether a SequenceExpr is folded and then
customize how ASTVisitor handles folded sequences.

Resolves rdar://142824799 and https://github.com/swiftlang/swift/issues/78567.
2025-01-17 10:21:22 -08:00
Hamish Knight
0fdb038fc9 Merge pull request #77896 from hamishknight/functionref-split
[AST] Split out "is compound" bit on FunctionRefKind
2024-12-03 09:53:37 +00:00
Hamish Knight
73fb36f371 [AST] Split out "is compound" bit on FunctionRefInfo
FunctionRefKind was originally designed to represent
the handling needed for argument labels on function
references, in which the unapplied and compound cases
are effectively the same. However it has since been
adopted in a bunch of other places where the
spelling of the function reference is entirely
orthogonal to the application level.

Split out the application level from the
"is compound" bit. Should be NFC. I've left some
FIXMEs for non-NFC changes that I'll address in a
follow-up.
2024-12-02 14:11:33 +00:00
Hamish Knight
a4d51419ba [AST] NFC: Rename FunctionRefKind -> FunctionRefInfo 2024-12-02 14:11:32 +00:00
Rintaro Ishizaki
bee4cfe3e5 [PreCheckTarget] Consider UnresolvedSpecializeExpr a chain expression
Optional chain and unresolved member chain should consider
a generic specialization as a chain expression.

rdar://140378864
2024-11-22 12:08:19 -08:00
Rintaro Ishizaki
ffeaa719ef [Sema] Ensure postfix operator is not a part of implicit member chain
But a part of optional chain.
2024-10-12 17:24:08 -07:00
Rintaro Ishizaki
8e8e4d0193 [Parse/Sema] Move OptionalEvaluationExpr wrapping to PreCheckTarget
This simplify the Parser diagnostics and some type checker logic.
2024-10-11 13:12:48 -07:00
Alejandro Alonso
0df42e9841 Lower UDRE to TypeValue if it references a value generic 2024-09-04 15:13:29 -07:00
Hamish Knight
89a3390aa1 [Sema] Move SingleValueStmtUsageChecker into pre-checking
These diagnostics are better suited for pre-checking
since we ought to be emitting them even if there's
some other error with the expression.
2024-08-30 18:55:48 +01:00
Hamish Knight
1139b0e799 Remove shouldWalkCaptureInitializerExpressions from PreCheckTarget
We walk into PatternBindingDecls, so I don't think
there should be any reason we can't walk captures
normally (i.e via their PBD).
2024-08-30 18:55:48 +01:00
Hamish Knight
f0e487dc81 NFC: Rename PreCheckExpression -> PreCheckTarget 2024-08-30 18:55:48 +01:00