Skip to content

Swap the arguments to has - #2758

Merged
natebosch merged 4 commits into
masterfrom
swap-has-arguments
Nov 13, 2026
Merged

natebosch merged 4 commits into
masterfrom
swap-has-arguments

Conversation

@natebosch

@natebosch natebosch commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Towards #2616

These were originally written with the callback argument first because
it adds a slight convenience in an IDE where the fields can be
autocompleted before having to type the name argument. It's more common
in Dart for the callback argument to be trailing, and it reads nicer
with the name argument first.

Add fix data to correct use sites. Migrate has2 call sites in checks
and checks_codegen back to has, and keep has2 forwarding to has
until downstream has2 callers are migrated.

Towards #2616

These were originally written with the callback argument first because
it adds a slight convenience in an IDE where the fields can be
autocompleted before having to type the name argument. It's more common
in Dart for the callback argument to be trailing, and it reads nicer
with the name argument first.

Add fix data to correct use sites. Update the code generator to use the
new format.
@github-actions github-actions Bot added the package:checks Issues related to pkg:checks label Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

PR Health

Publish ✔️
Package Version Status Publish tag (post-merge)
package:checks ⭐ 0.4.0-wip WIP (no publish necessary)
package:checks_codegen ⭐ 0.1.1-wip WIP (no publish necessary)
  • 3 already published.
  • 4 WIP (no publish necessary).

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

This check can be disabled by tagging the PR with skip-publish-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check (for example, for non-user-visible changes when the package version is already at -wip).

@natebosch
natebosch marked this pull request as ready for review September 18, 2026 05:09
@natebosch
natebosch requested a review from a team as a code owner September 18, 2026 05:09
@natebosch
natebosch requested a review from lrhn September 18, 2026 05:09
natebosch added a commit that referenced this pull request Oct 28, 2026
Towards #2616

Landing ahead of #2758

Add a `has2` extension method on `Subject` which takes the `name`
argument before the `extract` callback. This is the argument order that
`has` will eventually use. It's more common in Dart for a callback
argument to be trailing, and it reads better with the name first.

This package needs to roll to mono repos where an atomic fix to usage
sites is more brittle than incremental fixes. Instead of swapping the
arguments to `has` in one breaking change, roll this version and migrate
usages to `has2`. Then swap the arguments to `has`, migrate usages back,
and remove `has2`. All of these steps will land before the next publish
to pub.

Migrate usages in this repo to `has2`, and update the `checks_codegen`
builder to generate `has2` calls.
@@ -0,0 +1,45 @@
version: 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a new one for me!

@natebosch
natebosch merged commit 269bdfd into master Nov 13, 2026
70 checks passed
@natebosch
natebosch deleted the swap-has-arguments branch November 13, 2026 01:06
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Nov 13, 2026
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/7e2508c..1c40672):
  1c406729  Thu Nov 12 10:21:44 2026 +0200  Sergey G. Grekhov  Add method doc comment tests for mixin, enums, extension and extension types (dart-lang/dartdoc#4317)
  37781f73  Thu Nov 12 10:21:17 2026 +0200  Sergey G. Grekhov  Add operator doc comment tests for mixin, enums, extension and extension types (dart-lang/dartdoc#4318)

native (https://github.com/dart-lang/native/compare/b21ef2d..5fcc6f4):
  5fcc6f4f2  Fri Nov 13 10:15:54 2026 +1100  Liam Appelbe  [jni] Fix doc typo (dart-lang/native#3792)

test (https://github.com/dart-lang/test/compare/3533ae1..269bdfd):
  269bdfde  Thu Nov 12 17:06:39 2026 -0800  Nate Bosch  Swap the arguments to `has` (dart-lang/test#2758)

tools (https://github.com/dart-lang/tools/compare/589d844..ddda9d8):
  ddda9d89d  Thu Nov 12 20:52:40 2026 +0200  NemesisDev  [unified_analytics] Add fallbackRootTool to getEnvironment() (dart-lang/tools#2806)
  e4082a359  Thu Nov 12 15:50:08 2026 +0100  Jonas Finnemann Jensen  [markdown] Cap synthetic empty table cells at 0x40000 (dart-lang/tools#2816)

Change-Id: I87a785700abdb687cc74e643d95baf1e068f993b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/577800
Reviewed-by: Kevin Moore <[email protected]>
Commit-Queue: Kevin Moore <[email protected]>
Commit-Queue: Nate Bosch <[email protected]>
Auto-Submit: Nate Bosch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package:checks Issues related to pkg:checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants