From 5bf4a7188afdf336186bd200d963828e2bcc27e0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 22 Dec 2013 16:13:31 +0100 Subject: Make PolyProto a true prototype. Otherwise type comparers will go wrong. --- src/dotty/tools/dotc/typer/Inferencing.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/dotty') diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 124f43391..81e03f696 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -149,7 +149,15 @@ object Inferencing { * * [] [?_, ..., ?_nargs] resultType */ - case class PolyProto(nargs: Int, override val resultType: Type) extends UncachedGroundType + case class PolyProto(nargs: Int, override val resultType: Type) extends UncachedGroundType with ProtoType { + override def isMatchedBy(tp: Type)(implicit ctx: Context) = { + def isInstantiatable(tp: Type) = tp.widen match { + case PolyType(paramNames) => paramNames.length == nargs + case _ => false + } + isInstantiatable(tp) || tp.member(nme.apply).hasAltWith(d => isInstantiatable(d.info)) + } + } /** A prototype for expressions [] that are known to be functions: * -- cgit v1.2.3