Repository navigation
Conversation
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.
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with |
jonasfj
approved these changes
Oct 28, 2026
Member
|
You could also just make a hard break, it'll be a bit complicated to migrate a few places. But checks isn't 1.0.0 yet. |
Member
Author
It'll be a hard break by the time it's published to pub. This is solely to remove complications from internal rolls. |
copybara-service Bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Oct 29, 2026
Revisions updated by `dart tools/rev_sdk_deps.dart test`. test (https://github.com/dart-lang/test/compare/5967927..6d74720): 6d747209 Wed Oct 28 15:12:45 2026 -0700 Nate Bosch Fix a race in an expanded reporter retry test (dart-lang/test#2810) 434cf2fc Wed Oct 28 09:06:26 2026 -0700 Nate Bosch Enable incremental migration for argument swap (dart-lang/test#2806) Change-Id: Ifcb0f113940380b788492f3fed829792ba0b7676 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/570662 Auto-Submit: Nate Bosch <[email protected]> Reviewed-by: Kevin Moore <[email protected]> Commit-Queue: Kevin Moore <[email protected]>
copybara-service Bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Oct 29, 2026
`package:checks` is swapping the argument order of `Subject.has` so the description comes before the extractor. To allow incremental migration, dart-lang/test#2806 added `has2(String name, R Function(T) extract)` alongside `has(R Function(T) extract, String name)`. This is the first step of a multi-step migration that ends back at `has`: 1. Move callers from `has(extract, name)` to `has2(name, extract)` (this change). 2. Change `has` in `package:checks` to take `(name, extract)`. 3. Move callers from `has2` back to `has`, then remove `has2`. Rewrite all 52 `has` calls in `pkg/analyzer/test` and `pkg/dartpad_worker/test` to `has2`, swapping the arguments. The calls were found and rewritten with an analyzer-based codemod that only touches invocations resolving to `package:checks`. All packages that use `package:checks` list it in `dev_dependencies` with an `any` constraint, so no pubspec changes are needed. Change-Id: I845e9a36988ca9eecc8bf1f5b2db45c4eaa41f2c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/571201 Auto-Submit: Nate Bosch <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]> Commit-Queue: Nate Bosch <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Towards #2616
Landing ahead of #2758
Add a
has2extension method onSubjectwhich takes thenameargument before the
extractcallback. This is the argument order thathaswill eventually use. It's more common in Dart for a callbackargument 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
hasin one breaking change, roll this version and migrateusages to
has2. Then swap the arguments tohas, migrate usages back,and remove
has2. All of these steps will land before the next publishto pub.
Migrate usages in this repo to
has2, and update thechecks_codegenbuilder to generate
has2calls.