-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
-experimental
compiler flags (#18571)
When enabled, all top-level definitions are annotated as `@experimental`. This implies that all experimental language features and definitions can be used in this project. Note that this does not change the strong guarantees on stability of non-experimental code. The experimental features can only be used in a experimental scope (transitively). This flags does not affect the use of `ResearchPlugin`. Follow up of https://contributors.scala-lang.org/t/behaviour-of-experimental-in-scala-3/6309/27?u=nicolasstucki
- Loading branch information
Showing
12 changed files
with
90 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//> using options -Yno-experimental | ||
|
||
import scala.language.experimental.erasedDefinitions | ||
|
||
erased def erasedFun(erased x: Int): Int = x // error // error |
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,7 @@ | ||
//> using options -Yno-experimental | ||
|
||
import scala.language.experimental.namedTypeArguments // error | ||
|
||
def namedTypeArgumentsFun[T, U]: Int = | ||
namedTypeArgumentsFun[T = Int, U = Int] | ||
namedTypeArgumentsFun[U = Int, T = Int] |
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,18 @@ | ||
//> using options -Yno-experimental | ||
|
||
import scala.annotation.experimental | ||
|
||
class Foo: | ||
def foo: Int = experimentalDef // error | ||
|
||
class Bar: | ||
def bar: Int = experimentalDef // error | ||
object Bar: | ||
def bar: Int = experimentalDef // error | ||
|
||
object Baz: | ||
def bar: Int = experimentalDef // error | ||
|
||
def toplevelMethod: Int = experimentalDef // error | ||
|
||
@experimental def experimentalDef: Int = 1 |
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,10 @@ | ||
//> using options -experimental -Yno-experimental | ||
|
||
import scala.language.experimental.erasedDefinitions | ||
import scala.language.experimental.namedTypeArguments | ||
|
||
erased def erasedFun(erased x: Int): Int = x | ||
|
||
def namedTypeArgumentsFun[T, U]: Int = | ||
namedTypeArgumentsFun[T = Int, U = Int] | ||
namedTypeArgumentsFun[U = Int, T = Int] |
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,18 @@ | ||
//> using options -experimental -Yno-experimental | ||
|
||
import scala.annotation.experimental | ||
|
||
class Foo: | ||
def foo: Int = experimentalDef | ||
|
||
class Bar: | ||
def bar: Int = experimentalDef | ||
object Bar: | ||
def bar: Int = experimentalDef | ||
|
||
object Baz: | ||
def bar: Int = experimentalDef | ||
|
||
def toplevelMethod: Int = experimentalDef | ||
|
||
@experimental def experimentalDef: Int = 1 |