@@ -405,35 +405,22 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
405405 Prod (pat.tpe.stripAnnots, fun.tpe.widen, fun.symbol, pats.map(project), irrefutable(fun))
406406 case Typed (pat @ UnApply (_, _, _), _) => project(pat)
407407 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 )
411409 case _ =>
412410 debug.println(s " unknown pattern: $pat" )
413411 Empty
414412 }
415413
416414 /* 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 {
418416 case tp @ AppliedType (tycon, args) =>
419417 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 ))
431419 case OrType (tp1, tp2) =>
432420 OrType (erase(tp1), erase(tp2))
433421 case AndType (tp1, tp2) =>
434422 AndType (erase(tp1), erase(tp2))
435423 case tp : RefinedType =>
436- warn(" type refinement is not checked since it is eliminated by erasure" )
437424 tp.derivedRefinedType(erase(tp.parent), tp.refinedName, WildcardType )
438425 case _ => tp
439426 }
0 commit comments