Skip to content

Commit 472b217

Browse files
Add NameBasedPattern
1 parent 7080cad commit 472b217

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ class Definitions {
494494
def DynamicClass(implicit ctx: Context) = DynamicType.symbol.asClass
495495
lazy val OptionType: TypeRef = ctx.requiredClassRef("scala.Option")
496496
def OptionClass(implicit ctx: Context) = OptionType.symbol.asClass
497+
lazy val NameBasedPatternType: TypeRef = ctx.requiredClassRef("scala.NameBasedPattern")
497498
lazy val ProductType: TypeRef = ctx.requiredClassRef("scala.Product")
498499
def ProductClass(implicit ctx: Context) = ProductType.symbol.asClass
499500
lazy val Product_canEqualR = ProductClass.requiredMethodRef(nme.canEqual_)

compiler/src/dotty/tools/dotc/core/StdNames.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ object StdNames {
184184
final val Function: N = "Function"
185185
final val ImplicitFunction: N = "ImplicitFunction"
186186
final val Mirror: N = "Mirror"
187+
final val NameBasedPattern: N = "NameBasedPattern"
187188
final val Nothing: N = "Nothing"
188189
final val Null: N = "Null"
189190
final val Object: N = "Object"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package scala
2+
3+
/** Class extending this trait are eligible for name based pattern matching. */
4+
trait NameBasedPattern

0 commit comments

Comments
 (0)