diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-22 16:13:31 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-22 16:13:31 +0100 |
commit | 5bf4a7188afdf336186bd200d963828e2bcc27e0 (patch) | |
tree | 87b6fadd5c93078b1cd0ea6b5d373ffddd57e576 | |
parent | 8216688420003002449313c8a4f419b09282bf84 (diff) | |
download | dotty-5bf4a7188afdf336186bd200d963828e2bcc27e0.tar.gz dotty-5bf4a7188afdf336186bd200d963828e2bcc27e0.tar.bz2 dotty-5bf4a7188afdf336186bd200d963828e2bcc27e0.zip |
Make PolyProto a true prototype.
Otherwise type comparers will go wrong.
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 10 |
1 files changed, 9 insertions, 1 deletions
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: * |