@@ -52,6 +52,8 @@ object CheckRealizable {
52
52
53
53
def boundsRealizability (tp : Type )(implicit ctx : Context ) =
54
54
new CheckRealizable ().boundsRealizability(tp)
55
+
56
+ private val LateInitialized = Lazy | Erased ,
55
57
}
56
58
57
59
/** Compute realizability status */
@@ -63,10 +65,10 @@ class CheckRealizable(implicit ctx: Context) {
63
65
*/
64
66
private val checkedFields : mutable.Set [Symbol ] = mutable.LinkedHashSet [Symbol ]()
65
67
66
- /** Is symbol's definitition a lazy val?
68
+ /** Is symbol's definitition a lazy or erased val?
67
69
* (note we exclude modules here, because their realizability is ensured separately)
68
70
*/
69
- private def isLateInitialized (sym : Symbol ) = sym.is(Lazy , butNot = Module )
71
+ private def isLateInitialized (sym : Symbol ) = sym.is(LateInitialized , butNot = Module )
70
72
71
73
/** The realizability status of given type `tp`*/
72
74
def realizability (tp : Type ): Realizability = tp.dealias match {
@@ -156,10 +158,10 @@ class CheckRealizable(implicit ctx: Context) {
156
158
private def memberRealizability (tp : Type ) = {
157
159
def checkField (sofar : Realizability , fld : SingleDenotation ): Realizability =
158
160
sofar andAlso {
159
- if (checkedFields.contains(fld.symbol) || fld.symbol.is(Private | Mutable | Lazy ))
161
+ if (checkedFields.contains(fld.symbol) || fld.symbol.is(Private | Mutable | Lazy | Erased ))
160
162
// if field is private it cannot be part of a visible path
161
163
// if field is mutable it cannot be part of a path
162
- // if field is lazy it does not need to be initialized when the owning object is
164
+ // if field is lazy or erased it does not need to be initialized when the owning object is
163
165
// so in all cases the field does not influence realizability of the enclosing object.
164
166
Realizable
165
167
else {
0 commit comments