aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-22 16:13:31 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-22 16:13:31 +0100
commit5bf4a7188afdf336186bd200d963828e2bcc27e0 (patch)
tree87b6fadd5c93078b1cd0ea6b5d373ffddd57e576 /src/dotty
parent8216688420003002449313c8a4f419b09282bf84 (diff)
downloaddotty-5bf4a7188afdf336186bd200d963828e2bcc27e0.tar.gz
dotty-5bf4a7188afdf336186bd200d963828e2bcc27e0.tar.bz2
dotty-5bf4a7188afdf336186bd200d963828e2bcc27e0.zip
Make PolyProto a true prototype.
Otherwise type comparers will go wrong.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/typer/Inferencing.scala10
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:
*