diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-27 14:07:08 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-11 06:38:11 +0200 |
commit | 167581469779cabc7138427d506a16507369cbf5 (patch) | |
tree | 01d79f1bcc25421a12b2f839d4593d70a793a085 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | f50c3f0d1c80a9d9d98d24ed3e7d8577c5eb80a5 (diff) | |
download | dotty-167581469779cabc7138427d506a16507369cbf5.tar.gz dotty-167581469779cabc7138427d506a16507369cbf5.tar.bz2 dotty-167581469779cabc7138427d506a16507369cbf5.zip |
Fix #167
Can handle now vararg arguments in patterns.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 7b8fe3727..9066012f0 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -333,7 +333,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedTyped(tree: untpd.Typed, pt: Type)(implicit ctx: Context): Tree = track("typedTyped") { def regularTyped(isWildcard: Boolean) = { - val tpt1 = typedType(tree.tpt) + val tpt1 = + if (untpd.isWildcardStarArg(tree)) + TypeTree(defn.SeqClass.typeRef.appliedTo(pt :: Nil)) + else + typedType(tree.tpt) val expr1 = if (isWildcard) tree.expr withType tpt1.tpe else typed(tree.expr, tpt1.tpe) @@ -344,7 +348,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (id.name == nme.WILDCARD) regularTyped(isWildcard = true) else { import untpd._ - typed(Bind(id.name, Typed(Ident(nme.WILDCARD), tree.tpt)).withPos(id.pos)) + typed(Bind(id.name, Typed(Ident(nme.WILDCARD), tree.tpt)).withPos(id.pos), pt) } case _ => if (untpd.isWildcardStarArg(tree)) |