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/other-new-features/export.md
+20-9Lines changed: 20 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,6 @@ An export clause has the same format as an import clause. Its general form is:
47
47
48
48
```scala
49
49
exportpath . { sel_1, ..., sel_n }
50
-
exportgivenpath . { sel_1, ..., sel_n }
51
50
```
52
51
53
52
It consists of a qualifier expression `path`, which must be a stable identifier, followed by
@@ -58,7 +57,8 @@ of one of the following forms:
58
57
- A _renaming selector_`x => y` creates aliases for all eligible members of `path` that are named `x`, but the alias is named `y` instead of `x`.
59
58
- An _omitting selector_`x => _` prevents `x` from being aliased by a subsequent
60
59
wildcard selector.
61
-
- A _wildcard selector_ creates aliases for all eligible members of `path` except for
60
+
- A _given selector_`given x` has an optional type bound `x`. It creates aliases for all eligible given instances that conform to either `x`, or `Any` if `x` is omitted, except for members that are named by a previous simple, renaming, or omitting selector.
61
+
- A _wildcard selector_`_` creates aliases for all eligible members of `path` except for given instances,
62
62
synthetic members generated by the compiler and those members that are named by a previous simple, renaming, or omitting selector.
63
63
64
64
A member is _eligible_ if all of the following holds:
@@ -68,8 +68,7 @@ A member is _eligible_ if all of the following holds:
68
68
a base class of the class containing the export clause.
69
69
- it is accessible at the export clause,
70
70
- it is not a constructor, nor the (synthetic) class part of an object,
71
-
- it is a given instance (or an old-style `implicit` value)
72
-
if and only if the export is tagged with `given`.
71
+
- it is a given instance (declared with `given`) if and only if the export is from a _given selector_.
73
72
74
73
It is a compile-time error if a simple or renaming selector does not identify any eligible
75
74
members.
@@ -95,6 +94,8 @@ def f: c.T = ...
95
94
<aid="note_class"></a>
96
95
Export clauses can appear in classes or they can appear at the top-level. An export clause cannot appear as a statement in a block.
97
96
97
+
If an export clause contains a wildcard or given selector, it is forbidden for its qualifier path to refer to a package. This is because it is not yet known how to safely track wildcard dependencies to a package for the purposes of incremental compilation.
98
+
98
99
(\*) **Note:** Unless otherwise stated, the term "class" in this discussion also includes object and trait definitions.
0 commit comments