diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-13 13:57:37 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-10-13 13:57:37 +0200 |
commit | ac583c50d6c26dcfc2eb7ad54f63f1de22f29ae7 (patch) | |
tree | 98dfedb5a323915fae5690967d7ba4750343f316 | |
parent | 8ae2853e5a72363bb56b9cc69643e96f2ca4c1a3 (diff) | |
download | dotty-ac583c50d6c26dcfc2eb7ad54f63f1de22f29ae7.tar.gz dotty-ac583c50d6c26dcfc2eb7ad54f63f1de22f29ae7.tar.bz2 dotty-ac583c50d6c26dcfc2eb7ad54f63f1de22f29ae7.zip |
Better diagnostic from LambdaLift
-rw-r--r-- | src/dotty/tools/dotc/transform/LambdaLift.scala | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/LambdaLift.scala b/src/dotty/tools/dotc/transform/LambdaLift.scala index 9b7595f54..a08df1c33 100644 --- a/src/dotty/tools/dotc/transform/LambdaLift.scala +++ b/src/dotty/tools/dotc/transform/LambdaLift.scala @@ -22,7 +22,8 @@ import collection.{ mutable, immutable } import collection.mutable.{ HashMap, HashSet, LinkedHashMap, LinkedHashSet, TreeSet } object LambdaLift { - val NJ = NameTransformer.NAME_JOIN_STRING + private val NJ = NameTransformer.NAME_JOIN_STRING + private class NoPath extends Exception } class LambdaLift extends MiniPhaseTransform with IdentityDenotTransformer { thisTransform => @@ -125,7 +126,8 @@ class LambdaLift extends MiniPhaseTransform with IdentityDenotTransformer { this * } * } */ - private def markFree(sym: Symbol, enclosure: Symbol)(implicit ctx: Context): Boolean = { + private def markFree(sym: Symbol, enclosure: Symbol)(implicit ctx: Context): Boolean = try { + if (!enclosure.exists) throw new NoPath println(i"mark free: ${sym.showLocated} with owner ${sym.maybeOwner} marked free in $enclosure") (enclosure == sym.enclosure) || { ctx.debuglog(i"$enclosure != ${sym.enclosure}") @@ -143,6 +145,11 @@ class LambdaLift extends MiniPhaseTransform with IdentityDenotTransformer { this } } } + catch { + case ex: NoPath => + println(i"error lambda lifting ${ctx.compilationUnit}: $sym is not visible from $enclosure") + throw ex + } private def markCalled(callee: Symbol, caller: Symbol)(implicit ctx: Context): Unit = { ctx.debuglog(i"mark called: $callee of ${callee.owner} is called by $caller") |