Skip to content

Add tests for type parameters - #4308

Merged
szakarias merged 4 commits into
dart-lang:mainfrom
sgrekhov:sgrekhov-dartdoc-17
Nov 5, 2026
Merged

szakarias merged 4 commits into
dart-lang:mainfrom
sgrekhov:sgrekhov-dartdoc-17

Conversation

@sgrekhov

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds a new test file test/co19/placement_type_parameters_test.dart to verify that doc comments placed inside type parameter lists are ignored and not associated with the enclosing elements or the type parameters themselves. The reviewer points out that the tests should use the custom bootLibrary helper method instead of bootPackageWithLibrary to ensure proper setup for co19 tests.

@sgrekhov
sgrekhov requested a review from szakarias October 29, 2026 13:48

@szakarias szakarias left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

#4302 is a real bug, but it's unrelated to placement: these tests only fail because named('U') can't find a type parameter that dartdoc stores as 'U extends num'. The placement rule itself already holds — with named('U extends num') all assertions pass, and TypeParameterElement.documentationComment is null for every kind of type parameter, so there's no spec deviation to mark as failing. Could you write the assertions without looking up by name, e.g. for (var t in c.typeParameters) expect(t.documentation, isEmpty);, drop the @FailingTests, and fold the *2 assertions into the *1 tests so each package boots once? #4302 deserves its own test about TypeParameter.name. Also missing here: type parameters of methods and typedefs — those should pass today.

@szakarias

Copy link
Copy Markdown
Collaborator

Small addition: please also expect(c.typeParameters, hasLength(2)) before the loop, so it can't pass vacuously.

@sgrekhov

sgrekhov commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

@szakarias thank you for the review. All requested changes are implemented. PTAL.

@sgrekhov
sgrekhov requested a review from szakarias November 3, 2026 08:20

@szakarias szakarias left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@szakarias
szakarias merged commit 03ec6df into dart-lang:main Nov 5, 2026
27 checks passed
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Nov 12, 2026
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/2f6847b..03ec6df):
  03ec6df6  Thu Nov 5 11:12:45 2026 +0200  Sergey G. Grekhov  Add tests for type parameters (dart-lang/dartdoc#4308)
  14a91302  Tue Nov 3 04:24:32 2026 +0100  Moritz  Migrate to ecosystem health publish check and setup-dart publish workflow (dart-lang/dartdoc#4310)
  cd8bf52c  Mon Nov 2 14:19:25 2026 +0100  Sigurd Meldgaard  Support standalone AOT compilation and embed resources in html_resources.g.dart (dart-lang/dartdoc#4298)
  cb1b1b2f  Mon Nov 2 14:39:28 2026 +0200  Sergey G. Grekhov  Add tests for parameters (dart-lang/dartdoc#4304)
  07506415  Mon Nov 2 12:14:22 2026 +0100  dependabot[bot]  Bump the github-actions group across 1 directory with 3 updates (dart-lang/dartdoc#4311)
  494aec7f  Mon Nov 2 12:14:05 2026 +0100  Sarah Zakarias  Add a "Documentation inherited from" note to inherited doc comments (dart-lang/dartdoc#4309)
  527502a9  Mon Nov 2 11:21:46 2026 +0100  Sarah Zakarias  Give the mock SDK the version of the SDK running the tests (dart-lang/dartdoc#4312)

http (https://github.com/dart-lang/http/compare/1f869d0..4646fe6):
  4646fe6  Thu Nov 5 02:41:04 2026 +0530  Chandra ObulaReddy  [http] Don't throw in RetryClient when `when` has read the response stream (dart-lang/http#2040)

native (https://github.com/dart-lang/native/compare/1838637..6287745):
  6287745ca  Thu Nov 5 20:37:11 2026 +0800  Dz  [hooks_runner] Fix UTF-8 decoding of hook output on Windows (dart-lang/native#3772)
  0eada93f9  Thu Nov 5 19:18:09 2026 +0800  Dz  [native_toolchain_c] Decode vswhere UTF-8 output correctly on Windows (dart-lang/native#3773)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants