Skip to content

Commit 18065fd

Browse files
committed
Improve experimental language import documentation
1 parent 74f621f commit 18065fd

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: doc-page
3+
title: Experimental language features
4+
author: Nicolas Stucki
5+
---
6+
7+
### Experimental language features
8+
9+
All experimental language features can be found under the `scala.language.experimental` package.
10+
They are enabled by importing the feature or using the `-language` compiler flag.
11+
12+
* [`erasedDefinitions`](./erased-defs.md): Enable support for `erased` modifier.
13+
* `fewerBraces`: Enable support for using indentation for arguments.
14+
* [`genericNumberLiterals`](../changed-features/numeric-literals.md): Enable support for generic number literals.
15+
* [`namedTypeArguments`](../changed-features/named-typeargs.md): Enable support for named type arguments
16+
17+
### Experimental language imports
18+
19+
In general, experimental language features can be imported in an experimental scope (see [experimental definitions](../other-new-features/experimental-defs.md).
20+
They can be imported at the top-level if all top-level definitions are @experimental.

docs/docs/reference/other-new-features/experimental-defs.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ This annotation can be placed on term or type definitions.
1010

1111
### References to experimental definitions
1212

13-
- Experimental definitions can only be referenced in an experimental scope.
14-
- Experimental language features can be imported in an experimental scope.
15-
- Experimental language features can be imported at the top-level if all top-level definitions are @experimental.
16-
17-
Experimental scopes are defined as follows.
13+
Experimental definitions can only be referenced in an experimental scope. Experimental scopes are defined as follows.
1814

1915
(1) The RHS of an experimental `def`, `val`, `var`, `given` or `type` is an experimental scope.
2016

@@ -280,6 +276,7 @@ class A:
280276
class B extends A:
281277
- @experimental def f: Int = 2
282278
```
279+
283280
### Test frameworks
284281

285282
Tests can be defined as experimental. Tests frameworks can execute tests using reflection even if they are in an experimental class, object or method.

0 commit comments

Comments
 (0)