diff options
author | Martin Odersky <odersky@gmail.com> | 2015-02-26 15:14:40 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-02-26 15:14:40 +0100 |
commit | aa1179a6c58849375527ee7ea4c79bc96f87551d (patch) | |
tree | a913748651dd1521a00adf96ccbadd34668cdc41 /src | |
parent | 45477e5ba963d1bd992bfab73de0d1cccea9fb82 (diff) | |
download | dotty-aa1179a6c58849375527ee7ea4c79bc96f87551d.tar.gz dotty-aa1179a6c58849375527ee7ea4c79bc96f87551d.tar.bz2 dotty-aa1179a6c58849375527ee7ea4c79bc96f87551d.zip |
Fix of #375 - adapt returned value in erasure
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 10 |
1 files changed, 9 insertions, 1 deletions
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)) } |