diff --git a/docs/_docs/contributing/debug-tests.md b/docs/_docs/contributing/debug-tests.md index 7ca7f4e2a405..a38338fcc745 100644 --- a/docs/_docs/contributing/debug-tests.md +++ b/docs/_docs/contributing/debug-tests.md @@ -38,7 +38,7 @@ You can run `help` for commands that supported by JDB. Following file (`tests/debug/while.scala`) is an example of annotated source code: -```Scala +```scala object Test { def main(args: Array[String]): Unit = { diff --git a/docs/_docs/reference/changed-features/pattern-matching.md b/docs/_docs/reference/changed-features/pattern-matching.md index 8c6ab136fac6..30ae5d9dc104 100644 --- a/docs/_docs/reference/changed-features/pattern-matching.md +++ b/docs/_docs/reference/changed-features/pattern-matching.md @@ -12,7 +12,7 @@ Scala 3 supports a superset of Scala 2 [extractors](https://www.scala-lang.org/f Extractors are objects that expose a method `unapply` or `unapplySeq`: -```Scala +```scala def unapply[A](x: T)(implicit x: B): U def unapplySeq[A](x: T)(implicit x: B): U ``` @@ -25,7 +25,7 @@ called variadic extractors, which enables variadic patterns. Fixed-arity extractors expose the following signature: -```Scala +```scala def unapply[A](x: T)(implicit x: B): U ``` @@ -36,7 +36,7 @@ The type `U` conforms to one of the following matches: Or `U` conforms to the type `R`: -```Scala +```scala type R = { def isEmpty: Boolean def get: S @@ -62,7 +62,7 @@ A usage of a fixed-arity extractor is irrefutable if one of the following condit Variadic extractors expose the following signature: -```Scala +```scala def unapplySeq[A](x: T)(implicit x: B): U ``` @@ -73,7 +73,7 @@ The type `U` conforms to one of the following matches: Or `U` conforms to the type `R`: -```Scala +```scala type R = { def isEmpty: Boolean def get: S @@ -167,7 +167,7 @@ object Nat: - `N > 1` is the maximum number of consecutive (parameterless `def` or `val`) `_1: P1 ... _N: PN` members in `U` - Pattern-matching on exactly `N` patterns with types `P1, P2, ..., PN` -```Scala +```scala object ProdEmpty: def _1: Int = ??? def _2: String = ??? @@ -184,7 +184,7 @@ object ProdEmpty: - `U <: X`, `T2` and `T3` conform to `T1` -```Scala +```scala type X = { def lengthCompare(len: Int): Int // or, `def length: Int` def apply(i: Int): T1 @@ -219,7 +219,7 @@ object CharList: - Pattern-matching on exactly `>= N` patterns, the first `N - 1` patterns have types `P1, P2, ... P(N-1)`, the type of the remaining patterns are determined as in Seq Pattern. -```Scala +```scala class Foo(val name: String, val children: Int*) object Foo: def unapplySeq(f: Foo): Option[(String, Seq[Int])] = diff --git a/docs/_docs/reference/experimental/explicit-nulls.md b/docs/_docs/reference/experimental/explicit-nulls.md index bb13151b91a7..b3fa53429cfe 100644 --- a/docs/_docs/reference/experimental/explicit-nulls.md +++ b/docs/_docs/reference/experimental/explicit-nulls.md @@ -480,7 +480,7 @@ The program in [`unsafeNulls`](https://scala-lang.org/api/3.x/scala/runtime/stdL For example, the following code cannot be compiled even using unsafe nulls. Because of the Java interoperation, the type of the get method becomes `T | Null`. -```Scala +```scala def head[T](xs: java.util.List[T]): T = xs.get(0) // error ```