diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-23 13:38:55 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-23 13:38:55 +0200 |
commit | c01389d170bb0f1c8a925a25c145396007a75106 (patch) | |
tree | 40d0117154755585d1208ef28c67d11bffe6b238 /src/dotty/tools/dotc/transform/ExplicitOuter.scala | |
parent | e3449e9fdbb3801eb07680e4938bc4c3c77ec3a8 (diff) | |
download | dotty-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.scala | 10 |
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 { |