diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/neg/leak-type.scala | 13 | ||||
-rw-r--r-- | tests/pos/i1130.scala | 4 | ||||
-rw-r--r-- | tests/pos/leak-inferred.scala | 12 | ||||
-rw-r--r-- | tests/pos/tailcall/i2024.scala | 4 | ||||
-rw-r--r-- | tests/pos/tailcall/return.scala | 2 |
5 files changed, 33 insertions, 2 deletions
diff --git a/tests/neg/leak-type.scala b/tests/neg/leak-type.scala new file mode 100644 index 000000000..30ecab70b --- /dev/null +++ b/tests/neg/leak-type.scala @@ -0,0 +1,13 @@ +trait A { + private type Foo = Int + + + class Inner[T <: Foo] { // error: non-private type T refers to private type Foo in its type signature + def get: T = ??? + } +} +class B extends A { + def foo(x: Inner[_]): Unit = { + val a = x.get // error: cannot resolve reference to type B(B.this).Foo + } +} diff --git a/tests/pos/i1130.scala b/tests/pos/i1130.scala index 8d71de5e8..c28eaa169 100644 --- a/tests/pos/i1130.scala +++ b/tests/pos/i1130.scala @@ -3,4 +3,6 @@ trait A { def foo: Foo = 1 } -class B extends A +class B extends A { + foo +} diff --git a/tests/pos/leak-inferred.scala b/tests/pos/leak-inferred.scala new file mode 100644 index 000000000..5d8a7e3bc --- /dev/null +++ b/tests/pos/leak-inferred.scala @@ -0,0 +1,12 @@ +class A { + private val x = List(1,2) + + val elem = x.head +} + +class B extends A { + val a: Int = elem + // Without `checkNoPrivateLeaks`, we get: + // found: B.this.x.scala$collection$immutable$List$$A(B.this.elem) + // required: Int +} diff --git a/tests/pos/tailcall/i2024.scala b/tests/pos/tailcall/i2024.scala new file mode 100644 index 000000000..aba1db2e5 --- /dev/null +++ b/tests/pos/tailcall/i2024.scala @@ -0,0 +1,4 @@ +object Test { +// def main(args: Array[String]): Unit = { } + def assume[T]: Any = assume +} diff --git a/tests/pos/tailcall/return.scala b/tests/pos/tailcall/return.scala index 454686c3d..3724b5b32 100644 --- a/tests/pos/tailcall/return.scala +++ b/tests/pos/tailcall/return.scala @@ -1,4 +1,4 @@ -object Test { +object Return { def foo(x: Int): Int = return 3 |