diff options
author | Paul Phillips <paulp@improving.org> | 2012-04-12 15:23:51 +0100 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-04-12 15:23:51 +0100 |
commit | e4976678fa7479c2a44f19b00cb691dc5b881609 (patch) | |
tree | 5b6749880f8662548979f5e57509258971854500 /test/files/neg | |
parent | f9e8a8c13ff6f75f330766ae6e0febe431fc4b12 (diff) | |
parent | 46d0d73f66111d5d31b9fd593972970d7e9056bb (diff) | |
download | scala-e4976678fa7479c2a44f19b00cb691dc5b881609.tar.gz scala-e4976678fa7479c2a44f19b00cb691dc5b881609.tar.bz2 scala-e4976678fa7479c2a44f19b00cb691dc5b881609.zip |
Merge commit 'refs/pull/375/head' into develop
Diffstat (limited to 'test/files/neg')
243 files changed, 1458 insertions, 180 deletions
diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index d785179a56..23af94180a 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -1,100 +1,100 @@ -checksensible.scala:13: error: comparing a fresh object using `eq' will always yield false - (new AnyRef) eq (new AnyRef) - ^ -checksensible.scala:14: error: comparing a fresh object using `ne' will always yield true - (new AnyRef) ne (new AnyRef) - ^ -checksensible.scala:15: error: comparing a fresh object using `eq' will always yield false - Shmoopie eq (new AnyRef) - ^ -checksensible.scala:16: error: comparing a fresh object using `eq' will always yield false - (Shmoopie: AnyRef) eq (new AnyRef) - ^ -checksensible.scala:17: error: comparing a fresh object using `eq' will always yield false - (new AnyRef) eq Shmoopie - ^ -checksensible.scala:18: error: comparing a fresh object using `eq' will always yield false - (new AnyRef) eq null - ^ -checksensible.scala:19: error: comparing a fresh object using `eq' will always yield false - null eq new AnyRef - ^ -checksensible.scala:26: error: comparing values of types Unit and Int using `==' will always yield false - (c = 1) == 0 - ^ -checksensible.scala:27: error: comparing values of types Int and Unit using `==' will always yield false - 0 == (c = 1) - ^ -checksensible.scala:29: error: comparing values of types Int and String using `==' will always yield false - 1 == "abc" - ^ -checksensible.scala:33: error: comparing values of types Some[Int] and Int using `==' will always yield false - Some(1) == 1 // as above - ^ -checksensible.scala:38: error: comparing a fresh object using `==' will always yield false - new AnyRef == 1 - ^ -checksensible.scala:41: error: comparing values of types Int and Boolean using `==' will always yield false - 1 == (new java.lang.Boolean(true)) - ^ -checksensible.scala:43: error: comparing values of types Int and Boolean using `!=' will always yield true - 1 != true - ^ -checksensible.scala:44: error: comparing values of types Unit and Boolean using `==' will always yield false - () == true - ^ -checksensible.scala:45: error: comparing values of types Unit and Unit using `==' will always yield true - () == () - ^ -checksensible.scala:46: error: comparing values of types Unit and Unit using `==' will always yield true - () == println - ^ -checksensible.scala:47: error: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true - () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false - ^ -checksensible.scala:48: error: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false - scala.runtime.BoxedUnit.UNIT != () - ^ -checksensible.scala:51: error: comparing values of types Int and Unit using `!=' will always yield true - (1 != println) - ^ -checksensible.scala:52: error: comparing values of types Int and Symbol using `!=' will always yield true - (1 != 'sym) - ^ -checksensible.scala:58: error: comparing a fresh object using `==' will always yield false - ((x: Int) => x + 1) == null - ^ -checksensible.scala:59: error: comparing a fresh object using `==' will always yield false - Bep == ((_: Int) + 1) - ^ -checksensible.scala:61: error: comparing a fresh object using `==' will always yield false - new Object == new Object - ^ -checksensible.scala:62: error: comparing a fresh object using `==' will always yield false - new Object == "abc" - ^ -checksensible.scala:63: error: comparing a fresh object using `!=' will always yield true - new Exception() != new Exception() - ^ -checksensible.scala:66: error: comparing values of types Int and Null using `==' will always yield false - if (foo.length == null) "plante" else "plante pas" - ^ -checksensible.scala:71: error: comparing values of types Bip and Bop using `==' will always yield false - (x1 == x2) - ^ -checksensible.scala:81: error: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false - c3 == z1 - ^ -checksensible.scala:82: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false - z1 == c3 - ^ -checksensible.scala:83: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true - z1 != c3 - ^ -checksensible.scala:84: error: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true - c3 != "abc" - ^ -checksensible.scala:95: error: comparing values of types Unit and Int using `!=' will always yield true - while ((c = in.read) != -1) - ^ -33 errors found +checksensible.scala:13: error: comparing a fresh object using `eq' will always yield false
+ (new AnyRef) eq (new AnyRef)
+ ^
+checksensible.scala:14: error: comparing a fresh object using `ne' will always yield true
+ (new AnyRef) ne (new AnyRef)
+ ^
+checksensible.scala:15: error: comparing a fresh object using `eq' will always yield false
+ Shmoopie eq (new AnyRef)
+ ^
+checksensible.scala:16: error: comparing a fresh object using `eq' will always yield false
+ (Shmoopie: AnyRef) eq (new AnyRef)
+ ^
+checksensible.scala:17: error: comparing a fresh object using `eq' will always yield false
+ (new AnyRef) eq Shmoopie
+ ^
+checksensible.scala:18: error: comparing a fresh object using `eq' will always yield false
+ (new AnyRef) eq null
+ ^
+checksensible.scala:19: error: comparing a fresh object using `eq' will always yield false
+ null eq new AnyRef
+ ^
+checksensible.scala:26: error: comparing values of types Unit and Int using `==' will always yield false
+ (c = 1) == 0
+ ^
+checksensible.scala:27: error: comparing values of types Int and Unit using `==' will always yield false
+ 0 == (c = 1)
+ ^
+checksensible.scala:29: error: comparing values of types Int and String using `==' will always yield false
+ 1 == "abc"
+ ^
+checksensible.scala:33: error: comparing values of types Some[Int] and Int using `==' will always yield false
+ Some(1) == 1 // as above
+ ^
+checksensible.scala:38: error: comparing a fresh object using `==' will always yield false
+ new AnyRef == 1
+ ^
+checksensible.scala:41: error: comparing values of types Int and Boolean using `==' will always yield false
+ 1 == (new java.lang.Boolean(true))
+ ^
+checksensible.scala:43: error: comparing values of types Int and Boolean using `!=' will always yield true
+ 1 != true
+ ^
+checksensible.scala:44: error: comparing values of types Unit and Boolean using `==' will always yield false
+ () == true
+ ^
+checksensible.scala:45: error: comparing values of types Unit and Unit using `==' will always yield true
+ () == ()
+ ^
+checksensible.scala:46: error: comparing values of types Unit and Unit using `==' will always yield true
+ () == println
+ ^
+checksensible.scala:47: error: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true
+ () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false
+ ^
+checksensible.scala:48: error: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false
+ scala.runtime.BoxedUnit.UNIT != ()
+ ^
+checksensible.scala:51: error: comparing values of types Int and Unit using `!=' will always yield true
+ (1 != println)
+ ^
+checksensible.scala:52: error: comparing values of types Int and Symbol using `!=' will always yield true
+ (1 != 'sym)
+ ^
+checksensible.scala:58: error: comparing a fresh object using `==' will always yield false
+ ((x: Int) => x + 1) == null
+ ^
+checksensible.scala:59: error: comparing a fresh object using `==' will always yield false
+ Bep == ((_: Int) + 1)
+ ^
+checksensible.scala:61: error: comparing a fresh object using `==' will always yield false
+ new Object == new Object
+ ^
+checksensible.scala:62: error: comparing a fresh object using `==' will always yield false
+ new Object == "abc"
+ ^
+checksensible.scala:63: error: comparing a fresh object using `!=' will always yield true
+ new Exception() != new Exception()
+ ^
+checksensible.scala:66: error: comparing values of types Int and Null using `==' will always yield false
+ if (foo.length == null) "plante" else "plante pas"
+ ^
+checksensible.scala:71: error: comparing values of types Bip and Bop using `==' will always yield false
+ (x1 == x2)
+ ^
+checksensible.scala:81: error: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false
+ c3 == z1
+ ^
+checksensible.scala:82: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false
+ z1 == c3
+ ^
+checksensible.scala:83: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true
+ z1 != c3
+ ^
+checksensible.scala:84: error: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true
+ c3 != "abc"
+ ^
+checksensible.scala:95: error: comparing values of types Unit and Int using `!=' will always yield true
+ while ((c = in.read) != -1)
+ ^
+33 errors found
diff --git a/test/files/neg/classtags_contextbound_a.check b/test/files/neg/classtags_contextbound_a.check new file mode 100644 index 0000000000..f4b6ff5af1 --- /dev/null +++ b/test/files/neg/classtags_contextbound_a.check @@ -0,0 +1,4 @@ +classtags_contextbound_a.scala:2: error: No ClassTag available for T
+ def foo[T] = Array[T]()
+ ^
+one error found
diff --git a/test/files/neg/classtags_contextbound_a.scala b/test/files/neg/classtags_contextbound_a.scala new file mode 100644 index 0000000000..d18beda341 --- /dev/null +++ b/test/files/neg/classtags_contextbound_a.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo[T] = Array[T]() + println(foo[Int].getClass) +}
\ No newline at end of file diff --git a/test/files/neg/classtags_contextbound_b.check b/test/files/neg/classtags_contextbound_b.check new file mode 100644 index 0000000000..f1f48bed72 --- /dev/null +++ b/test/files/neg/classtags_contextbound_b.check @@ -0,0 +1,4 @@ +classtags_contextbound_b.scala:3: error: No ClassTag available for T
+ def foo[T] = mkArray[T]
+ ^
+one error found
diff --git a/test/files/neg/classtags_contextbound_b.scala b/test/files/neg/classtags_contextbound_b.scala new file mode 100644 index 0000000000..3247a8ff29 --- /dev/null +++ b/test/files/neg/classtags_contextbound_b.scala @@ -0,0 +1,5 @@ +object Test extends App { + def mkArray[T: ClassTag] = Array[T]() + def foo[T] = mkArray[T] + println(foo[Int].getClass) +}
\ No newline at end of file diff --git a/test/files/neg/classtags_contextbound_c.check b/test/files/neg/classtags_contextbound_c.check new file mode 100644 index 0000000000..54f630862a --- /dev/null +++ b/test/files/neg/classtags_contextbound_c.check @@ -0,0 +1,4 @@ +classtags_contextbound_c.scala:2: error: No ClassTag available for T
+ def mkArray[T] = Array[T]()
+ ^
+one error found
diff --git a/test/files/neg/classtags_contextbound_c.scala b/test/files/neg/classtags_contextbound_c.scala new file mode 100644 index 0000000000..0b63f8407e --- /dev/null +++ b/test/files/neg/classtags_contextbound_c.scala @@ -0,0 +1,5 @@ +object Test extends App { + def mkArray[T] = Array[T]() + def foo[T: ClassTag] = mkArray[T] + println(foo[Int].getClass) +}
\ No newline at end of file diff --git a/test/files/neg/macro-argtype-mismatch/Macros_1.scala b/test/files/neg/macro-argtype-mismatch/Macros_1.scala deleted file mode 100644 index 4b5f98ba37..0000000000 --- a/test/files/neg/macro-argtype-mismatch/Macros_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Macros { - def macro foo(x: Int) = x -}
\ No newline at end of file diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check new file mode 100644 index 0000000000..eef444f7b3 --- /dev/null +++ b/test/files/neg/macro-basic-mamdmi.check @@ -0,0 +1,5 @@ +Impls_Macros_Test_1.scala:36: error: macro implementation not found: foo (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
+if you do need to define macro implementations along with the rest of your program, consider two-phase compilation with -Xmacro-fallback-classpath in the second phase pointing to the output of the first phase
+ println(foo(2) + Macros.bar(2) * new Macros().quux(4))
+ ^
+one error found
diff --git a/test/files/neg/macro-basic-mamdmi.flags b/test/files/neg/macro-basic-mamdmi.flags new file mode 100644 index 0000000000..06a7b31f11 --- /dev/null +++ b/test/files/neg/macro-basic-mamdmi.flags @@ -0,0 +1 @@ +-Xmacros diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala new file mode 100644 index 0000000000..e9876e32e9 --- /dev/null +++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala @@ -0,0 +1,37 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + Expr[Int](body) + } + + def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + Expr[Int](body) + } + + def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + Expr[Int](body) + } +} + +object Macros { + object Shmacros { + def foo(x: Int): Int = macro Impls.foo + } + def bar(x: Int): Int = macro Impls.bar +} + +class Macros { + def quux(x: Int): Int = macro Impls.quux +} + +object Test extends App { + import Macros.Shmacros._ + println(foo(2) + Macros.bar(2) * new Macros().quux(4)) +}
\ No newline at end of file diff --git a/test/files/neg/macro-cyclic.check b/test/files/neg/macro-cyclic.check new file mode 100644 index 0000000000..608381e0e8 --- /dev/null +++ b/test/files/neg/macro-cyclic.check @@ -0,0 +1,4 @@ +Impls_Macros_1.scala:5: error: could not find implicit value for parameter e: SourceLocation
+ c.reify { implicitly[SourceLocation] }
+ ^
+one error found
diff --git a/test/files/neg/macro-cyclic.flags b/test/files/neg/macro-cyclic.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-cyclic.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-cyclic/Impls_Macros_1.scala b/test/files/neg/macro-cyclic/Impls_Macros_1.scala new file mode 100644 index 0000000000..1ea06fc968 --- /dev/null +++ b/test/files/neg/macro-cyclic/Impls_Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.makro.Context + +object Macros { + def impl(c: Context) = { + c.reify { implicitly[SourceLocation] } + } + + implicit def sourceLocation: SourceLocation1 = macro impl +} + +trait SourceLocation { + /** Source location of the outermost call */ + val outer: SourceLocation + + /** The name of the source file */ + val fileName: String + + /** The line number */ + val line: Int + + /** The character offset */ + val charOffset: Int +} + +case class SourceLocation1(val outer: SourceLocation, val fileName: String, val line: Int, val charOffset: Int) extends SourceLocation diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check new file mode 100644 index 0000000000..c97be5d9f6 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check @@ -0,0 +1,14 @@ +Macros_Package_10.scala:1: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package `macro`
+ ^
+Macros_Package_10.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package `macro`.bar
+ ^
+Macros_Package_11.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package `macro`.foo
+ ^
+Main.scala:2: error: Unmatched closing brace '}' ignored here
+}
+^
+three warnings found
+one error found
diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Bind_12.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Bind_12.scala new file mode 100644 index 0000000000..97c07b04a0 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Bind_12.scala @@ -0,0 +1,6 @@ +object Test12 { + val Some(`macro`) = Some(42) + `macro` match { + case `macro` => println(`macro`) + } +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_4.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_4.scala new file mode 100644 index 0000000000..f0037b5f82 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_4.scala @@ -0,0 +1,3 @@ +package test4 + +class `macro` diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_5.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_5.scala new file mode 100644 index 0000000000..a6d0903cbb --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_5.scala @@ -0,0 +1,3 @@ +object Test5 { + class `macro` +} diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Def_13.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Def_13.scala new file mode 100644 index 0000000000..6af8e1d65e --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Def_13.scala @@ -0,0 +1,3 @@ +object Test13 { + def `macro` = 2 +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_6.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_6.scala new file mode 100644 index 0000000000..29dab017d2 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_6.scala @@ -0,0 +1,3 @@ +package test6 + +object `macro` diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_7.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_7.scala new file mode 100644 index 0000000000..6cbcac55ca --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_7.scala @@ -0,0 +1,3 @@ +object Test7 { + object `macro` +} diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_10.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_10.scala new file mode 100644 index 0000000000..4985d6691e --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_10.scala @@ -0,0 +1,3 @@ +package `macro` + +package `macro`.bar
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_11.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_11.scala new file mode 100644 index 0000000000..35ed610637 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_11.scala @@ -0,0 +1,3 @@ +package foo + +package `macro`.foo diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_8.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_8.scala new file mode 100644 index 0000000000..7895cf9a43 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_8.scala @@ -0,0 +1,3 @@ +package test8 + +trait `macro` diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_9.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_9.scala new file mode 100644 index 0000000000..90ba2207b7 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_9.scala @@ -0,0 +1,3 @@ +object Test9 { + trait `macro` +} diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Type_3.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Type_3.scala new file mode 100644 index 0000000000..7a2196c9cd --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Type_3.scala @@ -0,0 +1,3 @@ +object Test3 { + type `macro` = Int +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Val_1.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Val_1.scala new file mode 100644 index 0000000000..9ad08b8ba0 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Val_1.scala @@ -0,0 +1,3 @@ +object Test1 { + val `macro` = ??? +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Var_2.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Var_2.scala new file mode 100644 index 0000000000..4fbe152e76 --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Var_2.scala @@ -0,0 +1,3 @@ +object Test2 { + var `macro` = ??? +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Main.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Main.scala new file mode 100644 index 0000000000..f5278d9e7e --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Main.scala @@ -0,0 +1,2 @@ +object Test extends App +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents.check b/test/files/neg/macro-deprecate-idents.check new file mode 100644 index 0000000000..5fa1dc84d0 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents.check @@ -0,0 +1,50 @@ +Macros_Bind_12.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ val Some(macro) = Some(42)
+ ^
+Macros_Bind_12.scala:4: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ case macro => println(macro)
+ ^
+Macros_Class_4.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+class macro
+ ^
+Macros_Class_5.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ class macro
+ ^
+Macros_Def_13.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ def macro = 2
+ ^
+Macros_Object_6.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+object macro
+ ^
+Macros_Object_7.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ object macro
+ ^
+Macros_Package_10.scala:1: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package macro
+ ^
+Macros_Package_10.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package macro.bar
+ ^
+Macros_Package_11.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package macro.foo
+ ^
+Macros_Trait_8.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+trait macro
+ ^
+Macros_Trait_9.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ trait macro
+ ^
+Macros_Type_3.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ type macro = Int
+ ^
+Macros_Val_1.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ val macro = ???
+ ^
+Macros_Var_2.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ var macro = ???
+ ^
+Main.scala:2: error: Unmatched closing brace '}' ignored here
+}
+^
+15 warnings found
+one error found
diff --git a/test/files/neg/macro-deprecate-idents/Macros_Bind_12.scala b/test/files/neg/macro-deprecate-idents/Macros_Bind_12.scala new file mode 100644 index 0000000000..a3b1553348 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Bind_12.scala @@ -0,0 +1,6 @@ +object Test12 { + val Some(macro) = Some(42) + macro match { + case macro => println(macro) + } +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Class_4.scala b/test/files/neg/macro-deprecate-idents/Macros_Class_4.scala new file mode 100644 index 0000000000..8635d1f4f6 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Class_4.scala @@ -0,0 +1,3 @@ +package test4 + +class macro diff --git a/test/files/neg/macro-deprecate-idents/Macros_Class_5.scala b/test/files/neg/macro-deprecate-idents/Macros_Class_5.scala new file mode 100644 index 0000000000..af24a489d0 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Class_5.scala @@ -0,0 +1,3 @@ +object Test5 { + class macro +} diff --git a/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala b/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala new file mode 100644 index 0000000000..f4e25bfdfc --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala @@ -0,0 +1,3 @@ +object Test13 { + def macro = 2 +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Object_6.scala b/test/files/neg/macro-deprecate-idents/Macros_Object_6.scala new file mode 100644 index 0000000000..66eb494e6b --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Object_6.scala @@ -0,0 +1,3 @@ +package test6 + +object macro diff --git a/test/files/neg/macro-deprecate-idents/Macros_Object_7.scala b/test/files/neg/macro-deprecate-idents/Macros_Object_7.scala new file mode 100644 index 0000000000..6f5b9ceacd --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Object_7.scala @@ -0,0 +1,3 @@ +object Test7 { + object macro +} diff --git a/test/files/neg/macro-deprecate-idents/Macros_Package_10.scala b/test/files/neg/macro-deprecate-idents/Macros_Package_10.scala new file mode 100644 index 0000000000..52d3fbabf6 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Package_10.scala @@ -0,0 +1,3 @@ +package macro + +package macro.bar
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Package_11.scala b/test/files/neg/macro-deprecate-idents/Macros_Package_11.scala new file mode 100644 index 0000000000..a68ebd935f --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Package_11.scala @@ -0,0 +1,3 @@ +package foo + +package macro.foo diff --git a/test/files/neg/macro-deprecate-idents/Macros_Trait_8.scala b/test/files/neg/macro-deprecate-idents/Macros_Trait_8.scala new file mode 100644 index 0000000000..e32d4c1385 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Trait_8.scala @@ -0,0 +1,3 @@ +package test8 + +trait macro diff --git a/test/files/neg/macro-deprecate-idents/Macros_Trait_9.scala b/test/files/neg/macro-deprecate-idents/Macros_Trait_9.scala new file mode 100644 index 0000000000..243a54abe6 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Trait_9.scala @@ -0,0 +1,3 @@ +object Test9 { + trait macro +} diff --git a/test/files/neg/macro-deprecate-idents/Macros_Type_3.scala b/test/files/neg/macro-deprecate-idents/Macros_Type_3.scala new file mode 100644 index 0000000000..30e523bcaf --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Type_3.scala @@ -0,0 +1,3 @@ +object Test3 { + type macro = Int +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Val_1.scala b/test/files/neg/macro-deprecate-idents/Macros_Val_1.scala new file mode 100644 index 0000000000..96f57acb30 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Val_1.scala @@ -0,0 +1,3 @@ +object Test1 { + val macro = ??? +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Var_2.scala b/test/files/neg/macro-deprecate-idents/Macros_Var_2.scala new file mode 100644 index 0000000000..a79dda6dc2 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Macros_Var_2.scala @@ -0,0 +1,3 @@ +object Test2 { + var macro = ??? +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Main.scala b/test/files/neg/macro-deprecate-idents/Main.scala new file mode 100644 index 0000000000..f5278d9e7e --- /dev/null +++ b/test/files/neg/macro-deprecate-idents/Main.scala @@ -0,0 +1,2 @@ +object Test extends App +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-a.check b/test/files/neg/macro-invalidimpl-a.check new file mode 100644 index 0000000000..855fe2d169 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-a.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:3: error: macro implementation must be in statically accessible object
+ def foo(x: Any) = macro impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidimpl-a.flags b/test/files/neg/macro-invalidimpl-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-a.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-a/Impls_1.scala b/test/files/neg/macro-invalidimpl-a/Impls_1.scala new file mode 100644 index 0000000000..c2f1843b8b --- /dev/null +++ b/test/files/neg/macro-invalidimpl-a/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +class Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-invalidimpl-a/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl-a/Macros_Test_2.scala new file mode 100644 index 0000000000..2220ddae0c --- /dev/null +++ b/test/files/neg/macro-invalidimpl-a/Macros_Test_2.scala @@ -0,0 +1,9 @@ +object Macros { + val impls = new Impls + def foo(x: Any) = macro impls.foo +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-b.check b/test/files/neg/macro-invalidimpl-b.check new file mode 100644 index 0000000000..855fe2d169 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-b.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:3: error: macro implementation must be in statically accessible object
+ def foo(x: Any) = macro impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidimpl-b.flags b/test/files/neg/macro-invalidimpl-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-b.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-b/Impls_1.scala b/test/files/neg/macro-invalidimpl-b/Impls_1.scala new file mode 100644 index 0000000000..7b1620d117 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-b/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-invalidimpl-b/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl-b/Macros_Test_2.scala new file mode 100644 index 0000000000..81e40837d2 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-b/Macros_Test_2.scala @@ -0,0 +1,9 @@ +object Macros { + val impls = Impls + def foo(x: Any) = macro impls.foo +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-c.check b/test/files/neg/macro-invalidimpl-c.check new file mode 100644 index 0000000000..722ec3c7bd --- /dev/null +++ b/test/files/neg/macro-invalidimpl-c.check @@ -0,0 +1,4 @@ +Impls_Macros_1.scala:8: error: macro implementation must be in statically accessible object
+ def foo(x: Any) = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidimpl-c.flags b/test/files/neg/macro-invalidimpl-c.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-c.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-c/Impls_Macros_1.scala b/test/files/neg/macro-invalidimpl-c/Impls_Macros_1.scala new file mode 100644 index 0000000000..657e2d4260 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-c/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +class Macros { + object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? + } + + def foo(x: Any) = macro Impls.foo +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-c/Test_2.scala b/test/files/neg/macro-invalidimpl-c/Test_2.scala new file mode 100644 index 0000000000..e75a8ba101 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-c/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + new Macros().foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-d.check b/test/files/neg/macro-invalidimpl-d.check new file mode 100644 index 0000000000..6fedfa74fc --- /dev/null +++ b/test/files/neg/macro-invalidimpl-d.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:2: error: macro implementation must be in statically accessible object
+ def foo(x: Any) = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidimpl-d.flags b/test/files/neg/macro-invalidimpl-d.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-d.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-d/Impls_1.scala b/test/files/neg/macro-invalidimpl-d/Impls_1.scala new file mode 100644 index 0000000000..f18e699a1e --- /dev/null +++ b/test/files/neg/macro-invalidimpl-d/Impls_1.scala @@ -0,0 +1,7 @@ +import scala.reflect.makro.{Context => Ctx} + +trait MacroHelpers { + object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = x + } +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-d/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl-d/Macros_Test_2.scala new file mode 100644 index 0000000000..067ab1ddec --- /dev/null +++ b/test/files/neg/macro-invalidimpl-d/Macros_Test_2.scala @@ -0,0 +1,7 @@ +class Macros extends MacroHelpers { + def foo(x: Any) = macro Impls.foo +} + +object Test extends App { + println(new Macros().foo(42)) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-e.check b/test/files/neg/macro-invalidimpl-e.check new file mode 100644 index 0000000000..61d1e05b87 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-e.check @@ -0,0 +1,13 @@ +Macros_Test_2.scala:2: error: ambiguous reference to overloaded definition,
+both method foo in object Impls of type (c: scala.reflect.makro.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
+and method foo in object Impls of type (c: scala.reflect.makro.Context)(x: c.Expr[Any])Nothing
+match expected type ?
+ def foo(x: Any) = macro Impls.foo
+ ^
+Macros_Test_2.scala:3: error: ambiguous reference to overloaded definition,
+both method foo in object Impls of type (c: scala.reflect.makro.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
+and method foo in object Impls of type (c: scala.reflect.makro.Context)(x: c.Expr[Any])Nothing
+match expected type ?
+ def foo(x: Any, y: Any) = macro Impls.foo
+ ^
+two errors found
diff --git a/test/files/neg/macro-invalidimpl-e.flags b/test/files/neg/macro-invalidimpl-e.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-e.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-e/Impls_1.scala b/test/files/neg/macro-invalidimpl-e/Impls_1.scala new file mode 100644 index 0000000000..ad3eed5cd5 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-e/Impls_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? + def foo(c: Ctx)(x: c.Expr[Any], y: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-invalidimpl-e/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl-e/Macros_Test_2.scala new file mode 100644 index 0000000000..6edde08167 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-e/Macros_Test_2.scala @@ -0,0 +1,9 @@ +object Macros { + def foo(x: Any) = macro Impls.foo + def foo(x: Any, y: Any) = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-f.check b/test/files/neg/macro-invalidimpl-f.check new file mode 100644 index 0000000000..ec82faa58c --- /dev/null +++ b/test/files/neg/macro-invalidimpl-f.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context)(): c.Expr[Unit] + found : (c: scala.reflect.makro.Context): c.Expr[Unit] +number of parameter sections differ + def bar1() = macro Impls.fooNullary + ^ +one error found diff --git a/test/files/neg/macro-invalidimpl-f.flags b/test/files/neg/macro-invalidimpl-f.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-f.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-f/Impls_1.scala b/test/files/neg/macro-invalidimpl-f/Impls_1.scala new file mode 100644 index 0000000000..06c6efbb1f --- /dev/null +++ b/test/files/neg/macro-invalidimpl-f/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def fooNullary(c: Ctx) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + Expr[Unit](body) + } + + def fooEmpty(c: Ctx)() = fooNullary(c) +} diff --git a/test/files/neg/macro-invalidimpl-f/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl-f/Macros_Test_2.scala new file mode 100644 index 0000000000..493edf1df8 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-f/Macros_Test_2.scala @@ -0,0 +1,9 @@ +object Macros { + def bar1() = macro Impls.fooNullary +} + +object Test extends App { + Macros.bar1 + Macros.bar1() + println("kkthxbai") +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-g.check b/test/files/neg/macro-invalidimpl-g.check new file mode 100644 index 0000000000..9c01f01dc8 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-g.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.makro.Context): c.Expr[Unit]
+ found : (c: scala.reflect.makro.Context)(): c.Expr[Unit]
+number of parameter sections differ
+ def foo1 = macro Impls.fooEmpty
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidimpl-g.flags b/test/files/neg/macro-invalidimpl-g.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-g.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-g/Impls_1.scala b/test/files/neg/macro-invalidimpl-g/Impls_1.scala new file mode 100644 index 0000000000..06c6efbb1f --- /dev/null +++ b/test/files/neg/macro-invalidimpl-g/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def fooNullary(c: Ctx) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + Expr[Unit](body) + } + + def fooEmpty(c: Ctx)() = fooNullary(c) +} diff --git a/test/files/neg/macro-invalidimpl-g/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl-g/Macros_Test_2.scala new file mode 100644 index 0000000000..5561db9f9a --- /dev/null +++ b/test/files/neg/macro-invalidimpl-g/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo1 = macro Impls.fooEmpty +} + +object Test extends App { + Macros.foo1 + println("kkthxbai") +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-h.check b/test/files/neg/macro-invalidimpl-h.check new file mode 100644 index 0000000000..cc7fc794d3 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-h.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:2: error: type arguments [String] do not conform to method foo's type parameter bounds [U <: Int]
+ def foo = macro Impls.foo[String]
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidimpl-h.flags b/test/files/neg/macro-invalidimpl-h.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-h.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-h/Impls_1.scala b/test/files/neg/macro-invalidimpl-h/Impls_1.scala new file mode 100644 index 0000000000..7db8bcd324 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-h/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U <: Int](c: Ctx) = ??? +} diff --git a/test/files/neg/macro-invalidimpl-h/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl-h/Macros_Test_2.scala new file mode 100644 index 0000000000..218c7aec7f --- /dev/null +++ b/test/files/neg/macro-invalidimpl-h/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo[String] +} + +object Test extends App { + import Macros._ + foo +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidret-nontree.check b/test/files/neg/macro-invalidret-nontree.check new file mode 100644 index 0000000000..7fcc396463 --- /dev/null +++ b/test/files/neg/macro-invalidret-nontree.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context): c.Expr[Any] + found : (c: scala.reflect.makro.Context): Int +type mismatch for return type : c.Expr[Any] does not conform to Int + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidret-nontree.flags b/test/files/neg/macro-invalidret-nontree.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidret-nontree.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidret-nontree/Impls_1.scala b/test/files/neg/macro-invalidret-nontree/Impls_1.scala new file mode 100644 index 0000000000..efc8d4bfec --- /dev/null +++ b/test/files/neg/macro-invalidret-nontree/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = 2 +} diff --git a/test/files/neg/macro-invalidret-nontree/Macros_Test_2.scala b/test/files/neg/macro-invalidret-nontree/Macros_Test_2.scala new file mode 100644 index 0000000000..96a8de2832 --- /dev/null +++ b/test/files/neg/macro-invalidret-nontree/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidret-nonuniversetree.check b/test/files/neg/macro-invalidret-nonuniversetree.check new file mode 100644 index 0000000000..a97d6daaa9 --- /dev/null +++ b/test/files/neg/macro-invalidret-nonuniversetree.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context): c.Expr[Any] + found : (c: scala.reflect.makro.Context): reflect.mirror.Literal +type mismatch for return type : c.Expr[Any] does not conform to reflect.mirror.Literal + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidret-nonuniversetree.flags b/test/files/neg/macro-invalidret-nonuniversetree.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidret-nonuniversetree.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala new file mode 100644 index 0000000000..86b7c8d8d0 --- /dev/null +++ b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = scala.reflect.mirror.Literal(scala.reflect.mirror.Constant(42)) +} diff --git a/test/files/neg/macro-invalidret-nonuniversetree/Macros_Test_2.scala b/test/files/neg/macro-invalidret-nonuniversetree/Macros_Test_2.scala new file mode 100644 index 0000000000..96a8de2832 --- /dev/null +++ b/test/files/neg/macro-invalidret-nonuniversetree/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidshape-a.check b/test/files/neg/macro-invalidshape-a.check new file mode 100644 index 0000000000..246b5c3226 --- /dev/null +++ b/test/files/neg/macro-invalidshape-a.check @@ -0,0 +1,6 @@ +Macros_Test_2.scala:2: error: macro body has wrong shape:
+ required: macro <reference to implementation object>.<implementation method name>
+ or : macro <implementation method name>
+ def foo(x: Any) = macro 2
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidshape-a.flags b/test/files/neg/macro-invalidshape-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidshape-a.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidshape-a/Impls_1.scala b/test/files/neg/macro-invalidshape-a/Impls_1.scala new file mode 100644 index 0000000000..7b1620d117 --- /dev/null +++ b/test/files/neg/macro-invalidshape-a/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-invalidshape-a/Macros_Test_2.scala b/test/files/neg/macro-invalidshape-a/Macros_Test_2.scala new file mode 100644 index 0000000000..ffff17d1e7 --- /dev/null +++ b/test/files/neg/macro-invalidshape-a/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Any) = macro 2 +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidshape-b.check b/test/files/neg/macro-invalidshape-b.check new file mode 100644 index 0000000000..59701d023b --- /dev/null +++ b/test/files/neg/macro-invalidshape-b.check @@ -0,0 +1,6 @@ +Macros_Test_2.scala:2: error: macro body has wrong shape:
+ required: macro <reference to implementation object>.<implementation method name>
+ or : macro <implementation method name>
+ def foo(x: Any) = macro Impls.foo(null)(null)
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidshape-b.flags b/test/files/neg/macro-invalidshape-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidshape-b.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidshape-b/Impls_1.scala b/test/files/neg/macro-invalidshape-b/Impls_1.scala new file mode 100644 index 0000000000..7b1620d117 --- /dev/null +++ b/test/files/neg/macro-invalidshape-b/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-invalidshape-b/Macros_Test_2.scala b/test/files/neg/macro-invalidshape-b/Macros_Test_2.scala new file mode 100644 index 0000000000..b67cd32a6e --- /dev/null +++ b/test/files/neg/macro-invalidshape-b/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Any) = macro Impls.foo(null)(null) +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidshape-c.check b/test/files/neg/macro-invalidshape-c.check new file mode 100644 index 0000000000..84d8c35222 --- /dev/null +++ b/test/files/neg/macro-invalidshape-c.check @@ -0,0 +1,6 @@ +Macros_Test_2.scala:2: error: macro body has wrong shape:
+ required: macro <reference to implementation object>.<implementation method name>
+ or : macro <implementation method name>
+ def foo(x: Any) = macro {2; Impls.foo}
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidshape-c.flags b/test/files/neg/macro-invalidshape-c.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidshape-c.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidshape-c/Impls_1.scala b/test/files/neg/macro-invalidshape-c/Impls_1.scala new file mode 100644 index 0000000000..7b1620d117 --- /dev/null +++ b/test/files/neg/macro-invalidshape-c/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-invalidshape-c/Macros_Test_2.scala b/test/files/neg/macro-invalidshape-c/Macros_Test_2.scala new file mode 100644 index 0000000000..552c3710c7 --- /dev/null +++ b/test/files/neg/macro-invalidshape-c/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Any) = macro {2; Impls.foo} +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidshape-d.check b/test/files/neg/macro-invalidshape-d.check new file mode 100644 index 0000000000..031aa653ab --- /dev/null +++ b/test/files/neg/macro-invalidshape-d.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:2: error: illegal start of statement
+ def foo(x: Any) = {2; macro Impls.foo}
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidshape-d.flags b/test/files/neg/macro-invalidshape-d.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidshape-d.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidshape-d/Impls_1.scala b/test/files/neg/macro-invalidshape-d/Impls_1.scala new file mode 100644 index 0000000000..7b1620d117 --- /dev/null +++ b/test/files/neg/macro-invalidshape-d/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-invalidshape-d/Macros_Test_2.scala b/test/files/neg/macro-invalidshape-d/Macros_Test_2.scala new file mode 100644 index 0000000000..bacd9a6e7c --- /dev/null +++ b/test/files/neg/macro-invalidshape-d/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Any) = {2; macro Impls.foo} +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check new file mode 100644 index 0000000000..dd68e5db1b --- /dev/null +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -0,0 +1,4 @@ +Impls_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences
+ def foo[U: c.TypeTag: Numeric](c: Ctx) = {
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-context-bounds.flags b/test/files/neg/macro-invalidsig-context-bounds.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-context-bounds.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala new file mode 100644 index 0000000000..2eb2ab3947 --- /dev/null +++ b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala @@ -0,0 +1,8 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U: c.TypeTag: Numeric](c: Ctx) = { + import c.mirror._ + Literal(Constant(42)) + } +} diff --git a/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala new file mode 100644 index 0000000000..5b4602f328 --- /dev/null +++ b/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo[U] = macro Impls.foo[U] +} + +object Test extends App { + import Macros._ + println(foo[String]) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-badargc.check b/test/files/neg/macro-invalidsig-ctx-badargc.check new file mode 100644 index 0000000000..1e1621ab61 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badargc.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context): c.Expr[Any] + found : : Nothing +number of parameter sections differ + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-ctx-badargc.flags b/test/files/neg/macro-invalidsig-ctx-badargc.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badargc.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala new file mode 100644 index 0000000000..da28944d27 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.api.{Mirror => Ctx} + +object Impls { + def foo = ??? +} diff --git a/test/files/neg/macro-invalidsig-ctx-badargc/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-ctx-badargc/Macros_Test_2.scala new file mode 100644 index 0000000000..96a8de2832 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badargc/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-badtype.check b/test/files/neg/macro-invalidsig-ctx-badtype.check new file mode 100644 index 0000000000..3913a8e3cb --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badtype.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context): c.Expr[Any] + found : (c: scala.reflect.api.Mirror): Nothing +type mismatch for parameter c: scala.reflect.makro.Context does not conform to scala.reflect.api.Mirror + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-ctx-badtype.flags b/test/files/neg/macro-invalidsig-ctx-badtype.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badtype.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala new file mode 100644 index 0000000000..747a2e9ca8 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.api.{Mirror => Ctx} + +object Impls { + def foo(c: Ctx) = ??? +} diff --git a/test/files/neg/macro-invalidsig-ctx-badtype/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-ctx-badtype/Macros_Test_2.scala new file mode 100644 index 0000000000..96a8de2832 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badtype/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-badvarargs.check b/test/files/neg/macro-invalidsig-ctx-badvarargs.check new file mode 100644 index 0000000000..18e3d6201f --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badvarargs.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context): c.Expr[Any] + found : (cs: scala.reflect.makro.Context*): Nothing +types incompatible for parameter cs: corresponding is not a vararg parameter + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-ctx-badvarargs.flags b/test/files/neg/macro-invalidsig-ctx-badvarargs.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badvarargs.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-badvarargs/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-badvarargs/Impls_1.scala new file mode 100644 index 0000000000..b2fb2539ec --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badvarargs/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(cs: Ctx*) = ??? +} diff --git a/test/files/neg/macro-invalidsig-ctx-badvarargs/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-ctx-badvarargs/Macros_Test_2.scala new file mode 100644 index 0000000000..96a8de2832 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-badvarargs/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-noctx.check b/test/files/neg/macro-invalidsig-ctx-noctx.check new file mode 100644 index 0000000000..66fa7c3514 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-noctx.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context)(x: c.Expr[Any]): c.Expr[Any] + found : (c: scala.reflect.makro.Context): Nothing +number of parameter sections differ + def foo(x: Any) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-ctx-noctx.flags b/test/files/neg/macro-invalidsig-ctx-noctx.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-noctx.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-noctx/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-noctx/Impls_1.scala new file mode 100644 index 0000000000..1e0ed755af --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-noctx/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = ??? +} diff --git a/test/files/neg/macro-invalidsig-ctx-noctx/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-ctx-noctx/Macros_Test_2.scala new file mode 100644 index 0000000000..e053cf99df --- /dev/null +++ b/test/files/neg/macro-invalidsig-ctx-noctx/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Any) = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check new file mode 100644 index 0000000000..0dd1c27b50 --- /dev/null +++ b/test/files/neg/macro-invalidsig-implicit-params.check @@ -0,0 +1,4 @@ +Impls_Macros_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences
+ def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-implicit-params.flags b/test/files/neg/macro-invalidsig-implicit-params.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-implicit-params.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala new file mode 100644 index 0000000000..662ad2ab52 --- /dev/null +++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { + import c.{prefix => prefix} + import c.mirror._ + val body = Block( + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.TypeTag[U]].tpe)))), + Literal(Constant(()))) + Expr[Unit](body) + } +} + +class Macros[T] { + def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U] +} diff --git a/test/files/neg/macro-invalidsig-implicit-params/Test_2.scala b/test/files/neg/macro-invalidsig-implicit-params/Test_2.scala new file mode 100644 index 0000000000..90e850df21 --- /dev/null +++ b/test/files/neg/macro-invalidsig-implicit-params/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println("foo_targs:") + new Macros[Int]().foo_targs[String](42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badargc.check b/test/files/neg/macro-invalidsig-params-badargc.check new file mode 100644 index 0000000000..6de8c5e95a --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badargc.check @@ -0,0 +1,7 @@ +Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context)(x: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.makro.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing +parameter lists have different length, found extra parameter y: c.Expr[Int] + def foo(x: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-params-badargc.flags b/test/files/neg/macro-invalidsig-params-badargc.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badargc.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badargc/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badargc/Impls_Macros_1.scala new file mode 100644 index 0000000000..4b449f35ed --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badargc/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = ??? +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/test/files/neg/macro-noexpand/Test_2.scala b/test/files/neg/macro-invalidsig-params-badargc/Test_2.scala index 0bed592883..cbd6232073 100644 --- a/test/files/neg/macro-noexpand/Test_2.scala +++ b/test/files/neg/macro-invalidsig-params-badargc/Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { import Macros._ - foo(x) + foo(42) }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check new file mode 100644 index 0000000000..71a65aec84 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -0,0 +1,7 @@ +Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context)(x: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.makro.Context)(x: c.mirror.Tree): Nothing +type mismatch for parameter x: c.Expr[Int] does not conform to c.mirror.Tree + def foo(x: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-params-badtype.flags b/test/files/neg/macro-invalidsig-params-badtype.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badtype.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala new file mode 100644 index 0000000000..29220c1c82 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.mirror.Tree) = ??? +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/test/files/neg/macro-argtype-mismatch/Test_2.scala b/test/files/neg/macro-invalidsig-params-badtype/Test_2.scala index 18feb69425..cbd6232073 100644 --- a/test/files/neg/macro-argtype-mismatch/Test_2.scala +++ b/test/files/neg/macro-invalidsig-params-badtype/Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { import Macros._ - foo("2") + foo(42) }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badvarargs.check b/test/files/neg/macro-invalidsig-params-badvarargs.check new file mode 100644 index 0000000000..0827680299 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badvarargs.check @@ -0,0 +1,7 @@ +Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.makro.Context)(xs: c.Expr[Int]*): Nothing +parameter lists have different length, required extra parameter y: c.Expr[Int] + def foo(x: Int, y: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-params-badvarargs.flags b/test/files/neg/macro-invalidsig-params-badvarargs.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badvarargs.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badvarargs/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badvarargs/Impls_Macros_1.scala new file mode 100644 index 0000000000..2ee1c2767c --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badvarargs/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(xs: c.Expr[Int]*) = ??? +} + +object Macros { + def foo(x: Int, y: Int) = macro Impls.foo +} diff --git a/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala b/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala new file mode 100644 index 0000000000..cbd6232073 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-namemismatch.check b/test/files/neg/macro-invalidsig-params-namemismatch.check new file mode 100644 index 0000000000..ca7270cca8 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-namemismatch.check @@ -0,0 +1,7 @@ +Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.makro.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing +parameter names differ: x != y + def foo(x: Int, y: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-params-namemismatch.flags b/test/files/neg/macro-invalidsig-params-namemismatch.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-namemismatch.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-namemismatch/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-namemismatch/Impls_Macros_1.scala new file mode 100644 index 0000000000..89c5347647 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-namemismatch/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(y: c.Expr[Int], x: c.Expr[Int]) = ??? +} + +object Macros { + def foo(x: Int, y: Int) = macro Impls.foo +} diff --git a/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala b/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala new file mode 100644 index 0000000000..cbd6232073 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-badtype.check b/test/files/neg/macro-invalidsig-tparams-badtype.check new file mode 100644 index 0000000000..bd1acc4a0a --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-badtype.check @@ -0,0 +1,7 @@ +Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.makro.Context): c.Expr[Any]
+ found : (c: scala.reflect.makro.Context)(U: c.mirror.Type): Nothing
+number of parameter sections differ
+ def foo[U] = macro Impls.foo[U]
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-badtype.flags b/test/files/neg/macro-invalidsig-tparams-badtype.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-badtype.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala new file mode 100644 index 0000000000..b43251df33 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U](c: Ctx)(U: c.mirror.Type) = ??? +} diff --git a/test/files/neg/macro-invalidsig-tparams-badtype/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-tparams-badtype/Macros_Test_2.scala new file mode 100644 index 0000000000..a82e813221 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-badtype/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo[U] = macro Impls.foo[U] +} + +object Test extends App { + import Macros._ + foo[Int] +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-a.check b/test/files/neg/macro-invalidsig-tparams-bounds-a.check new file mode 100644 index 0000000000..6ba80b45c0 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-bounds-a.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:2: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String]
+ def foo[U] = macro Impls.foo[U]
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-a.flags b/test/files/neg/macro-invalidsig-tparams-bounds-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-bounds-a.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-bounds-a/Impls_1.scala new file mode 100644 index 0000000000..88b85d48f4 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-bounds-a/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U <: String](c: Ctx) = ??? +} diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-a/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-tparams-bounds-a/Macros_Test_2.scala new file mode 100644 index 0000000000..a82e813221 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-bounds-a/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo[U] = macro Impls.foo[U] +} + +object Test extends App { + import Macros._ + foo[Int] +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-b.check b/test/files/neg/macro-invalidsig-tparams-bounds-b.check new file mode 100644 index 0000000000..50f0944acc --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-bounds-b.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:2: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String]
+ def foo[U <: Int] = macro Impls.foo[U]
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-b.flags b/test/files/neg/macro-invalidsig-tparams-bounds-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-bounds-b.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-bounds-b/Impls_1.scala new file mode 100644 index 0000000000..88b85d48f4 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-bounds-b/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U <: String](c: Ctx) = ??? +} diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-b/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-tparams-bounds-b/Macros_Test_2.scala new file mode 100644 index 0000000000..eed6369a16 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-bounds-b/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo[U <: Int] = macro Impls.foo[U] +} + +object Test extends App { + import Macros._ + foo[Int] +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a.check b/test/files/neg/macro-invalidsig-tparams-notparams-a.check new file mode 100644 index 0000000000..5b4ef42ea5 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:2: error: macro implementation reference needs type arguments
+ def foo = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a.flags b/test/files/neg/macro-invalidsig-tparams-notparams-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala new file mode 100644 index 0000000000..bbe5b4e519 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U: c.TypeTag](c: Ctx) = ??? +} diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Macros_Test_2.scala new file mode 100644 index 0000000000..96a8de2832 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b.check b/test/files/neg/macro-invalidsig-tparams-notparams-b.check new file mode 100644 index 0000000000..261e3b8293 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:3: error: macro implementation reference needs type arguments
+ def foo[V] = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b.flags b/test/files/neg/macro-invalidsig-tparams-notparams-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala new file mode 100644 index 0000000000..7bc46ff876 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T: c.TypeTag, U: c.TypeTag, V](c: Ctx)(implicit V: c.TypeTag[V]): c.Expr[Unit] = { + import c.mirror._ + println(implicitly[c.TypeTag[T]]) + println(implicitly[c.TypeTag[U]]) + println(V) + Literal(Constant(())) + } +} diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Macros_Test_2.scala new file mode 100644 index 0000000000..7d02bf613a --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Macros_Test_2.scala @@ -0,0 +1,11 @@ +class D[T] { + class C[U] { + def foo[V] = macro Impls.foo + } +} + +object Test extends App { + val outer1 = new D[Int] + val outer2 = new outer1.C[String] + outer2.foo[Boolean] +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c.check b/test/files/neg/macro-invalidsig-tparams-notparams-c.check new file mode 100644 index 0000000000..b64a469cc3 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.makro.Context)(implicit evidence$1: c.TypeTag[T], implicit evidence$2: c.TypeTag[U], implicit V: c.TypeTag[V])c.Expr[Unit]
+ def foo[V] = macro Impls.foo[V]
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c.flags b/test/files/neg/macro-invalidsig-tparams-notparams-c.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala new file mode 100644 index 0000000000..7bc46ff876 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T: c.TypeTag, U: c.TypeTag, V](c: Ctx)(implicit V: c.TypeTag[V]): c.Expr[Unit] = { + import c.mirror._ + println(implicitly[c.TypeTag[T]]) + println(implicitly[c.TypeTag[U]]) + println(V) + Literal(Constant(())) + } +} diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Macros_Test_2.scala new file mode 100644 index 0000000000..109e142e52 --- /dev/null +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Macros_Test_2.scala @@ -0,0 +1,11 @@ +class D[T] { + class C[U] { + def foo[V] = macro Impls.foo[V] + } +} + +object Test extends App { + val outer1 = new D[Int] + val outer2 = new outer1.C[String] + outer2.foo[Boolean] +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-badargs.check b/test/files/neg/macro-invalidusage-badargs.check new file mode 100644 index 0000000000..52beda5b61 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badargs.check @@ -0,0 +1,6 @@ +Macros_Test_2.scala:7: error: type mismatch;
+ found : String("42")
+ required: Int
+ val s: String = foo("42")
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidusage-badargs.flags b/test/files/neg/macro-invalidusage-badargs.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badargs.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-badargs/Impls_1.scala b/test/files/neg/macro-invalidusage-badargs/Impls_1.scala new file mode 100644 index 0000000000..2346a6106d --- /dev/null +++ b/test/files/neg/macro-invalidusage-badargs/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = x +} diff --git a/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala new file mode 100644 index 0000000000..a6af1bb277 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Int) = macro Impls.foo +} + +object Test extends App { + import Macros._ + val s: String = foo("42") +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-badbounds.check b/test/files/neg/macro-invalidusage-badbounds.check new file mode 100644 index 0000000000..fd0b64533e --- /dev/null +++ b/test/files/neg/macro-invalidusage-badbounds.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:7: error: type arguments [Int] do not conform to macro method foo's type parameter bounds [U <: String]
+ foo[Int]
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidusage-badbounds.flags b/test/files/neg/macro-invalidusage-badbounds.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badbounds.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala new file mode 100644 index 0000000000..88b85d48f4 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U <: String](c: Ctx) = ??? +} diff --git a/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala new file mode 100644 index 0000000000..3139599108 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo[U <: String] = macro Impls.foo[U] +} + +object Test extends App { + import Macros._ + foo[Int] +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-badtargs.check b/test/files/neg/macro-invalidusage-badtargs.check new file mode 100644 index 0000000000..61ef6f5af7 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badtargs.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:7: error: macro method foo: (x: Int)Int does not take type parameters.
+ val s: String = foo[String](42)
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidusage-badtargs.flags b/test/files/neg/macro-invalidusage-badtargs.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badtargs.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala b/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala new file mode 100644 index 0000000000..2346a6106d --- /dev/null +++ b/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = x +} diff --git a/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala new file mode 100644 index 0000000000..c54093b637 --- /dev/null +++ b/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Int) = macro Impls.foo +} + +object Test extends App { + import Macros._ + val s: String = foo[String](42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax.check b/test/files/neg/macro-invalidusage-methodvaluesyntax.check new file mode 100644 index 0000000000..27b2023202 --- /dev/null +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:6: error: macros cannot be eta-expanded
+ val firstClassFoo = Macros.foo _
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax.flags b/test/files/neg/macro-invalidusage-methodvaluesyntax.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala new file mode 100644 index 0000000000..8e52613b6d --- /dev/null +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + Expr[Unit](body) + } +} diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala new file mode 100644 index 0000000000..343cec99b5 --- /dev/null +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo +} + +object Test extends App { + val firstClassFoo = Macros.foo _ + firstClassFoo +}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword.check b/test/files/neg/macro-keyword.check new file mode 100644 index 0000000000..fd63db951c --- /dev/null +++ b/test/files/neg/macro-keyword.check @@ -0,0 +1,49 @@ +Macros_Bind_12.scala:2: error: illegal start of simple pattern
+ val Some(macro) = Some(42)
+ ^
+Macros_Bind_12.scala:6: error: ')' expected but '}' found.
+}
+^
+Macros_Class_4.scala:3: error: identifier expected but 'macro' found.
+class macro
+ ^
+Macros_Class_5.scala:2: error: identifier expected but 'macro' found.
+ class macro
+ ^
+Macros_Def_13.scala:2: error: identifier expected but 'macro' found.
+ def macro = 2
+ ^
+Macros_Object_6.scala:3: error: identifier expected but 'macro' found.
+object macro
+ ^
+Macros_Object_7.scala:2: error: identifier expected but 'macro' found.
+ object macro
+ ^
+Macros_Package_10.scala:1: error: identifier expected but 'macro' found.
+package macro
+ ^
+Macros_Package_11.scala:3: error: identifier expected but 'macro' found.
+package macro.foo
+ ^
+Macros_Trait_8.scala:3: error: identifier expected but 'macro' found.
+trait macro
+ ^
+Macros_Trait_9.scala:2: error: identifier expected but 'macro' found.
+ trait macro
+ ^
+Macros_Type_3.scala:2: error: identifier expected but 'macro' found.
+ type macro = Int
+ ^
+Macros_Val_1.scala:2: error: illegal start of simple pattern
+ val macro = ???
+ ^
+Macros_Val_1.scala:3: error: '=' expected but '}' found.
+}
+^
+Macros_Var_2.scala:2: error: illegal start of simple pattern
+ var macro = ???
+ ^
+Macros_Var_2.scala:3: error: '=' expected but '}' found.
+}
+^
+16 errors found
diff --git a/test/files/neg/macro-keyword.flags b/test/files/neg/macro-keyword.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Bind_12.scala b/test/files/neg/macro-keyword/Macros_Bind_12.scala new file mode 100644 index 0000000000..a3b1553348 --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Bind_12.scala @@ -0,0 +1,6 @@ +object Test12 { + val Some(macro) = Some(42) + macro match { + case macro => println(macro) + } +}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Class_4.scala b/test/files/neg/macro-keyword/Macros_Class_4.scala new file mode 100644 index 0000000000..8635d1f4f6 --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Class_4.scala @@ -0,0 +1,3 @@ +package test4 + +class macro diff --git a/test/files/neg/macro-keyword/Macros_Class_5.scala b/test/files/neg/macro-keyword/Macros_Class_5.scala new file mode 100644 index 0000000000..af24a489d0 --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Class_5.scala @@ -0,0 +1,3 @@ +object Test5 { + class macro +} diff --git a/test/files/neg/macro-keyword/Macros_Def_13.scala b/test/files/neg/macro-keyword/Macros_Def_13.scala new file mode 100644 index 0000000000..f4e25bfdfc --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Def_13.scala @@ -0,0 +1,3 @@ +object Test13 { + def macro = 2 +}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Object_6.scala b/test/files/neg/macro-keyword/Macros_Object_6.scala new file mode 100644 index 0000000000..66eb494e6b --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Object_6.scala @@ -0,0 +1,3 @@ +package test6 + +object macro diff --git a/test/files/neg/macro-keyword/Macros_Object_7.scala b/test/files/neg/macro-keyword/Macros_Object_7.scala new file mode 100644 index 0000000000..6f5b9ceacd --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Object_7.scala @@ -0,0 +1,3 @@ +object Test7 { + object macro +} diff --git a/test/files/neg/macro-keyword/Macros_Package_10.scala b/test/files/neg/macro-keyword/Macros_Package_10.scala new file mode 100644 index 0000000000..52d3fbabf6 --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Package_10.scala @@ -0,0 +1,3 @@ +package macro + +package macro.bar
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Package_11.scala b/test/files/neg/macro-keyword/Macros_Package_11.scala new file mode 100644 index 0000000000..a68ebd935f --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Package_11.scala @@ -0,0 +1,3 @@ +package foo + +package macro.foo diff --git a/test/files/neg/macro-keyword/Macros_Trait_8.scala b/test/files/neg/macro-keyword/Macros_Trait_8.scala new file mode 100644 index 0000000000..e32d4c1385 --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Trait_8.scala @@ -0,0 +1,3 @@ +package test8 + +trait macro diff --git a/test/files/neg/macro-keyword/Macros_Trait_9.scala b/test/files/neg/macro-keyword/Macros_Trait_9.scala new file mode 100644 index 0000000000..243a54abe6 --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Trait_9.scala @@ -0,0 +1,3 @@ +object Test9 { + trait macro +} diff --git a/test/files/neg/macro-keyword/Macros_Type_3.scala b/test/files/neg/macro-keyword/Macros_Type_3.scala new file mode 100644 index 0000000000..30e523bcaf --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Type_3.scala @@ -0,0 +1,3 @@ +object Test3 { + type macro = Int +}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Val_1.scala b/test/files/neg/macro-keyword/Macros_Val_1.scala new file mode 100644 index 0000000000..96f57acb30 --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Val_1.scala @@ -0,0 +1,3 @@ +object Test1 { + val macro = ??? +}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Var_2.scala b/test/files/neg/macro-keyword/Macros_Var_2.scala new file mode 100644 index 0000000000..a79dda6dc2 --- /dev/null +++ b/test/files/neg/macro-keyword/Macros_Var_2.scala @@ -0,0 +1,3 @@ +object Test2 { + var macro = ??? +}
\ No newline at end of file diff --git a/test/files/neg/macro-noexpand.check b/test/files/neg/macro-noexpand.check index c15d54bb32..c829bbab71 100644 --- a/test/files/neg/macro-noexpand.check +++ b/test/files/neg/macro-noexpand.check @@ -1,4 +1,4 @@ -Test_2.scala:3: error: not found: value x
+Macros_Test_2.scala:7: error: not found: value x
foo(x)
^
one error found
diff --git a/test/files/neg/macro-noexpand/Impls_1.scala b/test/files/neg/macro-noexpand/Impls_1.scala new file mode 100644 index 0000000000..7b1620d117 --- /dev/null +++ b/test/files/neg/macro-noexpand/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-noexpand/Macros_1.scala b/test/files/neg/macro-noexpand/Macros_1.scala deleted file mode 100644 index 7a6aadf6a1..0000000000 --- a/test/files/neg/macro-noexpand/Macros_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Macros { - def macro foo(x: Any) = ??? -}
\ No newline at end of file diff --git a/test/files/neg/macro-noexpand/Macros_Test_2.scala b/test/files/neg/macro-noexpand/Macros_Test_2.scala new file mode 100644 index 0000000000..e783e2b53e --- /dev/null +++ b/test/files/neg/macro-noexpand/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Any) = macro Impls.foo +} + +object Test extends App { + import Macros._ + foo(x) +}
\ No newline at end of file diff --git a/test/files/neg/macro-noncompilertree/Macros_1.scala b/test/files/neg/macro-noncompilertree/Macros_1.scala deleted file mode 100644 index eb1253e5e9..0000000000 --- a/test/files/neg/macro-noncompilertree/Macros_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Macros { - def macro foo = scala.reflect.mirror.Literal(scala.reflect.mirror.Constant(2)) -}
\ No newline at end of file diff --git a/test/files/neg/macro-nontree/Macros_1.scala b/test/files/neg/macro-nontree/Macros_1.scala deleted file mode 100644 index 2433974a85..0000000000 --- a/test/files/neg/macro-nontree/Macros_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Macros { - def macro foo = 2 -}
\ No newline at end of file diff --git a/test/files/neg/macro-nontypeablebody.check b/test/files/neg/macro-nontypeablebody.check new file mode 100644 index 0000000000..0cfc864df8 --- /dev/null +++ b/test/files/neg/macro-nontypeablebody.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:2: error: value foo2 is not a member of object Impls
+ def foo(x: Any) = macro Impls.foo2
+ ^
+one error found
diff --git a/test/files/neg/macro-nontypeablebody.flags b/test/files/neg/macro-nontypeablebody.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-nontypeablebody.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-nontypeablebody/Impls_1.scala b/test/files/neg/macro-nontypeablebody/Impls_1.scala new file mode 100644 index 0000000000..7b1620d117 --- /dev/null +++ b/test/files/neg/macro-nontypeablebody/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = ??? +} diff --git a/test/files/neg/macro-nontypeablebody/Macros_Test_2.scala b/test/files/neg/macro-nontypeablebody/Macros_Test_2.scala new file mode 100644 index 0000000000..2031893970 --- /dev/null +++ b/test/files/neg/macro-nontypeablebody/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(x: Any) = macro Impls.foo2 +} + +object Test extends App { + import Macros._ + foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check new file mode 100644 index 0000000000..4d95dfc45c --- /dev/null +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check @@ -0,0 +1,5 @@ +Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int;
+ macro method foo cannot override an abstract method
+ def foo(x: Int) = macro Impls.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a.flags b/test/files/neg/macro-override-macro-overrides-abstract-method-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala new file mode 100644 index 0000000000..cb0b152852 --- /dev/null +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def impl(c: Ctx)(x: c.Expr[Int]) = x +} + +trait Foo { + def foo(x: Int): Int +} + +object Macros extends Foo { + def foo(x: Int) = macro Impls.impl +} diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Test_2.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Test_2.scala new file mode 100644 index 0000000000..7e3357ec28 --- /dev/null +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val designator: Macros.type = Macros + designator.foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b.check b/test/files/neg/macro-override-macro-overrides-abstract-method-b.check new file mode 100644 index 0000000000..4d95dfc45c --- /dev/null +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b.check @@ -0,0 +1,5 @@ +Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int;
+ macro method foo cannot override an abstract method
+ def foo(x: Int) = macro Impls.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b.flags b/test/files/neg/macro-override-macro-overrides-abstract-method-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala new file mode 100644 index 0000000000..cb0b152852 --- /dev/null +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def impl(c: Ctx)(x: c.Expr[Int]) = x +} + +trait Foo { + def foo(x: Int): Int +} + +object Macros extends Foo { + def foo(x: Int) = macro Impls.impl +} diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b/Test_2.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Test_2.scala new file mode 100644 index 0000000000..08fff30baf --- /dev/null +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val designator: Foo = Macros + designator.foo(42) +}
\ No newline at end of file diff --git a/test/files/neg/macro-override-method-overrides-macro.check b/test/files/neg/macro-override-method-overrides-macro.check new file mode 100644 index 0000000000..42edb0ff23 --- /dev/null +++ b/test/files/neg/macro-override-method-overrides-macro.check @@ -0,0 +1,5 @@ +Macros_Test_2.scala:8: error: overriding macro method foo in class B of type (x: String)Unit;
+ method foo cannot override a macro
+ override def foo(x: String) = println("fooDString")
+ ^
+one error found
diff --git a/test/files/neg/macro-override-method-overrides-macro.flags b/test/files/neg/macro-override-method-overrides-macro.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-override-method-overrides-macro.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala new file mode 100644 index 0000000000..0b127f5a59 --- /dev/null +++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { + import c.{prefix => prefix} + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) + Expr[Unit](body) + } + + def fooBString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBString", x) + def fooBInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBInt", x) + def fooDInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooDInt", x) + def fooZString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooZString", x) +} diff --git a/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala b/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala new file mode 100644 index 0000000000..36821b05d8 --- /dev/null +++ b/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala @@ -0,0 +1,15 @@ +class B { + def foo(x: String) = macro Impls.fooBString + def foo(x: Int) = macro Impls.fooBInt + def foo(x: Boolean) = println("fooBBoolean") +} + +class D extends B { + override def foo(x: String) = println("fooDString") + override def foo(x: Int) = macro Impls.fooDInt +} + +class Z extends D { + override def foo(x: String) = macro Impls.fooZString + override def foo(x: Boolean) = println("fooZBoolean") +} diff --git a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check new file mode 100644 index 0000000000..39e90f827e --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No ConcreteTypeTag available for C[T]
+ println(implicitly[ConcreteTypeTag[C[T]]])
+ ^
+Test.scala:6: error: No ConcreteTypeTag available for List[C[T]]
+ println(implicitly[ConcreteTypeTag[List[C[T]]]])
+ ^
+two errors found
diff --git a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala new file mode 100644 index 0000000000..1302999da6 --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooNoTypeTagHK[C[_], T] = { + println(implicitly[ConcreteTypeTag[C[T]]]) + println(implicitly[ConcreteTypeTag[List[C[T]]]]) + } + fooNoTypeTagHK[List, Int] +}
\ No newline at end of file diff --git a/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check b/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check new file mode 100644 index 0000000000..164ca3543f --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No ConcreteTypeTag available for T
+ println(implicitly[ConcreteTypeTag[T]])
+ ^
+Test.scala:6: error: No ConcreteTypeTag available for List[T]
+ println(implicitly[ConcreteTypeTag[List[T]]])
+ ^
+two errors found
diff --git a/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala b/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala new file mode 100644 index 0000000000..d2276ce333 --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooNoTypeTag[T] = { + println(implicitly[ConcreteTypeTag[T]]) + println(implicitly[ConcreteTypeTag[List[T]]]) + } + fooNoTypeTag[Int] +}
\ No newline at end of file diff --git a/test/files/neg/macro-reify-groundtypetag-usetypetag.check b/test/files/neg/macro-reify-groundtypetag-usetypetag.check new file mode 100644 index 0000000000..164ca3543f --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-usetypetag.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No ConcreteTypeTag available for T
+ println(implicitly[ConcreteTypeTag[T]])
+ ^
+Test.scala:6: error: No ConcreteTypeTag available for List[T]
+ println(implicitly[ConcreteTypeTag[List[T]]])
+ ^
+two errors found
diff --git a/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala b/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala new file mode 100644 index 0000000000..d82cdc33e9 --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooTypeTag[T: TypeTag] = { + println(implicitly[ConcreteTypeTag[T]]) + println(implicitly[ConcreteTypeTag[List[T]]]) + } + fooTypeTag[Int] +}
\ No newline at end of file diff --git a/test/files/neg/macro-without-xmacros-a.check b/test/files/neg/macro-without-xmacros-a.check new file mode 100644 index 0000000000..a3ca081f04 --- /dev/null +++ b/test/files/neg/macro-without-xmacros-a.check @@ -0,0 +1,10 @@ +Macros_2.scala:5: error: not found: value macro
+ def foo(x: Int): Int = macro foo_impl
+ ^
+Macros_2.scala:7: error: not found: value macro
+ def bar(x: Int): Int = macro bar_impl
+ ^
+Macros_2.scala:11: error: not found: value macro
+ def quux(x: Int): Int = macro quux_impl
+ ^
+three errors found
diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala new file mode 100644 index 0000000000..2493c81c95 --- /dev/null +++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo_impl(c: Ctx)(x: c.Expr[Int]): c.mirror.Tree = { + import c.mirror._ + Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + } + + def bar_impl(c: Ctx)(x: c.Expr[Int]): c.mirror.Tree = { + import c.mirror._ + Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + } + + def quux_impl(c: Ctx)(x: c.Expr[Int]): c.mirror.Tree = { + import c.mirror._ + Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + } +} diff --git a/test/files/neg/macro-without-xmacros-a/Macros_2.scala b/test/files/neg/macro-without-xmacros-a/Macros_2.scala new file mode 100644 index 0000000000..62f9dcf505 --- /dev/null +++ b/test/files/neg/macro-without-xmacros-a/Macros_2.scala @@ -0,0 +1,12 @@ +import Impls._ + +object Macros { + object Shmacros { + def foo(x: Int): Int = macro foo_impl + } + def bar(x: Int): Int = macro bar_impl +} + +class Macros { + def quux(x: Int): Int = macro quux_impl +}
\ No newline at end of file diff --git a/test/files/neg/macro-without-xmacros-a/Test_3.scala b/test/files/neg/macro-without-xmacros-a/Test_3.scala new file mode 100644 index 0000000000..e9a10e20c9 --- /dev/null +++ b/test/files/neg/macro-without-xmacros-a/Test_3.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros.Shmacros._ + println(foo(2) + Macros.bar(2) * new Macros().quux(4)) +}
\ No newline at end of file diff --git a/test/files/neg/macro-without-xmacros-b.check b/test/files/neg/macro-without-xmacros-b.check new file mode 100644 index 0000000000..dce4a084c9 --- /dev/null +++ b/test/files/neg/macro-without-xmacros-b.check @@ -0,0 +1,10 @@ +Macros_2.scala:3: error: ';' expected but '.' found.
+ def foo(x: Int): Int = macro Impls.foo_impl
+ ^
+Macros_2.scala:5: error: ';' expected but '.' found.
+ def bar(x: Int): Int = macro Impls.bar_impl
+ ^
+Macros_2.scala:9: error: ';' expected but '.' found.
+ def quux(x: Int): Int = macro Impls.quux_impl
+ ^
+three errors found
diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala new file mode 100644 index 0000000000..2493c81c95 --- /dev/null +++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo_impl(c: Ctx)(x: c.Expr[Int]): c.mirror.Tree = { + import c.mirror._ + Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + } + + def bar_impl(c: Ctx)(x: c.Expr[Int]): c.mirror.Tree = { + import c.mirror._ + Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + } + + def quux_impl(c: Ctx)(x: c.Expr[Int]): c.mirror.Tree = { + import c.mirror._ + Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + } +} diff --git a/test/files/neg/macro-without-xmacros-b/Macros_2.scala b/test/files/neg/macro-without-xmacros-b/Macros_2.scala new file mode 100644 index 0000000000..de7080c7e8 --- /dev/null +++ b/test/files/neg/macro-without-xmacros-b/Macros_2.scala @@ -0,0 +1,10 @@ +object Macros { + object Shmacros { + def foo(x: Int): Int = macro Impls.foo_impl + } + def bar(x: Int): Int = macro Impls.bar_impl +} + +class Macros { + def quux(x: Int): Int = macro Impls.quux_impl +}
\ No newline at end of file diff --git a/test/files/neg/macro-without-xmacros-b/Test_3.scala b/test/files/neg/macro-without-xmacros-b/Test_3.scala new file mode 100644 index 0000000000..e9a10e20c9 --- /dev/null +++ b/test/files/neg/macro-without-xmacros-b/Test_3.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros.Shmacros._ + println(foo(2) + Macros.bar(2) * new Macros().quux(4)) +}
\ No newline at end of file diff --git a/test/files/neg/reify_ann2a.check b/test/files/neg/reify_ann2a.check deleted file mode 100644 index 2afe37e1d8..0000000000 --- a/test/files/neg/reify_ann2a.check +++ /dev/null @@ -1,4 +0,0 @@ -reify_ann2a.scala:9: error: exception during macro expansion: implementation restriction: cannot reify annotation @ann(immutable.this.List.apply[String]("1a")) which involves a symbol declared inside the block being reified - val tree = scala.reflect.Code.lift{ - ^ -one error found diff --git a/test/files/neg/reify_ann2a.scala b/test/files/neg/reify_ann2a.scala deleted file mode 100644 index 8de0984074..0000000000 --- a/test/files/neg/reify_ann2a.scala +++ /dev/null @@ -1,30 +0,0 @@ -import scala.reflect._ -import scala.reflect.api._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - -object Test extends App { - // test 1: reify - val tree = scala.reflect.Code.lift{ - class ann(bar: List[String]) extends StaticAnnotation - - @ann(bar=List("1a")) @ann(bar=List("1b")) class C[@ann(bar=List("2a")) @ann(bar=List("2b")) T](@ann(bar=List("3a")) @ann(bar=List("3b")) x: T @ann(bar=List("4a")) @ann(bar=List("4b"))) { - @ann(bar=List("5a")) @ann(bar=List("5b")) def f(x: Int @ann(bar=List("6a")) @ann(bar=List("6b"))) = { - @ann(bar=List("7a")) @ann(bar=List("7b")) val r = (x + 3): @ann(bar=List("8a")) @ann(bar=List("8b")) - val s = 4: Int @ann(bar=List("9a")) @ann(bar=List("9b")) - r + s - } - } - }.tree - println(tree.toString) - - // test 2: import and typecheck - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - val ttree = toolbox.typeCheck(tree) - println(ttree.toString) - - // test 3: import and compile - toolbox.runExpr(tree) -}
\ No newline at end of file diff --git a/test/files/neg/reify_ann2b.check b/test/files/neg/reify_ann2b.check index ceb70689f1..b9dd84c1ee 100644 --- a/test/files/neg/reify_ann2b.check +++ b/test/files/neg/reify_ann2b.check @@ -1,7 +1,4 @@ -reify_ann2b.scala:10: error: inner classes cannot be classfile annotations - class ann(bar: String) extends ClassfileAnnotation - ^ -reify_ann2b.scala:9: error: exception during macro expansion: implementation restriction: cannot reify annotation @ann(bar = "1a") which involves a symbol declared inside the block being reified - val tree = scala.reflect.Code.lift{ - ^ -two errors found +reify_ann2b.scala:6: error: inner classes cannot be classfile annotations
+ class ann(bar: String) extends ClassfileAnnotation
+ ^
+one error found
diff --git a/test/files/neg/reify_ann2b.scala b/test/files/neg/reify_ann2b.scala index b43567c2a7..6b6da8f790 100644 --- a/test/files/neg/reify_ann2b.scala +++ b/test/files/neg/reify_ann2b.scala @@ -1,12 +1,8 @@ -import scala.reflect._ -import scala.reflect.api._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { // test 1: reify - val tree = scala.reflect.Code.lift{ + val tree = reify{ class ann(bar: String) extends ClassfileAnnotation @ann(bar="1a") @ann(bar="1b") class C[@ann(bar="2a") @ann(bar="2b") T](@ann(bar="3a") @ann(bar="3b") x: T @ann(bar="4a") @ann(bar="4b")) { @@ -20,8 +16,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/neg/t2386.check b/test/files/neg/t2386.check index 1a01696a9a..f70f12535f 100644 --- a/test/files/neg/t2386.check +++ b/test/files/neg/t2386.check @@ -1,4 +1,4 @@ -t2386.scala:2: error: could not find implicit value for evidence parameter of type scala.reflect.ClassManifest[Array[_ >: String with Int]] - val a = Array(Array(1, 2), Array("a","b")) - ^ -one error found +t2386.scala:2: error: No ClassTag available for Array[_ >: String with Int]
+ val a = Array(Array(1, 2), Array("a","b"))
+ ^
+one error found
diff --git a/test/files/neg/t2775.check b/test/files/neg/t2775.check index a30d35fdd9..f357221cd9 100644 --- a/test/files/neg/t2775.check +++ b/test/files/neg/t2775.check @@ -1,4 +1,4 @@ -t2775.scala:1: error: cannot find class manifest for element type B.this.T -trait B[S] { type T = S; val c = new Array[T](1) } - ^ -one error found +t2775.scala:1: error: cannot find class tag for element type B.this.T
+trait B[S] { type T = S; val c = new Array[T](1) }
+ ^
+one error found
diff --git a/test/files/neg/t3507.check b/test/files/neg/t3507.check index 8e538e4a8b..71bf295039 100644 --- a/test/files/neg/t3507.check +++ b/test/files/neg/t3507.check @@ -1,4 +1,4 @@ -t3507.scala:13: error: No Manifest available for _1.b.c.type. - mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier - ^ -one error found +t3507.scala:13: error: No ConcreteTypeTag available for _1.b.c.type
+ mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier
+ ^
+one error found
diff --git a/test/files/neg/t3692.check b/test/files/neg/t3692.check index 96ddd2a461..d83abd31e2 100644 --- a/test/files/neg/t3692.check +++ b/test/files/neg/t3692.check @@ -1,4 +1,11 @@ -t3692.scala:15: error: unreachable code - case m2: Map[T, Int] => new java.util.HashMap[T, Integer] - ^ -one error found +t3692.scala:11: warning: type Manifest in object Predef is deprecated: Use `@scala.reflect.ConcreteTypeTag` instead
+ private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
+ ^
+t3692.scala:11: warning: type Manifest in object Predef is deprecated: Use `@scala.reflect.ConcreteTypeTag` instead
+ private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
+ ^
+t3692.scala:15: error: unreachable code
+ case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
+ ^
+two warnings found
+one error found
diff --git a/test/files/neg/t5334_1.check b/test/files/neg/t5334_1.check new file mode 100644 index 0000000000..1d5a7cbc01 --- /dev/null +++ b/test/files/neg/t5334_1.check @@ -0,0 +1,4 @@ +t5334_1.scala:4: error: implementation restriction: cannot reify block of type C that involves a type declared inside the block being reified. consider casting the return value to a suitable type
+ reify {
+ ^
+one error found
diff --git a/test/files/neg/t5334_1.scala b/test/files/neg/t5334_1.scala new file mode 100644 index 0000000000..a7de5a0915 --- /dev/null +++ b/test/files/neg/t5334_1.scala @@ -0,0 +1,8 @@ +import scala.reflect.mirror._ + +object Test extends App { + reify { + class C { override def toString = "C" } + new C + }.eval +} diff --git a/test/files/neg/t5334_2.check b/test/files/neg/t5334_2.check new file mode 100644 index 0000000000..a62bfff7a5 --- /dev/null +++ b/test/files/neg/t5334_2.check @@ -0,0 +1,4 @@ +t5334_2.scala:4: error: implementation restriction: cannot reify block of type List[(C, C)] that involves a type declared inside the block being reified. consider casting the return value to a suitable type
+ reify {
+ ^
+one error found
diff --git a/test/files/neg/t5334_2.scala b/test/files/neg/t5334_2.scala new file mode 100644 index 0000000000..fc6dfcd0c1 --- /dev/null +++ b/test/files/neg/t5334_2.scala @@ -0,0 +1,8 @@ +import scala.reflect.mirror._ + +object Test extends App { + reify { + class C { override def toString() = "C" } + List((new C, new C)) + }.eval +} |