Skip to content

Commit 457c812

Browse files
Blaisorbladenicolasstucki
authored andcommitted
Drop redundant @unchecked matches
1 parent a1e49b5 commit 457c812

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

compiler/src/dotty/tools/dotc/tastyreflect/TastyImpl.scala

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
7474

7575
object IsPackageClause extends IsPackageClauseExtractor {
7676
def unapply(tree: Tree)(implicit ctx: Context): Option[PackageClause] = tree match {
77-
case x: tpd.PackageDef @unchecked => Some(x)
77+
case x: tpd.PackageDef => Some(x)
7878
case _ => None
7979
}
8080
}
8181

8282
object PackageClause extends PackageClauseExtractor {
8383
def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, List[Tree])] = tree match {
84-
case x: tpd.PackageDef @unchecked => Some((x.pid, x.stats))
84+
case x: tpd.PackageDef => Some((x.pid, x.stats))
8585
case _ => None
8686
}
8787
}
@@ -98,7 +98,7 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
9898

9999
object Import extends ImportExtractor {
100100
def unapply(x: Tree)(implicit ctx: Context): Option[(Term, List[ImportSelector])] = x match {
101-
case x: tpd.Import @unchecked => Some((x.expr, x.selectors))
101+
case x: tpd.Import => Some((x.expr, x.selectors))
102102
case _ => None
103103
}
104104
}
@@ -181,14 +181,14 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
181181

182182
object IsClassDef extends IsClassDefExtractor {
183183
def unapply(tree: Tree)(implicit ctx: Context): Option[ClassDef] = tree match {
184-
case x: tpd.TypeDef @unchecked if x.isClassDef => Some(x)
184+
case x: tpd.TypeDef if x.isClassDef => Some(x)
185185
case _ => None
186186
}
187187
}
188188

