Skip to content

Commit f5af569

Browse files
Add NameBasedPattern
1 parent e33dc40 commit f5af569

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
@@ -507,6 +507,7 @@ class Definitions {
507507
def DynamicClass(implicit ctx: Context) = DynamicType.symbol.asClass
508508
lazy val OptionType: TypeRef = ctx.requiredClassRef("scala.Option")
509509
def OptionClass(implicit ctx: Context) = OptionType.symbol.asClass
510+
lazy val NameBasedPatternType: TypeRef = ctx.requiredClassRef("scala.NameBasedPattern")
510511
lazy val ProductType: TypeRef = ctx.requiredClassRef("scala.Product")
511512
def ProductClass(implicit ctx: Context) = ProductType.symbol.asClass
512513
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)