summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-07-30 07:15:53 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-07-30 07:15:53 -0700
commitb53e6f74f67113dc5b54a6db06b13bde1080fec1 (patch)
treee7415868e11c462e1c9dde8c292e1ee98792bbb9 /test/files/neg
parent7ac01d8d8f5c84d8640a6baac55f892dc0a88102 (diff)
parentadeffda25e94ed0206d35bdb9b42523227a89f8c (diff)
downloadscala-b53e6f74f67113dc5b54a6db06b13bde1080fec1.tar.gz
scala-b53e6f74f67113dc5b54a6db06b13bde1080fec1.tar.bz2
scala-b53e6f74f67113dc5b54a6db06b13bde1080fec1.zip
Merge pull request #1000 from paulp/topic/sealed-is-final
Refined isEffectivelyFinal logic for sealedness.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/sealed-final-neg.check4
-rw-r--r--test/files/neg/sealed-final-neg.flags1
-rw-r--r--test/files/neg/sealed-final-neg.scala41
3 files changed, 46 insertions, 0 deletions
diff --git a/test/files/neg/sealed-final-neg.check b/test/files/neg/sealed-final-neg.check
new file mode 100644
index 0000000000..500d23f49a
--- /dev/null
+++ b/test/files/neg/sealed-final-neg.check
@@ -0,0 +1,4 @@
+sealed-final-neg.scala:41: error: expected class or object definition
+"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed."
+^
+one error found
diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags
new file mode 100644
index 0000000000..cfabf7a5b4
--- /dev/null
+++ b/test/files/neg/sealed-final-neg.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Yinline-warnings -optimise \ No newline at end of file
diff --git a/test/files/neg/sealed-final-neg.scala b/test/files/neg/sealed-final-neg.scala
new file mode 100644
index 0000000000..bc25330e13
--- /dev/null
+++ b/test/files/neg/sealed-final-neg.scala
@@ -0,0 +1,41 @@
+package neg1 {
+ sealed abstract class Foo {
+ @inline def bar(x: Int) = x + 1
+ }
+ object Foo {
+ def mkFoo(): Foo = new Baz2
+ }
+
+ object Baz1 extends Foo
+ final class Baz2 extends Foo
+ final class Baz3 extends Foo {
+ override def bar(x: Int) = x - 1
+ }
+
+ object Test {
+ // bar can't be inlined - it is overridden in Baz3
+ def f = Foo.mkFoo() bar 10
+ }
+}
+
+package neg2 {
+ sealed abstract class Foo {
+ @inline def bar(x: Int) = x + 1
+ }
+ object Foo {
+ def mkFoo(): Foo = new Baz2
+ }
+
+ object Baz1 extends Foo
+ final class Baz2 extends Foo
+ class Baz3 extends Foo {
+ override def bar(x: Int) = x - 1
+ }
+
+ object Test {
+ // bar can't be inlined - Baz3 is not final
+ def f = Foo.mkFoo() bar 10
+ }
+}
+
+"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed."