diff options
author | Dmitry Petrashko <dark@d-d.me> | 2015-02-27 09:23:45 +0100 |
---|---|---|
committer | Dmitry Petrashko <dark@d-d.me> | 2015-02-27 09:23:45 +0100 |
commit | 4e9987740f206c2376957d08d626f7c1ed087688 (patch) | |
tree | a913748651dd1521a00adf96ccbadd34668cdc41 | |
parent | 45477e5ba963d1bd992bfab73de0d1cccea9fb82 (diff) | |
parent | aa1179a6c58849375527ee7ea4c79bc96f87551d (diff) | |
download | dotty-4e9987740f206c2376957d08d626f7c1ed087688.tar.gz dotty-4e9987740f206c2376957d08d626f7c1ed087688.tar.bz2 dotty-4e9987740f206c2376957d08d626f7c1ed087688.zip |
Merge pull request #382 from dotty-staging/fix/#375
Fix of #375 - adapt returned value in erasure
-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)) } |