summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-31 09:03:32 -0800
committerPaul Phillips <paulp@improving.org>2012-01-31 09:03:32 -0800
commit37bcff7956451cd74d08899e0e49c8b569d3a882 (patch)
tree1c9276ddd4501c2a6e1b610f883144c6caef371b /test
parent147e9eaf3814738f339b020e701a160ba2f68b60 (diff)
downloadscala-37bcff7956451cd74d08899e0e49c8b569d3a882.tar.gz
scala-37bcff7956451cd74d08899e0e49c8b569d3a882.tar.bz2
scala-37bcff7956451cd74d08899e0e49c8b569d3a882.zip
Test case closes SI-5352.
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t5352.check13
-rw-r--r--test/files/neg/t5352.flags1
-rw-r--r--test/files/neg/t5352.scala15
3 files changed, 29 insertions, 0 deletions
diff --git a/test/files/neg/t5352.check b/test/files/neg/t5352.check
new file mode 100644
index 0000000000..d24b0e8ee1
--- /dev/null
+++ b/test/files/neg/t5352.check
@@ -0,0 +1,13 @@
+t5352.scala:11: error: type mismatch;
+ found : boop.Bar
+ required: boop.BarF
+ (which expands to) AnyRef{def f(): Int}
+ x = xs.head
+ ^
+t5352.scala:14: error: method f in class Bar1 cannot be accessed in boop.Bar1
+ Access to protected method f not permitted because
+ enclosing object boop is not a subclass of
+ class Bar1 in object boop where target is defined
+ (new Bar1).f
+ ^
+two errors found
diff --git a/test/files/neg/t5352.flags b/test/files/neg/t5352.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t5352.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t5352.scala b/test/files/neg/t5352.scala
new file mode 100644
index 0000000000..6ee41f5680
--- /dev/null
+++ b/test/files/neg/t5352.scala
@@ -0,0 +1,15 @@
+object boop {
+ abstract class Bar { protected def f(): Any }
+ class Bar1 extends Bar { protected def f(): Int = 5 }
+ class Bar2 extends Bar { protected def f(): Int = 5 }
+
+ val xs = List(new Bar1, new Bar2)
+
+ type BarF = { def f(): Int }
+
+ var x: BarF = _
+ x = xs.head
+ x.f
+
+ (new Bar1).f
+}