aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/ExplicitOuter.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2015-04-23 13:38:55 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-04-23 13:38:55 +0200
commitc01389d170bb0f1c8a925a25c145396007a75106 (patch)
tree40d0117154755585d1208ef28c67d11bffe6b238 /src/dotty/tools/dotc/transform/ExplicitOuter.scala
parente3449e9fdbb3801eb07680e4938bc4c3c77ec3a8 (diff)
downloaddotty-c01389d170bb0f1c8a925a25c145396007a75106.tar.gz
dotty-c01389d170bb0f1c8a925a25c145396007a75106.tar.bz2
dotty-c01389d170bb0f1c8a925a25c145396007a75106.zip
Fix #492. Traits that require an outer pointer are not SAMs.
Diffstat (limited to 'src/dotty/tools/dotc/transform/ExplicitOuter.scala')
-rw-r--r--src/dotty/tools/dotc/transform/ExplicitOuter.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/src/dotty/tools/dotc/transform/ExplicitOuter.scala
index 8baaa3a11..9fc164d3b 100644
--- a/src/dotty/tools/dotc/transform/ExplicitOuter.scala
+++ b/src/dotty/tools/dotc/transform/ExplicitOuter.scala
@@ -13,6 +13,7 @@ import core.Names._
import core.NameOps._
import ast.Trees._
import SymUtils._
+import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.core.Phases.Phase
import util.Attachment
import collection.mutable
@@ -102,6 +103,15 @@ class ExplicitOuter extends MiniPhaseTransform with InfoTransformer { thisTransf
}
else impl
}
+
+ override def transformClosure(tree: Closure)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = {
+ if (tree.tpt ne EmptyTree) {
+ val cls = tree.tpt.asInstanceOf[TypeTree].tpe.classSymbol
+ if (cls.exists && hasOuter(cls.asClass))
+ ctx.error("Not a single abstract method type, requires an outer pointer", tree.pos)
+ }
+ tree
+ }
}
object ExplicitOuter {