Skip to content

Commit 66c5076

Browse files
authored
Merge pull request #12407 from dotty-staging/change-indent-2
Change indentation to two spaces in docs
2 parents 2004dc2 + fdb11a7 commit 66c5076

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1391
-1392
lines changed

docs/docs/reference/changed-features/compiler-plugins.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,28 @@ import dotty.tools.dotc.plugins.{PluginPhase, StandardPlugin}
6363
import dotty.tools.dotc.transform.{Pickler, Staging}
6464

6565
class DivideZero extends StandardPlugin:
66-
val name: String = "divideZero"
67-
override val description: String = "divide zero check"
66+
val name: String = "divideZero"
67+
override val description: String = "divide zero check"
6868

69-
def init(options: List[String]): List[PluginPhase] =
70-
(new DivideZeroPhase) :: Nil
69+
def init(options: List[String]): List[PluginPhase] =
70+
(new DivideZeroPhase) :: Nil
7171

7272
class DivideZeroPhase extends PluginPhase:
73-
import tpd.*
73+
import tpd.*
7474

75-
val phaseName = "divideZero"
75+
val phaseName = "divideZero"
7676

77-
override val runsAfter = Set(Pickler.name)
78-
override val runsBefore = Set(Staging.name)
77+
override val runsAfter = Set(Pickler.name)
78+
override val runsBefore = Set(Staging.name)
7979

80-
override def transformApply(tree: Apply)(implicit ctx: Context): Tree =
81-
tree match
82-
case Apply(Select(rcvr, nme.DIV), List(Literal(Constant(0))))
83-
if rcvr.tpe <:< defn.IntType =>
84-
report.error("dividing by zero", tree.pos)
85-
case _ =>
86-
()
87-
tree
80+
override def transformApply(tree: Apply)(implicit ctx: Context): Tree =
81+
tree match
82+
case Apply(Select(rcvr, nme.DIV), List(Literal(Constant(0))))
83+
if rcvr.tpe <:< defn.IntType =>
84+
report.error("dividing by zero", tree.pos)
85+
case _ =>
86+
()
87+
tree
8888
end DivideZeroPhase
8989
```
9090

@@ -109,11 +109,11 @@ import dotty.tools.dotc.core.Phases.Phase
109109
import dotty.tools.dotc.plugins.ResearchPlugin
110110

111111
class DummyResearchPlugin extends ResearchPlugin:
112-
val name: String = "dummy"
113-
override val description: String = "dummy research plugin"
112+
val name: String = "dummy"
113+
override val description: String = "dummy research plugin"
114114

115-
def init(options: List[String], phases: List[List[Phase]])(implicit ctx: Context): List[List[Phase]] =
116-
phases
115+
def init(options: List[String], phases: List[List[Phase]])(implicit ctx: Context): List[List[Phase]] =
116+
phases
117117
end DummyResearchPlugin
118118
```
119119

docs/docs/reference/changed-features/implicit-conversions-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The standard library defines an abstract class `Conversion`:
1717
package scala
1818
@java.lang.FunctionalInterface
1919
abstract class Conversion[-T, +U] extends Function1[T, U]:
20-
def apply(x: T): U
20+
def apply(x: T): U
2121
```
2222

2323
Function literals are automatically converted to `Conversion` values.

docs/docs/reference/changed-features/implicit-conversions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ method that expects a `java.lang.Integer`
3434
```scala
3535
import scala.language.implicitConversions
3636
implicit def int2Integer(x: Int): java.lang.Integer =
37-
x.asInstanceOf[java.lang.Integer]
37+
x.asInstanceOf[java.lang.Integer]
3838
```
3939

4040
The second example shows how to use `Conversion` to define an
@@ -44,11 +44,11 @@ types:
4444
```scala
4545
import scala.language.implicitConversions
4646
implicit def ordT[T, S](
47-
implicit conv: Conversion[T, S],
48-
ordS: Ordering[S]
47+
implicit conv: Conversion[T, S],
48+
ordS: Ordering[S]
4949
): Ordering[T] =
50-
// `ordS` compares values of type `S`, but we can convert from `T` to `S`
51-
(x: T, y: T) => ordS.compare(x, y)
50+
// `ordS` compares values of type `S`, but we can convert from `T` to `S`
51+
(x: T, y: T) => ordS.compare(x, y)
5252

5353
class A(val x: Int) // The type for which we want an `Ordering`
5454

docs/docs/reference/changed-features/implicit-resolution.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ where the type may still be inferred:
1313
```scala
1414
class C {
1515

16-
val ctx: Context = ... // ok
16+
val ctx: Context = ... // ok
1717

18-
/*!*/ implicit val x = ... // error: type must be given explicitly
18+
/*!*/ implicit val x = ... // error: type must be given explicitly
1919

20-
/*!*/ implicit def y = ... // error: type must be given explicitly
20+
/*!*/ implicit def y = ... // error: type must be given explicitly
2121
}
2222
val y = {
23-
implicit val ctx = this.ctx // ok
24-
...
23+
implicit val ctx = this.ctx // ok
24+
...
2525
}
2626
```
2727
**2.** Nesting is now taken into account for selecting an implicit. Consider for instance the following scenario:
2828
```scala
2929
def f(implicit i: C) = {
30-
def g(implicit j: C) = {
31-
implicitly[C]
32-
}
30+
def g(implicit j: C) = {
31+
implicitly[C]
32+
}
3333
}
3434
```
3535
This will now resolve the `implicitly` call to `j`, because `j` is nested
@@ -45,8 +45,8 @@ no longer applies.
4545
given a: A = A()
4646

