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/core/Types.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/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index e290e8868..595732b37 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2066,14 +2066,16 @@ object Types { def apply(paramTypes: List[Type], resultType: Type)(implicit ctx: Context): MethodType = apply(nme.syntheticParamNames(paramTypes.length), paramTypes, resultType) def fromSymbols(params: List[Symbol], resultType: Type)(implicit ctx: Context) = { - def paramInfo(param: Symbol): Type = param.info match { + def translateRepeated(tp: Type): Type = tp match { + case tp @ ExprType(tp1) => tp.derivedExprType(translateRepeated(tp1)) case AnnotatedType(annot, tp) if annot matches defn.RepeatedAnnot => - val typeSym = param.info.typeSymbol.asClass + val typeSym = tp.typeSymbol.asClass assert(typeSym == defn.SeqClass || typeSym == defn.ArrayClass) tp.translateParameterized(typeSym, defn.RepeatedParamClass) case tp => tp } + def paramInfo(param: Symbol): Type = translateRepeated(param.info) def transformResult(mt: MethodType) = resultType.subst(params, (0 until params.length).toList map (MethodParam(mt, _))) apply(params map (_.name.asTermName), params map paramInfo)(transformResult _) |