@@ -1120,11 +1120,11 @@ object desugar {
11201120 *
11211121 * { cases }
11221122 * ==>
1123- * x$1 => (x$1 @unchecked) match { cases }
1123+ * x$1 => (x$1 @unchecked? ) match { cases }
11241124 *
11251125 * If `nparams` != 1, expand instead to
11261126 *
1127- * (x$1, ..., x$n) => (x$0, ..., x${n-1} @unchecked) match { cases }
1127+ * (x$1, ..., x$n) => (x$0, ..., x${n-1} @unchecked? ) match { cases }
11281128 */
11291129 def makeCaseLambda (cases : List [CaseDef ], nparams : Int = 1 , unchecked : Boolean = true )(implicit ctx : Context ): Function = {
11301130 val params = (1 to nparams).toList.map(makeSyntheticParameter(_))
@@ -1343,7 +1343,7 @@ object desugar {
13431343 }
13441344
13451345 def isIrrefutableGenFrom (gen : GenFrom ): Boolean =
1346- gen.isInstanceOf [ IrrefutableGenFrom ] ||
1346+ ! gen.filtering ||
13471347 IdPattern .unapply(gen.pat).isDefined ||
13481348 isIrrefutable(gen.pat, gen.expr)
13491349
@@ -1370,11 +1370,11 @@ object desugar {
13701370 val pdefs = (valeqs, defpats, rhss).zipped.map(makePatDef(_, Modifiers (), _, _))
13711371 val rhs1 = makeFor(nme.map, nme.flatMap, GenFrom (defpat0, rhs, gen.filtering) :: Nil , Block (pdefs, makeTuple(id0 :: ids)))
13721372 val allpats = pat :: pats
1373- val vfrom1 = new IrrefutableGenFrom (makeTuple(allpats), rhs1)
1373+ val vfrom1 = new GenFrom (makeTuple(allpats), rhs1, filtering = false )
13741374 makeFor(mapName, flatMapName, vfrom1 :: rest1, body)
13751375 case (gen : GenFrom ) :: test :: rest =>
13761376 val filtered = Apply (rhsSelect(gen, nme.withFilter), makeLambda(gen.pat, test))
1377- val genFrom = new IrrefutableGenFrom (gen.pat, filtered)
1377+ val genFrom = new GenFrom (gen.pat, filtered, filtering = false )
13781378 makeFor(mapName, flatMapName, genFrom :: rest, body)
13791379 case _ =>
13801380 EmptyTree // may happen for erroneous input
@@ -1569,7 +1569,4 @@ object desugar {
15691569 collect(tree)
15701570 buf.toList
15711571 }
1572-
1573- private class IrrefutableGenFrom (pat : Tree , expr : Tree )(implicit @ constructorOnly src : SourceFile )
1574- extends GenFrom (pat, expr, false )
15751572}
0 commit comments