Skip to content

Commit e7bf561

Browse files
Merge pull request #7385 from Batanick/erased_function_assert
Replacing empty+erased function check with assert
2 parents 514334e + b1d7725 commit e7bf561

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,10 +862,8 @@ class Typer extends Namer
862862
case tree: untpd.FunctionWithMods => tree.mods.flags
863863
case _ => EmptyFlags
864864
}
865-
if (funFlags.is(Erased) && args.isEmpty) {
866-
ctx.error("An empty function cannot not be erased", tree.sourcePos)
867-
funFlags = funFlags &~ Erased
868-
}
865+
866+
assert(!funFlags.is(Erased) || !args.isEmpty, "An empty function cannot not be erased")
869867

870868
val funCls = defn.FunctionClass(args.length,
871869
isContextual = funFlags.is(Given), isErased = funFlags.is(Erased))

0 commit comments

Comments
 (0)