diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-15 15:21:26 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-12-15 15:21:26 +0100 |
commit | b1553cb9c5894e2e91925a67afd2c986675e5c46 (patch) | |
tree | f9def6ae664f0df939a51b55c5283790b93a7c4d /compiler/src/dotty/tools/dotc/ast | |
parent | 9bf58090c704a59d8735874c565200758bcea666 (diff) | |
download | dotty-b1553cb9c5894e2e91925a67afd2c986675e5c46.tar.gz dotty-b1553cb9c5894e2e91925a67afd2c986675e5c46.tar.bz2 dotty-b1553cb9c5894e2e91925a67afd2c986675e5c46.zip |
Implement new rules for name-based pattern matching
This implements the rules laid down in #1805.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/ast')
-rw-r--r-- | compiler/src/dotty/tools/dotc/ast/Desugar.scala | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 15cb0b665..11f8b81eb 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -24,7 +24,6 @@ object desugar { /** Names of methods that are added unconditionally to case classes */ def isDesugaredCaseClassMethodName(name: Name)(implicit ctx: Context): Boolean = - name == nme.isDefined || name == nme.copy || name == nme.productArity || name.isSelectorName @@ -343,7 +342,6 @@ object desugar { if (isCaseClass) { def syntheticProperty(name: TermName, rhs: Tree) = DefDef(name, Nil, Nil, TypeTree(), rhs).withMods(synthetic) - val isDefinedMeth = syntheticProperty(nme.isDefined, Literal(Constant(true))) val caseParams = constrVparamss.head.toArray val productElemMeths = for (i <- 0 until arity) yield syntheticProperty(nme.selectorName(i), Select(This(EmptyTypeIdent), caseParams(i).name)) @@ -369,7 +367,7 @@ object desugar { DefDef(nme.copy, derivedTparams, copyFirstParams :: copyRestParamss, TypeTree(), creatorExpr) .withMods(synthetic) :: Nil } - copyMeths ::: isDefinedMeth :: productElemMeths.toList + copyMeths ::: productElemMeths.toList } else Nil |