You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/reference/contextual/given-imports.md
+12-13Lines changed: 12 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,18 +12,18 @@ object A:
12
12
deff(usingTC) =???
13
13
14
14
objectB:
15
-
importA._
15
+
importA.*
16
16
importA.given
17
17
...
18
18
```
19
19
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
21
21
of `A`_except_ the given instance `tc`. Conversely, the second import `import A.given` will import _only_ that given instance.
22
22
The two import clauses can also be merged into one:
23
23
24
24
```scala
25
25
objectB:
26
-
importA.{given, _}
26
+
importA.{given, *}
27
27
...
28
28
```
29
29
@@ -44,7 +44,7 @@ There are two main benefits arising from these rules:
44
44
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:
45
45
46
46
```scala
47
-
importA.{givenTC}
47
+
importA.givenTC
48
48
```
49
49
50
50
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.
104
104
105
105
```
106
106
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
107
-
ImportExpr ::= StableId ‘.’ ImportSpec
108
-
ImportSpec ::= id
109
-
| ‘_’
110
-
| ‘given’
111
-
| ‘{’ ImportSelectors) ‘}’
112
-
ImportSelectors ::= id [‘=>’ id | ‘=>’ ‘_’] [‘,’ ImportSelectors]
Copy file name to clipboardExpand all lines: docs/docs/reference/dropped-features/nonlocal-returns.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Nonlocal returns are implemented by throwing and catching `scala.runtime.NonLoca
10
10
A drop-in library replacement is provided in [`scala.util.control.NonLocalReturns`](http://dotty.epfl.ch/api/scala/util/control/NonLocalReturns$.html). Example:
0 commit comments