189189
object ClassDef extends ClassDefExtractor {
190190
def unapply(tree: Tree)(implicit ctx: Context): Option[(String, DefDef, List[Parent], Option[ValDef], List[Statement])] = tree match {
191-
case x: tpd.TypeDef @unchecked if x.isClassDef =>
191+
case x: tpd.TypeDef if x.isClassDef =>
192192
val deco = ClassDefDeco(x)
193193
Some((x.name.toString, deco.constructor, deco.parents, deco.self, deco.body))
194194
case _ => None
@@ -209,14 +209,14 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
209209

210210
object IsDefDef extends IsDefDefExtractor {
211211
def unapply(tree: Tree)(implicit ctx: Context): Option[DefDef] = tree match {
212-
case x: tpd.DefDef @unchecked => Some(x)
212+
case x: tpd.DefDef => Some(x)
213213
case _ => None
214214
}
215215
}
216216

217217
object DefDef extends DefDefExtractor {
218218
def unapply(tree: Tree)(implicit ctx: Context): Option[(String, List[TypeDef], List[List[ValDef]], TypeTree, Option[Term])] = tree match {
219-
case x: tpd.DefDef @unchecked =>
219+
case x: tpd.DefDef =>
220220
Some((x.name.toString, x.tparams, x.vparamss, x.tpt, optional(x.rhs)))
221221
case _ => None
222222
}
@@ -235,14 +235,14 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
235235

236236
object IsValDef extends IsValDefExtractor {
237237
def unapply(tree: Tree)(implicit ctx: Context): Option[ValDef] = tree match {
238-
case x: tpd.ValDef @unchecked => Some(x)
238+
case x: tpd.ValDef => Some(x)
239239
case _ => None
240240
}
241241
}
242242

243243
object ValDef extends ValDefExtractor {
244244
def unapply(tree: Tree)(implicit ctx: Context): Option[(String, TypeTree, Option[Term])] = tree match {
245-
case x: tpd.ValDef @unchecked =>
245+
case x: tpd.ValDef =>
246246
Some((x.name.toString, x.tpt, optional(x.rhs)))
247247
case _ => None
248248
}
@@ -259,14 +259,14 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
259259

260260
object IsTypeDef extends IsTypeDefExtractor {
261261
def unapply(tree: Tree)(implicit ctx: Context): Option[TypeDef] = tree match {
262-
case x: tpd.TypeDef @unchecked if !x.symbol.isClass => Some(x)
262+
case x: tpd.TypeDef if !x.symbol.isClass => Some(x)
263263
case _ => None
264264
}
265265
}
266266

267267
object TypeDef extends TypeDefExtractor {
268268
def unapply(tree: Tree)(implicit ctx: Context): Option[(String, TypeOrBoundsTree /* TypeTree | TypeBoundsTree */)] = tree match {
269-
case x: tpd.TypeDef @unchecked if !x.symbol.isClass => Some((x.name.toString, x.rhs))
269+
case x: tpd.TypeDef if !x.symbol.isClass => Some((x.name.toString, x.rhs))
270270
case _ => None
271271
}
272272
}
@@ -359,14 +359,14 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
359359

360360
object Ident extends IdentExtractor {
361361
def unapply(x: Term)(implicit ctx: Context): Option[String] = x match {
362-
case x: tpd.Ident @unchecked if x.isTerm => Some(x.name.show)
362+
case x: tpd.Ident if x.isTerm => Some(x.name.show)
363363
case _ => None
364364
}
365365
}
366366

367367
object Select extends SelectExtractor {
368368
def unapply(x: Term)(implicit ctx: Context): Option[(Term, String, Option[Signature])] = x match {
369-
case x: tpd.Select @unchecked if x.isTerm =>
369+
case x: tpd.Select if x.isTerm =>
370370
val sig =
371371
if (x.symbol.signature == core.Signature.NotAMethod) None
372372
else Some(x.symbol.signature)
@@ -391,49 +391,49 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
391391

392392
object New extends NewExtractor {
393393
def unapply(x: Term)(implicit ctx: Context): Option[TypeTree] = x match {
394-
case x: tpd.New @unchecked => Some(x.tpt)
394+
case x: tpd.New => Some(x.tpt)
395395
case _ => None
396396
}
397397
}
398398

399399
object NamedArg extends NamedArgExtractor {
400400
def unapply(x: Term)(implicit ctx: Context): Option[(String, Term)] = x match {
401-
case x: tpd.NamedArg @unchecked if x.name.isInstanceOf[Names.TermName] => Some((x.name.toString, x.arg))
401+
case x: tpd.NamedArg if x.name.isInstanceOf[Names.TermName] => Some((x.name.toString, x.arg))
402402
case _ => None
403403
}
404404
}
405405

406406
object Apply extends ApplyExtractor {
407407
def unapply(x: Term)(implicit ctx: Context): Option[(Term, List[Term])] = x match {
408-
case x: tpd.Apply @unchecked => Some((x.fun, x.args))
408+
case x: tpd.Apply => Some((x.fun, x.args))
409409
case _ => None
410410
}
411411
}
412412

413413
object TypeApply extends TypeApplyExtractor {
414414
def unapply(x: Term)(implicit ctx: Context): Option[(Term, List[TypeTree])] = x match {
415-
case x: tpd.TypeApply @unchecked => Some((x.fun, x.args))
415+
case x: tpd.TypeApply => Some((x.fun, x.args))
416416
case _ => None
417417
}
418418
}
419419

420420
object Super extends SuperExtractor {
421421
def unapply(x: Term)(implicit ctx: Context): Option[(Term, Option[Id])] = x match {
422-
case x: tpd.Super @unchecked => Some((x.qual, if (x.mix.isEmpty) None else Some(x.mix)))
422+
case x: tpd.Super => Some((x.qual, if (x.mix.isEmpty) None else Some(x.mix)))
423423
case _ => None
424424
}
425425
}
426426

427427
object Typed extends TypedExtractor {
428428
def unapply(x: Term)(implicit ctx: Context): Option[(Term, TypeTree)] = x match {
429-
case x: tpd.Typed @unchecked => Some((x.expr, x.tpt))
429+
case x: tpd.Typed => Some((x.expr, x.tpt))
430430
case _ => None
431431
}
432432
}
433433

434434
object Assign extends AssignExtractor {
435435
def unapply(x: Term)(implicit ctx: Context): Option[(Term, Term)] = x match {
436-
case x: tpd.Assign @unchecked => Some((x.lhs, x.rhs))
436+
case x: tpd.Assign => Some((x.lhs, x.rhs))
437437
case _ => None
438438
}
439439
}
@@ -476,57 +476,57 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
476476

477477
object Inlined extends InlinedExtractor {
478478
def unapply(x: Term)(implicit ctx: Context): Option[(Option[Term], List[Statement], Term)] = x match {
479-
case x: tpd.Inlined @unchecked =>
479+
case x: tpd.Inlined =>
480480
Some((optional(x.call), x.bindings, x.expansion))
481481
case _ => None
482482
}
483483
}
484484

485485
object Lambda extends LambdaExtractor {
486486
def unapply(x: Term)(implicit ctx: Context): Option[(Term, Option[TypeTree])] = x match {
487-
case x: tpd.Closure @unchecked => Some((x.meth, optional(x.tpt)))
487+
case x: tpd.Closure => Some((x.meth, optional(x.tpt)))
488488
case _ => None
489489
}
490490
}
491491

492492
object If extends IfExtractor {
493493
def unapply(x: Term)(implicit ctx: Context): Option[(Term, Term, Term)] = x match {
494-
case x: tpd.If @unchecked => Some((x.cond, x.thenp, x.elsep))
494+
case x: tpd.If => Some((x.cond, x.thenp, x.elsep))
495495
case _ => None
496496
}
497497
}
498498

499499
object Match extends MatchExtractor {
500500
def unapply(x: Term)(implicit ctx: Context): Option[(Term, List[CaseDef])] = x match {
501-
case x: tpd.Match @unchecked => Some((x.selector, x.cases))
501+
case x: tpd.Match => Some((x.selector, x.cases))
502502
case _ => None
503503
}
504504
}
505505

506506
object Try extends TryExtractor {
507507
def unapply(x: Term)(implicit ctx: Context): Option[(Term, List[CaseDef], Option[Term])] = x match {
508-
case x: tpd.Try @unchecked => Some((x.expr, x.cases, optional(x.finalizer)))
508+
case x: tpd.Try => Some((x.expr, x.cases, optional(x.finalizer)))
509509
case _ => None
510510
}
511511
}
512512

513513
object Return extends ReturnExtractor {
514514
def unapply(x: Term)(implicit ctx: Context): Option[Term] = x match {
515-
case x: tpd.Return @unchecked => Some(x.expr)
515+
case x: tpd.Return => Some(x.expr)
516516
case _ => None
517517
}
518518
}
519519

520520
object Repeated extends RepeatedExtractor {
521521
def unapply(x: Term)(implicit ctx: Context): Option[List[Term]] = x match {
522-
case x: tpd.SeqLiteral @unchecked => Some(x.elems)
522+
case x: tpd.SeqLiteral => Some(x.elems)
523523
case _ => None
524524
}
525525
}
526526

527527
object SelectOuter extends SelectOuterExtractor {
528528
def unapply(x: Term)(implicit ctx: Context): Option[(Term, Int, Type)] = x match {
529-
case x: tpd.Select @unchecked =>
529+
case x: tpd.Select =>
530530
x.name match {
531531
case NameKinds.OuterSelectName(_, levels) => Some((x.qualifier, levels, x.tpe.stripTypeVar))
532532
case _ => None
@@ -572,7 +572,7 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
572572

573573
object CaseDef extends CaseDefExtractor {
574574
def unapply(x: CaseDef): Option[(Pattern, Option[Term], Term)] = x match {
575-
case x: tpd.CaseDef @unchecked =>
575+
case x: tpd.CaseDef =>
576576
Some(x.pat, optional(x.guard), x.body)
577577
case _ => None
578578
}
@@ -592,16 +592,16 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
592592

593593
object Value extends ValueExtractor {
594594
def unapply(x: Pattern)(implicit ctx: Context): Option[Term] = x match {
595-
case lit: tpd.Literal @unchecked => Some(lit)
596-
case ref: tpd.RefTree @unchecked if ref.isTerm => Some(ref)
597-
case ths: tpd.This @unchecked => Some(ths)
595+
case lit: tpd.Literal => Some(lit)
596+
case ref: tpd.RefTree if ref.isTerm => Some(ref)
597+
case ths: tpd.This => Some(ths)
598598
case _ => None
599599
}
600600
}
601601

602602
object Bind extends BindExtractor {
603603
def unapply(x: Pattern)(implicit ctx: Context): Option[(String, Pattern)] = x match {
604-
case x: tpd.Bind @unchecked if x.name.isTermName => Some(x.name.toString, x.body)
604+
case x: tpd.Bind if x.name.isTermName => Some(x.name.toString, x.body)
605605
case _ => None
606606
}
607607
}
@@ -620,7 +620,7 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
620620

621621
object Alternative extends AlternativeExtractor {
622622
def unapply(x: Pattern)(implicit ctx: Context): Option[List[Pattern]] = x match {
623-
case x: tpd.Alternative @unchecked => Some(x.trees)
623+
case x: tpd.Alternative => Some(x.trees)
624624
case _ => None
625625
}
626626
}
@@ -672,70 +672,70 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
672672

673673
object TypeIdent extends TypeIdentExtractor {
674674
def unapply(x: TypeTree)(implicit ctx: Context): Option[String] = x match {
675-
case x: tpd.Ident @unchecked if x.isType => Some(x.name.toString)
675+
case x: tpd.Ident if x.isType => Some(x.name.toString)
676676
case _ => None
677677
}
678678
}
679679

680680
object TermSelect extends TermSelectExtractor {
681681
def unapply(x: TypeTree)(implicit ctx: Context): Option[(Term, String)] = x match {
682-
case x: tpd.Select @unchecked if x.isType && x.qualifier.isTerm => Some(x.qualifier, x.name.toString)
682+
case x: tpd.Select if x.isType && x.qualifier.isTerm => Some(x.qualifier, x.name.toString)
683683
case _ => None
684684
}
685685
}
686686

687687
object TypeSelect extends TypeSelectExtractor {
688688
def unapply(x: TypeTree)(implicit ctx: Context): Option[(TypeTree, String)] = x match {
689-
case x: tpd.Select @unchecked if x.isType && x.qualifier.isType => Some(x.qualifier, x.name.toString)
689+
case x: tpd.Select if x.isType && x.qualifier.isType => Some(x.qualifier, x.name.toString)
690690
case _ => None
691691
}
692692
}
693693

694694
object Singleton extends SingletonExtractor {
695695
def unapply(x: TypeTree)(implicit ctx: Context): Option[Term] = x match {
696-
case x: tpd.SingletonTypeTree @unchecked => Some(x.ref)
696+
case x: tpd.SingletonTypeTree => Some(x.ref)
697697
case _ => None
698698
}
699699
}
700700

701701
object Refined extends RefinedExtractor {
702702
def unapply(x: TypeTree)(implicit ctx: Context): Option[(TypeTree, List[Definition])] = x match {
703-
case x: tpd.RefinedTypeTree @unchecked => Some(x.tpt, x.refinements)
703+
case x: tpd.RefinedTypeTree => Some(x.tpt, x.refinements)
704704
case _ => None
705705
}
706706
}
707707

708708
object Applied extends AppliedExtractor {
709709
def unapply(x: TypeTree)(implicit ctx: Context): Option[(TypeTree, List[TypeOrBoundsTree])] = x match {
710-
case x: tpd.AppliedTypeTree @unchecked => Some(x.tpt, x.args)
710+
case x: tpd.AppliedTypeTree => Some(x.tpt, x.args)
711711
case _ => None
712712
}
713713
}
714714

715715
object Annotated extends AnnotatedExtractor {
716716
def unapply(x: TypeTree)(implicit ctx: Context): Option[(TypeTree, Term)] = x match {
717-
case x: tpd.Annotated @unchecked => Some(x.arg, x.annot)
717+
case x: tpd.Annotated => Some(x.arg, x.annot)
718718
case _ => None
719719
}
720720
}
721721

722722
object And extends AndExtractor {
723723
def unapply(x: TypeTree)(implicit ctx: Context): Option[(TypeTree, TypeTree)] = x match {
724-
case x: tpd.AndTypeTree @unchecked => Some(x.left, x.right)
724+
case x: tpd.AndTypeTree => Some(x.left, x.right)
725725
case _ => None
726726
}
727727
}
728728

729729
object Or extends OrExtractor {
730730
def unapply(x: TypeTree)(implicit ctx: Context): Option[(TypeTree, TypeTree)] = x match {
731-
case x: tpd.OrTypeTree @unchecked => Some(x.left, x.right)
731+
case x: tpd.OrTypeTree => Some(x.left, x.right)
732732
case _ => None
733733
}
734734
}
735735

736736
object ByName extends ByNameExtractor {
737737
def unapply(x: TypeTree)(implicit ctx: Context): Option[TypeTree] = x match {
738-
case x: tpd.ByNameTypeTree @unchecked => Some(x.result)
738+
case x: tpd.ByNameTypeTree => Some(x.result)
739739
case _ => None
740740
}
741741
}
@@ -749,7 +749,7 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
749749

750750
object Bind extends BindExtractor {
751751
def unapply(x: TypeTree)(implicit ctx: Context): Option[(String, TypeBoundsTree)] = x match {
752-
case x: tpd.Bind @unchecked if x.name.isTypeName => Some((x.name.toString, x.body))
752+
case x: tpd.Bind if x.name.isTypeName => Some((x.name.toString, x.body))
753753
case _ => None
754754
}
755755
}
@@ -767,14 +767,14 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty wit
767767

768768
object IsTypeBoundsTree extends IsTypeBoundsTreeExtractor {
769769
def unapply(x: TypeOrBoundsTree)(implicit ctx: Context): Option[TypeBoundsTree] = x match {
770-
case x: tpd.TypeBoundsTree @unchecked => Some(x)
770+
case x: tpd.TypeBoundsTree => Some(x)
771771
case _ => None
772772
}
773773
}
774774

775775
object TypeBoundsTree extends TypeBoundsTreeExtractor {
776776
def unapply(x: TypeOrBoundsTree)(implicit ctx: Context): Option[(TypeTree, TypeTree)] = x match {
777-
case x: tpd.TypeBoundsTree @unchecked => Some(x.lo, x.hi)
777+
case x: tpd.TypeBoundsTree => Some(x.lo, x.hi)
778778
case _ => None
779779
}
780780
}

0 commit comments

Comments
 (0)