Skip to content

Commit cecaa4b

Browse files
committed
Remove unused method, fix comments.
Addendum to change-isVolatile. Changes did not make it in by accident before that branch was merged.
1 parent 8158279 commit cecaa4b

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

src/dotty/tools/dotc/core/CheckRealizable.scala

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,6 @@ class CheckRealizable(implicit ctx: Context) {
6363
*/
6464
private def isLateInitialized(sym: Symbol) = sym.is(Lazy, butNot = Module)
6565

66-
/** Is this type a path with some part that is initialized on use?
67-
*/
68-
private def isLateInitialized(tp: Type): Boolean = tp.dealias match {
69-
case tp: TermRef =>
70-
isLateInitialized(tp.symbol) || isLateInitialized(tp.prefix)
71-
case _: SingletonType | NoPrefix =>
72-
false
73-
case tp: TypeRef =>
74-
true
75-
case tp: TypeProxy =>
76-
isLateInitialized(tp.underlying)
77-
case tp: AndOrType =>
78-
isLateInitialized(tp.tp1) || isLateInitialized(tp.tp2)
79-
case _ =>
80-
true
81-
}
82-
8366
/** The realizability status of given type `tp`*/
8467
def realizability(tp: Type): Realizability = tp.dealias match {
8568
case tp: TermRef =>
@@ -121,13 +104,17 @@ class CheckRealizable(implicit ctx: Context) {
121104
}
122105
}
123106

124-
/** `Realizable` if `tp` all of `tp`'s non-struct fields have realizable types,
107+
/** `Realizable` if all of `tp`'s non-struct fields have realizable types,
125108
* a `HasProblemField` instance pointing to a bad field otherwise.
126109
*/
127110
private def memberRealizability(tp: Type) = {
128111
def checkField(sofar: Realizability, fld: SingleDenotation): Realizability =
129112
sofar andAlso {
130113
if (checkedFields.contains(fld.symbol) || fld.symbol.is(Private | Mutable | Lazy))
114+
// if field is private it cannot be part of a visible path
115+
// if field is mutable it cannot be part of a path
116+
// if field is lazy it does not need to be initialized when the owning object is
117+
// so in all cases the field does not influence realizability of the enclosing object.
131118
Realizable
132119
else {
133120
checkedFields += fld.symbol

src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ object Checking {
4949
def checkBounds(args: List[tpd.Tree], poly: PolyType)(implicit ctx: Context): Unit =
5050
checkBounds(args, poly.paramBounds, _.substParams(poly, _))
5151

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

0 commit comments

Comments
 (0)