@@ -52,6 +52,8 @@ object CheckRealizable {
5252
5353 def boundsRealizability (tp : Type )(implicit ctx : Context ) =
5454 new CheckRealizable ().boundsRealizability(tp)
55+
56+ private val LateInitialized = Lazy | Erased ,
5557}
5658
5759/** Compute realizability status */
@@ -63,10 +65,10 @@ class CheckRealizable(implicit ctx: Context) {
6365 */
6466 private val checkedFields : mutable.Set [Symbol ] = mutable.LinkedHashSet [Symbol ]()
6567
66- /** Is symbol's definitition a lazy val?
68+ /** Is symbol's definitition a lazy or erased val?
6769 * (note we exclude modules here, because their realizability is ensured separately)
6870 */
69- private def isLateInitialized (sym : Symbol ) = sym.is(Lazy , butNot = Module )
71+ private def isLateInitialized (sym : Symbol ) = sym.is(LateInitialized , butNot = Module )
7072
7173 /** The realizability status of given type `tp`*/
7274 def realizability (tp : Type ): Realizability = tp.dealias match {
@@ -156,10 +158,10 @@ class CheckRealizable(implicit ctx: Context) {
156158 private def memberRealizability (tp : Type ) = {
157159 def checkField (sofar : Realizability , fld : SingleDenotation ): Realizability =
158160 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 ))
160162 // if field is private it cannot be part of a visible path
161163 // 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
163165 // so in all cases the field does not influence realizability of the enclosing object.
164166 Realizable
165167 else {
0 commit comments