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
+22-15Lines changed: 22 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -70,8 +70,7 @@ A member is _eligible_ if all of the following holds:
70
70
- it is not a constructor, nor the (synthetic) class part of an object,
71
71
- it is a given instance (declared with `given`) if and only if the export is from a _given selector_.
72
72
73
-
It is a compile-time error if a simple or renaming selector does not identify any eligible
74
-
members.
73
+
It is a compile-time error if a simple or renaming selector does not identify any eligible members.
75
74
76
75
Type members are aliased by type definitions, and term members are aliased by method definitions. Export aliases copy the type and value parameters of the members they refer to.
77
76
Export aliases are always `final`. Aliases of given instances are again defined as givens (and aliases of old-style implicits are `implicit`). Aliases of inline methods or values are again defined `inline`. There are no other modifiers that can be given to an alias. This has the following consequences for overriding:
@@ -91,11 +90,21 @@ export O.c
91
90
deff: c.T= ...
92
91
```
93
92
94
-
<aid="note_class"></a>
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.
96
93
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.
94
+
**Restrictions:**
95
+
96
+
1. 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
+
1. 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
+
99
+
1. Simple renaming exports like
100
+
```scala
101
+
exportstatusasstat
102
+
```
103
+
are not supported yet. They would run afoul of the restriction that the
104
+
exported `a` cannot be already a member of the objectcontaining the export.
105
+
This restriction might be lifted in the future.
98
106
107
+
<aid="note_class"></a>
99
108
(\*) **Note:**Unless otherwise stated, the term "class" in this discussion also includes objectandtraitdefinitions.
100
109
101
110
##Motivation
@@ -116,17 +125,15 @@ TemplateStat ::= ...
116
125
| Export
117
126
TopStat ::= ...
118
127
| Export
119
-
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
120
-
ImportExpr ::= StableId ‘.’ ImportSpec
121
-
ImportSpec ::= id
122
-
| ‘_’
123
-
| ‘given’
124
-
| ‘{’ ImportSelectors) ‘}’
125
-
ImportSelectors ::= id [‘=>’ id | ‘=>’ ‘_’] [‘,’ ImportSelectors]
0 commit comments