@@ -63,23 +63,6 @@ class CheckRealizable(implicit ctx: Context) {
63
63
*/
64
64
private def isLateInitialized (sym : Symbol ) = sym.is(Lazy , butNot = Module )
65
65
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
-
83
66
/** The realizability status of given type `tp`*/
84
67
def realizability (tp : Type ): Realizability = tp.dealias match {
85
68
case tp : TermRef =>
@@ -121,13 +104,17 @@ class CheckRealizable(implicit ctx: Context) {
121
104
}
122
105
}
123
106
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,
125
108
* a `HasProblemField` instance pointing to a bad field otherwise.
126
109
*/
127
110
private def memberRealizability (tp : Type ) = {
128
111
def checkField (sofar : Realizability , fld : SingleDenotation ): Realizability =
129
112
sofar andAlso {
130
113
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.
131
118
Realizable
132
119
else {
133
120
checkedFields += fld.symbol
0 commit comments