@@ -1119,11 +1119,11 @@ object desugar {
1119
1119
*
1120
1120
* { cases }
1121
1121
* ==>
1122
- * x$1 => (x$1 @unchecked) match { cases }
1122
+ * x$1 => (x$1 @unchecked? ) match { cases }
1123
1123
*
1124
1124
* If `nparams` != 1, expand instead to
1125
1125
*
1126
- * (x$1, ..., x$n) => (x$0, ..., x${n-1} @unchecked) match { cases }
1126
+ * (x$1, ..., x$n) => (x$0, ..., x${n-1} @unchecked? ) match { cases }
1127
1127
*/
1128
1128
def makeCaseLambda (cases : List [CaseDef ], nparams : Int = 1 , unchecked : Boolean = true )(implicit ctx : Context ): Function = {
1129
1129
val params = (1 to nparams).toList.map(makeSyntheticParameter(_))
@@ -1341,7 +1341,7 @@ object desugar {
1341
1341
}
1342
1342
1343
1343
def isIrrefutableGenFrom (gen : GenFrom ): Boolean =
1344
- gen.isInstanceOf [ IrrefutableGenFrom ] ||
1344
+ ! gen.filtering ||
1345
1345
IdPattern .unapply(gen.pat).isDefined ||
1346
1346
isIrrefutable(gen.pat, gen.expr)
1347
1347
@@ -1368,11 +1368,11 @@ object desugar {
1368
1368
val pdefs = (valeqs, defpats, rhss).zipped.map(makePatDef(_, Modifiers (), _, _))
1369
1369
val rhs1 = makeFor(nme.map, nme.flatMap, GenFrom (defpat0, rhs, gen.filtering) :: Nil , Block (pdefs, makeTuple(id0 :: ids)))
1370
1370
val allpats = pat :: pats
1371
- val vfrom1 = new IrrefutableGenFrom (makeTuple(allpats), rhs1)
1371
+ val vfrom1 = new GenFrom (makeTuple(allpats), rhs1, filtering = false )
1372
1372
makeFor(mapName, flatMapName, vfrom1 :: rest1, body)
1373
1373
case (gen : GenFrom ) :: test :: rest =>
1374
1374
val filtered = Apply (rhsSelect(gen, nme.withFilter), makeLambda(gen.pat, test))
1375
- val genFrom = new IrrefutableGenFrom (gen.pat, filtered)
1375
+ val genFrom = new GenFrom (gen.pat, filtered, filtering = false )
1376
1376
makeFor(mapName, flatMapName, genFrom :: rest, body)
1377
1377
case _ =>
1378
1378
EmptyTree // may happen for erroneous input
@@ -1559,7 +1559,4 @@ object desugar {
1559
1559
collect(tree)
1560
1560
buf.toList
1561
1561
}
1562
-
1563
- private class IrrefutableGenFrom (pat : Tree , expr : Tree )(implicit @ constructorOnly src : SourceFile )
1564
- extends GenFrom (pat, expr, false )
1565
1562
}
0 commit comments