Skip to content

Commit a6fd020

Browse files
committed
Follow the standard way of labelling a page to be Scala 3 only
1 parent 9cfb9e7 commit a6fd020

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

_overviews/scala3-book/ca-given-imports.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@ languages: [zh-cn]
66
num: 62
77
previous-page: ca-context-bounds
88
next-page: ca-type-classes
9+
scala3: true
10+
versionSpecific: true
911
---
10-
<span class="tag tag-inline">Scala 3 only</span>
1112

1213

1314
To make it more clear where givens in the current scope are coming from, a special form of the `import` statement is used to import `given` instances.
1415
The basic form is shown in this example:
1516

16-
{% tabs given-imports-basic-form %}
17-
18-
{% tab 'Scala 3 Only' %}
19-
2017
```scala
2118
object A:
2219
class TC
@@ -28,28 +25,15 @@ object B:
2825
import A.given // import the given instance
2926
```
3027

31-
{% endtab %}
32-
33-
{% endtabs %}
34-
3528
In this code the `import A.*` clause of object `B` imports all members of `A` *except* the `given` instance, `tc`.
3629
Conversely, the second import, `import A.given`, imports *only* that `given` instance.
3730
The two `import` clauses can also be merged into one:
3831

39-
{% tabs given-imports-merged %}
40-
41-
{% tab 'Scala 3 Only' %}
42-
4332
```scala
4433
object B:
4534
import A.{given, *}
4635
```
4736

48-
{% endtab %}
49-
50-
{% endtabs %}
51-
52-
5337
## Discussion
5438

5539
The wildcard selector `*` brings all definitions other than givens or extensions into scope, whereas a `given` selector brings all *givens*---including those resulting from extensions---into scope.

0 commit comments

Comments
 (0)