diff options
author | Martin Odersky <odersky@gmail.com> | 2015-04-21 11:40:48 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-04-22 17:19:34 +0200 |
commit | d72645211880225d13764cd2d0764eee0efb069e (patch) | |
tree | 4a288ef779bf9c2c43c99e451816a1160a188584 | |
parent | dab8aa18419e7b6354d979440cae5105e2672061 (diff) | |
download | dotty-d72645211880225d13764cd2d0764eee0efb069e.tar.gz dotty-d72645211880225d13764cd2d0764eee0efb069e.tar.bz2 dotty-d72645211880225d13764cd2d0764eee0efb069e.zip |
Drop restriction that SuperAccessors should not touch patterns
Not sure why we need to do this, and in any case it's not sure
what constitutes a pattern. There are certainly some parts of
patterns (e.g. prefixes of unapplies, or their implicit arguments)
that should be transformed under SuperAccessors, so the previous
condition was too coarse.
We include the test case that motivated the restriction. It looks like
it works now.
-rw-r--r-- | src/dotty/tools/dotc/transform/SuperAccessors.scala | 5 | ||||
-rw-r--r-- | tests/pos/t4062.scala | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/transform/SuperAccessors.scala b/src/dotty/tools/dotc/transform/SuperAccessors.scala index 213a2369d..cfd78a91d 100644 --- a/src/dotty/tools/dotc/transform/SuperAccessors.scala +++ b/src/dotty/tools/dotc/transform/SuperAccessors.scala @@ -155,11 +155,6 @@ class SuperAccessors extends MacroTransform else tree try tree match { - // Don't transform patterns or strange trees will reach the matcher (ticket #4062) - // TODO Query `ctx.mode is Pattern` instead. - case CaseDef(pat, guard, body) => - cpy.CaseDef(tree)(pat, transform(guard), transform(body)) - case impl: Template => def transformTemplate = { diff --git a/tests/pos/t4062.scala b/tests/pos/t4062.scala new file mode 100644 index 000000000..63e05b739 --- /dev/null +++ b/tests/pos/t4062.scala @@ -0,0 +1,7 @@ +class A(val f : String) + +class B(a : Option[String], f : String) extends A(f) { + a match { + case Some(`f`) => print(f) + } +} |