File tree Expand file tree Collapse file tree 2 files changed +2
-44
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +2
-44
lines changed Original file line number Diff line number Diff line change @@ -659,23 +659,8 @@ trait Applications extends Compatibility { self: Typer =>
659
659
def typedUnApply (tree : untpd.Apply , selType : Type )(implicit ctx : Context ): Tree = track(" typedUnApply" ) {
660
660
val Apply (qual, args) = tree
661
661
662
- def notAnExtractor (unapplyFn : Tree ) = {
663
- val methodStr = unapplyFn.symbol.name match {
664
- case nme.unapply => " unapply"
665
- case nme.unapplySeq => " unapplySeq"
666
- case _ => " unapply or unapplySeq"
667
- }
668
- val because = unapplyFn.tpe.widen match {
669
- case mt : MethodType =>
670
- i " its $methodStr method of type $mt" + (
671
- if (mt.isDependent) i " has a dependent type "
672
- else if (mt.paramTypes.length != 1 ) i " does not take a single parameter "
673
- else " is not eligible (this could be an internal compiler error)" )
674
- case _ =>
675
- " it lacks a unapply or unapplySeq method"
676
- }
677
- errorTree(unapplyFn, s " ${qual.show} cannot be used as an extractor in a pattern $because" )
678
- }
662
+ def notAnExtractor (tree : Tree ) =
663
+ errorTree(tree, s " ${qual.show} cannot be used as an extractor in a pattern because it lacks an unapply or unapplySeq method " )
679
664
680
665
/** If this is a term ref tree, try to typecheck with its type name.
681
666
* If this refers to a type alias, follow the alias, and if
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments