Skip to content

quoted, jdk (6): Add Scaladoc comments for undocumented entities - #26903

Draft
bvenners wants to merge 3 commits into
scala:mainfrom
artimahub:scaladoc-missing-docs-quoted-jdk
Draft

quoted, jdk (6): Add Scaladoc comments for undocumented entities#26903
bvenners wants to merge 3 commits into
scala:mainfrom
artimahub:scaladoc-missing-docs-quoted-jdk

Conversation

@bvenners

Copy link
Copy Markdown
Contributor

This PR fills in a main doc comment plus @PARAM, @tparam, and @return tags for scala.jdk, scala.quoted and scala.quoted.runtime APIs that are completely missing any Scaladoc documentation. Most of it is quoted/Quotes.scala, which alone accounts for 285 newly documented declarations across the reflection API; the rest covers the scala.jdk accumulators and converters, Expr, ExprMap, FromExpr and Type. I'm submitting it as a draft PR so that I can get the CI to run on it, to see if it breaks anything, and to start getting feedback. We automated the generation of these changes and have not reviewed all of them yet. We will review them all before making the PR non-draft. Please let me know whether you think this is going in the right direction in general, and anything specific that you notice that could be improved.

Documents declarations that had no doc comment at all across scala.jdk (the
four accumulators and their shared base, the function wrappers and
extensions, the duration and future converters, OptionShape) and the first
two files of scala.quoted, Expr and ExprMap.

Comment-only: no declaration, body, import, annotation or blank line is
touched.
Documents the rest of scala.quoted, most of it Quotes.scala, which alone
accounts for 285 newly documented declarations across the reflection API,
along with FromExpr, Type, QuoteMatching and StopMacroExpansion.

Also revises the scala.jdk documentation added by the previous commit,
rechecking each claim against the implementation rather than against the
name: the accumulator steppers in particular describe what their guards
actually do.

Comment-only: no declaration, body, import, annotation or blank line is
touched.
Adjudicated from an independent review of this branch. Comment-only.

- Quotes.reflect: Closure.apply and TermParamClause.apply documented their
  arguments as required to satisfy a constraint. Neither is enforced in normal
  compilation; the assertions run only under -Xcheck-macros.
- SelectOuter's `levels` was described as nested scopes of inlined trees. It is
  stored in OuterSelectName and consumed by ElimOuterSelect as a count of
  outer-path hops.
- FlexibleType's upper bound was called the non-nullable underlying type.
  FlexibleType.apply takes any value type and uses it as given, so an already
  nullable type stays nullable.
- TreeAccumulator.foldOverTree does not visit the `call` of an Inlined, and
  TreeMap.transformTree leaves an Export, a Bind's pattern and an Inlined's
  call untransformed. Both were documented as covering all subtrees.
- Accumulator.knownSize said the size does not fit in an Int at Int.MaxValue.
  It is representable; the bound in the implementation is simply exclusive.
- StopMacroExpansion.fillInStackTrace said only a previously reported error is
  used. A macro can throw it without reporting one, and the compiler then
  emits its own diagnostic.
- asTerm and asExprOf were documented twice: once on the extension clause, as
  upstream does for a single-method extension, and again on the method by this
  branch. Since the added comment says strictly more, the older one-liner is
  dropped so that only one remains.

Three @note NEEDS-HUMAN markers are removed, from DoubleAccumulatorStepper
.nextStep, LongAccumulatorStepper.nextStep and OmitSelectorMethods.name. They
ask questions about the code rather than the documentation, and all three are
recorded in todo-writer/docs/suspected-bugs.md. The surrounding documentation
was already accurate without them: the steppers' @throws describes the empty
accumulator, which is true, and does not claim anything about exhaustion.
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.

1 participant