Skip to content

Commit

Permalink
Merge pull request scala#14856 from rochala/fix-uncompiling-snippets
Browse files Browse the repository at this point in the history
Scaladoc - fix uncompiling snippets, fix indentation for snippets
  • Loading branch information
pikinier20 authored Jun 9, 2022
2 parents aa5ea92 + ecebebb commit 8bd527e
Show file tree
Hide file tree
Showing 32 changed files with 439 additions and 255 deletions.
4 changes: 2 additions & 2 deletions library/src/scala/Tuple.scala
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ object Tuple {
/** Filters out those members of the tuple for which the predicate `P` returns `false`.
* A predicate `P[X]` is a type that can be either `true` or `false`. For example:
* ```scala
* type IsString[x] = x match {
* type IsString[x] <: Boolean = x match {
* case String => true
* case _ => false
* }
* Filter[(1, "foo", 2, "bar"), IsString] =:= ("foo", "bar")
* summon[Tuple.Filter[(1, "foo", 2, "bar"), IsString] =:= ("foo", "bar")]
* ```
* @syntax markdown
*/
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/annotation/MainAnnotation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package scala.annotation
* - a call to `command.run` with the closure of user-main applied to all arguments.
*
* Example:
* ```scala
* ```scala sc:nocompile
* /** Sum all the numbers
* *
* * @param first Fist number to sum
Expand All @@ -20,7 +20,7 @@ package scala.annotation
* @myMain def sum(first: Int, second: Int = 0, rest: Int*): Int = first + second + rest.sum
* ```
* generates
* ```scala
* ```scala sc:nocompile
* object foo {
* def main(args: Array[String]): Unit = {
* val mainAnnot = new myMain()
Expand Down
15 changes: 15 additions & 0 deletions library/src/scala/compiletime/ops/any.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ package ops
object any:
/** Equality comparison of two singleton types.
* ```scala
* //{
* import compiletime.ops.any._
* //}
* val eq1: 1 == 1 = true
* val eq2: 1 == "1" = false
* val eq3: "1" == "1" = true
Expand All @@ -14,6 +17,9 @@ object any:

/** Inequality comparison of two singleton types.
* ```scala
* //{
* import compiletime.ops.any._
* //}
* val eq1: 1 != 1 = false
* val eq2: 1 != "1" = true
* val eq3: "1" != "1" = false
Expand All @@ -24,6 +30,9 @@ object any:

/** Tests if a type is a constant.
* ```scala
* //{
* import compiletime.ops.any._
* //}
* val c1: IsConst[1] = true
* val c2: IsConst["hi"] = true
* val c3: IsConst[false] = true
Expand All @@ -32,6 +41,9 @@ object any:
* If the type is not yet known, then `IsConst` remains unevaluated, and
* will be evaluated only at its concrete type application. E.g.:
* ```scala
* //{
* import compiletime.ops.any._
* //}
* //def `isConst`` returns the type `IsConst[X]`, since `X` is not yet known.
* def isConst[X] : IsConst[X] = ???
* val c5 : true = isConst[1] //now the type is known to be a constant
Expand All @@ -43,6 +55,9 @@ object any:

/** String conversion of a constant singleton type.
* ```scala
* //{
* import compiletime.ops.any._
* //}
* val s1: ToString[1] = "1"
* val sTrue: ToString[true] = "true"
* ```
Expand Down
12 changes: 12 additions & 0 deletions library/src/scala/compiletime/ops/boolean.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ object boolean:

/** Negation of a `Boolean` singleton type.
* ```scala
* //{
* import compiletime.ops.boolean._
* //}
* val notFalse: ![false] = true
* val notTrue: ![true] = false
* ```
Expand All @@ -14,6 +17,9 @@ object boolean:

/** Exclusive disjunction of two `Boolean` singleton types.
* ```scala
* //{
* import compiletime.ops.boolean._
* //}
* val a: true ^ true = false
* val b: false ^ true = true
* ```
Expand All @@ -23,6 +29,9 @@ object boolean:

/** Conjunction of two `Boolean` singleton types.
* ```scala
* //{
* import compiletime.ops.boolean._
* //}
* val a: true && true = true
* val b: false && true = false
* ```
Expand All @@ -32,6 +41,9 @@ object boolean:

/** Disjunction of two `Boolean` singleton types.
* ```scala
* //{
* import compiletime.ops.boolean._
* //}
* val a: true || false = true
* val b: false || false = false
* ```
Expand Down
48 changes: 48 additions & 0 deletions library/src/scala/compiletime/ops/double.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ package ops
object double:
/** Addition of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val sum: 2.0 + 2.0 = 4.0
* ```
* @syntax markdown
Expand All @@ -12,6 +15,9 @@ object double:

/** Subtraction of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val sub: 4.0 - 2.0 = 2.0
* ```
* @syntax markdown
Expand All @@ -20,6 +26,9 @@ object double:

/** Multiplication of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val mul: 4.0 * 2.0 = 8.0
* ```
* @syntax markdown
Expand All @@ -28,6 +37,9 @@ object double:

/** Integer division of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val div: 5.0 / 2.0 = 2.5
* ```
* @syntax markdown
Expand All @@ -36,6 +48,9 @@ object double:

/** Remainder of the division of `X` by `Y`.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val mod: 5.0 % 2.0 = 1.0
* ```
* @syntax markdown
Expand All @@ -44,6 +59,9 @@ object double:

/** Less-than comparison of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val lt1: 4.0 < 2.0 = false
* val lt2: 2.0 < 4.0 = true
* ```
Expand All @@ -53,6 +71,9 @@ object double:

/** Greater-than comparison of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val gt1: 4.0 > 2.0 = true
* val gt2: 2.0 > 2.0 = false
* ```
Expand All @@ -62,6 +83,9 @@ object double:

/** Greater-or-equal comparison of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val ge1: 4.0 >= 2.0 = true
* val ge2: 2.0 >= 3.0 = false
* ```
Expand All @@ -71,6 +95,9 @@ object double:

/** Less-or-equal comparison of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val lt1: 4.0 <= 2.0 = false
* val lt2: 2.0 <= 2.0 = true
* ```
Expand All @@ -80,6 +107,9 @@ object double:

/** Absolute value of an `Double` singleton type.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val abs: Abs[-1.0] = 1.0
* ```
* @syntax markdown
Expand All @@ -88,6 +118,9 @@ object double:

/** Negation of an `Double` singleton type.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val neg1: Negate[-1.0] = 1.0
* val neg2: Negate[1.0] = -1.0
* ```
Expand All @@ -97,6 +130,9 @@ object double:

/** Minimum of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val min: Min[-1.0, 1.0] = -1.0
* ```
* @syntax markdown
Expand All @@ -105,6 +141,9 @@ object double:

/** Maximum of two `Double` singleton types.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val max: Max[-1.0, 1.0] = 1.0
* ```
* @syntax markdown
Expand All @@ -113,6 +152,9 @@ object double:

/** Int conversion of a `Double` singleton type.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val x: ToInt[1.0] = 1
* ```
* @syntax markdown
Expand All @@ -121,6 +163,9 @@ object double:

/** Long conversion of a `Double` singleton type.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val x: ToLong[1.0] = 1L
* ```
* @syntax markdown
Expand All @@ -129,6 +174,9 @@ object double:

/** Float conversion of a `Double` singleton type.
* ```scala
* //{
* import compiletime.ops.double._
* //}
* val x: ToFloat[1.0] = 1.0f
* ```
* @syntax markdown
Expand Down
Loading

0 comments on commit 8bd527e

Please sign in to comment.