From ec972b74ada750b5565028053032204e7d31417d Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 11 Jul 2014 17:45:09 +0200 Subject: Fix problem with dynamicSignature. Pattern match needs to compare against list of names, not single name. Universal equality bites again... Also fix comment for ElimRepeated. --- src/dotty/tools/dotc/transform/ElimRepeated.scala | 5 +++-- src/dotty/tools/dotc/transform/TypeUtils.scala | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dotty/tools/dotc/transform/ElimRepeated.scala b/src/dotty/tools/dotc/transform/ElimRepeated.scala index be1040cac..713127ea0 100644 --- a/src/dotty/tools/dotc/transform/ElimRepeated.scala +++ b/src/dotty/tools/dotc/transform/ElimRepeated.scala @@ -17,8 +17,9 @@ import Names.Name import NameOps._ import TypeUtils._ -/** A transformer that provides a convenient way to create companion objects - */ +/** A transformer that removes repeated parameters (T*) from all types, replacing + * them with Seq types. + */ class ElimRepeated extends TreeTransform with InfoTransformer { thisTransformer => import ast.tpd._ diff --git a/src/dotty/tools/dotc/transform/TypeUtils.scala b/src/dotty/tools/dotc/transform/TypeUtils.scala index 851029888..d9671a190 100644 --- a/src/dotty/tools/dotc/transform/TypeUtils.scala +++ b/src/dotty/tools/dotc/transform/TypeUtils.scala @@ -79,13 +79,14 @@ class TypeUtils(val self: Type) extends AnyVal { */ def dynamicSignature(implicit ctx: Context): Signature = self match { case self: PolyType => self.resultType.dynamicSignature - case self @ MethodType(nme.SELF, _) => + case self @ MethodType(nme.SELF :: Nil, _) => val normalizedResultType = self.resultType match { case rtp: MethodType => rtp case rtp => ExprType(rtp) } normalizedResultType.signature - case _ => Signature.NotAMethod + case _ => + Signature.NotAMethod } /** The Seq type corresponding to this repeated parameter type */ -- cgit v1.2.3