diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-01-14 13:19:44 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-01-14 13:44:08 +0100 |
commit | 2e28cf7f76c3d5fd0c2df4274f1af9acb42de699 (patch) | |
tree | 90e5754ad64ba84539e3395b6ef500dc6d845e4b /test/files/neg | |
parent | 8beeef339ad65f3308ece6fb0440cdb31b1ad404 (diff) | |
download | scala-2e28cf7f76c3d5fd0c2df4274f1af9acb42de699.tar.gz scala-2e28cf7f76c3d5fd0c2df4274f1af9acb42de699.tar.bz2 scala-2e28cf7f76c3d5fd0c2df4274f1af9acb42de699.zip |
SI-8146 Test cases for typechecking decidability
Taken from "On Decidability of Nominal Subtyping with Variance"
(Pierce, Kennedy), which was implemented in 152563b.
Part of the implementation (SubTypePair) will be changed in the
following commit to fix the non-deterministic errors typechecking
heavily nested types involving aliases or annotations.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t8146-non-finitary-2.check | 9 | ||||
-rw-r--r-- | test/files/neg/t8146-non-finitary-2.scala | 8 | ||||
-rw-r--r-- | test/files/neg/t8146-non-finitary.check | 9 | ||||
-rw-r--r-- | test/files/neg/t8146-non-finitary.scala | 7 |
4 files changed, 33 insertions, 0 deletions
diff --git a/test/files/neg/t8146-non-finitary-2.check b/test/files/neg/t8146-non-finitary-2.check new file mode 100644 index 0000000000..8c2e1436c2 --- /dev/null +++ b/test/files/neg/t8146-non-finitary-2.check @@ -0,0 +1,9 @@ +t8146-non-finitary-2.scala:5: error: class graph is not finitary because type parameter X is expansively recursive +trait C[X] extends N[N[C[D[X]]]] + ^ +t8146-non-finitary-2.scala:7: error: type mismatch; + found : C[Int] + required: N[C[Int]] + def foo(c: C[Int]): N[C[Int]] = c + ^ +two errors found diff --git a/test/files/neg/t8146-non-finitary-2.scala b/test/files/neg/t8146-non-finitary-2.scala new file mode 100644 index 0000000000..c12f5f8f49 --- /dev/null +++ b/test/files/neg/t8146-non-finitary-2.scala @@ -0,0 +1,8 @@ +// Example 3 from "On Decidability of Nominal Subtyping with Variance" (Pierce, Kennedy) +// http://research.microsoft.com/pubs/64041/fool2007.pdf +trait N[-Z] +trait D[Y] +trait C[X] extends N[N[C[D[X]]]] +object Test { + def foo(c: C[Int]): N[C[Int]] = c +} diff --git a/test/files/neg/t8146-non-finitary.check b/test/files/neg/t8146-non-finitary.check new file mode 100644 index 0000000000..8363b750ca --- /dev/null +++ b/test/files/neg/t8146-non-finitary.check @@ -0,0 +1,9 @@ +t8146-non-finitary.scala:4: error: class graph is not finitary because type parameter A is expansively recursive +trait C[A] extends N[N[C[C[A]]]] + ^ +t8146-non-finitary.scala:6: error: type mismatch; + found : C[Int] + required: N[C[Int]] + def foo(c: C[Int]): N[C[Int]] = c + ^ +two errors found diff --git a/test/files/neg/t8146-non-finitary.scala b/test/files/neg/t8146-non-finitary.scala new file mode 100644 index 0000000000..3d8a3074c7 --- /dev/null +++ b/test/files/neg/t8146-non-finitary.scala @@ -0,0 +1,7 @@ +// Example 3 from "On Decidability of Nominal Subtyping with Variance" (Pierce, Kennedy) +// http://research.microsoft.com/pubs/64041/fool2007.pdf +trait N[-A] +trait C[A] extends N[N[C[C[A]]]] +object Test { + def foo(c: C[Int]): N[C[Int]] = c +} |