Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Rename experimental feature to subCases
Avoids the issue with match completion with suggests importing the feature.
  • Loading branch information
EugeneFlesselle committed Aug 15, 2025
commit 4da6103fe94961bf3792d169aa4e0a613454e92e
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/config/Feature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object Feature:
val modularity = experimental("modularity")
val quotedPatternsWithPolymorphicFunctions = experimental("quotedPatternsWithPolymorphicFunctions")
val packageObjectValues = experimental("packageObjectValues")
val matchWithSubCases = experimental("matchWithSubCases")
val subCases = experimental("subCases")

def experimentalAutoEnableFeatures(using Context): List[TermName] =
defn.languageExperimentalFeatures
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3108,7 +3108,7 @@ object Parsers {
(withinMatchPattern(pattern()), guard())
}
val body =
if in.token == WITH && in.featureEnabled(Feature.matchWithSubCases) then atSpan(in.skipToken()):
if in.token == WITH && in.featureEnabled(Feature.subCases) then atSpan(in.skipToken()):
subMatchClause(simpleExpr(Location.ElseWhere))
else atSpan(accept(ARROW)):
if exprOnly then
Expand Down
6 changes: 3 additions & 3 deletions library/src/scala/language.scala
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ object language {
@compileTimeOnly("`packageObjectValues` can only be used at compile time in import statements")
object packageObjectValues

/** Experimental support for match expressions with sub-cases.
/** Experimental support for match expressions with sub cases.
*/
@compileTimeOnly("`matchWithSubCases` can only be used at compile time in import statements")
object matchWithSubCases
@compileTimeOnly("`subCases` can only be used at compile time in import statements")
object subCases

}

Expand Down
6 changes: 3 additions & 3 deletions library/src/scala/runtime/stdLibPatches/language.scala
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ object language:
@compileTimeOnly("`packageObjectValues` can only be used at compile time in import statements")
object packageObjectValues

/** Experimental support for match expressions with sub-cases.
/** Experimental support for match expressions with sub cases.
*/
@compileTimeOnly("`matchWithSubCases` can only be used at compile time in import statements")
object matchWithSubCases
@compileTimeOnly("`subCases` can only be used at compile time in import statements")
object subCases
end experimental

/** The deprecated object contains features that are no longer officially suypported in Scala.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scala.language.experimental.matchWithSubCases
import scala.language.experimental.subCases

object Test:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scala.language.experimental.matchWithSubCases
import scala.language.experimental.subCases

object Test:
val x: Option[Option[Int]] = ???
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scala.language.experimental.matchWithSubCases
import scala.language.experimental.subCases

enum E extends Exception:
case A(x: Any)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scala.language.experimental.matchWithSubCases
import scala.language.experimental.subCases

enum E:
case A(e: E)
Expand Down
2 changes: 1 addition & 1 deletion tests/run/pf-sub-cases.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scala.language.experimental.matchWithSubCases
import scala.language.experimental.subCases

val pf: PartialFunction[Option[Option[Int]], String] =
case Some(x2) with x2 match
Expand Down
2 changes: 1 addition & 1 deletion tests/warn/sub-cases-exhaustivity.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scala.language.experimental.matchWithSubCases
import scala.language.experimental.subCases

enum E:
case A(e: E)
Expand Down
Loading