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,7 +343,8 @@ 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
- if (isSyntheticScala2Unapply(unapp.symbol) && caseAccessors.length == args.length && args.length != 1 )
346
+ val wasNamedArg = args.length == 1 && args.head.removeAttachment(FirstTransform .WasNamedArg ).isDefined
347
+ if (isSyntheticScala2Unapply(unapp.symbol) && caseAccessors.length == args.length && ! wasNamedArg)
347
348
def tupleSel (sym : Symbol ) =
348
349
// If scrutinee is a named tuple, cast to underlying tuple, so that we can
349
350
// continue to select with _1, _2, ...
@@ -388,7 +389,7 @@ object PatternMatcher {
388
389
letAbstract(get) { getResult =>
389
390
def isUnaryNamedTupleSelectArg (arg : Tree ) =
390
391
get.tpe.widenDealias.isNamedTupleType
391
- && arg.removeAttachment( FirstTransform . WasNamedArg ).isDefined
392
+ && wasNamedArg
392
393
// Special case: Normally, we pull out the argument wholesale if
393
394
// there is only one. But if the argument is a named argument for
394
395
// a single-element named tuple, we have to select the field instead.
You can’t perform that action at this time.
0 commit comments