Skip to content

[AST] Split out "is compound" bit on FunctionRefKind #77896

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 2 commits into from
Dec 3, 2024

Conversation

hamishknight
Copy link
Contributor

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, and rename to FunctionRefInfo. Should be NFC. I've left some FIXMEs for non-NFC changes that I'll address in a follow-up.

Resolves #77804
rdar://140415962

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.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor Author

@swift-ci please test source compatibility

Comment on lines +29 to +40
/// Describes how a function is referenced within an expression node.
///
/// This dictates things like:
/// - Whether argument labels are part of the resulting function type or not.
/// - Whether the result can produce an implicitly unwrapped optional.
/// - Whether the function type needs adjustment for concurrency.
///
/// How a function is referenced comes down to how it was spelled in
/// the source code, e.g., was it called in the source code and was it
/// spelled as a compound name.
class FunctionRefInfo final {
public:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good abstraction, thank you!

@hamishknight hamishknight merged commit 0fdb038 into swiftlang:main Dec 3, 2024
7 checks passed
@hamishknight hamishknight deleted the functionref-split branch December 3, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split out the "is compound" bit for FunctionRefKind
2 participants