summaryrefslogtreecommitdiff
path: root/test/files/neg/sealed-final-neg.scala
blob: bc25330e13ccb36d3965f8a04f537df77c045631 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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."