diff options
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 32 | ||||
-rw-r--r-- | tests/pos/implicits1.scala | 2 |
2 files changed, 27 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 8e3bb9dbb..f81fcf3cd 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -458,16 +458,36 @@ trait Applications extends Compatibility { self: Typer => typedUnApply(tree, pt) else { - def realApply(implicit ctx: Context) = { + def realApply(implicit ctx: Context): Tree = { val proto = new FunProto(tree.args, pt, this) val fun1 = typedExpr(tree.fun, proto) methPart(fun1).tpe match { case funRef: TermRef => - val app = - if (proto.argsAreTyped) new ApplyToTyped(tree, fun1, funRef, proto.typedArgs, pt) - else new ApplyToUntyped(tree, fun1, funRef, tree.args, pt) - val result = app.result - ConstFold(result) orElse result + tryEither { implicit ctx => + val app = + if (proto.argsAreTyped) new ApplyToTyped(tree, fun1, funRef, proto.typedArgs, pt) + else new ApplyToUntyped(tree, fun1, funRef, tree.args, pt) + val result = app.result + ConstFold(result) orElse result + } { failed => fun1 match { + case Select(qual, name) => + tryEither { implicit ctx => + val qual1 = adapt(qual, new SelectionProto(name, proto)) + if (qual1.tpe.isError) qual1 + else { + assert(qual1 ne qual) + typedApply( + cpy.Apply(tree, + cpy.Select(fun1, untpd.TypedSplice(qual1), name), + proto.typedArgs map untpd.TypedSplice), + pt) + } + } { _ => failed.commit() + } + case _ => + failed.commit() + } + } case _ => fun1.qualifierType match { case ErrorType => diff --git a/tests/pos/implicits1.scala b/tests/pos/implicits1.scala index a4491b14f..2e918cd58 100644 --- a/tests/pos/implicits1.scala +++ b/tests/pos/implicits1.scala @@ -40,6 +40,6 @@ object Implicits { println(z.bar) - // val e: Int = z.foo(true) not yet + val e: Int = z.foo(true) } |