Skip to content

Commit 8bd527e

Browse files
authored
Merge pull request #14856 from rochala/fix-uncompiling-snippets
Scaladoc - fix uncompiling snippets, fix indentation for snippets
2 parents aa5ea92 + ecebebb commit 8bd527e

32 files changed

+439
-255
lines changed

library/src/scala/Tuple.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ object Tuple {
152152
/** Filters out those members of the tuple for which the predicate `P` returns `false`.
153153
* A predicate `P[X]` is a type that can be either `true` or `false`. For example:
154154
* ```scala
155-
* type IsString[x] = x match {
155+
* type IsString[x] <: Boolean = x match {
156156
* case String => true
157157
* case _ => false
158158
* }
159-
* Filter[(1, "foo", 2, "bar"), IsString] =:= ("foo", "bar")
159+
* summon[Tuple.Filter[(1, "foo", 2, "bar"), IsString] =:= ("foo", "bar")]
160160
* ```
161161
* @syntax markdown
162162
*/

library/src/scala/annotation/MainAnnotation.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package scala.annotation
1111
* - a call to `command.run` with the closure of user-main applied to all arguments.
1212
*
1313
* Example:
14-
* ```scala
14+
* ```scala sc:nocompile
1515
* /** Sum all the numbers
1616
* *
1717
* * @param first Fist number to sum
@@ -20,7 +20,7 @@ package scala.annotation
2020
* @myMain def sum(first: Int, second: Int = 0, rest: Int*): Int = first + second + rest.sum
2121
* ```
2222
* generates
23-
* ```scala
23+
* ```scala sc:nocompile
2424
* object foo {
2525
* def main(args: Array[String]): Unit = {
2626
* val mainAnnot = new myMain()

library/src/scala/compiletime/ops/any.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ package ops
44
object any:
55
/** Equality comparison of two singleton types.
66
* ```scala
7+
* //{
8+
* import compiletime.ops.any._
9+
* //}
710
* val eq1: 1 == 1 = true
811
* val eq2: 1 == "1" = false
912
* val eq3: "1" == "1" = true
@@ -14,6 +17,9 @@ object any:
1417

1518
/** Inequality comparison of two singleton types.
1619
* ```scala
20+
* //{
21+
* import compiletime.ops.any._
22+
* //}
1723
* val eq1: 1 != 1 = false
1824
* val eq2: 1 != "1" = true
1925
* val eq3: "1" != "1" = false
@@ -24,6 +30,9 @@ object any:
2430

2531
/** Tests if a type is a constant.
2632
* ```scala
33+
* //{
34+
* import compiletime.ops.any._
35+
* //}
2736
* val c1: IsConst[1] = true
2837
* val c2: IsConst["hi"] = true
2938
* val c3: IsConst[false] = true
@@ -32,6 +41,9 @@ object any:
3241
* If the type is not yet known, then `IsConst` remains unevaluated, and
3342
* will be evaluated only at its concrete type application. E.g.:
3443
* ```scala
44+
* //{
45+
* import compiletime.ops.any._
46+
* //}
3547
* //def `isConst`` returns the type `IsConst[X]`, since `X` is not yet known.
3648
* def isConst[X] : IsConst[X] = ???
3749
* val c5 : true = isConst[1] //now the type is known to be a constant
@@ -43,6 +55,9 @@ object any:
4355

4456
/** String conversion of a constant singleton type.
4557
* ```scala
58+
* //{
59+
* import compiletime.ops.any._
60+
* //}
4661
* val s1: ToString[1] = "1"
4762
* val sTrue: ToString[true] = "true"
4863
* ```

library/src/scala/compiletime/ops/boolean.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ object boolean:
55

66
/** Negation of a `Boolean` singleton type.
77
* ```scala
8+
* //{
9+
* import compiletime.ops.boolean._
10+
* //}
811
* val notFalse: ![false] = true
912
* val notTrue: ![true] = false
1013
* ```
@@ -14,6 +17,9 @@ object boolean:
1417

1518
/** Exclusive disjunction of two `Boolean` singleton types.
1619
* ```scala
20+
* //{
21+
* import compiletime.ops.boolean._
22+
* //}
1723
* val a: true ^ true = false
1824
* val b: false ^ true = true
1925
* ```
@@ -23,6 +29,9 @@ object boolean:
2329

2430
/** Conjunction of two `Boolean` singleton types.
2531
* ```scala
32+
* //{
33+
* import compiletime.ops.boolean._
34+
* //}
2635
* val a: true && true = true
2736
* val b: false && true = false
2837
* ```
@@ -32,6 +41,9 @@ object boolean:
3241

3342
/** Disjunction of two `Boolean` singleton types.
3443
* ```scala
44+
* //{
45+
* import compiletime.ops.boolean._
46+
* //}
3547
* val a: true || false = true
3648
* val b: false || false = false
3749
* ```

library/src/scala/compiletime/ops/double.scala

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ package ops
44
object double:
55
/** Addition of two `Double` singleton types.
66
* ```scala
7+
* //{
8+
* import compiletime.ops.double._
9+
* //}
710
* val sum: 2.0 + 2.0 = 4.0
811
* ```
912
* @syntax markdown
@@ -12,6 +15,9 @@ object double:
1215

1316
/** Subtraction of two `Double` singleton types.
1417
* ```scala
18+
* //{
19+
* import compiletime.ops.double._
20+
* //}
1521
* val sub: 4.0 - 2.0 = 2.0
1622
* ```
1723
* @syntax markdown
@@ -20,6 +26,9 @@ object double:
2026

2127
/** Multiplication of two `Double` singleton types.
2228
* ```scala
29+
* //{
30+
* import compiletime.ops.double._
31+
* //}
2332
* val mul: 4.0 * 2.0 = 8.0
2433
* ```
2534
* @syntax markdown
@@ -28,6 +37,9 @@ object double:
2837

2938
/** Integer division of two `Double` singleton types.
3039
* ```scala
40+
* //{
41+
* import compiletime.ops.double._
42+
* //}
3143
* val div: 5.0 / 2.0 = 2.5
3244
* ```
3345
* @syntax markdown
@@ -36,6 +48,9 @@ object double:
3648

3749
/** Remainder of the division of `X` by `Y`.
3850
* ```scala
51+
* //{
52+
* import compiletime.ops.double._
53+
* //}
3954
* val mod: 5.0 % 2.0 = 1.0
4055
* ```
4156
* @syntax markdown
@@ -44,6 +59,9 @@ object double:
4459

4560
/** Less-than comparison of two `Double` singleton types.
4661
* ```scala
62+
* //{
63+
* import compiletime.ops.double._
64+
* //}
4765
* val lt1: 4.0 < 2.0 = false
4866
* val lt2: 2.0 < 4.0 = true
4967
* ```
@@ -53,6 +71,9 @@ object double:
5371

5472
/** Greater-than comparison of two `Double` singleton types.
5573
* ```scala
74+
* //{
75+
* import compiletime.ops.double._
76+
* //}
5677
* val gt1: 4.0 > 2.0 = true
5778
* val gt2: 2.0 > 2.0 = false
5879
* ```
@@ -62,6 +83,9 @@ object double:
6283

6384
/** Greater-or-equal comparison of two `Double` singleton types.
6485
* ```scala
86+
* //{
87+
* import compiletime.ops.double._
88+
* //}
6589
* val ge1: 4.0 >= 2.0 = true
6690
* val ge2: 2.0 >= 3.0 = false
6791
* ```
@@ -71,6 +95,9 @@ object double:
7195

7296
/** Less-or-equal comparison of two `Double` singleton types.
7397
* ```scala
98+
* //{
99+
* import compiletime.ops.double._
100+
* //}
74101
* val lt1: 4.0 <= 2.0 = false
75102
* val lt2: 2.0 <= 2.0 = true
76103
* ```
@@ -80,6 +107,9 @@ object double:
80107

81108
/** Absolute value of an `Double` singleton type.
82109
* ```scala
110+
* //{
111+
* import compiletime.ops.double._
112+
* //}
83113
* val abs: Abs[-1.0] = 1.0
84114
* ```
85115
* @syntax markdown
@@ -88,6 +118,9 @@ object double:
88118

89119
/** Negation of an `Double` singleton type.
90120
* ```scala
121+
* //{
122+
* import compiletime.ops.double._
123+
* //}
91124
* val neg1: Negate[-1.0] = 1.0
92125
* val neg2: Negate[1.0] = -1.0
93126
* ```
@@ -97,6 +130,9 @@ object double:
97130

98131
/** Minimum of two `Double` singleton types.
99132
* ```scala
133+
* //{
134+
* import compiletime.ops.double._
135+
* //}
100136
* val min: Min[-1.0, 1.0] = -1.0
101137
* ```
102138
* @syntax markdown
@@ -105,6 +141,9 @@ object double:
105141

106142
/** Maximum of two `Double` singleton types.
107143
* ```scala
144+
* //{
145+
* import compiletime.ops.double._
146+
* //}
108147
* val max: Max[-1.0, 1.0] = 1.0
109148
* ```
110149
* @syntax markdown
@@ -113,6 +152,9 @@ object double:
113152

114153
/** Int conversion of a `Double` singleton type.
115154
* ```scala
155+
* //{
156+
* import compiletime.ops.double._
157+
* //}
116158
* val x: ToInt[1.0] = 1
117159
* ```
118160
* @syntax markdown
@@ -121,6 +163,9 @@ object double:
121163

122164
/** Long conversion of a `Double` singleton type.
123165
* ```scala
166+
* //{
167+
* import compiletime.ops.double._
168+
* //}
124169
* val x: ToLong[1.0] = 1L
125170
* ```
126171
* @syntax markdown
@@ -129,6 +174,9 @@ object double:
129174

130175
/** Float conversion of a `Double` singleton type.
131176
* ```scala
177+
* //{
178+
* import compiletime.ops.double._
179+
* //}
132180
* val x: ToFloat[1.0] = 1.0f
133181
* ```
134182
* @syntax markdown

0 commit comments

Comments
 (0)