From 7c02b2b3c8b50725b4035658a369d015a2a3b64f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 4 Oct 2013 13:33:11 +0200 Subject: No eta-expansion, implicit parameters when Mode = Type --- src/dotty/tools/dotc/typer/Typer.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (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 e902864d6..8a4ee2d83 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1046,8 +1046,7 @@ class Typer extends Namer with Applications with Implicits { |follow this method with `_' if you want to treat it as a partially applied function""".stripMargin) case _ => if (tree.tpe <:< pt) tree - else if (ctx.mode is Mode.Pattern) tree // no subtype check for patterns - else if (ctx.mode is Mode.Type) err.typeMismatch(tree, pt) + else if (ctx.mode is Mode.Pattern) tree // no subtype check for pattern else adaptToSubType(wtp) } @@ -1092,7 +1091,11 @@ class Typer extends Namer with Applications with Implicits { case wtp => pt match { case pt: FunProto => adaptToArgs(wtp, pt) - case _ => adaptNoArgs(wtp) + case _ => + if (ctx.mode is Mode.Type) + if (tree.tpe <:< pt) tree + else err.typeMismatch(tree, pt) + else adaptNoArgs(wtp) } } } -- cgit v1.2.3