@@ -1120,11 +1120,11 @@ object desugar {
1120
1120
*
1121
1121
* { cases }
1122
1122
* ==>
1123
- * x$1 => (x$1 @unchecked) match { cases }
1123
+ * x$1 => (x$1 @unchecked? ) match { cases }
1124
1124
*
1125
1125
* If `nparams` != 1, expand instead to
1126
1126
*
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 }
1128
1128
*/
1129
1129
def makeCaseLambda (cases : List [CaseDef ], nparams : Int = 1 , unchecked : Boolean = true )(implicit ctx : Context ): Function = {
1130
1130
val params = (1 to nparams).toList.map(makeSyntheticParameter(_))
@@ -1343,7 +1343,7 @@ object desugar {
1343
1343
}
1344
1344
1345
1345
def isIrrefutableGenFrom (gen : GenFrom ): Boolean =
1346
- gen.isInstanceOf [ IrrefutableGenFrom ] ||
1346
+ ! gen.filtering ||
1347
1347
IdPattern .unapply(gen.pat).isDefined ||
1348
1348
isIrrefutable(gen.pat, gen.expr)
1349
1349
@@ -1370,11 +1370,11 @@ object desugar {
1370
1370
val pdefs = (valeqs, defpats, rhss).zipped.map(makePatDef(_, Modifiers (), _, _))
1371
1371
val rhs1 = makeFor(nme.map, nme.flatMap, GenFrom (defpat0, rhs, gen.filtering) :: Nil , Block (pdefs, makeTuple(id0 :: ids)))
1372
1372
val allpats = pat :: pats
1373
- val vfrom1 = new IrrefutableGenFrom (makeTuple(allpats), rhs1)
1373
+ val vfrom1 = new GenFrom (makeTuple(allpats), rhs1, filtering = false )
1374
1374
makeFor(mapName, flatMapName, vfrom1 :: rest1, body)
1375
1375
case (gen : GenFrom ) :: test :: rest =>
1376
1376
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 )
1378
1378
makeFor(mapName, flatMapName, genFrom :: rest, body)
1379
1379
case _ =>
1380
1380
EmptyTree // may happen for erroneous input
@@ -1569,7 +1569,4 @@ object desugar {
1569
1569
collect(tree)
1570
1570
buf.toList
1571
1571
}
1572
-
1573
- private class IrrefutableGenFrom (pat : Tree , expr : Tree )(implicit @ constructorOnly src : SourceFile )
1574
- extends GenFrom (pat, expr, false )
1575
1572
}
0 commit comments