[XL] Change in dart/sdk[main]: DeCo. Refactor index tests.

0 views
Skip to first unread message

Konstantin Shcheglov (Gerrit)

unread,
Jan 21, 2026, 1:37:59 PM (11 hours ago) Jan 21
to Paul Berry, Johnni Winther, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Paul Berry

Konstantin Shcheglov added 1 comment

Patchset-level comments
File-level comment, Patchset 4:
Paul Berry . resolved

I don't feel that I can review this CL effectively because it combines so many renames with the addition of so many new tests. This means that in order to review it I will have to (a) skip review of the test file (which seems irresponsible), (b) track down which tests are new and which tests are old by doing a lot of searching, or (c) just go ahead and review all the tests.

What would be ideal for me is if you could split this into two CLs: one that renames the existing tests, and a follow-up CL that adds the new tests. Then, I could reassure myself that the first CL only contained renames by seeing that the diff contained an equal number of added and removed lines, and so I could focus my review effort on the second CL.

Konstantin Shcheglov

Unfortunately this is not just rename, but also re-group test situations, in a way described in the CL message. I believe the easiest approach would be just review all the tests.

Paul Berry

Ok, I didn't realize it was regrouping as well as renaming. Would it be possible to have a CL that renames and regroups the existing tests, followed by one that adds the new tests?

Judging by the size of the diffs in index_test.dart (-2342, +3264), I'm guessing that there's about 2342 lines of tests that were regrouped and renamed and about 3264-2342=922 lines of tests that were added, so if the CL were split into two in the way I suggest, it would be about 2342 lines of renaming and regrouping (which I would feel comfortable giving a much less thorough review), followed by 922 lines of added tests, which I would review more thoroughly. If we can find an approach where I only have to review 922 lines thoroughly rather than 3264, I believe that would be a far more efficient use of the time I have available for code review.

Konstantin Shcheglov

I believe that there is already segregation in place. New tests are around primary constructors. Look for `_primary` and `_newHead` categories in the test method names.

Paul Berry

Glad to hear there is already segregation in place. I believe that means that it would be relatively easy for you to create the two CLs I suggested. Am I understanding that correctly?

Konstantin Shcheglov

OK, I re-purposed this CL to re-group tests.

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Paul Berry
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I731033eee682e4088eadfa2e6d91adca79c00942
Gerrit-Change-Number: 474620
Gerrit-PatchSet: 7
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Wed, 21 Jan 2026 18:37:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Paul Berry <paul...@google.com>
Comment-In-Reply-To: Konstantin Shcheglov <sche...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Paul Berry (Gerrit)

unread,
Jan 21, 2026, 2:44:39 PM (10 hours ago) Jan 21
to Konstantin Shcheglov, Johnni Winther, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Konstantin Shcheglov

Paul Berry voted and added 4 comments

Votes added by Paul Berry

Code-Review+1

4 comments

Patchset-level comments
Paul Berry . resolved

I don't feel that I can review this CL effectively because it combines so many renames with the addition of so many new tests. This means that in order to review it I will have to (a) skip review of the test file (which seems irresponsible), (b) track down which tests are new and which tests are old by doing a lot of searching, or (c) just go ahead and review all the tests.

What would be ideal for me is if you could split this into two CLs: one that renames the existing tests, and a follow-up CL that adds the new tests. Then, I could reassure myself that the first CL only contained renames by seeing that the diff contained an equal number of added and removed lines, and so I could focus my review effort on the second CL.

Konstantin Shcheglov

Unfortunately this is not just rename, but also re-group test situations, in a way described in the CL message. I believe the easiest approach would be just review all the tests.

Paul Berry

Ok, I didn't realize it was regrouping as well as renaming. Would it be possible to have a CL that renames and regroups the existing tests, followed by one that adds the new tests?

Judging by the size of the diffs in index_test.dart (-2342, +3264), I'm guessing that there's about 2342 lines of tests that were regrouped and renamed and about 3264-2342=922 lines of tests that were added, so if the CL were split into two in the way I suggest, it would be about 2342 lines of renaming and regrouping (which I would feel comfortable giving a much less thorough review), followed by 922 lines of added tests, which I would review more thoroughly. If we can find an approach where I only have to review 922 lines thoroughly rather than 3264, I believe that would be a far more efficient use of the time I have available for code review.

Konstantin Shcheglov

I believe that there is already segregation in place. New tests are around primary constructors. Look for `_primary` and `_newHead` categories in the test method names.

