aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/neg/sealed-final-neg.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/neg/sealed-final-neg.scala')
-rw-r--r--tests/untried/neg/sealed-final-neg.scala41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/untried/neg/sealed-final-neg.scala b/tests/untried/neg/sealed-final-neg.scala
new file mode 100644
index 000000000..bc25330e1
--- /dev/null
+++ b/tests/untried/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."