Skip to content

Commit 438a17a

Browse files
committed
tweak: snippet compiler settings
- Fix build settings to make the snippet compiler to work properly - Tweak some doc snippets so that they pass snippet compiker check Related to: #12967
1 parent 5fc2ef9 commit 438a17a

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

library/src/scala/quoted/Quotes.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -1637,10 +1637,11 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
16371637
* val q: Quotes = summon[Quotes]
16381638
* import q.reflect._
16391639
* //}
1640-
* val intArgs = List(Literal(Constant(1)), Literal(Constant(2)))
1640+
* val intArgs = List(Literal(IntConstant(1)), Literal(IntConstant(2)))
16411641
* Typed(
1642-
* Repeated(intArgs, TypeTree.of[Int]),
1643-
* Inferred(defn.RepeatedParamClass.typeRef.appliedTo(TypeRepr.of[Int]))
1642+
* Repeated(intArgs, TypeTree.of[Int]),
1643+
* Inferred(defn.RepeatedParamClass.typeRef.appliedTo(TypeRepr.of[Int]))
1644+
* )
16441645
* //{
16451646
* }
16461647
* //}

library/src/scala/util/boundary.scala

+9-7
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ import scala.annotation.implicitNotFound
1515
* be rewritten to jumps.
1616
*
1717
* Example usage:
18+
*
19+
* ```scala
20+
* import scala.util.boundary, boundary.break
1821
*
19-
* import scala.util.boundary, boundary.break
20-
*
21-
* def firstIndex[T](xs: List[T], elem: T): Int =
22-
* boundary:
23-
* for (x, i) <- xs.zipWithIndex do
24-
* if x == elem then break(i)
25-
* -1
22+
* def firstIndex[T](xs: List[T], elem: T): Int =
23+
* boundary:
24+
* for (x, i) <- xs.zipWithIndex do
25+
* if x == elem then break(i)
26+
* -1
27+
* ```
2628
*/
2729
object boundary:
2830

project/Build.scala

+7-2
Original file line numberDiff line numberDiff line change
@@ -2359,7 +2359,10 @@ object ScaladocConfigs {
23592359
.add(VersionsDictionaryUrl("https://scala-lang.org/api/versions.json"))
23602360
.add(DocumentSyntheticTypes(true))
23612361
.add(SnippetCompiler(List(
2362-
s"${dottyLibRoot}/scala=compile",
2362+
s"$dottyLibRoot/src/scala=compile",
2363+
s"$dottyLibRoot/src/scala/compiletime=compile",
2364+
s"$dottyLibRoot/src/scala/util=compile",
2365+
s"$dottyLibRoot/src/scala/util/control=compile"
23632366
)))
23642367
.add(SiteRoot("docs"))
23652368
.add(ApiSubdirectory(true))
@@ -2375,7 +2378,9 @@ object ScaladocConfigs {
23752378
.add(SnippetCompiler(
23762379
List(
23772380
s"$dottyLibrarySrc/scala/quoted=compile",
2378-
s"$dottyLibrarySrc/scala/compiletime=compile"
2381+
s"$dottyLibrarySrc/scala/compiletime=compile",
2382+
s"$dottyLibrarySrc/scala/util=compile",
2383+
s"$dottyLibrarySrc/scala/util/control=compile"
23792384
)
23802385
))
23812386
.add(CommentSyntax(List(

0 commit comments

Comments
 (0)