-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `@exerimental` annotation marks definitions as _experimental_ feature. These can be used in the same situattions where `languange.experimental` can be used.
- Loading branch information
1 parent
1f503e7
commit c23db64
Showing
20 changed files
with
239 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package dotty.tools.dotc | ||
package util | ||
|
||
import dotty.tools.dotc.ast.tpd | ||
import dotty.tools.dotc.ast.Trees._ | ||
import dotty.tools.dotc.config.Feature | ||
import dotty.tools.dotc.core.Contexts._ | ||
import dotty.tools.dotc.core.Symbols._ | ||
import dotty.tools.dotc.core.Types._ | ||
import dotty.tools.dotc.core.Flags._ | ||
import dotty.tools.dotc.transform.SymUtils._ | ||
|
||
object Experimental: | ||
import tpd._ | ||
|
||
def checkExperimental(tree: Tree)(using Context): Unit = | ||
if tree.symbol.isExperimental | ||
&& !tree.symbol.isConstructor // already reported on the class | ||
&& !tree.symbol.is(ModuleClass) // already reported on the module | ||
&& (tree.span.exists || tree.symbol != defn.ExperimentalAnnot) // already reported on inferred annotations | ||
then | ||
Feature.checkExperimentalDef(tree.symbol, tree) | ||
|
||
def checkExperimentalTypes(tree: Tree)(using Context): Unit = | ||
val checker = new TypeTraverser: | ||
def traverse(tp: Type): Unit = | ||
if tp.typeSymbol.isExperimental then | ||
Feature.checkExperimentalDef(tp.typeSymbol, tree) | ||
else | ||
traverseChildren(tp) | ||
if !tree.span.isSynthetic then // avoid double errors | ||
checker.traverse(tree.tpe) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package scala.annotation | ||
|
||
/** An annotation that can be used to mark a definition as experimental. | ||
* | ||
* This class is experimental as well as if it was defined as | ||
* ```scala | ||
* @experimental | ||
* class experimental extends StaticAnnotation | ||
* ``` | ||
* | ||
* @syntax markdown | ||
*/ | ||
// @experimental | ||
class experimental extends StaticAnnotation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.