Skip to content

Commit ee287ab

Browse files
committed
Consider by name parameters as lazily initialized
should be terated analogous to lazy vals for realizability checking.
1 parent 51856ba commit ee287ab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,17 @@ object SymDenotations {
526526
final def isRealizable(implicit ctx: Context) =
527527
is(Stable) || isType || {
528528
val isRealizable =
529-
!is(Lazy, butNot = Module) ||
529+
!isLateInitialized ||
530530
isEffectivelyFinal && ctx.realizability(info) == TypeOps.Realizable
531531
isRealizable && { setFlag(Stable); true }
532532
}
533533

534+
/** Field is initialized on use, not on definition;
535+
* we do not count modules as fields here.
536+
*/
537+
final def isLateInitialized(implicit ctx: Context) =
538+
is(Lazy, butNot = Module) || is(Param) && info.isInstanceOf[ExprType]
539+
534540
/** Is this a "real" method? A real method is a method which is:
535541
* - not an accessor
536542
* - not a label

0 commit comments

Comments
 (0)