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 {
343
343
receiver.ensureConforms(defn.NonEmptyTupleTypeRef ), // If scrutinee is a named tuple, cast to underlying tuple
344
344
Literal (Constant (i)))
345
345
346
+ def getOfGetMatch (gm : Tree ) = gm.select(nme.get, _.info.isParameterless)
346
347
// Disable Scala2Unapply optimization if the argument is a named argument for a single-element named tuple to
347
348
// enable selecting the field. See i23131.scala for test cases.
348
349
val wasUnaryNamedTupleSelectArgForNamedTuple =
349
350
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
351
352
if (isSyntheticScala2Unapply(unapp.symbol) && caseAccessors.length == args.length && ! wasUnaryNamedTupleSelectArgForNamedTuple)
352
353
def tupleSel (sym : Symbol ) =
353
354
// If scrutinee is a named tuple, cast to underlying tuple, so that we can
@@ -381,7 +382,7 @@ object PatternMatcher {
381
382
else {
382
383
assert(isGetMatch(unappType))
383
384
val argsPlan = {
384
- val get = ref(unappResult).select(nme.get, _.info.isParameterless )
385
+ val get = getOfGetMatch( ref(unappResult))
385
386
val arity = productArity(get.tpe.stripNamedTuple, unapp.srcPos)
386
387
if (isUnapplySeq)
387
388
letAbstract(get) { getResult =>
You can’t perform that action at this time.
0 commit comments