diff options
Diffstat (limited to 'src/dotty/tools/dotc/ast')
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 9 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index a04b7b2da..e52ff9d62 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -248,6 +248,15 @@ trait TreeInfo[T >: Untyped] { self: Trees.Instance[T] => /** Is this case guarded? */ def isGuardedCase(cdef: CaseDef) = cdef.guard ne EmptyTree + /** True iff definition if a val or def with no right-hand-side, or it + * is an abstract typoe declaration + */ + def lacksDefinition(mdef: MemberDef) = mdef match { + case mdef: ValOrDefDef => mdef.rhs.isEmpty && !mdef.name.isConstructorName + case mdef: TypeDef => mdef.rhs.isEmpty || mdef.rhs.isInstanceOf[TypeBoundsTree] + case _ => false + } + /** The underlying pattern ignoring any bindings */ def unbind(x: Tree): Tree = unsplice(x) match { case Bind(_, y) => unbind(y) diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index bf3b3633b..b66b4d017 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -293,7 +293,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { } // no checks necessary def ref(sym: Symbol)(implicit ctx: Context): tpd.NameTree = - ref(NamedType(sym.owner.thisType, sym.name).withDenot(sym)) + ref(NamedType(sym.owner.thisType, sym.name, sym.denot)) // ----- Converting to releated trees ----------------------------------------------- |