diff options
author | Martin Odersky <odersky@gmail.com> | 2015-04-24 18:04:09 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-04-24 18:04:09 +0200 |
commit | 6a3aab8241cc5379bcffb7644bdbaa04ba12ce5b (patch) | |
tree | 80d4fa10baf4b1530963b2366fa4c420e68adeb4 /src/dotty/tools/dotc/typer/Applications.scala | |
parent | 1e9c012a0c61b2031ecaf11de3f2e99a5fdff7af (diff) | |
download | dotty-6a3aab8241cc5379bcffb7644bdbaa04ba12ce5b.tar.gz dotty-6a3aab8241cc5379bcffb7644bdbaa04ba12ce5b.tar.bz2 dotty-6a3aab8241cc5379bcffb7644bdbaa04ba12ce5b.zip |
Allow byname repated parameters
Implements #499
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index c5bd70c1e..dd30c45c0 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -330,7 +330,7 @@ trait Applications extends Compatibility { self: Typer => case arg :: Nil if isVarArg(arg) => addTyped(arg, formal) case _ => - val elemFormal = formal.argTypesLo.head + val elemFormal = formal.widenExpr.argTypesLo.head args foreach (addTyped(_, elemFormal)) makeVarArg(args.length, elemFormal) } @@ -842,7 +842,10 @@ trait Applications extends Compatibility { self: Typer => val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags, tp1.instantiateBounds) isAsSpecific(alt1, tp1.instantiate(tparams map (_.typeRef)), alt2, tp2) case tp1: MethodType => - def repeatedToSingle(tp: Type) = if (tp.isRepeatedParam) tp.argTypesHi.head else tp + def repeatedToSingle(tp: Type): Type = tp match { + case tp @ ExprType(tp1) => tp.derivedExprType(repeatedToSingle(tp1)) + case _ => if (tp.isRepeatedParam) tp.argTypesHi.head else tp + } isApplicable(alt2, tp1.paramTypes map repeatedToSingle, WildcardType) || tp1.paramTypes.isEmpty && tp2.isInstanceOf[MethodOrPoly] case _ => |