Skip to content

Commit a3cc938

Browse files
committed
Use _1 intstead of get for accessing unary case class parameters
Now that caes classes always inherit from ProductX, we can avoid the special case. (We need to define _1 anyway to implement Product1).
1 parent 974f706 commit a3cc938

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,9 @@ object desugar {
288288
DefDef(synthetic, name, Nil, Nil, TypeTree(), rhs)
289289
val isDefinedMeth = syntheticProperty(nme.isDefined, Literal(Constant(true)))
290290
val productArityMeth = syntheticProperty(nme.productArity, Literal(Constant(arity)))
291-
def selectorName(n: Int) =
292-
if (arity == 1) nme.get else nme.selectorName(n)
293291
val caseParams = constrVparamss.head.toArray
294292
val productElemMeths = for (i <- 0 until arity) yield
295-
syntheticProperty(selectorName(i), Select(This(EmptyTypeName), caseParams(i).name))
293+
syntheticProperty(nme.selectorName(i), Select(This(EmptyTypeName), caseParams(i).name))
296294
val copyMeths =
297295
if (mods is Abstract) Nil
298296
else {

0 commit comments

Comments
 (0)