Skip to content

Commit 7bc0173

Browse files
committed
Add synthetic pattern var names
1 parent f700dda commit 7bc0173

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ object NameKinds {
320320
val PatMatStdBinderName: UniqueNameKind = new UniqueNameKind("x")
321321
val PatMatAltsName: UniqueNameKind = new UniqueNameKind("matchAlts")
322322
val PatMatResultName: UniqueNameKind = new UniqueNameKind("matchResult")
323-
val PatMatQuoteTypeEv: UniqueNameKind = new UniqueNameKind("tpev$")
323+
val PatMatVarName: UniqueNameKind = new UniqueNameKind("ev$")
324324

325325
val LocalOptInlineLocalObj: UniqueNameKind = new UniqueNameKind("ilo")
326326

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ object NameOps {
8989
&& (n != true_)
9090
&& (n != null_))
9191
}
92-
} || name.is(PatMatQuoteTypeEv)
92+
} || name.is(PatMatVarName)
9393

9494
def isOpAssignmentName: Boolean = name match {
9595
case raw.NE | raw.LE | raw.GE | EMPTY =>

compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import dotty.tools.dotc.core.Constants._
99
import dotty.tools.dotc.core.Contexts._
1010
import dotty.tools.dotc.core.Decorators._
1111
import dotty.tools.dotc.core.Flags._
12-
import dotty.tools.dotc.core.NameKinds.{UniqueName, PatMatQuoteTypeEv}
12+
import dotty.tools.dotc.core.NameKinds.{UniqueName, PatMatVarName}
1313
import dotty.tools.dotc.core.Names._
1414
import dotty.tools.dotc.core.StagingContext._
1515
import dotty.tools.dotc.core.StdNames._
@@ -158,7 +158,7 @@ trait QuotesAndSplices {
158158
if (ctx.mode.is(Mode.QuotedPattern)) spliceOwner(ctx.outer) else ctx.owner
159159
val (name, expr) = tree.expr match {
160160
case Ident(name) =>
161-
val nameOfSyntheticGiven = PatMatQuoteTypeEv.fresh()
161+
val nameOfSyntheticGiven = PatMatVarName.fresh()
162162
(name.toTypeName, untpd.cpy.Ident(tree.expr)(nameOfSyntheticGiven))
163163
case expr =>
164164
report.error("expected a name binding", expr.srcPos)
@@ -272,7 +272,7 @@ trait QuotesAndSplices {
272272
tree
273273
case tdef: TypeDef =>
274274
if tdef.symbol.hasAnnotation(defn.InternalQuotedPatterns_patternTypeAnnot) then
275-
transformTypeBindingTypeDef(PatMatQuoteTypeEv.fresh(), tdef, typePatBuf)
275+
transformTypeBindingTypeDef(PatMatVarName.fresh(), tdef, typePatBuf)
276276
else if tdef.symbol.isClass then
277277
val kind = if tdef.symbol.is(Module) then "objects" else "classes"
278278
report.error("Implementation restriction: cannot match " + kind, tree.srcPos)

0 commit comments

Comments
 (0)