-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Implement named arguments anywhere feature #47451
Comments
The implementation in the CFE is landed as fcd684e. |
@chloestefantsova what experiment flag is this behind? |
At the moment, it's behind an internal CFE flag |
Perhaps |
I like the name :) I'll add the flag. |
Since the check or the absence of the check for a named argument appearing before a positional parameter is feature-specific considering the language feature that allows placing the named arguments anywhere, it should be performed by the listeners of the parser and guarded by an experiment flag, in alignment with other experimental featuers. This CL moves the check and the reporting of the error from the parser into the Analyzer, so that later this check can be skipped if the corresponding experiment flag is enabled. Part of #47451. Change-Id: Ib795d418af429ee04ecfff6dfa71ec1e836fe798 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216640 Reviewed-by: Paul Berry <paulberry@google.com> Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
Part of #47451 Change-Id: I049519061d132eb681cc3aa67b1dea5d296e540e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216801 Commit-Queue: Chloe Stefantsova <dmitryas@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
Part of #47451. Change-Id: I7befc385261f2489b79f6c90f1bb903b02a413a1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217001 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
Part of #47451. Change-Id: I6e13e8642c287c2386f7a323ccd5e41d83c5b358 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217012 Reviewed-by: Paul Berry <paulberry@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
@devoncarew, @srawlins, @chloestefantsova, I have the impression that this feature would be well placed in the language evolution pipeline at some point in Q1. Do you agree, and do you have a specific milestone in mind? |
Q1 sounds great to me. |
Part of #47451. Change-Id: Ic3564833cf87d5ccfb8b43f589c241104ce6df61 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217602 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Part of #47451. Change-Id: I0c865a6a37c6e31e57df037f65c298c449f297bd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217013 Commit-Queue: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Erik Ernst <eernst@google.com>
I'm going to start creating sub-issues here to scope the work. |
@sigmundch - I assume the DDC and dart2js implementations are no-ops here. Can you confirm that (or ask someone else to)? Thanks! |
@a-siva / @mkustermann - can you confirm that the VM implementation for this is a no-op? Otherwise we'll create a tracking bug for the VM work. |
Agree, I believe nothing is needed for DDC and dart2js directly. /cc @nshahan @fishythefish The only open question is whether there is work needed for the web debugger integration, which may entail some work in DDC. At a glance, I would be surprised if we needed anything special for that either, but it's good to double check. /cc @nshahan @annagrin |
It seems this is purely a use-site only feature, so one wouldn't need to worry about observing mixed positional and named parameters on declaration site with If the CFE desugars use-sites to existing Kernel AST constructs with the correct evaluation order (@chloestefantsova guess this is true?), then there is indeed no work for the VM team here (pending @bkonyi's answer on |
@jakemac53 - do we expect any implementation work for this wrt build systems? If so we'll file an issue to track. |
Nothing major that jumps to mind other than general language versioning support which we already have in place. Internally language versioning is weird (we don't expose actual versions to users), so some amount of work will have to happen to allow users to enable this (similar to how null safety is enabled internally). EDIT: One other potential area of work would be around the analyzer apis - in general builders don't operate on method bodies though and shouldn't see these types of invocations, but some do go to the AST, and could be affected. Not anything the dart team owns though afaik. |
We would need to at least add tests for newly allowed expressions to evaluate correctly. The debugging support depends on whether there are any changes in the vm service API (@bkonyi) or significant changes to support the compilation in DDC (@nshahan) but most likely nothing needed to be done for the debugger. |
@bkonyi - can you speak to Anna's question above wrt any service protocol changes to support this feature? |
Sorry for the delay. No, I don't think there's anything special we'd need to change from the service's perspective. |
Thanks! |
I'll keep a task for the vm service protocol to cover Anna's comment above - 'we would need to at least add tests for newly allowed expressions to evaluate correctly'. It sounds like no protocol / api changes however, so nothing that would leak through to other clients. @nshahan - for Anna's other question - |
@devoncarew My assumption was that there would be little to no implementation on the DDC side. I will take a look at the feature tests that are failing to get an idea of what will be required. I'll report back if I find any significant issues. |
It looks like the failing tests in DDC are all related to redirecting constructors that apply named arguments anywhere in the redirection. We are not correctly creating the temporary variables created by the CFE lowering. I'll investigate a fix but it doesn't look like it will be very big. See #47831 |
Update: dart2js now passing. dart2js has an existing bug (#47047) which is tickled by the new tests. I'll fix it (WIP https://dart-review.googlesource.com/c/sdk/+/223381) |
I have this implemented in dart_style now, but not yet released and rolled into the Dart SDK. I'll roll it in once I get enhanced enums done too. |
@devoncarew Can this issue be closed now, given the unchecked boxes in the top posting? |
Yes, I think we can close (and track any remaining work in separate issues). @leafpetersen @mit-mit - I lost track of this issue when I switched away from TPM style work. Not sure what the new project management process for language features looks like going forward. |
This issue is for implementing dart-lang/language#1072 and referencing it in the related CLs.
The language flag here is
named-arguments-anywhere
, and the github project for this feature is https://github.com/orgs/dart-lang/projects/33.Spec and test tasks
Implementation tasks
The text was updated successfully, but these errors were encountered: