aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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:
*