aboutsummaryrefslogtreecommitdiff
path: root/tests/neg
diff options
context:
space:
mode:
Diffstat (limited to 'tests/neg')
-rw-r--r--tests/neg/i1786.scala17
-rw-r--r--tests/neg/t3683-modified.scala20
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/neg/i1786.scala b/tests/neg/i1786.scala
new file mode 100644
index 000000000..7bf513ed8
--- /dev/null
+++ b/tests/neg/i1786.scala
@@ -0,0 +1,17 @@
+package scala
+
+package object meta {
+ def apply(x: Int): Int = x * x
+}
+
+class Test {
+ def f(a: Any): Any = f(meta) // error
+ def g(a: Any): Any = f(scala.meta) // error
+
+ meta { 5 + 4 }
+
+ scala.meta { 3 }
+
+ val m1 = meta // error
+ val m2 = scala.meta // error
+}
diff --git a/tests/neg/t3683-modified.scala b/tests/neg/t3683-modified.scala
new file mode 100644
index 000000000..19b981e0a
--- /dev/null
+++ b/tests/neg/t3683-modified.scala
@@ -0,0 +1,20 @@
+sealed trait Foo
+sealed trait Bar extends Foo
+sealed trait W[T >: Bar <: Foo]
+case class X() extends W[Foo]
+case class XX() extends W[Bar]
+case class Y() extends W[Bar]
+case class Z[T >: T <: Foo]( // error: cyclic reference
+ z1: W[T]
+) extends W[T]
+
+object Main {
+ // should warn for not including XX()
+ def f1(w: W[Bar]): Int = {
+ w match {
+ // case XX() => 2
+ case Y() => 1
+ case Z(z) => f1(z)
+ }
+ }
+}