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 {
343343 receiver.ensureConforms(defn.NonEmptyTupleTypeRef ), // If scrutinee is a named tuple, cast to underlying tuple
344344 Literal (Constant (i)))
345345
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)
347348 def tupleSel (sym : Symbol ) =
348349 // If scrutinee is a named tuple, cast to underlying tuple, so that we can
349350 // continue to select with _1, _2, ...
@@ -388,7 +389,7 @@ object PatternMatcher {
388389 letAbstract(get) { getResult =>
389390 def isUnaryNamedTupleSelectArg (arg : Tree ) =
390391 get.tpe.widenDealias.isNamedTupleType
391- && arg.removeAttachment( FirstTransform . WasNamedArg ).isDefined
392+ && wasNamedArg
392393 // Special case: Normally, we pull out the argument wholesale if
393394 // there is only one. But if the argument is a named argument for
394395 // a single-element named tuple, we have to select the field instead.
You can’t perform that action at this time.
0 commit comments