aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-02-08 14:35:53 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-19 16:57:35 +0100
commitfc043bfb2e1c8fd0a73b87a4c955e3e09f6bf8c0 (patch)
tree1f2813884bfcd8fff4e558f6a61aa40b750b613e /src/dotty/tools/dotc/core
parenteb1908a9f2c61895cabe70c0ac0ebbe8ef14fcea (diff)
downloaddotty-fc043bfb2e1c8fd0a73b87a4c955e3e09f6bf8c0.tar.gz
dotty-fc043bfb2e1c8fd0a73b87a4c955e3e09f6bf8c0.tar.bz2
dotty-fc043bfb2e1c8fd0a73b87a4c955e3e09f6bf8c0.zip
Add checking for leaking private definitions
First version. Fixes #997.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Flags.scala3
-rw-r--r--src/dotty/tools/dotc/core/Types.scala9
2 files changed, 12 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Flags.scala b/src/dotty/tools/dotc/core/Flags.scala
index 02b341649..d1f562f72 100644
--- a/src/dotty/tools/dotc/core/Flags.scala
+++ b/src/dotty/tools/dotc/core/Flags.scala
@@ -543,6 +543,9 @@ object Flags {
/** A lazy or deferred value */
final val LazyOrDeferred = Lazy | Deferred
+ /** A synthetic or private definition */
+ final val SyntheticOrPrivate = Synthetic | Private
+
/** A type parameter or type parameter accessor */
final val TypeParamOrAccessor = TypeParam | TypeParamAccessor
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 8595da640..16287c827 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1014,6 +1014,12 @@ object Types {
case _ => List()
}
+ /** The full parent types, including all type arguments */
+ def parentsWithArgs(implicit ctx: Context): List[Type] = this match {
+ case tp: TypeProxy => tp.underlying.parents
+ case _ => List()
+ }
+
/** The first parent of this type, AnyRef if list of parents is empty */
def firstParent(implicit ctx: Context): TypeRef = parents match {
case p :: _ => p
@@ -2780,6 +2786,9 @@ object Types {
parentsCache
}
+ override def parentsWithArgs(implicit ctx: Context): List[Type] =
+ parents.map(p => typeRef.baseTypeWithArgs(p.symbol))
+
/** The parent types with all type arguments */
def instantiatedParents(implicit ctx: Context): List[Type] =
parents mapConserve { pref =>