summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-26 13:39:09 -0800
committerPaul Phillips <paulp@improving.org>2013-01-26 13:40:09 -0800
commita24fd59f7b1a271d918623a49562cc728547045f (patch)
tree1cc3241f6edcb4d897fa2eea684c7d5e1215dca2 /test/files
parent74a8ef9c24246c54ffe6236ef156d20d3e1c3f27 (diff)
parent2580a51bbaccb31ad88679874d6ad626f8d4491c (diff)
downloadscala-a24fd59f7b1a271d918623a49562cc728547045f.tar.gz
scala-a24fd59f7b1a271d918623a49562cc728547045f.tar.bz2
scala-a24fd59f7b1a271d918623a49562cc728547045f.zip
Merge pull request #1864 from retronym/ticket/4859-6
SI-4859 Step back from mis-optimizations in qualifiers
Diffstat (limited to 'test/files')
-rw-r--r--test/files/pos/t4859.scala17
-rw-r--r--test/files/run/t4859.check8
-rw-r--r--test/files/run/t4859.scala29
3 files changed, 54 insertions, 0 deletions
diff --git a/test/files/pos/t4859.scala b/test/files/pos/t4859.scala
new file mode 100644
index 0000000000..284a39b7ab
--- /dev/null
+++ b/test/files/pos/t4859.scala
@@ -0,0 +1,17 @@
+object O {
+ // error: C is not a legal prefix for a constructor
+ C().CC()
+ // but this works.
+ D().DD()
+}
+
+case class C() {
+ case class CC()
+}
+
+case class D() {
+ class DD()
+ object DD {
+ def apply() = new DD()
+ }
+}
diff --git a/test/files/run/t4859.check b/test/files/run/t4859.check
new file mode 100644
index 0000000000..d329744ca0
--- /dev/null
+++ b/test/files/run/t4859.check
@@ -0,0 +1,8 @@
+Inner
+Inner.i
+About to reference Inner.i
+Outer
+Inner.i
+About to reference O.N
+About to reference O.N
+About to reference O.N.apply()
diff --git a/test/files/run/t4859.scala b/test/files/run/t4859.scala
new file mode 100644
index 0000000000..3c20cea983
--- /dev/null
+++ b/test/files/run/t4859.scala
@@ -0,0 +1,29 @@
+object O {
+ case class N()
+ object P
+}
+
+object Outer {
+ println("Outer")
+ object Inner {
+ println("Inner")
+ def i {
+ println("Inner.i")
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ Outer.Inner.i // we still don't initialize Outer here (but should we?)
+
+ {println("About to reference Inner.i"); Outer}.Inner.i // Outer will be initialized.
+
+ {println("About to reference O.N" ); O}.N
+
+ {println("About to reference O.N" ); O}.N
+
+ {println("About to reference O.N.apply()"); O}.N.apply()
+ }
+}
+