diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-05-26 20:50:28 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-05-27 16:41:37 +0200 |
commit | 8f08b714424b3ada8a12156bdc3fd43e13ad09ee (patch) | |
tree | 2d874cd0d7f2775e8d6ce1a67b954d3601f5beac /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 87b779bc96e10adc6a05635393cecc9ecbb2b4ea (diff) | |
download | dotty-8f08b714424b3ada8a12156bdc3fd43e13ad09ee.tar.gz dotty-8f08b714424b3ada8a12156bdc3fd43e13ad09ee.tar.bz2 dotty-8f08b714424b3ada8a12156bdc3fd43e13ad09ee.zip |
Annotate repeated params with `case` flag to indicate that they are legal
One drawback with this approach is that the type seems to propagate.
I.e. if the return type of an expression is `repeated` then the
enclosing variable will get the `repeated` type instead of getting the
expected `Seq` type
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 88b6746d6..9f38ac0f0 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -427,7 +427,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } if (untpd.isWildcardStarArg(tree)) cases( - //ifPat = ascription(TypeTree(defn.SeqType.appliedTo(pt :: Nil)), isWildcard = true), ifPat = ascription(TypeTree(defn.RepeatedParamType.appliedTo(pt)), isWildcard = true), ifExpr = seqToRepeated(typedExpr(tree.expr, defn.SeqType)), wildName = nme.WILDCARD_STAR) @@ -976,7 +975,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit typed(untpd.Bind(tree.name, arg).withPos(tree.pos), arg.tpe) :: Nil) case _ => val flags = if (tree.isType) BindDefinedType else EmptyFlags - val sym = ctx.newSymbol(ctx.owner, tree.name, flags, body1.tpe, coord = tree.pos) + val sym = ctx.newSymbol(ctx.owner, tree.name, flags | Case, body1.tpe, coord = tree.pos) assignType(cpy.Bind(tree)(tree.name, body1), sym) } } |