diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-23 14:30:21 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-10-23 15:34:39 -0700 |
commit | e326d864d0a7fc9471695d89635c101a84592c58 (patch) | |
tree | c4a5c27b60ef08bf499444893c73d03035e7ba38 /test/files | |
parent | 9cbbb1ccb50fc0a6c423321494ea360f25736e28 (diff) | |
download | scala-e326d864d0a7fc9471695d89635c101a84592c58.tar.gz scala-e326d864d0a7fc9471695d89635c101a84592c58.tar.bz2 scala-e326d864d0a7fc9471695d89635c101a84592c58.zip |
Tests for SI-3160, SI-4537, import precedence.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/import-precedence.check | 19 | ||||
-rw-r--r-- | test/files/neg/import-precedence.scala | 68 | ||||
-rw-r--r-- | test/files/neg/t3160ambiguous.check | 7 | ||||
-rw-r--r-- | test/files/neg/t3160ambiguous.scala | 15 | ||||
-rw-r--r-- | test/files/neg/t4537.check | 4 | ||||
-rw-r--r-- | test/files/neg/t4537/c.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t3160.scala | 6 | ||||
-rw-r--r-- | test/files/run/t4537.check | 1 | ||||
-rw-r--r-- | test/files/run/t4537/a.scala (renamed from test/files/neg/t4537/a.scala) | 4 | ||||
-rw-r--r-- | test/files/run/t4537/b.scala (renamed from test/files/neg/t4537/b.scala) | 4 | ||||
-rw-r--r-- | test/files/run/t4537/c.scala | 8 | ||||
-rw-r--r-- | test/files/run/t4537/d.scala | 6 |
12 files changed, 134 insertions, 16 deletions
diff --git a/test/files/neg/import-precedence.check b/test/files/neg/import-precedence.check new file mode 100644 index 0000000000..5f99611052 --- /dev/null +++ b/test/files/neg/import-precedence.check @@ -0,0 +1,19 @@ +import-precedence.scala:18: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2._ +and import uniq1.X + object Y { def f = X } + ^ +import-precedence.scala:61: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2._ +and import uniq1._ + object Y { def f = X } + ^ +import-precedence.scala:67: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2.X +and import uniq1.X + object Y { def f = X } + ^ +three errors found diff --git a/test/files/neg/import-precedence.scala b/test/files/neg/import-precedence.scala new file mode 100644 index 0000000000..0401635e32 --- /dev/null +++ b/test/files/neg/import-precedence.scala @@ -0,0 +1,68 @@ +package uniq1 { + object X + package uniq2 { + object X + package uniq3 { + object X + package uniq4 { + object X + } + } + } +} + +package p1 { + import uniq1.X + package p2 { + import uniq1.uniq2._ + object Y { def f = X } + } +} + +package p2 { + import uniq1.uniq2._ + package p2 { + import uniq1.X + object Y { def f = X } + } +} + +package p3 { + import uniq1.X + import uniq1.uniq2._ + object Y { def f = X } +} + +package p4 { + import uniq1.uniq2._ + import uniq1.X + object Y { def f = X } +} + +package p5 { + import uniq1.X + package p6 { + import uniq1.uniq2.X + object Y { def f = X } + } +} + +package p6 { + import uniq1._ + package p5 { + import uniq1.uniq2._ + object Y { def f = X } + } +} + +package p7 { + import uniq1._ + import uniq1.uniq2._ + object Y { def f = X } +} + +package p8 { + import uniq1.X + import uniq1.uniq2.X + object Y { def f = X } +} diff --git a/test/files/neg/t3160ambiguous.check b/test/files/neg/t3160ambiguous.check new file mode 100644 index 0000000000..e80d9a5461 --- /dev/null +++ b/test/files/neg/t3160ambiguous.check @@ -0,0 +1,7 @@ +t3160ambiguous.scala:8: error: reference to Node is ambiguous; +it is imported twice in the same scope by +import scala.xml._ +and import Bippy._ + def f(x: Node): String = ??? // ambiguous, because Bippy.Node is accessible + ^ +one error found diff --git a/test/files/neg/t3160ambiguous.scala b/test/files/neg/t3160ambiguous.scala new file mode 100644 index 0000000000..cb9759b79c --- /dev/null +++ b/test/files/neg/t3160ambiguous.scala @@ -0,0 +1,15 @@ +object Bippy { + private class Node +} +class Bippy { + import Bippy._ + import scala.xml._ + + def f(x: Node): String = ??? // ambiguous, because Bippy.Node is accessible +} +class Other { + import Bippy._ + import scala.xml._ + + def f(x: Node): String = ??? // unambiguous, because Bippy.Node is inaccessible +} diff --git a/test/files/neg/t4537.check b/test/files/neg/t4537.check deleted file mode 100644 index 931bcd0405..0000000000 --- a/test/files/neg/t4537.check +++ /dev/null @@ -1,4 +0,0 @@ -c.scala:7: error: object Settings in package a cannot be accessed in package a - println(Settings.Y) - ^ -one error found diff --git a/test/files/neg/t4537/c.scala b/test/files/neg/t4537/c.scala deleted file mode 100644 index 379599112d..0000000000 --- a/test/files/neg/t4537/c.scala +++ /dev/null @@ -1,8 +0,0 @@ -package b -package c - -import a._ - -object Test { - println(Settings.Y) -}
\ No newline at end of file diff --git a/test/files/pos/t3160.scala b/test/files/pos/t3160.scala new file mode 100644 index 0000000000..3309ece160 --- /dev/null +++ b/test/files/pos/t3160.scala @@ -0,0 +1,6 @@ +import scala.collection.mutable._ +import scala.xml._ + +class A { + def f(x: Node): Node = ??? +} diff --git a/test/files/run/t4537.check b/test/files/run/t4537.check new file mode 100644 index 0000000000..63739ca64a --- /dev/null +++ b/test/files/run/t4537.check @@ -0,0 +1 @@ +b.Settings diff --git a/test/files/neg/t4537/a.scala b/test/files/run/t4537/a.scala index 65e183c5f8..125e223e13 100644 --- a/test/files/neg/t4537/a.scala +++ b/test/files/run/t4537/a.scala @@ -1,5 +1,5 @@ package a private[a] object Settings { - val X = 0 -}
\ No newline at end of file + val X = "a.Settings" +} diff --git a/test/files/neg/t4537/b.scala b/test/files/run/t4537/b.scala index bb9dd4e15a..c709d49b04 100644 --- a/test/files/neg/t4537/b.scala +++ b/test/files/run/t4537/b.scala @@ -1,5 +1,5 @@ package b object Settings { - val Y = 0 -}
\ No newline at end of file + val Y = "b.Settings" +} diff --git a/test/files/run/t4537/c.scala b/test/files/run/t4537/c.scala new file mode 100644 index 0000000000..ee05d4bbfb --- /dev/null +++ b/test/files/run/t4537/c.scala @@ -0,0 +1,8 @@ +package b +package c + +import a._ + +object Unambiguous { + println(Settings.Y) +} diff --git a/test/files/run/t4537/d.scala b/test/files/run/t4537/d.scala new file mode 100644 index 0000000000..dd1d2045ed --- /dev/null +++ b/test/files/run/t4537/d.scala @@ -0,0 +1,6 @@ +import a._ +import b._ + +object Test extends App { + println(Settings.Y) +} |