File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -343,11 +343,12 @@ object PatternMatcher {
343343 receiver.ensureConforms(defn.NonEmptyTupleTypeRef ), // If scrutinee is a named tuple, cast to underlying tuple
344344 Literal (Constant (i)))
345345
346+ def getOfGetMatch (gm : Tree ) = gm.select(nme.get, _.info.isParameterless)
346347 // Disable Scala2Unapply optimization if the argument is a named argument for a single-element named tuple to
347348 // enable selecting the field. See i23131.scala for test cases.
348349 val wasUnaryNamedTupleSelectArgForNamedTuple =
349350 args.length == 1 && args.head.removeAttachment(FirstTransform .WasNamedArg ).isDefined &&
350- isGetMatch(unappType) && unapp.select(nme.get, _.info.isParameterless ).tpe.widenDealias.isNamedTupleType
351+ isGetMatch(unappType) && getOfGetMatch(unapp ).tpe.widenDealias.isNamedTupleType
351352 if (isSyntheticScala2Unapply(unapp.symbol) && caseAccessors.length == args.length && ! wasUnaryNamedTupleSelectArgForNamedTuple)
352353 def tupleSel (sym : Symbol ) =
353354 // If scrutinee is a named tuple, cast to underlying tuple, so that we can
@@ -381,7 +382,7 @@ object PatternMatcher {
381382 else {
382383 assert(isGetMatch(unappType))
383384 val argsPlan = {
384- val get = ref(unappResult).select(nme.get, _.info.isParameterless )
385+ val get = getOfGetMatch( ref(unappResult))
385386 val arity = productArity(get.tpe.stripNamedTuple, unapp.srcPos)
386387 if (isUnapplySeq)
387388 letAbstract(get) { getResult =>
You can’t perform that action at this time.
0 commit comments