Skip to content

collection, convert, js (7): Add Scaladoc comments for undocumented entities - #26904

Draft
bvenners wants to merge 1 commit into
scala:mainfrom
artimahub:scaladoc-missing-docs-collection-convert-js
Draft

bvenners wants to merge 1 commit into
scala:mainfrom
artimahub:scaladoc-missing-docs-collection-convert-js

Conversation

@bvenners

Copy link
Copy Markdown
Contributor

This PR fills in a main doc comment plus @PARAM, @tparam, and @return tags for scala.collection.convert and the Scala.js variants of the standard library that are completely missing any Scaladoc documentation. Most of it is the stepper implementations under collection.convert.impl; the rest is the Scala.js counterparts of files whose JVM versions are documented in the other pull requests in this series, across scala, scala.collection.immutable, scala.collection.mutable, scala.runtime, scala.reflect, scala.util, scala.math, scala.concurrent and scala.scalajs. 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.

@inline def compareAndSet(ll: LazyListBase[?], expected: AnyRef, value: AnyRef): Boolean =
if (ll._tail eq expected) { ll._tail = value; true } else false

/** Sets the `_tail` field of `ll` to `value`.

@WojciechMazur WojciechMazur Aug 25, 2026

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.

Do we really want to document internal implementation details in public documentation?
Also all package-private definitions are not user facing, maybe we don't need to explicitlly document them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. About a quarter of the added docs in these PRs are non-user facing, so that would be for maintainers alone. I can strip that out if people think it is more clutter than clarity. I'm not sure if there's a compile time cost, but there could be a comprehension cost if the bare, uncommented code is easier for maintainers to work with. I'm curious to hear what people think.

@bvenners
bvenners force-pushed the scaladoc-missing-docs-collection-convert-js branch from b4980d4 to 86f1335 Compare September 9, 2026 22:20
@bvenners
bvenners force-pushed the scaladoc-missing-docs-collection-convert-js branch from 36d8b8c to 38121c0 Compare September 9, 2026 22:30

@cheeseng cheeseng left a comment

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.

Added some comments about the new scaladocs.

/** Returns a message describing the object that failed to match.
*
* The message contains the object's string representation and its class name,
* falling back to the class name alone if its `toString` throws, and naming

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.

The fallback, when happens, is:

"an instance " + ofClass

Not just the class name alone.

Also, the comment didn't mention that when obj is null it will return "null".

@@ -40,9 +40,15 @@ import scala.collection.{AbstractIterator, AnyStepper, IterableFactoryDefaults,
*/
@SerialVersionUID(3L)
sealed class NumericRange[T](

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.

Not sure if it is due to the 'sealed' keyword that makes our tool to not process this, the current scaladoc does not have @tparam fot T.

trait NoStackTrace extends Throwable {
/** Overrides the default stack trace filling behavior to optionally suppress stack traces for efficiency.
*
* @return this `Throwable` instance without filling in the stack trace if suppression is enabled, otherwise the result of the superclass implementation

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.

May be simpler with:

"returns this unchanged when stack traces are suppressed, otherwise fills in the stack trace".

* to `Array[AnyRef]`. Arrays are covariant in their
* element type at run time.
*
* `Array.equals(xs.asInstanceOf[Array[AnyRef]], ys.asInstanceOf[Array[AnyRef]])`

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.

Better to use triple quotes here.

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.

3 participants