diff --git a/library/src/scala/collection/generic/IsIterable.scala b/library/src/scala/collection/generic/IsIterable.scala index 63f2d0267866..2d3a743b5bde 100644 --- a/library/src/scala/collection/generic/IsIterable.scala +++ b/library/src/scala/collection/generic/IsIterable.scala @@ -39,7 +39,7 @@ import caps.unsafe.untrackedCaptures * is to provide a generic extension method `mapReduce` for any type that extends * or can be converted to `Iterable`, such as `String`. * - * ``` + * ```scala sc:compile * import scala.collection.generic.IsIterable * * extension [Repr, I <: IsIterable[Repr]](coll: Repr)(using it: I) @@ -51,9 +51,9 @@ import caps.unsafe.untrackedCaptures * res * } * - * // See it in action! - * List(1, 2, 3).mapReduce(_ * 2)(_ + _) // res0: Int = 12 - * "Yeah, well, you know, that's just, like, your opinion, man.".mapReduce(x => 1)(_ + _) // res1: Int = 59 + * // See it in action! + * val res0 = List(1, 2, 3).mapReduce(_ * 2)(_ + _) // res0: Int = 12 + * val res1 = "Yeah, well, you know, that's just, like, your opinion, man.".mapReduce(x => 1)(_ + _) // res1: Int = 59 * ``` * * The extension method takes a receiver `coll` of type `Repr`, where @@ -79,7 +79,10 @@ import caps.unsafe.untrackedCaptures * the implicit value for any `IterableOps`, as for `List` in the previous example. * Similarly, the instance for `String` was available because the library provides an `IsSeq[String]`. * + * ```scala sc-name:iterableops-import sc-hidden + * import scala.collection.IterableOps * ``` + * ```scala sc-compile-with:iterableops-import * implicit val rangeRepr: IsIterable[Range] { type A = Int; type C = IndexedSeq[Int] } = * new IsIterable[Range] { * type A = Int diff --git a/library/src/scala/collection/generic/IsIterableOnce.scala b/library/src/scala/collection/generic/IsIterableOnce.scala index c77d9e23bc8a..1c6eefa7030b 100644 --- a/library/src/scala/collection/generic/IsIterableOnce.scala +++ b/library/src/scala/collection/generic/IsIterableOnce.scala @@ -26,7 +26,10 @@ import caps.unsafe.untrackedCaptures * framework in their implementation. * * Example usage, + * ```scala sc-name:import-buildfrom sc-hidden + * import scala.collection.BuildFrom * ``` + * ```scala sc-compile-with:import-buildfrom * extension [Repr, I <: IsIterableOnce[Repr]](coll: Repr)(using it: I) { * final def filterMap[B, That](f: it.A => Option[B])(using bf: BuildFrom[Repr, B, That]): That = { * val b = bf.newBuilder(coll)