From fe4974c8b506d33309aeafb9f27ce046a7480740 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Thu, 30 Mar 2017 21:33:24 +0200 Subject: Remove unreachable `tupleExtractor` method --- .../tools/dotc/transform/PatternMatcher.scala | 23 +--------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala') diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala index 0f1c96012..4c47a7984 100644 --- a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -1813,11 +1813,6 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer { } object alignPatterns extends ScalacPatternExpander { - /** Converts a T => (A, B, C) extractor to a T => ((A, B, CC)) extractor. - */ - def tupleExtractor(extractor: Extractor): Extractor = - extractor.copy(fixed = defn.tupleType(extractor.fixed) :: Nil) - private def validateAligned(tree: Tree, aligned: Aligned): Aligned = { import aligned._ @@ -1859,29 +1854,13 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer { } val patterns = newPatterns(args) val isSeq = sel.symbol.name == nme.unapplySeq - val isUnapply = sel.symbol.name == nme.unapply val extractor = sel.symbol.name match { case nme.unapply => unapplyMethodTypes(tree, /*fn*/sel, args, resultType, isSeq = false) case nme.unapplySeq => unapplyMethodTypes(tree, /*fn*/sel, args, resultType, isSeq = true) case _ => applyMethodTypes(/*fn*/sel.tpe) } - /** Rather than let the error that is SI-6675 pollute the entire matching - * process, we will tuple the extractor before creation Aligned so that - * it contains known good values. - */ - def prodArity = extractor.prodArity - def acceptMessage = if (extractor.isErroneous) "" else s" to hold ${extractor.offeringString}" - val requiresTupling = isUnapply && patterns.totalArity == 1 && prodArity > 1 - - //if (requiresTupling && effectivePatternArity(args) == 1) - // currentUnit.deprecationWarning(sel.pos, s"${sel.symbol.owner} expects $prodArity patterns$acceptMessage but crushing into $prodArity-tuple to fit single pattern (SI-6675)") - - val normalizedExtractor = - if (requiresTupling) - tupleExtractor(extractor) - else extractor - validateAligned(fn, Aligned(patterns, normalizedExtractor)) + validateAligned(fn, Aligned(patterns, extractor)) } def apply(tree: Tree, resultType: Type): Aligned = tree match { -- cgit v1.2.3