-
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.
Allow experimental language imports in experimental scopes
Also allow top-level experimental language imports if all top-level definitions are experimental
- Loading branch information
1 parent
028c749
commit c92da2e
Showing
14 changed files
with
202 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Test7 { | ||
import scala.language.experimental | ||
import experimental.genericNumberLiterals // error: no aliases can be used to refer to a language import | ||
val x: BigInt = 13232202002020202020202 // error | ||
} |
46 changes: 46 additions & 0 deletions
46
tests/neg-custom-args/no-experimental/experimental-imports.scala
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,46 @@ | ||
import annotation.experimental | ||
|
||
@experimental | ||
object Object1: | ||
import language.experimental.fewerBraces | ||
import language.experimental.namedTypeArguments | ||
import language.experimental.genericNumberLiterals | ||
import language.experimental.erasedDefinitions | ||
erased def f = 1 | ||
|
||
object Object2: | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions | ||
erased def f = 1 | ||
|
||
@experimental | ||
object Class1: | ||
import language.experimental.fewerBraces | ||
import language.experimental.namedTypeArguments | ||
import language.experimental.genericNumberLiterals | ||
import language.experimental.erasedDefinitions | ||
erased def f = 1 | ||
|
||
object Class2: | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions | ||
erased def f = 1 | ||
|
||
@experimental | ||
def fun1 = | ||
import language.experimental.fewerBraces | ||
import language.experimental.namedTypeArguments | ||
import language.experimental.genericNumberLiterals | ||
import language.experimental.erasedDefinitions | ||
erased def f = 1 | ||
|
||
def fun2 = | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions | ||
erased def f = 1 |
33 changes: 33 additions & 0 deletions
33
tests/neg-custom-args/no-experimental/experimental-nested-imports-2.scala
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,33 @@ | ||
import annotation.experimental | ||
|
||
class Class1: | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
@experimental def f = 1 | ||
def g = 1 | ||
|
||
object Object1: | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
@experimental def f = 1 | ||
def g = 1 | ||
|
||
def fun1 = | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
@experimental def f = 1 | ||
def g = 1 | ||
|
||
val value1 = | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
@experimental def f = 1 | ||
def g = 1 |
25 changes: 25 additions & 0 deletions
25
tests/neg-custom-args/no-experimental/experimental-nested-imports-3.scala
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,25 @@ | ||
import annotation.experimental | ||
|
||
class Class1: | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
|
||
object Object1: | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
|
||
def fun1 = | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
|
||
val value1 = | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition |
29 changes: 29 additions & 0 deletions
29
tests/neg-custom-args/no-experimental/experimental-nested-imports.scala
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,29 @@ | ||
import annotation.experimental | ||
|
||
class Class1: | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
@experimental def f = 1 | ||
|
||
object Object1: | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
@experimental def f = 1 | ||
|
||
def fun1 = | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
@experimental def f = 1 | ||
|
||
val value1 = | ||
import language.experimental.fewerBraces // error | ||
import language.experimental.namedTypeArguments // error | ||
import language.experimental.genericNumberLiterals // error | ||
import language.experimental.erasedDefinitions // ok: only check at erased definition | ||
@experimental def f = 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
5 changes: 5 additions & 0 deletions
5
tests/pos-custom-args/no-experimental/experimental-imports-empty.scala
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 @@ | ||
import annotation.experimental | ||
import language.experimental.fewerBraces | ||
import language.experimental.namedTypeArguments | ||
import language.experimental.genericNumberLiterals | ||
import language.experimental.erasedDefinitions |
5 changes: 5 additions & 0 deletions
5
tests/pos-custom-args/no-experimental/experimental-imports-top.scala
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 @@ | ||
import language.experimental.erasedDefinitions | ||
import annotation.experimental | ||
|
||
@experimental | ||
erased def f = 1 |