aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-04 11:03:51 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-04 11:03:51 +0100
commitc6e2ca6845352a0cdb82f8cd3b9baec2154b4f61 (patch)
tree2abaa2b9a7abf9ee582cb3a1f09eadb5110781f3 /src/dotty/tools/dotc/typer/Typer.scala
parenteeab526ef293abdb15d1776e470aca59c4697cfd (diff)
downloaddotty-c6e2ca6845352a0cdb82f8cd3b9baec2154b4f61.tar.gz
dotty-c6e2ca6845352a0cdb82f8cd3b9baec2154b4f61.tar.bz2
dotty-c6e2ca6845352a0cdb82f8cd3b9baec2154b4f61.zip
Make anonymous methods non-dependent where possible so that they can be used in closures.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 4352a17d6..f3e61ee1a 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -487,7 +487,7 @@ class Typer extends Namer with Applications with Implicits {
val exprCtx = index(tree.stats)
val stats1 = typedStats(tree.stats, ctx.owner)
val expr1 = typedExpr(tree.expr, pt)(exprCtx)
- val result = cpy.Block(tree, stats1, expr1).withType(blockType(stats1, expr1.tpe))
+ val result = cpy.Block(tree, stats1, expr1).withType(avoid(expr1.tpe, localSyms(stats1)))
val leaks = CheckTrees.escapingRefs(result)
if (leaks.isEmpty) result
else if (isFullyDefined(pt, ForceDegree.all)) {
@@ -606,7 +606,7 @@ class Typer extends Namer with Applications with Implicits {
(pt, TypeTree(pt))
case _ =>
if (!mt.isDependent) (mt.toFunctionType, EmptyTree)
- else throw new Error(s"internal error: cannot turn dependent method type $mt into closure, position = ${tree.pos}") // !!! DEBUG. Eventually, convert to an error?
+ else throw new Error(i"internal error: cannot turn dependent method type $mt into closure, position = ${tree.pos}, raw type = ${mt.toString}") // !!! DEBUG. Eventually, convert to an error?
}
case tp =>
throw new Error(i"internal error: closing over non-method $tp, pos = ${tree.pos}")