From f8c9dc95929655a198066652cd12109329836198 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 27 Nov 2013 14:17:12 +0100 Subject: Changed Signatures Signatures have a different meaning before and after erasure. After erasure, the result type counts also whereas before it doesn't. The new definitions refelect this behavior. --- src/dotty/tools/dotc/core/Types.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/dotty/tools/dotc/core/Types.scala') diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 9c849bfdf..fb430f336 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -487,7 +487,7 @@ object Types { * poly types. */ def matches(that: Type)(implicit ctx: Context): Boolean = - if (Config.newMatch) this.signature == that.signature + if (Config.newMatch) this.signature matches that.signature else track("matches") { ctx.typeComparer.matchesType( this, that, alwaysMatchSimple = !ctx.phase.erasedTypes) @@ -798,7 +798,7 @@ object Types { * pattern is that method signatures use caching, so encapsulation * is improved using an OO scheme). */ - def signature(implicit ctx: Context): Signature = NotAMethod + def signature(implicit ctx: Context): Signature = Signature.NotAMethod /** Convert to text */ def toText(printer: Printer): Text = printer.toText(this) @@ -1406,11 +1406,11 @@ object Types { override def signature(implicit ctx: Context): Signature = { def computeSignature: Signature = { - val followSig = resultType match { + val followSig: Signature = resultType match { case rtp: MethodType => rtp.signature - case _ => Nil + case tp => Signature(tp) } - (paramTypes map Erasure.paramSignature) ++ followSig + paramTypes ++: followSig } if (ctx.runId != mySignatureRunId) { mySignature = computeSignature @@ -1499,7 +1499,7 @@ object Types { abstract case class ExprType(override val resultType: Type) extends CachedProxyType with TermType { override def underlying(implicit ctx: Context): Type = resultType - override def signature(implicit ctx: Context): Signature = Nil + override def signature(implicit ctx: Context): Signature = Signature(resultType) // todo: cache? def derivedExprType(resultType: Type)(implicit ctx: Context) = if (resultType eq this.resultType) this else ExprType(resultType) override def computeHash = doHash(resultType) -- cgit v1.2.3