diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-19 17:27:20 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-19 17:27:20 +0200 |
commit | 5eeee54e1a1419edf40efb9f9928076a143e7cd7 (patch) | |
tree | 83fdf7b60cbbcc5f5eef4132723b73d21f5aa56e /src | |
parent | 5d6c1020e0dd24c10e2a5827f5b7a89bfa925e09 (diff) | |
download | dotty-5eeee54e1a1419edf40efb9f9928076a143e7cd7.tar.gz dotty-5eeee54e1a1419edf40efb9f9928076a143e7cd7.tar.bz2 dotty-5eeee54e1a1419edf40efb9f9928076a143e7cd7.zip |
Allow function prototypes to have wildcards.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 11a7b6753..df72f0095 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -582,7 +582,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit private def decomposeProtoFunction(pt: Type, defaultArity: Int)(implicit ctx: Context): (List[Type], Type) = pt match { case _ if defn.isFunctionType(pt) => - (pt.dealias.argInfos.init, pt.dealias.argInfos.last) + // if expected parameter type(s) are wildcards, approximate from below. + // if expected result type is a wildcard, approximate from above. + // this can type the greatest set of admissible closures. + (pt.dealias.argTypesLo.init, pt.dealias.argTypesHi.last) case SAMType(meth) => val mt @ MethodType(_, paramTypes) = meth.info (paramTypes, mt.resultType) |