summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/macro-attachments/Macros_1.scala19
-rw-r--r--test/files/pos/macro-attachments/Test_2.scala3
-rw-r--r--test/files/pos/t8013.flags2
-rw-r--r--test/files/pos/t8736-b.flags1
-rw-r--r--test/files/pos/t8736-b.scala7
-rw-r--r--test/files/pos/t8736.flags1
-rw-r--r--test/files/pos/t8736.scala7
-rw-r--r--test/files/pos/t8743.scala15
-rw-r--r--test/files/pos/t8781/Macro_1.scala13
-rw-r--r--test/files/pos/t8781/Test_2.flags1
-rw-r--r--test/files/pos/t8781/Test_2.scala5
-rw-r--r--test/files/pos/t8793.scala15
-rw-r--r--test/files/pos/t8828.flags1
-rw-r--r--test/files/pos/t8828.scala20
14 files changed, 109 insertions, 1 deletions
diff --git a/test/files/pos/macro-attachments/Macros_1.scala b/test/files/pos/macro-attachments/Macros_1.scala
new file mode 100644
index 0000000000..38d05d5b85
--- /dev/null
+++ b/test/files/pos/macro-attachments/Macros_1.scala
@@ -0,0 +1,19 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+trait Base
+class Att extends Base
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ import c.internal._
+ import decorators._
+ val dummy = q"x"
+ dummy.updateAttachment(new Att)
+ if (dummy.attachments.get[Base].isEmpty) c.abort(c.enclosingPosition, "that's not good")
+ q"()"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/pos/macro-attachments/Test_2.scala b/test/files/pos/macro-attachments/Test_2.scala
new file mode 100644
index 0000000000..acfddae942
--- /dev/null
+++ b/test/files/pos/macro-attachments/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.foo
+} \ No newline at end of file
diff --git a/test/files/pos/t8013.flags b/test/files/pos/t8013.flags
index 954eaba352..3955bb6710 100644
--- a/test/files/pos/t8013.flags
+++ b/test/files/pos/t8013.flags
@@ -1 +1 @@
--Xfatal-warnings -Xlint
+-Xfatal-warnings -Xlint:-infer-any,_
diff --git a/test/files/pos/t8736-b.flags b/test/files/pos/t8736-b.flags
new file mode 100644
index 0000000000..1ad4eabe0f
--- /dev/null
+++ b/test/files/pos/t8736-b.flags
@@ -0,0 +1 @@
+-feature -language:_ -Xfatal-warnings
diff --git a/test/files/pos/t8736-b.scala b/test/files/pos/t8736-b.scala
new file mode 100644
index 0000000000..903292d232
--- /dev/null
+++ b/test/files/pos/t8736-b.scala
@@ -0,0 +1,7 @@
+// scalac: -feature -language:_ -Xfatal-warnings
+// showing that all are set
+class X {
+ def hk[M[_]] = ???
+
+ implicit def imp(x: X): Int = x.hashCode
+}
diff --git a/test/files/pos/t8736.flags b/test/files/pos/t8736.flags
new file mode 100644
index 0000000000..7fe42f7340
--- /dev/null
+++ b/test/files/pos/t8736.flags
@@ -0,0 +1 @@
+-feature -language:implicitConversions -language:higherKinds -language:-implicitConversions -Xfatal-warnings
diff --git a/test/files/pos/t8736.scala b/test/files/pos/t8736.scala
new file mode 100644
index 0000000000..46c0cdfd00
--- /dev/null
+++ b/test/files/pos/t8736.scala
@@ -0,0 +1,7 @@
+// scalac: -feature -language:implicitConversions -language:higherKinds -language:-implicitConversions -Xfatal-warnings
+// showing that multiple settings are respected, and explicit enablement has precedence
+class X {
+ def hk[M[_]] = ???
+
+ implicit def imp(x: X): Int = x.hashCode
+}
diff --git a/test/files/pos/t8743.scala b/test/files/pos/t8743.scala
new file mode 100644
index 0000000000..03b0cd7044
--- /dev/null
+++ b/test/files/pos/t8743.scala
@@ -0,0 +1,15 @@
+import annotation.varargs
+
+object VarArgs {
+ @varargs
+ def foo[A](x: A, xs: String*): A = ???
+
+ @varargs
+ def bar[A](x: List[A], xs: String*): A = ???
+
+ @varargs
+ def baz[A](x: List[A], xs: String*): A = ???
+
+ @varargs
+ def boz[A](x: A, xs: String*): Nothing = ???
+}
diff --git a/test/files/pos/t8781/Macro_1.scala b/test/files/pos/t8781/Macro_1.scala
new file mode 100644
index 0000000000..ecd9c5e8d5
--- /dev/null
+++ b/test/files/pos/t8781/Macro_1.scala
@@ -0,0 +1,13 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ val name = TypeName(c.freshName())
+ q"class $name extends T; new $name"
+ }
+ def fresh: Any = macro impl
+}
+
+trait T
diff --git a/test/files/pos/t8781/Test_2.flags b/test/files/pos/t8781/Test_2.flags
new file mode 100644
index 0000000000..24e2109690
--- /dev/null
+++ b/test/files/pos/t8781/Test_2.flags
@@ -0,0 +1 @@
+-Ymacro-expand:discard -Ystop-after:typer
diff --git a/test/files/pos/t8781/Test_2.scala b/test/files/pos/t8781/Test_2.scala
new file mode 100644
index 0000000000..3ca6406599
--- /dev/null
+++ b/test/files/pos/t8781/Test_2.scala
@@ -0,0 +1,5 @@
+object Test {
+ implicit class RichT(t: T) { def augmented = "" }
+
+ Macros.fresh.augmented
+}
diff --git a/test/files/pos/t8793.scala b/test/files/pos/t8793.scala
new file mode 100644
index 0000000000..1276155675
--- /dev/null
+++ b/test/files/pos/t8793.scala
@@ -0,0 +1,15 @@
+package regr
+
+trait F[A]
+
+class G(val a: F[_], val b: F[_])
+
+object G {
+ def unapply(g: G) = Option((g.a, g.b))
+}
+
+object H {
+ def unapply(g: G) = g match {
+ case G(a, _) => Option(a)
+ }
+}
diff --git a/test/files/pos/t8828.flags b/test/files/pos/t8828.flags
new file mode 100644
index 0000000000..e68991f643
--- /dev/null
+++ b/test/files/pos/t8828.flags
@@ -0,0 +1 @@
+-Xlint:inaccessible -Xfatal-warnings
diff --git a/test/files/pos/t8828.scala b/test/files/pos/t8828.scala
new file mode 100644
index 0000000000..92092b4dd4
--- /dev/null
+++ b/test/files/pos/t8828.scala
@@ -0,0 +1,20 @@
+
+package outer
+
+package inner {
+
+ private[inner] class A
+
+ // the class is final: no warning
+ private[outer] final class B {
+ def doWork(a: A): A = a
+ }
+
+ // the trait is sealed and doWork is not
+ // and cannot be overriden: no warning
+ private[outer] sealed trait C {
+ def doWork(a: A): A = a
+ }
+
+ private[outer] final class D extends C
+}