aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2015-02-27 09:23:45 +0100
committerDmitry Petrashko <dark@d-d.me>2015-02-27 09:23:45 +0100
commit4e9987740f206c2376957d08d626f7c1ed087688 (patch)
treea913748651dd1521a00adf96ccbadd34668cdc41 /src/dotty/tools
parent45477e5ba963d1bd992bfab73de0d1cccea9fb82 (diff)
parentaa1179a6c58849375527ee7ea4c79bc96f87551d (diff)
downloaddotty-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
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala10
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))
}