diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-02-25 12:36:27 +0100 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-03-09 15:47:21 +0200 |
commit | 67d175f06db62e8af18851fc5694cfff2158d73b (patch) | |
tree | be0ddf941355a07ee0a92cfb687260149a5c2c30 /test/files | |
parent | 973f2255481c0ee3c9954d361ef3941186495c8f (diff) | |
download | scala-67d175f06db62e8af18851fc5694cfff2158d73b.tar.gz scala-67d175f06db62e8af18851fc5694cfff2158d73b.tar.bz2 scala-67d175f06db62e8af18851fc5694cfff2158d73b.zip |
SI-8331 make sure type select & applied type doesn't match terms
Due to tree re-use it used to be the fact that type quasiquotes could
match term trees. This commit makes sure selections and applied type and
type applied are all non-overlapping between q and tq.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala | 12 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala index e96d1186f7..f558a2f078 100644 --- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala @@ -199,4 +199,16 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction q"..$tpt; ()" } } + + property("term select doesn't match type select") = test { + assertThrows[MatchError] { + val q"$qual.$name" = tq"foo.bar" + } + } + + property("type application doesn't match applied type") = test { + assertThrows[MatchError] { + val q"$f[..$targs]" = tq"foo[bar]" + } + } } diff --git a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala index 8ec1779353..7572b27b52 100644 --- a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala @@ -63,4 +63,16 @@ object TypeDeconstructionProps extends QuasiquoteProperties("type deconstruction // matches because type tree isn't syntactic without original val tq"" = tq"${typeOf[Int]}" } + + property("type select doesn't match term select") = test { + assertThrows[MatchError] { + val tq"$qual.$name" = q"foo.bar" + } + } + + property("applied type doesn't match type appliction") = test { + assertThrows[MatchError] { + val tq"$tpt[..$tpts]" = q"foo[bar]" + } + } } |