Skip to content

Fix of #375 - adapt returned value in erasure #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that after erasure tree.from is not an EmptyTree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does that matter?

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))
}
Expand Down