Skip to content

Commit e2e56eb

Browse files
committed
Simplify guardOK
No need to enter new bindings into a context, since all references are symbolic.
1 parent f1400ff commit e2e56eb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
902902
def reduceCase(cdef: CaseDef): MatchRedux = {
903903
val caseBindingsBuf = new mutable.ListBuffer[ValOrDefDef]()
904904
def guardOK(implicit ctx: Context) = cdef.guard.isEmpty || {
905-
val guardCtx = ctx.fresh.setNewScope
906-
caseBindingsBuf.foreach(binding => guardCtx.enter(binding.symbol))
907-
typer.typed(cdef.guard, defn.BooleanType)(guardCtx) match {
905+
typer.typed(cdef.guard, defn.BooleanType) match {
908906
case ConstantValue(true) => true
909907
case _ => false
910908
}

0 commit comments

Comments
 (0)