Skip to content

Commit

Permalink
Remove unused method, fix comments.
Browse files Browse the repository at this point in the history
Addendum to change-isVolatile. Changes did not make it in
by accident before that branch was merged.
  • Loading branch information
odersky committed Feb 19, 2016
1 parent 8158279 commit cecaa4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
23 changes: 5 additions & 18 deletions src/dotty/tools/dotc/core/CheckRealizable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,6 @@ class CheckRealizable(implicit ctx: Context) {
*/
private def isLateInitialized(sym: Symbol) = sym.is(Lazy, butNot = Module)

/** Is this type a path with some part that is initialized on use?
*/
private def isLateInitialized(tp: Type): Boolean = tp.dealias match {
case tp: TermRef =>
isLateInitialized(tp.symbol) || isLateInitialized(tp.prefix)
case _: SingletonType | NoPrefix =>
false
case tp: TypeRef =>
true
case tp: TypeProxy =>
isLateInitialized(tp.underlying)
case tp: AndOrType =>
isLateInitialized(tp.tp1) || isLateInitialized(tp.tp2)
case _ =>
true
}

/** The realizability status of given type `tp`*/
def realizability(tp: Type): Realizability = tp.dealias match {
case tp: TermRef =>
Expand Down Expand Up @@ -121,13 +104,17 @@ class CheckRealizable(implicit ctx: Context) {
}
}

/** `Realizable` if `tp` all of `tp`'s non-struct fields have realizable types,
/** `Realizable` if all of `tp`'s non-struct fields have realizable types,
* a `HasProblemField` instance pointing to a bad field otherwise.
*/
private def memberRealizability(tp: Type) = {
def checkField(sofar: Realizability, fld: SingleDenotation): Realizability =
sofar andAlso {
if (checkedFields.contains(fld.symbol) || fld.symbol.is(Private | Mutable | Lazy))
// if field is private it cannot be part of a visible path
// if field is mutable it cannot be part of a path
// if field is lazy it does not need to be initialized when the owning object is
// so in all cases the field does not influence realizability of the enclosing object.
Realizable
else {
checkedFields += fld.symbol
Expand Down
5 changes: 4 additions & 1 deletion src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ object Checking {
def checkBounds(args: List[tpd.Tree], poly: PolyType)(implicit ctx: Context): Unit =
checkBounds(args, poly.paramBounds, _.substParams(poly, _))

/** Check all AppliedTypeTree nodes in this tree for legal bounds @@@ */
/** Traverse type tree, performing the following checks:
* 1. All arguments of applied type trees must conform to their bounds.
* 2. Prefixes of type selections and singleton types must be realizable.
*/
val typeChecker = new TreeTraverser {
def traverse(tree: Tree)(implicit ctx: Context) = {
tree match {
Expand Down

0 comments on commit cecaa4b

Please sign in to comment.