From 5d64e64b6718bc2658c461e0e388ee6b4711abb4 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 11 Jan 2022 14:49:46 +0100 Subject: [PATCH] Homogenize generation of erased definitions The erased value generated by a `try` is now a reference to `erasedValue` like other generated erased expressions. We also remove the `Lazy` as it is semantically meaningless in an erased definition. --- compiler/src/dotty/tools/dotc/typer/Typer.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 957a51532886..f70bf20a9ec6 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1765,8 +1765,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer untpd.ValDef( EvidenceParamName.fresh(), untpd.TypeTree(defn.CanThrowClass.typeRef.appliedTo(tp)), - untpd.ref(defn.Predef_undefined)) - .withFlags(Given | Final | Lazy | Erased) + untpd.ref(defn.Compiletime_erasedValue)) + .withFlags(Given | Final | Erased) .withSpan(expr.span) val caughtExceptions = if Feature.enabled(Feature.saferExceptions) then