From aa1179a6c58849375527ee7ea4c79bc96f87551d Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 26 Feb 2015 15:14:40 +0100 Subject: Fix of #375 - adapt returned value in erasure --- src/dotty/tools/dotc/typer/Typer.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 1e07cbf79..e25e73a2c 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -715,7 +715,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } val (from, proto) = if (tree.from.isEmpty) enclMethInfo(ctx) - else (tree.from.asInstanceOf[tpd.Tree], WildcardType) + else { + val from = tree.from.asInstanceOf[tpd.Tree] + val proto = + if (ctx.erasedTypes) from.symbol.info.finalResultType + else WildcardType // We cannot reliably detect the internal type view of polymorphic or dependent methods + // because we do not know the internal type params and method params. + // Hence no adaptation is possible, and we assume WildcardType as prototype. + (from, proto) + } val expr1 = typedExpr(tree.expr orElse untpd.unitLiteral.withPos(tree.pos), proto) assignType(cpy.Return(tree)(expr1, from)) } -- cgit v1.2.3