File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -280,7 +280,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
280280trait UntypedTreeInfo extends TreeInfo [Untyped ] { self : Trees .Instance [Untyped ] =>
281281 import TreeInfo ._
282282
283- def isFunctionWithImplicitParamType (tree : Tree ) = tree match {
283+ def isFunctionWithUnknownParamType (tree : Tree ) = tree match {
284284 case untpd.Function (args, _) =>
285285 args.exists {
286286 case ValDef (_, tpt, _) => tpt.isEmpty
Original file line number Diff line number Diff line change @@ -554,12 +554,11 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
554554 if (proto.isTupled) proto = proto.tupled
555555
556556 // If some of the application's arguments are function literals without explicitly declared
557- // parameter types, and the expected type is a value type, relate the
558- // normalized result type of the application with the expected type through `<:<`.
559- // This can add more constraints which help sharpen the inferred parameter
560- // types for the argument function literal(s).
561- // This tweak is needed to make i1348 compile.
562- if (tree.args.exists(untpd.isFunctionWithImplicitParamType(_)))
557+ // parameter types, relate the normalized result type of the application with the
558+ // expected type through `constrainResult`. This can add more constraints which
559+ // help sharpen the inferred parameter types for the argument function literal(s).
560+ // This tweak is needed to make i1378 compile.
561+ if (tree.args.exists(untpd.isFunctionWithUnknownParamType(_)))
563562 if (! constrainResult(fun1.tpe.widen, proto.derivedFunProto(resultType = pt)))
564563 typr.println(i " result failure for $tree with type ${fun1.tpe.widen}, expected = $pt" )
565564
Original file line number Diff line number Diff line change @@ -599,7 +599,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
599599 val params = args.asInstanceOf [List [untpd.ValDef ]]
600600
601601 pt match {
602- case pt : TypeVar if untpd.isFunctionWithImplicitParamType(tree) =>
602+ case pt : TypeVar if untpd.isFunctionWithUnknownParamType(tree) =>
603+ // try to instantiate `pt` if this is possible. If it does not
604+ // work the error will be reported later in `inferredParam`,
605+ // when we try to infer the parameter type.
603606 isFullyDefined(pt, ForceDegree .noBottom)
604607 case _ =>
605608 }
You can’t perform that action at this time.
0 commit comments