aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2015-06-19 14:10:53 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-06-19 16:48:50 +0200
commit7269b37ce4a5db902513ee96678823a6921a4593 (patch)
treeb63a5a36739d0aee9e8a9bd836dad499473abaa2 /src/dotty/tools/dotc/typer/Typer.scala
parent25304a028e6d1426b14ead4a469c362b8536d893 (diff)
downloaddotty-7269b37ce4a5db902513ee96678823a6921a4593.tar.gz
dotty-7269b37ce4a5db902513ee96678823a6921a4593.tar.bz2
dotty-7269b37ce4a5db902513ee96678823a6921a4593.zip
Make named repeated parameters discoverable during PatMat.
They used to be discoverable using repeatedType, but ElimRepeated eliminates it. Instead I'm using internal synthetic Typed nodes name, similar to how it's done for non-star Wildcards. This makes handling Wildcards and Wildacard_Star more symmetric in patmat.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 2bdd0d197..f8a33cc85 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -377,10 +377,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
tree.expr match {
case id: untpd.Ident if (ctx.mode is Mode.Pattern) && isVarPattern(id) =>
- if (id.name == nme.WILDCARD) regularTyped(isWildcard = true)
+ if (id.name == nme.WILDCARD || id.name == nme.WILDCARD_STAR) regularTyped(isWildcard = true)
else {
import untpd._
- typed(Bind(id.name, Typed(Ident(nme.WILDCARD), tree.tpt)).withPos(id.pos), pt)
+ val name = if (untpd.isWildcardStarArg(tree)) nme.WILDCARD_STAR else nme.WILDCARD
+ typed(Bind(id.name, Typed(Ident(name), tree.tpt)).withPos(id.pos), pt)
}
case _ =>
if (untpd.isWildcardStarArg(tree))