summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-29 18:00:57 -0700
committerPaul Phillips <paulp@improving.org>2013-01-30 03:50:33 -0800
commite156cd13a37048b6ea822fdc8caaee40bb6a70a4 (patch)
treec4d64f0119aa834c3b24d72a70c0786ee668db00 /src/reflect
parentf3f1e5060efe45eb01040f8332506c8c1dd26cfc (diff)
downloadscala-e156cd13a37048b6ea822fdc8caaee40bb6a70a4.tar.gz
scala-e156cd13a37048b6ea822fdc8caaee40bb6a70a4.tar.bz2
scala-e156cd13a37048b6ea822fdc8caaee40bb6a70a4.zip
SI-5859, inapplicable varargs.
[backport] And other polishing related to varargs handling.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 26708cff55..91a0df92b7 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -3848,12 +3848,16 @@ trait Types extends api.Types { self: SymbolTable =>
// This is the specified behavior.
protected def etaExpandKeepsStar = false
+ /** Turn any T* types into Seq[T] except when
+ * in method parameter position.
+ */
object dropRepeatedParamType extends TypeMap {
def apply(tp: Type): Type = tp match {
case MethodType(params, restpe) =>
- MethodType(params, apply(restpe))
- case PolyType(tparams, restpe) =>
- PolyType(tparams, apply(restpe))
+ // Not mapping over params
+ val restpe1 = apply(restpe)
+ if (restpe eq restpe1) tp
+ else MethodType(params, restpe1)
case TypeRef(_, RepeatedParamClass, arg :: Nil) =>
seqType(arg)
case _ =>
@@ -4668,6 +4672,8 @@ trait Types extends api.Types { self: SymbolTable =>
/** A map to implement the `substSym` method. */
class SubstSymMap(from: List[Symbol], to: List[Symbol]) extends SubstMap(from, to) {
+ def this(pairs: (Symbol, Symbol)*) = this(pairs.toList.map(_._1), pairs.toList.map(_._2))
+
protected def toType(fromtp: Type, sym: Symbol) = fromtp match {
case TypeRef(pre, _, args) => copyTypeRef(fromtp, pre, sym, args)
case SingleType(pre, _) => singleType(pre, sym)