diff options
Diffstat (limited to 'test')
97 files changed, 940 insertions, 224 deletions
diff --git a/test/disabled/jvm/concurrent-future.check b/test/disabled/jvm/concurrent-future.check index c55e824818..715ac90ce7 100644 --- a/test/disabled/jvm/concurrent-future.check +++ b/test/disabled/jvm/concurrent-future.check @@ -12,5 +12,3 @@ test6: hai world test6: kthxbye test7: hai world test7: kthxbye -test8: hai world -test8: im in yr loop diff --git a/test/disabled/jvm/concurrent-future.scala b/test/disabled/jvm/concurrent-future.scala index b44d054219..eda05428c8 100644 --- a/test/disabled/jvm/concurrent-future.scala +++ b/test/disabled/jvm/concurrent-future.scala @@ -90,25 +90,25 @@ object Test extends App { } } - def testOnFailureWhenFutureTimeoutException(): Unit = once { - done => - val f = future[Unit] { - output(8, "hai world") - throw new FutureTimeoutException(null) - } - f onSuccess { case _ => - output(8, "onoes") - done() - } - f onFailure { - case e: FutureTimeoutException => - output(8, "im in yr loop") - done() - case other => - output(8, "onoes: " + other) - done() - } - } + // def testOnFailureWhenFutureTimeoutException(): Unit = once { + // done => + // val f = future[Unit] { + // output(8, "hai world") + // throw new FutureTimeoutException(null) + // } + // f onSuccess { case _ => + // output(8, "onoes") + // done() + // } + // f onFailure { + // case e: FutureTimeoutException => + // output(8, "im in yr loop") + // done() + // case other => + // output(8, "onoes: " + other) + // done() + // } + // } testOnSuccess() testOnSuccessWhenCompleted() @@ -117,6 +117,6 @@ object Test extends App { testOnFailureWhenSpecialThrowable(5, new Error) testOnFailureWhenSpecialThrowable(6, new scala.util.control.ControlThrowable { }) testOnFailureWhenSpecialThrowable(7, new InterruptedException) - testOnFailureWhenFutureTimeoutException() + // testOnFailureWhenFutureTimeoutException() } diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check index c97be5d9f6..25df9a6a4a 100644 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check @@ -1,14 +1,10 @@ -Macros_Package_10.scala:1: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-package `macro`
+macro-deprecate-dont-touch-backquotedidents.scala:37: error: 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
+macro-deprecate-dont-touch-backquotedidents.scala:38: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ package `macro`.bar {
+ ^
+macro-deprecate-dont-touch-backquotedidents.scala:43: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ package `macro`.foo {
+ ^
+three errors found
diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.flags b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.scala new file mode 100644 index 0000000000..dee2f1de3b --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.scala @@ -0,0 +1,56 @@ +object Test1 { + val `macro` = ??? +} + +object Test2 { + var `macro` = ??? +} + +object Test3 { + type `macro` = Int +} + +package test4 { + class `macro` +} + +object Test5 { + class `macro` +} + +package test6 { + object `macro` +} + +object Test7 { + object `macro` +} + +package test8 { + trait `macro` +} + +object Test9 { + trait `macro` +} + +package `macro` { + package `macro`.bar { + } +} + +package foo { + package `macro`.foo { + } +} + +object Test12 { + val Some(`macro`) = Some(42) + `macro` match { + case `macro` => println(`macro`) + } +} + +object Test13 { + def `macro` = 2 +}
\ No newline at end of file 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 deleted file mode 100644 index 97c07b04a0..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Bind_12.scala +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index f0037b5f82..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_4.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index a6d0903cbb..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_5.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 6af8e1d65e..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Def_13.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 29dab017d2..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_6.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 6cbcac55ca..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_7.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 4985d6691e..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_10.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 35ed610637..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_11.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 7895cf9a43..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_8.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 90ba2207b7..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_9.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 7a2196c9cd..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Type_3.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 9ad08b8ba0..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Val_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 4fbe152e76..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Var_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index f5278d9e7e..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Main.scala +++ /dev/null @@ -1,2 +0,0 @@ -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 index 5fa1dc84d0..bd685fc7b9 100644 --- a/test/files/neg/macro-deprecate-idents.check +++ b/test/files/neg/macro-deprecate-idents.check @@ -1,50 +1,46 @@ -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
+macro-deprecate-idents.scala:2: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ val 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
+macro-deprecate-idents.scala:6: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ var macro = ???
^
-Macros_Object_6.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-object macro
+macro-deprecate-idents.scala:10: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ type macro = Int
^
-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
+macro-deprecate-idents.scala:14: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ class 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
+macro-deprecate-idents.scala:18: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ class macro
^
-Macros_Package_11.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-package macro.foo
+macro-deprecate-idents.scala:22: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ object macro
+ ^
+macro-deprecate-idents.scala:26: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ object macro
+ ^
+macro-deprecate-idents.scala:30: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ trait macro
^
-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.
+macro-deprecate-idents.scala:34: error: 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 = ???
+macro-deprecate-idents.scala:37: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package macro {
+ ^
+macro-deprecate-idents.scala:38: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ package macro.bar {
+ ^
+macro-deprecate-idents.scala:43: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ package macro.foo {
+ ^
+macro-deprecate-idents.scala:48: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ val Some(macro) = Some(42)
+ ^
+macro-deprecate-idents.scala:50: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ case macro => println(macro)
+ ^
+macro-deprecate-idents.scala:55: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ def macro = 2
^
-Main.scala:2: error: Unmatched closing brace '}' ignored here
-}
-^
-15 warnings found
-one error found
+15 errors found
diff --git a/test/files/neg/macro-deprecate-idents.flags b/test/files/neg/macro-deprecate-idents.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/macro-deprecate-idents.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents.scala b/test/files/neg/macro-deprecate-idents.scala new file mode 100644 index 0000000000..23c398e341 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents.scala @@ -0,0 +1,56 @@ +object Test1 { + val macro = ??? +} + +object Test2 { + var macro = ??? +} + +object Test3 { + type macro = Int +} + +package test4 { + class macro +} + +object Test5 { + class macro +} + +package test6 { + object macro +} + +object Test7 { + object macro +} + +package test8 { + trait macro +} + +object Test9 { + trait macro +} + +package macro { + package macro.bar { + } +} + +package foo { + package macro.foo { + } +} + +object Test12 { + val Some(macro) = Some(42) + macro match { + case macro => println(macro) + } +} + +object Test13 { + def macro = 2 +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala b/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala deleted file mode 100644 index f4e25bfdfc..0000000000 --- a/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test13 { - def macro = 2 -}
\ 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 deleted file mode 100644 index f5278d9e7e..0000000000 --- a/test/files/neg/macro-deprecate-idents/Main.scala +++ /dev/null @@ -1,2 +0,0 @@ -object Test extends App -}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala b/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala index cbd6232073..fa50ac4f73 100644 --- a/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala +++ b/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { import Macros._ - foo(42) + foo(42, 100) }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala b/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala index cbd6232073..fa50ac4f73 100644 --- a/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala +++ b/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { import Macros._ - foo(42) + foo(42, 100) }
\ No newline at end of file diff --git a/test/files/neg/macro-keyword-bind.check b/test/files/neg/macro-keyword-bind.check new file mode 100644 index 0000000000..1f74cfe5cd --- /dev/null +++ b/test/files/neg/macro-keyword-bind.check @@ -0,0 +1,7 @@ +macro-keyword-bind.scala:2: error: illegal start of simple pattern
+ val Some(macro) = Some(42)
+ ^
+macro-keyword-bind.scala:6: error: ')' expected but '}' found.
+}
+^
+two errors found
diff --git a/test/files/neg/macro-keyword-bind.flags b/test/files/neg/macro-keyword-bind.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-bind.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Bind_12.scala b/test/files/neg/macro-keyword-bind.scala index a3b1553348..a3b1553348 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Bind_12.scala +++ b/test/files/neg/macro-keyword-bind.scala diff --git a/test/files/neg/macro-keyword-class1.check b/test/files/neg/macro-keyword-class1.check new file mode 100644 index 0000000000..d8983180ef --- /dev/null +++ b/test/files/neg/macro-keyword-class1.check @@ -0,0 +1,4 @@ +macro-keyword-class1.scala:3: error: identifier expected but 'macro' found.
+class macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-class1.flags b/test/files/neg/macro-keyword-class1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-class1.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Class_4.scala b/test/files/neg/macro-keyword-class1.scala index 8635d1f4f6..8635d1f4f6 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Class_4.scala +++ b/test/files/neg/macro-keyword-class1.scala diff --git a/test/files/neg/macro-keyword-class2.check b/test/files/neg/macro-keyword-class2.check new file mode 100644 index 0000000000..0e4d11bcc4 --- /dev/null +++ b/test/files/neg/macro-keyword-class2.check @@ -0,0 +1,4 @@ +macro-keyword-class2.scala:2: error: identifier expected but 'macro' found.
+ class macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-class2.flags b/test/files/neg/macro-keyword-class2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-class2.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Class_5.scala b/test/files/neg/macro-keyword-class2.scala index af24a489d0..af24a489d0 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Class_5.scala +++ b/test/files/neg/macro-keyword-class2.scala diff --git a/test/files/neg/macro-keyword-object1.check b/test/files/neg/macro-keyword-object1.check new file mode 100644 index 0000000000..cfbd06ffd6 --- /dev/null +++ b/test/files/neg/macro-keyword-object1.check @@ -0,0 +1,4 @@ +macro-keyword-object1.scala:3: error: identifier expected but 'macro' found.
+object macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-object1.flags b/test/files/neg/macro-keyword-object1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-object1.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Object_6.scala b/test/files/neg/macro-keyword-object1.scala index 66eb494e6b..66eb494e6b 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Object_6.scala +++ b/test/files/neg/macro-keyword-object1.scala diff --git a/test/files/neg/macro-keyword-object2.check b/test/files/neg/macro-keyword-object2.check new file mode 100644 index 0000000000..ede31f13e5 --- /dev/null +++ b/test/files/neg/macro-keyword-object2.check @@ -0,0 +1,4 @@ +macro-keyword-object2.scala:2: error: identifier expected but 'macro' found.
+ object macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-object2.flags b/test/files/neg/macro-keyword-object2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-object2.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Object_7.scala b/test/files/neg/macro-keyword-object2.scala index 6f5b9ceacd..6f5b9ceacd 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Object_7.scala +++ b/test/files/neg/macro-keyword-object2.scala diff --git a/test/files/neg/macro-keyword-package1.check b/test/files/neg/macro-keyword-package1.check new file mode 100644 index 0000000000..22c1e11ded --- /dev/null +++ b/test/files/neg/macro-keyword-package1.check @@ -0,0 +1,4 @@ +macro-keyword-package1.scala:1: error: identifier expected but 'macro' found.
+package macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-package1.flags b/test/files/neg/macro-keyword-package1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-package1.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Package_10.scala b/test/files/neg/macro-keyword-package1.scala index 52d3fbabf6..52d3fbabf6 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Package_10.scala +++ b/test/files/neg/macro-keyword-package1.scala diff --git a/test/files/neg/macro-keyword-package2.check b/test/files/neg/macro-keyword-package2.check new file mode 100644 index 0000000000..0cb542a85d --- /dev/null +++ b/test/files/neg/macro-keyword-package2.check @@ -0,0 +1,4 @@ +macro-keyword-package2.scala:3: error: identifier expected but 'macro' found.
+package macro.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-package2.flags b/test/files/neg/macro-keyword-package2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-package2.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Package_11.scala b/test/files/neg/macro-keyword-package2.scala index a68ebd935f..a68ebd935f 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Package_11.scala +++ b/test/files/neg/macro-keyword-package2.scala diff --git a/test/files/neg/macro-keyword-trait1.check b/test/files/neg/macro-keyword-trait1.check new file mode 100644 index 0000000000..9586a62e08 --- /dev/null +++ b/test/files/neg/macro-keyword-trait1.check @@ -0,0 +1,4 @@ +macro-keyword-trait1.scala:3: error: identifier expected but 'macro' found.
+trait macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-trait1.flags b/test/files/neg/macro-keyword-trait1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-trait1.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Trait_8.scala b/test/files/neg/macro-keyword-trait1.scala index e32d4c1385..e32d4c1385 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Trait_8.scala +++ b/test/files/neg/macro-keyword-trait1.scala diff --git a/test/files/neg/macro-keyword-trait2.check b/test/files/neg/macro-keyword-trait2.check new file mode 100644 index 0000000000..40aa764378 --- /dev/null +++ b/test/files/neg/macro-keyword-trait2.check @@ -0,0 +1,4 @@ +macro-keyword-trait2.scala:2: error: identifier expected but 'macro' found.
+ trait macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-trait2.flags b/test/files/neg/macro-keyword-trait2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-trait2.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Trait_9.scala b/test/files/neg/macro-keyword-trait2.scala index 243a54abe6..243a54abe6 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Trait_9.scala +++ b/test/files/neg/macro-keyword-trait2.scala diff --git a/test/files/neg/macro-keyword-type.check b/test/files/neg/macro-keyword-type.check new file mode 100644 index 0000000000..4a7481114c --- /dev/null +++ b/test/files/neg/macro-keyword-type.check @@ -0,0 +1,4 @@ +macro-keyword-type.scala:2: error: identifier expected but 'macro' found.
+ type macro = Int
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-type.flags b/test/files/neg/macro-keyword-type.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-type.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Type_3.scala b/test/files/neg/macro-keyword-type.scala index 30e523bcaf..30e523bcaf 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Type_3.scala +++ b/test/files/neg/macro-keyword-type.scala diff --git a/test/files/neg/macro-keyword-val.check b/test/files/neg/macro-keyword-val.check new file mode 100644 index 0000000000..0dc4c030a9 --- /dev/null +++ b/test/files/neg/macro-keyword-val.check @@ -0,0 +1,7 @@ +macro-keyword-val.scala:2: error: illegal start of simple pattern
+ val macro = ???
+ ^
+macro-keyword-val.scala:3: error: '=' expected but '}' found.
+}
+^
+two errors found
diff --git a/test/files/neg/macro-keyword-val.flags b/test/files/neg/macro-keyword-val.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-val.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Val_1.scala b/test/files/neg/macro-keyword-val.scala index 96f57acb30..96f57acb30 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Val_1.scala +++ b/test/files/neg/macro-keyword-val.scala diff --git a/test/files/neg/macro-keyword-var.check b/test/files/neg/macro-keyword-var.check new file mode 100644 index 0000000000..96d02e0052 --- /dev/null +++ b/test/files/neg/macro-keyword-var.check @@ -0,0 +1,7 @@ +macro-keyword-var.scala:2: error: illegal start of simple pattern
+ var macro = ???
+ ^
+macro-keyword-var.scala:3: error: '=' expected but '}' found.
+}
+^
+two errors found
diff --git a/test/files/neg/macro-keyword.flags b/test/files/neg/macro-keyword-var.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/neg/macro-keyword.flags +++ b/test/files/neg/macro-keyword-var.flags diff --git a/test/files/neg/macro-deprecate-idents/Macros_Var_2.scala b/test/files/neg/macro-keyword-var.scala index a79dda6dc2..a79dda6dc2 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Var_2.scala +++ b/test/files/neg/macro-keyword-var.scala diff --git a/test/files/neg/macro-keyword.check b/test/files/neg/macro-keyword.check deleted file mode 100644 index fd63db951c..0000000000 --- a/test/files/neg/macro-keyword.check +++ /dev/null @@ -1,49 +0,0 @@ -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/Macros_Bind_12.scala b/test/files/neg/macro-keyword/Macros_Bind_12.scala deleted file mode 100644 index a3b1553348..0000000000 --- a/test/files/neg/macro-keyword/Macros_Bind_12.scala +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 8635d1f4f6..0000000000 --- a/test/files/neg/macro-keyword/Macros_Class_4.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index af24a489d0..0000000000 --- a/test/files/neg/macro-keyword/Macros_Class_5.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index f4e25bfdfc..0000000000 --- a/test/files/neg/macro-keyword/Macros_Def_13.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 66eb494e6b..0000000000 --- a/test/files/neg/macro-keyword/Macros_Object_6.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 6f5b9ceacd..0000000000 --- a/test/files/neg/macro-keyword/Macros_Object_7.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 52d3fbabf6..0000000000 --- a/test/files/neg/macro-keyword/Macros_Package_10.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index a68ebd935f..0000000000 --- a/test/files/neg/macro-keyword/Macros_Package_11.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index e32d4c1385..0000000000 --- a/test/files/neg/macro-keyword/Macros_Trait_8.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 243a54abe6..0000000000 --- a/test/files/neg/macro-keyword/Macros_Trait_9.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 30e523bcaf..0000000000 --- a/test/files/neg/macro-keyword/Macros_Type_3.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 96f57acb30..0000000000 --- a/test/files/neg/macro-keyword/Macros_Val_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index a79dda6dc2..0000000000 --- a/test/files/neg/macro-keyword/Macros_Var_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test2 { - var macro = ??? -}
\ No newline at end of file diff --git a/test/files/neg/t5510.check b/test/files/neg/t5510.check new file mode 100644 index 0000000000..60da3bed40 --- /dev/null +++ b/test/files/neg/t5510.check @@ -0,0 +1,19 @@ +t5510.scala:2: error: unclosed string literal + val s1 = s"xxx + ^ +t5510.scala:3: error: unclosed string literal + val s2 = s"xxx $x + ^ +t5510.scala:4: error: unclosed string literal + val s3 = s"xxx $$ + ^ +t5510.scala:5: error: unclosed string literal + val s4 = ""s" + ^ +t5510.scala:6: error: unclosed multi-line string literal + val s5 = ""s""" $s1 $s2 s" + ^ +t5510.scala:7: error: '}' expected but eof found. +} + ^ +6 errors found diff --git a/test/files/neg/t5510.scala b/test/files/neg/t5510.scala new file mode 100644 index 0000000000..12630eb2cd --- /dev/null +++ b/test/files/neg/t5510.scala @@ -0,0 +1,7 @@ +object Test { + val s1 = s"xxx + val s2 = s"xxx $x + val s3 = s"xxx $$ + val s4 = ""s" + val s5 = ""s""" $s1 $s2 s" +} diff --git a/test/files/run/t5535.check b/test/files/run/t5535.check new file mode 100644 index 0000000000..8da9829b78 --- /dev/null +++ b/test/files/run/t5535.check @@ -0,0 +1,20 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> def h()(i: Int) = 1 + i +h: ()(i: Int)Int + +scala> println(h()(5)) +6 + +scala> val f = h() _ +f: Int => Int = <function1> + +scala> println(f(10)) +11 + +scala> + +scala> diff --git a/test/files/run/t5535.scala b/test/files/run/t5535.scala new file mode 100644 index 0000000000..7bc12f3470 --- /dev/null +++ b/test/files/run/t5535.scala @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ +def h()(i: Int) = 1 + i +println(h()(5)) +val f = h() _ +println(f(10)) + """ +} diff --git a/test/files/run/t5583.check b/test/files/run/t5583.check new file mode 100644 index 0000000000..39b969fbe7 --- /dev/null +++ b/test/files/run/t5583.check @@ -0,0 +1,20 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> var s = 0 +s: Int = 0 + +scala> for (i <- 1 to 10) {s += i} + +scala> for (i <- 1 to 10) {s += i} + +scala> for (i <- 1 to 10) {s += i} + +scala> println(s) +165 + +scala> + +scala> diff --git a/test/files/run/t5583.scala b/test/files/run/t5583.scala new file mode 100644 index 0000000000..8561a5946f --- /dev/null +++ b/test/files/run/t5583.scala @@ -0,0 +1,11 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ +var s = 0 +for (i <- 1 to 10) {s += i} +for (i <- 1 to 10) {s += i} +for (i <- 1 to 10) {s += i} +println(s) + """ +} diff --git a/test/scaladoc/resources/implicits-base-res.scala b/test/scaladoc/resources/implicits-base-res.scala new file mode 100644 index 0000000000..db7ca4fa51 --- /dev/null +++ b/test/scaladoc/resources/implicits-base-res.scala @@ -0,0 +1,143 @@ +/** + * Test scaladoc implicits - the bread and butter of the testsuite :) + */ +package scala.test.scaladoc.implicits.base + +class Foo[T] +class Bar[T] +trait MyNumeric[R] + +/** Class A + * - tests the complete type inference + * - the following inherited methods should appear: + * {{{ + * def convToGtColonDoubleA: Double // pimpA3: with a constraint that T <: Double + * def convToIntA: Int // pimpA2: with a constraint that T = Int + * def convToManifestA: T // pimpA7: with 2 constraints: T: Manifest and T <: Double + * def convToMyNumericA: T // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope + * def convToNumericA: T // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope + * def convToPimpedA: Bar[Foo[T]] // pimpA5: no constraints + * def convToPimpedA: S // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar + * def convToTraversableOps: T // pimpA7: with 2 constraints: T: Manifest and T <: Double + * // should not be abstract! + * }}} + */ +class A[T] { + /** This should prevent the implicitly inherited `def convToPimpedA: T` from `pimpA0` from showing up */ + def convToPimpedA: T = sys.error("Let's check it out!") +} +/** Companion object with implicit transformations */ +object A { + implicit def pimpA0[V](a: A[V]) = new PimpedA(a) + implicit def pimpA1[ZBUR: Numeric](a: A[ZBUR]) = new NumericA[ZBUR](a) + implicit def pimpA2(a: A[Int]) = new IntA(a) + implicit def pimpA3(a: A[T] forSome { type T <: Double }) = new GtColonDoubleA(a) + implicit def pimpA4[S](a: A[Foo[Bar[S]]])(implicit foo: Foo[S], bar: Bar[S]): PimpedA[S] = sys.error("not implemented") + implicit def pimpA5[Z](a: A[Z]): PimpedA[Bar[Foo[Z]]] = sys.error("not implemented") + implicit def pimpA6[Z: MyNumeric](a: A[Z]) = new MyNumericA[Z](a) + // TODO: Add H <: Double and see why it crashes for C and D -- context bounds, need to check! + implicit def pimpA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps: H = sys.error("no") } +} + + +/** Class B + * - tests the existential type solving + * - the following inherited methods should appear: + * {{{ + * def convToGtColonDoubleA: Double // pimpA3: no constraints + * def convToManifestA: Double // pimpA7: no constraints + * def convToMyNumericA: Double // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope + * def convToNumericA: Double // pimpA1: no constraintsd + * def convToPimpedA: Bar[Foo[Double]] // pimpA5: no constraints + * def convToTraversableOps: Double // pimpA7: no constraints + * // should not be abstract! + * }}} + */ +class B extends A[Double] +object B extends A + + +/** Class C + * - tests asSeenFrom + * - the following inherited methods should appear: + * {{{ + * def convToIntA: Int // pimpA2: no constraints + * def convToMyNumericA: Int // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope + * def convToNumericA: Int // pimpA1: no constraints + * def convToPimpedA: Bar[Foo[Int]] // pimpA5: no constraints + * }}} + */ +class C extends A[Int] +object C extends A + + +/** Class D + * - tests implicit elimination + * - the following inherited methods should appear: + * {{{ + * def convToMyNumericA: String // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope + * def convToNumericA: String // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope + * def convToPimpedA: Bar[Foo[String]] // pimpA5: no constraints + * }}} + */ +class D extends A[String] +/** Companion object with implicit transformations */ +object D extends A + + +/** PimpedA class <br/> + * - tests simple inheritance and asSeenFrom + * - A, B and C should be implicitly converted to this */ +class PimpedA[V](a: A[V]) { + /** The convToPimpedA: V documentation... */ + def convToPimpedA: V = sys.error("Not implemented") +} + +/** NumericA class <br/> + * - tests the implicit conversion between parametric and fixed types + * - A, B and C should be implicitly converted to this */ +class NumericA[U: Numeric](a: A[U]) { + /** The convToNumericA: U documentation... */ + def convToNumericA: U = implicitly[Numeric[U]].zero +} + +/** IntA class <br/> + * - tests the interaction between implicit conversion and specific types + * - A and C should be implicitly converted to this */ +class IntA(a: A[Int]) { + /** The convToIntA: Int documentation... */ + def convToIntA: Int = 0 +} + +/** GtColonDoubleA class <br/> + * - tests the interaction between implicit conversion and existential types + * - A and B should be implicitly converted to this */ +class GtColonDoubleA(a: A[T] forSome { type T <: Double }) { + /** The convToGtColonDoubleA: Double documentation... */ + def convToGtColonDoubleA: Double = 0 +} + +/** MyNumericA class <br/> + * - tests the implicit conversion between parametric and fixed types + * - A should be implicitly converted to this */ +class MyNumericA[U: MyNumeric](a: A[U]) { + /** The convToMyNumericA: U documentation... */ + def convToMyNumericA: U = sys.error("dunno") +} + +/** ManifestA class <br/> + * - tests the manifest recognition + * - A, B, C, D should be implicitly converted to this */ +class ManifestA[W: Manifest](a: A[W]) { + /** The convToManifestA: W documentation... */ + def convToManifestA: W = sys.error("dunno") +} + +/** MyTraversableOps class <br/> + * - checks if any abstract members are added - should not happen! + */ +trait MyTraversableOps[S] { + /** The convToTraversableOps: S documentation... */ + def convToTraversableOps: S +} + diff --git a/test/scaladoc/resources/implicits-chaining-res.scala b/test/scaladoc/resources/implicits-chaining-res.scala new file mode 100644 index 0000000000..b20c8f846c --- /dev/null +++ b/test/scaladoc/resources/implicits-chaining-res.scala @@ -0,0 +1,48 @@ +/** + * Testing scaladoc implicits chaining + */ +package scala.test.scaladoc.implicits { + + // the classes involved + case class Z[U](a: U) + case class Intermediate[T, U](t: T, u: U) + class Implicit1[T](b: Implicit2[T]) + class Implicit2[T](c: Implicit3[T]) + class Implicit3[T](/* and so on */) + + object chaining { + + // the base conversion + implicit def convertToZ[T](a: A[T])(implicit b: Implicit1[T]): Z[A[T]] = Z(a) + + // and the implicit chaining, don't you just love it? :D + // implicit1, with one alternative + implicit def implicit1[T <: Intermediate[_, _]](implicit b: Implicit2[T]) = new Implicit1[T](b) + // implicit2, with two alternatives + implicit def implicit2alt1[T <: Intermediate[_ <: String, _]](implicit c: Implicit3[T]) = new Implicit2[T](c) + implicit def implicit2alt2[T <: Intermediate[_ <: Double, _]](implicit c: Implicit3[T]) = new Implicit2[T](c) + // implicit3, with two alternatives + implicit def implicit3alt1[T <: Intermediate[_, _ <: Int]] = new Implicit3[T]() + implicit def implicit3alt2[T <: Intermediate[_ <: Double, _ <: AnyRef],X] = new Implicit3[T]() + + // and our targets + /** conversion here, with constraints */ + class A[T]() + /** conversion here, no constraints */ + class B extends A[Intermediate[String, Int]] + /** no conversion */ + class C extends A[Intermediate[String, String]] + /** conversion here, no constraints */ + class D extends A[Intermediate[Double, Int]] + /** conversion here, no constraints */ + class E extends A[Intermediate[Double, String]] + /** no conversion */ + class F extends A[Intermediate[String, Double]] + + object scalacTest { + (new B).a + (new D).a + (new E).a + } + } +} diff --git a/test/scaladoc/resources/implicits-elimination-res.scala b/test/scaladoc/resources/implicits-elimination-res.scala new file mode 100644 index 0000000000..68743aee06 --- /dev/null +++ b/test/scaladoc/resources/implicits-elimination-res.scala @@ -0,0 +1,9 @@ +/** + * Testing scaladoc implicits elimination + */ +package scala.test.scaladoc.implicits.elimination { + /** No conversion, as B doesn't bring any member */ + class A + class B { class C; trait V; type T; } + object A { implicit def toB(a: A): B = null } +} diff --git a/test/scaladoc/resources/implicits-scopes-res.scala b/test/scaladoc/resources/implicits-scopes-res.scala new file mode 100644 index 0000000000..4e55c3e388 --- /dev/null +++ b/test/scaladoc/resources/implicits-scopes-res.scala @@ -0,0 +1,51 @@ +/** + * Testing scaladoc implicit scopes - looking for implicits in the right places + */ +package scala.test.scaladoc.implicits.scopes + +// TEST1 - In package object +package object test1 { + implicit def toB(a: A): B = null +} +package test1 { + class A + class B { def b = "" } +} + +// TEST2 - In enclosing package - doesn't seem to work even in scalac +package object test2 { + import classes._ + implicit def toB(a: A): B = null +} +package test2 { + package classes { + class A + class B { def b = "" } + object test { /* (new A).b won't compile */ } + } +} + +// TEST3 - In companion object +package test3 { + class A + object A { implicit def toB(a: A): B = null } + class B { def b = "" } +} + +// TEST4 - Nested type's companion object +package test4 { + class U[V] + class S + object S { implicit def toB(a: A): B = null } + class A extends U[S] + class B { def b = "" } +} + +// TEST5 - In scope +package test5 { + object scope { + class A + class B { def b = "" } + implicit def toB(a: A): B = null + } +} diff --git a/test/scaladoc/run/SI-5373.check b/test/scaladoc/run/SI-5373.check index c55eb001cf..619c56180b 100644 --- a/test/scaladoc/run/SI-5373.check +++ b/test/scaladoc/run/SI-5373.check @@ -1 +1 @@ -model contains 6 documentable templates +Done. diff --git a/test/scaladoc/run/SI-5373.scala b/test/scaladoc/run/SI-5373.scala index af433a1844..0062abbb2a 100644 --- a/test/scaladoc/run/SI-5373.scala +++ b/test/scaladoc/run/SI-5373.scala @@ -1,9 +1,9 @@ import scala.tools.nsc.doc.model._ import scala.tools.partest.ScaladocModelTest -object Test extends ScaladocModelTest { +object Test extends ScaladocModelTest { - def code = """ + override def code = """ import scala.annotation.bridge package scala.test { @@ -23,7 +23,7 @@ object Test extends ScaladocModelTest { // no need for special settings def scaladocSettings = "" - + def testModel(rootPackage: Package) = { // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) import access._ diff --git a/test/scaladoc/run/implicits-base.check b/test/scaladoc/run/implicits-base.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/implicits-base.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/implicits-base.scala b/test/scaladoc/run/implicits-base.scala new file mode 100644 index 0000000000..a0dd2071d7 --- /dev/null +++ b/test/scaladoc/run/implicits-base.scala @@ -0,0 +1,179 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + // test a file instead of a piece of code + override def resourceFile = "implicits-base-res.scala" + + // start implicits + def scaladocSettings = "-implicits -implicits-show-all" + + def testModel(root: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + + // SEE THE test/resources/implicits-base-res.scala FOR THE EXPLANATION OF WHAT'S CHECKED HERE: + val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._package("base") + var conv: ImplicitConversion = null + +//// class A /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val A = base._class("A") + + // the method pimped on by pimpA0 should be shadowed by the method in class A + assert(A._conversions(A.qualifiedName + ".pimpA0").isEmpty) + + // def convToNumericA: T // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope + conv = A._conversion(A.qualifiedName + ".pimpA1") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + assert(conv._member("convToNumericA").resultType.name == "T") + + // def convToIntA: Int // pimpA2: with a constraint that T = Int + conv = A._conversion(A.qualifiedName + ".pimpA2") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + assert(conv._member("convToIntA").resultType.name == "Int") + + // def convToGtColonDoubleA: Double // pimpA3: with a constraint that T <: Double + conv = A._conversion(A.qualifiedName + ".pimpA3") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + assert(conv._member("convToGtColonDoubleA").resultType.name == "Double") + + // def convToPimpedA: S // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar + conv = A._conversion(A.qualifiedName + ".pimpA4") + assert(conv.members.length == 1) + assert(conv.constraints.length == 3) + assert(conv._member("convToPimpedA").resultType.name == "S") + + // def convToPimpedA: Bar[Foo[T]] // pimpA5: no constraints + conv = A._conversion(A.qualifiedName + ".pimpA5") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[T]]") + + // def convToMyNumericA: T // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope + conv = A._conversion(A.qualifiedName + ".pimpA6") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + assert(conv._member("convToMyNumericA").resultType.name == "T") + + // def convToManifestA: T // pimpA7: with 2 constraints: T: Manifest and T <: Double + // def convToTraversableOps: T // pimpA7: with 2 constraints: T: Manifest and T <: Double + // should not be abstract! + conv = A._conversion(A.qualifiedName + ".pimpA7") + assert(conv.members.length == 2) + assert(conv.constraints.length == 2) + assert(conv._member("convToManifestA").resultType.name == "T") + assert(conv._member("convToTraversableOps").resultType.name == "T") + assert(conv._member("convToTraversableOps").flags.toString.indexOf("abstract") == -1) + +//// class B /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val B = base._class("B") + + // these conversions should not affect B + assert(B._conversions(A.qualifiedName + ".pimpA0").isEmpty) + assert(B._conversions(A.qualifiedName + ".pimpA2").isEmpty) + assert(B._conversions(A.qualifiedName + ".pimpA4").isEmpty) + + // def convToNumericA: Double // pimpA1: no constraintsd + conv = B._conversion(A.qualifiedName + ".pimpA1") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + assert(conv._member("convToNumericA").resultType.name == "Double") + + // def convToGtColonDoubleA: Double // pimpA3: no constraints + conv = B._conversion(A.qualifiedName + ".pimpA3") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + assert(conv._member("convToGtColonDoubleA").resultType.name == "Double") + + // def convToPimpedA: Bar[Foo[Double]] // pimpA5: no constraints + conv = B._conversion(A.qualifiedName + ".pimpA5") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Double]]") + + // def convToMyNumericA: Double // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope + conv = B._conversion(A.qualifiedName + ".pimpA6") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + assert(conv._member("convToMyNumericA").resultType.name == "Double") + + // def convToManifestA: Double // pimpA7: no constraints + // def convToTraversableOps: Double // pimpA7: no constraints + // // should not be abstract! + conv = B._conversion(A.qualifiedName + ".pimpA7") + assert(conv.members.length == 2) + assert(conv.constraints.length == 0) + assert(conv._member("convToManifestA").resultType.name == "Double") + assert(conv._member("convToTraversableOps").resultType.name == "Double") + assert(conv._member("convToTraversableOps").flags.toString.indexOf("abstract") == -1) + +//// class C /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val C = base._class("C") + + // these conversions should not affect C + assert(C._conversions(A.qualifiedName + ".pimpA0").isEmpty) + assert(C._conversions(A.qualifiedName + ".pimpA3").isEmpty) + assert(C._conversions(A.qualifiedName + ".pimpA4").isEmpty) + assert(C._conversions(A.qualifiedName + ".pimpA7").isEmpty) + + // def convToNumericA: Int // pimpA1: no constraints + conv = C._conversion(A.qualifiedName + ".pimpA1") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + assert(conv._member("convToNumericA").resultType.name == "Int") + + // def convToIntA: Int // pimpA2: no constraints + conv = C._conversion(A.qualifiedName + ".pimpA2") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + assert(conv._member("convToIntA").resultType.name == "Int") + + // def convToPimpedA: Bar[Foo[Int]] // pimpA5: no constraints + conv = C._conversion(A.qualifiedName + ".pimpA5") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Int]]") + + // def convToMyNumericA: Int // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope + conv = C._conversion(A.qualifiedName + ".pimpA6") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + assert(conv._member("convToMyNumericA").resultType.name == "Int") + +//// class D /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val D = base._class("D") + + // these conversions should not affect D + assert(D._conversions(A.qualifiedName + ".pimpA0").isEmpty) + assert(D._conversions(A.qualifiedName + ".pimpA2").isEmpty) + assert(D._conversions(A.qualifiedName + ".pimpA3").isEmpty) + assert(D._conversions(A.qualifiedName + ".pimpA4").isEmpty) + assert(D._conversions(A.qualifiedName + ".pimpA7").isEmpty) + + // def convToNumericA: String // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope + conv = D._conversion(A.qualifiedName + ".pimpA1") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + assert(conv._member("convToNumericA").resultType.name == "String") + + // def convToPimpedA: Bar[Foo[String]] // pimpA5: no constraints + conv = D._conversion(A.qualifiedName + ".pimpA5") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[String]]") + + // def convToMyNumericA: String // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope + conv = D._conversion(A.qualifiedName + ".pimpA6") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + assert(conv._member("convToMyNumericA").resultType.name == "String") + } +}
\ No newline at end of file diff --git a/test/scaladoc/run/implicits-chaining.check b/test/scaladoc/run/implicits-chaining.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/implicits-chaining.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/implicits-chaining.scala b/test/scaladoc/run/implicits-chaining.scala new file mode 100644 index 0000000000..96e288b204 --- /dev/null +++ b/test/scaladoc/run/implicits-chaining.scala @@ -0,0 +1,64 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + // test a file instead of a piece of code + override def resourceFile = "implicits-chaining-res.scala" + + // start implicits + def scaladocSettings = "-implicits" + + def testModel(root: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + + // SEE THE test/resources/implicits-chaining-res.scala FOR THE EXPLANATION OF WHAT'S CHECKED HERE: + val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._object("chaining") + var conv: ImplicitConversion = null + +//// class A /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val A = base._class("A") + + conv = A._conversion(base.qualifiedName + ".convertToZ") + assert(conv.members.length == 1) + assert(conv.constraints.length == 1) + +//// class B /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val B = base._class("B") + + conv = B._conversion(base.qualifiedName + ".convertToZ") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + +//// class C /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val C = base._class("C") + + assert(C._conversions(base.qualifiedName + ".convertToZ").isEmpty) + +//// class D /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val D = base._class("D") + + conv = D._conversion(base.qualifiedName + ".convertToZ") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + +//// class E /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val E = base._class("E") + + conv = E._conversion(base.qualifiedName + ".convertToZ") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + +//// class F /////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val F = base._class("F") + + assert(F._conversions(base.qualifiedName + ".convertToZ").isEmpty) + } +}
\ No newline at end of file diff --git a/test/scaladoc/run/implicits-elimination.check b/test/scaladoc/run/implicits-elimination.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/implicits-elimination.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/implicits-elimination.scala b/test/scaladoc/run/implicits-elimination.scala new file mode 100644 index 0000000000..71319f9f47 --- /dev/null +++ b/test/scaladoc/run/implicits-elimination.scala @@ -0,0 +1,22 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + // test a file instead of a piece of code + override def resourceFile = "implicits-elimination-res.scala" + + // start implicits + def scaladocSettings = "-implicits" + + def testModel(root: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + + // SEE THE test/resources/implicits-elimination-res.scala FOR THE EXPLANATION OF WHAT'S CHECKED HERE: + val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._package("elimination") + val A = base._class("A") + + assert(A._conversions(A.qualifiedName + ".toB").isEmpty) + } +}
\ No newline at end of file diff --git a/test/scaladoc/run/implicits-scopes.check b/test/scaladoc/run/implicits-scopes.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/implicits-scopes.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/implicits-scopes.scala b/test/scaladoc/run/implicits-scopes.scala new file mode 100644 index 0000000000..7fb41e1ae8 --- /dev/null +++ b/test/scaladoc/run/implicits-scopes.scala @@ -0,0 +1,76 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + // test a file instead of a piece of code + override def resourceFile = "implicits-scopes-res.scala" + + // start implicits + def scaladocSettings = "-implicits" + + def testModel(root: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + var conv: ImplicitConversion = null + + // SEE THE test/resources/implicits-chaining-res.scala FOR THE EXPLANATION OF WHAT'S CHECKED HERE: + val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._package("scopes") + +//// test1 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val doTest1 = { + val test1 = base._package("test1") + val A = test1._class("A") + + conv = A._conversion(test1.qualifiedName + ".package.toB") // the .package means it's the package object + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + } + +//// test2 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val doTest2 = { + val test2 = base._package("test2") + val classes = test2._package("classes") + val A = classes._class("A") + + assert(A._conversions(test2.qualifiedName + ".toB").isEmpty) + } + +//// test3 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val doTest3 = { + val test3 = base._package("test3") + val A = test3._class("A") + + conv = A._conversion(A.qualifiedName + ".toB") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + } + +//// test4 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val doTest4 = { + val test4 = base._package("test4") + val A = test4._class("A") + val S = test4._object("S") + + conv = A._conversion(S.qualifiedName + ".toB") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + } + +//// test5 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + + val doTest5 = { + val test5 = base._package("test5") + val scope = test5._object("scope") + val A = scope._class("A") + + conv = A._conversion(scope.qualifiedName + ".toB") + assert(conv.members.length == 1) + assert(conv.constraints.length == 0) + } + } +}
\ No newline at end of file diff --git a/test/scaladoc/scalacheck/CommentFactoryTest.scala b/test/scaladoc/scalacheck/CommentFactoryTest.scala index 69c314a64c..68ca68efdd 100644 --- a/test/scaladoc/scalacheck/CommentFactoryTest.scala +++ b/test/scaladoc/scalacheck/CommentFactoryTest.scala @@ -3,11 +3,12 @@ import org.scalacheck.Prop._ import scala.tools.nsc.Global import scala.tools.nsc.doc +import scala.tools.nsc.doc.model._ import scala.tools.nsc.doc.model.comment._ class Factory(val g: Global, val s: doc.Settings) extends doc.model.ModelFactory(g, s) { - thisFactory: Factory with CommentFactory with doc.model.TreeFactory => + thisFactory: Factory with ModelFactoryImplicitSupport with CommentFactory with doc.model.TreeFactory => def strip(c: Comment): Option[Inline] = { c.body match { @@ -28,7 +29,7 @@ object Test extends Properties("CommentFactory") { val settings = new doc.Settings((str: String) => {}) val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings) val g = new Global(settings, reporter) - (new Factory(g, settings) with CommentFactory with doc.model.TreeFactory) + (new Factory(g, settings) with ModelFactoryImplicitSupport with CommentFactory with doc.model.TreeFactory) } def parse(src: String, dst: Inline) = { |