aboutsummaryrefslogtreecommitdiff
path: root/tests/neg
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2017-02-22 11:33:52 +0100
committerGitHub <noreply@github.com>2017-02-22 11:33:52 +0100
commit5c7ef22a5464456a3e95869c0f6154a2ae8a5f84 (patch)
treeb65e67507ca53f2c1c51bf4f85f67620ffc7aa69 /tests/neg
parent355232690d96e458764159a66f3fed0135c059a3 (diff)
parent815e426c8512e046f09edb7c7d3c3a98653bce24 (diff)
downloaddotty-5c7ef22a5464456a3e95869c0f6154a2ae8a5f84.tar.gz
dotty-5c7ef22a5464456a3e95869c0f6154a2ae8a5f84.tar.bz2
dotty-5c7ef22a5464456a3e95869c0f6154a2ae8a5f84.zip
Merge pull request #1997 from dotty-staging/fix-#1992
Fix off-by-one error in forward reference checking
Diffstat (limited to 'tests/neg')
-rw-r--r--tests/neg/i1992.scala9
-rw-r--r--tests/neg/i2005.scala7
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/neg/i1992.scala b/tests/neg/i1992.scala
new file mode 100644
index 000000000..818b46771
--- /dev/null
+++ b/tests/neg/i1992.scala
@@ -0,0 +1,9 @@
+object Test {
+ def main(args: Array[String]) = {
+ val x: Int => Unit =
+ y => println(x) // error: `x` is a forward reference
+ implicit val z: String => Unit =
+ y => println(implicitly[String => Unit]) // error: `z` is a forward reference
+ }
+}
+
diff --git a/tests/neg/i2005.scala b/tests/neg/i2005.scala
new file mode 100644
index 000000000..fc2e4ddec
--- /dev/null
+++ b/tests/neg/i2005.scala
@@ -0,0 +1,7 @@
+
+object Test {
+ val a = 42
+ def main(args: Array[String]) = {
+ val a: Int = a // error
+ }
+}