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 | |
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')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/ExplicitOuter.scala | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index fe95219b8..e290e8868 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1788,12 +1788,12 @@ object Types { if (false) RefinedType(parent, refinedName, refinedInfo) else RefinedType(parent, refinedName, rt => refinedInfo.substSkolem(this, SkolemType(rt))) } - + /** Add this refinement to `parent`, provided If `refinedName` is a member of `parent`. */ def wrapIfMember(parent: Type)(implicit ctx: Context): Type = if (parent.member(refinedName).exists) derivedRefinedType(parent, refinedName, refinedInfo) else parent - + override def equals(that: Any) = that match { case that: RefinedType => this.parent == that.parent && @@ -2414,7 +2414,7 @@ object Types { selfTypeCache = { def fullRef = fullyAppliedRef(cls.typeRef, cls.typeParams) val given = givenSelfType - val raw = + val raw = if (!given.exists) fullRef else if (cls is Module) given else if (ctx.erasedTypes) fullRef @@ -2423,7 +2423,7 @@ object Types { } selfTypeCache } - + /** The explicitly given self type (self types of modules are assumed to be * explcitly given here). */ 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 { |