Skip to content

Commit 9e1a53a

Browse files
committed
Update docs
1 parent 8445d3c commit 9e1a53a

File tree

20 files changed

+55
-54
lines changed

20 files changed

+55
-54
lines changed

docs/docs/contributing/workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type stealer:
4545
```bash
4646
$ sbt
4747
> repl
48-
scala> import dotty.tools.DottyTypeStealer._; import dotty.tools.dotc.core._; import Contexts._,Types._
48+
scala> import dotty.tools.DottyTypeStealer.*; import dotty.tools.dotc.core.*; import Contexts.*,Types.*
4949
```
5050

5151
Now, you can define types and access their representation. For example:

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ zero as errors.
5252
```scala
5353
package dividezero
5454

55-
import dotty.tools.dotc.ast.Trees._
55+
import dotty.tools.dotc.ast.Trees.*
5656
import dotty.tools.dotc.ast.tpd
5757
import dotty.tools.dotc.core.Constants.Constant
5858
import dotty.tools.dotc.core.Contexts.Context
59-
import dotty.tools.dotc.core.Decorators._
60-
import dotty.tools.dotc.core.StdNames._
61-
import dotty.tools.dotc.core.Symbols._
59+
import dotty.tools.dotc.core.Decorators.*
60+
import dotty.tools.dotc.core.StdNames.*
61+
import dotty.tools.dotc.core.Symbols.*
6262
import dotty.tools.dotc.plugins.{PluginPhase, StandardPlugin}
6363
import dotty.tools.dotc.transform.{Pickler, Staging}
6464

@@ -70,7 +70,7 @@ class DivideZero extends StandardPlugin:
7070
(new DivideZeroPhase) :: Nil
7171

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

7575
val phaseName = "divideZero"
7676

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ For instance, the `happyBirthDay` method above would generate additional code eq
6262

6363
```scala
6464
final class happyBirthday:
65-
import scala.util.{CommandLineParser => CLP}
65+
import scala.util.CommandLineParser => CLP
6666
<static> def main(args: Array[String]): Unit =
6767
try
6868
happyBirthday(

docs/docs/reference/contextual/conversions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ conversion from `Int` to `java.lang.Integer` can be defined as follows:
6363
given fromFuture : Conversion[Future[HttpResponse], CompletionArg] = Response(_)
6464
given fromStatusCode: Conversion[Future[StatusCode], CompletionArg] = Status(_)
6565
end CompletionArg
66-
import CompletionArg._
66+
import CompletionArg.*
6767

6868
def complete[T](arg: CompletionArg) = arg match
6969
case Error(s) => ...

docs/docs/reference/contextual/derivation-macro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ from the signature. The body of the `derived` method is shown below:
4141

4242
```scala
4343
given derived[T: Type](using Quotes): Expr[Eq[T]] =
44-
import quotes.reflect._
44+
import quotes.reflect.*
4545

4646
val ev: Expr[Mirror.Of[T]] = Expr.summon[Mirror.Of[T]].get
4747

@@ -135,8 +135,8 @@ enum Opt[+T]:
135135
The full code is shown below:
136136

137137
```scala
138-
import scala.deriving._
139-
import scala.quoted._
138+
import scala.deriving.*
139+
import scala.quoted.*
140140

141141

142142
trait Eq[T]:
@@ -165,7 +165,7 @@ object Eq:
165165
case '[EmptyTuple] => Nil
166166

167167
given derived[T: Type](using q: Quotes): Expr[Eq[T]] =
168-
import quotes.reflect._
168+
import quotes.reflect.*
169169

170170
val ev: Expr[Mirror.Of[T]] = Expr.summon[Mirror.Of[T]].get
171171

docs/docs/reference/contextual/derivation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def eqProduct[T](p: Mirror.ProductOf[T], elems: List[Eq[_]]): Eq[T] =
231231
Pulling this all together we have the following complete implementation,
232232

233233
```scala
234-
import scala.deriving._
234+
import scala.deriving.*
235235
import scala.compiletime.{erasedValue, summonInline}
236236

237237
inline def summonAll[T <: Tuple]: List[Eq[_]] =
@@ -280,7 +280,7 @@ enum Opt[+T] derives Eq:
280280
case Nn
281281

282282
@main def test =
283-
import Opt._
283+
import Opt.*
284284
val eqoi = summon[Eq[Opt[Int]]]
285285
assert(eqoi.eqv(Sm(23), Sm(23)))
286286
assert(!eqoi.eqv(Sm(23), Sm(13)))

docs/docs/reference/contextual/extension-methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ object IntOpsEx extends IntOps:
189189
else Some(i / x)
190190

191191
trait SafeDiv:
192-
import IntOpsEx._ // brings safeDiv and safeMod into scope
192+
import IntOpsEx.* // brings safeDiv and safeMod into scope
193193

194194
extension (i: Int) def divide(d: Int): Option[(Int, Int)] =
195195
// extension methods imported and thus in scope

docs/docs/reference/contextual/given-imports.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ object A:
1212
def f(using TC) = ???
1313

1414
object B:
15-
import A._
15+
import A.*
1616
import A.given
1717
...
1818
```
1919

20-
In the code above, the `import A._` clause in object `B` imports all members
20+
In the code above, the `import A.*` clause in object `B` imports all members
2121
of `A` _except_ the given instance `tc`. Conversely, the second import `import A.given` will import _only_ that given instance.
2222
The two import clauses can also be merged into one:
2323

2424
```scala
2525
object B:
26-
import A.{given, _}
26+
import A.{given, *}
2727
...
2828
```
2929

@@ -44,7 +44,7 @@ There are two main benefits arising from these rules:
4444
Since givens can be anonymous it is not always practical to import them by their name, and wildcard imports are typically used instead. By-type imports provide a more specific alternative to wildcard imports, which makes it clearer what is imported. Example:
4545

4646
```scala
47-
import A.{given TC}
47+
import A.given TC
4848
```
4949

5050
This imports any given in `A` that has a type which conforms to `TC`. Importing givens of several types `T1,...,Tn`
@@ -104,14 +104,13 @@ given instances once their user base has migrated.
104104

105105
```
106106
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
107-
ImportExpr ::= StableId ‘.’ ImportSpec
108-
ImportSpec ::= id
109-
| ‘_’
110-
| ‘given’
111-
| ‘{’ ImportSelectors) ‘}’
112-
ImportSelectors ::= id [‘=>’ id | ‘=>’ ‘_’] [‘,’ ImportSelectors]
113-
| WildCardSelector {‘,’ WildCardSelector}
114-
WildCardSelector ::= ‘_'
115-
| ‘given’ [InfixType]
116107
Export ::= ‘export’ ImportExpr {‘,’ ImportExpr}
108+
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec
109+
ImportSpec ::= NamedSelector
110+
| WildcardSelector
111+
| ‘{’ ImportSelectors) ‘}’
112+
NamedSelector ::= id [‘as’ (id | ‘_’)]
113+
WildCardSelector ::= ‘*' | ‘given’ [InfixType]
114+
ImportSelectors ::= NamedSelector [‘,’ ImportSelectors]
115+
| WildCardSelector {‘,’ WildCardSelector}
117116
```

docs/docs/reference/dropped-features/nonlocal-returns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Nonlocal returns are implemented by throwing and catching `scala.runtime.NonLoca
1010
A drop-in library replacement is provided in [`scala.util.control.NonLocalReturns`](http://dotty.epfl.ch/api/scala/util/control/NonLocalReturns$.html). Example:
1111

1212
```scala
13-
import scala.util.control.NonLocalReturns._
13+
import scala.util.control.NonLocalReturns.*
1414

1515
extension [T](xs: List[T])
1616
def has(elem: T): Boolean = returning {

docs/docs/reference/metaprogramming/erased-terms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ matches. `erasedValue` is implemented with `erased`, so the state machine above
157157
can be encoded as follows:
158158

159159
```scala
160-
import scala.compiletime._
160+
import scala.compiletime.*
161161

162162
sealed trait State
163163
final class On extends State

0 commit comments

Comments
 (0)