Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions compiler/src/dotty/tools/dotc/config/Feature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ object Feature:
val into = experimental("into")
val modularity = experimental("modularity")
val quotedPatternsWithPolymorphicFunctions = experimental("quotedPatternsWithPolymorphicFunctions")
val packageObjectValues = experimental("packageObjectValues")
val multiSpreads = experimental("multiSpreads")
val subCases = experimental("subCases")
val relaxedLambdaSyntax = experimental("relaxedLambdaSyntax")
Expand Down Expand Up @@ -69,7 +68,6 @@ object Feature:
(separationChecking, "Enable experimental separation checking (requires captureChecking)"),
(into, "Allow into modifier on parameter types"),
(modularity, "Enable experimental modularity features"),
(packageObjectValues, "Enable experimental package objects as values"),
(multiSpreads, "Enable experimental varargs with multi-spreads"),
(subCases, "Enable experimental match expressions with sub-cases"),
(relaxedLambdaSyntax, "Enable experimental relaxed lambda syntax"),
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
val sym = tree.tpe.termSymbol
if sym.isNoValue && !ctx.isJava then
if sym.is(Package)
&& Feature.enabled(Feature.packageObjectValues)
&& tree.tpe.member(nme.PACKAGE).hasAltWith(_.symbol.isPackageObject)
then
// The feature is in preview for 3.10
Feature.checkPreviewFeature("package object values", tree.srcPos)
typed(untpd.Select(untpd.TypedSplice(tree), nme.PACKAGE))
else
report.error(SymbolIsNotAValue(sym), tree.srcPos)
Expand Down
19 changes: 10 additions & 9 deletions library/src/scala/language.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ object language {
*
* @group experimental
*/
object experimental {
object experimental:

import languageFeature.experimental._

Expand Down Expand Up @@ -299,15 +299,15 @@ object language {
* @see [[https://dotty.epfl.ch/docs/reference/experimental/into-modifier]]
*/
@compileTimeOnly("`into` can only be used at compile time in import statements")
@deprecated("The into language import is no longer needed since the feature is now in preview", since = "3.8")
@deprecated("The `into` language import is no longer needed since the feature is now in preview", since = "3.8")
object into

/** Experimental support for named tuples.
*
* @see [[https://dotty.epfl.ch/docs/reference/experimental/named-tuples]]
*/
@compileTimeOnly("`namedTuples` can only be used at compile time in import statements")
@deprecated("The experimental.namedTuples language import is no longer needed since the feature is now standard", since = "3.7")
@deprecated("`experimental.namedTuples` is now standard, no language import is needed", since = "3.7")
object namedTuples

/** Experimental support for new features for better modularity, including
Expand All @@ -327,15 +327,15 @@ object language {
* @see [[http://dotty.epfl.ch/docs/reference/contextual/extension-methods]]
*/
@compileTimeOnly("`relaxedExtensionImports` can only be used at compile time in import statements")
@deprecated("The experimental.relaxedExtensionImports language import is no longer needed since the feature is now standard", since = "3.4")
@deprecated("`experimental.relaxedExtensionImports` is now standard, no language import is needed", since = "3.4")
object relaxedExtensionImports

/** Enhance match type extractors to follow aliases and singletons.
*
* @see [[https://github.com/scala/improvement-proposals/pull/84]]
*/
@compileTimeOnly("`betterMatchTypeExtractors` can only be used at compile time in import statements")
@deprecated("The experimental.betterMatchTypeExtractors language import is no longer needed since the feature is now standard. It now has no effect, including when setting an older source version.", since = "3.6")
@deprecated("`experimental.betterMatchTypeExtractors` is now standard, no language import is needed", since = "3.6")
object betterMatchTypeExtractors

/** Experimental support for quote pattern matching with polymorphic functions
Expand All @@ -350,12 +350,13 @@ object language {
* @see [[https://github.com/scala/improvement-proposals/pull/79]]
*/
@compileTimeOnly("`betterFors` can only be used at compile time in import statements")
@deprecated("The `experimental.betterFors` language import no longer has any effect, the feature is being stabilised and can be enabled using `-preview` flag", since = "3.7")
@deprecated("`experimental.betterFors` is now standard, no language import is needed", since = "3.7")
object betterFors

/** Experimental support for package object values
*/
@compileTimeOnly("`packageObjectValues` can only be used at compile time in import statements")
@deprecated("The `experimental.packageObjectValues` language import is no longer needed since the feature is now in preview", since = "3.10")
object packageObjectValues

/** Experimental support for multiple spread arguments.
Expand All @@ -368,13 +369,13 @@ object language {
@compileTimeOnly("`subCases` can only be used at compile time in import statements")
object subCases

/** Experimental support for single-line lambdas and case clause expressions after `:`
/** Experimental support for single-line lambdas and case clause expressions after `:`
*/
@compileTimeOnly("`relaxedLambdaSyntax` can only be used at compile time in import statements")
object relaxedLambdaSyntax
}
end experimental

/** The deprecated object contains features that are no longer officially suypported in Scala.
/** The deprecated object contains features that are no longer officially suypported in Scala.
* Features in this object are slated for removal. New code should not use them and
* old code should migrate away from them.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/pos/packageObjectValues.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -language:experimental.packageObjectValues
//> using options -preview

package object p { }

Expand Down
2 changes: 1 addition & 1 deletion tests/run/pkgobjvals.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import language.experimental.packageObjectValues
//> using options -preview

package a:
package object b:
Expand Down
Loading