From a370eed7bebbc534e19de7dadefd72a70349854f Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Sat, 15 Apr 2017 19:29:44 +0200 Subject: Fix #2266: Do not replace constant type lazy vals with constant. --- compiler/src/dotty/tools/dotc/ast/TreeInfo.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/src/dotty') diff --git a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala index f3bce4000..cac0e4b91 100644 --- a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -427,7 +427,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => def constToLiteral(tree: Tree)(implicit ctx: Context): Tree = { val tree1 = ConstFold(tree) tree1.tpe.widenTermRefExpr match { - case ConstantType(value) if isIdempotentExpr(tree1) => Literal(value) + case ConstantType(value) if isIdempotentExpr(tree1) && !tree1.symbol.is(Lazy) => Literal(value) case _ => tree1 } } -- cgit v1.2.3