Paul Berry

Glad to hear there is already segregation in place. I believe that means that it would be relatively easy for you to create the two CLs I suggested. Am I understanding that correctly?

Konstantin Shcheglov

OK, I re-purposed this CL to re-group tests.

Paul Berry

Thanks!

File pkg/analyzer/test/src/dart/analysis/index_test.dart
Line 75, Patchset 7 (Latest):44 5:7 |B| IS_ANCESTOR_OF
Paul Berry . unresolved

Something you might want to consider for a future CL:

This reads to me as "B is the ancestor of <something>", whereas actually I believe the relation that's being asserted here is that "A (the thing that we passed to findElement2) is an ancestor of B". Maybe in the future it would be useful to change the output format of _getRelationsText so that this relation is shown like "IS_ANCESTOR_OF |B|".

Line 76, Patchset 7 (Latest):54 5:17 |A| IS_EXTENDED_BY
Paul Berry . unresolved

Similarly, I think this would read more straightforwardly as "IS_EXTENDED_BY |A|", since the relation it's asserting is "A (the thing that we passed to findElement2) is extended via the text "A" that appears here".

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Konstantin Shcheglov
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I731033eee682e4088eadfa2e6d91adca79c00942
Gerrit-Change-Number: 474620
Gerrit-PatchSet: 7
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Wed, 21 Jan 2026 19:44:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Konstantin Shcheglov (Gerrit)

unread,
Jan 21, 2026, 2:56:15 PM (9 hours ago) Jan 21
to Paul Berry, Johnni Winther, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Paul Berry

Konstantin Shcheglov voted and added 1 comment

Votes added by Konstantin Shcheglov

Commit-Queue+2

1 comment

File pkg/analyzer/test/src/dart/analysis/index_test.dart
Line 76, Patchset 7 (Latest):54 5:17 |A| IS_EXTENDED_BY
Paul Berry . unresolved

Similarly, I think this would read more straightforwardly as "IS_EXTENDED_BY |A|", since the relation it's asserting is "A (the thing that we passed to findElement2) is extended via the text "A" that appears here".

Konstantin Shcheglov

I agree that `|B| IS_ANCESTOR_OF` reads not quite right, not as the actual relation it represents.

There are a few other constraints that I had in mind. First, put the text like `|B|` next to the location, because this text serves as the "length" of the location, with an additional bonus that it shows also the selected text.

Second, `54 5:17 |A| IS_EXTENDED_BY` actually reads right, here the order is correct. The element that corresponds to the location, `class B`, extends `A`.

Similarly `54 5:17 |A| IS_REFERENCED_BY`, I think reads right.

And so, for consistency I think it is better to keep the format as is, and don't move the selected text depending on the relation kind.

OTOH, we might not need `IS_ANCESTOR_OF` at all, a quick check did not show that we use it, but I will try to remove and do more analysis separately.

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Paul Berry
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I731033eee682e4088eadfa2e6d91adca79c00942
Gerrit-Change-Number: 474620
Gerrit-PatchSet: 7
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Wed, 21 Jan 2026 19:56:11 +0000
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
Jan 21, 2026, 3:26:26 PM (9 hours ago) Jan 21
to Konstantin Shcheglov, Paul Berry, Johnni Winther, dart-analys...@google.com, rev...@dartlang.org

Commit Queue submitted the change

Change information

Commit message:
DeCo. Refactor index tests.

Rework analyzer index tests to be more maintainable and to better match
the DeCo/primary-constructor surface area.

Test methods are named in general as
`test_<ElementClass>_<container>_<details>` or
`test_<ElementClass>_<usageGroup>_<details>`. This makes it easier to
see for which elements we have tests, and provide better coverage by
freely adding usages to the same code.

Improve failure diagnostics by printing a structured diff when expected
index text mismatches.
Change-Id: I731033eee682e4088eadfa2e6d91adca79c00942
Commit-Queue: Konstantin Shcheglov <sche...@google.com>
Reviewed-by: Paul Berry <paul...@google.com>
Files:
  • M pkg/analyzer/lib/src/test_utilities/find_element2.dart
  • M pkg/analyzer/test/src/dart/analysis/index_test.dart
Change size: XL
Delta: 2 files changed, 2864 insertions(+), 2342 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Paul Berry
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I731033eee682e4088eadfa2e6d91adca79c00942
Gerrit-Change-Number: 474620
Gerrit-PatchSet: 8
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages