From ffa6f9044145cfe600b4f5ccaffb62e3d8042a53 Mon Sep 17 00:00:00 2001 From: Batanick Date: Mon, 7 Oct 2019 23:31:10 +0200 Subject: [PATCH] Replacing empty+erased function check with assert --- compiler/src/dotty/tools/dotc/typer/Typer.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 66845e343f7f..7d566de2a591 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -862,10 +862,8 @@ class Typer extends Namer case tree: untpd.FunctionWithMods => tree.mods.flags case _ => EmptyFlags } - if (funFlags.is(Erased) && args.isEmpty) { - ctx.error("An empty function cannot not be erased", tree.sourcePos) - funFlags = funFlags &~ Erased - } + + assert(!funFlags.is(Erased) || !args.isEmpty, "An empty function cannot not be erased") val funCls = defn.FunctionClass(args.length, isContextual = funFlags.is(Given), isErased = funFlags.is(Erased))