Skip to content

Commit b8f6c56

Browse files
committed
Fix check for synthesized lazy var/def
1 parent 862e9b3 commit b8f6c56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,8 @@ trait Checking {
564564
if (sym is Lazy) {
565565
def error(kind: String) = ctx.error("lazy keyword cannot be used on " + kind, tree.pos)
566566
tree match {
567-
case _: DefDef => error("def")
568-
case _: ValDef if sym.is(Mutable) => error("var")
567+
case _: DefDef if !sym.is(Accessor) => error("def")
568+
case _: ValDef if sym.is(Mutable) && !sym.is(Synthetic) => error("var")
569569
case _ =>
570570
}
571571
}

0 commit comments

Comments
 (0)