diff --git a/library/src/scala/quoted/Quotes.scala b/library/src/scala/quoted/Quotes.scala index 0f4695e48dfb..935ddceead56 100644 --- a/library/src/scala/quoted/Quotes.scala +++ b/library/src/scala/quoted/Quotes.scala @@ -1599,7 +1599,31 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching => end extension end ReturnMethods - /** Tree representing a variable argument list in the source code */ + /** Tree representing a variable argument list in the source code. + * + * This tree is used to encode varargs terms. The Repeated encapsulates + * the sequence of the elements but needs to be wrapped in a + * `scala.[T]` (see `defn.RepeatedParamClass`). For example the + * arguments `1, 2` of `List.apply(1, 2)` can be represented as follows: + * + * + * ```scala + * //{ + * import scala.quoted._ + * def inQuotes(using Quotes) = { + * val q: Quotes = summon[Quotes] + * import q.reflect._ + * //} + * val intArgs = List(Literal(IntConstant(1)), Literal(IntConstant(2))) + * Typed( + * Repeated(intArgs, TypeTree.of[Int]), + * Inferred(defn.RepeatedParamClass.typeRef.appliedTo(TypeRepr.of[Int])) + * ) + * //{ + * } + * //} + * ``` + */ type Repeated <: Term /** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is a `Repeated` */ diff --git a/library/src/scala/util/boundary.scala b/library/src/scala/util/boundary.scala index 2edd754bbb93..3039fc70be90 100644 --- a/library/src/scala/util/boundary.scala +++ b/library/src/scala/util/boundary.scala @@ -15,14 +15,16 @@ import scala.annotation.implicitNotFound * be rewritten to jumps. * * Example usage: + * + * ```scala + * import scala.util.boundary, boundary.break * - * import scala.util.boundary, boundary.break - * - * def firstIndex[T](xs: List[T], elem: T): Int = - * boundary: - * for (x, i) <- xs.zipWithIndex do - * if x == elem then break(i) - * -1 + * def firstIndex[T](xs: List[T], elem: T): Int = + * boundary: + * for (x, i) <- xs.zipWithIndex do + * if x == elem then break(i) + * -1 + * ``` */ object boundary: diff --git a/project/Build.scala b/project/Build.scala index 8da49dedeb4c..3c3c04408b84 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -2134,7 +2134,10 @@ object ScaladocConfigs { .add(VersionsDictionaryUrl("https://scala-lang.org/api/versions.json")) .add(DocumentSyntheticTypes(true)) .add(SnippetCompiler(List( - s"${dottyLibRoot}/scala=compile", + s"$dottyLibRoot/scala=compile", + s"$dottyLibRoot/scala/compiletime=compile", + s"$dottyLibRoot/scala/util=compile", + s"$dottyLibRoot/scala/util/control=compile" ))) .add(SiteRoot("docs")) .add(ApiSubdirectory(true)) @@ -2142,21 +2145,25 @@ object ScaladocConfigs { } def stableScala3(version: String) = Def.task { + val scalaLibrarySrc = s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src" + val dottyLibrarySrc = s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src" Scala3.value .add(defaultSourceLinks(version + "-bin-SNAPSHOT-nonbootstrapped", version).value) .add(ProjectVersion(version)) .add(SnippetCompiler( List( - s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/quoted=compile", - s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/compiletime=compile" + s"$dottyLibrarySrc/scala/quoted=compile", + s"$dottyLibrarySrc/scala/compiletime=compile", + s"$dottyLibrarySrc/scala/util=compile", + s"$dottyLibrarySrc/scala/util/control=compile" ) )) .add(CommentSyntax(List( - s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src=markdown", - s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src=wiki", + s"$dottyLibrarySrc=markdown", + s"$scalaLibrarySrc=wiki", "wiki" ))) - .add(DocRootContent(s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src/rootdoc.txt")) + .add(DocRootContent(s"$scalaLibrarySrc/rootdoc.txt")) .withTargets( Seq( s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",