diff options
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index c9a22f09e..82c8c9d60 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -189,7 +189,8 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => /** Is this argument node of the form <expr> : _* ? */ - def isWildcardStarArg(tree: untpd.Tree)(implicit ctx: Context): Boolean = unsplice(tree) match { + def isWildcardStarArg(tree: Tree)(implicit ctx: Context): Boolean = unbind(tree) match { + case Typed(Ident(nme.WILDCARD_STAR), _) => true case Typed(_, Ident(tpnme.WILDCARD_STAR)) => true case Typed(_, tpt: TypeTree) => tpt.hasType && tpt.tpe.isRepeatedParam case _ => false 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)) |