4747
object o:
48-
given b: B = B()
49-
type C
48+
given b: B = B()
49+
type C
5050
```
5151
Both `a` and `b` are visible as implicits at the point of the definition
5252
of `type C`. However, a reference to `p.o.C` outside of package `p` will

docs/docs/reference/changed-features/imports.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ If you want to import a member named `*` specifically, you can use backticks aro
1616

1717
```scala
1818
object A:
19-
def * = ...
20-
def min = ...
19+
def * = ...
20+
def min = ...
2121

2222
object B:
2323
import A.`*` // imports just `*`

docs/docs/reference/changed-features/main-functions.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ Example:
99

1010
```scala
1111
@main def happyBirthday(age: Int, name: String, others: String*) =
12-
val suffix =
13-
age % 100 match
14-
case 11 | 12 | 13 => "th"
15-
case _ =>
16-
age % 10 match
17-
case 1 => "st"
18-
case 2 => "nd"
19-
case 3 => "rd"
20-
case _ => "th"
21-
val bldr = new StringBuilder(s"Happy $age$suffix birthday, $name")
22-
for other <- others do bldr.append(" and ").append(other)
23-
bldr.toString
12+
val suffix =
13+
age % 100 match
14+
case 11 | 12 | 13 => "th"
15+
case _ =>
16+
age % 10 match
17+
case 1 => "st"
18+
case 2 => "nd"
19+
case 3 => "rd"
20+
case _ => "th"
21+
val bldr = new StringBuilder(s"Happy $age$suffix birthday, $name")
22+
for other <- others do bldr.append(" and ").append(other)
23+
bldr.toString
2424
```
2525

2626
This would generate a main program `happyBirthday` that could be called like this
@@ -62,15 +62,15 @@ For instance, the `happyBirthDay` method above would generate additional code eq
6262

6363
```scala
6464
final class happyBirthday:
65-
import scala.util.CommandLineParser as CLP
66-
<static> def main(args: Array[String]): Unit =
67-
try
68-
happyBirthday(
69-
CLP.parseArgument[Int](args, 0),
70-
CLP.parseArgument[String](args, 1),
71-
CLP.parseRemainingArguments[String](args, 2))
72-
catch
73-
case error: CLP.ParseError => CLP.showError(error)
65+
import scala.util.CommandLineParser as CLP
66+
<static> def main(args: Array[String]): Unit =
67+
try
68+
happyBirthday(
69+
CLP.parseArgument[Int](args, 0),
70+
CLP.parseArgument[String](args, 1),
71+
CLP.parseRemainingArguments[String](args, 2))
72+
catch
73+
case error: CLP.ParseError => CLP.showError(error)
7474
```
7575

7676
**Note**: The `<static>` modifier above expresses that the `main` method is generated
@@ -80,8 +80,8 @@ as a static method of class `happyBirthDay`. It is not available for user progra
8080

8181
```scala
8282
object happyBirthday extends App:
83-
// needs by-hand parsing of arguments vector
84-
...
83+
// needs by-hand parsing of arguments vector
84+
...
8585
```
8686

8787
The previous functionality of `App`, which relied on the "magic" [`DelayedInit`](../dropped-features/delayed-init.md) trait, is no longer available. [`App`](https://dotty.epfl.ch/api/scala/App.html) still exists in limited form for now, but it does not support command line arguments and will be deprecated in the future. If programs need to cross-build

docs/docs/reference/changed-features/match-syntax.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ The syntactical precedence of match expressions has been changed.
1010

1111
```scala
1212
xs match {
13-
case Nil => "empty"
14-
case _ => "nonempty"
13+
case Nil => "empty"
14+
case _ => "nonempty"
1515
} match {
16-
case "empty" => 0
17-
case "nonempty" => 1
16+
case "empty" => 0
17+
case "nonempty" => 1
1818
}
1919
```
2020

2121
(or, dropping the optional braces)
2222

2323
```scala
2424
xs match
25-
case Nil => "empty"
26-
case _ => "nonempty"
25+
case Nil => "empty"
26+
case _ => "nonempty"
2727
match
28-
case "empty" => 0
29-
case "nonempty" => 1
28+
case "empty" => 0
29+
case "nonempty" => 1
3030
```
3131

3232
2. `match` may follow a period:
3333

3434
```scala
3535
if xs.match
36-
case Nil => false
37-
case _ => true
36+
case Nil => false
37+
case _ => true
3838
then "nonempty"
3939
else "empty"
4040
```

0 commit comments

Comments
 (0)