From b6257dd6e3aa76da9465593c5d1b1a785ee5320a Mon Sep 17 00:00:00 2001 From: odersky Date: Tue, 15 Apr 2025 12:13:27 +0200 Subject: [PATCH] Add experimentalpackageObjectValues language setting By an ovsersight this was available only as a language import. Fixes #22830 --- compiler/src/dotty/tools/dotc/config/Feature.scala | 3 ++- tests/pos/packageObjectValues.scala | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/pos/packageObjectValues.scala diff --git a/compiler/src/dotty/tools/dotc/config/Feature.scala b/compiler/src/dotty/tools/dotc/config/Feature.scala index 6df190f3147e..a53346c8a44d 100644 --- a/compiler/src/dotty/tools/dotc/config/Feature.scala +++ b/compiler/src/dotty/tools/dotc/config/Feature.scala @@ -61,7 +61,8 @@ object Feature: (pureFunctions, "Enable pure functions for capture checking"), (captureChecking, "Enable experimental capture checking"), (into, "Allow into modifier on parameter types"), - (modularity, "Enable experimental modularity features") + (modularity, "Enable experimental modularity features"), + (packageObjectValues, "Enable experimental package objects as values"), ) // legacy language features from Scala 2 that are no longer supported. diff --git a/tests/pos/packageObjectValues.scala b/tests/pos/packageObjectValues.scala new file mode 100644 index 000000000000..7133c6a01471 --- /dev/null +++ b/tests/pos/packageObjectValues.scala @@ -0,0 +1,7 @@ +//> using options -language:experimental.packageObjectValues + +package object p { } + +object Test: + val x = p +