-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Introduce callables. #23517
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Introduce callables. #23517
Conversation
Introduce callables: values that can be "called" like functions. Add a new `call` declaration kind to represent callable methods.
@@ -2829,6 +2829,8 @@ NodePointer Demangler::demangleFunctionEntity() { | |||
Args = TypeAndMaybePrivateName; Kind = Node::Kind::Allocator; break; | |||
case 'c': | |||
Args = TypeAndMaybePrivateName; Kind = Node::Kind::Constructor; break; | |||
case 'F': |
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.
TODO: Add mangling/demangling tests.
Currently, there are no SIL tests for call
declarations.
I informally checked that demangling works via -emit-silgen
.
The old remangler might not work - haven't look into how to invoke/test it yet.
@@ -1,8 +1,8 @@ | |||
<s118><s163><s92><s13><NULL/><NULL/><t6>// REQUIRES: syntax_parser_lib | |||
<s119><s164><s93><s13><NULL/><NULL/><t6>// REQUIRES: syntax_parser_lib |
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.
I’m not sure why changing this test to pass was necessary. I wonder if changing this test is breaking.
@@ -97,6 +97,7 @@ enum class SyntaxStructureKind : uint8_t { | |||
EnumElement, | |||
TypeAlias, | |||
Subscript, | |||
Call, |
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.
fyi will need a simple change to ModelASTWalker::walkToDeclPre()
to actually emit this, and I think a possibly less-simple change to SyntaxModelContext::SyntaxModelContext()
to classify tok::kw_call
as identifer/keyword depending on context (this affects syntax highlighting).
- Use uniform naming: either "`call` member" or "`call` declaration". - Fix `call` member resolution during type-checking. - Enable more `func` attributes on `call` declarations. - Add tests.
The main callable functionality is done and tested: ready for review. |
@swift-ci build toolchain |
@swift-ci please build toolchain |
clang requires minor changes to support `call` declarations in Swift. Note: the clang remote should be reverted back to "apple/swift-clang".
- Parse "call" as identifier in patterns and enum case names. Add tests. - Disallow `@warn_unqualified_access` on `call` declarations. - Update failing attribute tests.
Sorry, building failed because this PR depends on some minor changes to clang to support I temporarily updated the clang version in I've verified that all swift tests pass locally. Retriggering toolchain build. |
@swift-ci Please build toolchain |
Investigating errors. |
@swift-ci Please build toolchain |
@swift-ci Please build toolchain macOS |
Linux Toolchain (Ubuntu 16.04) Install command |
@swift-ci Please build toolchain macOS |
macOS Toolchain Install command |
@swift-ci Please benchmark |
!!! Couldn't read commit file !!! |
@swift-ci please test source compatibility |
1 similar comment
@swift-ci please test source compatibility |
FWIW, SwiftLint (from the source compatibility suite) is failing with this error:
|
Closing, as SE-0253 was returned for revision. |
Introduce callables: values that can be "called" like functions.
Add a new
call
declaration kind to represent callable methods."Introducing callables" pitch. Proposal coming soon.