@@ -405,35 +405,22 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
405
405
Prod (pat.tpe.stripAnnots, fun.tpe.widen, fun.symbol, pats.map(project), irrefutable(fun))
406
406
case Typed (pat @ UnApply (_, _, _), _) => project(pat)
407
407
case Typed (expr, tpt) =>
408
- val unchecked = expr.tpe.hasAnnotation(ctx.definitions.UncheckedAnnot )
409
- def warn (msg : String ): Unit = if (! unchecked) ctx.warning(UncheckedTypePattern (msg), tpt.pos)
410
- Typ (erase(expr.tpe.stripAnnots)(warn), true )
408
+ Typ (erase(expr.tpe.stripAnnots), true )
411
409
case _ =>
412
410
debug.println(s " unknown pattern: $pat" )
413
411
Empty
414
412
}
415
413
416
414
/* Erase a type binding according to erasure semantics in pattern matching */
417
- def erase (tp : Type )( implicit warn : String => Unit ) : Type = tp match {
415
+ def erase (tp : Type ): Type = tp match {
418
416
case tp @ AppliedType (tycon, args) =>
419
417
if (tycon.isRef(defn.ArrayClass )) tp.derivedAppliedType(tycon, args.map(erase))
420
- else {
421
- val ignoreWarning = args.forall { p =>
422
- p.typeSymbol.is(BindDefinedType ) ||
423
- p.hasAnnotation(defn.UncheckedAnnot ) ||
424
- p.isInstanceOf [TypeBounds ]
425
- }
426
- if (! ignoreWarning)
427
- warn(" type arguments are not checked since they are eliminated by erasure" )
428
-
429
- tp.derivedAppliedType(tycon, args.map(t => WildcardType ))
430
- }
418
+ else tp.derivedAppliedType(tycon, args.map(t => WildcardType ))
431
419
case OrType (tp1, tp2) =>
432
420
OrType (erase(tp1), erase(tp2))
433
421
case AndType (tp1, tp2) =>
434
422
AndType (erase(tp1), erase(tp2))
435
423
case tp : RefinedType =>
436
- warn(" type refinement is not checked since it is eliminated by erasure" )
437
424
tp.derivedRefinedType(erase(tp.parent), tp.refinedName, WildcardType )
438
425
case _ => tp
439
426
}
0 commit comments