From 0eb2d76c467a53786ae6147c9c983c23ab0894c8 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 16 Jul 2016 15:21:12 +0200 Subject: Proparage function result constrains when inferring parameter types If an application has functions with implicit parameter types we need to be more aggressive about propagating knowledge of the expected result type into the constraint. Fixes #1378. --- src/dotty/tools/dotc/typer/Typer.scala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 11a7b6753..13b6167b1 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -597,6 +597,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit untpd.TypeTree(defn.FunctionClass(args.length).typeRef), args :+ body), pt) else { val params = args.asInstanceOf[List[untpd.ValDef]] + + pt match { + case pt: TypeVar if untpd.isFunctionWithImplicitParamType(tree) => + isFullyDefined(pt, ForceDegree.noBottom) + case _ => + } + val (protoFormals, protoResult) = decomposeProtoFunction(pt, params.length) def refersTo(arg: untpd.Tree, param: untpd.ValDef): Boolean = arg match { -- cgit v1.2.3