From 814cf34fb00f9ccb001249f4b3445ebc4f9942c9 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Thu, 12 Apr 2012 01:59:46 +0200 Subject: Next generation of macros Implements SIP 16: Self-cleaning macros: http://bit.ly/wjjXTZ Features: * Macro defs * Reification * Type tags * Manifests aliased to type tags * Extended reflection API * Several hundred tests * 1111 changed files Not yet implemented: * Reification of refined types * Expr.value splicing * Named and default macro expansions * Intricacies of interaction between macros and implicits * Emission of debug information for macros (compliant with JSR-45) Dedicated to Yuri Alekseyevich Gagarin --- test/files/codelib/code.jar.desired.sha1 | 2 +- test/files/jvm/interpreter.check | 738 ++++++++++----------- test/files/jvm/interpreter.scala | 9 +- test/files/jvm/manifests.check | 55 -- .../files/jvm/manifests.check.temporarily.disabled | 55 ++ test/files/jvm/manifests.scala | 119 ---- .../files/jvm/manifests.scala.temporarily.disabled | 109 +++ test/files/macros/Printf.scala | 39 -- test/files/macros/Test.scala | 8 - test/files/macros/macros_v0001.bat | 40 -- test/files/macros/macros_v0001.sh | 30 - test/files/neg/checksensible.check | 200 +++--- test/files/neg/classtags_contextbound_a.check | 4 + test/files/neg/classtags_contextbound_a.scala | 4 + test/files/neg/classtags_contextbound_b.check | 4 + test/files/neg/classtags_contextbound_b.scala | 5 + test/files/neg/classtags_contextbound_c.check | 4 + test/files/neg/classtags_contextbound_c.scala | 5 + .../neg/macro-argtype-mismatch/Macros_1.scala | 3 - test/files/neg/macro-argtype-mismatch/Test_2.scala | 4 - test/files/neg/macro-basic-mamdmi.check | 5 + test/files/neg/macro-basic-mamdmi.flags | 1 + .../macro-basic-mamdmi/Impls_Macros_Test_1.scala | 37 ++ test/files/neg/macro-cyclic.check | 4 + test/files/neg/macro-cyclic.flags | 1 + test/files/neg/macro-cyclic/Impls_Macros_1.scala | 25 + ...cro-deprecate-dont-touch-backquotedidents.check | 14 + .../Macros_Bind_12.scala | 6 + .../Macros_Class_4.scala | 3 + .../Macros_Class_5.scala | 3 + .../Macros_Def_13.scala | 3 + .../Macros_Object_6.scala | 3 + .../Macros_Object_7.scala | 3 + .../Macros_Package_10.scala | 3 + .../Macros_Package_11.scala | 3 + .../Macros_Trait_8.scala | 3 + .../Macros_Trait_9.scala | 3 + .../Macros_Type_3.scala | 3 + .../Macros_Val_1.scala | 3 + .../Macros_Var_2.scala | 3 + .../Main.scala | 2 + test/files/neg/macro-deprecate-idents.check | 50 ++ .../macro-deprecate-idents/Macros_Bind_12.scala | 6 + .../macro-deprecate-idents/Macros_Class_4.scala | 3 + .../macro-deprecate-idents/Macros_Class_5.scala | 3 + .../neg/macro-deprecate-idents/Macros_Def_13.scala | 3 + .../macro-deprecate-idents/Macros_Object_6.scala | 3 + .../macro-deprecate-idents/Macros_Object_7.scala | 3 + .../macro-deprecate-idents/Macros_Package_10.scala | 3 + .../macro-deprecate-idents/Macros_Package_11.scala | 3 + .../macro-deprecate-idents/Macros_Trait_8.scala | 3 + .../macro-deprecate-idents/Macros_Trait_9.scala | 3 + .../neg/macro-deprecate-idents/Macros_Type_3.scala | 3 + .../neg/macro-deprecate-idents/Macros_Val_1.scala | 3 + .../neg/macro-deprecate-idents/Macros_Var_2.scala | 3 + test/files/neg/macro-deprecate-idents/Main.scala | 2 + test/files/neg/macro-invalidimpl-a.check | 4 + test/files/neg/macro-invalidimpl-a.flags | 1 + test/files/neg/macro-invalidimpl-a/Impls_1.scala | 5 + .../neg/macro-invalidimpl-a/Macros_Test_2.scala | 9 + test/files/neg/macro-invalidimpl-b.check | 4 + test/files/neg/macro-invalidimpl-b.flags | 1 + test/files/neg/macro-invalidimpl-b/Impls_1.scala | 5 + .../neg/macro-invalidimpl-b/Macros_Test_2.scala | 9 + test/files/neg/macro-invalidimpl-c.check | 4 + test/files/neg/macro-invalidimpl-c.flags | 1 + .../neg/macro-invalidimpl-c/Impls_Macros_1.scala | 9 + test/files/neg/macro-invalidimpl-c/Test_2.scala | 3 + test/files/neg/macro-invalidimpl-d.check | 4 + test/files/neg/macro-invalidimpl-d.flags | 1 + test/files/neg/macro-invalidimpl-d/Impls_1.scala | 7 + .../neg/macro-invalidimpl-d/Macros_Test_2.scala | 7 + test/files/neg/macro-invalidimpl-e.check | 13 + test/files/neg/macro-invalidimpl-e.flags | 1 + test/files/neg/macro-invalidimpl-e/Impls_1.scala | 6 + .../neg/macro-invalidimpl-e/Macros_Test_2.scala | 9 + test/files/neg/macro-invalidimpl-f.check | 7 + test/files/neg/macro-invalidimpl-f.flags | 1 + test/files/neg/macro-invalidimpl-f/Impls_1.scala | 11 + .../neg/macro-invalidimpl-f/Macros_Test_2.scala | 9 + test/files/neg/macro-invalidimpl-g.check | 7 + test/files/neg/macro-invalidimpl-g.flags | 1 + test/files/neg/macro-invalidimpl-g/Impls_1.scala | 11 + .../neg/macro-invalidimpl-g/Macros_Test_2.scala | 8 + test/files/neg/macro-invalidimpl-h.check | 4 + test/files/neg/macro-invalidimpl-h.flags | 1 + test/files/neg/macro-invalidimpl-h/Impls_1.scala | 5 + .../neg/macro-invalidimpl-h/Macros_Test_2.scala | 8 + test/files/neg/macro-invalidret-nontree.check | 7 + test/files/neg/macro-invalidret-nontree.flags | 1 + .../neg/macro-invalidret-nontree/Impls_1.scala | 5 + .../macro-invalidret-nontree/Macros_Test_2.scala | 8 + .../neg/macro-invalidret-nonuniversetree.check | 7 + .../neg/macro-invalidret-nonuniversetree.flags | 1 + .../macro-invalidret-nonuniversetree/Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + test/files/neg/macro-invalidshape-a.check | 6 + test/files/neg/macro-invalidshape-a.flags | 1 + test/files/neg/macro-invalidshape-a/Impls_1.scala | 5 + .../neg/macro-invalidshape-a/Macros_Test_2.scala | 8 + test/files/neg/macro-invalidshape-b.check | 6 + test/files/neg/macro-invalidshape-b.flags | 1 + test/files/neg/macro-invalidshape-b/Impls_1.scala | 5 + .../neg/macro-invalidshape-b/Macros_Test_2.scala | 8 + test/files/neg/macro-invalidshape-c.check | 6 + test/files/neg/macro-invalidshape-c.flags | 1 + test/files/neg/macro-invalidshape-c/Impls_1.scala | 5 + .../neg/macro-invalidshape-c/Macros_Test_2.scala | 8 + test/files/neg/macro-invalidshape-d.check | 4 + test/files/neg/macro-invalidshape-d.flags | 1 + test/files/neg/macro-invalidshape-d/Impls_1.scala | 5 + .../neg/macro-invalidshape-d/Macros_Test_2.scala | 8 + .../neg/macro-invalidsig-context-bounds.check | 4 + .../neg/macro-invalidsig-context-bounds.flags | 1 + .../macro-invalidsig-context-bounds/Impls_1.scala | 8 + .../Macros_Test_2.scala | 8 + test/files/neg/macro-invalidsig-ctx-badargc.check | 7 + test/files/neg/macro-invalidsig-ctx-badargc.flags | 1 + .../neg/macro-invalidsig-ctx-badargc/Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + test/files/neg/macro-invalidsig-ctx-badtype.check | 7 + test/files/neg/macro-invalidsig-ctx-badtype.flags | 1 + .../neg/macro-invalidsig-ctx-badtype/Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + .../neg/macro-invalidsig-ctx-badvarargs.check | 7 + .../neg/macro-invalidsig-ctx-badvarargs.flags | 1 + .../macro-invalidsig-ctx-badvarargs/Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + test/files/neg/macro-invalidsig-ctx-noctx.check | 7 + test/files/neg/macro-invalidsig-ctx-noctx.flags | 1 + .../neg/macro-invalidsig-ctx-noctx/Impls_1.scala | 5 + .../macro-invalidsig-ctx-noctx/Macros_Test_2.scala | 8 + .../neg/macro-invalidsig-implicit-params.check | 4 + .../neg/macro-invalidsig-implicit-params.flags | 1 + .../Impls_Macros_1.scala | 18 + .../macro-invalidsig-implicit-params/Test_2.scala | 4 + .../neg/macro-invalidsig-params-badargc.check | 7 + .../neg/macro-invalidsig-params-badargc.flags | 1 + .../Impls_Macros_1.scala | 9 + .../macro-invalidsig-params-badargc/Test_2.scala | 4 + .../neg/macro-invalidsig-params-badtype.check | 7 + .../neg/macro-invalidsig-params-badtype.flags | 1 + .../Impls_Macros_1.scala | 9 + .../macro-invalidsig-params-badtype/Test_2.scala | 4 + .../neg/macro-invalidsig-params-badvarargs.check | 7 + .../neg/macro-invalidsig-params-badvarargs.flags | 1 + .../Impls_Macros_1.scala | 9 + .../Test_2.scala | 4 + .../neg/macro-invalidsig-params-namemismatch.check | 7 + .../neg/macro-invalidsig-params-namemismatch.flags | 1 + .../Impls_Macros_1.scala | 9 + .../Test_2.scala | 4 + .../neg/macro-invalidsig-tparams-badtype.check | 7 + .../neg/macro-invalidsig-tparams-badtype.flags | 1 + .../macro-invalidsig-tparams-badtype/Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + .../neg/macro-invalidsig-tparams-bounds-a.check | 4 + .../neg/macro-invalidsig-tparams-bounds-a.flags | 1 + .../Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + .../neg/macro-invalidsig-tparams-bounds-b.check | 4 + .../neg/macro-invalidsig-tparams-bounds-b.flags | 1 + .../Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + .../neg/macro-invalidsig-tparams-notparams-a.check | 4 + .../neg/macro-invalidsig-tparams-notparams-a.flags | 1 + .../Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + .../neg/macro-invalidsig-tparams-notparams-b.check | 4 + .../neg/macro-invalidsig-tparams-notparams-b.flags | 1 + .../Impls_1.scala | 11 + .../Macros_Test_2.scala | 11 + .../neg/macro-invalidsig-tparams-notparams-c.check | 4 + .../neg/macro-invalidsig-tparams-notparams-c.flags | 1 + .../Impls_1.scala | 11 + .../Macros_Test_2.scala | 11 + test/files/neg/macro-invalidusage-badargs.check | 6 + test/files/neg/macro-invalidusage-badargs.flags | 1 + .../neg/macro-invalidusage-badargs/Impls_1.scala | 5 + .../macro-invalidusage-badargs/Macros_Test_2.scala | 8 + test/files/neg/macro-invalidusage-badbounds.check | 4 + test/files/neg/macro-invalidusage-badbounds.flags | 1 + .../neg/macro-invalidusage-badbounds/Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + test/files/neg/macro-invalidusage-badtargs.check | 4 + test/files/neg/macro-invalidusage-badtargs.flags | 1 + .../neg/macro-invalidusage-badtargs/Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 + .../neg/macro-invalidusage-methodvaluesyntax.check | 4 + .../neg/macro-invalidusage-methodvaluesyntax.flags | 1 + .../Impls_1.scala | 9 + .../Macros_Test_2.scala | 8 + test/files/neg/macro-keyword.check | 49 ++ test/files/neg/macro-keyword.flags | 1 + test/files/neg/macro-keyword/Macros_Bind_12.scala | 6 + test/files/neg/macro-keyword/Macros_Class_4.scala | 3 + test/files/neg/macro-keyword/Macros_Class_5.scala | 3 + test/files/neg/macro-keyword/Macros_Def_13.scala | 3 + test/files/neg/macro-keyword/Macros_Object_6.scala | 3 + test/files/neg/macro-keyword/Macros_Object_7.scala | 3 + .../neg/macro-keyword/Macros_Package_10.scala | 3 + .../neg/macro-keyword/Macros_Package_11.scala | 3 + test/files/neg/macro-keyword/Macros_Trait_8.scala | 3 + test/files/neg/macro-keyword/Macros_Trait_9.scala | 3 + test/files/neg/macro-keyword/Macros_Type_3.scala | 3 + test/files/neg/macro-keyword/Macros_Val_1.scala | 3 + test/files/neg/macro-keyword/Macros_Var_2.scala | 3 + test/files/neg/macro-noexpand.check | 2 +- test/files/neg/macro-noexpand/Impls_1.scala | 5 + test/files/neg/macro-noexpand/Macros_1.scala | 3 - test/files/neg/macro-noexpand/Macros_Test_2.scala | 8 + test/files/neg/macro-noexpand/Test_2.scala | 4 - .../files/neg/macro-noncompilertree/Macros_1.scala | 3 - test/files/neg/macro-nontree/Macros_1.scala | 3 - test/files/neg/macro-nontypeablebody.check | 4 + test/files/neg/macro-nontypeablebody.flags | 1 + test/files/neg/macro-nontypeablebody/Impls_1.scala | 5 + .../neg/macro-nontypeablebody/Macros_Test_2.scala | 8 + ...verride-macro-overrides-abstract-method-a.check | 5 + ...verride-macro-overrides-abstract-method-a.flags | 1 + .../Impls_Macros_1.scala | 13 + .../Test_2.scala | 4 + ...verride-macro-overrides-abstract-method-b.check | 5 + ...verride-macro-overrides-abstract-method-b.flags | 1 + .../Impls_Macros_1.scala | 13 + .../Test_2.scala | 4 + .../macro-override-method-overrides-macro.check | 5 + .../macro-override-method-overrides-macro.flags | 1 + .../Impls_1.scala | 15 + .../Macros_Test_2.scala | 15 + ...o-reify-groundtypetag-hktypeparams-notags.check | 7 + .../Test.scala | 9 + ...cro-reify-groundtypetag-typeparams-notags.check | 7 + .../Test.scala | 9 + .../neg/macro-reify-groundtypetag-usetypetag.check | 7 + .../Test.scala | 9 + test/files/neg/macro-without-xmacros-a.check | 10 + .../neg/macro-without-xmacros-a/Impls_1.scala | 18 + .../neg/macro-without-xmacros-a/Macros_2.scala | 12 + .../files/neg/macro-without-xmacros-a/Test_3.scala | 4 + test/files/neg/macro-without-xmacros-b.check | 10 + .../neg/macro-without-xmacros-b/Impls_1.scala | 18 + .../neg/macro-without-xmacros-b/Macros_2.scala | 10 + .../files/neg/macro-without-xmacros-b/Test_3.scala | 4 + test/files/neg/reify_ann2a.check | 4 - test/files/neg/reify_ann2a.scala | 30 - test/files/neg/reify_ann2b.check | 11 +- test/files/neg/reify_ann2b.scala | 11 +- test/files/neg/t2386.check | 8 +- test/files/neg/t2775.check | 8 +- test/files/neg/t3507.check | 8 +- test/files/neg/t3692.check | 15 +- test/files/neg/t5334_1.check | 4 + test/files/neg/t5334_1.scala | 8 + test/files/neg/t5334_2.check | 4 + test/files/neg/t5334_2.scala | 8 + test/files/pos/implicits.scala | 89 --- .../files/pos/implicits.scala.temporarily.disabled | 89 +++ test/files/pos/liftcode_polymorphic.scala | 4 +- test/files/pos/macros.flags | 1 - test/files/pos/macros.scala | 8 - test/files/pos/manifest1.scala | 21 - .../files/pos/manifest1.scala.temporarily.disabled | 21 + test/files/pos/t5223.scala | 6 +- test/files/pos/t531.scala | 5 +- test/files/pos/t532.scala | 5 +- test/files/run/classtags_contextbound.check | 1 + test/files/run/classtags_contextbound.scala | 5 + test/files/run/classtags_core.check | 30 + test/files/run/classtags_core.scala | 32 + test/files/run/existentials3.check | 22 - .../run/existentials3.check.temporarily.disabled | 22 + test/files/run/existentials3.scala | 73 -- .../run/existentials3.scala.temporarily.disabled | 73 ++ test/files/run/groundtypetags_core.check | 30 + test/files/run/groundtypetags_core.scala | 32 + test/files/run/macro-abort-fresh.check | 6 + test/files/run/macro-abort-fresh.flags | 1 + test/files/run/macro-abort-fresh/Macros_1.scala | 15 + test/files/run/macro-abort-fresh/Test_2.scala | 6 + test/files/run/macro-basic-ma-md-mi.check | 1 + test/files/run/macro-basic-ma-md-mi.flags | 1 + test/files/run/macro-basic-ma-md-mi/Impls_1.scala | 21 + test/files/run/macro-basic-ma-md-mi/Macros_2.scala | 10 + test/files/run/macro-basic-ma-md-mi/Test_3.scala | 4 + test/files/run/macro-basic-ma-mdmi.check | 1 + test/files/run/macro-basic-ma-mdmi.flags | 1 + .../run/macro-basic-ma-mdmi/Impls_Macros_1.scala | 32 + test/files/run/macro-basic-ma-mdmi/Test_2.scala | 4 + test/files/run/macro-basic-mamd-mi.check | 1 + test/files/run/macro-basic-mamd-mi.flags | 1 + test/files/run/macro-basic-mamd-mi/Impls_1.scala | 19 + .../run/macro-basic-mamd-mi/Macros_Test_2.scala | 15 + test/files/run/macro-basic.check | 1 - test/files/run/macro-basic.flags | 1 - test/files/run/macro-basic/Macros_1.scala | 10 - test/files/run/macro-basic/Test_2.scala | 4 - test/files/run/macro-bodyexpandstoimpl.check | 1 + test/files/run/macro-bodyexpandstoimpl.flags | 1 + .../run/macro-bodyexpandstoimpl/Impls_1.scala | 12 + .../macro-bodyexpandstoimpl/Macros_Test_2.scala | 10 + test/files/run/macro-declared-in-annotation.check | 1 + test/files/run/macro-declared-in-annotation.flags | 1 + .../run/macro-declared-in-annotation/Impls_1.scala | 11 + .../macro-declared-in-annotation/Macros_2.scala | 8 + .../run/macro-declared-in-annotation/Test_3.scala | 3 + test/files/run/macro-declared-in-anonymous.check | 2 + test/files/run/macro-declared-in-anonymous.flags | 1 + .../run/macro-declared-in-anonymous/Impls_1.scala | 11 + .../Macros_Test_2.scala | 4 + test/files/run/macro-declared-in-block.check | 2 + test/files/run/macro-declared-in-block.flags | 1 + .../run/macro-declared-in-block/Impls_1.scala | 11 + .../macro-declared-in-block/Macros_Test_2.scala | 6 + test/files/run/macro-declared-in-class-class.check | 2 + test/files/run/macro-declared-in-class-class.flags | 1 + .../macro-declared-in-class-class/Impls_1.scala | 11 + .../Macros_Test_2.scala | 10 + .../files/run/macro-declared-in-class-object.check | 2 + .../files/run/macro-declared-in-class-object.flags | 1 + .../macro-declared-in-class-object/Impls_1.scala | 11 + .../Macros_Test_2.scala | 10 + test/files/run/macro-declared-in-class.check | 2 + test/files/run/macro-declared-in-class.flags | 1 + .../run/macro-declared-in-class/Impls_1.scala | 11 + .../macro-declared-in-class/Macros_Test_2.scala | 7 + .../run/macro-declared-in-default-param.check | 5 + .../run/macro-declared-in-default-param.flags | 1 + .../macro-declared-in-default-param/Impls_1.scala | 11 + .../Macros_Test_2.scala | 7 + .../run/macro-declared-in-implicit-class.check | 2 + .../run/macro-declared-in-implicit-class.flags | 1 + .../Impls_Macros_1.scala | 19 + .../macro-declared-in-implicit-class/Test_2.scala | 4 + test/files/run/macro-declared-in-method.check | 2 + test/files/run/macro-declared-in-method.flags | 1 + .../run/macro-declared-in-method/Impls_1.scala | 11 + .../macro-declared-in-method/Macros_Test_2.scala | 8 + .../files/run/macro-declared-in-object-class.check | 2 + .../files/run/macro-declared-in-object-class.flags | 1 + .../macro-declared-in-object-class/Impls_1.scala | 11 + .../Macros_Test_2.scala | 10 + .../run/macro-declared-in-object-object.check | 2 + .../run/macro-declared-in-object-object.flags | 1 + .../macro-declared-in-object-object/Impls_1.scala | 11 + .../Macros_Test_2.scala | 10 + test/files/run/macro-declared-in-object.check | 2 + test/files/run/macro-declared-in-object.flags | 1 + .../run/macro-declared-in-object/Impls_1.scala | 11 + .../macro-declared-in-object/Macros_Test_2.scala | 7 + .../run/macro-declared-in-package-object.check | 2 + .../run/macro-declared-in-package-object.flags | 1 + .../macro-declared-in-package-object/Impls_1.scala | 11 + .../Macros_Test_2.scala | 8 + test/files/run/macro-declared-in-refinement.check | 2 + test/files/run/macro-declared-in-refinement.flags | 1 + .../run/macro-declared-in-refinement/Impls_1.scala | 11 + .../Macros_Test_2.scala | 6 + test/files/run/macro-declared-in-trait.check | 15 + test/files/run/macro-declared-in-trait.flags | 1 + .../run/macro-declared-in-trait/Impls_1.scala | 11 + .../macro-declared-in-trait/Macros_Test_2.scala | 13 + test/files/run/macro-def-infer-return-type-a.check | 1 + test/files/run/macro-def-infer-return-type-a.flags | 1 + .../macro-def-infer-return-type-a/Impls_1.scala | 5 + .../Macros_Test_2.scala | 4 + test/files/run/macro-def-infer-return-type-b.check | 6 + test/files/run/macro-def-infer-return-type-b.flags | 1 + .../Impls_Macros_1.scala | 10 + .../run/macro-def-infer-return-type-b/Test_2.scala | 6 + test/files/run/macro-def-infer-return-type-c.check | 1 + test/files/run/macro-def-infer-return-type-c.flags | 1 + .../macro-def-infer-return-type-c/Impls_1.scala | 5 + .../Macros_Test_2.scala | 4 + test/files/run/macro-def-path-dependent-a.check | 1 + test/files/run/macro-def-path-dependent-a.flags | 1 + .../Impls_Macros_1.scala | 21 + .../run/macro-def-path-dependent-a/Test_2.scala | 3 + test/files/run/macro-def-path-dependent-b.check | 1 + test/files/run/macro-def-path-dependent-b.flags | 1 + .../Impls_Macros_1.scala | 20 + .../run/macro-def-path-dependent-b/Test_2.scala | 3 + test/files/run/macro-def-path-dependent-c.check | 1 + test/files/run/macro-def-path-dependent-c.flags | 1 + .../Impls_Macros_1.scala | 20 + .../run/macro-def-path-dependent-c/Test_2.scala | 3 + test/files/run/macro-def-path-dependent-d.check | 1 + test/files/run/macro-def-path-dependent-d.flags | 1 + .../Impls_Macros_1.scala | 8 + .../run/macro-def-path-dependent-d/Test_2.scala | 3 + .../macro-expand-implicit-macro-has-implicit.check | 1 + .../macro-expand-implicit-macro-has-implicit.flags | 1 + .../Impls_1.scala | 9 + .../Macros_Test_2.scala | 5 + .../macro-expand-implicit-macro-is-implicit.check | 2 + .../macro-expand-implicit-macro-is-implicit.flags | 1 + .../Impls_1.scala | 9 + .../Macros_Test_2.scala | 10 + .../run/macro-expand-implicit-macro-is-val.check | 1 + .../run/macro-expand-implicit-macro-is-val.flags | 1 + .../Impls_1.scala | 9 + .../Macros_Test_2.scala | 5 + .../run/macro-expand-implicit-macro-is-view.check | 1 + .../run/macro-expand-implicit-macro-is-view.flags | 1 + .../Impls_1.scala | 9 + .../Macros_Test_2.scala | 9 + .../files/run/macro-expand-multiple-arglists.check | 1 + .../files/run/macro-expand-multiple-arglists.flags | 1 + .../macro-expand-multiple-arglists/Impls_1.scala | 10 + .../Macros_Test_2.scala | 4 + test/files/run/macro-expand-nullary-generic.check | 6 + test/files/run/macro-expand-nullary-generic.flags | 1 + .../run/macro-expand-nullary-generic/Impls_1.scala | 14 + .../Macros_Test_2.scala | 15 + .../run/macro-expand-nullary-nongeneric.check | 6 + .../run/macro-expand-nullary-nongeneric.flags | 1 + .../macro-expand-nullary-nongeneric/Impls_1.scala | 14 + .../Macros_Test_2.scala | 15 + test/files/run/macro-expand-overload.check | 6 + test/files/run/macro-expand-overload.flags | 1 + test/files/run/macro-expand-overload/Impls_1.scala | 15 + .../run/macro-expand-overload/Macros_Test_2.scala | 20 + test/files/run/macro-expand-override.check | 15 + test/files/run/macro-expand-override.flags | 1 + test/files/run/macro-expand-override/Impls_1.scala | 15 + .../run/macro-expand-override/Macros_Test_2.scala | 43 ++ test/files/run/macro-expand-recursive.check | 1 + test/files/run/macro-expand-recursive.flags | 1 + .../files/run/macro-expand-recursive/Impls_1.scala | 15 + .../run/macro-expand-recursive/Macros_Test_2.scala | 8 + test/files/run/macro-expand-tparams-bounds-a.check | 0 test/files/run/macro-expand-tparams-bounds-a.flags | 1 + .../macro-expand-tparams-bounds-a/Impls_1.scala | 8 + .../Macros_Test_2.scala | 8 + test/files/run/macro-expand-tparams-bounds-b.check | 0 test/files/run/macro-expand-tparams-bounds-b.flags | 1 + .../macro-expand-tparams-bounds-b/Impls_1.scala | 10 + .../Macros_Test_2.scala | 10 + test/files/run/macro-expand-tparams-explicit.check | 1 + test/files/run/macro-expand-tparams-explicit.flags | 1 + .../macro-expand-tparams-explicit/Impls_1.scala | 10 + .../Macros_Test_2.scala | 4 + test/files/run/macro-expand-tparams-implicit.check | 2 + test/files/run/macro-expand-tparams-implicit.flags | 1 + .../macro-expand-tparams-implicit/Impls_1.scala | 10 + .../Macros_Test_2.scala | 5 + .../run/macro-expand-tparams-only-in-impl.flags | 1 + .../Impls_1.scala | 8 + .../Macros_Test_2.scala | 8 + test/files/run/macro-expand-tparams-optional.check | 1 + test/files/run/macro-expand-tparams-optional.flags | 1 + .../macro-expand-tparams-optional/Impls_1.scala | 9 + .../Macros_Test_2.scala | 4 + test/files/run/macro-expand-tparams-prefix-a.check | 4 + test/files/run/macro-expand-tparams-prefix-a.flags | 1 + .../macro-expand-tparams-prefix-a/Impls_1.scala | 10 + .../Macros_Test_2.scala | 10 + test/files/run/macro-expand-tparams-prefix-b.check | 2 + test/files/run/macro-expand-tparams-prefix-b.flags | 1 + .../macro-expand-tparams-prefix-b/Impls_1.scala | 11 + .../Macros_Test_2.scala | 10 + .../files/run/macro-expand-tparams-prefix-c1.check | 3 + .../files/run/macro-expand-tparams-prefix-c1.flags | 1 + .../macro-expand-tparams-prefix-c1/Impls_1.scala | 12 + .../Macros_Test_2.scala | 11 + .../files/run/macro-expand-tparams-prefix-c2.check | 3 + .../files/run/macro-expand-tparams-prefix-c2.flags | 1 + .../Impls_Macros_1.scala | 18 + .../macro-expand-tparams-prefix-c2/Test_2.scala | 5 + .../files/run/macro-expand-tparams-prefix-d1.check | 3 + .../files/run/macro-expand-tparams-prefix-d1.flags | 1 + .../macro-expand-tparams-prefix-d1/Impls_1.scala | 12 + .../Macros_Test_2.scala | 11 + ...pand-varargs-explicit-over-nonvarargs-bad.check | 4 + ...pand-varargs-explicit-over-nonvarargs-bad.flags | 1 + .../Impls_1.scala | 9 + .../Macros_Test_2.scala | 10 + ...and-varargs-explicit-over-nonvarargs-good.check | 1 + ...and-varargs-explicit-over-nonvarargs-good.flags | 1 + .../Impls_1.scala | 13 + .../Macros_Test_2.scala | 8 + ...acro-expand-varargs-explicit-over-varargs.check | 1 + ...acro-expand-varargs-explicit-over-varargs.flags | 1 + .../Impls_1.scala | 13 + .../Macros_Test_2.scala | 8 + ...o-expand-varargs-implicit-over-nonvarargs.check | 1 + ...o-expand-varargs-implicit-over-nonvarargs.flags | 1 + .../Impls_1.scala | 9 + .../Macros_Test_2.scala | 7 + ...acro-expand-varargs-implicit-over-varargs.check | 1 + ...acro-expand-varargs-implicit-over-varargs.flags | 1 + .../Impls_1.scala | 13 + .../Macros_Test_2.scala | 7 + test/files/run/macro-impl-default-params.check | 5 + test/files/run/macro-impl-default-params.flags | 1 + .../macro-impl-default-params/Impls_Macros_1.scala | 20 + .../run/macro-impl-default-params/Test_2.scala | 4 + test/files/run/macro-impl-rename-context.check | 2 + test/files/run/macro-impl-rename-context.flags | 1 + .../macro-impl-rename-context/Impls_Macros_1.scala | 15 + .../run/macro-impl-rename-context/Test_2.scala | 4 + ...-invalidret-doesnt-conform-to-def-rettype.check | 5 + ...-invalidret-doesnt-conform-to-def-rettype.flags | 1 + .../Impls_Macros_1.scala | 12 + .../Test_2.scala | 6 + ...invalidret-doesnt-conform-to-impl-rettype.check | 0 ...invalidret-doesnt-conform-to-impl-rettype.flags | 1 + test/files/run/macro-invalidret-nontypeable.check | 3 + test/files/run/macro-invalidret-nontypeable.flags | 1 + .../Impls_Macros_1.scala | 13 + .../run/macro-invalidret-nontypeable/Test_2.scala | 6 + test/files/run/macro-invalidusage-badret.check | 5 + test/files/run/macro-invalidusage-badret.flags | 1 + .../macro-invalidusage-badret/Impls_Macros_1.scala | 9 + .../run/macro-invalidusage-badret/Test_2.scala | 6 + .../macro-invalidusage-partialapplication.check | 3 + .../macro-invalidusage-partialapplication.flags | 1 + .../Impls_Macros_1.scala | 14 + .../Test_2.scala | 6 + test/files/run/macro-openmacros.check | 3 + test/files/run/macro-openmacros.flags | 1 + .../run/macro-openmacros/Impls_Macros_1.scala | 26 + test/files/run/macro-openmacros/Test_2.scala | 3 + test/files/run/macro-quasiinvalidbody-c.check | 1 + test/files/run/macro-quasiinvalidbody-c.flags | 1 + .../macro-quasiinvalidbody-c/Impls_Macros_1.scala | 9 + .../run/macro-quasiinvalidbody-c/Test_2.scala | 4 + test/files/run/macro-range/Common_1.scala | 48 ++ .../run/macro-range/Expansion_Impossible_2.scala | 53 ++ .../run/macro-range/Expansion_Possible_3.scala | 7 + test/files/run/macro-range/macro_range_1.scala | 99 --- test/files/run/macro-range/macro_range_2.scala | 99 --- .../run/macro-reflective-ma-normal-mdmi.check | 1 + .../run/macro-reflective-ma-normal-mdmi.flags | 1 + .../Impls_Macros_1.scala | 13 + .../macro-reflective-ma-normal-mdmi/Test_2.scala | 5 + .../run/macro-reflective-mamd-normal-mi.check | 1 + .../run/macro-reflective-mamd-normal-mi.flags | 0 .../macro-reflective-mamd-normal-mi/Impls_1.scala | 9 + .../Macros_Test_2.scala | 16 + test/files/run/macro-reify-basic.check | 1 + test/files/run/macro-reify-basic.flags | 1 + test/files/run/macro-reify-basic/Macros_1.scala | 11 + test/files/run/macro-reify-basic/Test_2.scala | 3 + test/files/run/macro-reify-eval-eval.check | 1 + test/files/run/macro-reify-eval-eval.flags | 1 + .../files/run/macro-reify-eval-eval/Macros_1.scala | 12 + test/files/run/macro-reify-eval-eval/Test_2.scala | 3 + .../files/run/macro-reify-eval-outside-reify.check | 1 + .../files/run/macro-reify-eval-outside-reify.flags | 1 + .../Impls_Macros_1.scala | 9 + .../macro-reify-eval-outside-reify/Test_2.scala | 5 + test/files/run/macro-reify-freevars.check | 3 + test/files/run/macro-reify-freevars.flags | 1 + test/files/run/macro-reify-freevars/Macros_1.scala | 19 + test/files/run/macro-reify-freevars/Test_2.scala | 9 + .../macro-reify-groundtypetag-notypeparams.check | 2 + .../Test.scala | 6 + ...macro-reify-groundtypetag-typeparams-tags.check | 2 + .../Test.scala | 9 + test/files/run/macro-reify-nested-a.check | 0 test/files/run/macro-reify-nested-a.flags | 1 + .../run/macro-reify-nested-a/Impls_Macros_1.scala | 43 ++ test/files/run/macro-reify-nested-a/Test_2.scala | 4 + test/files/run/macro-reify-nested-b.check | 0 test/files/run/macro-reify-nested-b.flags | 1 + .../run/macro-reify-nested-b/Impls_Macros_1.scala | 43 ++ test/files/run/macro-reify-nested-b/Test_2.scala | 4 + .../files/run/macro-reify-ref-to-packageless.check | 1 + .../files/run/macro-reify-ref-to-packageless.flags | 1 + .../macro-reify-ref-to-packageless/Impls_1.scala | 6 + .../macro-reify-ref-to-packageless/Test_2.scala | 4 + test/files/run/macro-reify-tagful-a.check | 1 + test/files/run/macro-reify-tagful-a.flags | 1 + test/files/run/macro-reify-tagful-a/Macros_1.scala | 11 + test/files/run/macro-reify-tagful-a/Test_2.scala | 4 + test/files/run/macro-reify-tagless-a.check | 3 + test/files/run/macro-reify-tagless-a.flags | 1 + .../run/macro-reify-tagless-a/Impls_Macros_1.scala | 11 + test/files/run/macro-reify-tagless-a/Test_2.scala | 12 + .../run/macro-reify-typetag-notypeparams.check | 2 + .../macro-reify-typetag-notypeparams/Test.scala | 6 + .../macro-reify-typetag-typeparams-notags.check | 2 + .../Test.scala | 9 + .../run/macro-reify-typetag-typeparams-tags.check | 2 + .../macro-reify-typetag-typeparams-tags/Test.scala | 9 + .../run/macro-reify-typetag-usegroundtypetag.check | 2 + .../Test.scala | 9 + test/files/run/macro-reify-unreify.check | 1 + test/files/run/macro-reify-unreify.flags | 1 + test/files/run/macro-reify-unreify/Macros_1.scala | 19 + test/files/run/macro-reify-unreify/Test_2.scala | 3 + .../run/macro-reify-value-outside-reify.check | 1 + .../run/macro-reify-value-outside-reify.flags | 1 + .../Impls_Macros_1.scala | 9 + .../macro-reify-value-outside-reify/Test_2.scala | 6 + test/files/run/macro-repl-basic.check | 34 +- test/files/run/macro-repl-basic.scala | 27 +- test/files/run/macro-repl-dontexpand.check | 5 +- test/files/run/macro-repl-dontexpand.scala | 3 +- .../run/macro-rettype-mismatch/Macros_1.scala | 3 - test/files/run/macro-rettype-mismatch/Test_2.scala | 16 - test/files/run/macro-settings.check | 1 + test/files/run/macro-settings.flags | 1 + test/files/run/macro-settings/Impls_Macros_1.scala | 11 + test/files/run/macro-settings/Test_2.scala | 3 + test/files/run/macro-sip19-revised.check | 5 + test/files/run/macro-sip19-revised.flags | 1 + .../run/macro-sip19-revised/Impls_Macros_1.scala | 34 + test/files/run/macro-sip19-revised/Test_2.scala | 12 + test/files/run/macro-sip19.check | 5 + test/files/run/macro-sip19.flags | 1 + test/files/run/macro-sip19/Impls_Macros_1.scala | 25 + test/files/run/macro-sip19/Test_2.scala | 16 + .../run/macro-typecheck-implicitsdisabled.check | 2 + .../run/macro-typecheck-implicitsdisabled.flags | 1 + .../Impls_Macros_1.scala | 28 + .../macro-typecheck-implicitsdisabled/Test_2.scala | 4 + .../files/run/macro-typecheck-macrosdisabled.check | 5 + .../files/run/macro-typecheck-macrosdisabled.flags | 1 + .../Impls_Macros_1.scala | 36 + .../macro-typecheck-macrosdisabled/Test_2.scala | 4 + test/files/run/macro-undetparams-consfromsls.check | 5 + test/files/run/macro-undetparams-consfromsls.flags | 1 + .../Impls_Macros_1.scala | 17 + .../run/macro-undetparams-consfromsls/Test_2.scala | 7 + test/files/run/macro-undetparams-implicitval.check | 1 + test/files/run/macro-undetparams-implicitval.flags | 1 + .../run/macro-undetparams-implicitval/Test.scala | 4 + test/files/run/macro-undetparams-macroitself.check | 2 + test/files/run/macro-undetparams-macroitself.flags | 1 + .../Impls_Macros_1.scala | 7 + .../run/macro-undetparams-macroitself/Test_2.scala | 4 + test/files/run/manifests.scala | 71 +- test/files/run/primitive-sigs-2.check | 14 +- test/files/run/reify_ann1a.check | 60 +- test/files/run/reify_ann1a.scala | 11 +- test/files/run/reify_ann1b.check | 60 +- test/files/run/reify_ann1b.scala | 11 +- test/files/run/reify_ann2a.check | 44 ++ test/files/run/reify_ann2a.scala | 25 + test/files/run/reify_ann3.check | 21 + test/files/run/reify_ann3.scala | 19 + test/files/run/reify_ann4.check | 32 + test/files/run/reify_ann4.scala | 23 + test/files/run/reify_ann5.check | 22 + test/files/run/reify_ann5.scala | 20 + test/files/run/reify_anonymous.scala | 12 +- test/files/run/reify_classfileann_a.check | 36 +- test/files/run/reify_classfileann_a.scala | 11 +- test/files/run/reify_classfileann_b.check | 20 + test/files/run/reify_classfileann_b.scala | 23 + test/files/run/reify_closure1.scala | 9 +- test/files/run/reify_closure2a.scala | 9 +- test/files/run/reify_closure3a.scala | 9 +- test/files/run/reify_closure4a.scala | 9 +- test/files/run/reify_closure5a.scala | 17 +- test/files/run/reify_closure6.scala | 17 +- test/files/run/reify_closure7.scala | 17 +- test/files/run/reify_closure8a.scala | 10 +- test/files/run/reify_closure8b.check | 3 + test/files/run/reify_closure8b.scala | 18 + test/files/run/reify_closures10.scala | 10 +- test/files/run/reify_complex.scala | 12 +- test/files/run/reify_extendbuiltins.scala | 12 +- test/files/run/reify_for1.scala | 12 +- test/files/run/reify_fors.scala | 12 +- test/files/run/reify_generic.scala | 12 +- test/files/run/reify_generic2.scala | 12 +- test/files/run/reify_getter.scala | 11 +- test/files/run/reify_implicits.scala | 12 +- test/files/run/reify_inheritance.scala | 12 +- test/files/run/reify_inner1.scala | 12 +- test/files/run/reify_inner2.scala | 12 +- test/files/run/reify_inner3.scala | 12 +- test/files/run/reify_inner4.scala | 12 +- test/files/run/reify_maps.scala | 12 +- .../reify_metalevel_breach_+0_refers_to_1.check | 1 + .../reify_metalevel_breach_+0_refers_to_1.scala | 13 + .../reify_metalevel_breach_-1_refers_to_0_a.check | 1 + .../reify_metalevel_breach_-1_refers_to_0_a.scala | 11 + .../reify_metalevel_breach_-1_refers_to_0_b.check | 1 + .../reify_metalevel_breach_-1_refers_to_0_b.scala | 15 + .../reify_metalevel_breach_-1_refers_to_1.check | 1 + .../reify_metalevel_breach_-1_refers_to_1.scala | 13 + .../run/reify_nested_inner_refers_to_global.check | 1 + .../run/reify_nested_inner_refers_to_global.scala | 14 + .../run/reify_nested_inner_refers_to_local.check | 1 + .../run/reify_nested_inner_refers_to_local.scala | 12 + .../run/reify_nested_outer_refers_to_global.check | 1 + .../run/reify_nested_outer_refers_to_global.scala | 16 + .../run/reify_nested_outer_refers_to_local.check | 1 + .../run/reify_nested_outer_refers_to_local.scala | 16 + test/files/run/reify_newimpl_01.check | 1 + test/files/run/reify_newimpl_01.scala | 11 + test/files/run/reify_newimpl_02.check | 1 + test/files/run/reify_newimpl_02.scala | 11 + test/files/run/reify_newimpl_03.check | 1 + test/files/run/reify_newimpl_03.scala | 11 + test/files/run/reify_newimpl_04.check | 1 + test/files/run/reify_newimpl_04.scala | 11 + test/files/run/reify_newimpl_05.check | 1 + test/files/run/reify_newimpl_05.scala | 12 + test/files/run/reify_newimpl_06.check | 1 + test/files/run/reify_newimpl_06.scala | 11 + test/files/run/reify_newimpl_09.check | 1 + test/files/run/reify_newimpl_09.scala | 11 + test/files/run/reify_newimpl_10.check | 1 + test/files/run/reify_newimpl_10.scala | 12 + test/files/run/reify_newimpl_11.check | 2 + test/files/run/reify_newimpl_11.scala | 17 + test/files/run/reify_newimpl_12.check | 1 + test/files/run/reify_newimpl_12.scala | 12 + test/files/run/reify_newimpl_13.check | 2 + test/files/run/reify_newimpl_13.scala | 19 + test/files/run/reify_newimpl_14.check | 1 + test/files/run/reify_newimpl_14.scala | 14 + test/files/run/reify_newimpl_15.check | 1 + test/files/run/reify_newimpl_15.scala | 13 + test/files/run/reify_newimpl_16.check | 1 + test/files/run/reify_newimpl_16.scala | 15 + test/files/run/reify_newimpl_17.check | 2 + test/files/run/reify_newimpl_17.scala | 18 + test/files/run/reify_newimpl_18.check | 1 + test/files/run/reify_newimpl_18.scala | 13 + test/files/run/reify_newimpl_19.check | 2 + test/files/run/reify_newimpl_19.scala | 18 + test/files/run/reify_newimpl_20.check | 1 + test/files/run/reify_newimpl_20.scala | 14 + test/files/run/reify_newimpl_21.check | 1 + test/files/run/reify_newimpl_21.scala | 18 + test/files/run/reify_newimpl_22.check | 23 + test/files/run/reify_newimpl_22.scala | 15 + test/files/run/reify_newimpl_23.check | 22 + test/files/run/reify_newimpl_23.scala | 14 + test/files/run/reify_newimpl_24.check | 24 + test/files/run/reify_newimpl_24.scala | 16 + test/files/run/reify_newimpl_25.check | 21 + test/files/run/reify_newimpl_25.scala | 13 + test/files/run/reify_newimpl_26.check | 23 + test/files/run/reify_newimpl_26.scala | 13 + test/files/run/reify_newimpl_27.check | 1 + test/files/run/reify_newimpl_27.scala | 13 + test/files/run/reify_newimpl_28.check | 1 + test/files/run/reify_newimpl_28.scala | 15 + test/files/run/reify_newimpl_29.check | 1 + test/files/run/reify_newimpl_29.scala | 13 + test/files/run/reify_newimpl_30.check | 1 + test/files/run/reify_newimpl_30.scala | 15 + test/files/run/reify_newimpl_31.check | 1 + test/files/run/reify_newimpl_31.scala | 13 + test/files/run/reify_newimpl_32.check | 1 + test/files/run/reify_newimpl_32.scala | 15 + test/files/run/reify_newimpl_33.check | 1 + test/files/run/reify_newimpl_33.scala | 14 + test/files/run/reify_newimpl_34.check | 1 + test/files/run/reify_newimpl_34.scala | 16 + test/files/run/reify_newimpl_36.check | 1 + test/files/run/reify_newimpl_36.scala | 14 + test/files/run/reify_newimpl_37.check | 1 + test/files/run/reify_newimpl_37.scala | 15 + test/files/run/reify_newimpl_38.check | 1 + test/files/run/reify_newimpl_38.scala | 14 + test/files/run/reify_newimpl_39.check | 1 + test/files/run/reify_newimpl_39.scala | 15 + test/files/run/reify_newimpl_40.check | 1 + test/files/run/reify_newimpl_40.scala | 15 + test/files/run/reify_newimpl_41.check | 3 + test/files/run/reify_newimpl_41.scala | 17 + test/files/run/reify_newimpl_42.check | 3 + test/files/run/reify_newimpl_42.scala | 16 + test/files/run/reify_newimpl_43.check | 2 + test/files/run/reify_newimpl_43.scala | 15 + test/files/run/reify_newimpl_44.check | 2 + test/files/run/reify_newimpl_44.scala | 15 + test/files/run/reify_newimpl_45.check | 2 + test/files/run/reify_newimpl_45.scala | 12 + test/files/run/reify_newimpl_47.check | 1 + test/files/run/reify_newimpl_47.scala | 15 + test/files/run/reify_newimpl_48.check | 1 + test/files/run/reify_newimpl_48.scala | 20 + test/files/run/reify_newimpl_49.check | 3 + test/files/run/reify_newimpl_49.scala | 15 + test/files/run/reify_newimpl_50.check | 3 + test/files/run/reify_newimpl_50.scala | 14 + test/files/run/reify_newimpl_51.check | 3 + test/files/run/reify_newimpl_51.scala | 17 + test/files/run/reify_newimpl_52.check | 3 + test/files/run/reify_newimpl_52.scala | 17 + test/files/run/reify_printf.scala | 11 +- test/files/run/reify_sort.scala | 12 +- test/files/run/reify_sort1.scala | 12 +- test/files/run/reify_this.scala | 25 +- test/files/run/reify_timeofday.scala | 12 +- test/files/run/reify_typerefs_1a.check | 1 + test/files/run/reify_typerefs_1a.scala | 15 + test/files/run/reify_typerefs_1b.check | 1 + test/files/run/reify_typerefs_1b.scala | 15 + test/files/run/reify_typerefs_2a.check | 1 + test/files/run/reify_typerefs_2a.scala | 17 + test/files/run/reify_typerefs_2b.check | 1 + test/files/run/reify_typerefs_2b.scala | 17 + test/files/run/reify_typerefs_3a.check | 1 + test/files/run/reify_typerefs_3a.scala | 17 + test/files/run/reify_typerefs_3b.check | 1 + test/files/run/reify_typerefs_3b.scala | 17 + test/files/run/reify_varargs.scala | 12 +- test/files/run/repl-power.check | 64 +- test/files/run/t1195.check | 6 - test/files/run/t1195.check.temporarily.disabled | 6 + test/files/run/t1195.scala | 26 - test/files/run/t1195.scala.temporarily.disabled | 26 + test/files/run/t3758.check | 6 + test/files/run/t3758.scala | 12 +- test/files/run/t4110.check | 2 - test/files/run/t4110.check.temporarily.disabled | 2 + test/files/run/t4110.scala | 11 - test/files/run/t4110.scala.temporarily.disabled | 11 + test/files/run/t5224.check | 18 +- test/files/run/t5224.scala | 5 +- test/files/run/t5225_1.check | 8 +- test/files/run/t5225_1.scala | 5 +- test/files/run/t5225_2.check | 8 +- test/files/run/t5225_2.scala | 5 +- test/files/run/t5229_1.scala | 12 +- test/files/run/t5229_2.scala | 9 +- test/files/run/t5230.scala | 9 +- test/files/run/t5258a.check | 1 - test/files/run/t5258a.scala | 13 - test/files/run/t5266_1.scala | 9 +- test/files/run/t5266_2.scala | 9 +- test/files/run/t5269.scala | 12 +- test/files/run/t5270.scala | 12 +- test/files/run/t5271_1.check | 22 +- test/files/run/t5271_1.scala | 9 +- test/files/run/t5271_2.check | 24 +- test/files/run/t5271_2.scala | 9 +- test/files/run/t5271_3.check | 38 +- test/files/run/t5271_3.scala | 9 +- test/files/run/t5271_4.scala | 12 +- test/files/run/t5272_1.scala | 12 +- test/files/run/t5272_2.scala | 12 +- test/files/run/t5273_1.scala | 12 +- test/files/run/t5273_2a.scala | 12 +- test/files/run/t5273_2b.scala | 12 +- test/files/run/t5274_1.scala | 12 +- test/files/run/t5274_2.scala | 12 +- test/files/run/t5275.scala | 12 +- test/files/run/t5276_1a.scala | 12 +- test/files/run/t5276_1b.scala | 12 +- test/files/run/t5276_2a.scala | 12 +- test/files/run/t5276_2b.scala | 12 +- test/files/run/t5277_1.scala | 12 +- test/files/run/t5277_2.scala | 12 +- test/files/run/t5279.scala | 12 +- test/files/run/t5334_1.scala | 12 +- test/files/run/t5334_2.scala | 12 +- test/files/run/t5335.scala | 12 +- test/files/run/t5415.scala | 10 +- test/files/run/t5419.check | 2 +- test/files/run/t5419.scala | 5 +- test/files/run/t5423.scala | 3 - test/files/run/toolbox_console_reporter.check | 0 test/files/run/toolbox_console_reporter.scala | 16 + .../run/toolbox_default_reporter_is_silent.check | 1 + .../run/toolbox_default_reporter_is_silent.scala | 13 + test/files/run/toolbox_silent_reporter.check | 4 + test/files/run/toolbox_silent_reporter.scala | 16 + .../run/toolbox_typecheck_implicitsdisabled.check | 5 + .../run/toolbox_typecheck_implicitsdisabled.scala | 24 + .../run/toolbox_typecheck_macrosdisabled.check | 5 + .../run/toolbox_typecheck_macrosdisabled.scala | 17 + test/files/run/treePrint.check | 5 - .../files/run/treePrint.check.temporarily.disabled | 5 + test/files/run/treePrint.scala | 42 -- .../files/run/treePrint.scala.temporarily.disabled | 42 ++ test/files/run/typetags_core.check | 30 + test/files/run/typetags_core.scala | 32 + test/pending/neg/reify_packed.check | 4 + test/pending/neg/reify_packed.scala | 10 + test/pending/run/macro-expand-default.flags | 1 + .../pending/run/macro-expand-default/Impls_1.scala | 10 + .../run/macro-expand-default/Macros_Test_2.scala | 8 + ...o-expand-implicit-macro-has-context-bound.check | 1 + ...o-expand-implicit-macro-has-context-bound.flags | 1 + .../Impls_1.scala | 10 + .../Macros_Test_2.scala | 4 + test/pending/run/macro-expand-named.flags | 1 + test/pending/run/macro-expand-named/Impls_1.scala | 10 + .../run/macro-expand-named/Macros_Test_2.scala | 5 + .../run/macro-expand-tparams-prefix-e1.check | 3 + .../run/macro-expand-tparams-prefix-e1.flags | 1 + .../macro-expand-tparams-prefix-e1/Impls_1.scala | 12 + .../Macros_Test_2.scala | 13 + .../run/macro-expand-tparams-prefix-f1.check | 3 + .../run/macro-expand-tparams-prefix-f1.flags | 1 + .../macro-expand-tparams-prefix-f1/Impls_1.scala | 12 + .../Macros_Test_2.scala | 13 + test/pending/run/macro-overload.check | 4 - test/pending/run/macro-overload.flags | 1 - test/pending/run/macro-overload/Macros_1.scala | 9 - test/pending/run/macro-overload/Test_2.scala | 6 - test/pending/run/macro-quasiinvalidbody-a.check | 1 + test/pending/run/macro-quasiinvalidbody-a.flags | 1 + .../run/macro-quasiinvalidbody-a/Impls_1.scala | 5 + .../macro-quasiinvalidbody-a/Macros_Test_2.scala | 10 + test/pending/run/macro-quasiinvalidbody-b.check | 1 + test/pending/run/macro-quasiinvalidbody-b.flags | 1 + .../run/macro-quasiinvalidbody-b/Impls_1.scala | 7 + .../macro-quasiinvalidbody-b/Macros_Test_2.scala | 10 + test/pending/run/macro-reify-array.flags | 1 + test/pending/run/macro-reify-array/Macros_1.scala | 11 + test/pending/run/macro-reify-array/Test_2.scala | 4 + test/pending/run/macro-reify-eval-vs-value.flags | 1 + .../run/macro-reify-eval-vs-value/Macros_1.scala | 25 + .../run/macro-reify-eval-vs-value/Test_2.scala | 5 + ...cro-reify-groundtypetag-hktypeparams-tags.check | 2 + .../Test.scala | 9 + test/pending/run/macro-reify-tagful-b.check | 1 + test/pending/run/macro-reify-tagful-b.flags | 1 + .../run/macro-reify-tagful-b/Macros_1.scala | 11 + test/pending/run/macro-reify-tagful-b/Test_2.scala | 4 + test/pending/run/macro-reify-tagless-b.check | 3 + test/pending/run/macro-reify-tagless-b.flags | 1 + .../run/macro-reify-tagless-b/Impls_Macros_1.scala | 11 + .../pending/run/macro-reify-tagless-b/Test_2.scala | 11 + .../macro-reify-typetag-hktypeparams-notags.check | 2 + .../Test.scala | 9 + .../macro-reify-typetag-hktypeparams-tags.check | 2 + .../Test.scala | 9 + test/pending/run/reify_addressbook.scala | 12 +- test/pending/run/reify_brainf_ck.scala | 12 +- test/pending/run/reify_callccinterpreter.scala | 12 +- test/pending/run/reify_classfileann_b.check | 0 test/pending/run/reify_classfileann_b.scala | 24 - test/pending/run/reify_closure2b.scala | 9 +- test/pending/run/reify_closure3b.scala | 9 +- test/pending/run/reify_closure4b.scala | 9 +- test/pending/run/reify_closure5b.scala | 9 +- test/pending/run/reify_closure8b.check | 1 - test/pending/run/reify_closure8b.scala | 16 - test/pending/run/reify_closure9a.scala | 11 +- test/pending/run/reify_closure9b.scala | 11 +- test/pending/run/reify_closures11.scala | 11 +- test/pending/run/reify_csv.scala | 12 +- test/pending/run/reify_gadts.scala | 12 +- test/pending/run/reify_lazyevaluation.scala | 12 +- test/pending/run/reify_newimpl_07.scala | 13 + test/pending/run/reify_newimpl_08.scala | 15 + test/pending/run/reify_newimpl_35.scala | 10 + test/pending/run/reify_newimpl_46.scala | 12 + test/pending/run/reify_newimpl_53.scala | 15 + test/pending/run/reify_properties.scala | 12 +- test/pending/run/reify_simpleinterpreter.scala | 12 +- test/pending/run/t5258a.check | 1 + test/pending/run/t5258a.scala | 5 + test/pending/run/t5258b.scala | 12 +- test/pending/run/t5258c.scala | 12 +- test/pending/run/t5271_1.scala | 12 +- test/pending/run/t5271_2.scala | 12 +- test/pending/run/t5271_3.scala | 12 +- test/pending/run/t5418.scala | 12 +- 962 files changed, 7102 insertions(+), 2425 deletions(-) delete mode 100644 test/files/jvm/manifests.check create mode 100644 test/files/jvm/manifests.check.temporarily.disabled delete mode 100644 test/files/jvm/manifests.scala create mode 100644 test/files/jvm/manifests.scala.temporarily.disabled delete mode 100644 test/files/macros/Printf.scala delete mode 100644 test/files/macros/Test.scala delete mode 100644 test/files/macros/macros_v0001.bat delete mode 100644 test/files/macros/macros_v0001.sh create mode 100644 test/files/neg/classtags_contextbound_a.check create mode 100644 test/files/neg/classtags_contextbound_a.scala create mode 100644 test/files/neg/classtags_contextbound_b.check create mode 100644 test/files/neg/classtags_contextbound_b.scala create mode 100644 test/files/neg/classtags_contextbound_c.check create mode 100644 test/files/neg/classtags_contextbound_c.scala delete mode 100644 test/files/neg/macro-argtype-mismatch/Macros_1.scala delete mode 100644 test/files/neg/macro-argtype-mismatch/Test_2.scala create mode 100644 test/files/neg/macro-basic-mamdmi.check create mode 100644 test/files/neg/macro-basic-mamdmi.flags create mode 100644 test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala create mode 100644 test/files/neg/macro-cyclic.check create mode 100644 test/files/neg/macro-cyclic.flags create mode 100644 test/files/neg/macro-cyclic/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents.check create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Bind_12.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_4.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_5.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Def_13.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_6.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_7.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_10.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_11.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_8.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_9.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Type_3.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Val_1.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Var_2.scala create mode 100644 test/files/neg/macro-deprecate-dont-touch-backquotedidents/Main.scala create mode 100644 test/files/neg/macro-deprecate-idents.check create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Bind_12.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Class_4.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Class_5.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Def_13.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Object_6.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Object_7.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Package_10.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Package_11.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Trait_8.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Trait_9.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Type_3.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Val_1.scala create mode 100644 test/files/neg/macro-deprecate-idents/Macros_Var_2.scala create mode 100644 test/files/neg/macro-deprecate-idents/Main.scala create mode 100644 test/files/neg/macro-invalidimpl-a.check create mode 100644 test/files/neg/macro-invalidimpl-a.flags create mode 100644 test/files/neg/macro-invalidimpl-a/Impls_1.scala create mode 100644 test/files/neg/macro-invalidimpl-a/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidimpl-b.check create mode 100644 test/files/neg/macro-invalidimpl-b.flags create mode 100644 test/files/neg/macro-invalidimpl-b/Impls_1.scala create mode 100644 test/files/neg/macro-invalidimpl-b/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidimpl-c.check create mode 100644 test/files/neg/macro-invalidimpl-c.flags create mode 100644 test/files/neg/macro-invalidimpl-c/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-invalidimpl-c/Test_2.scala create mode 100644 test/files/neg/macro-invalidimpl-d.check create mode 100644 test/files/neg/macro-invalidimpl-d.flags create mode 100644 test/files/neg/macro-invalidimpl-d/Impls_1.scala create mode 100644 test/files/neg/macro-invalidimpl-d/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidimpl-e.check create mode 100644 test/files/neg/macro-invalidimpl-e.flags create mode 100644 test/files/neg/macro-invalidimpl-e/Impls_1.scala create mode 100644 test/files/neg/macro-invalidimpl-e/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidimpl-f.check create mode 100644 test/files/neg/macro-invalidimpl-f.flags create mode 100644 test/files/neg/macro-invalidimpl-f/Impls_1.scala create mode 100644 test/files/neg/macro-invalidimpl-f/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidimpl-g.check create mode 100644 test/files/neg/macro-invalidimpl-g.flags create mode 100644 test/files/neg/macro-invalidimpl-g/Impls_1.scala create mode 100644 test/files/neg/macro-invalidimpl-g/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidimpl-h.check create mode 100644 test/files/neg/macro-invalidimpl-h.flags create mode 100644 test/files/neg/macro-invalidimpl-h/Impls_1.scala create mode 100644 test/files/neg/macro-invalidimpl-h/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidret-nontree.check create mode 100644 test/files/neg/macro-invalidret-nontree.flags create mode 100644 test/files/neg/macro-invalidret-nontree/Impls_1.scala create mode 100644 test/files/neg/macro-invalidret-nontree/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidret-nonuniversetree.check create mode 100644 test/files/neg/macro-invalidret-nonuniversetree.flags create mode 100644 test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala create mode 100644 test/files/neg/macro-invalidret-nonuniversetree/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidshape-a.check create mode 100644 test/files/neg/macro-invalidshape-a.flags create mode 100644 test/files/neg/macro-invalidshape-a/Impls_1.scala create mode 100644 test/files/neg/macro-invalidshape-a/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidshape-b.check create mode 100644 test/files/neg/macro-invalidshape-b.flags create mode 100644 test/files/neg/macro-invalidshape-b/Impls_1.scala create mode 100644 test/files/neg/macro-invalidshape-b/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidshape-c.check create mode 100644 test/files/neg/macro-invalidshape-c.flags create mode 100644 test/files/neg/macro-invalidshape-c/Impls_1.scala create mode 100644 test/files/neg/macro-invalidshape-c/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidshape-d.check create mode 100644 test/files/neg/macro-invalidshape-d.flags create mode 100644 test/files/neg/macro-invalidshape-d/Impls_1.scala create mode 100644 test/files/neg/macro-invalidshape-d/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-context-bounds.check create mode 100644 test/files/neg/macro-invalidsig-context-bounds.flags create mode 100644 test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-ctx-badargc.check create mode 100644 test/files/neg/macro-invalidsig-ctx-badargc.flags create mode 100644 test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-ctx-badargc/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-ctx-badtype.check create mode 100644 test/files/neg/macro-invalidsig-ctx-badtype.flags create mode 100644 test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-ctx-badtype/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-ctx-badvarargs.check create mode 100644 test/files/neg/macro-invalidsig-ctx-badvarargs.flags create mode 100644 test/files/neg/macro-invalidsig-ctx-badvarargs/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-ctx-badvarargs/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-ctx-noctx.check create mode 100644 test/files/neg/macro-invalidsig-ctx-noctx.flags create mode 100644 test/files/neg/macro-invalidsig-ctx-noctx/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-ctx-noctx/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-implicit-params.check create mode 100644 test/files/neg/macro-invalidsig-implicit-params.flags create mode 100644 test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-invalidsig-implicit-params/Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-params-badargc.check create mode 100644 test/files/neg/macro-invalidsig-params-badargc.flags create mode 100644 test/files/neg/macro-invalidsig-params-badargc/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-invalidsig-params-badargc/Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-params-badtype.check create mode 100644 test/files/neg/macro-invalidsig-params-badtype.flags create mode 100644 test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-invalidsig-params-badtype/Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-params-badvarargs.check create mode 100644 test/files/neg/macro-invalidsig-params-badvarargs.flags create mode 100644 test/files/neg/macro-invalidsig-params-badvarargs/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-params-namemismatch.check create mode 100644 test/files/neg/macro-invalidsig-params-namemismatch.flags create mode 100644 test/files/neg/macro-invalidsig-params-namemismatch/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-badtype.check create mode 100644 test/files/neg/macro-invalidsig-tparams-badtype.flags create mode 100644 test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-badtype/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-bounds-a.check create mode 100644 test/files/neg/macro-invalidsig-tparams-bounds-a.flags create mode 100644 test/files/neg/macro-invalidsig-tparams-bounds-a/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-bounds-a/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-bounds-b.check create mode 100644 test/files/neg/macro-invalidsig-tparams-bounds-b.flags create mode 100644 test/files/neg/macro-invalidsig-tparams-bounds-b/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-bounds-b/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-a.check create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-a.flags create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-a/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-b.check create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-b.flags create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-b/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-c.check create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-c.flags create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala create mode 100644 test/files/neg/macro-invalidsig-tparams-notparams-c/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidusage-badargs.check create mode 100644 test/files/neg/macro-invalidusage-badargs.flags create mode 100644 test/files/neg/macro-invalidusage-badargs/Impls_1.scala create mode 100644 test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidusage-badbounds.check create mode 100644 test/files/neg/macro-invalidusage-badbounds.flags create mode 100644 test/files/neg/macro-invalidusage-badbounds/Impls_1.scala create mode 100644 test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidusage-badtargs.check create mode 100644 test/files/neg/macro-invalidusage-badtargs.flags create mode 100644 test/files/neg/macro-invalidusage-badtargs/Impls_1.scala create mode 100644 test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala create mode 100644 test/files/neg/macro-invalidusage-methodvaluesyntax.check create mode 100644 test/files/neg/macro-invalidusage-methodvaluesyntax.flags create mode 100644 test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala create mode 100644 test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala create mode 100644 test/files/neg/macro-keyword.check create mode 100644 test/files/neg/macro-keyword.flags create mode 100644 test/files/neg/macro-keyword/Macros_Bind_12.scala create mode 100644 test/files/neg/macro-keyword/Macros_Class_4.scala create mode 100644 test/files/neg/macro-keyword/Macros_Class_5.scala create mode 100644 test/files/neg/macro-keyword/Macros_Def_13.scala create mode 100644 test/files/neg/macro-keyword/Macros_Object_6.scala create mode 100644 test/files/neg/macro-keyword/Macros_Object_7.scala create mode 100644 test/files/neg/macro-keyword/Macros_Package_10.scala create mode 100644 test/files/neg/macro-keyword/Macros_Package_11.scala create mode 100644 test/files/neg/macro-keyword/Macros_Trait_8.scala create mode 100644 test/files/neg/macro-keyword/Macros_Trait_9.scala create mode 100644 test/files/neg/macro-keyword/Macros_Type_3.scala create mode 100644 test/files/neg/macro-keyword/Macros_Val_1.scala create mode 100644 test/files/neg/macro-keyword/Macros_Var_2.scala create mode 100644 test/files/neg/macro-noexpand/Impls_1.scala delete mode 100644 test/files/neg/macro-noexpand/Macros_1.scala create mode 100644 test/files/neg/macro-noexpand/Macros_Test_2.scala delete mode 100644 test/files/neg/macro-noexpand/Test_2.scala delete mode 100644 test/files/neg/macro-noncompilertree/Macros_1.scala delete mode 100644 test/files/neg/macro-nontree/Macros_1.scala create mode 100644 test/files/neg/macro-nontypeablebody.check create mode 100644 test/files/neg/macro-nontypeablebody.flags create mode 100644 test/files/neg/macro-nontypeablebody/Impls_1.scala create mode 100644 test/files/neg/macro-nontypeablebody/Macros_Test_2.scala create mode 100644 test/files/neg/macro-override-macro-overrides-abstract-method-a.check create mode 100644 test/files/neg/macro-override-macro-overrides-abstract-method-a.flags create mode 100644 test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-override-macro-overrides-abstract-method-a/Test_2.scala create mode 100644 test/files/neg/macro-override-macro-overrides-abstract-method-b.check create mode 100644 test/files/neg/macro-override-macro-overrides-abstract-method-b.flags create mode 100644 test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala create mode 100644 test/files/neg/macro-override-macro-overrides-abstract-method-b/Test_2.scala create mode 100644 test/files/neg/macro-override-method-overrides-macro.check create mode 100644 test/files/neg/macro-override-method-overrides-macro.flags create mode 100644 test/files/neg/macro-override-method-overrides-macro/Impls_1.scala create mode 100644 test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala create mode 100644 test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check create mode 100644 test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala create mode 100644 test/files/neg/macro-reify-groundtypetag-typeparams-notags.check create mode 100644 test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala create mode 100644 test/files/neg/macro-reify-groundtypetag-usetypetag.check create mode 100644 test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala create mode 100644 test/files/neg/macro-without-xmacros-a.check create mode 100644 test/files/neg/macro-without-xmacros-a/Impls_1.scala create mode 100644 test/files/neg/macro-without-xmacros-a/Macros_2.scala create mode 100644 test/files/neg/macro-without-xmacros-a/Test_3.scala create mode 100644 test/files/neg/macro-without-xmacros-b.check create mode 100644 test/files/neg/macro-without-xmacros-b/Impls_1.scala create mode 100644 test/files/neg/macro-without-xmacros-b/Macros_2.scala create mode 100644 test/files/neg/macro-without-xmacros-b/Test_3.scala delete mode 100644 test/files/neg/reify_ann2a.check delete mode 100644 test/files/neg/reify_ann2a.scala create mode 100644 test/files/neg/t5334_1.check create mode 100644 test/files/neg/t5334_1.scala create mode 100644 test/files/neg/t5334_2.check create mode 100644 test/files/neg/t5334_2.scala delete mode 100644 test/files/pos/implicits.scala create mode 100644 test/files/pos/implicits.scala.temporarily.disabled delete mode 100644 test/files/pos/macros.flags delete mode 100644 test/files/pos/macros.scala delete mode 100644 test/files/pos/manifest1.scala create mode 100644 test/files/pos/manifest1.scala.temporarily.disabled create mode 100644 test/files/run/classtags_contextbound.check create mode 100644 test/files/run/classtags_contextbound.scala create mode 100644 test/files/run/classtags_core.check create mode 100644 test/files/run/classtags_core.scala delete mode 100644 test/files/run/existentials3.check create mode 100644 test/files/run/existentials3.check.temporarily.disabled delete mode 100644 test/files/run/existentials3.scala create mode 100644 test/files/run/existentials3.scala.temporarily.disabled create mode 100644 test/files/run/groundtypetags_core.check create mode 100644 test/files/run/groundtypetags_core.scala create mode 100644 test/files/run/macro-abort-fresh.check create mode 100644 test/files/run/macro-abort-fresh.flags create mode 100644 test/files/run/macro-abort-fresh/Macros_1.scala create mode 100644 test/files/run/macro-abort-fresh/Test_2.scala create mode 100644 test/files/run/macro-basic-ma-md-mi.check create mode 100644 test/files/run/macro-basic-ma-md-mi.flags create mode 100644 test/files/run/macro-basic-ma-md-mi/Impls_1.scala create mode 100644 test/files/run/macro-basic-ma-md-mi/Macros_2.scala create mode 100644 test/files/run/macro-basic-ma-md-mi/Test_3.scala create mode 100644 test/files/run/macro-basic-ma-mdmi.check create mode 100644 test/files/run/macro-basic-ma-mdmi.flags create mode 100644 test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala create mode 100644 test/files/run/macro-basic-ma-mdmi/Test_2.scala create mode 100644 test/files/run/macro-basic-mamd-mi.check create mode 100644 test/files/run/macro-basic-mamd-mi.flags create mode 100644 test/files/run/macro-basic-mamd-mi/Impls_1.scala create mode 100644 test/files/run/macro-basic-mamd-mi/Macros_Test_2.scala delete mode 100644 test/files/run/macro-basic.check delete mode 100644 test/files/run/macro-basic.flags delete mode 100644 test/files/run/macro-basic/Macros_1.scala delete mode 100644 test/files/run/macro-basic/Test_2.scala create mode 100644 test/files/run/macro-bodyexpandstoimpl.check create mode 100644 test/files/run/macro-bodyexpandstoimpl.flags create mode 100644 test/files/run/macro-bodyexpandstoimpl/Impls_1.scala create mode 100644 test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-annotation.check create mode 100644 test/files/run/macro-declared-in-annotation.flags create mode 100644 test/files/run/macro-declared-in-annotation/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-annotation/Macros_2.scala create mode 100644 test/files/run/macro-declared-in-annotation/Test_3.scala create mode 100644 test/files/run/macro-declared-in-anonymous.check create mode 100644 test/files/run/macro-declared-in-anonymous.flags create mode 100644 test/files/run/macro-declared-in-anonymous/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-block.check create mode 100644 test/files/run/macro-declared-in-block.flags create mode 100644 test/files/run/macro-declared-in-block/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-block/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-class-class.check create mode 100644 test/files/run/macro-declared-in-class-class.flags create mode 100644 test/files/run/macro-declared-in-class-class/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-class-class/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-class-object.check create mode 100644 test/files/run/macro-declared-in-class-object.flags create mode 100644 test/files/run/macro-declared-in-class-object/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-class-object/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-class.check create mode 100644 test/files/run/macro-declared-in-class.flags create mode 100644 test/files/run/macro-declared-in-class/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-class/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-default-param.check create mode 100644 test/files/run/macro-declared-in-default-param.flags create mode 100644 test/files/run/macro-declared-in-default-param/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-default-param/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-implicit-class.check create mode 100644 test/files/run/macro-declared-in-implicit-class.flags create mode 100644 test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala create mode 100644 test/files/run/macro-declared-in-implicit-class/Test_2.scala create mode 100644 test/files/run/macro-declared-in-method.check create mode 100644 test/files/run/macro-declared-in-method.flags create mode 100644 test/files/run/macro-declared-in-method/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-method/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-object-class.check create mode 100644 test/files/run/macro-declared-in-object-class.flags create mode 100644 test/files/run/macro-declared-in-object-class/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-object-class/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-object-object.check create mode 100644 test/files/run/macro-declared-in-object-object.flags create mode 100644 test/files/run/macro-declared-in-object-object/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-object-object/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-object.check create mode 100644 test/files/run/macro-declared-in-object.flags create mode 100644 test/files/run/macro-declared-in-object/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-object/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-package-object.check create mode 100644 test/files/run/macro-declared-in-package-object.flags create mode 100644 test/files/run/macro-declared-in-package-object/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-package-object/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-refinement.check create mode 100644 test/files/run/macro-declared-in-refinement.flags create mode 100644 test/files/run/macro-declared-in-refinement/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-refinement/Macros_Test_2.scala create mode 100644 test/files/run/macro-declared-in-trait.check create mode 100644 test/files/run/macro-declared-in-trait.flags create mode 100644 test/files/run/macro-declared-in-trait/Impls_1.scala create mode 100644 test/files/run/macro-declared-in-trait/Macros_Test_2.scala create mode 100644 test/files/run/macro-def-infer-return-type-a.check create mode 100644 test/files/run/macro-def-infer-return-type-a.flags create mode 100644 test/files/run/macro-def-infer-return-type-a/Impls_1.scala create mode 100644 test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala create mode 100644 test/files/run/macro-def-infer-return-type-b.check create mode 100644 test/files/run/macro-def-infer-return-type-b.flags create mode 100644 test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala create mode 100644 test/files/run/macro-def-infer-return-type-b/Test_2.scala create mode 100644 test/files/run/macro-def-infer-return-type-c.check create mode 100644 test/files/run/macro-def-infer-return-type-c.flags create mode 100644 test/files/run/macro-def-infer-return-type-c/Impls_1.scala create mode 100644 test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala create mode 100644 test/files/run/macro-def-path-dependent-a.check create mode 100644 test/files/run/macro-def-path-dependent-a.flags create mode 100644 test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala create mode 100644 test/files/run/macro-def-path-dependent-a/Test_2.scala create mode 100644 test/files/run/macro-def-path-dependent-b.check create mode 100644 test/files/run/macro-def-path-dependent-b.flags create mode 100644 test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala create mode 100644 test/files/run/macro-def-path-dependent-b/Test_2.scala create mode 100644 test/files/run/macro-def-path-dependent-c.check create mode 100644 test/files/run/macro-def-path-dependent-c.flags create mode 100644 test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala create mode 100644 test/files/run/macro-def-path-dependent-c/Test_2.scala create mode 100644 test/files/run/macro-def-path-dependent-d.check create mode 100644 test/files/run/macro-def-path-dependent-d.flags create mode 100644 test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala create mode 100644 test/files/run/macro-def-path-dependent-d/Test_2.scala create mode 100644 test/files/run/macro-expand-implicit-macro-has-implicit.check create mode 100644 test/files/run/macro-expand-implicit-macro-has-implicit.flags create mode 100644 test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala create mode 100644 test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-implicit-macro-is-implicit.check create mode 100644 test/files/run/macro-expand-implicit-macro-is-implicit.flags create mode 100644 test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala create mode 100644 test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-implicit-macro-is-val.check create mode 100644 test/files/run/macro-expand-implicit-macro-is-val.flags create mode 100644 test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala create mode 100644 test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-implicit-macro-is-view.check create mode 100644 test/files/run/macro-expand-implicit-macro-is-view.flags create mode 100644 test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala create mode 100644 test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-multiple-arglists.check create mode 100644 test/files/run/macro-expand-multiple-arglists.flags create mode 100644 test/files/run/macro-expand-multiple-arglists/Impls_1.scala create mode 100644 test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-nullary-generic.check create mode 100644 test/files/run/macro-expand-nullary-generic.flags create mode 100644 test/files/run/macro-expand-nullary-generic/Impls_1.scala create mode 100644 test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-nullary-nongeneric.check create mode 100644 test/files/run/macro-expand-nullary-nongeneric.flags create mode 100644 test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala create mode 100644 test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-overload.check create mode 100644 test/files/run/macro-expand-overload.flags create mode 100644 test/files/run/macro-expand-overload/Impls_1.scala create mode 100644 test/files/run/macro-expand-overload/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-override.check create mode 100644 test/files/run/macro-expand-override.flags create mode 100644 test/files/run/macro-expand-override/Impls_1.scala create mode 100644 test/files/run/macro-expand-override/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-recursive.check create mode 100644 test/files/run/macro-expand-recursive.flags create mode 100644 test/files/run/macro-expand-recursive/Impls_1.scala create mode 100644 test/files/run/macro-expand-recursive/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-bounds-a.check create mode 100644 test/files/run/macro-expand-tparams-bounds-a.flags create mode 100644 test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-bounds-b.check create mode 100644 test/files/run/macro-expand-tparams-bounds-b.flags create mode 100644 test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-explicit.check create mode 100644 test/files/run/macro-expand-tparams-explicit.flags create mode 100644 test/files/run/macro-expand-tparams-explicit/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-implicit.check create mode 100644 test/files/run/macro-expand-tparams-implicit.flags create mode 100644 test/files/run/macro-expand-tparams-implicit/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-only-in-impl.flags create mode 100644 test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-optional.check create mode 100644 test/files/run/macro-expand-tparams-optional.flags create mode 100644 test/files/run/macro-expand-tparams-optional/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-a.check create mode 100644 test/files/run/macro-expand-tparams-prefix-a.flags create mode 100644 test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-b.check create mode 100644 test/files/run/macro-expand-tparams-prefix-b.flags create mode 100644 test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-c1.check create mode 100644 test/files/run/macro-expand-tparams-prefix-c1.flags create mode 100644 test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-c2.check create mode 100644 test/files/run/macro-expand-tparams-prefix-c2.flags create mode 100644 test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-d1.check create mode 100644 test/files/run/macro-expand-tparams-prefix-d1.flags create mode 100644 test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala create mode 100644 test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check create mode 100644 test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.flags create mode 100644 test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala create mode 100644 test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.check create mode 100644 test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.flags create mode 100644 test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala create mode 100644 test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-varargs-explicit-over-varargs.check create mode 100644 test/files/run/macro-expand-varargs-explicit-over-varargs.flags create mode 100644 test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala create mode 100644 test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-varargs-implicit-over-nonvarargs.check create mode 100644 test/files/run/macro-expand-varargs-implicit-over-nonvarargs.flags create mode 100644 test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala create mode 100644 test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala create mode 100644 test/files/run/macro-expand-varargs-implicit-over-varargs.check create mode 100644 test/files/run/macro-expand-varargs-implicit-over-varargs.flags create mode 100644 test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala create mode 100644 test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala create mode 100644 test/files/run/macro-impl-default-params.check create mode 100644 test/files/run/macro-impl-default-params.flags create mode 100644 test/files/run/macro-impl-default-params/Impls_Macros_1.scala create mode 100644 test/files/run/macro-impl-default-params/Test_2.scala create mode 100644 test/files/run/macro-impl-rename-context.check create mode 100644 test/files/run/macro-impl-rename-context.flags create mode 100644 test/files/run/macro-impl-rename-context/Impls_Macros_1.scala create mode 100644 test/files/run/macro-impl-rename-context/Test_2.scala create mode 100644 test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check create mode 100644 test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.flags create mode 100644 test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala create mode 100644 test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala create mode 100644 test/files/run/macro-invalidret-doesnt-conform-to-impl-rettype.check create mode 100644 test/files/run/macro-invalidret-doesnt-conform-to-impl-rettype.flags create mode 100644 test/files/run/macro-invalidret-nontypeable.check create mode 100644 test/files/run/macro-invalidret-nontypeable.flags create mode 100644 test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala create mode 100644 test/files/run/macro-invalidret-nontypeable/Test_2.scala create mode 100644 test/files/run/macro-invalidusage-badret.check create mode 100644 test/files/run/macro-invalidusage-badret.flags create mode 100644 test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala create mode 100644 test/files/run/macro-invalidusage-badret/Test_2.scala create mode 100644 test/files/run/macro-invalidusage-partialapplication.check create mode 100644 test/files/run/macro-invalidusage-partialapplication.flags create mode 100644 test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala create mode 100644 test/files/run/macro-invalidusage-partialapplication/Test_2.scala create mode 100644 test/files/run/macro-openmacros.check create mode 100644 test/files/run/macro-openmacros.flags create mode 100644 test/files/run/macro-openmacros/Impls_Macros_1.scala create mode 100644 test/files/run/macro-openmacros/Test_2.scala create mode 100644 test/files/run/macro-quasiinvalidbody-c.check create mode 100644 test/files/run/macro-quasiinvalidbody-c.flags create mode 100644 test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala create mode 100644 test/files/run/macro-quasiinvalidbody-c/Test_2.scala create mode 100644 test/files/run/macro-range/Common_1.scala create mode 100644 test/files/run/macro-range/Expansion_Impossible_2.scala create mode 100644 test/files/run/macro-range/Expansion_Possible_3.scala delete mode 100644 test/files/run/macro-range/macro_range_1.scala delete mode 100644 test/files/run/macro-range/macro_range_2.scala create mode 100644 test/files/run/macro-reflective-ma-normal-mdmi.check create mode 100644 test/files/run/macro-reflective-ma-normal-mdmi.flags create mode 100644 test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala create mode 100644 test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala create mode 100644 test/files/run/macro-reflective-mamd-normal-mi.check create mode 100644 test/files/run/macro-reflective-mamd-normal-mi.flags create mode 100644 test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala create mode 100644 test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala create mode 100644 test/files/run/macro-reify-basic.check create mode 100644 test/files/run/macro-reify-basic.flags create mode 100644 test/files/run/macro-reify-basic/Macros_1.scala create mode 100644 test/files/run/macro-reify-basic/Test_2.scala create mode 100644 test/files/run/macro-reify-eval-eval.check create mode 100644 test/files/run/macro-reify-eval-eval.flags create mode 100644 test/files/run/macro-reify-eval-eval/Macros_1.scala create mode 100644 test/files/run/macro-reify-eval-eval/Test_2.scala create mode 100644 test/files/run/macro-reify-eval-outside-reify.check create mode 100644 test/files/run/macro-reify-eval-outside-reify.flags create mode 100644 test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala create mode 100644 test/files/run/macro-reify-eval-outside-reify/Test_2.scala create mode 100644 test/files/run/macro-reify-freevars.check create mode 100644 test/files/run/macro-reify-freevars.flags create mode 100644 test/files/run/macro-reify-freevars/Macros_1.scala create mode 100644 test/files/run/macro-reify-freevars/Test_2.scala create mode 100644 test/files/run/macro-reify-groundtypetag-notypeparams.check create mode 100644 test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala create mode 100644 test/files/run/macro-reify-groundtypetag-typeparams-tags.check create mode 100644 test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala create mode 100644 test/files/run/macro-reify-nested-a.check create mode 100644 test/files/run/macro-reify-nested-a.flags create mode 100644 test/files/run/macro-reify-nested-a/Impls_Macros_1.scala create mode 100644 test/files/run/macro-reify-nested-a/Test_2.scala create mode 100644 test/files/run/macro-reify-nested-b.check create mode 100644 test/files/run/macro-reify-nested-b.flags create mode 100644 test/files/run/macro-reify-nested-b/Impls_Macros_1.scala create mode 100644 test/files/run/macro-reify-nested-b/Test_2.scala create mode 100644 test/files/run/macro-reify-ref-to-packageless.check create mode 100644 test/files/run/macro-reify-ref-to-packageless.flags create mode 100644 test/files/run/macro-reify-ref-to-packageless/Impls_1.scala create mode 100644 test/files/run/macro-reify-ref-to-packageless/Test_2.scala create mode 100644 test/files/run/macro-reify-tagful-a.check create mode 100644 test/files/run/macro-reify-tagful-a.flags create mode 100644 test/files/run/macro-reify-tagful-a/Macros_1.scala create mode 100644 test/files/run/macro-reify-tagful-a/Test_2.scala create mode 100644 test/files/run/macro-reify-tagless-a.check create mode 100644 test/files/run/macro-reify-tagless-a.flags create mode 100644 test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala create mode 100644 test/files/run/macro-reify-tagless-a/Test_2.scala create mode 100644 test/files/run/macro-reify-typetag-notypeparams.check create mode 100644 test/files/run/macro-reify-typetag-notypeparams/Test.scala create mode 100644 test/files/run/macro-reify-typetag-typeparams-notags.check create mode 100644 test/files/run/macro-reify-typetag-typeparams-notags/Test.scala create mode 100644 test/files/run/macro-reify-typetag-typeparams-tags.check create mode 100644 test/files/run/macro-reify-typetag-typeparams-tags/Test.scala create mode 100644 test/files/run/macro-reify-typetag-usegroundtypetag.check create mode 100644 test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala create mode 100644 test/files/run/macro-reify-unreify.check create mode 100644 test/files/run/macro-reify-unreify.flags create mode 100644 test/files/run/macro-reify-unreify/Macros_1.scala create mode 100644 test/files/run/macro-reify-unreify/Test_2.scala create mode 100644 test/files/run/macro-reify-value-outside-reify.check create mode 100644 test/files/run/macro-reify-value-outside-reify.flags create mode 100644 test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala create mode 100644 test/files/run/macro-reify-value-outside-reify/Test_2.scala delete mode 100644 test/files/run/macro-rettype-mismatch/Macros_1.scala delete mode 100644 test/files/run/macro-rettype-mismatch/Test_2.scala create mode 100644 test/files/run/macro-settings.check create mode 100644 test/files/run/macro-settings.flags create mode 100644 test/files/run/macro-settings/Impls_Macros_1.scala create mode 100644 test/files/run/macro-settings/Test_2.scala create mode 100644 test/files/run/macro-sip19-revised.check create mode 100644 test/files/run/macro-sip19-revised.flags create mode 100644 test/files/run/macro-sip19-revised/Impls_Macros_1.scala create mode 100644 test/files/run/macro-sip19-revised/Test_2.scala create mode 100644 test/files/run/macro-sip19.check create mode 100644 test/files/run/macro-sip19.flags create mode 100644 test/files/run/macro-sip19/Impls_Macros_1.scala create mode 100644 test/files/run/macro-sip19/Test_2.scala create mode 100644 test/files/run/macro-typecheck-implicitsdisabled.check create mode 100644 test/files/run/macro-typecheck-implicitsdisabled.flags create mode 100644 test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala create mode 100644 test/files/run/macro-typecheck-implicitsdisabled/Test_2.scala create mode 100644 test/files/run/macro-typecheck-macrosdisabled.check create mode 100644 test/files/run/macro-typecheck-macrosdisabled.flags create mode 100644 test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala create mode 100644 test/files/run/macro-typecheck-macrosdisabled/Test_2.scala create mode 100644 test/files/run/macro-undetparams-consfromsls.check create mode 100644 test/files/run/macro-undetparams-consfromsls.flags create mode 100644 test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala create mode 100644 test/files/run/macro-undetparams-consfromsls/Test_2.scala create mode 100644 test/files/run/macro-undetparams-implicitval.check create mode 100644 test/files/run/macro-undetparams-implicitval.flags create mode 100644 test/files/run/macro-undetparams-implicitval/Test.scala create mode 100644 test/files/run/macro-undetparams-macroitself.check create mode 100644 test/files/run/macro-undetparams-macroitself.flags create mode 100644 test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala create mode 100644 test/files/run/macro-undetparams-macroitself/Test_2.scala create mode 100644 test/files/run/reify_ann2a.check create mode 100644 test/files/run/reify_ann2a.scala create mode 100644 test/files/run/reify_ann3.check create mode 100644 test/files/run/reify_ann3.scala create mode 100644 test/files/run/reify_ann4.check create mode 100644 test/files/run/reify_ann4.scala create mode 100644 test/files/run/reify_ann5.check create mode 100644 test/files/run/reify_ann5.scala create mode 100644 test/files/run/reify_classfileann_b.check create mode 100644 test/files/run/reify_classfileann_b.scala create mode 100644 test/files/run/reify_closure8b.check create mode 100644 test/files/run/reify_closure8b.scala create mode 100644 test/files/run/reify_metalevel_breach_+0_refers_to_1.check create mode 100644 test/files/run/reify_metalevel_breach_+0_refers_to_1.scala create mode 100644 test/files/run/reify_metalevel_breach_-1_refers_to_0_a.check create mode 100644 test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala create mode 100644 test/files/run/reify_metalevel_breach_-1_refers_to_0_b.check create mode 100644 test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala create mode 100644 test/files/run/reify_metalevel_breach_-1_refers_to_1.check create mode 100644 test/files/run/reify_metalevel_breach_-1_refers_to_1.scala create mode 100644 test/files/run/reify_nested_inner_refers_to_global.check create mode 100644 test/files/run/reify_nested_inner_refers_to_global.scala create mode 100644 test/files/run/reify_nested_inner_refers_to_local.check create mode 100644 test/files/run/reify_nested_inner_refers_to_local.scala create mode 100644 test/files/run/reify_nested_outer_refers_to_global.check create mode 100644 test/files/run/reify_nested_outer_refers_to_global.scala create mode 100644 test/files/run/reify_nested_outer_refers_to_local.check create mode 100644 test/files/run/reify_nested_outer_refers_to_local.scala create mode 100644 test/files/run/reify_newimpl_01.check create mode 100644 test/files/run/reify_newimpl_01.scala create mode 100644 test/files/run/reify_newimpl_02.check create mode 100644 test/files/run/reify_newimpl_02.scala create mode 100644 test/files/run/reify_newimpl_03.check create mode 100644 test/files/run/reify_newimpl_03.scala create mode 100644 test/files/run/reify_newimpl_04.check create mode 100644 test/files/run/reify_newimpl_04.scala create mode 100644 test/files/run/reify_newimpl_05.check create mode 100644 test/files/run/reify_newimpl_05.scala create mode 100644 test/files/run/reify_newimpl_06.check create mode 100644 test/files/run/reify_newimpl_06.scala create mode 100644 test/files/run/reify_newimpl_09.check create mode 100644 test/files/run/reify_newimpl_09.scala create mode 100644 test/files/run/reify_newimpl_10.check create mode 100644 test/files/run/reify_newimpl_10.scala create mode 100644 test/files/run/reify_newimpl_11.check create mode 100644 test/files/run/reify_newimpl_11.scala create mode 100644 test/files/run/reify_newimpl_12.check create mode 100644 test/files/run/reify_newimpl_12.scala create mode 100644 test/files/run/reify_newimpl_13.check create mode 100644 test/files/run/reify_newimpl_13.scala create mode 100644 test/files/run/reify_newimpl_14.check create mode 100644 test/files/run/reify_newimpl_14.scala create mode 100644 test/files/run/reify_newimpl_15.check create mode 100644 test/files/run/reify_newimpl_15.scala create mode 100644 test/files/run/reify_newimpl_16.check create mode 100644 test/files/run/reify_newimpl_16.scala create mode 100644 test/files/run/reify_newimpl_17.check create mode 100644 test/files/run/reify_newimpl_17.scala create mode 100644 test/files/run/reify_newimpl_18.check create mode 100644 test/files/run/reify_newimpl_18.scala create mode 100644 test/files/run/reify_newimpl_19.check create mode 100644 test/files/run/reify_newimpl_19.scala create mode 100644 test/files/run/reify_newimpl_20.check create mode 100644 test/files/run/reify_newimpl_20.scala create mode 100644 test/files/run/reify_newimpl_21.check create mode 100644 test/files/run/reify_newimpl_21.scala create mode 100644 test/files/run/reify_newimpl_22.check create mode 100644 test/files/run/reify_newimpl_22.scala create mode 100644 test/files/run/reify_newimpl_23.check create mode 100644 test/files/run/reify_newimpl_23.scala create mode 100644 test/files/run/reify_newimpl_24.check create mode 100644 test/files/run/reify_newimpl_24.scala create mode 100644 test/files/run/reify_newimpl_25.check create mode 100644 test/files/run/reify_newimpl_25.scala create mode 100644 test/files/run/reify_newimpl_26.check create mode 100644 test/files/run/reify_newimpl_26.scala create mode 100644 test/files/run/reify_newimpl_27.check create mode 100644 test/files/run/reify_newimpl_27.scala create mode 100644 test/files/run/reify_newimpl_28.check create mode 100644 test/files/run/reify_newimpl_28.scala create mode 100644 test/files/run/reify_newimpl_29.check create mode 100644 test/files/run/reify_newimpl_29.scala create mode 100644 test/files/run/reify_newimpl_30.check create mode 100644 test/files/run/reify_newimpl_30.scala create mode 100644 test/files/run/reify_newimpl_31.check create mode 100644 test/files/run/reify_newimpl_31.scala create mode 100644 test/files/run/reify_newimpl_32.check create mode 100644 test/files/run/reify_newimpl_32.scala create mode 100644 test/files/run/reify_newimpl_33.check create mode 100644 test/files/run/reify_newimpl_33.scala create mode 100644 test/files/run/reify_newimpl_34.check create mode 100644 test/files/run/reify_newimpl_34.scala create mode 100644 test/files/run/reify_newimpl_36.check create mode 100644 test/files/run/reify_newimpl_36.scala create mode 100644 test/files/run/reify_newimpl_37.check create mode 100644 test/files/run/reify_newimpl_37.scala create mode 100644 test/files/run/reify_newimpl_38.check create mode 100644 test/files/run/reify_newimpl_38.scala create mode 100644 test/files/run/reify_newimpl_39.check create mode 100644 test/files/run/reify_newimpl_39.scala create mode 100644 test/files/run/reify_newimpl_40.check create mode 100644 test/files/run/reify_newimpl_40.scala create mode 100644 test/files/run/reify_newimpl_41.check create mode 100644 test/files/run/reify_newimpl_41.scala create mode 100644 test/files/run/reify_newimpl_42.check create mode 100644 test/files/run/reify_newimpl_42.scala create mode 100644 test/files/run/reify_newimpl_43.check create mode 100644 test/files/run/reify_newimpl_43.scala create mode 100644 test/files/run/reify_newimpl_44.check create mode 100644 test/files/run/reify_newimpl_44.scala create mode 100644 test/files/run/reify_newimpl_45.check create mode 100644 test/files/run/reify_newimpl_45.scala create mode 100644 test/files/run/reify_newimpl_47.check create mode 100644 test/files/run/reify_newimpl_47.scala create mode 100644 test/files/run/reify_newimpl_48.check create mode 100644 test/files/run/reify_newimpl_48.scala create mode 100644 test/files/run/reify_newimpl_49.check create mode 100644 test/files/run/reify_newimpl_49.scala create mode 100644 test/files/run/reify_newimpl_50.check create mode 100644 test/files/run/reify_newimpl_50.scala create mode 100644 test/files/run/reify_newimpl_51.check create mode 100644 test/files/run/reify_newimpl_51.scala create mode 100644 test/files/run/reify_newimpl_52.check create mode 100644 test/files/run/reify_newimpl_52.scala create mode 100644 test/files/run/reify_typerefs_1a.check create mode 100644 test/files/run/reify_typerefs_1a.scala create mode 100644 test/files/run/reify_typerefs_1b.check create mode 100644 test/files/run/reify_typerefs_1b.scala create mode 100644 test/files/run/reify_typerefs_2a.check create mode 100644 test/files/run/reify_typerefs_2a.scala create mode 100644 test/files/run/reify_typerefs_2b.check create mode 100644 test/files/run/reify_typerefs_2b.scala create mode 100644 test/files/run/reify_typerefs_3a.check create mode 100644 test/files/run/reify_typerefs_3a.scala create mode 100644 test/files/run/reify_typerefs_3b.check create mode 100644 test/files/run/reify_typerefs_3b.scala delete mode 100644 test/files/run/t1195.check create mode 100644 test/files/run/t1195.check.temporarily.disabled delete mode 100644 test/files/run/t1195.scala create mode 100644 test/files/run/t1195.scala.temporarily.disabled create mode 100644 test/files/run/t3758.check delete mode 100644 test/files/run/t4110.check create mode 100644 test/files/run/t4110.check.temporarily.disabled delete mode 100644 test/files/run/t4110.scala create mode 100644 test/files/run/t4110.scala.temporarily.disabled delete mode 100644 test/files/run/t5258a.check delete mode 100644 test/files/run/t5258a.scala create mode 100644 test/files/run/toolbox_console_reporter.check create mode 100644 test/files/run/toolbox_console_reporter.scala create mode 100644 test/files/run/toolbox_default_reporter_is_silent.check create mode 100644 test/files/run/toolbox_default_reporter_is_silent.scala create mode 100644 test/files/run/toolbox_silent_reporter.check create mode 100644 test/files/run/toolbox_silent_reporter.scala create mode 100644 test/files/run/toolbox_typecheck_implicitsdisabled.check create mode 100644 test/files/run/toolbox_typecheck_implicitsdisabled.scala create mode 100644 test/files/run/toolbox_typecheck_macrosdisabled.check create mode 100644 test/files/run/toolbox_typecheck_macrosdisabled.scala delete mode 100644 test/files/run/treePrint.check create mode 100644 test/files/run/treePrint.check.temporarily.disabled delete mode 100644 test/files/run/treePrint.scala create mode 100644 test/files/run/treePrint.scala.temporarily.disabled create mode 100644 test/files/run/typetags_core.check create mode 100644 test/files/run/typetags_core.scala create mode 100644 test/pending/neg/reify_packed.check create mode 100644 test/pending/neg/reify_packed.scala create mode 100644 test/pending/run/macro-expand-default.flags create mode 100644 test/pending/run/macro-expand-default/Impls_1.scala create mode 100644 test/pending/run/macro-expand-default/Macros_Test_2.scala create mode 100644 test/pending/run/macro-expand-implicit-macro-has-context-bound.check create mode 100644 test/pending/run/macro-expand-implicit-macro-has-context-bound.flags create mode 100644 test/pending/run/macro-expand-implicit-macro-has-context-bound/Impls_1.scala create mode 100644 test/pending/run/macro-expand-implicit-macro-has-context-bound/Macros_Test_2.scala create mode 100644 test/pending/run/macro-expand-named.flags create mode 100644 test/pending/run/macro-expand-named/Impls_1.scala create mode 100644 test/pending/run/macro-expand-named/Macros_Test_2.scala create mode 100644 test/pending/run/macro-expand-tparams-prefix-e1.check create mode 100644 test/pending/run/macro-expand-tparams-prefix-e1.flags create mode 100644 test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala create mode 100644 test/pending/run/macro-expand-tparams-prefix-e1/Macros_Test_2.scala create mode 100644 test/pending/run/macro-expand-tparams-prefix-f1.check create mode 100644 test/pending/run/macro-expand-tparams-prefix-f1.flags create mode 100644 test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala create mode 100644 test/pending/run/macro-expand-tparams-prefix-f1/Macros_Test_2.scala delete mode 100644 test/pending/run/macro-overload.check delete mode 100644 test/pending/run/macro-overload.flags delete mode 100644 test/pending/run/macro-overload/Macros_1.scala delete mode 100644 test/pending/run/macro-overload/Test_2.scala create mode 100644 test/pending/run/macro-quasiinvalidbody-a.check create mode 100644 test/pending/run/macro-quasiinvalidbody-a.flags create mode 100644 test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala create mode 100644 test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala create mode 100644 test/pending/run/macro-quasiinvalidbody-b.check create mode 100644 test/pending/run/macro-quasiinvalidbody-b.flags create mode 100644 test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala create mode 100644 test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala create mode 100644 test/pending/run/macro-reify-array.flags create mode 100644 test/pending/run/macro-reify-array/Macros_1.scala create mode 100644 test/pending/run/macro-reify-array/Test_2.scala create mode 100644 test/pending/run/macro-reify-eval-vs-value.flags create mode 100644 test/pending/run/macro-reify-eval-vs-value/Macros_1.scala create mode 100644 test/pending/run/macro-reify-eval-vs-value/Test_2.scala create mode 100644 test/pending/run/macro-reify-groundtypetag-hktypeparams-tags.check create mode 100644 test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala create mode 100644 test/pending/run/macro-reify-tagful-b.check create mode 100644 test/pending/run/macro-reify-tagful-b.flags create mode 100644 test/pending/run/macro-reify-tagful-b/Macros_1.scala create mode 100644 test/pending/run/macro-reify-tagful-b/Test_2.scala create mode 100644 test/pending/run/macro-reify-tagless-b.check create mode 100644 test/pending/run/macro-reify-tagless-b.flags create mode 100644 test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala create mode 100644 test/pending/run/macro-reify-tagless-b/Test_2.scala create mode 100644 test/pending/run/macro-reify-typetag-hktypeparams-notags.check create mode 100644 test/pending/run/macro-reify-typetag-hktypeparams-notags/Test.scala create mode 100644 test/pending/run/macro-reify-typetag-hktypeparams-tags.check create mode 100644 test/pending/run/macro-reify-typetag-hktypeparams-tags/Test.scala delete mode 100644 test/pending/run/reify_classfileann_b.check delete mode 100644 test/pending/run/reify_classfileann_b.scala delete mode 100644 test/pending/run/reify_closure8b.check delete mode 100644 test/pending/run/reify_closure8b.scala create mode 100644 test/pending/run/reify_newimpl_07.scala create mode 100644 test/pending/run/reify_newimpl_08.scala create mode 100644 test/pending/run/reify_newimpl_35.scala create mode 100644 test/pending/run/reify_newimpl_46.scala create mode 100644 test/pending/run/reify_newimpl_53.scala create mode 100644 test/pending/run/t5258a.check create mode 100644 test/pending/run/t5258a.scala (limited to 'test') diff --git a/test/files/codelib/code.jar.desired.sha1 b/test/files/codelib/code.jar.desired.sha1 index 8dabf404b9..21c4dccb30 100644 --- a/test/files/codelib/code.jar.desired.sha1 +++ b/test/files/codelib/code.jar.desired.sha1 @@ -1 +1 @@ -e76a8883d275ca4870f745b505fb0a1cb9cbe446 ?code.jar +3ddb9fded6e19ca591a78b8a294284c9e945da30 ?code.jar diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 243c9aa3be..d93e314d8e 100755 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -1,372 +1,372 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> - -scala> // basics - -scala> 3+4 -res0: Int = 7 - -scala> def gcd(x: Int, y: Int): Int = { - if (x == 0) y - else if (y == 0) x - else gcd(y%x, x) -} -gcd: (x: Int, y: Int)Int - -scala> val five = gcd(15,35) -five: Int = 5 - -scala> var x = 1 -x: Int = 1 - -scala> x = 2 -x: Int = 2 - -scala> val three = x+1 -three: Int = 3 - -scala> type anotherint = Int -defined type alias anotherint - -scala> val four: anotherint = 4 -four: anotherint = 4 - -scala> val bogus: anotherint = "hello" -:8: error: type mismatch; - found : String("hello") - required: anotherint - (which expands to) Int - val bogus: anotherint = "hello" - ^ - -scala> trait PointlessTrait -defined trait PointlessTrait - -scala> val (x,y) = (2,3) -x: Int = 2 -y: Int = 3 - -scala> println("hello") -hello - -scala> - -scala> // ticket #1513 - -scala> val t1513 = Array(null) -t1513: Array[Null] = Array(null) - -scala> // ambiguous toString problem from #547 - -scala> val atom = new scala.xml.Atom() -atom: scala.xml.Atom[Unit] = () - -scala> // overriding toString problem from #1404 - -scala> class S(override val toString : String) -defined class S - -scala> val fish = new S("fish") -fish: S = fish - -scala> // Test that arrays pretty print nicely. - -scala> val arr = Array("What's", "up", "doc?") -arr: Array[String] = Array(What's, up, doc?) - -scala> // Test that arrays pretty print nicely, even when we give them type Any - -scala> val arrInt : Any = Array(1,2,3) -arrInt: Any = Array(1, 2, 3) - -scala> // Test that nested arrays are pretty-printed correctly - -scala> val arrArrInt : Any = Array(Array(1, 2), Array(3, 4)) -arrArrInt: Any = Array(Array(1, 2), Array(3, 4)) - -scala> - -scala> // implicit conversions - -scala> case class Foo(n: Int) -defined class Foo - -scala> case class Bar(n: Int) -defined class Bar - -scala> implicit def foo2bar(foo: Foo) = Bar(foo.n) -foo2bar: (foo: Foo)Bar - -scala> val bar: Bar = Foo(3) -bar: Bar = Bar(3) - -scala> - -scala> // importing from a previous result - -scala> import bar._ -import bar._ - -scala> val m = n -m: Int = 3 - -scala> - -scala> // stressing the imports mechanism - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> val one = 1 -one: Int = 1 - -scala> - -scala> - -scala> val x1 = 1 -x1: Int = 1 - -scala> val x2 = 1 -x2: Int = 1 - -scala> val x3 = 1 -x3: Int = 1 - -scala> val x4 = 1 -x4: Int = 1 - -scala> val x5 = 1 -x5: Int = 1 - -scala> val x6 = 1 -x6: Int = 1 - -scala> val x7 = 1 -x7: Int = 1 - -scala> val x8 = 1 -x8: Int = 1 - -scala> val x9 = 1 -x9: Int = 1 - -scala> val x10 = 1 -x10: Int = 1 - -scala> val x11 = 1 -x11: Int = 1 - -scala> val x12 = 1 -x12: Int = 1 - -scala> val x13 = 1 -x13: Int = 1 - -scala> val x14 = 1 -x14: Int = 1 - -scala> val x15 = 1 -x15: Int = 1 - -scala> val x16 = 1 -x16: Int = 1 - -scala> val x17 = 1 -x17: Int = 1 - -scala> val x18 = 1 -x18: Int = 1 - -scala> val x19 = 1 -x19: Int = 1 - -scala> val x20 = 1 -x20: Int = 1 - -scala> - -scala> val two = one + x5 -two: Int = 2 - -scala> - -scala> // handling generic wildcard arrays (#2386) - -scala> // It's put here because type feedback is an important part of it. - -scala> val xs: Array[_] = Array(1, 2) -xs: Array[_] = Array(1, 2) - -scala> xs.size -res2: Int = 2 - -scala> xs.head -res3: Any = 1 - -scala> xs filter (_ == 2) -res4: Array[_] = Array(2) - -scala> xs map (_ => "abc") -res5: Array[String] = Array(abc, abc) - -scala> xs map (x => x) -res6: scala.collection.mutable.ArraySeq[_] = ArraySeq(1, 2) - -scala> xs map (x => (x, x)) -res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2)) - -scala> - -scala> // interior syntax errors should *not* go into multi-line input mode. - -scala> // both of the following should abort immediately: - -scala> def x => y => z -:1: error: '=' expected but '=>' found. - def x => y => z - ^ - -scala> [1,2,3] -:1: error: illegal start of definition - [1,2,3] - ^ - -scala> - -scala> - -scala> // multi-line XML - -scala> - -res8: scala.xml.Elem = - - - -scala> - -scala> - -scala> /* - /* - multi-line comment - */ -*/ - -scala> - -scala> - -scala> // multi-line string - -scala> """ -hello -there -""" -res9: String = -" -hello -there -" - -scala> - -scala> (1 + // give up early by typing two blank lines - - -You typed two blank lines. Starting a new command. - -scala> // defining and using quoted names should work (ticket #323) - -scala> def `match` = 1 -match: Int - -scala> val x = `match` -x: Int = 1 - -scala> - -scala> // multiple classes defined on one line - -scala> sealed class Exp; class Fact extends Exp; class Term extends Exp -defined class Exp -defined class Fact -defined class Term - -scala> def f(e: Exp) = e match { // non-exhaustive warning here - case _:Fact => 3 -} -:18: warning: match is not exhaustive! -missing combination Exp -missing combination Term - - def f(e: Exp) = e match { // non-exhaustive warning here - ^ -f: (e: Exp)Int - -scala> - -scala> +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> // basics + +scala> 3+4 +res0: Int = 7 + +scala> def gcd(x: Int, y: Int): Int = { + if (x == 0) y + else if (y == 0) x + else gcd(y%x, x) +} +gcd: (x: Int, y: Int)Int + +scala> val five = gcd(15,35) +five: Int = 5 + +scala> var x = 1 +x: Int = 1 + +scala> x = 2 +x: Int = 2 + +scala> val three = x+1 +three: Int = 3 + +scala> type anotherint = Int +defined type alias anotherint + +scala> val four: anotherint = 4 +four: anotherint = 4 + +scala> val bogus: anotherint = "hello" +:8: error: type mismatch; + found : String("hello") + required: anotherint + (which expands to) Int + val bogus: anotherint = "hello" + ^ + +scala> trait PointlessTrait +defined trait PointlessTrait + +scala> val (x,y) = (2,3) +x: Int = 2 +y: Int = 3 + +scala> println("hello") +hello + +scala> + +scala> // ticket #1513 + +scala> val t1513 = Array(null) +t1513: Array[Null] = Array(null) + +scala> // ambiguous toString problem from #547 + +scala> val atom = new scala.xml.Atom() +atom: scala.xml.Atom[Unit] = () + +scala> // overriding toString problem from #1404 + +scala> class S(override val toString : String) +defined class S + +scala> val fish = new S("fish") +fish: S = fish + +scala> // Test that arrays pretty print nicely. + +scala> val arr = Array("What's", "up", "doc?") +arr: Array[String] = Array(What's, up, doc?) + +scala> // Test that arrays pretty print nicely, even when we give them type Any + +scala> val arrInt : Any = Array(1,2,3) +arrInt: Any = Array(1, 2, 3) + +scala> // Test that nested arrays are pretty-printed correctly + +scala> val arrArrInt : Any = Array(Array(1, 2), Array(3, 4)) +arrArrInt: Any = Array(Array(1, 2), Array(3, 4)) + +scala> + +scala> // implicit conversions + +scala> case class Foo(n: Int) +defined class Foo + +scala> case class Bar(n: Int) +defined class Bar + +scala> implicit def foo2bar(foo: Foo) = Bar(foo.n) +foo2bar: (foo: Foo)Bar + +scala> val bar: Bar = Foo(3) +bar: Bar = Bar(3) + +scala> + +scala> // importing from a previous result + +scala> import bar._ +import bar._ + +scala> val m = n +m: Int = 3 + +scala> + +scala> // stressing the imports mechanism + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> + +scala> + +scala> val x1 = 1 +x1: Int = 1 + +scala> val x2 = 1 +x2: Int = 1 + +scala> val x3 = 1 +x3: Int = 1 + +scala> val x4 = 1 +x4: Int = 1 + +scala> val x5 = 1 +x5: Int = 1 + +scala> val x6 = 1 +x6: Int = 1 + +scala> val x7 = 1 +x7: Int = 1 + +scala> val x8 = 1 +x8: Int = 1 + +scala> val x9 = 1 +x9: Int = 1 + +scala> val x10 = 1 +x10: Int = 1 + +scala> val x11 = 1 +x11: Int = 1 + +scala> val x12 = 1 +x12: Int = 1 + +scala> val x13 = 1 +x13: Int = 1 + +scala> val x14 = 1 +x14: Int = 1 + +scala> val x15 = 1 +x15: Int = 1 + +scala> val x16 = 1 +x16: Int = 1 + +scala> val x17 = 1 +x17: Int = 1 + +scala> val x18 = 1 +x18: Int = 1 + +scala> val x19 = 1 +x19: Int = 1 + +scala> val x20 = 1 +x20: Int = 1 + +scala> + +scala> val two = one + x5 +two: Int = 2 + +scala> + +scala> // handling generic wildcard arrays (#2386) + +scala> // It's put here because type feedback is an important part of it. + +scala> val xs: Array[_] = Array(1, 2) +xs: Array[_] = Array(1, 2) + +scala> xs.size +res2: Int = 2 + +scala> xs.head +res3: Any = 1 + +scala> xs filter (_ == 2) +res4: Array[_] = Array(2) + +scala> xs map (_ => "abc") +res5: Array[String] = Array(abc, abc) + +scala> xs map (x => x) +res6: scala.collection.mutable.ArraySeq[_] = ArraySeq(1, 2) + +scala> xs map (x => (x, x)) +res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2)) + +scala> + +scala> // interior syntax errors should *not* go into multi-line input mode. + +scala> // both of the following should abort immediately: + +scala> def x => y => z +:1: error: '=' expected but '=>' found. + def x => y => z + ^ + +scala> [1,2,3] +:1: error: illegal start of definition + [1,2,3] + ^ + +scala> + +scala> + +scala> // multi-line XML + +scala> + +res8: scala.xml.Elem = + + + +scala> + +scala> + +scala> /* + /* + multi-line comment + */ +*/ + +scala> + +scala> + +scala> // multi-line string + +scala> """ +hello +there +""" +res9: String = +" +hello +there +" + +scala> + +scala> (1 + // give up early by typing two blank lines + + +You typed two blank lines. Starting a new command. + +scala> // defining and using quoted names should work (ticket #323) + +scala> def `match` = 1 +match: Int + +scala> val x = `match` +x: Int = 1 + +scala> + +scala> // multiple classes defined on one line + +scala> sealed class Exp; class Fact extends Exp; class Term extends Exp +defined class Exp +defined class Fact +defined class Term + +scala> def f(e: Exp) = e match { // non-exhaustive warning here + case _:Fact => 3 +} +:18: warning: match is not exhaustive! +missing combination Exp +missing combination Term + + def f(e: Exp) = e match { // non-exhaustive warning here + ^ +f: (e: Exp)Int + +scala> + +scala> plusOne: (x: Int)Int res0: Int = 6 res0: String = after reset diff --git a/test/files/jvm/interpreter.scala b/test/files/jvm/interpreter.scala index f0bc8b5818..1f289d9335 100644 --- a/test/files/jvm/interpreter.scala +++ b/test/files/jvm/interpreter.scala @@ -2,6 +2,7 @@ import scala.tools.nsc._ import scala.tools.partest.ReplTest object Test extends ReplTest { + override def extraSettings = "-deprecation" def code = // basics 3+4 @@ -29,7 +30,7 @@ val atom = new scala.xml.Atom() class S(override val toString : String) val fish = new S("fish") // Test that arrays pretty print nicely. -val arr = Array("What's", "up", "doc?") +val arr = Array("What's", "up", "doc?") // Test that arrays pretty print nicely, even when we give them type Any val arrInt : Any = Array(1,2,3) // Test that nested arrays are pretty-printed correctly @@ -132,8 +133,8 @@ there // defining and using quoted names should work (ticket #323) -def `match` = 1 -val x = `match` +def `match` = 1 +val x = `match` // multiple classes defined on one line sealed class Exp; class Fact extends Exp; class Term extends Exp @@ -153,6 +154,6 @@ def f(e: Exp) = e match {{ // non-exhaustive warning here interp.interpret("\"after reset\"") interp.interpret("plusOne(5) // should be undefined now") } - + appendix() } diff --git a/test/files/jvm/manifests.check b/test/files/jvm/manifests.check deleted file mode 100644 index 54f504b929..0000000000 --- a/test/files/jvm/manifests.check +++ /dev/null @@ -1,55 +0,0 @@ -x=(), m=Unit -x=true, m=Boolean -x=a, m=Char -x=1, m=Int -x=abc, m=java.lang.String -x='abc, m=scala.Symbol - -x=List(()), m=scala.collection.immutable.List[Unit] -x=List(true), m=scala.collection.immutable.List[Boolean] -x=List(1), m=scala.collection.immutable.List[Int] -x=List(abc), m=scala.collection.immutable.List[java.lang.String] -x=List('abc), m=scala.collection.immutable.List[scala.Symbol] - -x=[Z, m=Array[Boolean] -x=[C, m=Array[Char] -x=[I, m=Array[Int] -x=[Ljava.lang.String;, m=Array[java.lang.String] -x=[Lscala.Symbol;, m=Array[scala.Symbol] - -x=((),()), m=scala.Tuple2[Unit, Unit] -x=(true,false), m=scala.Tuple2[Boolean, Boolean] -x=(1,2), m=scala.Tuple2[Int, Int] -x=(abc,xyz), m=scala.Tuple2[java.lang.String, java.lang.String] -x=('abc,'xyz), m=scala.Tuple2[scala.Symbol, scala.Symbol] - - -x=Foo, m=Foo[Int] -x=Foo, m=Foo[scala.collection.immutable.List[Int]] -x=Foo, m=Foo[Foo[Int]] -x=Foo, m=Foo[scala.collection.immutable.List[Foo[Int]]] - -x=Test1$$anon$1, m=Object with Bar[java.lang.String] - -()=() -true=true -a=a -1=1 -'abc='abc - -List(())=List(()) -List(true)=List(true) -List('abc)=List('abc) - -Array()=Array() -Array(true)=Array(true) -Array(a)=Array(a) -Array(1)=Array(1) - -((),())=((),()) -(true,false)=(true,false) - -List(List(1), List(2))=List(List(1), List(2)) - -Array(Array(1), Array(2))=Array(Array(1), Array(2)) - diff --git a/test/files/jvm/manifests.check.temporarily.disabled b/test/files/jvm/manifests.check.temporarily.disabled new file mode 100644 index 0000000000..54f504b929 --- /dev/null +++ b/test/files/jvm/manifests.check.temporarily.disabled @@ -0,0 +1,55 @@ +x=(), m=Unit +x=true, m=Boolean +x=a, m=Char +x=1, m=Int +x=abc, m=java.lang.String +x='abc, m=scala.Symbol + +x=List(()), m=scala.collection.immutable.List[Unit] +x=List(true), m=scala.collection.immutable.List[Boolean] +x=List(1), m=scala.collection.immutable.List[Int] +x=List(abc), m=scala.collection.immutable.List[java.lang.String] +x=List('abc), m=scala.collection.immutable.List[scala.Symbol] + +x=[Z, m=Array[Boolean] +x=[C, m=Array[Char] +x=[I, m=Array[Int] +x=[Ljava.lang.String;, m=Array[java.lang.String] +x=[Lscala.Symbol;, m=Array[scala.Symbol] + +x=((),()), m=scala.Tuple2[Unit, Unit] +x=(true,false), m=scala.Tuple2[Boolean, Boolean] +x=(1,2), m=scala.Tuple2[Int, Int] +x=(abc,xyz), m=scala.Tuple2[java.lang.String, java.lang.String] +x=('abc,'xyz), m=scala.Tuple2[scala.Symbol, scala.Symbol] + + +x=Foo, m=Foo[Int] +x=Foo, m=Foo[scala.collection.immutable.List[Int]] +x=Foo, m=Foo[Foo[Int]] +x=Foo, m=Foo[scala.collection.immutable.List[Foo[Int]]] + +x=Test1$$anon$1, m=Object with Bar[java.lang.String] + +()=() +true=true +a=a +1=1 +'abc='abc + +List(())=List(()) +List(true)=List(true) +List('abc)=List('abc) + +Array()=Array() +Array(true)=Array(true) +Array(a)=Array(a) +Array(1)=Array(1) + +((),())=((),()) +(true,false)=(true,false) + +List(List(1), List(2))=List(List(1), List(2)) + +Array(Array(1), Array(2))=Array(Array(1), Array(2)) + diff --git a/test/files/jvm/manifests.scala b/test/files/jvm/manifests.scala deleted file mode 100644 index 6bbea4d052..0000000000 --- a/test/files/jvm/manifests.scala +++ /dev/null @@ -1,119 +0,0 @@ -object Test extends App { - Test1 - Test2 - //Test3 // Java 1.5+ only -} - -class Foo[T](x: T) -trait Bar[T] { def f: T } - -object Test1 extends TestUtil { - print(()) - print(true) - print('a') - print(1) - print("abc") - print('abc) - println() - - print(List(())) - print(List(true)) - print(List(1)) - print(List("abc")) - print(List('abc)) - println() - - //print(Array(())) //Illegal class name "[V" in class file Test$ - print(Array(true)) - print(Array('a')) - print(Array(1)) - print(Array("abc")) - print(Array('abc)) - println() - - print(((), ())) - print((true, false)) - print((1, 2)) - print(("abc", "xyz")) - print(('abc, 'xyz)) - println() - - // Disabled: should these work? changing the inference for objects from - // "object Test" to "Test.type" drags in a singleton manifest which for - // some reason leads to serialization failure. - // print(Test) - // print(List) - println() - - print(new Foo(2)) - print(new Foo(List(2))) - print(new Foo(new Foo(2))) - print(new Foo(List(new Foo(2)))) - println() - - print(new Bar[String] { def f = "abc" }) - println() -} - -object Test2 { - import scala.util.Marshal._ - println("()="+load[Unit](dump(()))) - println("true="+load[Boolean](dump(true))) - println("a="+load[Char](dump('a'))) - println("1="+load[Int](dump(1))) - println("'abc="+load[Symbol](dump('abc))) - println() - - println("List(())="+load[List[Unit]](dump(List(())))) - println("List(true)="+load[List[Boolean]](dump(List(true)))) - println("List('abc)="+load[List[Symbol]](dump(List('abc)))) - println() - - def loadArray[T](x: Array[Byte])(implicit m: reflect.Manifest[Array[T]]) = - load[Array[T]](x)(m).deep.toString - println("Array()="+loadArray[Int](dump(Array(): Array[Int]))) - println("Array(true)="+loadArray[Boolean](dump(Array(true)))) - println("Array(a)="+loadArray[Char](dump(Array('a')))) - println("Array(1)="+loadArray[Int](dump(Array(1)))) - println() - - println("((),())="+load[(Unit, Unit)](dump(((), ())))) - println("(true,false)="+load[(Boolean, Boolean)](dump((true, false)))) - println() - - println("List(List(1), List(2))="+load[List[List[Int]]](dump(List(List(1), List(2))))) - println() - - println("Array(Array(1), Array(2))="+loadArray[Array[Int]](dump(Array(Array(1), Array(2))))) - println() -} - -object Test3 extends TestUtil { - import scala.reflect.Manifest._ - val ct1 = classType(classOf[Char]) - val ct2 = classType(classOf[List[_]], ct1) - print(ct1) - //print(ct2) // ??? x=scala.List[char], m=scala.reflect.Manifest[scala.runtime.Nothing$] - println() -} - -trait TestUtil { - import java.io._ - def write[A](o: A): Array[Byte] = { - val ba = new ByteArrayOutputStream(512) - val out = new ObjectOutputStream(ba) - out.writeObject(o) - out.close() - ba.toByteArray() - } - def read[A](buffer: Array[Byte]): A = { - val in = new ObjectInputStream(new ByteArrayInputStream(buffer)) - in.readObject().asInstanceOf[A] - } - import scala.reflect._ - def print[T](x: T)(implicit m: Manifest[T]) { - val m1: Manifest[T] = read(write(m)) - val x1 = x.toString.replaceAll("@[0-9a-z]+$", "") - println("x="+x1+", m="+m1) - } -} diff --git a/test/files/jvm/manifests.scala.temporarily.disabled b/test/files/jvm/manifests.scala.temporarily.disabled new file mode 100644 index 0000000000..241966fd9d --- /dev/null +++ b/test/files/jvm/manifests.scala.temporarily.disabled @@ -0,0 +1,109 @@ +object Test extends App { + Test1 + Test2 +} + +class Foo[T](x: T) +trait Bar[T] { def f: T } + +object Test1 extends TestUtil { + print(()) + print(true) + print('a') + print(1) + print("abc") + print('abc) + println() + + print(List(())) + print(List(true)) + print(List(1)) + print(List("abc")) + print(List('abc)) + println() + + //print(Array(())) //Illegal class name "[V" in class file Test$ + print(Array(true)) + print(Array('a')) + print(Array(1)) + print(Array("abc")) + print(Array('abc)) + println() + + print(((), ())) + print((true, false)) + print((1, 2)) + print(("abc", "xyz")) + print(('abc, 'xyz)) + println() + + // Disabled: should these work? changing the inference for objects from + // "object Test" to "Test.type" drags in a singleton manifest which for + // some reason leads to serialization failure. + // print(Test) + // print(List) + println() + + print(new Foo(2)) + print(new Foo(List(2))) + print(new Foo(new Foo(2))) + print(new Foo(List(new Foo(2)))) + println() + + print(new Bar[String] { def f = "abc" }) + println() +} + +object Test2 { + import scala.util.Marshal._ + println("()="+load[Unit](dump(()))) + println("true="+load[Boolean](dump(true))) + println("a="+load[Char](dump('a'))) + println("1="+load[Int](dump(1))) + println("'abc="+load[Symbol](dump('abc))) + println() + + println("List(())="+load[List[Unit]](dump(List(())))) + println("List(true)="+load[List[Boolean]](dump(List(true)))) + println("List('abc)="+load[List[Symbol]](dump(List('abc)))) + println() + + def loadArray[T](x: Array[Byte])(implicit m: reflect.Manifest[Array[T]]) = + load[Array[T]](x)(m).deep.toString + println("Array()="+loadArray[Int](dump(Array(): Array[Int]))) + println("Array(true)="+loadArray[Boolean](dump(Array(true)))) + println("Array(a)="+loadArray[Char](dump(Array('a')))) + println("Array(1)="+loadArray[Int](dump(Array(1)))) + println() + + println("((),())="+load[(Unit, Unit)](dump(((), ())))) + println("(true,false)="+load[(Boolean, Boolean)](dump((true, false)))) + println() + + println("List(List(1), List(2))="+load[List[List[Int]]](dump(List(List(1), List(2))))) + println() + + println("Array(Array(1), Array(2))="+loadArray[Array[Int]](dump(Array(Array(1), Array(2))))) + println() +} + +trait TestUtil { + import java.io._ + def write[A](o: A): Array[Byte] = { + val ba = new ByteArrayOutputStream(512) + val out = new ObjectOutputStream(ba) + out.writeObject(o) + out.close() + ba.toByteArray() + } + def read[A](buffer: Array[Byte]): A = { + val in = new ObjectInputStream(new ByteArrayInputStream(buffer)) + in.readObject().asInstanceOf[A] + } + import scala.reflect._ + def print[T](x: T)(implicit m: Manifest[T]) { + val m1: Manifest[T] = read(write(m)) + val x1 = x.toString.replaceAll("@[0-9a-z]+$", "") + println("x="+x1+", m="+m1) + } +} diff --git a/test/files/macros/Printf.scala b/test/files/macros/Printf.scala deleted file mode 100644 index 4a88e5b069..0000000000 --- a/test/files/macros/Printf.scala +++ /dev/null @@ -1,39 +0,0 @@ -// macros should be built separately from their clients, so simple "scalac Printf.scala Test.scala" won't work -// 1) first build this file with "scalac -Xmacros Printf.scala" -// 2) the build the test with "scalac -cp Test.scala" - -object Printf extends App { - def macro printf(format: String, params: Any*) : String = { - var i = 0 - def gensym(name: String) = { i += 1; newTermName(name + i) } - - def createTempValDef(value: Tree, clazz: Class[_]): (Option[Tree], Tree) = { - val local = gensym("temp") - val tpe = if (clazz == classOf[Int]) Ident(newTypeName("Int")) - else if (clazz == classOf[String]) Select(Select(Ident(newTermName("java")), newTermName("lang")), newTypeName("String")) - else throw new Exception("unknown class " + clazz.toString) - (Some(ValDef(Modifiers(), local, tpe, value)), Ident(local)) - } - - def tree_printf(format: Tree, params: Tree*) = { - val Literal(Constant(s_format: String)) = format - val paramsStack = scala.collection.mutable.Stack(params: _*) - val parsed = s_format.split("(?<=%[\\w%])|(?=%[\\w%])") map { - case "%d" => createTempValDef(paramsStack.pop, classOf[Int]) - case "%s" => createTempValDef(paramsStack.pop, classOf[String]) - case "%%" => (None, Literal(Constant("%"))) - case part => (None, Literal(Constant(part))) - } - - val evals = for ((Some(eval), _) <- parsed if eval != None) yield eval - val prints = for ((_, ref) <- parsed) yield { - val print = Select(Select(Ident(newTermName("scala")), newTermName("Predef")), newTermName("print")) - Apply(print, List(ref)) - } - - Block((evals ++ prints).toList, Literal(Constant(()))) - } - - tree_printf(format, params: _*) - } -} diff --git a/test/files/macros/Test.scala b/test/files/macros/Test.scala deleted file mode 100644 index d8cdcf6756..0000000000 --- a/test/files/macros/Test.scala +++ /dev/null @@ -1,8 +0,0 @@ -// macros should be built separately from their clients, so simple "scalac Printf.scala Test.scala" won't work -// 1) first build the printf macro with "scalac -Xmacros Printf.scala" -// 2) the build this file with "scalac -cp Test.scala" - -object Test extends App { - import Printf._ - printf("hello %s", "world") -} \ No newline at end of file diff --git a/test/files/macros/macros_v0001.bat b/test/files/macros/macros_v0001.bat deleted file mode 100644 index 3395d2e3c1..0000000000 --- a/test/files/macros/macros_v0001.bat +++ /dev/null @@ -1,40 +0,0 @@ -@echo off - -set scalahome=%~dp0\..\..\.. -set scaladeps=%scalahome%\lib\jline.jar;%scalahome%\lib\fjbg.jar -set scalalib=%scalahome%\build\pack\lib\scala-library.jar -if not exist "%scalalib%" set scalalib=%scalahome%\build\locker\classes\library -set scalacomp="%scalahome%\build\pack\lib\scala-compiler.jar" -if not exist "%scalacomp%" set scalacomp=%scalahome%\build\locker\classes\compiler -set stdcp=%scaladeps%;%scalalib%;%scalacomp% - -echo Compiling macros... -set cp=%stdcp% -call :scalac -Xmacros "%~dp0\Printf.scala" - -echo Compiling the program... -set cp=%stdcp%;%~dp0. -call :scalac "%~dp0\Test.scala" - -echo. -echo NOW LOOK!!! -echo =============================================== -set cp=%stdcp%;%~dp0. -call :scala Test -echo. -echo =============================================== -goto :eof - -:scalac -setlocal -call set args=%* -rem echo java -cp "%cp%" -Dscala.usejavacp=true scala.tools.nsc.Main %args% -java -cp "%cp%" -Dscala.usejavacp=true scala.tools.nsc.Main %args% -endlocal&goto :eof - -:scala -setlocal -call set args=%* -rem echo java -cp "%cp%" -Dscala.usejavacp=true scala.tools.nsc.MainGenericRunner %args% -java -cp "%cp%" -Dscala.usejavacp=true scala.tools.nsc.MainGenericRunner %args% -endlocal&goto :eof diff --git a/test/files/macros/macros_v0001.sh b/test/files/macros/macros_v0001.sh deleted file mode 100644 index abe09836bb..0000000000 --- a/test/files/macros/macros_v0001.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -set -o errexit - -if [[ $(uname -s) == CYGWIN* ]]; then cpsep=";"; else cpsep=":"; fi -scripthome="$(dirname "$0")" -scalahome="$scripthome/../../.." -scaladeps="$scalahome/lib/jline.jar;$scalahome/lib/fjbg.jar" -scalalib="$scalahome/build/pack/lib/scala-library.jar" -if [ ! -f "$scalalib" ]; then scalalib="$scalahome/build/locker/classes/library"; fi -scalacomp="$scalahome/build/pack/lib/scala-compiler.jar" -if [ ! -f "$scalacomp" ]; then scalacomp="$scalahome/build/locker/classes/compiler"; fi -stdcp="$scaladeps$cpsep$scalalib$cpsep$scalacomp" -function scalac { java -cp "$cp" -Dscala.usejavacp=true scala.tools.nsc.Main $*; } -function scala { java -cp "$cp" -Dscala.usejavacp=true scala.tools.nsc.MainGenericRunner $*; } - -echo "Compiling macros..." -cp="$stdcp" -scalac -Xmacros "$scripthome/Printf.scala" - -echo "Compiling the program..." -cp="$stdcp$cpsep$scripthome" -scalac "$scripthome/Test.scala" - -echo "" -echo "NOW LOOK" -echo "===============================================" -cp="$stdcp$cpsep$scripthome" -scala Test -echo "" -echo "===============================================" 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-argtype-mismatch/Test_2.scala b/test/files/neg/macro-argtype-mismatch/Test_2.scala deleted file mode 100644 index 18feb69425..0000000000 --- a/test/files/neg/macro-argtype-mismatch/Test_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test extends App { - import Macros._ - foo("2") -} \ 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 . + or : macro + 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 . + or : macro + 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 . + or : macro + 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-invalidsig-params-badargc/Test_2.scala b/test/files/neg/macro-invalidsig-params-badargc/Test_2.scala new file mode 100644 index 0000000000..cbd6232073 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badargc/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-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-invalidsig-params-badtype/Test_2.scala b/test/files/neg/macro-invalidsig-params-badtype/Test_2.scala new file mode 100644 index 0000000000..cbd6232073 --- /dev/null +++ b/test/files/neg/macro-invalidsig-params-badtype/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-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-noexpand/Test_2.scala b/test/files/neg/macro-noexpand/Test_2.scala deleted file mode 100644 index 0bed592883..0000000000 --- a/test/files/neg/macro-noexpand/Test_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -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..d9c390ba25 --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No GroundTypeTag available for C[T] + println(implicitly[GroundTypeTag[C[T]]]) + ^ +Test.scala:6: error: No GroundTypeTag available for List[C[T]] + println(implicitly[GroundTypeTag[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..d5ee61b91d --- /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[GroundTypeTag[C[T]]]) + println(implicitly[GroundTypeTag[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..c678a2a313 --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-typeparams-notags.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No GroundTypeTag available for T + println(implicitly[GroundTypeTag[T]]) + ^ +Test.scala:6: error: No GroundTypeTag available for List[T] + println(implicitly[GroundTypeTag[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..98bdf6d67f --- /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[GroundTypeTag[T]]) + println(implicitly[GroundTypeTag[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..c678a2a313 --- /dev/null +++ b/test/files/neg/macro-reify-groundtypetag-usetypetag.check @@ -0,0 +1,7 @@ +Test.scala:5: error: No GroundTypeTag available for T + println(implicitly[GroundTypeTag[T]]) + ^ +Test.scala:6: error: No GroundTypeTag available for List[T] + println(implicitly[GroundTypeTag[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..507d03a390 --- /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[GroundTypeTag[T]]) + println(implicitly[GroundTypeTag[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..6b6df6ba76 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 GroundTypeTag 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..ec67e76bb4 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.GroundTypeTag` 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.GroundTypeTag` 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 +} diff --git a/test/files/pos/implicits.scala b/test/files/pos/implicits.scala deleted file mode 100644 index 2c01dd0ba8..0000000000 --- a/test/files/pos/implicits.scala +++ /dev/null @@ -1,89 +0,0 @@ -// #1435 -object t1435 { - implicit def a(s:String):String = error("") - implicit def a(i:Int):String = error("") - implicit def b(i:Int):String = error("") -} - -class C1435 { - val v:String = { - import t1435.a - 2 - } -} - -// #1492 -class C1492 { - - class X - - def foo(x: X => X) {} - - foo ( implicit x => implicitly[X] ) - foo { implicit x => implicitly[X] } -} - -// #1579 -object Test1579 { - class Column - class Query[E](val value: E) - class Invoker(q: Any) { val foo = null } - - implicit def unwrap[C](q: Query[C]) = q.value - implicit def invoker(q: Query[Column]) = new Invoker(q) - - val q = new Query(new Column) - q.foo -} -// #1625 -object Test1625 { - - class Wrapped(x:Any) { - def unwrap() = x - } - - implicit def byName[A](x: =>A) = new Wrapped(x) - - implicit def byVal[A](x: A) = x - - def main(args: Array[String]) = { - -// val res:Wrapped = 7 // works - - val res = 7.unwrap() // doesn't work - - println("=> result: " + res) - } -} - -object Test2188 { - implicit def toJavaList[A: ClassManifest](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) - - val x: java.util.List[String] = List("foo") -} - -object TestNumericWidening { - val y = 1 - val x: java.lang.Long = y -} - -// #2709 -package foo2709 { - class A - class B - - package object bar { - implicit def a2b(a: A): B = new B - } - - package bar { - object test { - new A: B - } - } -} - -// Problem with specs -object specsProblem { - println(implicitly[Manifest[Class[_]]]) -} diff --git a/test/files/pos/implicits.scala.temporarily.disabled b/test/files/pos/implicits.scala.temporarily.disabled new file mode 100644 index 0000000000..2c01dd0ba8 --- /dev/null +++ b/test/files/pos/implicits.scala.temporarily.disabled @@ -0,0 +1,89 @@ +// #1435 +object t1435 { + implicit def a(s:String):String = error("") + implicit def a(i:Int):String = error("") + implicit def b(i:Int):String = error("") +} + +class C1435 { + val v:String = { + import t1435.a + 2 + } +} + +// #1492 +class C1492 { + + class X + + def foo(x: X => X) {} + + foo ( implicit x => implicitly[X] ) + foo { implicit x => implicitly[X] } +} + +// #1579 +object Test1579 { + class Column + class Query[E](val value: E) + class Invoker(q: Any) { val foo = null } + + implicit def unwrap[C](q: Query[C]) = q.value + implicit def invoker(q: Query[Column]) = new Invoker(q) + + val q = new Query(new Column) + q.foo +} +// #1625 +object Test1625 { + + class Wrapped(x:Any) { + def unwrap() = x + } + + implicit def byName[A](x: =>A) = new Wrapped(x) + + implicit def byVal[A](x: A) = x + + def main(args: Array[String]) = { + +// val res:Wrapped = 7 // works + + val res = 7.unwrap() // doesn't work + + println("=> result: " + res) + } +} + +object Test2188 { + implicit def toJavaList[A: ClassManifest](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) + + val x: java.util.List[String] = List("foo") +} + +object TestNumericWidening { + val y = 1 + val x: java.lang.Long = y +} + +// #2709 +package foo2709 { + class A + class B + + package object bar { + implicit def a2b(a: A): B = new B + } + + package bar { + object test { + new A: B + } + } +} + +// Problem with specs +object specsProblem { + println(implicitly[Manifest[Class[_]]]) +} diff --git a/test/files/pos/liftcode_polymorphic.scala b/test/files/pos/liftcode_polymorphic.scala index 3d4b159c83..9c59b34bee 100644 --- a/test/files/pos/liftcode_polymorphic.scala +++ b/test/files/pos/liftcode_polymorphic.scala @@ -1,3 +1,5 @@ +import scala.reflect.mirror._ + object Append extends Application { def append[A](l1: List[A], l2: List[A]):List[A] = @@ -6,6 +8,6 @@ object Append extends Application { case x::xs => x :: append(xs, l2) } - println(scala.reflect.Code.lift(append _).tree) + println(reify(append _).tree) } diff --git a/test/files/pos/macros.flags b/test/files/pos/macros.flags deleted file mode 100644 index 7fea2ff901..0000000000 --- a/test/files/pos/macros.flags +++ /dev/null @@ -1 +0,0 @@ --Xmacros \ No newline at end of file diff --git a/test/files/pos/macros.scala b/test/files/pos/macros.scala deleted file mode 100644 index 303610d464..0000000000 --- a/test/files/pos/macros.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test { - - class C { - def macro foo[T](xs: List[T]): T = (T, xs) match { - case (t1: Type, t2: Tree) => t2 - } - } -} diff --git a/test/files/pos/manifest1.scala b/test/files/pos/manifest1.scala deleted file mode 100644 index 8901aa7437..0000000000 --- a/test/files/pos/manifest1.scala +++ /dev/null @@ -1,21 +0,0 @@ -import scala.reflect.Manifest - -object Test { - def foo[T](x: T)(implicit m: Manifest[T]) { - foo(List(x)) - } - foo(1) - foo("abc") - foo(List(1, 2, 3)) - val x: List[Int] with Ordered[List[Int]] = null - foo(x) - foo[x.type](x) - abstract class C { type T = String; val x: T } - val c = new C { val x = "abc" } - foo(c.x) - abstract class D { type T; implicit val m: Manifest[T]; val x: T } - val stringm = implicitly[Manifest[String]] - val d: D = new D { type T = String; val m = stringm; val x = "x" } - import d.m - foo(d.x) -} diff --git a/test/files/pos/manifest1.scala.temporarily.disabled b/test/files/pos/manifest1.scala.temporarily.disabled new file mode 100644 index 0000000000..8901aa7437 --- /dev/null +++ b/test/files/pos/manifest1.scala.temporarily.disabled @@ -0,0 +1,21 @@ +import scala.reflect.Manifest + +object Test { + def foo[T](x: T)(implicit m: Manifest[T]) { + foo(List(x)) + } + foo(1) + foo("abc") + foo(List(1, 2, 3)) + val x: List[Int] with Ordered[List[Int]] = null + foo(x) + foo[x.type](x) + abstract class C { type T = String; val x: T } + val c = new C { val x = "abc" } + foo(c.x) + abstract class D { type T; implicit val m: Manifest[T]; val x: T } + val stringm = implicitly[Manifest[String]] + val d: D = new D { type T = String; val m = stringm; val x = "x" } + import d.m + foo(d.x) +} diff --git a/test/files/pos/t5223.scala b/test/files/pos/t5223.scala index 51682e9254..398630dc61 100644 --- a/test/files/pos/t5223.scala +++ b/test/files/pos/t5223.scala @@ -1,6 +1,6 @@ -import scala.reflect._ +import scala.reflect.mirror._ object Foo extends App { - Code.lift{def printf(format: String, args: Any*): String = null } - Code.lift{def printf(format: String, args: Any*): String = ("abc": @cloneable)} + reify{def printf(format: String, args: Any*): String = null } + reify{def printf(format: String, args: Any*): String = ("abc": @cloneable)} } diff --git a/test/files/pos/t531.scala b/test/files/pos/t531.scala index 856926de4f..5176912ef0 100644 --- a/test/files/pos/t531.scala +++ b/test/files/pos/t531.scala @@ -1,8 +1,9 @@ +import scala.reflect.mirror._ + object Test extends App { - import scala.reflect._; def titi = { var truc = 0 - val tata = Code.lift{() => { + val tata = reify{() => { truc = 6 }} () diff --git a/test/files/pos/t532.scala b/test/files/pos/t532.scala index f864bbf45e..a319fdfa27 100644 --- a/test/files/pos/t532.scala +++ b/test/files/pos/t532.scala @@ -1,8 +1,9 @@ +import scala.reflect.mirror._ + object Test extends App { - import scala.reflect._; def titi: Unit = { var truc = 0 - val tata = Code.lift{() => { + val tata = reify{() => { truc = truc + 6 }} () diff --git a/test/files/run/classtags_contextbound.check b/test/files/run/classtags_contextbound.check new file mode 100644 index 0000000000..4104d544ba --- /dev/null +++ b/test/files/run/classtags_contextbound.check @@ -0,0 +1 @@ +class [I diff --git a/test/files/run/classtags_contextbound.scala b/test/files/run/classtags_contextbound.scala new file mode 100644 index 0000000000..5bb0ae8d80 --- /dev/null +++ b/test/files/run/classtags_contextbound.scala @@ -0,0 +1,5 @@ +object Test extends App { + def mkArray[T: ClassTag] = Array[T]() + def foo[T: ClassTag] = mkArray[T] + println(foo[Int].getClass) +} \ No newline at end of file diff --git a/test/files/run/classtags_core.check b/test/files/run/classtags_core.check new file mode 100644 index 0000000000..ce5a893b08 --- /dev/null +++ b/test/files/run/classtags_core.check @@ -0,0 +1,30 @@ +true +ClassTag(byte) +true +ClassTag(short) +true +ClassTag(char) +true +ClassTag(int) +true +ClassTag(long) +true +ClassTag(float) +true +ClassTag(double) +true +ClassTag(boolean) +true +ClassTag(void) +true +ClassTag(class java.lang.Object) +true +ClassTag(class java.lang.Object) +true +ClassTag(class java.lang.Object) +true +ClassTag(class java.lang.Object) +true +ClassTag(class java.lang.Object) +true +ClassTag(class java.lang.Object) diff --git a/test/files/run/classtags_core.scala b/test/files/run/classtags_core.scala new file mode 100644 index 0000000000..45c54b1fe0 --- /dev/null +++ b/test/files/run/classtags_core.scala @@ -0,0 +1,32 @@ +object Test extends App { + println(implicitly[ClassTag[Byte]] eq ClassTag.Byte) + println(implicitly[ClassTag[Byte]]) + println(implicitly[ClassTag[Short]] eq ClassTag.Short) + println(implicitly[ClassTag[Short]]) + println(implicitly[ClassTag[Char]] eq ClassTag.Char) + println(implicitly[ClassTag[Char]]) + println(implicitly[ClassTag[Int]] eq ClassTag.Int) + println(implicitly[ClassTag[Int]]) + println(implicitly[ClassTag[Long]] eq ClassTag.Long) + println(implicitly[ClassTag[Long]]) + println(implicitly[ClassTag[Float]] eq ClassTag.Float) + println(implicitly[ClassTag[Float]]) + println(implicitly[ClassTag[Double]] eq ClassTag.Double) + println(implicitly[ClassTag[Double]]) + println(implicitly[ClassTag[Boolean]] eq ClassTag.Boolean) + println(implicitly[ClassTag[Boolean]]) + println(implicitly[ClassTag[Unit]] eq ClassTag.Unit) + println(implicitly[ClassTag[Unit]]) + println(implicitly[ClassTag[Any]] eq ClassTag.Any) + println(implicitly[ClassTag[Any]]) + println(implicitly[ClassTag[Object]] eq ClassTag.Object) + println(implicitly[ClassTag[Object]]) + println(implicitly[ClassTag[AnyVal]] eq ClassTag.AnyVal) + println(implicitly[ClassTag[AnyVal]]) + println(implicitly[ClassTag[AnyRef]] eq ClassTag.AnyRef) + println(implicitly[ClassTag[AnyRef]]) + println(implicitly[ClassTag[Null]] eq ClassTag.Null) + println(implicitly[ClassTag[Null]]) + println(implicitly[ClassTag[Nothing]] eq ClassTag.Nothing) + println(implicitly[ClassTag[Nothing]]) +} \ No newline at end of file diff --git a/test/files/run/existentials3.check b/test/files/run/existentials3.check deleted file mode 100644 index 36a458dacc..0000000000 --- a/test/files/run/existentials3.check +++ /dev/null @@ -1,22 +0,0 @@ -_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object -_ <: Object with Test$ToS with scala.Product with scala.Serializable -Object with Test$ToS -Object with Test$ToS -Object with Test$ToS -scala.Function0[Object with Test$ToS] -scala.Function0[Object with Test$ToS] -_ <: Object with _ <: Object with Object with Test$ToS -_ <: Object with _ <: Object with _ <: Object with Test$ToS -scala.collection.immutable.List[Object with scala.collection.Seq[Int]] -scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]] -_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object -_ <: Object with Test$ToS with scala.Product with scala.Serializable -Object with Test$ToS -Object with Test$ToS -Object with Test$ToS -scala.Function0[Object with Test$ToS] -scala.Function0[Object with Test$ToS] -_ <: Object with _ <: Object with Object with Test$ToS -_ <: Object with _ <: Object with _ <: Object with Test$ToS -scala.collection.immutable.List[Object with scala.collection.Seq[Int]] -scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]] diff --git a/test/files/run/existentials3.check.temporarily.disabled b/test/files/run/existentials3.check.temporarily.disabled new file mode 100644 index 0000000000..36a458dacc --- /dev/null +++ b/test/files/run/existentials3.check.temporarily.disabled @@ -0,0 +1,22 @@ +_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object +_ <: Object with Test$ToS with scala.Product with scala.Serializable +Object with Test$ToS +Object with Test$ToS +Object with Test$ToS +scala.Function0[Object with Test$ToS] +scala.Function0[Object with Test$ToS] +_ <: Object with _ <: Object with Object with Test$ToS +_ <: Object with _ <: Object with _ <: Object with Test$ToS +scala.collection.immutable.List[Object with scala.collection.Seq[Int]] +scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]] +_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object +_ <: Object with Test$ToS with scala.Product with scala.Serializable +Object with Test$ToS +Object with Test$ToS +Object with Test$ToS +scala.Function0[Object with Test$ToS] +scala.Function0[Object with Test$ToS] +_ <: Object with _ <: Object with Object with Test$ToS +_ <: Object with _ <: Object with _ <: Object with Test$ToS +scala.collection.immutable.List[Object with scala.collection.Seq[Int]] +scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]] diff --git a/test/files/run/existentials3.scala b/test/files/run/existentials3.scala deleted file mode 100644 index bb80d366cc..0000000000 --- a/test/files/run/existentials3.scala +++ /dev/null @@ -1,73 +0,0 @@ -object Test { - trait ToS { final override def toString = getClass.getName } - - def f1 = { case class Bar() extends ToS; Bar } - def f2 = { case class Bar() extends ToS; Bar() } - def f3 = { class Bar() extends ToS; object Bar extends ToS; Bar } - def f4 = { class Bar() extends ToS; new Bar() } - def f5 = { object Bar extends ToS; Bar } - def f6 = { () => { object Bar extends ToS ; Bar } } - def f7 = { val f = { () => { object Bar extends ToS ; Bar } } ; f } - - def f8 = { trait A ; trait B extends A ; class C extends B with ToS; new C { } } - def f9 = { trait A ; trait B ; class C extends B with A with ToS; new C { } } - - def f10 = { class A { type T1 } ; List[A#T1]() } - def f11 = { abstract class A extends Seq[Int] ; List[A]() } - def f12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } - - val g1 = { case class Bar() extends ToS; Bar } - val g2 = { case class Bar() extends ToS; Bar() } - val g3 = { class Bar() extends ToS; object Bar extends ToS; Bar } - val g4 = { class Bar() extends ToS; new Bar() } - val g5 = { object Bar extends ToS; Bar } - val g6 = { () => { object Bar extends ToS ; Bar } } - val g7 = { val f = { () => { object Bar extends ToS ; Bar } } ; f } - - val g8 = { trait A ; trait B extends A ; class C extends B with ToS; new C { } } - val g9 = { trait A ; trait B ; class C extends B with A with ToS; new C { } } - - val g10 = { class A { type T1 } ; List[A#T1]() } - val g11 = { abstract class A extends Seq[Int] ; List[A]() } - val g12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } - - def m[T: Manifest](x: T) = println(manifest[T]) - - // manifests don't work for f10/g10 - def main(args: Array[String]): Unit = { - m(f1) - m(f2) - m(f3) - m(f4) - m(f5) - m(f6) - m(f7) - m(f8) - m(f9) - // m(f10) - m(f11) - m(f12) - m(g1) - m(g2) - m(g3) - m(g4) - m(g5) - m(g6) - m(g7) - m(g8) - m(g9) - // m(g10) - m(g11) - m(g12) - } -} - -object Misc { - trait Bippy { def bippy = "I'm Bippy!" } - object o1 { - def f1 = { trait A extends Seq[U forSome { type U <: Bippy }] ; abstract class B extends A ; trait C extends B ; (null: C) } - def f2 = f1.head.bippy - } - def g1 = o1.f1 _ - def g2 = o1.f2 _ -} diff --git a/test/files/run/existentials3.scala.temporarily.disabled b/test/files/run/existentials3.scala.temporarily.disabled new file mode 100644 index 0000000000..bb80d366cc --- /dev/null +++ b/test/files/run/existentials3.scala.temporarily.disabled @@ -0,0 +1,73 @@ +object Test { + trait ToS { final override def toString = getClass.getName } + + def f1 = { case class Bar() extends ToS; Bar } + def f2 = { case class Bar() extends ToS; Bar() } + def f3 = { class Bar() extends ToS; object Bar extends ToS; Bar } + def f4 = { class Bar() extends ToS; new Bar() } + def f5 = { object Bar extends ToS; Bar } + def f6 = { () => { object Bar extends ToS ; Bar } } + def f7 = { val f = { () => { object Bar extends ToS ; Bar } } ; f } + + def f8 = { trait A ; trait B extends A ; class C extends B with ToS; new C { } } + def f9 = { trait A ; trait B ; class C extends B with A with ToS; new C { } } + + def f10 = { class A { type T1 } ; List[A#T1]() } + def f11 = { abstract class A extends Seq[Int] ; List[A]() } + def f12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } + + val g1 = { case class Bar() extends ToS; Bar } + val g2 = { case class Bar() extends ToS; Bar() } + val g3 = { class Bar() extends ToS; object Bar extends ToS; Bar } + val g4 = { class Bar() extends ToS; new Bar() } + val g5 = { object Bar extends ToS; Bar } + val g6 = { () => { object Bar extends ToS ; Bar } } + val g7 = { val f = { () => { object Bar extends ToS ; Bar } } ; f } + + val g8 = { trait A ; trait B extends A ; class C extends B with ToS; new C { } } + val g9 = { trait A ; trait B ; class C extends B with A with ToS; new C { } } + + val g10 = { class A { type T1 } ; List[A#T1]() } + val g11 = { abstract class A extends Seq[Int] ; List[A]() } + val g12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } + + def m[T: Manifest](x: T) = println(manifest[T]) + + // manifests don't work for f10/g10 + def main(args: Array[String]): Unit = { + m(f1) + m(f2) + m(f3) + m(f4) + m(f5) + m(f6) + m(f7) + m(f8) + m(f9) + // m(f10) + m(f11) + m(f12) + m(g1) + m(g2) + m(g3) + m(g4) + m(g5) + m(g6) + m(g7) + m(g8) + m(g9) + // m(g10) + m(g11) + m(g12) + } +} + +object Misc { + trait Bippy { def bippy = "I'm Bippy!" } + object o1 { + def f1 = { trait A extends Seq[U forSome { type U <: Bippy }] ; abstract class B extends A ; trait C extends B ; (null: C) } + def f2 = f1.head.bippy + } + def g1 = o1.f1 _ + def g2 = o1.f2 _ +} diff --git a/test/files/run/groundtypetags_core.check b/test/files/run/groundtypetags_core.check new file mode 100644 index 0000000000..d1b71f0926 --- /dev/null +++ b/test/files/run/groundtypetags_core.check @@ -0,0 +1,30 @@ +true +GroundTypeTag[Byte] +true +GroundTypeTag[Short] +true +GroundTypeTag[Char] +true +GroundTypeTag[Int] +true +GroundTypeTag[Long] +true +GroundTypeTag[Float] +true +GroundTypeTag[Double] +true +GroundTypeTag[Boolean] +true +GroundTypeTag[Unit] +true +GroundTypeTag[Any] +true +GroundTypeTag[Object] +true +GroundTypeTag[AnyVal] +true +GroundTypeTag[AnyRef] +true +GroundTypeTag[Null] +true +GroundTypeTag[Nothing] diff --git a/test/files/run/groundtypetags_core.scala b/test/files/run/groundtypetags_core.scala new file mode 100644 index 0000000000..d779e3fc7e --- /dev/null +++ b/test/files/run/groundtypetags_core.scala @@ -0,0 +1,32 @@ +object Test extends App { + println(implicitly[GroundTypeTag[Byte]] eq GroundTypeTag.Byte) + println(implicitly[GroundTypeTag[Byte]]) + println(implicitly[GroundTypeTag[Short]] eq GroundTypeTag.Short) + println(implicitly[GroundTypeTag[Short]]) + println(implicitly[GroundTypeTag[Char]] eq GroundTypeTag.Char) + println(implicitly[GroundTypeTag[Char]]) + println(implicitly[GroundTypeTag[Int]] eq GroundTypeTag.Int) + println(implicitly[GroundTypeTag[Int]]) + println(implicitly[GroundTypeTag[Long]] eq GroundTypeTag.Long) + println(implicitly[GroundTypeTag[Long]]) + println(implicitly[GroundTypeTag[Float]] eq GroundTypeTag.Float) + println(implicitly[GroundTypeTag[Float]]) + println(implicitly[GroundTypeTag[Double]] eq GroundTypeTag.Double) + println(implicitly[GroundTypeTag[Double]]) + println(implicitly[GroundTypeTag[Boolean]] eq GroundTypeTag.Boolean) + println(implicitly[GroundTypeTag[Boolean]]) + println(implicitly[GroundTypeTag[Unit]] eq GroundTypeTag.Unit) + println(implicitly[GroundTypeTag[Unit]]) + println(implicitly[GroundTypeTag[Any]] eq GroundTypeTag.Any) + println(implicitly[GroundTypeTag[Any]]) + println(implicitly[GroundTypeTag[Object]] eq GroundTypeTag.Object) + println(implicitly[GroundTypeTag[Object]]) + println(implicitly[GroundTypeTag[AnyVal]] eq GroundTypeTag.AnyVal) + println(implicitly[GroundTypeTag[AnyVal]]) + println(implicitly[GroundTypeTag[AnyRef]] eq GroundTypeTag.AnyRef) + println(implicitly[GroundTypeTag[AnyRef]]) + println(implicitly[GroundTypeTag[Null]] eq GroundTypeTag.Null) + println(implicitly[GroundTypeTag[Null]]) + println(implicitly[GroundTypeTag[Nothing]] eq GroundTypeTag.Nothing) + println(implicitly[GroundTypeTag[Nothing]]) +} \ No newline at end of file diff --git a/test/files/run/macro-abort-fresh.check b/test/files/run/macro-abort-fresh.check new file mode 100644 index 0000000000..28057c2883 --- /dev/null +++ b/test/files/run/macro-abort-fresh.check @@ -0,0 +1,6 @@ +$1$ +qwe1 +qwe2 +reflective compilation has failed: + +blargh diff --git a/test/files/run/macro-abort-fresh.flags b/test/files/run/macro-abort-fresh.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-abort-fresh.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-abort-fresh/Macros_1.scala b/test/files/run/macro-abort-fresh/Macros_1.scala new file mode 100644 index 0000000000..4186c4c4a6 --- /dev/null +++ b/test/files/run/macro-abort-fresh/Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.makro.Context + +object Impls { + def impl(c: Context) = { + import c.mirror._ + println(c.fresh()) + println(c.fresh("qwe")) + println(c.fresh(newTypeName("qwe"))) + c.abort(NoPosition, "blargh") + } +} + +object Macros { + def foo = macro Impls.impl +} \ No newline at end of file diff --git a/test/files/run/macro-abort-fresh/Test_2.scala b/test/files/run/macro-abort-fresh/Test_2.scala new file mode 100644 index 0000000000..f389231ca6 --- /dev/null +++ b/test/files/run/macro-abort-fresh/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Select(Ident("Macros"), newTermName("foo")) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/test/files/run/macro-basic-ma-md-mi.check b/test/files/run/macro-basic-ma-md-mi.check new file mode 100644 index 0000000000..b74e882ae3 --- /dev/null +++ b/test/files/run/macro-basic-ma-md-mi.check @@ -0,0 +1 @@ +31 \ No newline at end of file diff --git a/test/files/run/macro-basic-ma-md-mi.flags b/test/files/run/macro-basic-ma-md-mi.flags new file mode 100644 index 0000000000..06a7b31f11 --- /dev/null +++ b/test/files/run/macro-basic-ma-md-mi.flags @@ -0,0 +1 @@ +-Xmacros diff --git a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala new file mode 100644 index 0000000000..3f23e349d5 --- /dev/null +++ b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala @@ -0,0 +1,21 @@ +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) + } +} diff --git a/test/files/run/macro-basic-ma-md-mi/Macros_2.scala b/test/files/run/macro-basic-ma-md-mi/Macros_2.scala new file mode 100644 index 0000000000..5279043746 --- /dev/null +++ b/test/files/run/macro-basic-ma-md-mi/Macros_2.scala @@ -0,0 +1,10 @@ +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 +} \ No newline at end of file diff --git a/test/files/run/macro-basic-ma-md-mi/Test_3.scala b/test/files/run/macro-basic-ma-md-mi/Test_3.scala new file mode 100644 index 0000000000..e9a10e20c9 --- /dev/null +++ b/test/files/run/macro-basic-ma-md-mi/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/run/macro-basic-ma-mdmi.check b/test/files/run/macro-basic-ma-mdmi.check new file mode 100644 index 0000000000..b74e882ae3 --- /dev/null +++ b/test/files/run/macro-basic-ma-mdmi.check @@ -0,0 +1 @@ +31 \ No newline at end of file diff --git a/test/files/run/macro-basic-ma-mdmi.flags b/test/files/run/macro-basic-ma-mdmi.flags new file mode 100644 index 0000000000..06a7b31f11 --- /dev/null +++ b/test/files/run/macro-basic-ma-mdmi.flags @@ -0,0 +1 @@ +-Xmacros diff --git a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala new file mode 100644 index 0000000000..44bfe861e3 --- /dev/null +++ b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala @@ -0,0 +1,32 @@ +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 +} \ No newline at end of file diff --git a/test/files/run/macro-basic-ma-mdmi/Test_2.scala b/test/files/run/macro-basic-ma-mdmi/Test_2.scala new file mode 100644 index 0000000000..e9a10e20c9 --- /dev/null +++ b/test/files/run/macro-basic-ma-mdmi/Test_2.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/run/macro-basic-mamd-mi.check b/test/files/run/macro-basic-mamd-mi.check new file mode 100644 index 0000000000..b74e882ae3 --- /dev/null +++ b/test/files/run/macro-basic-mamd-mi.check @@ -0,0 +1 @@ +31 \ No newline at end of file diff --git a/test/files/run/macro-basic-mamd-mi.flags b/test/files/run/macro-basic-mamd-mi.flags new file mode 100644 index 0000000000..06a7b31f11 --- /dev/null +++ b/test/files/run/macro-basic-mamd-mi.flags @@ -0,0 +1 @@ +-Xmacros diff --git a/test/files/run/macro-basic-mamd-mi/Impls_1.scala b/test/files/run/macro-basic-mamd-mi/Impls_1.scala new file mode 100644 index 0000000000..eadb63fa8e --- /dev/null +++ b/test/files/run/macro-basic-mamd-mi/Impls_1.scala @@ -0,0 +1,19 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + import c.mirror._ + Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + } + + def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + import c.mirror._ + Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + } + + 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) + } +} diff --git a/test/files/run/macro-basic-mamd-mi/Macros_Test_2.scala b/test/files/run/macro-basic-mamd-mi/Macros_Test_2.scala new file mode 100644 index 0000000000..d3746894f0 --- /dev/null +++ b/test/files/run/macro-basic-mamd-mi/Macros_Test_2.scala @@ -0,0 +1,15 @@ +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/run/macro-basic.check b/test/files/run/macro-basic.check deleted file mode 100644 index d434014897..0000000000 --- a/test/files/run/macro-basic.check +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/files/run/macro-basic.flags b/test/files/run/macro-basic.flags deleted file mode 100644 index 06a7b31f11..0000000000 --- a/test/files/run/macro-basic.flags +++ /dev/null @@ -1 +0,0 @@ --Xmacros diff --git a/test/files/run/macro-basic/Macros_1.scala b/test/files/run/macro-basic/Macros_1.scala deleted file mode 100644 index c2ea183abe..0000000000 --- a/test/files/run/macro-basic/Macros_1.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Macros { - object Shmacros { - def macro foo(x: Int): Int = x - } - def macro bar(x: Int): Int = x -} - -class Macros { - def macro quux(x: Int): Int = x -} \ No newline at end of file diff --git a/test/files/run/macro-basic/Test_2.scala b/test/files/run/macro-basic/Test_2.scala deleted file mode 100644 index e9a10e20c9..0000000000 --- a/test/files/run/macro-basic/Test_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -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/run/macro-bodyexpandstoimpl.check b/test/files/run/macro-bodyexpandstoimpl.check new file mode 100644 index 0000000000..f70d7bba4a --- /dev/null +++ b/test/files/run/macro-bodyexpandstoimpl.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/test/files/run/macro-bodyexpandstoimpl.flags b/test/files/run/macro-bodyexpandstoimpl.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-bodyexpandstoimpl.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala new file mode 100644 index 0000000000..5c5ec2c999 --- /dev/null +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = x + + def refToFoo(dummy: Int) = macro refToFoo_impl + def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = { + import c.mirror._ + val body = Select(Ident(newTermName("Impls")), newTermName("foo")) + Expr[Int](body) + } +} \ No newline at end of file diff --git a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala new file mode 100644 index 0000000000..2934201a16 --- /dev/null +++ b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def foo(x: Int) = macro Impls.refToFoo(42) +} + +object Test extends App { + import Macros._ + println(foo(42)) +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation.check b/test/files/run/macro-declared-in-annotation.check new file mode 100644 index 0000000000..1ea14b4e20 --- /dev/null +++ b/test/files/run/macro-declared-in-annotation.check @@ -0,0 +1 @@ +it works diff --git a/test/files/run/macro-declared-in-annotation.flags b/test/files/run/macro-declared-in-annotation.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-annotation.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-declared-in-annotation/Impls_1.scala new file mode 100644 index 0000000000..a1234a7374 --- /dev/null +++ b/test/files/run/macro-declared-in-annotation/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Literal(Constant("this is deprecated"))) + Expr[String](body) + } +} diff --git a/test/files/run/macro-declared-in-annotation/Macros_2.scala b/test/files/run/macro-declared-in-annotation/Macros_2.scala new file mode 100644 index 0000000000..a565849aa9 --- /dev/null +++ b/test/files/run/macro-declared-in-annotation/Macros_2.scala @@ -0,0 +1,8 @@ +class foo(val bar: String) extends StaticAnnotation + +object Api { + // foo in ann must have a different name + // otherwise, we get bitten by https://issues.scala-lang.org/browse/SI-5544 + @foo({def fooInAnn = macro Impls.foo; fooInAnn}) + def foo = println("it works") +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation/Test_3.scala b/test/files/run/macro-declared-in-annotation/Test_3.scala new file mode 100644 index 0000000000..866487f028 --- /dev/null +++ b/test/files/run/macro-declared-in-annotation/Test_3.scala @@ -0,0 +1,3 @@ +object Test extends App { + Api.foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-anonymous.check b/test/files/run/macro-declared-in-anonymous.check new file mode 100644 index 0000000000..09b8d015a6 --- /dev/null +++ b/test/files/run/macro-declared-in-anonymous.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Test.this.macros) +it works diff --git a/test/files/run/macro-declared-in-anonymous.flags b/test/files/run/macro-declared-in-anonymous.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-anonymous.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-declared-in-anonymous/Impls_1.scala new file mode 100644 index 0000000000..c0827ace31 --- /dev/null +++ b/test/files/run/macro-declared-in-anonymous/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala b/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala new file mode 100644 index 0000000000..8bd8c172c9 --- /dev/null +++ b/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val macros = new { def foo = macro Impls.foo } + macros.foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-block.check b/test/files/run/macro-declared-in-block.check new file mode 100644 index 0000000000..a61fd13087 --- /dev/null +++ b/test/files/run/macro-declared-in-block.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing]() +it works diff --git a/test/files/run/macro-declared-in-block.flags b/test/files/run/macro-declared-in-block.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-block.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-declared-in-block/Impls_1.scala new file mode 100644 index 0000000000..c0827ace31 --- /dev/null +++ b/test/files/run/macro-declared-in-block/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-block/Macros_Test_2.scala b/test/files/run/macro-declared-in-block/Macros_Test_2.scala new file mode 100644 index 0000000000..69088e24bc --- /dev/null +++ b/test/files/run/macro-declared-in-block/Macros_Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + { + def foo = macro Impls.foo + foo + } +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-class.check b/test/files/run/macro-declared-in-class-class.check new file mode 100644 index 0000000000..480c2f906f --- /dev/null +++ b/test/files/run/macro-declared-in-class-class.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](new Test.this.outer.Macros()) +it works diff --git a/test/files/run/macro-declared-in-class-class.flags b/test/files/run/macro-declared-in-class-class.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-class-class.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-class/Impls_1.scala b/test/files/run/macro-declared-in-class-class/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-class-class/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala b/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala new file mode 100644 index 0000000000..871857a97f --- /dev/null +++ b/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala @@ -0,0 +1,10 @@ +class Macros { + class Macros { + def foo = macro Impls.foo + } +} + +object Test extends App { + val outer = new Macros() + new outer.Macros().foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-object.check b/test/files/run/macro-declared-in-class-object.check new file mode 100644 index 0000000000..f7ba5a53cb --- /dev/null +++ b/test/files/run/macro-declared-in-class-object.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Test.this.outer.Macros) +it works diff --git a/test/files/run/macro-declared-in-class-object.flags b/test/files/run/macro-declared-in-class-object.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-class-object.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-object/Impls_1.scala b/test/files/run/macro-declared-in-class-object/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-class-object/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala b/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala new file mode 100644 index 0000000000..994f9fe935 --- /dev/null +++ b/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala @@ -0,0 +1,10 @@ +class Macros { + object Macros { + def foo = macro Impls.foo + } +} + +object Test extends App { + val outer = new Macros() + outer.Macros.foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class.check b/test/files/run/macro-declared-in-class.check new file mode 100644 index 0000000000..946851e4bb --- /dev/null +++ b/test/files/run/macro-declared-in-class.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](new Macros()) +it works diff --git a/test/files/run/macro-declared-in-class.flags b/test/files/run/macro-declared-in-class.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-class.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class/Impls_1.scala b/test/files/run/macro-declared-in-class/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-class/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-class/Macros_Test_2.scala b/test/files/run/macro-declared-in-class/Macros_Test_2.scala new file mode 100644 index 0000000000..1b9d13e775 --- /dev/null +++ b/test/files/run/macro-declared-in-class/Macros_Test_2.scala @@ -0,0 +1,7 @@ +class Macros { + def foo = macro Impls.foo +} + +object Test extends App { + new Macros().foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-default-param.check b/test/files/run/macro-declared-in-default-param.check new file mode 100644 index 0000000000..00052ad018 --- /dev/null +++ b/test/files/run/macro-declared-in-default-param.check @@ -0,0 +1,5 @@ +prefix = Expr[Nothing]() +it works +it works +prefix = Expr[Nothing]() +it works diff --git a/test/files/run/macro-declared-in-default-param.flags b/test/files/run/macro-declared-in-default-param.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-default-param.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-declared-in-default-param/Impls_1.scala new file mode 100644 index 0000000000..e45095812a --- /dev/null +++ b/test/files/run/macro-declared-in-default-param/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Literal(Constant("it works"))) + Expr[String](body) + } +} diff --git a/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala b/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala new file mode 100644 index 0000000000..356029e63e --- /dev/null +++ b/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala @@ -0,0 +1,7 @@ +object Test extends App { + def foo(bar: String = { def foo = macro Impls.foo; foo }) = println(bar) + + foo() + foo("it works") + foo() +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-implicit-class.check b/test/files/run/macro-declared-in-implicit-class.check new file mode 100644 index 0000000000..b3640ceaa7 --- /dev/null +++ b/test/files/run/macro-declared-in-implicit-class.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Macros.foo("2")) +Some(2) diff --git a/test/files/run/macro-declared-in-implicit-class.flags b/test/files/run/macro-declared-in-implicit-class.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-implicit-class.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala new file mode 100644 index 0000000000..8605d4a8be --- /dev/null +++ b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala @@ -0,0 +1,19 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def toOptionOfInt(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, newTermName("x")), newTermName("toInt"))))) + Expr[Option[Int]](body) + } +} + +object Macros { + implicit def foo(x: String): Foo = new Foo(x) + + class Foo(val x: String) { + def toOptionOfInt = macro Impls.toOptionOfInt + } +} diff --git a/test/files/run/macro-declared-in-implicit-class/Test_2.scala b/test/files/run/macro-declared-in-implicit-class/Test_2.scala new file mode 100644 index 0000000000..d0bc9cc38c --- /dev/null +++ b/test/files/run/macro-declared-in-implicit-class/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros._ + println("2".toOptionOfInt) +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-method.check b/test/files/run/macro-declared-in-method.check new file mode 100644 index 0000000000..a61fd13087 --- /dev/null +++ b/test/files/run/macro-declared-in-method.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing]() +it works diff --git a/test/files/run/macro-declared-in-method.flags b/test/files/run/macro-declared-in-method.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-method.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-declared-in-method/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-method/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-method/Macros_Test_2.scala b/test/files/run/macro-declared-in-method/Macros_Test_2.scala new file mode 100644 index 0000000000..ed5c8b7c43 --- /dev/null +++ b/test/files/run/macro-declared-in-method/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Test extends App { + def bar() = { + def foo = macro Impls.foo + foo + } + + bar() +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-class.check b/test/files/run/macro-declared-in-object-class.check new file mode 100644 index 0000000000..480c2f906f --- /dev/null +++ b/test/files/run/macro-declared-in-object-class.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](new Test.this.outer.Macros()) +it works diff --git a/test/files/run/macro-declared-in-object-class.flags b/test/files/run/macro-declared-in-object-class.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-object-class.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-class/Impls_1.scala b/test/files/run/macro-declared-in-object-class/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-object-class/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala b/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala new file mode 100644 index 0000000000..204deed61c --- /dev/null +++ b/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala @@ -0,0 +1,10 @@ +object Macros { + class Macros { + def foo = macro Impls.foo + } +} + +object Test extends App { + val outer = Macros + new outer.Macros().foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-object.check b/test/files/run/macro-declared-in-object-object.check new file mode 100644 index 0000000000..f7ba5a53cb --- /dev/null +++ b/test/files/run/macro-declared-in-object-object.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Test.this.outer.Macros) +it works diff --git a/test/files/run/macro-declared-in-object-object.flags b/test/files/run/macro-declared-in-object-object.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-object-object.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-object/Impls_1.scala b/test/files/run/macro-declared-in-object-object/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-object-object/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala b/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala new file mode 100644 index 0000000000..e261a50f3d --- /dev/null +++ b/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala @@ -0,0 +1,10 @@ +object Macros { + object Macros { + def foo = macro Impls.foo + } +} + +object Test extends App { + val outer = Macros + outer.Macros.foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object.check b/test/files/run/macro-declared-in-object.check new file mode 100644 index 0000000000..05a8cc48ea --- /dev/null +++ b/test/files/run/macro-declared-in-object.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Macros) +it works diff --git a/test/files/run/macro-declared-in-object.flags b/test/files/run/macro-declared-in-object.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-object.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object/Impls_1.scala b/test/files/run/macro-declared-in-object/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-object/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-object/Macros_Test_2.scala b/test/files/run/macro-declared-in-object/Macros_Test_2.scala new file mode 100644 index 0000000000..a5a4862ba0 --- /dev/null +++ b/test/files/run/macro-declared-in-object/Macros_Test_2.scala @@ -0,0 +1,7 @@ +object Macros { + def foo = macro Impls.foo +} + +object Test extends App { + Macros.foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-package-object.check b/test/files/run/macro-declared-in-package-object.check new file mode 100644 index 0000000000..6f797f3c68 --- /dev/null +++ b/test/files/run/macro-declared-in-package-object.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Macros.`package`) +it works diff --git a/test/files/run/macro-declared-in-package-object.flags b/test/files/run/macro-declared-in-package-object.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-package-object.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-package-object/Impls_1.scala b/test/files/run/macro-declared-in-package-object/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-package-object/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala b/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala new file mode 100644 index 0000000000..54a5962e80 --- /dev/null +++ b/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala @@ -0,0 +1,8 @@ +package 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/run/macro-declared-in-refinement.check b/test/files/run/macro-declared-in-refinement.check new file mode 100644 index 0000000000..861cd43b01 --- /dev/null +++ b/test/files/run/macro-declared-in-refinement.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Test.this.macros) +it works diff --git a/test/files/run/macro-declared-in-refinement.flags b/test/files/run/macro-declared-in-refinement.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-refinement.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-refinement/Impls_1.scala b/test/files/run/macro-declared-in-refinement/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-refinement/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala b/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala new file mode 100644 index 0000000000..f746c2da57 --- /dev/null +++ b/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala @@ -0,0 +1,6 @@ +class Base + +object Test extends App { + val macros = new Base { def foo = macro Impls.foo } + macros.foo +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-trait.check b/test/files/run/macro-declared-in-trait.check new file mode 100644 index 0000000000..d5d9e4e457 --- /dev/null +++ b/test/files/run/macro-declared-in-trait.check @@ -0,0 +1,15 @@ +prefix = Expr[Nothing]({ + final class $anon extends Object with Base { + def (): anonymous class $anon = { + $anon.super.(); + () + }; + + }; + new $anon() +}) +it works +prefix = Expr[Nothing](Macros) +it works +prefix = Expr[Nothing](new Macros()) +it works diff --git a/test/files/run/macro-declared-in-trait.flags b/test/files/run/macro-declared-in-trait.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-declared-in-trait.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-declared-in-trait/Impls_1.scala new file mode 100644 index 0000000000..c2e6933582 --- /dev/null +++ b/test/files/run/macro-declared-in-trait/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.{prefix => prefix} + import c.mirror._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-declared-in-trait/Macros_Test_2.scala b/test/files/run/macro-declared-in-trait/Macros_Test_2.scala new file mode 100644 index 0000000000..f75906b636 --- /dev/null +++ b/test/files/run/macro-declared-in-trait/Macros_Test_2.scala @@ -0,0 +1,13 @@ +trait Base { + def foo = macro Impls.foo +} + +object Macros extends Base + +class Macros extends Base + +object Test extends App { + (new Base {}).foo + Macros.foo + new Macros().foo +} \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-a.check b/test/files/run/macro-def-infer-return-type-a.check new file mode 100644 index 0000000000..f70d7bba4a --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-a.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-a.flags b/test/files/run/macro-def-infer-return-type-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-a.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala b/test/files/run/macro-def-infer-return-type-a/Impls_1.scala new file mode 100644 index 0000000000..2346a6106d --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-a/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/run/macro-def-infer-return-type-a/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala new file mode 100644 index 0000000000..60fe9dc1c2 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo(x: Int) = macro Impls.foo + println(foo(42)) +} \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b.check b/test/files/run/macro-def-infer-return-type-b.check new file mode 100644 index 0000000000..f34d257c82 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-b.check @@ -0,0 +1,6 @@ +reflective compilation has failed: + +exception during macro expansion: +java.lang.Error: an implementation is missing + at Impls$.foo(Impls_Macros_1.scala:5) + diff --git a/test/files/run/macro-def-infer-return-type-b.flags b/test/files/run/macro-def-infer-return-type-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-b.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala b/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala new file mode 100644 index 0000000000..8640713846 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T](c: Ctx)(x: c.Expr[T]) = + throw new Error("an implementation is missing") +} + +object Macros { + def foo[T](x: T) = macro Impls.foo[T] +} \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Test_2.scala b/test/files/run/macro-def-infer-return-type-b/Test_2.scala new file mode 100644 index 0000000000..8ff4494750 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-b/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-c.check b/test/files/run/macro-def-infer-return-type-c.check new file mode 100644 index 0000000000..f70d7bba4a --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-c.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-c.flags b/test/files/run/macro-def-infer-return-type-c.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-c.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala b/test/files/run/macro-def-infer-return-type-c/Impls_1.scala new file mode 100644 index 0000000000..f3e53bbea7 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-c/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T](c: Ctx)(x: c.Expr[T]): c.Expr[T] = x +} diff --git a/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala new file mode 100644 index 0000000000..967d16f6de --- /dev/null +++ b/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo[T](x: T) = macro Impls.foo[T] + println(foo(42)) +} \ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-a.check b/test/files/run/macro-def-path-dependent-a.check new file mode 100644 index 0000000000..1ea14b4e20 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-a.check @@ -0,0 +1 @@ +it works diff --git a/test/files/run/macro-def-path-dependent-a.flags b/test/files/run/macro-def-path-dependent-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-a.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala new file mode 100644 index 0000000000..d7167e671c --- /dev/null +++ b/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala @@ -0,0 +1,21 @@ +import scala.reflect.makro.{Context => Ctx} + +trait Exprs { + self: Universe => + + class Expr[T] +} + +trait Reifiers { + self: Universe => + + type Expr[T] + + def reify[T](expr: T) = macro Impls.reify[T] +} + +trait Universe extends Exprs with Reifiers + +object Impls { + def reify[T](cc: Ctx{ type PrefixType = Reifiers })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ??? +} diff --git a/test/files/run/macro-def-path-dependent-a/Test_2.scala b/test/files/run/macro-def-path-dependent-a/Test_2.scala new file mode 100644 index 0000000000..7dffc5107d --- /dev/null +++ b/test/files/run/macro-def-path-dependent-a/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println("it works") +} \ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-b.check b/test/files/run/macro-def-path-dependent-b.check new file mode 100644 index 0000000000..1ea14b4e20 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-b.check @@ -0,0 +1 @@ +it works diff --git a/test/files/run/macro-def-path-dependent-b.flags b/test/files/run/macro-def-path-dependent-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-b.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala new file mode 100644 index 0000000000..44af6949a7 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala @@ -0,0 +1,20 @@ +import scala.reflect.makro.{Context => Ctx} + +trait Exprs { + self: Universe => + + class Expr[T] +} + +trait Reifiers { + self: Universe => + +} + +trait Universe extends Exprs with Reifiers { + def reify[T](expr: T) = macro Impls.reify[T] +} + +object Impls { + def reify[T](cc: Ctx{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ??? +} diff --git a/test/files/run/macro-def-path-dependent-b/Test_2.scala b/test/files/run/macro-def-path-dependent-b/Test_2.scala new file mode 100644 index 0000000000..7dffc5107d --- /dev/null +++ b/test/files/run/macro-def-path-dependent-b/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println("it works") +} \ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-c.check b/test/files/run/macro-def-path-dependent-c.check new file mode 100644 index 0000000000..1ea14b4e20 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-c.check @@ -0,0 +1 @@ +it works diff --git a/test/files/run/macro-def-path-dependent-c.flags b/test/files/run/macro-def-path-dependent-c.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-c.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala new file mode 100644 index 0000000000..305146c48b --- /dev/null +++ b/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala @@ -0,0 +1,20 @@ +import scala.reflect.makro.{Context => Ctx} + +trait Exprs { + self: Universe => + + class Expr[T] +} + +trait Reifiers { + self: Universe => + +} + +trait Universe extends Exprs with Reifiers { + def reify[T](expr: T): Expr[T] = macro Impls.reify[T] +} + +object Impls { + def reify[T](cc: Ctx{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ??? +} diff --git a/test/files/run/macro-def-path-dependent-c/Test_2.scala b/test/files/run/macro-def-path-dependent-c/Test_2.scala new file mode 100644 index 0000000000..7dffc5107d --- /dev/null +++ b/test/files/run/macro-def-path-dependent-c/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println("it works") +} \ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-d.check b/test/files/run/macro-def-path-dependent-d.check new file mode 100644 index 0000000000..1ea14b4e20 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-d.check @@ -0,0 +1 @@ +it works diff --git a/test/files/run/macro-def-path-dependent-d.flags b/test/files/run/macro-def-path-dependent-d.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-def-path-dependent-d.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala new file mode 100644 index 0000000000..32f03e778e --- /dev/null +++ b/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala @@ -0,0 +1,8 @@ +import scala.reflect.makro.Context +import scala.reflect.api.Universe + +object Test { + def materializeTypeTag[T](u: Universe)(e: T) = macro materializeTypeTag_impl[T] + + def materializeTypeTag_impl[T: c.TypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? +} diff --git a/test/files/run/macro-def-path-dependent-d/Test_2.scala b/test/files/run/macro-def-path-dependent-d/Test_2.scala new file mode 100644 index 0000000000..7dffc5107d --- /dev/null +++ b/test/files/run/macro-def-path-dependent-d/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println("it works") +} \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit.check b/test/files/run/macro-expand-implicit-macro-has-implicit.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-has-implicit.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit.flags b/test/files/run/macro-expand-implicit-macro-has-implicit.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-has-implicit.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala new file mode 100644 index 0000000000..39db275e1c --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(x.tree)) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala new file mode 100644 index 0000000000..ffb04dc80b --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + implicit val x = 42 + def foo(implicit x: Int) = macro Impls.foo + foo +} \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit.check b/test/files/run/macro-expand-implicit-macro-is-implicit.check new file mode 100644 index 0000000000..42abf4579b --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-implicit.check @@ -0,0 +1,2 @@ +Some(2) +2 diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit.flags b/test/files/run/macro-expand-implicit-macro-is-implicit.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-implicit.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala new file mode 100644 index 0000000000..0262485994 --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { + import c.mirror._ + val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt")))) + Expr[Option[Int]](body) + } +} diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala new file mode 100644 index 0000000000..81ebd63c5f --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala @@ -0,0 +1,10 @@ +object Macros { + implicit def foo(x: String): Option[Int] = macro Impls.foo +} + +object Test extends App { + import Macros._ + println("2": Option[Int]) + val s: Int = "2" getOrElse 0 + println(s) +} \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-val.check b/test/files/run/macro-expand-implicit-macro-is-val.check new file mode 100644 index 0000000000..78c6baefdd --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-val.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/macro-expand-implicit-macro-is-val.flags b/test/files/run/macro-expand-implicit-macro-is-val.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-val.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala new file mode 100644 index 0000000000..510d8502f6 --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.mirror._ + val body = Literal(Constant(2)) + Expr[Int](body) + } +} diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala new file mode 100644 index 0000000000..b91b1016c9 --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + implicit def foo = macro Impls.foo + def bar(implicit x: Int) = println(x) + bar +} \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-view.check b/test/files/run/macro-expand-implicit-macro-is-view.check new file mode 100644 index 0000000000..78c6baefdd --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-view.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/macro-expand-implicit-macro-is-view.flags b/test/files/run/macro-expand-implicit-macro-is-view.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-view.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala new file mode 100644 index 0000000000..0262485994 --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { + import c.mirror._ + val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt")))) + Expr[Option[Int]](body) + } +} diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala new file mode 100644 index 0000000000..0ff1fb80ca --- /dev/null +++ b/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala @@ -0,0 +1,9 @@ +object Macros { + implicit def foo(x: String): Option[Int] = macro Impls.foo +} + +object Test extends App { + import Macros._ + def bar[T <% Option[Int]](x: T) = println(x) + println("2") +} \ No newline at end of file diff --git a/test/files/run/macro-expand-multiple-arglists.check b/test/files/run/macro-expand-multiple-arglists.check new file mode 100644 index 0000000000..c24b6ae77d --- /dev/null +++ b/test/files/run/macro-expand-multiple-arglists.check @@ -0,0 +1 @@ +38 \ No newline at end of file diff --git a/test/files/run/macro-expand-multiple-arglists.flags b/test/files/run/macro-expand-multiple-arglists.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-multiple-arglists.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala new file mode 100644 index 0000000000..ae1c50eace --- /dev/null +++ b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { + import c.mirror._ + val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala b/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala new file mode 100644 index 0000000000..fa4504b0ea --- /dev/null +++ b/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo(x: Int)(y: Int) = macro Impls.foo + foo(40)(2) +} \ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-generic.check b/test/files/run/macro-expand-nullary-generic.check new file mode 100644 index 0000000000..34a453cd3a --- /dev/null +++ b/test/files/run/macro-expand-nullary-generic.check @@ -0,0 +1,6 @@ +it works GroundTypeTag[Int] +it works GroundTypeTag[Int] +it works GroundTypeTag[Int] +it works GroundTypeTag[Int] +it works GroundTypeTag[Int] +kkthxbai diff --git a/test/files/run/macro-expand-nullary-generic.flags b/test/files/run/macro-expand-nullary-generic.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-nullary-generic.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala new file mode 100644 index 0000000000..10352594f5 --- /dev/null +++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def impl[T: c.TypeTag](c: Ctx) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.TypeTag[T]])))) + Expr[Unit](body) + } + + def fooNullary[T: c.TypeTag](c: Ctx) = impl[T](c) + def fooEmpty[T: c.TypeTag](c: Ctx)() = impl[T](c) + def barNullary[T: c.TypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) + def barEmpty[T: c.TypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) +} diff --git a/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala b/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala new file mode 100644 index 0000000000..2d5cf53c3c --- /dev/null +++ b/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala @@ -0,0 +1,15 @@ +object Macros { + def foo1[T] = macro Impls.fooNullary[T] + def foo2[T]() = macro Impls.fooEmpty[T] + def bar1[T](x: Int) = macro Impls.barNullary[T] + def bar2[T](x: Int)() = macro Impls.barEmpty[T] +} + +object Test extends App { + Macros.foo1[Int] + Macros.foo2[Int] + Macros.foo2[Int]() + Macros.bar1[Int](42) + Macros.bar2[Int](42)() + println("kkthxbai") +} \ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-nongeneric.check b/test/files/run/macro-expand-nullary-nongeneric.check new file mode 100644 index 0000000000..9ab5f3a2bc --- /dev/null +++ b/test/files/run/macro-expand-nullary-nongeneric.check @@ -0,0 +1,6 @@ +it works +it works +it works +it works +it works +kkthxbai diff --git a/test/files/run/macro-expand-nullary-nongeneric.flags b/test/files/run/macro-expand-nullary-nongeneric.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-nullary-nongeneric.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala new file mode 100644 index 0000000000..7dc58abba8 --- /dev/null +++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def impl(c: Ctx) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + Expr[Unit](body) + } + + def fooNullary(c: Ctx) = impl(c) + def fooEmpty(c: Ctx)() = impl(c) + def barNullary(c: Ctx)(x: c.Expr[Int]) = impl(c) + def barEmpty(c: Ctx)(x: c.Expr[Int])() = impl(c) +} diff --git a/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala b/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala new file mode 100644 index 0000000000..1f6d717956 --- /dev/null +++ b/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala @@ -0,0 +1,15 @@ +object Macros { + def foo1 = macro Impls.fooNullary + def foo2() = macro Impls.fooEmpty + def bar1(x: Int) = macro Impls.barNullary + def bar2(x: Int)() = macro Impls.barEmpty +} + +object Test extends App { + Macros.foo1 + Macros.foo2 + Macros.foo2() + Macros.bar1(42) + Macros.bar2(42)() + println("kkthxbai") +} \ No newline at end of file diff --git a/test/files/run/macro-expand-overload.check b/test/files/run/macro-expand-overload.check new file mode 100644 index 0000000000..9d9989d85f --- /dev/null +++ b/test/files/run/macro-expand-overload.check @@ -0,0 +1,6 @@ +(fooObjectString,Expr[Nothing](Macros),42) +(fooObjectInt,Expr[Nothing](Macros),42) +fooObjectBoolean +(fooClassString,Expr[Nothing](new Macros()),42) +(fooClassInt,Expr[Nothing](new Macros()),42) +fooClassBoolean diff --git a/test/files/run/macro-expand-overload.flags b/test/files/run/macro-expand-overload.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-overload.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-overload/Impls_1.scala b/test/files/run/macro-expand-overload/Impls_1.scala new file mode 100644 index 0000000000..1dc4adc20e --- /dev/null +++ b/test/files/run/macro-expand-overload/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 fooObjectString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooObjectString", x) + def fooObjectInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooObjectInt", x) + def fooClassString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooClassString", x) + def fooClassInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooClassInt", x) +} diff --git a/test/files/run/macro-expand-overload/Macros_Test_2.scala b/test/files/run/macro-expand-overload/Macros_Test_2.scala new file mode 100644 index 0000000000..7f61f85184 --- /dev/null +++ b/test/files/run/macro-expand-overload/Macros_Test_2.scala @@ -0,0 +1,20 @@ +object Macros { + def foo(x: String) = macro Impls.fooObjectString + def foo(x: Int) = macro Impls.fooObjectInt + def foo(x: Boolean) = println("fooObjectBoolean") +} + +class Macros { + def foo(x: String) = macro Impls.fooClassString + def foo(x: Int) = macro Impls.fooClassInt + def foo(x: Boolean) = println("fooClassBoolean") +} + +object Test extends App { + Macros.foo("42") + Macros.foo(42) + Macros.foo(true) + new Macros().foo("42") + new Macros().foo(42) + new Macros().foo(true) +} \ No newline at end of file diff --git a/test/files/run/macro-expand-override.check b/test/files/run/macro-expand-override.check new file mode 100644 index 0000000000..486bec7098 --- /dev/null +++ b/test/files/run/macro-expand-override.check @@ -0,0 +1,15 @@ +(fooBString,Expr[Nothing](Test.this.dd),42) +(fooDInt,Expr[Nothing](Test.this.dd),42) +fooBBoolean +(fooBString,Expr[Nothing](Test.this.db),42) +(fooBInt,Expr[Nothing](Test.this.db),42) +fooBBoolean +(fooZString,Expr[Nothing](Test.this.zz),42) +(fooDInt,Expr[Nothing](Test.this.zz),42) +fooZBoolean +(fooBString,Expr[Nothing](Test.this.zd),42) +(fooDInt,Expr[Nothing](Test.this.zd),42) +fooZBoolean +(fooBString,Expr[Nothing](Test.this.zb),42) +(fooBInt,Expr[Nothing](Test.this.zb),42) +fooZBoolean diff --git a/test/files/run/macro-expand-override.flags b/test/files/run/macro-expand-override.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-override.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-override/Impls_1.scala b/test/files/run/macro-expand-override/Impls_1.scala new file mode 100644 index 0000000000..0b127f5a59 --- /dev/null +++ b/test/files/run/macro-expand-override/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/run/macro-expand-override/Macros_Test_2.scala b/test/files/run/macro-expand-override/Macros_Test_2.scala new file mode 100644 index 0000000000..f162773c95 --- /dev/null +++ b/test/files/run/macro-expand-override/Macros_Test_2.scala @@ -0,0 +1,43 @@ +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") => method cannot override a macro + 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") +} + +object Test extends App { + + val dd: D = new D() + dd.foo("42") + dd.foo(42) + dd.foo(true) + + val db: B = new D() + db.foo("42") + db.foo(42) + db.foo(true) + + val zz: Z = new Z() + zz.foo("42") + zz.foo(42) + zz.foo(true) + + val zd: D = new Z() + zd.foo("42") + zd.foo(42) + zd.foo(true) + + val zb: B = new Z() + zb.foo("42") + zb.foo(42) + zb.foo(true) +} \ No newline at end of file diff --git a/test/files/run/macro-expand-recursive.check b/test/files/run/macro-expand-recursive.check new file mode 100644 index 0000000000..1ea14b4e20 --- /dev/null +++ b/test/files/run/macro-expand-recursive.check @@ -0,0 +1 @@ +it works diff --git a/test/files/run/macro-expand-recursive.flags b/test/files/run/macro-expand-recursive.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-recursive.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-recursive/Impls_1.scala b/test/files/run/macro-expand-recursive/Impls_1.scala new file mode 100644 index 0000000000..6eff805989 --- /dev/null +++ b/test/files/run/macro-expand-recursive/Impls_1.scala @@ -0,0 +1,15 @@ +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) + } + + def fooFoo(c: Ctx) = { + import c.mirror._ + val body = Select(Ident(newTermName("Macros")), newTermName("foo")) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-recursive/Macros_Test_2.scala b/test/files/run/macro-expand-recursive/Macros_Test_2.scala new file mode 100644 index 0000000000..6ff691bdb1 --- /dev/null +++ b/test/files/run/macro-expand-recursive/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo = macro Impls.foo + def fooFoo = macro Impls.fooFoo +} + +object Test extends App { + Macros.fooFoo +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-a.check b/test/files/run/macro-expand-tparams-bounds-a.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/macro-expand-tparams-bounds-a.flags b/test/files/run/macro-expand-tparams-bounds-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds-a.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala new file mode 100644 index 0000000000..4cd98c5838 --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala @@ -0,0 +1,8 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U <: String](c: Ctx): c.Expr[Unit] = { + import c.mirror._ + Literal(Constant(())) + } +} diff --git a/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala new file mode 100644 index 0000000000..b498e6f65b --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds-a/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[String] +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-b.check b/test/files/run/macro-expand-tparams-bounds-b.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/macro-expand-tparams-bounds-b.flags b/test/files/run/macro-expand-tparams-bounds-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds-b.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala new file mode 100644 index 0000000000..9103ddb08a --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +class C + +object Impls { + def foo[U <: C](c: Ctx): c.Expr[Unit] = { + import c.mirror._ + Literal(Constant(())) + } +} diff --git a/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala new file mode 100644 index 0000000000..1a261e9f73 --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala @@ -0,0 +1,10 @@ +class D extends C + +object Macros { + def foo[T <: D] = macro Impls.foo[T] +} + +object Test extends App { + import Macros._ + foo[D] +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-explicit.check b/test/files/run/macro-expand-tparams-explicit.check new file mode 100644 index 0000000000..54da026aa8 --- /dev/null +++ b/test/files/run/macro-expand-tparams-explicit.check @@ -0,0 +1 @@ +GroundTypeTag[Int] diff --git a/test/files/run/macro-expand-tparams-explicit.flags b/test/files/run/macro-expand-tparams-explicit.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-explicit.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala new file mode 100644 index 0000000000..957d8331fc --- /dev/null +++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U: c.TypeTag](c: Ctx) = { + import c.mirror._ + val U = implicitly[c.TypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala new file mode 100644 index 0000000000..e72c27881a --- /dev/null +++ b/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo[U] = macro Impls.foo[U] + foo[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check new file mode 100644 index 0000000000..60c021a35b --- /dev/null +++ b/test/files/run/macro-expand-tparams-implicit.check @@ -0,0 +1,2 @@ +GroundTypeTag[Int] +GroundTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-implicit.flags b/test/files/run/macro-expand-tparams-implicit.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-implicit.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala new file mode 100644 index 0000000000..c25d12be60 --- /dev/null +++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { + import c.mirror._ + val U = implicitly[c.TypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala new file mode 100644 index 0000000000..f8c573f509 --- /dev/null +++ b/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + def foo[U](x: U) = macro Impls.foo[U] + foo(42) + foo("42") +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-only-in-impl.flags b/test/files/run/macro-expand-tparams-only-in-impl.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-only-in-impl.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala b/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala new file mode 100644 index 0000000000..4cd98c5838 --- /dev/null +++ b/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala @@ -0,0 +1,8 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U <: String](c: Ctx): c.Expr[Unit] = { + import c.mirror._ + Literal(Constant(())) + } +} diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala new file mode 100644 index 0000000000..218c7aec7f --- /dev/null +++ b/test/files/run/macro-expand-tparams-only-in-impl/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/run/macro-expand-tparams-optional.check b/test/files/run/macro-expand-tparams-optional.check new file mode 100644 index 0000000000..3bacd7a4e0 --- /dev/null +++ b/test/files/run/macro-expand-tparams-optional.check @@ -0,0 +1 @@ +don't know U diff --git a/test/files/run/macro-expand-tparams-optional.flags b/test/files/run/macro-expand-tparams-optional.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-optional.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-optional/Impls_1.scala b/test/files/run/macro-expand-tparams-optional/Impls_1.scala new file mode 100644 index 0000000000..37efb009c4 --- /dev/null +++ b/test/files/run/macro-expand-tparams-optional/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U](c: Ctx) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("don't know U")))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala new file mode 100644 index 0000000000..e72c27881a --- /dev/null +++ b/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo[U] = macro Impls.foo[U] + foo[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check new file mode 100644 index 0000000000..1447c2478f --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-a.check @@ -0,0 +1,4 @@ +GroundTypeTag[Int] +GroundTypeTag[Int] +GroundTypeTag[String] +GroundTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-a.flags b/test/files/run/macro-expand-tparams-prefix-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-a.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala new file mode 100644 index 0000000000..c25d12be60 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { + import c.mirror._ + val U = implicitly[c.TypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala new file mode 100644 index 0000000000..81ccb7ff42 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala @@ -0,0 +1,10 @@ +object Test extends App { + class C[T] { + def foo[U](x: U) = macro Impls.foo[U] + } + + new C[Int]().foo(42) + new C[Boolean]().foo(42) + new C[Int]().foo("42") + new C[String]().foo(true) +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check new file mode 100644 index 0000000000..c7ec594b92 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-b.check @@ -0,0 +1,2 @@ +GroundTypeTag[Boolean] GroundTypeTag[Int] +GroundTypeTag[Boolean] GroundTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-b.flags b/test/files/run/macro-expand-tparams-prefix-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-b.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala new file mode 100644 index 0000000000..8af3ecc9ae --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T: c.TypeTag, U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { + import c.mirror._ + val T = implicitly[c.TypeTag[T]] + val U = implicitly[c.TypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala new file mode 100644 index 0000000000..a4a0acfe8b --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala @@ -0,0 +1,10 @@ +object Test extends App { + class C[T] { + def foo[U](x: U) = macro Impls.foo[T, U] + } + + object D extends C[Boolean] + + D.foo(42) + D.foo("42") +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check new file mode 100644 index 0000000000..fac58e9516 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-c1.check @@ -0,0 +1,3 @@ +GroundTypeTag[Int] +GroundTypeTag[String] +GroundTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c1.flags b/test/files/run/macro-expand-tparams-prefix-c1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-c1.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala new file mode 100644 index 0000000000..bc880fdf77 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + import c.mirror._ + Block(List( + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Literal(Constant(()))) + } +} diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala new file mode 100644 index 0000000000..4fa0c8cb33 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala @@ -0,0 +1,11 @@ +class D[T] { + class C[U] { + def foo[V] = macro Impls.foo[T, U, 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/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check new file mode 100644 index 0000000000..fac58e9516 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-c2.check @@ -0,0 +1,3 @@ +GroundTypeTag[Int] +GroundTypeTag[String] +GroundTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c2.flags b/test/files/run/macro-expand-tparams-prefix-c2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-c2.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala new file mode 100644 index 0000000000..c83e401afb --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + import c.mirror._ + Block(List( + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Literal(Constant(()))) + } +} + +class D[T] { + class C[U] { + def foo[V] = macro Impls.foo[T, U, V] + } +} diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala b/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala new file mode 100644 index 0000000000..e729d4a536 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala @@ -0,0 +1,5 @@ +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/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check new file mode 100644 index 0000000000..f78ddea4f3 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-d1.check @@ -0,0 +1,3 @@ +TypeTag[T] +TypeTag[U] +GroundTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-d1.flags b/test/files/run/macro-expand-tparams-prefix-d1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-d1.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala new file mode 100644 index 0000000000..bc880fdf77 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + import c.mirror._ + Block(List( + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Literal(Constant(()))) + } +} diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala new file mode 100644 index 0000000000..8222a6d1e8 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala @@ -0,0 +1,11 @@ +object Test extends App { + class D[T] { + class C[U] { + def foo[V] = macro Impls.foo[T, U, V] + foo[Boolean] + } + } + + val outer1 = new D[Int] + new outer1.C[String] +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check new file mode 100644 index 0000000000..fd1d654cf8 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check @@ -0,0 +1,4 @@ +reflective compilation has failed: + +no `: _*' annotation allowed here +(such annotations are only allowed in arguments to *-parameters) diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.flags b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala new file mode 100644 index 0000000000..d97f0af786 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(xs: c.Expr[Int]*) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala new file mode 100644 index 0000000000..523c6b0645 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala @@ -0,0 +1,10 @@ +object Macros { + def foo(xs: Int*) = macro Impls.foo +} + +object Test extends App { + import scala.reflect.mirror._ + val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(tpnme.WILDCARD_STAR)))) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.check b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.check new file mode 100644 index 0000000000..835137b4a2 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.check @@ -0,0 +1 @@ +List(1, 2, 3, 4, 5) diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.flags b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala new file mode 100644 index 0000000000..f9667d78b8 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(xs: c.Expr[Int]*) = { + import c.mirror._ + val stripped_xs = xs map (_.tree) toList match { + case List(Typed(stripped, Ident(wildstar))) if wildstar == tpnme.WILDCARD_STAR => List(stripped) + case _ => ??? + } + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), stripped_xs) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala new file mode 100644 index 0000000000..f127ebcde7 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(xs: Int*) = macro Impls.foo +} + +object Test extends App { + val numbers = List(1, 2, 3, 4, 5) + Macros.foo(numbers: _*) +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs.check b/test/files/run/macro-expand-varargs-explicit-over-varargs.check new file mode 100644 index 0000000000..835137b4a2 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs.check @@ -0,0 +1 @@ +List(1, 2, 3, 4, 5) diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs.flags b/test/files/run/macro-expand-varargs-explicit-over-varargs.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala new file mode 100644 index 0000000000..8c609daa0e --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def myprintln(xs: Int*) = { + println(xs) + } + + def foo(c: Ctx)(xs: c.Expr[Int]*) = { + import c.mirror._ + val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala new file mode 100644 index 0000000000..f127ebcde7 --- /dev/null +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(xs: Int*) = macro Impls.foo +} + +object Test extends App { + val numbers = List(1, 2, 3, 4, 5) + Macros.foo(numbers: _*) +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.check b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.check new file mode 100644 index 0000000000..0a6596858c --- /dev/null +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.check @@ -0,0 +1 @@ +(1,2,3,4,5) diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.flags b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala new file mode 100644 index 0000000000..d97f0af786 --- /dev/null +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(xs: c.Expr[Int]*) = { + import c.mirror._ + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala new file mode 100644 index 0000000000..2311ca0b95 --- /dev/null +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala @@ -0,0 +1,7 @@ +object Macros { + def foo(xs: Int*) = macro Impls.foo +} + +object Test extends App { + Macros.foo(1, 2, 3, 4, 5) +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs.check b/test/files/run/macro-expand-varargs-implicit-over-varargs.check new file mode 100644 index 0000000000..f25fa141d3 --- /dev/null +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs.check @@ -0,0 +1 @@ +WrappedArray(1, 2, 3, 4, 5) diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs.flags b/test/files/run/macro-expand-varargs-implicit-over-varargs.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala new file mode 100644 index 0000000000..8c609daa0e --- /dev/null +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def myprintln(xs: Int*) = { + println(xs) + } + + def foo(c: Ctx)(xs: c.Expr[Int]*) = { + import c.mirror._ + val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList) + Expr[Unit](body) + } +} diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala new file mode 100644 index 0000000000..2311ca0b95 --- /dev/null +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala @@ -0,0 +1,7 @@ +object Macros { + def foo(xs: Int*) = macro Impls.foo +} + +object Test extends App { + Macros.foo(1, 2, 3, 4, 5) +} \ No newline at end of file diff --git a/test/files/run/macro-impl-default-params.check b/test/files/run/macro-impl-default-params.check new file mode 100644 index 0000000000..eaf94458e6 --- /dev/null +++ b/test/files/run/macro-impl-default-params.check @@ -0,0 +1,5 @@ +foo_targs: +invoking foo_targs... +type of prefix is: Nothing +type of prefix tree is: Macros[Int] +U is: String diff --git a/test/files/run/macro-impl-default-params.flags b/test/files/run/macro-impl-default-params.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-impl-default-params.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala new file mode 100644 index 0000000000..cece1c09e4 --- /dev/null +++ b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala @@ -0,0 +1,20 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo_targs[T, U: c.TypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = { + import c.{prefix => prefix} + import c.mirror._ + val U = implicitly[c.TypeTag[U]] + 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("type of prefix tree is: " + prefix.tree.tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + 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/run/macro-impl-default-params/Test_2.scala b/test/files/run/macro-impl-default-params/Test_2.scala new file mode 100644 index 0000000000..90e850df21 --- /dev/null +++ b/test/files/run/macro-impl-default-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/run/macro-impl-rename-context.check b/test/files/run/macro-impl-rename-context.check new file mode 100644 index 0000000000..753edcd970 --- /dev/null +++ b/test/files/run/macro-impl-rename-context.check @@ -0,0 +1,2 @@ +foo +invoking foo... diff --git a/test/files/run/macro-impl-rename-context.flags b/test/files/run/macro-impl-rename-context.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-impl-rename-context.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala new file mode 100644 index 0000000000..000e351f4d --- /dev/null +++ b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = { + import unconventionalName.mirror._ + val body = Block( + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo...")))), + Literal(Constant(()))) + Expr[Unit](body) + } +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/test/files/run/macro-impl-rename-context/Test_2.scala b/test/files/run/macro-impl-rename-context/Test_2.scala new file mode 100644 index 0000000000..bd9c493544 --- /dev/null +++ b/test/files/run/macro-impl-rename-context/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println("foo") + Macros.foo(42) +} \ No newline at end of file diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check new file mode 100644 index 0000000000..e21e05157a --- /dev/null +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check @@ -0,0 +1,5 @@ +reflective compilation has failed: + +type mismatch; + found : String("42") + required: Int diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.flags b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala new file mode 100644 index 0000000000..882867fcab --- /dev/null +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx): c.Expr[Int] = { + import c.mirror._ + Literal(Constant("42")) + } +} + +object Macros { + def foo: Int = macro Impls.foo +} \ No newline at end of file diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala new file mode 100644 index 0000000000..f389231ca6 --- /dev/null +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Select(Ident("Macros"), newTermName("foo")) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-impl-rettype.check b/test/files/run/macro-invalidret-doesnt-conform-to-impl-rettype.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-impl-rettype.flags b/test/files/run/macro-invalidret-doesnt-conform-to-impl-rettype.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-invalidret-doesnt-conform-to-impl-rettype.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-invalidret-nontypeable.check b/test/files/run/macro-invalidret-nontypeable.check new file mode 100644 index 0000000000..eee08528e2 --- /dev/null +++ b/test/files/run/macro-invalidret-nontypeable.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +not found: value IDoNotExist diff --git a/test/files/run/macro-invalidret-nontypeable.flags b/test/files/run/macro-invalidret-nontypeable.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-invalidret-nontypeable.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala new file mode 100644 index 0000000000..f3a0476a35 --- /dev/null +++ b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx) = { + import c.mirror._ + val body = Ident("IDoNotExist") + Expr[Int](body) + } +} + +object Macros { + def foo = macro Impls.foo +} diff --git a/test/files/run/macro-invalidret-nontypeable/Test_2.scala b/test/files/run/macro-invalidret-nontypeable/Test_2.scala new file mode 100644 index 0000000000..f389231ca6 --- /dev/null +++ b/test/files/run/macro-invalidret-nontypeable/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Select(Ident("Macros"), newTermName("foo")) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/test/files/run/macro-invalidusage-badret.check b/test/files/run/macro-invalidusage-badret.check new file mode 100644 index 0000000000..5bdc484644 --- /dev/null +++ b/test/files/run/macro-invalidusage-badret.check @@ -0,0 +1,5 @@ +reflective compilation has failed: + +type mismatch; + found : Int(42) + required: String diff --git a/test/files/run/macro-invalidusage-badret.flags b/test/files/run/macro-invalidusage-badret.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-invalidusage-badret.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala new file mode 100644 index 0000000000..c63ad01677 --- /dev/null +++ b/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = x +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/test/files/run/macro-invalidusage-badret/Test_2.scala b/test/files/run/macro-invalidusage-badret/Test_2.scala new file mode 100644 index 0000000000..e171c9d05a --- /dev/null +++ b/test/files/run/macro-invalidusage-badret/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Typed(Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))), Ident(newTypeName("String"))) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/test/files/run/macro-invalidusage-partialapplication.check b/test/files/run/macro-invalidusage-partialapplication.check new file mode 100644 index 0000000000..73f57b0b81 --- /dev/null +++ b/test/files/run/macro-invalidusage-partialapplication.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +macros cannot be partially applied diff --git a/test/files/run/macro-invalidusage-partialapplication.flags b/test/files/run/macro-invalidusage-partialapplication.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-invalidusage-partialapplication.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala new file mode 100644 index 0000000000..449b91d074 --- /dev/null +++ b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { + import c.mirror._ + val sum = Apply(Select(x.tree, newTermName("$plus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) + Expr[Unit](body) + } +} + +object Macros { + def foo(x: Int)(y: Int) = macro Impls.foo +} \ No newline at end of file diff --git a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala new file mode 100644 index 0000000000..63371a4a82 --- /dev/null +++ b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(40)))) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/test/files/run/macro-openmacros.check b/test/files/run/macro-openmacros.check new file mode 100644 index 0000000000..a4b06a1e1a --- /dev/null +++ b/test/files/run/macro-openmacros.check @@ -0,0 +1,3 @@ +List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0)) +List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +1), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0)) +List(MacroContext(foo@source-Test_2.scala,line-2,offset=35 +2), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +1), MacroContext(foo@source-Test_2.scala,line-2,offset=35 +0)) diff --git a/test/files/run/macro-openmacros.flags b/test/files/run/macro-openmacros.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-openmacros.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala new file mode 100644 index 0000000000..9fd658656e --- /dev/null +++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala @@ -0,0 +1,26 @@ +import scala.reflect.makro.Context + +object Macros { + def impl(c: Context): c.Expr[Unit] = { + // we're macros, so we can reflect against our source path + // so we don't need any partests to clean up after us! + val c.CompilationUnit(file, _, _) = c.enclosingUnit + val dir = file.getParentFile + def normalizePaths(s: String) = { + val base = (dir.getCanonicalPath + java.io.File.separator).replace('\\', '/') + var regex = """\Q%s\E""" format base + val isWin = System.getProperty("os.name", "") startsWith "Windows" + if (isWin) regex = "(?i)" + regex + s.replace('\\', '/').replaceAll(regex, "") + } + + import c.mirror._ + val next = if (c.enclosingMacros.length < 3) Expr[Unit](Select(Ident(staticModule("Macros")), newTermName("foo"))) else c.literalUnit + c.reify { + println(c.literal(normalizePaths(c.enclosingMacros.toString)).eval) + next.eval + } + } + + def foo = macro impl +} \ No newline at end of file diff --git a/test/files/run/macro-openmacros/Test_2.scala b/test/files/run/macro-openmacros/Test_2.scala new file mode 100644 index 0000000000..5d19639cdd --- /dev/null +++ b/test/files/run/macro-openmacros/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + Macros.foo +} diff --git a/test/files/run/macro-quasiinvalidbody-c.check b/test/files/run/macro-quasiinvalidbody-c.check new file mode 100644 index 0000000000..f70d7bba4a --- /dev/null +++ b/test/files/run/macro-quasiinvalidbody-c.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/test/files/run/macro-quasiinvalidbody-c.flags b/test/files/run/macro-quasiinvalidbody-c.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-quasiinvalidbody-c.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala b/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala new file mode 100644 index 0000000000..7cb810c86b --- /dev/null +++ b/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = x + } + + def foo(x: Any) = macro Impls.foo +} \ No newline at end of file diff --git a/test/files/run/macro-quasiinvalidbody-c/Test_2.scala b/test/files/run/macro-quasiinvalidbody-c/Test_2.scala new file mode 100644 index 0000000000..dec29aa857 --- /dev/null +++ b/test/files/run/macro-quasiinvalidbody-c/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros._ + println(foo(42)) +} \ No newline at end of file diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala new file mode 100644 index 0000000000..bd46e1f529 --- /dev/null +++ b/test/files/run/macro-range/Common_1.scala @@ -0,0 +1,48 @@ +import reflect.api.Modifier +import reflect.makro.Context + +abstract class RangeDefault { + val from, to: Int + def foreach(f: Int => Unit) = { + var i = from + while (i < to) { f(i); i += 1 } + } +} + +/** This class should go into reflect.macro once it is a bit more stable. */ +abstract class Utils { + val context: Context + import context.mirror._ + + class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { + override def transform(tree: Tree): Tree = tree match { + case Ident(_) => + def subst(from: List[Symbol], to: List[Tree]): Tree = + if (from.isEmpty) tree + else if (tree.symbol == from.head) to.head.duplicate // TODO: does it ever make sense *not* to perform a shallowDuplicate on `to.head`? + else subst(from.tail, to.tail); + subst(from, to) + case _ => + val tree1 = super.transform(tree) + if (tree1 ne tree) tree1.tpe = null + tree1 + } + } + def makeApply(fn: Tree, args: List[Tree]): Tree = fn match { + case Function(vparams, body) => + new TreeSubstituter(vparams map (_.symbol), args) transform body + case Block(stats, expr) => + Block(stats, makeApply(expr, args)) + case _ => + // todo. read the compiler config and print if -Ydebug is set + //println("no beta on "+fn+" "+fn.getClass) + Apply(fn, args) + } + def makeWhile(lname: TermName, cond: Tree, body: Tree): Tree = { + val continu = Apply(Ident(lname), Nil) + val rhs = If(cond, Block(List(body), continu), Literal(Constant())) + LabelDef(lname, Nil, rhs) + } + def makeBinop(left: Tree, op: String, right: Tree): Tree = + Apply(Select(left, newTermName(op)), List(right)) +} diff --git a/test/files/run/macro-range/Expansion_Impossible_2.scala b/test/files/run/macro-range/Expansion_Impossible_2.scala new file mode 100644 index 0000000000..7a093b74ee --- /dev/null +++ b/test/files/run/macro-range/Expansion_Impossible_2.scala @@ -0,0 +1,53 @@ +import reflect.api.Modifier +import reflect.makro.Context + +object Impls { + def foreach(c: Context)(f: c.Expr[Int => Unit]): c.Expr[Unit] = { + // todo. read the compiler config and print if -Ydebug is set + //println("macro-expand, _this = "+ _this) + object utils extends Utils { val context: c.type = c } + import utils._ + import c.mirror._ + + val initName = newTermName("") + // Either: + // scala"{ var i = $low; val h = $hi; while (i < h) { $f(i); i = i + 1 } } + // or: + // scala"($_this: RangeDefault).foreach($f)" + c.prefix.tree match { + case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" => + val iname = newTermName("$i") + val hname = newTermName("$h") + def iref = Ident(iname) + def href = Ident(hname) + val labelname = newTermName("$while") + val cond = makeBinop(iref, "$less", href) + val body = Block( + List(makeApply(f, List(iref))), + Assign(iref, makeBinop(iref, "$plus", Literal(Constant(1))))) + val generated = + Block( + List( + ValDef(Modifiers(Set(Modifier.mutable)), iname, TypeTree(), lo), + ValDef(Modifiers(), hname, TypeTree(), hi)), + makeWhile(labelname, cond, body)) + // todo. read the compiler config and print if -Ydebug is set + //tools.nsc.util.trace("generated: ")(generated) + generated + case _ => + Apply( + Select( + Typed(c.prefix, Ident(newTypeName("RangeDefault"))), + newTermName("foreach")), + List(f)) + } + } +} + +class Range(val from: Int, val to: Int) extends RangeDefault { + override def foreach(f: Int => Unit): Unit = macro Impls.foreach +} + +object Test extends App { + new Range(1, 10) foreach println +} \ No newline at end of file diff --git a/test/files/run/macro-range/Expansion_Possible_3.scala b/test/files/run/macro-range/Expansion_Possible_3.scala new file mode 100644 index 0000000000..e7ecbcc362 --- /dev/null +++ b/test/files/run/macro-range/Expansion_Possible_3.scala @@ -0,0 +1,7 @@ +class Range(val from: Int, val to: Int) extends RangeDefault { + override def foreach(f: Int => Unit): Unit = macro Impls.foreach +} + +object Test extends App { + new Range(1, 10) foreach println +} \ No newline at end of file diff --git a/test/files/run/macro-range/macro_range_1.scala b/test/files/run/macro-range/macro_range_1.scala deleted file mode 100644 index fdfe7169ad..0000000000 --- a/test/files/run/macro-range/macro_range_1.scala +++ /dev/null @@ -1,99 +0,0 @@ -import reflect.api.Modifier -import reflect.macro.Context - -abstract class RangeDefault { - val from, to: Int - def foreach(f: Int => Unit) = { - var i = from - while (i < to) { f(i); i += 1 } - } -} - -/** This class should go into reflect.macro once it is a bit more stable. */ -abstract class Utils { - val context: Context - import context._ - - class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { - override def transform(tree: Tree): Tree = tree match { - case Ident(_) => - def subst(from: List[Symbol], to: List[Tree]): Tree = - if (from.isEmpty) tree - else if (tree.symbol == from.head) to.head.duplicate // TODO: does it ever make sense *not* to perform a shallowDuplicate on `to.head`? - else subst(from.tail, to.tail); - subst(from, to) - case _ => - val tree1 = super.transform(tree) - if (tree1 ne tree) tree1.tpe = null - tree1 - } - } - def makeApply(fn: Tree, args: List[Tree]): Tree = fn match { - case Function(vparams, body) => - new TreeSubstituter(vparams map (_.symbol), args) transform body - case Block(stats, expr) => - Block(stats, makeApply(expr, args)) - case _ => - // todo. read the compiler config and print if -Ydebug is set - //println("no beta on "+fn+" "+fn.getClass) - Apply(fn, args) - } - def makeWhile(lname: TermName, cond: Tree, body: Tree): Tree = { - val continu = Apply(Ident(lname), Nil) - val rhs = If(cond, Block(List(body), continu), Literal(Constant())) - LabelDef(lname, Nil, rhs) - } - def makeBinop(left: Tree, op: String, right: Tree): Tree = - Apply(Select(left, newTermName(op)), List(right)) -} - -class Range(val from: Int, val to: Int) extends RangeDefault { - override def macro foreach(f: Int => Unit): Unit = { - // todo. read the compiler config and print if -Ydebug is set - //println("macro-expand, _this = "+ _this) - import _context._ - object utils extends Utils { - val context: _context.type = _context - } - import utils._ - - val initName = newTermName("") - // Either: - // scala"{ var i = $low; val h = $hi; while (i < h) { $f(i); i = i + 1 } } - // or: - // scala"($_this: RangeDefault).foreach($f)" - _this match { - case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" => - val iname = newTermName("$i") - val hname = newTermName("$h") - def iref = Ident(iname) - def href = Ident(hname) - val labelname = newTermName("$while") - val cond = makeBinop(iref, "$less", href) - val body = Block( - List(makeApply(f, List(iref))), - Assign(iref, makeBinop(iref, "$plus", Literal(Constant(1))))) - val generated = - Block( - List( - ValDef(Modifiers(Set(Modifier.mutable)), iname, TypeTree(), lo), - ValDef(Modifiers(), hname, TypeTree(), hi)), - makeWhile(labelname, cond, body)) - // todo. read the compiler config and print if -Ydebug is set - //tools.nsc.util.trace("generated: ")(generated) - generated - case _ => - Apply( - Select( - Typed(_this, Ident(newTypeName("RangeDefault"))), - newTermName("foreach")), - List(f)) - } - } -} - -object Test extends App { - - new Range(1, 10) foreach println - -} diff --git a/test/files/run/macro-range/macro_range_2.scala b/test/files/run/macro-range/macro_range_2.scala deleted file mode 100644 index fdfe7169ad..0000000000 --- a/test/files/run/macro-range/macro_range_2.scala +++ /dev/null @@ -1,99 +0,0 @@ -import reflect.api.Modifier -import reflect.macro.Context - -abstract class RangeDefault { - val from, to: Int - def foreach(f: Int => Unit) = { - var i = from - while (i < to) { f(i); i += 1 } - } -} - -/** This class should go into reflect.macro once it is a bit more stable. */ -abstract class Utils { - val context: Context - import context._ - - class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { - override def transform(tree: Tree): Tree = tree match { - case Ident(_) => - def subst(from: List[Symbol], to: List[Tree]): Tree = - if (from.isEmpty) tree - else if (tree.symbol == from.head) to.head.duplicate // TODO: does it ever make sense *not* to perform a shallowDuplicate on `to.head`? - else subst(from.tail, to.tail); - subst(from, to) - case _ => - val tree1 = super.transform(tree) - if (tree1 ne tree) tree1.tpe = null - tree1 - } - } - def makeApply(fn: Tree, args: List[Tree]): Tree = fn match { - case Function(vparams, body) => - new TreeSubstituter(vparams map (_.symbol), args) transform body - case Block(stats, expr) => - Block(stats, makeApply(expr, args)) - case _ => - // todo. read the compiler config and print if -Ydebug is set - //println("no beta on "+fn+" "+fn.getClass) - Apply(fn, args) - } - def makeWhile(lname: TermName, cond: Tree, body: Tree): Tree = { - val continu = Apply(Ident(lname), Nil) - val rhs = If(cond, Block(List(body), continu), Literal(Constant())) - LabelDef(lname, Nil, rhs) - } - def makeBinop(left: Tree, op: String, right: Tree): Tree = - Apply(Select(left, newTermName(op)), List(right)) -} - -class Range(val from: Int, val to: Int) extends RangeDefault { - override def macro foreach(f: Int => Unit): Unit = { - // todo. read the compiler config and print if -Ydebug is set - //println("macro-expand, _this = "+ _this) - import _context._ - object utils extends Utils { - val context: _context.type = _context - } - import utils._ - - val initName = newTermName("") - // Either: - // scala"{ var i = $low; val h = $hi; while (i < h) { $f(i); i = i + 1 } } - // or: - // scala"($_this: RangeDefault).foreach($f)" - _this match { - case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" => - val iname = newTermName("$i") - val hname = newTermName("$h") - def iref = Ident(iname) - def href = Ident(hname) - val labelname = newTermName("$while") - val cond = makeBinop(iref, "$less", href) - val body = Block( - List(makeApply(f, List(iref))), - Assign(iref, makeBinop(iref, "$plus", Literal(Constant(1))))) - val generated = - Block( - List( - ValDef(Modifiers(Set(Modifier.mutable)), iname, TypeTree(), lo), - ValDef(Modifiers(), hname, TypeTree(), hi)), - makeWhile(labelname, cond, body)) - // todo. read the compiler config and print if -Ydebug is set - //tools.nsc.util.trace("generated: ")(generated) - generated - case _ => - Apply( - Select( - Typed(_this, Ident(newTypeName("RangeDefault"))), - newTermName("foreach")), - List(f)) - } - } -} - -object Test extends App { - - new Range(1, 10) foreach println - -} diff --git a/test/files/run/macro-reflective-ma-normal-mdmi.check b/test/files/run/macro-reflective-ma-normal-mdmi.check new file mode 100644 index 0000000000..ac4213d6e9 --- /dev/null +++ b/test/files/run/macro-reflective-ma-normal-mdmi.check @@ -0,0 +1 @@ +43 \ No newline at end of file diff --git a/test/files/run/macro-reflective-ma-normal-mdmi.flags b/test/files/run/macro-reflective-ma-normal-mdmi.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reflective-ma-normal-mdmi.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala new file mode 100644 index 0000000000..f6caf89dca --- /dev/null +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + Expr[Int](body) + } +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} \ No newline at end of file diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala new file mode 100644 index 0000000000..3c594aed75 --- /dev/null +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) + println(tree.eval) +} diff --git a/test/files/run/macro-reflective-mamd-normal-mi.check b/test/files/run/macro-reflective-mamd-normal-mi.check new file mode 100644 index 0000000000..ac4213d6e9 --- /dev/null +++ b/test/files/run/macro-reflective-mamd-normal-mi.check @@ -0,0 +1 @@ +43 \ No newline at end of file diff --git a/test/files/run/macro-reflective-mamd-normal-mi.flags b/test/files/run/macro-reflective-mamd-normal-mi.flags new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala new file mode 100644 index 0000000000..dc7d42d23e --- /dev/null +++ b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + Expr[Int](body) + } +} diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala new file mode 100644 index 0000000000..7cbe425fc8 --- /dev/null +++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala @@ -0,0 +1,16 @@ +//object Macros { +// def foo(x: Int) = macro Impls.foo +//} + +object Test extends App { + import scala.reflect.mirror._ + + val macrobody = Select(Ident(newTermName("Impls")), newTermName("foo")) + val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.asType), EmptyTree) + val macrodef = DefDef(Modifiers(Set(scala.reflect.api.Modifier.`macro`)), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) + val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(EmptyTypeName), EmptyTypeName), nme.CONSTRUCTOR), List()))) + val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef))) + val macroapp = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) + val tree = Block(macrodef, module, macroapp) + println(tree.eval) +} diff --git a/test/files/run/macro-reify-basic.check b/test/files/run/macro-reify-basic.check new file mode 100644 index 0000000000..f35d3e67b4 --- /dev/null +++ b/test/files/run/macro-reify-basic.check @@ -0,0 +1 @@ +hello world diff --git a/test/files/run/macro-reify-basic.flags b/test/files/run/macro-reify-basic.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-basic.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-basic/Macros_1.scala b/test/files/run/macro-reify-basic/Macros_1.scala new file mode 100644 index 0000000000..b2243d131c --- /dev/null +++ b/test/files/run/macro-reify-basic/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def foo(s: String) = macro Impls.foo + + object Impls { + def foo(c: Ctx)(s: c.Expr[String]) = c.reify { + println("hello " + s.eval) + } + } +} \ No newline at end of file diff --git a/test/files/run/macro-reify-basic/Test_2.scala b/test/files/run/macro-reify-basic/Test_2.scala new file mode 100644 index 0000000000..0a762f7ad7 --- /dev/null +++ b/test/files/run/macro-reify-basic/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + Macros.foo("world") +} \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-eval.check b/test/files/run/macro-reify-eval-eval.check new file mode 100644 index 0000000000..f35d3e67b4 --- /dev/null +++ b/test/files/run/macro-reify-eval-eval.check @@ -0,0 +1 @@ +hello world diff --git a/test/files/run/macro-reify-eval-eval.flags b/test/files/run/macro-reify-eval-eval.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-eval-eval.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-eval/Macros_1.scala b/test/files/run/macro-reify-eval-eval/Macros_1.scala new file mode 100644 index 0000000000..6b8ac94f0e --- /dev/null +++ b/test/files/run/macro-reify-eval-eval/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.makro.{Context => Ctx} +import scala.reflect.{mirror => mr} + +object Macros { + def foo = macro Impls.foo + + object Impls { + def foo(c: Ctx) = c.reify { + { c.reify(c.reify("hello world")) }.eval.eval + } + } +} \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-eval/Test_2.scala b/test/files/run/macro-reify-eval-eval/Test_2.scala new file mode 100644 index 0000000000..f697da6020 --- /dev/null +++ b/test/files/run/macro-reify-eval-eval/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println(Macros.foo) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-outside-reify.check b/test/files/run/macro-reify-eval-outside-reify.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/macro-reify-eval-outside-reify.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/macro-reify-eval-outside-reify.flags b/test/files/run/macro-reify-eval-outside-reify.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-eval-outside-reify.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala new file mode 100644 index 0000000000..13b603d610 --- /dev/null +++ b/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = c.literal(x.eval) +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/test/files/run/macro-reify-eval-outside-reify/Test_2.scala b/test/files/run/macro-reify-eval-outside-reify/Test_2.scala new file mode 100644 index 0000000000..3c594aed75 --- /dev/null +++ b/test/files/run/macro-reify-eval-outside-reify/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) + println(tree.eval) +} diff --git a/test/files/run/macro-reify-freevars.check b/test/files/run/macro-reify-freevars.check new file mode 100644 index 0000000000..02a6a7436b --- /dev/null +++ b/test/files/run/macro-reify-freevars.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +macro expansion contains free term variable code defined by map in Macros_1.scala:8:9. have you forgot to use eval when splicing this variable into a reifee? if you have troubles tracking free term variables, consider using -Xlog-free-terms diff --git a/test/files/run/macro-reify-freevars.flags b/test/files/run/macro-reify-freevars.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-freevars.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-freevars/Macros_1.scala b/test/files/run/macro-reify-freevars/Macros_1.scala new file mode 100644 index 0000000000..3cc559a0af --- /dev/null +++ b/test/files/run/macro-reify-freevars/Macros_1.scala @@ -0,0 +1,19 @@ +package scala.collection.slick +object QueryableMacros{ + def map[T:c.TypeTag, S:c.TypeTag] + (c: scala.reflect.makro.Context) + (projection: c.mirror.Expr[T => S]) + : c.mirror.Expr[scala.collection.slick.Queryable[S]] = { + import c.mirror._ + val code = EmptyTree + c.reify{ + Queryable.factory[S]( code.asInstanceOf[reflect.mirror.Tree] ) + } + } +} +class Queryable[T]{ + def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] +} +object Queryable{ + def factory[S]( projection:scala.reflect.mirror.Tree ) : Queryable[S] = null +} \ No newline at end of file diff --git a/test/files/run/macro-reify-freevars/Test_2.scala b/test/files/run/macro-reify-freevars/Test_2.scala new file mode 100644 index 0000000000..55c677155a --- /dev/null +++ b/test/files/run/macro-reify-freevars/Test_2.scala @@ -0,0 +1,9 @@ +object Test extends App { + import scala.reflect.mirror._ + val q = New(AppliedTypeTree(Select(Select(Select(Ident("scala"), newTermName("collection")), newTermName("slick")), newTypeName("Queryable")), List(Ident("Int")))) + val x = ValDef(NoMods, newTermName("x"), Ident("Int"), EmptyTree) + val fn = Function(List(x), Apply(Select(Ident(newTermName("x")), newTermName("$plus")), List(Literal(Constant("5"))))) + val tree = Apply(Select(q, newTermName("map")), List(fn)) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/test/files/run/macro-reify-groundtypetag-notypeparams.check b/test/files/run/macro-reify-groundtypetag-notypeparams.check new file mode 100644 index 0000000000..24612cd4b7 --- /dev/null +++ b/test/files/run/macro-reify-groundtypetag-notypeparams.check @@ -0,0 +1,2 @@ +GroundTypeTag[Int] +GroundTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala new file mode 100644 index 0000000000..3aa40251ec --- /dev/null +++ b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala @@ -0,0 +1,6 @@ +import scala.reflect.mirror._ + +object Test extends App { + println(implicitly[GroundTypeTag[Int]]) + println(implicitly[GroundTypeTag[List[Int]]]) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-groundtypetag-typeparams-tags.check b/test/files/run/macro-reify-groundtypetag-typeparams-tags.check new file mode 100644 index 0000000000..24612cd4b7 --- /dev/null +++ b/test/files/run/macro-reify-groundtypetag-typeparams-tags.check @@ -0,0 +1,2 @@ +GroundTypeTag[Int] +GroundTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala new file mode 100644 index 0000000000..21735c10d5 --- /dev/null +++ b/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooTypeTag[T: GroundTypeTag] = { + println(implicitly[GroundTypeTag[T]]) + println(implicitly[GroundTypeTag[List[T]]]) + } + fooTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-reify-nested-a.check b/test/files/run/macro-reify-nested-a.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/macro-reify-nested-a.flags b/test/files/run/macro-reify-nested-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-nested-a.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala new file mode 100644 index 0000000000..1ce8f44671 --- /dev/null +++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala @@ -0,0 +1,43 @@ +import scala.reflect.makro.Context + +case class Utils[C <: Context]( c:C ) { + import c.mirror._ + import c.{Tree=>_} + object removeDoubleReify extends c.mirror.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reified::Nil ) + if termname.toString == "factory" => c.unreifyTree(reified) + case Apply(Select(_this, termname), reified::Nil ) + if termname.toString == "factory" => c.unreifyTree(reified) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.mirror.Expr[_] ) = { + import c.mirror._ + val element_type = implicitly[c.TypeTag[S]].tpe + val foo = Expr[reflect.mirror.Expr[Queryable[S]]]( + c.reifyTree( c.reflectMirrorPrefix, c.typeCheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.reify{ Queryable.factory[S]( foo.eval )} + } + def map[T:c.TypeTag, S:c.TypeTag] + (c: scala.reflect.makro.Context) + (projection: c.mirror.Expr[T => S]): c.mirror.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) +} +class Queryable[T]{ + def _map[S]( projection: T => S ) : Queryable[S] = ??? + def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] +} +object Queryable{ + def factory[S]( projection:scala.reflect.mirror.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file diff --git a/test/files/run/macro-reify-nested-a/Test_2.scala b/test/files/run/macro-reify-nested-a/Test_2.scala new file mode 100644 index 0000000000..fa0eb378af --- /dev/null +++ b/test/files/run/macro-reify-nested-a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App{ + val q : Queryable[Any] = new Queryable[Any] + q.map(e1 => q.map(e2=>e1)) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-nested-b.check b/test/files/run/macro-reify-nested-b.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/macro-reify-nested-b.flags b/test/files/run/macro-reify-nested-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-nested-b.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala new file mode 100644 index 0000000000..1ce8f44671 --- /dev/null +++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala @@ -0,0 +1,43 @@ +import scala.reflect.makro.Context + +case class Utils[C <: Context]( c:C ) { + import c.mirror._ + import c.{Tree=>_} + object removeDoubleReify extends c.mirror.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reified::Nil ) + if termname.toString == "factory" => c.unreifyTree(reified) + case Apply(Select(_this, termname), reified::Nil ) + if termname.toString == "factory" => c.unreifyTree(reified) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.mirror.Expr[_] ) = { + import c.mirror._ + val element_type = implicitly[c.TypeTag[S]].tpe + val foo = Expr[reflect.mirror.Expr[Queryable[S]]]( + c.reifyTree( c.reflectMirrorPrefix, c.typeCheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.reify{ Queryable.factory[S]( foo.eval )} + } + def map[T:c.TypeTag, S:c.TypeTag] + (c: scala.reflect.makro.Context) + (projection: c.mirror.Expr[T => S]): c.mirror.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) +} +class Queryable[T]{ + def _map[S]( projection: T => S ) : Queryable[S] = ??? + def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] +} +object Queryable{ + def factory[S]( projection:scala.reflect.mirror.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file diff --git a/test/files/run/macro-reify-nested-b/Test_2.scala b/test/files/run/macro-reify-nested-b/Test_2.scala new file mode 100644 index 0000000000..fa13f57ffb --- /dev/null +++ b/test/files/run/macro-reify-nested-b/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App{ + val q : Queryable[Any] = new Queryable[Any] + q.map(e1 => q.map(e2=>e1).map(e2=>e1)) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-ref-to-packageless.check b/test/files/run/macro-reify-ref-to-packageless.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/macro-reify-ref-to-packageless.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/macro-reify-ref-to-packageless.flags b/test/files/run/macro-reify-ref-to-packageless.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-ref-to-packageless.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala new file mode 100644 index 0000000000..2f2d05678d --- /dev/null +++ b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + val `Answer to the Ultimate Question of Life, the Universe, and Everything` = 42 + def foo(c: Ctx) = c.reify { `Answer to the Ultimate Question of Life, the Universe, and Everything` } +} diff --git a/test/files/run/macro-reify-ref-to-packageless/Test_2.scala b/test/files/run/macro-reify-ref-to-packageless/Test_2.scala new file mode 100644 index 0000000000..9d475f756d --- /dev/null +++ b/test/files/run/macro-reify-ref-to-packageless/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo = macro Impls.foo + println(foo) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-tagful-a.check b/test/files/run/macro-reify-tagful-a.check new file mode 100644 index 0000000000..8a701df6a5 --- /dev/null +++ b/test/files/run/macro-reify-tagful-a.check @@ -0,0 +1 @@ +List(hello world) diff --git a/test/files/run/macro-reify-tagful-a.flags b/test/files/run/macro-reify-tagful-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-tagful-a.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-tagful-a/Macros_1.scala b/test/files/run/macro-reify-tagful-a/Macros_1.scala new file mode 100644 index 0000000000..2ff12091a1 --- /dev/null +++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def foo[T](s: T) = macro Impls.foo[T] + + object Impls { + def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify { + List(s.eval) + } + } +} \ No newline at end of file diff --git a/test/files/run/macro-reify-tagful-a/Test_2.scala b/test/files/run/macro-reify-tagful-a/Test_2.scala new file mode 100644 index 0000000000..4d27166341 --- /dev/null +++ b/test/files/run/macro-reify-tagful-a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val list: List[String] = Macros.foo("hello world") + println(list) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-tagless-a.check b/test/files/run/macro-reify-tagless-a.check new file mode 100644 index 0000000000..b58cff19bc --- /dev/null +++ b/test/files/run/macro-reify-tagless-a.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. have you forgot to use c.TypeTag annotation for this type parameter? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/macro-reify-tagless-a.flags b/test/files/run/macro-reify-tagless-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-tagless-a.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala new file mode 100644 index 0000000000..45e39d7d1c --- /dev/null +++ b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def foo[T](s: T) = macro Impls.foo[T] + + object Impls { + def foo[T](c: Ctx)(s: c.Expr[T]) = c.reify { + List[T](s.eval) + } + } +} \ No newline at end of file diff --git a/test/files/run/macro-reify-tagless-a/Test_2.scala b/test/files/run/macro-reify-tagless-a/Test_2.scala new file mode 100644 index 0000000000..d996da1570 --- /dev/null +++ b/test/files/run/macro-reify-tagless-a/Test_2.scala @@ -0,0 +1,12 @@ +object Test extends App { + //val list: List[String] = Macros.foo("hello world") + //println(list) + + import scala.reflect.mirror._ + val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass))) + val rhs = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant("hello world")))) + val list = ValDef(NoMods, newTermName("list"), tpt, rhs) + val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name)))) + try tree.eval + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/test/files/run/macro-reify-typetag-notypeparams.check b/test/files/run/macro-reify-typetag-notypeparams.check new file mode 100644 index 0000000000..24612cd4b7 --- /dev/null +++ b/test/files/run/macro-reify-typetag-notypeparams.check @@ -0,0 +1,2 @@ +GroundTypeTag[Int] +GroundTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-notypeparams/Test.scala b/test/files/run/macro-reify-typetag-notypeparams/Test.scala new file mode 100644 index 0000000000..041a44273d --- /dev/null +++ b/test/files/run/macro-reify-typetag-notypeparams/Test.scala @@ -0,0 +1,6 @@ +import scala.reflect.mirror._ + +object Test extends App { + println(implicitly[TypeTag[Int]]) + println(implicitly[TypeTag[List[Int]]]) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-typetag-typeparams-notags.check b/test/files/run/macro-reify-typetag-typeparams-notags.check new file mode 100644 index 0000000000..3da30c71ba --- /dev/null +++ b/test/files/run/macro-reify-typetag-typeparams-notags.check @@ -0,0 +1,2 @@ +GroundTypeTag[T] +GroundTypeTag[List[T]] diff --git a/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala b/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala new file mode 100644 index 0000000000..a89499e7fe --- /dev/null +++ b/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooNoTypeTag[T] = { + println(implicitly[TypeTag[T]]) + println(implicitly[TypeTag[List[T]]]) + } + fooNoTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-reify-typetag-typeparams-tags.check b/test/files/run/macro-reify-typetag-typeparams-tags.check new file mode 100644 index 0000000000..24612cd4b7 --- /dev/null +++ b/test/files/run/macro-reify-typetag-typeparams-tags.check @@ -0,0 +1,2 @@ +GroundTypeTag[Int] +GroundTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala new file mode 100644 index 0000000000..b32680a4b8 --- /dev/null +++ b/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooTypeTag[T: TypeTag] = { + println(implicitly[TypeTag[T]]) + println(implicitly[TypeTag[List[T]]]) + } + fooTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag.check b/test/files/run/macro-reify-typetag-usegroundtypetag.check new file mode 100644 index 0000000000..24612cd4b7 --- /dev/null +++ b/test/files/run/macro-reify-typetag-usegroundtypetag.check @@ -0,0 +1,2 @@ +GroundTypeTag[Int] +GroundTypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala new file mode 100644 index 0000000000..c9b210f35a --- /dev/null +++ b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooTypeTag[T: GroundTypeTag] = { + println(implicitly[TypeTag[T]]) + println(implicitly[TypeTag[List[T]]]) + } + fooTypeTag[Int] +} \ No newline at end of file diff --git a/test/files/run/macro-reify-unreify.check b/test/files/run/macro-reify-unreify.check new file mode 100644 index 0000000000..a5334cc355 --- /dev/null +++ b/test/files/run/macro-reify-unreify.check @@ -0,0 +1 @@ +hello world = Expr[String("hello world")]("hello world") diff --git a/test/files/run/macro-reify-unreify.flags b/test/files/run/macro-reify-unreify.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-unreify.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala new file mode 100644 index 0000000000..1b0b9c6421 --- /dev/null +++ b/test/files/run/macro-reify-unreify/Macros_1.scala @@ -0,0 +1,19 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def foo(s: String) = macro Impls.foo + + object Impls { + def foo(c: Ctx)(s: c.Expr[String]) = { + import c.mirror._ + + val world = c.reifyTree(c.reflectMirrorPrefix, s.tree) + val greeting = c.reifyTree(c.reflectMirrorPrefix, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) + val typedGreeting = Expr[String](greeting) + + c.reify { + println("hello " + s.eval + " = " + typedGreeting.eval) + } + } + } +} \ No newline at end of file diff --git a/test/files/run/macro-reify-unreify/Test_2.scala b/test/files/run/macro-reify-unreify/Test_2.scala new file mode 100644 index 0000000000..0a762f7ad7 --- /dev/null +++ b/test/files/run/macro-reify-unreify/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + Macros.foo("world") +} \ No newline at end of file diff --git a/test/files/run/macro-reify-value-outside-reify.check b/test/files/run/macro-reify-value-outside-reify.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/macro-reify-value-outside-reify.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/macro-reify-value-outside-reify.flags b/test/files/run/macro-reify-value-outside-reify.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-reify-value-outside-reify.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala new file mode 100644 index 0000000000..28ec1ace67 --- /dev/null +++ b/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = c.literal(x.value) +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/test/files/run/macro-reify-value-outside-reify/Test_2.scala b/test/files/run/macro-reify-value-outside-reify/Test_2.scala new file mode 100644 index 0000000000..8225eb0b39 --- /dev/null +++ b/test/files/run/macro-reify-value-outside-reify/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import scala.reflect.mirror._ + val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) + try println(tree.eval) + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index f8f0d3ad29..3bc899f49b 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -3,13 +3,39 @@ Type :help for more information. scala> +scala> import scala.reflect.makro.{Context => Ctx} +import scala.reflect.makro.{Context=>Ctx} + +scala> + +scala> object Impls { + def foo(c: Ctx)(x: 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]) = { + 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]) = { + import c.mirror._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + Expr[Int](body) + } +} +defined module Impls + scala> object Macros { object Shmacros { - def macro foo(x: Int): Int = x + def foo(x: Int): Int = macro Impls.foo } - def macro bar(x: Int): Int = x + def bar(x: Int): Int = macro Impls.bar }; class Macros { - def macro quux(x: Int): Int = x + def quux(x: Int): Int = macro Impls.quux } defined module Macros defined class Macros @@ -20,6 +46,6 @@ scala> import Macros.Shmacros._ import Macros.Shmacros._ scala> println(foo(2) + Macros.bar(2) * new Macros().quux(4)) -10 +31 scala> diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala index 9b1a53343b..a21eb7815f 100644 --- a/test/files/run/macro-repl-basic.scala +++ b/test/files/run/macro-repl-basic.scala @@ -3,13 +3,34 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xmacros" def code = """ + |import scala.reflect.makro.{Context => Ctx} + | + |object Impls { + | def foo(c: Ctx)(x: 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]) = { + | 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]) = { + | import c.mirror._ + | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + | Expr[Int](body) + | } + |} |object Macros { | object Shmacros { - | def macro foo(x: Int): Int = x + | def foo(x: Int): Int = macro Impls.foo | } - | def macro bar(x: Int): Int = x + | def bar(x: Int): Int = macro Impls.bar |}; class Macros { - | def macro quux(x: Int): Int = x + | def quux(x: Int): Int = macro Impls.quux |} | |import Macros.Shmacros._ diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index d2bb89b6f7..35845f0cff 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -3,7 +3,10 @@ Type :help for more information. scala> -scala> def macro foo = ??? +scala> def bar(c: scala.reflect.makro.Context) = ??? +bar: (c: scala.reflect.makro.Context)Nothing + +scala> def foo = macro bar foo: Any scala> diff --git a/test/files/run/macro-repl-dontexpand.scala b/test/files/run/macro-repl-dontexpand.scala index 254bce894c..9889a8ffdf 100644 --- a/test/files/run/macro-repl-dontexpand.scala +++ b/test/files/run/macro-repl-dontexpand.scala @@ -3,6 +3,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xmacros" def code = """ - |def macro foo = ??? + |def bar(c: scala.reflect.makro.Context) = ??? + |def foo = macro bar |""".stripMargin } \ No newline at end of file diff --git a/test/files/run/macro-rettype-mismatch/Macros_1.scala b/test/files/run/macro-rettype-mismatch/Macros_1.scala deleted file mode 100644 index 64e5b93468..0000000000 --- a/test/files/run/macro-rettype-mismatch/Macros_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Macros { - def macro foo(x: Int): String = x -} \ No newline at end of file diff --git a/test/files/run/macro-rettype-mismatch/Test_2.scala b/test/files/run/macro-rettype-mismatch/Test_2.scala deleted file mode 100644 index 39a7c7ad1a..0000000000 --- a/test/files/run/macro-rettype-mismatch/Test_2.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - -object Test extends App { - import scala.reflect.mirror._ - val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(2)))) - - val stderr = new java.io.ByteArrayOutputStream() - Console.setErr(new java.io.PrintStream(stderr)) - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - try { toolbox.runExpr(tree) } - catch { case ex: Throwable => println(stderr); println(ex) } -} diff --git a/test/files/run/macro-settings.check b/test/files/run/macro-settings.check new file mode 100644 index 0000000000..33784d1c15 --- /dev/null +++ b/test/files/run/macro-settings.check @@ -0,0 +1 @@ +List(hello=1) diff --git a/test/files/run/macro-settings.flags b/test/files/run/macro-settings.flags new file mode 100644 index 0000000000..cdc7512197 --- /dev/null +++ b/test/files/run/macro-settings.flags @@ -0,0 +1 @@ +-Xmacros -Xmacro-settings:hello=1 \ No newline at end of file diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala new file mode 100644 index 0000000000..8c7254c79a --- /dev/null +++ b/test/files/run/macro-settings/Impls_Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.Context + +object Impls { + def impl(c: Context) = c.reify { + println(c.literal(c.settings.toString).eval) + } +} + +object Macros { + def foo = macro Impls.impl +} \ No newline at end of file diff --git a/test/files/run/macro-settings/Test_2.scala b/test/files/run/macro-settings/Test_2.scala new file mode 100644 index 0000000000..acfddae942 --- /dev/null +++ b/test/files/run/macro-settings/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + Macros.foo +} \ No newline at end of file diff --git a/test/files/run/macro-sip19-revised.check b/test/files/run/macro-sip19-revised.check new file mode 100644 index 0000000000..aa2fbd11d3 --- /dev/null +++ b/test/files/run/macro-sip19-revised.check @@ -0,0 +1,5 @@ +hey, i've been called from SourceLocation1(null,Test_2.scala,11,251) +hey, i've been called from SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222) +hey, i've been called from SourceLocation1(SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222),Test_2.scala,8,222) +hey, i've been called from SourceLocation1(SourceLocation1(SourceLocation1(SourceLocation1(null,Test_2.scala,11,251),Test_2.scala,8,222),Test_2.scala,8,222),Test_2.scala,6,180) +2 diff --git a/test/files/run/macro-sip19-revised.flags b/test/files/run/macro-sip19-revised.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-sip19-revised.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala new file mode 100644 index 0000000000..e8f6e1df85 --- /dev/null +++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala @@ -0,0 +1,34 @@ +import scala.reflect.makro.Context + +object Macros { + def impl(c: Context) = { + import c.mirror._ + + val inscope = c.inferImplicitValue(staticClass("SourceLocation").asType) + val outer = Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null))) + + val Apply(fun, args) = c.enclosingImplicits(0)._2 + val fileName = fun.pos.fileInfo.getName + val line = fun.pos.line + val charOffset = fun.pos.point + c.reify { SourceLocation1(outer.eval, c.literal(fileName).eval, c.literal(line).eval, c.literal(charOffset).eval) } + } + + 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/run/macro-sip19-revised/Test_2.scala b/test/files/run/macro-sip19-revised/Test_2.scala new file mode 100644 index 0000000000..d9a4d7d4fc --- /dev/null +++ b/test/files/run/macro-sip19-revised/Test_2.scala @@ -0,0 +1,12 @@ +import Macros._ + +object Test extends App { + def foo(x: Int, y: Int)(implicit loc: SourceLocation): Int = { + println("hey, i've been called from %s".format(loc)) + if (x < y) foo(y, x) + else if (y == 0) x + else foo(x - y, y) + } + + println(foo(4, 2)) +} diff --git a/test/files/run/macro-sip19.check b/test/files/run/macro-sip19.check new file mode 100644 index 0000000000..6b317ccb47 --- /dev/null +++ b/test/files/run/macro-sip19.check @@ -0,0 +1,5 @@ +hey, i've been called from SourceLocation(Test_2.scala,15,366) +hey, i've been called from SourceLocation(Test_2.scala,11,331) +hey, i've been called from SourceLocation(Test_2.scala,11,331) +hey, i've been called from SourceLocation(Test_2.scala,9,285) +2 diff --git a/test/files/run/macro-sip19.flags b/test/files/run/macro-sip19.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-sip19.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala new file mode 100644 index 0000000000..39b29ad64c --- /dev/null +++ b/test/files/run/macro-sip19/Impls_Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.makro.Context + +object Macros { + def impl(c: Context) = { + import c.mirror._ + val Apply(fun, args) = c.enclosingImplicits(0)._2 + val fileName = fun.pos.fileInfo.getName + val line = fun.pos.line + val charOffset = fun.pos.point + c.reify { SourceLocation(c.literal(fileName).eval, c.literal(line).eval, c.literal(charOffset).eval) } + } + + implicit def sourceLocation: SourceLocation = macro impl +} + +case class SourceLocation( + /** The name of the source file */ + val fileName: String, + + /** The line number */ + val line: Int, + + /** The character offset */ + val charOffset: Int +) diff --git a/test/files/run/macro-sip19/Test_2.scala b/test/files/run/macro-sip19/Test_2.scala new file mode 100644 index 0000000000..32326e6352 --- /dev/null +++ b/test/files/run/macro-sip19/Test_2.scala @@ -0,0 +1,16 @@ +import Macros._ + +object Test extends App { + def foo(x: Int, y: Int)(implicit loc0: SourceLocation): Int = { + var loc = loc0; + { + var loc0 = 0 // shadow loc0 to disambiguate with the implicit macro + println("hey, i've been called from %s".format(loc)) + if (x < y) foo(y, x) + else if (y == 0) x + else foo(x - y, y) + } + } + + println(foo(4, 2)) +} diff --git a/test/files/run/macro-typecheck-implicitsdisabled.check b/test/files/run/macro-typecheck-implicitsdisabled.check new file mode 100644 index 0000000000..aa6c8e1f07 --- /dev/null +++ b/test/files/run/macro-typecheck-implicitsdisabled.check @@ -0,0 +1,2 @@ +scala.this.Predef.any2ArrowAssoc[Int](1).->[Int](2) +scala.reflect.internal.Types$TypeError: value -> is not a member of Int diff --git a/test/files/run/macro-typecheck-implicitsdisabled.flags b/test/files/run/macro-typecheck-implicitsdisabled.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-typecheck-implicitsdisabled.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala new file mode 100644 index 0000000000..4f0f76aed6 --- /dev/null +++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala @@ -0,0 +1,28 @@ +import scala.reflect.makro.Context + +object Macros { + def impl_with_implicits_enabled(c: Context) = { + import c.mirror._ + + val tree1 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) + val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false) + c.literal(ttree1.toString) + } + + def foo_with_implicits_enabled = macro impl_with_implicits_enabled + + def impl_with_implicits_disabled(c: Context) = { + import c.mirror._ + + try { + val tree2 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) + val ttree2 = c.typeCheck(tree2, withImplicitViewsDisabled = true) + c.literal(ttree2.toString) + } catch { + case ex: Throwable => + c.literal(ex.toString) + } + } + + def foo_with_implicits_disabled = macro impl_with_implicits_disabled +} \ No newline at end of file diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Test_2.scala b/test/files/run/macro-typecheck-implicitsdisabled/Test_2.scala new file mode 100644 index 0000000000..127e955f0e --- /dev/null +++ b/test/files/run/macro-typecheck-implicitsdisabled/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(Macros.foo_with_implicits_enabled) + println(Macros.foo_with_implicits_disabled) +} \ No newline at end of file diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check new file mode 100644 index 0000000000..9760c117a7 --- /dev/null +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -0,0 +1,5 @@ +{ + val $mr: reflect.mirror.type = scala.reflect.`package`.mirror; + $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.GroundTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)))) +} +mr.reify[Int](2) diff --git a/test/files/run/macro-typecheck-macrosdisabled.flags b/test/files/run/macro-typecheck-macrosdisabled.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-typecheck-macrosdisabled.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala new file mode 100644 index 0000000000..c253f0b1fb --- /dev/null +++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala @@ -0,0 +1,36 @@ +import scala.reflect.makro.Context + +object Macros { + def impl_with_macros_enabled(c: Context) = { + import c.mirror._ + + // todo. doesn't work. why? + //val mrPkg = staticModule("scala.reflect.package") + //val mrSym = selectTerm(mrPkg, "mirror") + //val NullaryMethodType(mrTpe) = mrSym.typeSignature + //val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror, null) + //val tree1 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + + val mr = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("package")), newTermName("mirror")) + val tree1 = Apply(Select(mr, newTermName("reify")), List(Literal(Constant(2)))) + val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) + c.literal(ttree1.toString) + } + + def foo_with_macros_enabled = macro impl_with_macros_enabled + + def impl_with_macros_disabled(c: Context) = { + import c.mirror._ + + val mrPkg = staticModule("scala.reflect.package") + val mrSym = selectTerm(mrPkg, "mirror") + val NullaryMethodType(mrTpe) = mrSym.typeSignature + val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror, null) + + val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) + c.literal(ttree2.toString) + } + + def foo_with_macros_disabled = macro impl_with_macros_disabled +} \ No newline at end of file diff --git a/test/files/run/macro-typecheck-macrosdisabled/Test_2.scala b/test/files/run/macro-typecheck-macrosdisabled/Test_2.scala new file mode 100644 index 0000000000..bdba39195b --- /dev/null +++ b/test/files/run/macro-typecheck-macrosdisabled/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(Macros.foo_with_macros_enabled) + println(Macros.foo_with_macros_disabled) +} \ No newline at end of file diff --git a/test/files/run/macro-undetparams-consfromsls.check b/test/files/run/macro-undetparams-consfromsls.check new file mode 100644 index 0000000000..6bf9bcca5a --- /dev/null +++ b/test/files/run/macro-undetparams-consfromsls.check @@ -0,0 +1,5 @@ +A = GroundTypeTag[Int] +B = GroundTypeTag[Nothing] +List(1) +A = GroundTypeTag[Any] +List(abc, 1) diff --git a/test/files/run/macro-undetparams-consfromsls.flags b/test/files/run/macro-undetparams-consfromsls.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-undetparams-consfromsls.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala new file mode 100644 index 0000000000..c22ff96028 --- /dev/null +++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala @@ -0,0 +1,17 @@ +import scala.reflect.makro.Context + +object Macros { + def cons_impl[A: c.TypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.reify { + println("A = " + c.literal(implicitly[c.TypeTag[A]].toString).eval) + x.eval :: xs.eval + } + + def nil_impl[B: c.TypeTag](c: Context): c.Expr[List[B]] = c.reify { + println("B = " + c.literal(implicitly[c.TypeTag[B]].toString).eval) + Nil + } + + def cons[A](x: A, xs: List[A]): List[A] = macro cons_impl[A] + + def nil[B]: List[B] = macro nil_impl[B] +} \ No newline at end of file diff --git a/test/files/run/macro-undetparams-consfromsls/Test_2.scala b/test/files/run/macro-undetparams-consfromsls/Test_2.scala new file mode 100644 index 0000000000..f2c2ce0051 --- /dev/null +++ b/test/files/run/macro-undetparams-consfromsls/Test_2.scala @@ -0,0 +1,7 @@ +object Test extends App { + import Macros._ + val xs = cons(1, nil) + println(xs) + val ys = cons("abc", xs) + println(ys) +} \ No newline at end of file diff --git a/test/files/run/macro-undetparams-implicitval.check b/test/files/run/macro-undetparams-implicitval.check new file mode 100644 index 0000000000..352a2e6480 --- /dev/null +++ b/test/files/run/macro-undetparams-implicitval.check @@ -0,0 +1 @@ +GroundTypeTag[Nothing] diff --git a/test/files/run/macro-undetparams-implicitval.flags b/test/files/run/macro-undetparams-implicitval.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-undetparams-implicitval.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-undetparams-implicitval/Test.scala b/test/files/run/macro-undetparams-implicitval/Test.scala new file mode 100644 index 0000000000..5278295451 --- /dev/null +++ b/test/files/run/macro-undetparams-implicitval/Test.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo[T: TypeTag] = println(implicitly[TypeTag[T]]) + foo +} \ No newline at end of file diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check new file mode 100644 index 0000000000..60c021a35b --- /dev/null +++ b/test/files/run/macro-undetparams-macroitself.check @@ -0,0 +1,2 @@ +GroundTypeTag[Int] +GroundTypeTag[String] diff --git a/test/files/run/macro-undetparams-macroitself.flags b/test/files/run/macro-undetparams-macroitself.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/run/macro-undetparams-macroitself.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala new file mode 100644 index 0000000000..9d65e8b0da --- /dev/null +++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala @@ -0,0 +1,7 @@ +import scala.reflect.makro.Context + +object Macros { + def impl[T: c.TypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.reify { println(c.literal(implicitly[c.TypeTag[T]].toString).eval) } + + def foo[T](foo: T) = macro impl[T] +} \ No newline at end of file diff --git a/test/files/run/macro-undetparams-macroitself/Test_2.scala b/test/files/run/macro-undetparams-macroitself/Test_2.scala new file mode 100644 index 0000000000..1a93ff1304 --- /dev/null +++ b/test/files/run/macro-undetparams-macroitself/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + Macros.foo(42) + Macros.foo("42") +} \ No newline at end of file diff --git a/test/files/run/manifests.scala b/test/files/run/manifests.scala index 6b6ea80b34..2d64bf18a9 100644 --- a/test/files/run/manifests.scala +++ b/test/files/run/manifests.scala @@ -4,29 +4,29 @@ object Test val CO, IN, CONTRA = Value } import Variances.{ CO, IN, CONTRA } - + object SubtypeRelationship extends Enumeration { val NONE, SAME, SUB, SUPER = Value } import SubtypeRelationship.{ NONE, SAME, SUB, SUPER } - + class VarianceTester[T, U, CC[_]](expected: Variances.Value)( implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) { - - def elements = List(ev1 <:< ev2, ev2 <:< ev1) - def containers = List(ev3 <:< ev4, ev4 <:< ev3) + + def elements = List(ev1.tpe <:< ev2.tpe, ev2.tpe <:< ev1.tpe) + def containers = List(ev3.tpe <:< ev4.tpe, ev4.tpe <:< ev3.tpe) def isUnrelated = typeCompare[T, U] == NONE def isSame = typeCompare[T, U] == SAME def isSub = typeCompare[T, U] == SUB def isSuper = typeCompare[T, U] == SUPER - + def showsCovariance = (elements == containers) def showsContravariance = (elements == containers.reverse) def showsInvariance = containers forall (_ == isSame) def allContainerVariances = List(showsCovariance, showsInvariance, showsContravariance) - + def showsExpectedVariance = if (isUnrelated) allContainerVariances forall (_ == false) else if (isSame) allContainerVariances forall (_ == true) @@ -36,64 +36,57 @@ object Test case CONTRA => showsContravariance && !showsCovariance && !showsInvariance } } - + def showsCovariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) = new VarianceTester[T, U, CC](CO) showsExpectedVariance def showsInvariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) = new VarianceTester[T, U, CC](IN) showsExpectedVariance - + def showsContravariance[T, U, CC[_]](implicit ev1: Manifest[T], ev2: Manifest[U], ev3: Manifest[CC[T]], ev4: Manifest[CC[U]]) = new VarianceTester[T, U, CC](CONTRA) showsExpectedVariance - - def typeCompare[T, U](implicit ev1: Manifest[T], ev2: Manifest[U]) = { - // checking types as well - if ((ev1 <:< ev2) != (ev1.tpe <:< ev2.tpe)) - println("Failed! " + ((ev1, ev2))) - - if ((ev2 <:< ev1) != (ev2.tpe <:< ev1.tpe)) - println("Failed! " + ((ev2, ev1))) - (ev1 <:< ev2, ev2 <:< ev1) match { + def typeCompare[T, U](implicit ev1: Manifest[T], ev2: Manifest[U]) = { + (ev1.tpe <:< ev2.tpe, ev2.tpe <:< ev1.tpe) match { case (true, true) => SAME case (true, false) => SUB case (false, true) => SUPER case (false, false) => NONE } } - + def assertAnyRef[T: Manifest] = List( - manifest[T] <:< manifest[Any], - manifest[T] <:< manifest[AnyRef], - !(manifest[T] <:< manifest[AnyVal]) + manifest[T].tpe <:< manifest[Any].tpe, + manifest[T].tpe <:< manifest[AnyRef].tpe, + !(manifest[T].tpe <:< manifest[AnyVal].tpe) ) foreach (assert(_, "assertAnyRef")) - + def assertAnyVal[T: Manifest] = List( - manifest[T] <:< manifest[Any], - !(manifest[T] <:< manifest[AnyRef]), - manifest[T] <:< manifest[AnyVal] + manifest[T].tpe <:< manifest[Any].tpe, + !(manifest[T].tpe <:< manifest[AnyRef].tpe), + manifest[T].tpe <:< manifest[AnyVal].tpe ) foreach (assert(_, "assertAnyVal")) - + def assertSameType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SAME, "assertSameType") def assertSuperType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SUPER, "assertSuperType") def assertSubType[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == SUB, "assertSubType") def assertNoRelationship[T: Manifest, U: Manifest] = assert(typeCompare[T, U] == NONE, "assertNoRelationship") - + def testVariancesVia[T: Manifest, U: Manifest] = assert( - typeCompare[T, U] == SUB && + typeCompare[T, U] == SUB && showsCovariance[T, U, List] && showsInvariance[T, U, Set], "testVariancesVia" ) - + def runAllTests = { assertAnyVal[AnyVal] assertAnyVal[Unit] - assertAnyVal[Int] - assertAnyVal[Double] + assertAnyVal[Int] + assertAnyVal[Double] assertAnyVal[Boolean] assertAnyVal[Char] - + assertAnyRef[AnyRef] assertAnyRef[java.lang.Object] assertAnyRef[java.lang.Integer] @@ -103,7 +96,7 @@ object Test assertAnyRef[String] assertAnyRef[scala.List[String]] assertAnyRef[scala.List[_]] - + // variance doesn't work yet // testVariancesVia[String, Any] // testVariancesVia[String, AnyRef] @@ -111,11 +104,11 @@ object Test assertSubType[List[String], List[Any]] assertSubType[List[String], List[AnyRef]] assertNoRelationship[List[String], List[AnyVal]] - + assertSubType[List[Int], List[Any]] assertSubType[List[Int], List[AnyVal]] assertNoRelationship[List[Int], List[AnyRef]] - + // Nothing assertSubType[Nothing, Any] assertSubType[Nothing, AnyVal] @@ -124,7 +117,7 @@ object Test assertSubType[Nothing, List[String]] assertSubType[Nothing, Null] assertSameType[Nothing, Nothing] - + // Null assertSubType[Null, Any] assertNoRelationship[Null, AnyVal] @@ -133,7 +126,7 @@ object Test assertSubType[Null, List[String]] assertSameType[Null, Null] assertSuperType[Null, Nothing] - + // Any assertSameType[Any, Any] assertSuperType[Any, AnyVal] @@ -142,7 +135,7 @@ object Test assertSuperType[Any, List[String]] assertSuperType[Any, Null] assertSuperType[Any, Nothing] - + // Misc unrelated types assertNoRelationship[Unit, AnyRef] assertNoRelationship[Unit, Int] diff --git a/test/files/run/primitive-sigs-2.check b/test/files/run/primitive-sigs-2.check index feb0619525..761aa1ca72 100644 --- a/test/files/run/primitive-sigs-2.check +++ b/test/files/run/primitive-sigs-2.check @@ -1,7 +1,7 @@ -T -List(A, char, class java.lang.Object) -a -public java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.Manifest) -public float[] Arr.arr3(float[][]) -public scala.collection.immutable.List Arr.arr2(java.lang.Character[]) -public scala.collection.immutable.List Arr.arr1(int[]) +T +List(A, char, class java.lang.Object) +a +public java.lang.Object Arr.arr4(java.lang.Object[],scala.reflect.api.TypeTags.scala.reflect.api.TypeTags$GroundTypeTag) +public float[] Arr.arr3(float[][]) +public scala.collection.immutable.List Arr.arr2(java.lang.Character[]) +public scala.collection.immutable.List Arr.arr1(int[]) diff --git a/test/files/run/reify_ann1a.check b/test/files/run/reify_ann1a.check index 66dce778a8..a3944ae1ee 100644 --- a/test/files/run/reify_ann1a.check +++ b/test/files/run/reify_ann1a.check @@ -1,30 +1,30 @@ -{ - @new ann(immutable.this.List.apply[String]("1a")) @new ann(immutable.this.List.apply[String]("1b")) class C[@new ann(immutable.this.List.apply[String]("2a")) @new ann(immutable.this.List.apply[String]("2b")) T] extends scala.AnyRef { - @new ann(immutable.this.List.apply[String]("3a")) @new ann(immutable.this.List.apply[String]("3b")) private[this] val x: T @ann(immutable.this.List.apply[String]("4a")) @ann(immutable.this.List.apply[String]("4b")) = _; - def (@new ann(immutable.this.List.apply[String]("3a")) @new ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4a")) @ann(immutable.this.List.apply[String]("4b"))) = { - super.(); - () - }; - @new ann(immutable.this.List.apply[String]("5a")) @new ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = { - @new ann(immutable.this.List.apply[String]("7a")) @new ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.$plus(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a"))); - val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a"))); - r.$plus(s) - } - }; - () -} -{ - @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends scala.AnyRef { - @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _; - def (@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = { - C.super.(); - () - }; - @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = { - @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a"))); - val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a"))); - r.+(s) - } - }; - () -} +{ + @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends Object { + @new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) private[this] val x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b")) = _; + def (@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b"))) = { + super.(); + () + }; + @new ann(immutable.this.List.apply("5a")) @new ann(immutable.this.List.apply("5b")) def f(x: Int @ann(immutable.this.List.apply("6a")) @ann(immutable.this.List.apply("6b"))) = { + @new ann(immutable.this.List.apply("7a")) @new ann(immutable.this.List.apply("7b")) val r = x.$plus(3): @ann(immutable.this.List.apply("8a")): @ann(immutable.this.List.apply("8b")); + val s = (4: Int @ann(immutable.this.List.apply("9a")) @ann(immutable.this.List.apply("9b"))); + r.$plus(s) + } + }; + () +} +{ + @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends Object { + @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _; + def (@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = { + C.super.(); + () + }; + @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = { + @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a"))); + val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a"))); + r.+(s) + } + }; + () +} diff --git a/test/files/run/reify_ann1a.scala b/test/files/run/reify_ann1a.scala index 1ca170904b..1f5d1daccd 100644 --- a/test/files/run/reify_ann1a.scala +++ b/test/files/run/reify_ann1a.scala @@ -1,14 +1,10 @@ -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._ class ann(bar: List[String]) extends StaticAnnotation object Test extends App { // test 1: reify - val tree = scala.reflect.Code.lift{ + val tree = reify{ @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")) @@ -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/run/reify_ann1b.check b/test/files/run/reify_ann1b.check index 9bc65a422e..bae838f15f 100644 --- a/test/files/run/reify_ann1b.check +++ b/test/files/run/reify_ann1b.check @@ -1,30 +1,30 @@ -{ - @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T] extends scala.AnyRef { - @new ann(bar = "3a") @new ann(bar = "3b") private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _; - def (@new ann(bar = "3a") @new ann(bar = "3b") x: T @ann(bar = "4a") @ann(bar = "4b")) = { - super.(); - () - }; - @new ann(bar = "5a") @new ann(bar = "5b") def f(x: Int @ann(bar = "6b") @ann(bar = "6a")): Int = { - @new ann(bar = "7a") @new ann(bar = "7b") val r: Int @ann(bar = "8b") @ann(bar = "8a") = ((x.$plus(3): Int @ann(bar = "8a")): Int @ann(bar = "8b") @ann(bar = "8a")); - val s: Int @ann(bar = "9b") @ann(bar = "9a") = (4: Int @ann(bar = "9b") @ann(bar = "9a")); - r.$plus(s) - } - }; - () -} -{ - @ann(bar = "1a") @ann(bar = "1b") class C[@ann(bar = "2a") @ann(bar = "2b") T] extends scala.AnyRef { - @ann(bar = "3a") @ann(bar = "3b") private[this] val x: T @ann(bar = "4b") @ann(bar = "4a") = _; - def (@ann(bar = "3a") @ann(bar = "3b") x: T @ann(bar = "4b") @ann(bar = "4a")): C[T] = { - C.super.(); - () - }; - @ann(bar = "5a") @ann(bar = "5b") def f(x: Int @ann(bar = "6b") @ann(bar = "6a")): Int = { - @ann(bar = "7a") @ann(bar = "7b") val r: Int @ann(bar = "8b") @ann(bar = "8a") = ((x.+(3): Int @ann(bar = "8a")): Int @ann(bar = "8b") @ann(bar = "8a")); - val s: Int @ann(bar = "9b") @ann(bar = "9a") = (4: Int @ann(bar = "9b") @ann(bar = "9a")); - r.+(s) - } - }; - () -} +{ + @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T >: Nothing <: Any] extends Object { + @new ann(bar = "3a") @new ann(bar = "3b") private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _; + def (@new ann(bar = "3a") @new ann(bar = "3b") x: T @ann(bar = "4a") @ann(bar = "4b")) = { + super.(); + () + }; + @new ann(bar = "5a") @new ann(bar = "5b") def f(x: Int @ann(bar = "6a") @ann(bar = "6b")) = { + @new ann(bar = "7a") @new ann(bar = "7b") val r = x.$plus(3): @ann(bar = "8a"): @ann(bar = "8b"); + val s = (4: Int @ann(bar = "9a") @ann(bar = "9b")); + r.$plus(s) + } + }; + () +} +{ + @ann(bar = "1a") @ann(bar = "1b") class C[@ann(bar = "2a") @ann(bar = "2b") T] extends Object { + @ann(bar = "3a") @ann(bar = "3b") private[this] val x: T @ann(bar = "4b") @ann(bar = "4a") = _; + def (@ann(bar = "3a") @ann(bar = "3b") x: T @ann(bar = "4b") @ann(bar = "4a")): C[T] = { + C.super.(); + () + }; + @ann(bar = "5a") @ann(bar = "5b") def f(x: Int @ann(bar = "6b") @ann(bar = "6a")): Int = { + @ann(bar = "7a") @ann(bar = "7b") val r: Int @ann(bar = "8b") @ann(bar = "8a") = ((x.+(3): Int @ann(bar = "8a")): Int @ann(bar = "8b") @ann(bar = "8a")); + val s: Int @ann(bar = "9b") @ann(bar = "9a") = (4: Int @ann(bar = "9b") @ann(bar = "9a")); + r.+(s) + } + }; + () +} diff --git a/test/files/run/reify_ann1b.scala b/test/files/run/reify_ann1b.scala index 9bdc712227..13d861a15c 100644 --- a/test/files/run/reify_ann1b.scala +++ b/test/files/run/reify_ann1b.scala @@ -1,14 +1,10 @@ -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._ class ann(bar: String) extends ClassfileAnnotation object Test extends App { // test 1: reify - val tree = scala.reflect.Code.lift{ + val tree = reify{ @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")) { @ann(bar="5a") @ann(bar="5b") def f(x: Int @ann(bar="6a") @ann(bar="6b")) = { @ann(bar="7a") @ann(bar="7b") val r = (x + 3): @ann(bar="8a") @ann(bar="8b") @@ -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/run/reify_ann2a.check b/test/files/run/reify_ann2a.check new file mode 100644 index 0000000000..5022c50ca8 --- /dev/null +++ b/test/files/run/reify_ann2a.check @@ -0,0 +1,44 @@ +{ + class ann extends StaticAnnotation { + private[this] val bar: List[String] = _; + def (bar: List[String]) = { + super.(); + () + } + }; + @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends Object { + @new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) private[this] val x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b")) = _; + def (@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b"))) = { + super.(); + () + }; + @new ann(immutable.this.List.apply("5a")) @new ann(immutable.this.List.apply("5b")) def f(x: Int @ann(immutable.this.List.apply("6a")) @ann(immutable.this.List.apply("6b"))) = { + @new ann(immutable.this.List.apply("7a")) @new ann(immutable.this.List.apply("7b")) val r = x.$plus(3): @ann(immutable.this.List.apply("8a")): @ann(immutable.this.List.apply("8b")); + val s = (4: Int @ann(immutable.this.List.apply("9a")) @ann(immutable.this.List.apply("9b"))); + r.$plus(s) + } + }; + () +} +{ + class ann extends scala.annotation.Annotation with scala.annotation.StaticAnnotation { + private[this] val bar: List[String] = _; + def (bar: List[String]): ann = { + ann.super.(); + () + } + }; + @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends Object { + @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _; + def (@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = { + C.super.(); + () + }; + @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = { + @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a"))); + val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a"))); + r.+(s) + } + }; + () +} diff --git a/test/files/run/reify_ann2a.scala b/test/files/run/reify_ann2a.scala new file mode 100644 index 0000000000..370abadba0 --- /dev/null +++ b/test/files/run/reify_ann2a.scala @@ -0,0 +1,25 @@ +import scala.reflect.mirror._ + +object Test extends App { + // test 1: reify + val tree = reify{ + 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 toolbox = mkToolBox() + 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/run/reify_ann3.check b/test/files/run/reify_ann3.check new file mode 100644 index 0000000000..9452a9701e --- /dev/null +++ b/test/files/run/reify_ann3.check @@ -0,0 +1,21 @@ +{ + class Tree[A >: Nothing <: Any, B >: Nothing <: Any] extends Object { + @new inline @getter() final val key: A = _; + def (key: A) = { + super.(); + () + } + }; + () +} +{ + class Tree[A, B] extends Object { + final private[this] val key: A = _; + @inline @scala.annotation.meta.getter final def key: A = Tree.this.key; + def (key: A): Tree[A,B] = { + Tree.super.(); + () + } + }; + () +} diff --git a/test/files/run/reify_ann3.scala b/test/files/run/reify_ann3.scala new file mode 100644 index 0000000000..d65e641619 --- /dev/null +++ b/test/files/run/reify_ann3.scala @@ -0,0 +1,19 @@ +import scala.reflect.mirror._ +import scala.annotation._ +import scala.annotation.meta._ + +object Test extends App { + // test 1: reify + val tree = reify{ + class Tree[A, +B](@(inline @getter) final val key: A) + }.tree + println(tree.toString) + + // test 2: import and typecheck + val toolbox = mkToolBox() + val ttree = toolbox.typeCheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.runExpr(tree) +} diff --git a/test/files/run/reify_ann4.check b/test/files/run/reify_ann4.check new file mode 100644 index 0000000000..406ee7bc08 --- /dev/null +++ b/test/files/run/reify_ann4.check @@ -0,0 +1,32 @@ +{ + class D extends StaticAnnotation { + def () = { + super.(); + () + } + }; + class C extends Object { + def () = { + super.(); + () + } + }; + val c1 = new C @D(); + () +} +{ + class D extends scala.annotation.Annotation with scala.annotation.StaticAnnotation { + def (): D = { + D.super.(); + () + } + }; + class C extends Object { + def (): C = { + C.super.(); + () + } + }; + val c1: C = new C @D(); + () +} diff --git a/test/files/run/reify_ann4.scala b/test/files/run/reify_ann4.scala new file mode 100644 index 0000000000..5655812689 --- /dev/null +++ b/test/files/run/reify_ann4.scala @@ -0,0 +1,23 @@ +import scala.reflect.mirror._ +import scala.annotation._ +import scala.annotation.meta._ + +object Test extends App { + // test 1: reify + val tree = reify{ + class D extends StaticAnnotation + class C + val c1 = new C @D + //val c2 = (new C) @D // illegal syntax + //val c3 = c1 @D // illegal syntax + }.tree + println(tree.toString) + + // test 2: import and typecheck + val toolbox = mkToolBox() + val ttree = toolbox.typeCheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.runExpr(tree) +} diff --git a/test/files/run/reify_ann5.check b/test/files/run/reify_ann5.check new file mode 100644 index 0000000000..ecf08eebb2 --- /dev/null +++ b/test/files/run/reify_ann5.check @@ -0,0 +1,22 @@ +{ + class C extends Object { + @new inline @beanGetter() @new BeanProperty() val x: Int = _; + def (x: Int) = { + super.(); + () + } + }; + () +} +{ + class C extends Object { + @scala.beans.BeanProperty private[this] val x: Int = _; + def x: Int = C.this.x; + def (x: Int): C = { + C.super.(); + () + }; + @inline @scala.annotation.meta.beanGetter def getX(): Int = C.this.x + }; + () +} diff --git a/test/files/run/reify_ann5.scala b/test/files/run/reify_ann5.scala new file mode 100644 index 0000000000..aecc61de46 --- /dev/null +++ b/test/files/run/reify_ann5.scala @@ -0,0 +1,20 @@ +import scala.reflect.mirror._ +import scala.annotation._ +import scala.annotation.meta._ +import scala.beans._ + +object Test extends App { + // test 1: reify + val tree = reify{ + class C(@BeanProperty @(inline @beanGetter) val x: Int) + }.tree + println(tree.toString) + + // test 2: import and typecheck + val toolbox = mkToolBox() + val ttree = toolbox.typeCheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.runExpr(tree) +} diff --git a/test/files/run/reify_anonymous.scala b/test/files/run/reify_anonymous.scala index af16f2f8fd..cd740f0190 100644 --- a/test/files/run/reify_anonymous.scala +++ b/test/files/run/reify_anonymous.scala @@ -1,13 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { println(new {def x = 2; def y = x * x}.y) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_classfileann_a.check b/test/files/run/reify_classfileann_a.check index 419d916907..685ecf5de6 100644 --- a/test/files/run/reify_classfileann_a.check +++ b/test/files/run/reify_classfileann_a.check @@ -1,18 +1,18 @@ -{ - @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends scala.AnyRef { - def () = { - super.(); - () - } - }; - () -} -{ - @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4")) class C extends scala.AnyRef { - def (): C = { - C.super.(); - () - } - }; - () -} +{ + @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends Object { + def () = { + super.(); + () + } + }; + () +} +{ + @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4")) class C extends Object { + def (): C = { + C.super.(); + () + } + }; + () +} diff --git a/test/files/run/reify_classfileann_a.scala b/test/files/run/reify_classfileann_a.scala index c77bd3b8a2..c3e7d8d2e9 100644 --- a/test/files/run/reify_classfileann_a.scala +++ b/test/files/run/reify_classfileann_a.scala @@ -1,21 +1,16 @@ -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._ class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends ClassfileAnnotation object Test extends App { // test 1: reify - val tree = scala.reflect.Code.lift{ + val tree = reify{ @ann(bar="1", quux=Array("2", "3"), baz = new ann(bar = "4")) class C }.tree 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/run/reify_classfileann_b.check b/test/files/run/reify_classfileann_b.check new file mode 100644 index 0000000000..0aac9aeb2a --- /dev/null +++ b/test/files/run/reify_classfileann_b.check @@ -0,0 +1,20 @@ +{ + class C extends Object { + def () = { + super.(); + () + }; + def x: Int = 2: @ann(bar = "1",quux = Array("2", "3"),baz = new ann(bar = "4")) + }; + () +} +{ + class C extends Object { + def (): C = { + C.super.(); + () + }; + def x: Int = (2: Int(2) @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4"))) + }; + () +} diff --git a/test/files/run/reify_classfileann_b.scala b/test/files/run/reify_classfileann_b.scala new file mode 100644 index 0000000000..4e50494af3 --- /dev/null +++ b/test/files/run/reify_classfileann_b.scala @@ -0,0 +1,23 @@ +import scala.reflect.mirror._ + +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends ClassfileAnnotation + +object Test extends App { + // test 1: reify + val tree = reify{ + class C { + def x: Int = { + 2: @ann(bar="1", quux=Array("2", "3"), baz = new ann(bar = "4")) + } + } + }.tree + println(tree.toString) + + // test 2: import and typecheck + val toolbox = mkToolBox() + 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/run/reify_closure1.scala b/test/files/run/reify_closure1.scala index 7cb3aff17d..3f5c8a8724 100644 --- a/test/files/run/reify_closure1.scala +++ b/test/files/run/reify_closure1.scala @@ -1,15 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { def foo[T](ys: List[T]): Int => Int = { - val fun = reflect.Code.lift{(x: Int) => { + val fun = reify{(x: Int) => { x }} - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure2a.scala b/test/files/run/reify_closure2a.scala index cf367aa63f..f5669a0e2c 100644 --- a/test/files/run/reify_closure2a.scala +++ b/test/files/run/reify_closure2a.scala @@ -1,15 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { def foo(y: Int): Int => Int = { - val fun = reflect.Code.lift{(x: Int) => { + val fun = reify{(x: Int) => { x + y }} - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure3a.scala b/test/files/run/reify_closure3a.scala index d322b970b6..056a705d7d 100644 --- a/test/files/run/reify_closure3a.scala +++ b/test/files/run/reify_closure3a.scala @@ -1,17 +1,14 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { def foo(y: Int): Int => Int = { def y1 = y - val fun = reflect.Code.lift{(x: Int) => { + val fun = reify{(x: Int) => { x + y1 }} - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure4a.scala b/test/files/run/reify_closure4a.scala index bbedd7e092..a63d20e561 100644 --- a/test/files/run/reify_closure4a.scala +++ b/test/files/run/reify_closure4a.scala @@ -1,17 +1,14 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { def foo(y: Int): Int => Int = { val y1 = y - val fun = reflect.Code.lift{(x: Int) => { + val fun = reify{(x: Int) => { x + y1 }} - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure5a.scala b/test/files/run/reify_closure5a.scala index 193e18103a..2e8b413f4c 100644 --- a/test/files/run/reify_closure5a.scala +++ b/test/files/run/reify_closure5a.scala @@ -1,19 +1,18 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - def foo[T](ys: List[T]): Int => Int = { - val fun = reflect.Code.lift{(x: Int) => { + def foo[T: TypeTag](ys: List[T]): Int => Int = { + val fun = reify{(x: Int) => { x + ys.length }} - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } - println(foo(List(1, 2, 3))(10)) - println(foo(List(1, 2, 3, 4))(10)) + var fun1 = foo(List(1, 2, 3)) + println(fun1(10)) + var fun2 = foo(List(1, 2, 3, 4)) + println(fun2(10)) } diff --git a/test/files/run/reify_closure6.scala b/test/files/run/reify_closure6.scala index 6aff83cb94..2cbd4ce819 100644 --- a/test/files/run/reify_closure6.scala +++ b/test/files/run/reify_closure6.scala @@ -1,13 +1,11 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { var q = 0 - def foo[T](ys: List[T]): Int => Int = { + def foo[T: TypeTag](ys: List[T]): Int => Int = { val z = 1 var y = 0 - val fun = reflect.Code.lift{(x: Int) => { + val fun = reify{(x: Int) => { y += 1 q += 1 println("q = " + q) @@ -15,13 +13,14 @@ object Test extends App { x + ys.length * z + q + y }} - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } - println("first invocation = " + foo(List(1, 2, 3))(10)) - println("second invocation = " + foo(List(1, 2, 3, 4))(10)) + val fun1 = foo(List(1, 2, 3)) + println("first invocation = " + fun1(10)) + val fun2 = foo(List(1, 2, 3, 4)) + println("second invocation = " + fun2(10)) println("q after second invocation = " + q) } \ No newline at end of file diff --git a/test/files/run/reify_closure7.scala b/test/files/run/reify_closure7.scala index 46002d8d6c..b9f87dbdeb 100644 --- a/test/files/run/reify_closure7.scala +++ b/test/files/run/reify_closure7.scala @@ -1,14 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { var q = 0 var clo: Int => Int = null - def foo[T](ys: List[T]): Int => Int = { + def foo[T: TypeTag](ys: List[T]): Int => Int = { val z = 1 var y = 0 - val fun = reflect.Code.lift{(x: Int) => { + val fun = reify{(x: Int) => { y += 1 q += 1 println("q = " + q) @@ -17,8 +15,7 @@ object Test extends App { }} if (clo == null) { - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun.tree) clo = dyn.asInstanceOf[Int => Int] } @@ -26,6 +23,8 @@ object Test extends App { clo } - println("first invocation = " + foo(List(1, 2, 3))(10)) - println("second invocation = " + foo(List(1, 2, 3, 4))(10)) + val fun1 = foo(List(1, 2, 3)) + println("first invocation = " + fun1(10)) + val fun2 = foo(List(1, 2, 3, 4)) + println("second invocation = " + fun2(10)) } diff --git a/test/files/run/reify_closure8a.scala b/test/files/run/reify_closure8a.scala index 805d8ff855..9de121b42f 100644 --- a/test/files/run/reify_closure8a.scala +++ b/test/files/run/reify_closure8a.scala @@ -1,15 +1,11 @@ -import scala.reflect.Code._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { class Foo(val y: Int) { - def fun = lift{y} + def fun = reify{y} } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(new Foo(10).fun.tree) val foo = dyn.asInstanceOf[Int] println(foo) diff --git a/test/files/run/reify_closure8b.check b/test/files/run/reify_closure8b.check new file mode 100644 index 0000000000..e0ec7d2c8f --- /dev/null +++ b/test/files/run/reify_closure8b.check @@ -0,0 +1,3 @@ +scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective compilation has failed: + +value y is not a member of Test.Foo diff --git a/test/files/run/reify_closure8b.scala b/test/files/run/reify_closure8b.scala new file mode 100644 index 0000000000..431da3230e --- /dev/null +++ b/test/files/run/reify_closure8b.scala @@ -0,0 +1,18 @@ +import scala.reflect.mirror._ + +object Test extends App { + // will fail because y is a private field + // reification doesn't magically make unavailable stuff available + class Foo(y: Int) { + def fun = reify{y} + } + + try { + val dyn = mkToolBox().runExpr(new Foo(10).fun.tree) + val foo = dyn.asInstanceOf[Int] + println(foo) + } catch { + case ex: Throwable => + println(ex) + } +} diff --git a/test/files/run/reify_closures10.scala b/test/files/run/reify_closures10.scala index b6ec8e8911..0ccce77a94 100644 --- a/test/files/run/reify_closures10.scala +++ b/test/files/run/reify_closures10.scala @@ -1,14 +1,10 @@ -import scala.reflect.Code._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { val x = 2 val y = 3 - val code = lift{println(x + y); x + y} + val code = reify{println(x + y); x + y} - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() println(toolbox.runExpr(code.tree)) } diff --git a/test/files/run/reify_complex.scala b/test/files/run/reify_complex.scala index 0d9aeb28c5..ecc25ffca5 100644 --- a/test/files/run/reify_complex.scala +++ b/test/files/run/reify_complex.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class Complex(val re: Double, val im: Double) { def + (that: Complex) = new Complex(re + that.re, im + that.im) @@ -22,9 +20,5 @@ object Test extends App { } val x = new Complex(2, 1); val y = new Complex(1, 3) println(x + y) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_extendbuiltins.scala b/test/files/run/reify_extendbuiltins.scala index 0aaec7cdf2..f95e9ab6ec 100644 --- a/test/files/run/reify_extendbuiltins.scala +++ b/test/files/run/reify_extendbuiltins.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { def fact(n: Int): BigInt = if (n == 0) 1 else fact(n-1) * n class Factorizer(n: Int) { @@ -12,9 +10,5 @@ object Test extends App { implicit def int2fact(n: Int) = new Factorizer(n) println("10! = " + (10!)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_for1.scala b/test/files/run/reify_for1.scala index d1b60d878b..9d1e32f7e5 100644 --- a/test/files/run/reify_for1.scala +++ b/test/files/run/reify_for1.scala @@ -1,15 +1,9 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { val sumOfSquares1 = (for (i <- 1 to 100; if (i % 3 == 0)) yield Math.pow(i, 2)).sum val sumOfSquares2 = (1 to 100).filter(_ % 3 == 0).map(Math.pow(_, 2)).sum assert(sumOfSquares1 == sumOfSquares2) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_fors.scala b/test/files/run/reify_fors.scala index 27ee85d18b..635fce049e 100644 --- a/test/files/run/reify_fors.scala +++ b/test/files/run/reify_fors.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { object Persons { /** A list of persons. To create a list, we use Predef.List * which takes a variable number of arguments and constructs @@ -98,9 +96,5 @@ object Test extends App { val ys = List(2.0, 1.0, 3.0) println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_generic.scala b/test/files/run/reify_generic.scala index 6a4ff148c4..7033c4e237 100644 --- a/test/files/run/reify_generic.scala +++ b/test/files/run/reify_generic.scala @@ -1,14 +1,8 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { val product = List(1, 2, 3).head * List[Any](4, 2, 0).head.asInstanceOf[Int] println(product) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_generic2.scala b/test/files/run/reify_generic2.scala index 9413f41eb5..8f9def318e 100644 --- a/test/files/run/reify_generic2.scala +++ b/test/files/run/reify_generic2.scala @@ -1,15 +1,9 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class C val product = List(new C, new C).length * List[C](new C, new C).length println(product) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_getter.scala b/test/files/run/reify_getter.scala index 33f36888a7..8bae293e72 100644 --- a/test/files/run/reify_getter.scala +++ b/test/files/run/reify_getter.scala @@ -1,18 +1,15 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { class C { val x = 2 } new C().x - }; + } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) } diff --git a/test/files/run/reify_implicits.scala b/test/files/run/reify_implicits.scala index 953eabe6c2..60971c3cfb 100644 --- a/test/files/run/reify_implicits.scala +++ b/test/files/run/reify_implicits.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { implicit def arrayWrapper[A : ClassManifest](x: Array[A]) = new { def sort(p: (A, A) => Boolean) = { @@ -12,9 +10,5 @@ object Test extends App { } val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_inheritance.scala b/test/files/run/reify_inheritance.scala index 78a64c264e..dd86c355a3 100644 --- a/test/files/run/reify_inheritance.scala +++ b/test/files/run/reify_inheritance.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class C { def x = 2 def y = x * x @@ -14,9 +12,5 @@ object Test extends App { } println(new D().y * new C().x) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_inner1.scala b/test/files/run/reify_inner1.scala index 546fe36d16..ea77ece6df 100644 --- a/test/files/run/reify_inner1.scala +++ b/test/files/run/reify_inner1.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class C { class D { val x = 2 @@ -13,9 +11,5 @@ object Test extends App { val outer = new C() val inner = new outer.D() println(inner.x) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_inner2.scala b/test/files/run/reify_inner2.scala index 613614b989..67c403f7e5 100644 --- a/test/files/run/reify_inner2.scala +++ b/test/files/run/reify_inner2.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class C { object D { val x = 2 @@ -13,9 +11,5 @@ object Test extends App { val outer = new C() val inner = outer.D println(inner.x) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_inner3.scala b/test/files/run/reify_inner3.scala index e9fb636dce..ad401d81da 100644 --- a/test/files/run/reify_inner3.scala +++ b/test/files/run/reify_inner3.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { object C { class D { val x = 2 @@ -13,9 +11,5 @@ object Test extends App { val outer = C val inner = new outer.D println(inner.x) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_inner4.scala b/test/files/run/reify_inner4.scala index 33870b0983..140c8e9ed4 100644 --- a/test/files/run/reify_inner4.scala +++ b/test/files/run/reify_inner4.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { object C { object D { val x = 2 @@ -13,9 +11,5 @@ object Test extends App { val outer = C val inner = outer.D println(inner.x) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_maps.scala b/test/files/run/reify_maps.scala index d3d95ffa24..3fcc21892f 100644 --- a/test/files/run/reify_maps.scala +++ b/test/files/run/reify_maps.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { val colors = Map("red" -> 0xFF0000, "turquoise" -> 0x00FFFF, "black" -> 0x000000, @@ -17,9 +15,5 @@ object Test extends App { "Unknown color: " + name } ) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_metalevel_breach_+0_refers_to_1.check b/test/files/run/reify_metalevel_breach_+0_refers_to_1.check new file mode 100644 index 0000000000..5bfed17f8e --- /dev/null +++ b/test/files/run/reify_metalevel_breach_+0_refers_to_1.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala b/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala new file mode 100644 index 0000000000..fe23bc8438 --- /dev/null +++ b/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + val code = reify{ + val x = 2 + val inner = reify{x} + inner.eval + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.check b/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.check new file mode 100644 index 0000000000..5bfed17f8e --- /dev/null +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala new file mode 100644 index 0000000000..5d98a38592 --- /dev/null +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala @@ -0,0 +1,11 @@ +import scala.reflect.mirror._ + +object Test extends App { + val x = 2 + val outer = reify{reify{x}} + val code = reify{outer.eval.eval} + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.check b/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.check new file mode 100644 index 0000000000..5bfed17f8e --- /dev/null +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala new file mode 100644 index 0000000000..ca31d83acd --- /dev/null +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + val x = 2 + val code = reify{ + { + val inner = reify{reify{x}} + inner.eval + }.eval + } + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_1.check b/test/files/run/reify_metalevel_breach_-1_refers_to_1.check new file mode 100644 index 0000000000..5bfed17f8e --- /dev/null +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_1.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala new file mode 100644 index 0000000000..56d85c6ba1 --- /dev/null +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + val code = reify{ + val x = 2 + val inner = reify{reify{x}} + inner.eval.eval + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_nested_inner_refers_to_global.check b/test/files/run/reify_nested_inner_refers_to_global.check new file mode 100644 index 0000000000..7ff4c83d37 --- /dev/null +++ b/test/files/run/reify_nested_inner_refers_to_global.check @@ -0,0 +1 @@ +evaluated = 2 diff --git a/test/files/run/reify_nested_inner_refers_to_global.scala b/test/files/run/reify_nested_inner_refers_to_global.scala new file mode 100644 index 0000000000..14899bcf99 --- /dev/null +++ b/test/files/run/reify_nested_inner_refers_to_global.scala @@ -0,0 +1,14 @@ +import scala.reflect.mirror._ + +object Test extends App { + val code = { + val x = 2 + reify{ + reify{x}.eval + } + } + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_nested_inner_refers_to_local.check b/test/files/run/reify_nested_inner_refers_to_local.check new file mode 100644 index 0000000000..5bfed17f8e --- /dev/null +++ b/test/files/run/reify_nested_inner_refers_to_local.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/test/files/run/reify_nested_inner_refers_to_local.scala b/test/files/run/reify_nested_inner_refers_to_local.scala new file mode 100644 index 0000000000..fd56585f72 --- /dev/null +++ b/test/files/run/reify_nested_inner_refers_to_local.scala @@ -0,0 +1,12 @@ +import scala.reflect.mirror._ + +object Test extends App { + val code = reify{ + val x = 2 + reify{x}.eval + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_nested_outer_refers_to_global.check b/test/files/run/reify_nested_outer_refers_to_global.check new file mode 100644 index 0000000000..7ff4c83d37 --- /dev/null +++ b/test/files/run/reify_nested_outer_refers_to_global.check @@ -0,0 +1 @@ +evaluated = 2 diff --git a/test/files/run/reify_nested_outer_refers_to_global.scala b/test/files/run/reify_nested_outer_refers_to_global.scala new file mode 100644 index 0000000000..f34e4fe04b --- /dev/null +++ b/test/files/run/reify_nested_outer_refers_to_global.scala @@ -0,0 +1,16 @@ +import scala.reflect.mirror._ + +object Test extends App { + val code = { + val x = 2 + val outer = reify{x} + reify{ + val x = 42 + outer.eval + }; + } + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_nested_outer_refers_to_local.check b/test/files/run/reify_nested_outer_refers_to_local.check new file mode 100644 index 0000000000..7ff4c83d37 --- /dev/null +++ b/test/files/run/reify_nested_outer_refers_to_local.check @@ -0,0 +1 @@ +evaluated = 2 diff --git a/test/files/run/reify_nested_outer_refers_to_local.scala b/test/files/run/reify_nested_outer_refers_to_local.scala new file mode 100644 index 0000000000..e16c851d8d --- /dev/null +++ b/test/files/run/reify_nested_outer_refers_to_local.scala @@ -0,0 +1,16 @@ +import scala.reflect.mirror._ + +object Test extends App { + val outer = { + val x = 2 + reify{x} + } + val code = reify{ + val x = 42 + outer.eval + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_newimpl_01.check b/test/files/run/reify_newimpl_01.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/reify_newimpl_01.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_01.scala b/test/files/run/reify_newimpl_01.scala new file mode 100644 index 0000000000..f7539a15b0 --- /dev/null +++ b/test/files/run/reify_newimpl_01.scala @@ -0,0 +1,11 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val x = 2 + val code = reify { + x + } + println(code.eval) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_02.check b/test/files/run/reify_newimpl_02.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/reify_newimpl_02.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_02.scala b/test/files/run/reify_newimpl_02.scala new file mode 100644 index 0000000000..2c085efa04 --- /dev/null +++ b/test/files/run/reify_newimpl_02.scala @@ -0,0 +1,11 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var x = 2 + val code = reify { + x + } + println(code.eval) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_03.check b/test/files/run/reify_newimpl_03.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/reify_newimpl_03.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_03.scala b/test/files/run/reify_newimpl_03.scala new file mode 100644 index 0000000000..361cfc50bb --- /dev/null +++ b/test/files/run/reify_newimpl_03.scala @@ -0,0 +1,11 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val code = reify { + val x = 2 + reify{x}.eval + } + println(code.eval) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_04.check b/test/files/run/reify_newimpl_04.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/reify_newimpl_04.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_04.scala b/test/files/run/reify_newimpl_04.scala new file mode 100644 index 0000000000..d80a7c9ffd --- /dev/null +++ b/test/files/run/reify_newimpl_04.scala @@ -0,0 +1,11 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val code = reify { + var x = 2 + reify{x}.eval + } + println(code.eval) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_05.check b/test/files/run/reify_newimpl_05.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/reify_newimpl_05.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_05.scala b/test/files/run/reify_newimpl_05.scala new file mode 100644 index 0000000000..85c1711bdb --- /dev/null +++ b/test/files/run/reify_newimpl_05.scala @@ -0,0 +1,12 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val code = reify { + var x = 2 + def y = x // forcibly captures x + reify{x}.eval + } + println(code.eval) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_06.check b/test/files/run/reify_newimpl_06.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/reify_newimpl_06.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_06.scala b/test/files/run/reify_newimpl_06.scala new file mode 100644 index 0000000000..257b54167a --- /dev/null +++ b/test/files/run/reify_newimpl_06.scala @@ -0,0 +1,11 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C(val y: Int) { + val code = reify { + reify{y}.eval + } + } + + println(new C(2).code.eval) +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_09.check b/test/files/run/reify_newimpl_09.check new file mode 100644 index 0000000000..220bd6875a --- /dev/null +++ b/test/files/run/reify_newimpl_09.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/test/files/run/reify_newimpl_09.scala b/test/files/run/reify_newimpl_09.scala new file mode 100644 index 0000000000..2c81945a2a --- /dev/null +++ b/test/files/run/reify_newimpl_09.scala @@ -0,0 +1,11 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + type T = Int + val code = reify { + List[T](2) + } + println(code.eval) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_10.check b/test/files/run/reify_newimpl_10.check new file mode 100644 index 0000000000..220bd6875a --- /dev/null +++ b/test/files/run/reify_newimpl_10.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/test/files/run/reify_newimpl_10.scala b/test/files/run/reify_newimpl_10.scala new file mode 100644 index 0000000000..6e70b4d216 --- /dev/null +++ b/test/files/run/reify_newimpl_10.scala @@ -0,0 +1,12 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + type T = Int + implicit val tt = implicitly[TypeTag[String]].asInstanceOf[TypeTag[T]] // this "mistake" is made for a reason! + val code = reify { + List[T](2) + } + println(code.eval) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_11.check b/test/files/run/reify_newimpl_11.check new file mode 100644 index 0000000000..e2a8206132 --- /dev/null +++ b/test/files/run/reify_newimpl_11.check @@ -0,0 +1,2 @@ +scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: +unresolved free type variables (namely: T defined by C in reify_newimpl_11.scala:4:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_11.scala b/test/files/run/reify_newimpl_11.scala new file mode 100644 index 0000000000..4e91c7a457 --- /dev/null +++ b/test/files/run/reify_newimpl_11.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C[T] { + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + try { + new C[Int] + } catch { + case ex: Throwable => + println(ex) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_12.check b/test/files/run/reify_newimpl_12.check new file mode 100644 index 0000000000..220bd6875a --- /dev/null +++ b/test/files/run/reify_newimpl_12.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/test/files/run/reify_newimpl_12.scala b/test/files/run/reify_newimpl_12.scala new file mode 100644 index 0000000000..433168ce28 --- /dev/null +++ b/test/files/run/reify_newimpl_12.scala @@ -0,0 +1,12 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C[T: TypeTag] { + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + new C[Int] +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_13.check b/test/files/run/reify_newimpl_13.check new file mode 100644 index 0000000000..7c47310cf2 --- /dev/null +++ b/test/files/run/reify_newimpl_13.check @@ -0,0 +1,2 @@ +scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: +unresolved free type variables (namely: T defined by C in reify_newimpl_13.scala:5:13). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_13.scala b/test/files/run/reify_newimpl_13.scala new file mode 100644 index 0000000000..dd1980b74f --- /dev/null +++ b/test/files/run/reify_newimpl_13.scala @@ -0,0 +1,19 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + class C[T] { + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + try { + new C[Int] + } catch { + case ex: Throwable => + println(ex) + } + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_14.check b/test/files/run/reify_newimpl_14.check new file mode 100644 index 0000000000..220bd6875a --- /dev/null +++ b/test/files/run/reify_newimpl_14.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/test/files/run/reify_newimpl_14.scala b/test/files/run/reify_newimpl_14.scala new file mode 100644 index 0000000000..3f52f19cfb --- /dev/null +++ b/test/files/run/reify_newimpl_14.scala @@ -0,0 +1,14 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + class C[T: TypeTag] { + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + new C[Int] + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_15.check b/test/files/run/reify_newimpl_15.check new file mode 100644 index 0000000000..220bd6875a --- /dev/null +++ b/test/files/run/reify_newimpl_15.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/test/files/run/reify_newimpl_15.scala b/test/files/run/reify_newimpl_15.scala new file mode 100644 index 0000000000..b707b2583d --- /dev/null +++ b/test/files/run/reify_newimpl_15.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C { + type T = Int + val code = reify { + List[T](2) + } + println(code.eval) + } + + new C +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_16.check b/test/files/run/reify_newimpl_16.check new file mode 100644 index 0000000000..220bd6875a --- /dev/null +++ b/test/files/run/reify_newimpl_16.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/test/files/run/reify_newimpl_16.scala b/test/files/run/reify_newimpl_16.scala new file mode 100644 index 0000000000..98fc15878c --- /dev/null +++ b/test/files/run/reify_newimpl_16.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + class C { + type T = Int + val code = reify { + List[T](2) + } + println(code.eval) + } + + new C + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_17.check b/test/files/run/reify_newimpl_17.check new file mode 100644 index 0000000000..0fb9ddfc2d --- /dev/null +++ b/test/files/run/reify_newimpl_17.check @@ -0,0 +1,2 @@ +scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: +unresolved free type variables (namely: U defined by C in reify_newimpl_17.scala:4:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_17.scala b/test/files/run/reify_newimpl_17.scala new file mode 100644 index 0000000000..331777fcfb --- /dev/null +++ b/test/files/run/reify_newimpl_17.scala @@ -0,0 +1,18 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C[U] { + type T = U + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + try { + new C[Int] + } catch { + case ex: Throwable => + println(ex) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_18.check b/test/files/run/reify_newimpl_18.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_18.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_18.scala b/test/files/run/reify_newimpl_18.scala new file mode 100644 index 0000000000..704e54928a --- /dev/null +++ b/test/files/run/reify_newimpl_18.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C[U: TypeTag] { + type T = U + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + new C[Int] +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_19.check b/test/files/run/reify_newimpl_19.check new file mode 100644 index 0000000000..32f9300f53 --- /dev/null +++ b/test/files/run/reify_newimpl_19.check @@ -0,0 +1,2 @@ +scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: +unresolved free type variables (namely: T defined by C in reify_newimpl_19.scala:5:10). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_19.scala b/test/files/run/reify_newimpl_19.scala new file mode 100644 index 0000000000..0ea8ae6992 --- /dev/null +++ b/test/files/run/reify_newimpl_19.scala @@ -0,0 +1,18 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C { + type T + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + try { + new C { val T = Int } + } catch { + case ex: Throwable => + println(ex) + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_20.check b/test/files/run/reify_newimpl_20.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_20.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_20.scala b/test/files/run/reify_newimpl_20.scala new file mode 100644 index 0000000000..16895a449e --- /dev/null +++ b/test/files/run/reify_newimpl_20.scala @@ -0,0 +1,14 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C { + type T + implicit val tt: TypeTag[T] = implicitly[TypeTag[Int]].asInstanceOf[TypeTag[T]] + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + new C { type T = String } // this "mistake" is made for a reason! +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_21.check b/test/files/run/reify_newimpl_21.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_21.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_21.scala b/test/files/run/reify_newimpl_21.scala new file mode 100644 index 0000000000..99f9ac9089 --- /dev/null +++ b/test/files/run/reify_newimpl_21.scala @@ -0,0 +1,18 @@ +import scala.reflect.mirror._ + +object Test extends App { + trait C { + type T + implicit val tt: TypeTag[T] + lazy val code = reify { + List[T](2.asInstanceOf[T]) + } + } + + class D extends C { + type T = String // this "mistake" is made for a reason! + override val tt: TypeTag[T] = implicitly[TypeTag[Int]].asInstanceOf[TypeTag[T]] + } + + println((new D).code.eval) +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check new file mode 100644 index 0000000000..51699cbc29 --- /dev/null +++ b/test/files/run/reify_newimpl_22.check @@ -0,0 +1,23 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.mirror._ +import scala.reflect.mirror._ + +scala> { + val x = 2 + val code = reify { + x + } + println(code.eval) +} +:13: free term: Ident(newTermName("x")) defined by res0 in :12:21 + val code = reify { + ^ +2 + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_22.scala b/test/files/run/reify_newimpl_22.scala new file mode 100644 index 0000000000..a211ad360c --- /dev/null +++ b/test/files/run/reify_newimpl_22.scala @@ -0,0 +1,15 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-free-terms" + def code = """ +import scala.reflect.mirror._ +{ + val x = 2 + val code = reify { + x + } + println(code.eval) +} + """ +} diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check new file mode 100644 index 0000000000..33d15190fb --- /dev/null +++ b/test/files/run/reify_newimpl_23.check @@ -0,0 +1,22 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.mirror._ +import scala.reflect.mirror._ + +scala> def foo[T]{ + val code = reify { + List[T]() + } + println(code.eval) +} +:11: free type: Ident(newTypeName("T")) defined by foo in :10:16 + val code = reify { + ^ +foo: [T]=> Unit + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_23.scala b/test/files/run/reify_newimpl_23.scala new file mode 100644 index 0000000000..15da4e497e --- /dev/null +++ b/test/files/run/reify_newimpl_23.scala @@ -0,0 +1,14 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-free-types" + def code = """ +import scala.reflect.mirror._ +def foo[T]{ + val code = reify { + List[T]() + } + println(code.eval) +} + """ +} diff --git a/test/files/run/reify_newimpl_24.check b/test/files/run/reify_newimpl_24.check new file mode 100644 index 0000000000..66b18c790e --- /dev/null +++ b/test/files/run/reify_newimpl_24.check @@ -0,0 +1,24 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.mirror._ +import scala.reflect.mirror._ + +scala> { + val x = 2 + val code = reify { + val y = reify { x } + y.eval + } + println(code.eval) +} +:15: this splice cannot be resolved statically + y.eval + ^ +2 + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_24.scala b/test/files/run/reify_newimpl_24.scala new file mode 100644 index 0000000000..7b21eeeb10 --- /dev/null +++ b/test/files/run/reify_newimpl_24.scala @@ -0,0 +1,16 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-runtime-splices" + def code = """ +import scala.reflect.mirror._ +{ + val x = 2 + val code = reify { + val y = reify { x } + y.eval + } + println(code.eval) +} + """ +} diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check new file mode 100644 index 0000000000..31ece627e1 --- /dev/null +++ b/test/files/run/reify_newimpl_25.check @@ -0,0 +1,21 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.mirror._ +import scala.reflect.mirror._ + +scala> { + val x = "2" + val tt = implicitly[TypeTag[x.type]] + println(tt) +} +:13: free term: Ident(newTermName("x")) defined by res0 in :12:21 + val tt = implicitly[TypeTag[x.type]] + ^ +GroundTypeTag[x.type] + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_25.scala b/test/files/run/reify_newimpl_25.scala new file mode 100644 index 0000000000..1f66f5e681 --- /dev/null +++ b/test/files/run/reify_newimpl_25.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-free-terms" + def code = """ +import scala.reflect.mirror._ +{ + val x = "2" + val tt = implicitly[TypeTag[x.type]] + println(tt) +} + """ +} diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check new file mode 100644 index 0000000000..68b0ee8c99 --- /dev/null +++ b/test/files/run/reify_newimpl_26.check @@ -0,0 +1,23 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.mirror._ +import scala.reflect.mirror._ + +scala> def foo[T]{ + val tt = implicitly[TypeTag[List[T]]] + println(tt) +} +:11: free type: Ident(newTypeName("T")) defined by foo in :10:16 + val tt = implicitly[TypeTag[List[T]]] + ^ +foo: [T]=> Unit + +scala> foo[Int] +GroundTypeTag[List[T]] + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_26.scala b/test/files/run/reify_newimpl_26.scala new file mode 100644 index 0000000000..f2dd1bfc4e --- /dev/null +++ b/test/files/run/reify_newimpl_26.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-free-types" + def code = """ +import scala.reflect.mirror._ +def foo[T]{ + val tt = implicitly[TypeTag[List[T]]] + println(tt) +} +foo[Int] + """ +} diff --git a/test/files/run/reify_newimpl_27.check b/test/files/run/reify_newimpl_27.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_27.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_27.scala b/test/files/run/reify_newimpl_27.scala new file mode 100644 index 0000000000..b3d6d5c865 --- /dev/null +++ b/test/files/run/reify_newimpl_27.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + object C { + type T = Int + val code = reify { + List[T](2) + } + println(code.eval) + } + + C +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_28.check b/test/files/run/reify_newimpl_28.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_28.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_28.scala b/test/files/run/reify_newimpl_28.scala new file mode 100644 index 0000000000..f7874b8548 --- /dev/null +++ b/test/files/run/reify_newimpl_28.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + object C { + type T = Int + val code = reify { + List[T](2) + } + println(code.eval) + } + + C + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_29.check b/test/files/run/reify_newimpl_29.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_29.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_29.scala b/test/files/run/reify_newimpl_29.scala new file mode 100644 index 0000000000..e32762f335 --- /dev/null +++ b/test/files/run/reify_newimpl_29.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C { + type T = Int + val code = reify { + List[C#T](2) + } + println(code.eval) + } + + new C +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_30.check b/test/files/run/reify_newimpl_30.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_30.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_30.scala b/test/files/run/reify_newimpl_30.scala new file mode 100644 index 0000000000..e4ba3221e1 --- /dev/null +++ b/test/files/run/reify_newimpl_30.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + class C { + type T = Int + val code = reify { + List[C#T](2) + } + println(code.eval) + } + + new C + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_31.check b/test/files/run/reify_newimpl_31.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_31.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_31.scala b/test/files/run/reify_newimpl_31.scala new file mode 100644 index 0000000000..20a851e32e --- /dev/null +++ b/test/files/run/reify_newimpl_31.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + object C { + type T = Int + val code = reify { + List[C.T](2) + } + println(code.eval) + } + + C +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_32.check b/test/files/run/reify_newimpl_32.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_32.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_32.scala b/test/files/run/reify_newimpl_32.scala new file mode 100644 index 0000000000..788486ec00 --- /dev/null +++ b/test/files/run/reify_newimpl_32.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + object C { + type T = Int + val code = reify { + List[C.T](2) + } + println(code.eval) + } + + C + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_33.check b/test/files/run/reify_newimpl_33.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_33.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_33.scala b/test/files/run/reify_newimpl_33.scala new file mode 100644 index 0000000000..84a8258256 --- /dev/null +++ b/test/files/run/reify_newimpl_33.scala @@ -0,0 +1,14 @@ +import scala.reflect.mirror._ + +object Test extends App { + object C { + type T = Int + val c = C + val code = reify { + List[c.T](2) + } + println(code.eval) + } + + C +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_34.check b/test/files/run/reify_newimpl_34.check new file mode 100644 index 0000000000..a7029974a4 --- /dev/null +++ b/test/files/run/reify_newimpl_34.check @@ -0,0 +1 @@ +List(2) diff --git a/test/files/run/reify_newimpl_34.scala b/test/files/run/reify_newimpl_34.scala new file mode 100644 index 0000000000..5935ab385c --- /dev/null +++ b/test/files/run/reify_newimpl_34.scala @@ -0,0 +1,16 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + object C { + type T = Int + lazy val c = C + val code = reify { + List[c.T](2) + } + println(code.eval) + } + + C + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_36.check b/test/files/run/reify_newimpl_36.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/reify_newimpl_36.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/reify_newimpl_36.scala b/test/files/run/reify_newimpl_36.scala new file mode 100644 index 0000000000..c76efce27a --- /dev/null +++ b/test/files/run/reify_newimpl_36.scala @@ -0,0 +1,14 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val x = 42 + def foo() = reify(reify(x)); + { + val x = 2 + val code1 = foo() + val code2 = code1.eval + println(code2.eval) + } + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_37.check b/test/files/run/reify_newimpl_37.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/reify_newimpl_37.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/reify_newimpl_37.scala b/test/files/run/reify_newimpl_37.scala new file mode 100644 index 0000000000..e83d35dbe1 --- /dev/null +++ b/test/files/run/reify_newimpl_37.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val x = 42 + def foo() = reify(reify(reify(x))); + { + val x = 2 + val code1 = foo() + val code2 = code1.eval + val code3 = code2.eval + println(code3.eval) + } + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_38.check b/test/files/run/reify_newimpl_38.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/reify_newimpl_38.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/reify_newimpl_38.scala b/test/files/run/reify_newimpl_38.scala new file mode 100644 index 0000000000..70ef49ecf7 --- /dev/null +++ b/test/files/run/reify_newimpl_38.scala @@ -0,0 +1,14 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val x = 42 + def foo() = reify{ val y = x; reify(y) }; + { + val x = 2 + val code1 = foo() + val code2 = code1.eval + println(code2.eval) + } + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_39.check b/test/files/run/reify_newimpl_39.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/reify_newimpl_39.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/reify_newimpl_39.scala b/test/files/run/reify_newimpl_39.scala new file mode 100644 index 0000000000..faa45d917d --- /dev/null +++ b/test/files/run/reify_newimpl_39.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val x = 42 + def foo() = reify{ val y = x; reify{ val z = y; reify(z) } }; + { + val x = 2 + val code1 = foo() + val code2 = code1.eval + val code3 = code2.eval + println(code3.eval) + } + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_40.check b/test/files/run/reify_newimpl_40.check new file mode 100644 index 0000000000..94c5a65fe0 --- /dev/null +++ b/test/files/run/reify_newimpl_40.check @@ -0,0 +1 @@ +74088 diff --git a/test/files/run/reify_newimpl_40.scala b/test/files/run/reify_newimpl_40.scala new file mode 100644 index 0000000000..a983a92324 --- /dev/null +++ b/test/files/run/reify_newimpl_40.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + val x = 42 + def foo() = reify{ val y = x; reify{ val z = y * x; reify(z * x) } }; + { + val x = 2 + val code1 = foo() + val code2 = code1.eval + val code3 = code2.eval + println(code3.eval) + } + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_41.check b/test/files/run/reify_newimpl_41.check new file mode 100644 index 0000000000..0b427f2ee6 --- /dev/null +++ b/test/files/run/reify_newimpl_41.check @@ -0,0 +1,3 @@ +42 +44 +43 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_41.scala b/test/files/run/reify_newimpl_41.scala new file mode 100644 index 0000000000..9aedccc98a --- /dev/null +++ b/test/files/run/reify_newimpl_41.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var _x = 42 + def x = { val x0 = _x; _x += 1; x0 } + var _y = 1 + def y = { val y0 = _y + _x; _y += y0; y0 } + val code = reify { + def foo = y // ensures that y is the first freevar we find + println(x) + println(y) + println(x) + } + code.eval + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_42.check b/test/files/run/reify_newimpl_42.check new file mode 100644 index 0000000000..0b427f2ee6 --- /dev/null +++ b/test/files/run/reify_newimpl_42.check @@ -0,0 +1,3 @@ +42 +44 +43 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_42.scala b/test/files/run/reify_newimpl_42.scala new file mode 100644 index 0000000000..1e21bd59bc --- /dev/null +++ b/test/files/run/reify_newimpl_42.scala @@ -0,0 +1,16 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var _x = 42 + def x = { val x0 = _x; _x += 1; x0 } + var _y = 1 + def y = { val y0 = _y + _x; _y += y0; y0 } + val code = reify { + println(x) + println(y) + println(x) + } + code.eval + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_43.check b/test/files/run/reify_newimpl_43.check new file mode 100644 index 0000000000..7a754f414c --- /dev/null +++ b/test/files/run/reify_newimpl_43.check @@ -0,0 +1,2 @@ +1 +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_43.scala b/test/files/run/reify_newimpl_43.scala new file mode 100644 index 0000000000..962461db8b --- /dev/null +++ b/test/files/run/reify_newimpl_43.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var counter = 0 + lazy val x = { counter += 1; counter } + lazy val y = { counter += 1; counter } + val code = reify { + def foo = y // ensures that y is the first freevar we find + println(x) + println(y) + } + code.eval + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_44.check b/test/files/run/reify_newimpl_44.check new file mode 100644 index 0000000000..7a754f414c --- /dev/null +++ b/test/files/run/reify_newimpl_44.check @@ -0,0 +1,2 @@ +1 +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_44.scala b/test/files/run/reify_newimpl_44.scala new file mode 100644 index 0000000000..962461db8b --- /dev/null +++ b/test/files/run/reify_newimpl_44.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var counter = 0 + lazy val x = { counter += 1; counter } + lazy val y = { counter += 1; counter } + val code = reify { + def foo = y // ensures that y is the first freevar we find + println(x) + println(y) + } + code.eval + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_45.check b/test/files/run/reify_newimpl_45.check new file mode 100644 index 0000000000..6e14f71e26 --- /dev/null +++ b/test/files/run/reify_newimpl_45.check @@ -0,0 +1,2 @@ +List(free type T) +ima worx: 2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_45.scala b/test/files/run/reify_newimpl_45.scala new file mode 100644 index 0000000000..241b7d4bc3 --- /dev/null +++ b/test/files/run/reify_newimpl_45.scala @@ -0,0 +1,12 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C[T >: Null] { + val code = reify{val x: T = "2".asInstanceOf[T]; println("ima worx: %s".format(x)); x} + println(freeTypes(code)) + val T = freeTypes(code)(0) + mkToolBox().runExpr(code, Map(T -> definitions.StringClass.asType)) + } + + new C[String] +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_47.check b/test/files/run/reify_newimpl_47.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/reify_newimpl_47.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_47.scala b/test/files/run/reify_newimpl_47.scala new file mode 100644 index 0000000000..bd1bd1fe65 --- /dev/null +++ b/test/files/run/reify_newimpl_47.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + val outer = { + val x = 2 + reify{x} + } + + val code = reify{ + val x = 42 + outer.eval + } + + println(code.eval) +} diff --git a/test/files/run/reify_newimpl_48.check b/test/files/run/reify_newimpl_48.check new file mode 100644 index 0000000000..f11c82a4cb --- /dev/null +++ b/test/files/run/reify_newimpl_48.check @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_48.scala b/test/files/run/reify_newimpl_48.scala new file mode 100644 index 0000000000..1522509907 --- /dev/null +++ b/test/files/run/reify_newimpl_48.scala @@ -0,0 +1,20 @@ +import scala.reflect.mirror._ + +object Test extends App { + val outer1 = { + val x = 2 + reify{x} + } + + val outer2 = { + val x = 3 + reify{x} + } + + val code = reify{ + val x = 4 + x + outer1.eval + outer2.eval + } + + println(code.eval) +} diff --git a/test/files/run/reify_newimpl_49.check b/test/files/run/reify_newimpl_49.check new file mode 100644 index 0000000000..d8a621df00 --- /dev/null +++ b/test/files/run/reify_newimpl_49.check @@ -0,0 +1,3 @@ +3 +3 +5 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_49.scala b/test/files/run/reify_newimpl_49.scala new file mode 100644 index 0000000000..68d968e28b --- /dev/null +++ b/test/files/run/reify_newimpl_49.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var y = 1 + def x = { y += 2; y } + val code = reify { + def foo = y // ensures that y is the first freevar we find + println(x) + println(y) + println(x) + } + code.eval + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_50.check b/test/files/run/reify_newimpl_50.check new file mode 100644 index 0000000000..d8a621df00 --- /dev/null +++ b/test/files/run/reify_newimpl_50.check @@ -0,0 +1,3 @@ +3 +3 +5 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_50.scala b/test/files/run/reify_newimpl_50.scala new file mode 100644 index 0000000000..b81d72a4eb --- /dev/null +++ b/test/files/run/reify_newimpl_50.scala @@ -0,0 +1,14 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var y = 1 + def x = { y += 2; y } + val code = reify { + println(x) + println(y) + println(x) + } + code.eval + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_51.check b/test/files/run/reify_newimpl_51.check new file mode 100644 index 0000000000..9a4ddeacd3 --- /dev/null +++ b/test/files/run/reify_newimpl_51.check @@ -0,0 +1,3 @@ +2 +1 +2 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_51.scala b/test/files/run/reify_newimpl_51.scala new file mode 100644 index 0000000000..ccbae2e160 --- /dev/null +++ b/test/files/run/reify_newimpl_51.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var counter = 0 + lazy val x = { counter += 1; counter } + lazy val y = { counter += 1; counter } + val code = reify { + def foo = y // ensures that y is the first freevar we find + val bar = reify { println(x * y) } + bar.eval + println(x) + println(y) + } + code.eval + } +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_52.check b/test/files/run/reify_newimpl_52.check new file mode 100644 index 0000000000..9359a2b211 --- /dev/null +++ b/test/files/run/reify_newimpl_52.check @@ -0,0 +1,3 @@ +2 +2 +1 \ No newline at end of file diff --git a/test/files/run/reify_newimpl_52.scala b/test/files/run/reify_newimpl_52.scala new file mode 100644 index 0000000000..60b16d3618 --- /dev/null +++ b/test/files/run/reify_newimpl_52.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + var counter = 0 + lazy val x = { counter += 1; counter } + lazy val y = { counter += 1; counter } + val code = reify { + def foo = y // ensures that y is the first freevar we find + val bar = reify { println(y * x) } + bar.eval + println(x) + println(y) + } + code.eval + } +} \ No newline at end of file diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index cd6052bc5e..dc092c1a85 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -1,19 +1,15 @@ import java.io.{ ByteArrayOutputStream, PrintStream } -import scala.reflect.Code import scala.reflect.mirror._ import scala.reflect.api._ import scala.reflect.api.Trees import scala.reflect.internal.Types -import reflect.runtime.Mirror.ToolBox -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings import scala.util.matching.Regex object Test extends App { - val tree = tree_printf(Code.lift("hello %s").tree, Code.lift("world").tree) + val tree = tree_printf(reify("hello %s").tree, reify("world").tree) - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter, args mkString " ") + import scala.reflect.mirror._ + val toolbox = mkToolBox() val output = new ByteArrayOutputStream() Console.setOut(new PrintStream(output)) @@ -22,6 +18,7 @@ object Test extends App { assert(output.toString() == "hello world", output.toString() +" == hello world") /* + // upd. Oh, good old times, our very-very first experiments with macros :) macro def printf(format: String, params: Any*) : String = tree_printf(format: Tree, (params: Seq[Tree]): _*) */ diff --git a/test/files/run/reify_sort.scala b/test/files/run/reify_sort.scala index 5984a64967..0b373b358f 100644 --- a/test/files/run/reify_sort.scala +++ b/test/files/run/reify_sort.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { /** Nested methods can use and even update everything * visible in their scope (including local variables or * arguments of enclosing methods). @@ -48,9 +46,5 @@ object Test extends App { println(ar) sort(ar) println(ar) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_sort1.scala b/test/files/run/reify_sort1.scala index 6f365dea26..56125619e9 100644 --- a/test/files/run/reify_sort1.scala +++ b/test/files/run/reify_sort1.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { def sort(a: List[Int]): List[Int] = { if (a.length < 2) a @@ -18,9 +16,5 @@ object Test extends App { val xs = List(6, 2, 8, 5, 1) println(xs) println(sort(xs)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_this.scala b/test/files/run/reify_this.scala index ee1f116013..280d735ab6 100644 --- a/test/files/run/reify_this.scala +++ b/test/files/run/reify_this.scala @@ -1,30 +1,19 @@ -import scala.reflect._ -import scala.reflect.Code._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ trait Eval { - def eval(code: Code): Any = eval(code.tree) - - def eval(tree: Tree): Any = { - val settings = new Settings - val reporter = new ConsoleReporter(settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(tree) - } + def eval(tree: Expr[_]) = tree.eval } object Test extends App with Eval { // select a value from package - eval(lift{println("foo")}) - eval(lift{println((new Object).toString == (new Object).toString)}) + eval(reify{println("foo")}) + eval(reify{println((new Object).toString == (new Object).toString)}) // select a type from package - eval(lift{val x: Any = 2; println(x)}) - eval(lift{val x: Object = "bar"; println(x)}) + eval(reify{val x: Any = 2; println(x)}) + eval(reify{val x: Object = "bar"; println(x)}) // select a value from module val x = 2 - eval(lift{println(x)}) + eval(reify{println(x)}) } diff --git a/test/files/run/reify_timeofday.scala b/test/files/run/reify_timeofday.scala index 122d7a6d52..481ab04df5 100644 --- a/test/files/run/reify_timeofday.scala +++ b/test/files/run/reify_timeofday.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class DateError extends Exception /** Simulating properties in Scala @@ -39,9 +37,5 @@ object Test extends App { case de: DateError => println("DateError") case e: Exception => println("Exception") } - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/reify_typerefs_1a.check b/test/files/run/reify_typerefs_1a.check new file mode 100644 index 0000000000..919c298ba3 --- /dev/null +++ b/test/files/run/reify_typerefs_1a.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/test/files/run/reify_typerefs_1a.scala b/test/files/run/reify_typerefs_1a.scala new file mode 100644 index 0000000000..15d8d17835 --- /dev/null +++ b/test/files/run/reify_typerefs_1a.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +class Expression { + override def toString = "Expression" +} + +object Test extends App { + val code = reify { + List(new Expression, new Expression) + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_typerefs_1b.check b/test/files/run/reify_typerefs_1b.check new file mode 100644 index 0000000000..919c298ba3 --- /dev/null +++ b/test/files/run/reify_typerefs_1b.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/test/files/run/reify_typerefs_1b.scala b/test/files/run/reify_typerefs_1b.scala new file mode 100644 index 0000000000..06ce1e35ac --- /dev/null +++ b/test/files/run/reify_typerefs_1b.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Expression { + override def toString = "Expression" +} + +object Test extends App { + val code = reify { + List(Expression, Expression) + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_typerefs_2a.check b/test/files/run/reify_typerefs_2a.check new file mode 100644 index 0000000000..919c298ba3 --- /dev/null +++ b/test/files/run/reify_typerefs_2a.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/test/files/run/reify_typerefs_2a.scala b/test/files/run/reify_typerefs_2a.scala new file mode 100644 index 0000000000..d03efea222 --- /dev/null +++ b/test/files/run/reify_typerefs_2a.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +package foo { + class Expression { + override def toString = "Expression" + } +} + +object Test extends App { + val code = reify { + List(new foo.Expression, new foo.Expression) + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_typerefs_2b.check b/test/files/run/reify_typerefs_2b.check new file mode 100644 index 0000000000..919c298ba3 --- /dev/null +++ b/test/files/run/reify_typerefs_2b.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/test/files/run/reify_typerefs_2b.scala b/test/files/run/reify_typerefs_2b.scala new file mode 100644 index 0000000000..3d9f7d61b8 --- /dev/null +++ b/test/files/run/reify_typerefs_2b.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +package foo { + object Expression { + override def toString = "Expression" + } +} + +object Test extends App { + val code = reify { + List(foo.Expression, foo.Expression) + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_typerefs_3a.check b/test/files/run/reify_typerefs_3a.check new file mode 100644 index 0000000000..919c298ba3 --- /dev/null +++ b/test/files/run/reify_typerefs_3a.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/test/files/run/reify_typerefs_3a.scala b/test/files/run/reify_typerefs_3a.scala new file mode 100644 index 0000000000..4128073f60 --- /dev/null +++ b/test/files/run/reify_typerefs_3a.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +object foo { + class Expression { + override def toString = "Expression" + } +} + +object Test extends App { + val code = reify { + List(new foo.Expression, new foo.Expression) + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_typerefs_3b.check b/test/files/run/reify_typerefs_3b.check new file mode 100644 index 0000000000..919c298ba3 --- /dev/null +++ b/test/files/run/reify_typerefs_3b.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/test/files/run/reify_typerefs_3b.scala b/test/files/run/reify_typerefs_3b.scala new file mode 100644 index 0000000000..a7ede00c9c --- /dev/null +++ b/test/files/run/reify_typerefs_3b.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +object foo { + object Expression { + override def toString = "Expression" + } +} + +object Test extends App { + val code = reify { + List(foo.Expression, foo.Expression) + }; + + val toolbox = mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} diff --git a/test/files/run/reify_varargs.scala b/test/files/run/reify_varargs.scala index 175cfb5db0..fe8f03b702 100644 --- a/test/files/run/reify_varargs.scala +++ b/test/files/run/reify_varargs.scala @@ -1,16 +1,10 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { val msg = java.text.MessageFormat.format( "On {1} there was {2} on planet {0}.", "Hoth", "the fifth of August", "a disturbance in the Force") println("Message="+msg) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index 1e7b6f0cd8..b811a4a8c5 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -1,32 +1,32 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> :power -** Power User mode enabled - BEEP WHIR GYVE ** -** :phase has been set to 'typer'. ** -** scala.tools.nsc._ has been imported ** -** global._, definitions._ also imported ** -** Try :help, :vals, power. ** - -scala> // guarding against "error: reference to global is ambiguous" - -scala> global.emptyValDef // "it is imported twice in the same scope by ..." -res0: $r.global.emptyValDef.type = private val _ = _ - -scala> val tp = ArrayClass[scala.util.Random] // magic with manifests -tp: $r.global.Type = Array[scala.util.Random] - -scala> tp.memberType(Array_apply) // evidence -res1: $r.global.Type = (i: Int)scala.util.Random - -scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl -m: $r.treedsl.global.Match = -10 match { - case 5 => false - case _ => true -} - -scala> typed(m).tpe // typed is in scope -res2: $r.treedsl.global.Type = Boolean - -scala> +Type in expressions to have them evaluated. +Type :help for more information. + +scala> :power +** Power User mode enabled - BEEP WHIR GYVE ** +** :phase has been set to 'typer'. ** +** scala.tools.nsc._ has been imported ** +** global._, definitions._ also imported ** +** Try :help, :vals, power. ** + +scala> // guarding against "error: reference to global is ambiguous" + +scala> global.emptyValDef // "it is imported twice in the same scope by ..." +res0: $r.global.emptyValDef.type = private val _ = _ + +scala> val tp = ArrayClass[scala.util.Random] // magic with manifests +tp: $r.global.Type = Array[scala.util.Random] + +scala> tp.memberType(Array_apply) // evidence +res1: $r.global.Type = (i: Int)scala.util.Random + +scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl +m: $r.treedsl.global.Match = +10 match { + case 5 => false + case _ => true +} + +scala> typed(m).tpe // typed is in scope +res2: $r.treedsl.global.Type = Boolean + +scala> diff --git a/test/files/run/t1195.check b/test/files/run/t1195.check deleted file mode 100644 index d023bc91f7..0000000000 --- a/test/files/run/t1195.check +++ /dev/null @@ -1,6 +0,0 @@ -_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object -_ <: Object with scala.Product with scala.Serializable -Object with scala.Product with scala.Serializable -_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object -_ <: Object with scala.Product with scala.Serializable -Object with scala.Product with scala.Serializable diff --git a/test/files/run/t1195.check.temporarily.disabled b/test/files/run/t1195.check.temporarily.disabled new file mode 100644 index 0000000000..d023bc91f7 --- /dev/null +++ b/test/files/run/t1195.check.temporarily.disabled @@ -0,0 +1,6 @@ +_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object +_ <: Object with scala.Product with scala.Serializable +Object with scala.Product with scala.Serializable +_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object +_ <: Object with scala.Product with scala.Serializable +Object with scala.Product with scala.Serializable diff --git a/test/files/run/t1195.scala b/test/files/run/t1195.scala deleted file mode 100644 index 81ef5bdb0e..0000000000 --- a/test/files/run/t1195.scala +++ /dev/null @@ -1,26 +0,0 @@ -object Test { - def f() = { case class Bar(x: Int); Bar } - def g() = { case class Bar(x: Int); Bar(5) } - def h() = { case object Bar ; Bar } - - val f1 = f() - val g1 = g() - val h1 = h() - - def m[T: Manifest](x: T) = println(manifest[T]) - - def main(args: Array[String]): Unit = { - m(f) - m(g) - m(h) - m(f1) - m(g1) - m(h1) - } -} - -class A1[T] { - class B1[U] { - def f = { case class D(x: Int) extends A1[String] ; new D(5) } - } -} diff --git a/test/files/run/t1195.scala.temporarily.disabled b/test/files/run/t1195.scala.temporarily.disabled new file mode 100644 index 0000000000..81ef5bdb0e --- /dev/null +++ b/test/files/run/t1195.scala.temporarily.disabled @@ -0,0 +1,26 @@ +object Test { + def f() = { case class Bar(x: Int); Bar } + def g() = { case class Bar(x: Int); Bar(5) } + def h() = { case object Bar ; Bar } + + val f1 = f() + val g1 = g() + val h1 = h() + + def m[T: Manifest](x: T) = println(manifest[T]) + + def main(args: Array[String]): Unit = { + m(f) + m(g) + m(h) + m(f1) + m(g1) + m(h1) + } +} + +class A1[T] { + class B1[U] { + def f = { case class D(x: Int) extends A1[String] ; new D(5) } + } +} diff --git a/test/files/run/t3758.check b/test/files/run/t3758.check new file mode 100644 index 0000000000..9c6ab655a3 --- /dev/null +++ b/test/files/run/t3758.check @@ -0,0 +1,6 @@ +List(String) +List(Int) +List(Float) +List(String) +List(Int) +List(Float) diff --git a/test/files/run/t3758.scala b/test/files/run/t3758.scala index 18750b0a9c..10bfb5724b 100644 --- a/test/files/run/t3758.scala +++ b/test/files/run/t3758.scala @@ -1,10 +1,10 @@ object Test { def main(args: Array[String]): Unit = { - assert(classManifest[Array[String]].typeArguments contains classManifest[String]) - assert(classManifest[Array[Int]].typeArguments contains classManifest[Int]) - assert(classManifest[Array[Float]].typeArguments contains classManifest[Float]) - assert(manifest[Array[String]].typeArguments contains manifest[String]) - assert(manifest[Array[Int]].typeArguments contains manifest[Int]) - assert(manifest[Array[Float]].typeArguments contains manifest[Float]) + println(classManifest[Array[String]].tpe.typeArguments) + println(classManifest[Array[Int]].tpe.typeArguments) + println(classManifest[Array[Float]].tpe.typeArguments) + println(manifest[Array[String]].tpe.typeArguments) + println(manifest[Array[Int]].tpe.typeArguments) + println(manifest[Array[Float]].tpe.typeArguments) } } diff --git a/test/files/run/t4110.check b/test/files/run/t4110.check deleted file mode 100644 index 8b005989de..0000000000 --- a/test/files/run/t4110.check +++ /dev/null @@ -1,2 +0,0 @@ -Object with Test$A with Test$B -Object with Test$A with Test$B diff --git a/test/files/run/t4110.check.temporarily.disabled b/test/files/run/t4110.check.temporarily.disabled new file mode 100644 index 0000000000..8b005989de --- /dev/null +++ b/test/files/run/t4110.check.temporarily.disabled @@ -0,0 +1,2 @@ +Object with Test$A with Test$B +Object with Test$A with Test$B diff --git a/test/files/run/t4110.scala b/test/files/run/t4110.scala deleted file mode 100644 index 4bd377b73e..0000000000 --- a/test/files/run/t4110.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test extends App { - def inferredType[T : Manifest](v : T) = println(manifest[T]) - - trait A - trait B - - inferredType(new A with B) - - val name = new A with B - inferredType(name) -} \ No newline at end of file diff --git a/test/files/run/t4110.scala.temporarily.disabled b/test/files/run/t4110.scala.temporarily.disabled new file mode 100644 index 0000000000..4bd377b73e --- /dev/null +++ b/test/files/run/t4110.scala.temporarily.disabled @@ -0,0 +1,11 @@ +object Test extends App { + def inferredType[T : Manifest](v : T) = println(manifest[T]) + + trait A + trait B + + inferredType(new A with B) + + val name = new A with B + inferredType(name) +} \ No newline at end of file diff --git a/test/files/run/t5224.check b/test/files/run/t5224.check index 28bc75d4fd..c754f23551 100644 --- a/test/files/run/t5224.check +++ b/test/files/run/t5224.check @@ -1,9 +1,9 @@ -{ - @new Foo(bar = "qwe") class C extends scala.AnyRef { - def () = { - super.(); - () - } - }; - () -} +{ + @new Foo(bar = "qwe") class C extends Object { + def () = { + super.(); + () + } + }; + () +} diff --git a/test/files/run/t5224.scala b/test/files/run/t5224.scala index 2226a69a05..93b244e03e 100644 --- a/test/files/run/t5224.scala +++ b/test/files/run/t5224.scala @@ -1,9 +1,8 @@ -import scala.reflect._ -import scala.reflect.api._ +import scala.reflect.mirror._ class Foo(bar: String) extends ClassfileAnnotation object Test extends App { - val tree = scala.reflect.Code.lift{@Foo(bar = "qwe") class C}.tree + val tree = reify{@Foo(bar = "qwe") class C}.tree println(tree.toString) } \ No newline at end of file diff --git a/test/files/run/t5225_1.check b/test/files/run/t5225_1.check index 719da572c7..40db2468b1 100644 --- a/test/files/run/t5225_1.check +++ b/test/files/run/t5225_1.check @@ -1,4 +1,4 @@ -{ - @new transient() @new volatile() var x: Int = 2; - () -} +{ + @new transient() @new volatile() var x = 2; + () +} diff --git a/test/files/run/t5225_1.scala b/test/files/run/t5225_1.scala index a655b7dd71..5e1d3b1f17 100644 --- a/test/files/run/t5225_1.scala +++ b/test/files/run/t5225_1.scala @@ -1,7 +1,6 @@ -import scala.reflect._ -import scala.reflect.api._ +import scala.reflect.mirror._ object Test extends App { - val tree = scala.reflect.Code.lift{@transient @volatile var x = 2}.tree + val tree = reify{@transient @volatile var x = 2}.tree println(tree.toString) } \ No newline at end of file diff --git a/test/files/run/t5225_2.check b/test/files/run/t5225_2.check index c4f6b4761e..8cd2ddc1a4 100644 --- a/test/files/run/t5225_2.check +++ b/test/files/run/t5225_2.check @@ -1,4 +1,4 @@ -{ - def foo(@new cloneable() x: Int): String = ""; - () -} +{ + def foo(@new cloneable() x: Int) = ""; + () +} diff --git a/test/files/run/t5225_2.scala b/test/files/run/t5225_2.scala index 65ea9b2f73..4cab640fe8 100644 --- a/test/files/run/t5225_2.scala +++ b/test/files/run/t5225_2.scala @@ -1,7 +1,6 @@ -import scala.reflect._ -import scala.reflect.api._ +import scala.reflect.mirror._ object Test extends App { - val tree = scala.reflect.Code.lift{def foo(@cloneable x: Int) = ""}.tree + val tree = reify{def foo(@cloneable x: Int) = ""}.tree println(tree.toString) } \ No newline at end of file diff --git a/test/files/run/t5229_1.scala b/test/files/run/t5229_1.scala index d5af569656..273079a89d 100644 --- a/test/files/run/t5229_1.scala +++ b/test/files/run/t5229_1.scala @@ -1,13 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { object C - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5229_2.scala b/test/files/run/t5229_2.scala index 07f9ac6b84..85bf78ba31 100644 --- a/test/files/run/t5229_2.scala +++ b/test/files/run/t5229_2.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { object C { val x = 2 } @@ -11,8 +9,7 @@ object Test extends App { println(C.x) }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) } diff --git a/test/files/run/t5230.scala b/test/files/run/t5230.scala index d3106ca05c..e0632f591c 100644 --- a/test/files/run/t5230.scala +++ b/test/files/run/t5230.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { class C { val x = 2 } @@ -11,8 +9,7 @@ object Test extends App { println(new C().x) }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) } diff --git a/test/files/run/t5258a.check b/test/files/run/t5258a.check deleted file mode 100644 index 4e0b2da04c..0000000000 --- a/test/files/run/t5258a.check +++ /dev/null @@ -1 +0,0 @@ -int \ No newline at end of file diff --git a/test/files/run/t5258a.scala b/test/files/run/t5258a.scala deleted file mode 100644 index 8cc4249e06..0000000000 --- a/test/files/run/t5258a.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - -object Test extends App { - val code = scala.reflect.Code.lift{ - println(classOf[Int]) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) -} \ No newline at end of file diff --git a/test/files/run/t5266_1.scala b/test/files/run/t5266_1.scala index 4262bc7a7b..ebb432be71 100644 --- a/test/files/run/t5266_1.scala +++ b/test/files/run/t5266_1.scala @@ -1,15 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { def x = 2 println(x) }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) } \ No newline at end of file diff --git a/test/files/run/t5266_2.scala b/test/files/run/t5266_2.scala index d0f718dbd7..27c91c35a8 100644 --- a/test/files/run/t5266_2.scala +++ b/test/files/run/t5266_2.scala @@ -1,16 +1,13 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { def x = 2 def y = x println(y) }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) } diff --git a/test/files/run/t5269.scala b/test/files/run/t5269.scala index cab99f17e6..9026090b29 100644 --- a/test/files/run/t5269.scala +++ b/test/files/run/t5269.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { trait Z { val z = 2 } @@ -13,9 +11,5 @@ object Test extends App { } new X().println() - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5270.scala b/test/files/run/t5270.scala index 934cc13dea..476b610148 100644 --- a/test/files/run/t5270.scala +++ b/test/files/run/t5270.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class Y { def y = 100 } @@ -17,9 +15,5 @@ object Test extends App { } new X().println() - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5271_1.check b/test/files/run/t5271_1.check index 9b956da17a..7a728e5164 100644 --- a/test/files/run/t5271_1.check +++ b/test/files/run/t5271_1.check @@ -1,11 +1,11 @@ -{ - case class C extends Object with Product with Serializable { - val foo : Int = _; - val bar : Int = _; - def (foo: Int, bar: Int) = { - super.(); - () - } - }; - () -} +{ + case class C extends Product with Serializable { + val foo: Int = _; + val bar: Int = _; + def (foo: Int, bar: Int) = { + super.(); + () + } + }; + () +} diff --git a/test/files/run/t5271_1.scala b/test/files/run/t5271_1.scala index fbc57aead7..5baa57c290 100644 --- a/test/files/run/t5271_1.scala +++ b/test/files/run/t5271_1.scala @@ -1,13 +1,10 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { case class C(foo: Int, bar: Int) }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() println(code.tree) } diff --git a/test/files/run/t5271_2.check b/test/files/run/t5271_2.check index 27297febb6..d8d6edeffc 100644 --- a/test/files/run/t5271_2.check +++ b/test/files/run/t5271_2.check @@ -1,12 +1,12 @@ -{ - case class C extends Object with Product with Serializable { - val foo : Int = _; - val bar : Int = _; - def (foo: Int, bar: Int) = { - super.(); - () - } - }; - val c = C.apply(2, 2); - scala.this.Predef.println(c.foo.$times(c.bar)) -} +{ + case class C extends Product with Serializable { + val foo: Int = _; + val bar: Int = _; + def (foo: Int, bar: Int) = { + super.(); + () + } + }; + val c = C.apply(2, 2); + scala.this.Predef.println(c.foo.$times(c.bar)) +} diff --git a/test/files/run/t5271_2.scala b/test/files/run/t5271_2.scala index 4bfc574e00..9820ebe692 100644 --- a/test/files/run/t5271_2.scala +++ b/test/files/run/t5271_2.scala @@ -1,15 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { case class C(foo: Int, bar: Int) val c = C(2, 2) println(c.foo * c.bar) }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() println(code.tree) } diff --git a/test/files/run/t5271_3.check b/test/files/run/t5271_3.check index 9331c78959..1d4f47c5df 100644 --- a/test/files/run/t5271_3.check +++ b/test/files/run/t5271_3.check @@ -1,19 +1,19 @@ -{ - object C extends scala.AnyRef with Serializable { - def () = { - super.(); - () - }; - def qwe: Int = 4 - }; - case class C extends Object with Product with Serializable { - val foo : Int = _; - val bar : Int = _; - def (foo: Int, bar: Int) = { - super.(); - () - } - }; - val c = C.apply(2, 2); - scala.this.Predef.println(c.foo.$times(c.bar).$eq$eq(C.qwe)) -} +{ + object C extends Object { + def () = { + super.(); + () + }; + def qwe = 4 + }; + case class C extends Product with Serializable { + val foo: Int = _; + val bar: Int = _; + def (foo: Int, bar: Int) = { + super.(); + () + } + }; + val c = C.apply(2, 2); + scala.this.Predef.println(c.foo.$times(c.bar).$eq$eq(C.qwe)) +} diff --git a/test/files/run/t5271_3.scala b/test/files/run/t5271_3.scala index a085bdca4c..5fd94f4a2b 100644 --- a/test/files/run/t5271_3.scala +++ b/test/files/run/t5271_3.scala @@ -1,16 +1,13 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { object C { def qwe = 4 } case class C(foo: Int, bar: Int) val c = C(2, 2) println(c.foo * c.bar == C.qwe) }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() println(code.tree) } diff --git a/test/files/run/t5271_4.scala b/test/files/run/t5271_4.scala index c253b1adca..e13a331d9c 100644 --- a/test/files/run/t5271_4.scala +++ b/test/files/run/t5271_4.scala @@ -1,13 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { case object C - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5272_1.scala b/test/files/run/t5272_1.scala index 882287f033..46472babf3 100644 --- a/test/files/run/t5272_1.scala +++ b/test/files/run/t5272_1.scala @@ -1,16 +1,10 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { 2 match { case 2 => println("okay") case _ => println("not okay") } - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5272_2.scala b/test/files/run/t5272_2.scala index 48b6a670bb..f5bab44205 100644 --- a/test/files/run/t5272_2.scala +++ b/test/files/run/t5272_2.scala @@ -1,15 +1,9 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { 2 match { case x => println("okay" + x) } - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5273_1.scala b/test/files/run/t5273_1.scala index 80460a4ae6..1b491923b2 100644 --- a/test/files/run/t5273_1.scala +++ b/test/files/run/t5273_1.scala @@ -1,16 +1,10 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { List(1, 2, 3) match { case foo :: bar :: _ => println(foo * bar) case _ => println("this is getting out of hand!") } - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5273_2a.scala b/test/files/run/t5273_2a.scala index a7a336d8a7..062ff79d11 100644 --- a/test/files/run/t5273_2a.scala +++ b/test/files/run/t5273_2a.scala @@ -1,14 +1,8 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { val foo :: bar :: _ = List(1, 2, 3) println(foo * bar) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5273_2b.scala b/test/files/run/t5273_2b.scala index 85c40f0607..82f1de89f7 100644 --- a/test/files/run/t5273_2b.scala +++ b/test/files/run/t5273_2b.scala @@ -1,15 +1,9 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { val RegexParser = """(.*) \d+([A-Z]+) \| (.*) \|.*""".r val RegexParser(name, shortname, value) = "American Dollar 1USD | 2,8567 | sometext" println("name = %s, shortname = %s, value = %s".format(name, shortname, value)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5274_1.scala b/test/files/run/t5274_1.scala index 74a5b81bcb..7ef332aa05 100644 --- a/test/files/run/t5274_1.scala +++ b/test/files/run/t5274_1.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { def factorial(n: BigInt): BigInt = if (n == 0) 1 else n * factorial(n-1) @@ -11,9 +9,5 @@ object Test extends App { println("50! = " + f50) println("49! = " + f49) println("50!/49! = " + (f50 / f49)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5274_2.scala b/test/files/run/t5274_2.scala index 5984a64967..0b373b358f 100644 --- a/test/files/run/t5274_2.scala +++ b/test/files/run/t5274_2.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { /** Nested methods can use and even update everything * visible in their scope (including local variables or * arguments of enclosing methods). @@ -48,9 +46,5 @@ object Test extends App { println(ar) sort(ar) println(ar) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5275.scala b/test/files/run/t5275.scala index 285d8a18a4..534672be3c 100644 --- a/test/files/run/t5275.scala +++ b/test/files/run/t5275.scala @@ -1,14 +1,8 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class C(val foo: Int) println(new C(2).foo) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5276_1a.scala b/test/files/run/t5276_1a.scala index b717675824..a6e327c0e7 100644 --- a/test/files/run/t5276_1a.scala +++ b/test/files/run/t5276_1a.scala @@ -1,14 +1,8 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { lazy val x = 2 println(x) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5276_1b.scala b/test/files/run/t5276_1b.scala index 1ff25504ca..1bc3e246c9 100644 --- a/test/files/run/t5276_1b.scala +++ b/test/files/run/t5276_1b.scala @@ -1,14 +1,8 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { implicit lazy val x = 2 println(implicitly[Int]) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5276_2a.scala b/test/files/run/t5276_2a.scala index af5ff2a565..cdd87ddc9e 100644 --- a/test/files/run/t5276_2a.scala +++ b/test/files/run/t5276_2a.scala @@ -1,17 +1,11 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class C { lazy val x = 2 } println(new C().x) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5276_2b.scala b/test/files/run/t5276_2b.scala index 63904b2898..2fac951731 100644 --- a/test/files/run/t5276_2b.scala +++ b/test/files/run/t5276_2b.scala @@ -1,18 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class C { implicit lazy val x = 2 def y = implicitly[Int] } println(new C().y) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5277_1.scala b/test/files/run/t5277_1.scala index 0aaec7cdf2..f95e9ab6ec 100644 --- a/test/files/run/t5277_1.scala +++ b/test/files/run/t5277_1.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { def fact(n: Int): BigInt = if (n == 0) 1 else fact(n-1) * n class Factorizer(n: Int) { @@ -12,9 +10,5 @@ object Test extends App { implicit def int2fact(n: Int) = new Factorizer(n) println("10! = " + (10!)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5277_2.scala b/test/files/run/t5277_2.scala index 91ed55122a..5f1737f503 100644 --- a/test/files/run/t5277_2.scala +++ b/test/files/run/t5277_2.scala @@ -1,17 +1,11 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { def p(implicit i: Int) = print(i) implicit val v = 2 println(p) println(p(1)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5279.scala b/test/files/run/t5279.scala index cef58535d5..aab5588877 100644 --- a/test/files/run/t5279.scala +++ b/test/files/run/t5279.scala @@ -1,13 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { println(new Integer(10)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5334_1.scala b/test/files/run/t5334_1.scala index 9887bebf78..49dbea6b68 100644 --- a/test/files/run/t5334_1.scala +++ b/test/files/run/t5334_1.scala @@ -1,14 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { class C { override def toString = "C" } - new C + val ret = new C + ret.asInstanceOf[Object] }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() println(toolbox.runExpr(code.tree)) } diff --git a/test/files/run/t5334_2.scala b/test/files/run/t5334_2.scala index 775a05aaf7..c6a77158dd 100644 --- a/test/files/run/t5334_2.scala +++ b/test/files/run/t5334_2.scala @@ -1,14 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + val code = reify { class C { override def toString() = "C" } - List((new C, new C)) + val ret = List((new C, new C)) + ret.asInstanceOf[List[Any]] }; - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() println(toolbox.runExpr(code.tree)) } diff --git a/test/files/run/t5335.scala b/test/files/run/t5335.scala index 8e2ed59db6..a0fe6c5822 100644 --- a/test/files/run/t5335.scala +++ b/test/files/run/t5335.scala @@ -1,13 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { println(new {def x = 2}.x) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/files/run/t5415.scala b/test/files/run/t5415.scala index 3db356da86..c6552f69b3 100644 --- a/test/files/run/t5415.scala +++ b/test/files/run/t5415.scala @@ -1,14 +1,10 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import scala.reflect.runtime.Mirror.ToolBox - object Test extends App{ case class Queryable2[T]() { def filter(predicate: T => Boolean) = ??? } trait CoffeesTable{ def sales : Int } val q = Queryable2[CoffeesTable]() - val code = scala.reflect.Code.lift{q.filter(_.sales > 5)} + import scala.reflect.mirror._ + val code = reify{q.filter(_.sales > 5)} - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val ttree = toolbox.typeCheck(code.tree) } diff --git a/test/files/run/t5419.check b/test/files/run/t5419.check index 7e6d739354..50751b168e 100644 --- a/test/files/run/t5419.check +++ b/test/files/run/t5419.check @@ -1 +1 @@ -(5: Int(5) @Foo) +5: @Foo.asInstanceOf[Int] diff --git a/test/files/run/t5419.scala b/test/files/run/t5419.scala index 695786e5c4..d65d8f38c8 100644 --- a/test/files/run/t5419.scala +++ b/test/files/run/t5419.scala @@ -1,9 +1,8 @@ -import scala.reflect._ -import scala.reflect.api._ +import scala.reflect.mirror._ class Foo extends StaticAnnotation object Test extends App { - val tree = scala.reflect.Code.lift{5: @Foo}.tree + val tree = reify{(5: @Foo).asInstanceOf[Int]}.tree println(tree.toString) } \ No newline at end of file diff --git a/test/files/run/t5423.scala b/test/files/run/t5423.scala index fc507c417b..645c8c7c1d 100644 --- a/test/files/run/t5423.scala +++ b/test/files/run/t5423.scala @@ -1,7 +1,4 @@ -import java.lang.Class import scala.reflect.mirror._ -import scala.reflect.runtime.Mirror.ToolBox -import scala.reflect.Code final class table extends StaticAnnotation @table class A diff --git a/test/files/run/toolbox_console_reporter.check b/test/files/run/toolbox_console_reporter.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala new file mode 100644 index 0000000000..fd244b40ec --- /dev/null +++ b/test/files/run/toolbox_console_reporter.scala @@ -0,0 +1,16 @@ +import scala.reflect.mirror._ + +object Test extends App { + // todo. cannot test this unfortunately, because ConsoleReporter grabs Console.out too early + // todo. and isn't affected by Console.setOut employed by partest to intercept output + + //val toolbox = mkToolBox(reporter = mkConsoleReporter(), options = "-deprecation") + //toolbox.runExpr(reify{ + // object Utils { + // @deprecated("test", "2.10.0") + // def foo { println("hello") } + // } + // + // Utils.foo + //}) +} diff --git a/test/files/run/toolbox_default_reporter_is_silent.check b/test/files/run/toolbox_default_reporter_is_silent.check new file mode 100644 index 0000000000..ef0493b275 --- /dev/null +++ b/test/files/run/toolbox_default_reporter_is_silent.check @@ -0,0 +1 @@ +hello diff --git a/test/files/run/toolbox_default_reporter_is_silent.scala b/test/files/run/toolbox_default_reporter_is_silent.scala new file mode 100644 index 0000000000..78606e2abc --- /dev/null +++ b/test/files/run/toolbox_default_reporter_is_silent.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + val toolbox = mkToolBox() + toolbox.runExpr(reify{ + object Utils { + @deprecated("test", "2.10.0") + def foo { println("hello") } + } + + Utils.foo + }) +} diff --git a/test/files/run/toolbox_silent_reporter.check b/test/files/run/toolbox_silent_reporter.check new file mode 100644 index 0000000000..2d05b1e3f8 --- /dev/null +++ b/test/files/run/toolbox_silent_reporter.check @@ -0,0 +1,4 @@ +hello +============compiler messages============ +Info(NoPosition,method foo in object Utils is deprecated: test,WARNING) +========================================= diff --git a/test/files/run/toolbox_silent_reporter.scala b/test/files/run/toolbox_silent_reporter.scala new file mode 100644 index 0000000000..7e9259946b --- /dev/null +++ b/test/files/run/toolbox_silent_reporter.scala @@ -0,0 +1,16 @@ +import scala.reflect.mirror._ + +object Test extends App { + val toolbox = mkToolBox(options = "-deprecation") + toolbox.runExpr(reify{ + object Utils { + @deprecated("test", "2.10.0") + def foo { println("hello") } + } + + Utils.foo + }) + println("============compiler messages============") + toolbox.reporter.infos.foreach(println(_)) + println("=========================================") +} \ No newline at end of file diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.check b/test/files/run/toolbox_typecheck_implicitsdisabled.check new file mode 100644 index 0000000000..4bc64530ab --- /dev/null +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.check @@ -0,0 +1,5 @@ +{ + import scala.Predef._; + scala.Predef.any2ArrowAssoc[Int](1).->[Int](2) +} +scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective typecheck has failed: value -> is not a member of Int diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.scala b/test/files/run/toolbox_typecheck_implicitsdisabled.scala new file mode 100644 index 0000000000..9d52e91f73 --- /dev/null +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.scala @@ -0,0 +1,24 @@ +import scala.reflect.mirror._ + +object Test extends App { + val toolbox = mkToolBox() + + val tree1 = Block( + Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1))), + Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) + ) + val ttree1 = toolbox.typeCheck(tree1, withImplicitViewsDisabled = false) + println(ttree1) + + try { + val tree2 = Block( + Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1))), + Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) + ) + val ttree2 = toolbox.typeCheck(tree2, withImplicitViewsDisabled = true) + println(ttree2) + } catch { + case ex: Throwable => + println(ex) + } +} \ No newline at end of file diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check new file mode 100644 index 0000000000..fe2323ea06 --- /dev/null +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -0,0 +1,5 @@ +{ + val $mr: mr.type = mr; + $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.GroundTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)))) +} +mr.reify[Int](2) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala new file mode 100644 index 0000000000..7d2707d5e1 --- /dev/null +++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala @@ -0,0 +1,17 @@ +import scala.reflect.mirror._ + +object Test extends App { + val toolbox = mkToolBox() + val mrPkg = staticModule("scala.reflect.package") + val mrSym = selectTerm(mrPkg, "mirror") + val NullaryMethodType(mrTpe) = mrSym.typeSignature + val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror, null) + + val tree1 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) + println(ttree1) + + val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) + println(ttree2) +} diff --git a/test/files/run/treePrint.check b/test/files/run/treePrint.check deleted file mode 100644 index 3360815ac1..0000000000 --- a/test/files/run/treePrint.check +++ /dev/null @@ -1,5 +0,0 @@ -def foo = { - var q: Boolean = false; - val x = 5; - ((x == 5) || (!q)) || (true) -} diff --git a/test/files/run/treePrint.check.temporarily.disabled b/test/files/run/treePrint.check.temporarily.disabled new file mode 100644 index 0000000000..3360815ac1 --- /dev/null +++ b/test/files/run/treePrint.check.temporarily.disabled @@ -0,0 +1,5 @@ +def foo = { + var q: Boolean = false; + val x = 5; + ((x == 5) || (!q)) || (true) +} diff --git a/test/files/run/treePrint.scala b/test/files/run/treePrint.scala deleted file mode 100644 index e0332a705f..0000000000 --- a/test/files/run/treePrint.scala +++ /dev/null @@ -1,42 +0,0 @@ -/** Testing compact tree printers. - */ -object Test { - import scala.tools.nsc._ - import interpreter._ - import java.io.{ OutputStream, BufferedReader, StringReader, PrintWriter, Writer, OutputStreamWriter} - - val code = """ - def foo = { - var q: Boolean = false - val x = if (true) { - if (true) { - if (true) { - 5 - } - else if (true) { - 5 - } else { - 10 - } - } - else 20 - } - else 30 - - (x == 5) || !q || true - } - """ - - class NullOutputStream extends OutputStream { def write(b: Int) { } } - - def main(args: Array[String]) { - val settings = new Settings - settings.classpath.value = System.getProperty("java.class.path") - settings.Ycompacttrees.value = true - - val intp = new IMain(settings, new PrintWriter(new NullOutputStream)) - val power = new Power(intp, new ReplVals { }) - intp.interpret("""def initialize = "Have to interpret something or we get errors." """) - power trees code foreach println - } -} diff --git a/test/files/run/treePrint.scala.temporarily.disabled b/test/files/run/treePrint.scala.temporarily.disabled new file mode 100644 index 0000000000..e0332a705f --- /dev/null +++ b/test/files/run/treePrint.scala.temporarily.disabled @@ -0,0 +1,42 @@ +/** Testing compact tree printers. + */ +object Test { + import scala.tools.nsc._ + import interpreter._ + import java.io.{ OutputStream, BufferedReader, StringReader, PrintWriter, Writer, OutputStreamWriter} + + val code = """ + def foo = { + var q: Boolean = false + val x = if (true) { + if (true) { + if (true) { + 5 + } + else if (true) { + 5 + } else { + 10 + } + } + else 20 + } + else 30 + + (x == 5) || !q || true + } + """ + + class NullOutputStream extends OutputStream { def write(b: Int) { } } + + def main(args: Array[String]) { + val settings = new Settings + settings.classpath.value = System.getProperty("java.class.path") + settings.Ycompacttrees.value = true + + val intp = new IMain(settings, new PrintWriter(new NullOutputStream)) + val power = new Power(intp, new ReplVals { }) + intp.interpret("""def initialize = "Have to interpret something or we get errors." """) + power trees code foreach println + } +} diff --git a/test/files/run/typetags_core.check b/test/files/run/typetags_core.check new file mode 100644 index 0000000000..d1b71f0926 --- /dev/null +++ b/test/files/run/typetags_core.check @@ -0,0 +1,30 @@ +true +GroundTypeTag[Byte] +true +GroundTypeTag[Short] +true +GroundTypeTag[Char] +true +GroundTypeTag[Int] +true +GroundTypeTag[Long] +true +GroundTypeTag[Float] +true +GroundTypeTag[Double] +true +GroundTypeTag[Boolean] +true +GroundTypeTag[Unit] +true +GroundTypeTag[Any] +true +GroundTypeTag[Object] +true +GroundTypeTag[AnyVal] +true +GroundTypeTag[AnyRef] +true +GroundTypeTag[Null] +true +GroundTypeTag[Nothing] diff --git a/test/files/run/typetags_core.scala b/test/files/run/typetags_core.scala new file mode 100644 index 0000000000..883c54b9a8 --- /dev/null +++ b/test/files/run/typetags_core.scala @@ -0,0 +1,32 @@ +object Test extends App { + println(implicitly[TypeTag[Byte]] eq TypeTag.Byte) + println(implicitly[TypeTag[Byte]]) + println(implicitly[TypeTag[Short]] eq TypeTag.Short) + println(implicitly[TypeTag[Short]]) + println(implicitly[TypeTag[Char]] eq TypeTag.Char) + println(implicitly[TypeTag[Char]]) + println(implicitly[TypeTag[Int]] eq TypeTag.Int) + println(implicitly[TypeTag[Int]]) + println(implicitly[TypeTag[Long]] eq TypeTag.Long) + println(implicitly[TypeTag[Long]]) + println(implicitly[TypeTag[Float]] eq TypeTag.Float) + println(implicitly[TypeTag[Float]]) + println(implicitly[TypeTag[Double]] eq TypeTag.Double) + println(implicitly[TypeTag[Double]]) + println(implicitly[TypeTag[Boolean]] eq TypeTag.Boolean) + println(implicitly[TypeTag[Boolean]]) + println(implicitly[TypeTag[Unit]] eq TypeTag.Unit) + println(implicitly[TypeTag[Unit]]) + println(implicitly[TypeTag[Any]] eq TypeTag.Any) + println(implicitly[TypeTag[Any]]) + println(implicitly[TypeTag[Object]] eq TypeTag.Object) + println(implicitly[TypeTag[Object]]) + println(implicitly[TypeTag[AnyVal]] eq TypeTag.AnyVal) + println(implicitly[TypeTag[AnyVal]]) + println(implicitly[TypeTag[AnyRef]] eq TypeTag.AnyRef) + println(implicitly[TypeTag[AnyRef]]) + println(implicitly[TypeTag[Null]] eq TypeTag.Null) + println(implicitly[TypeTag[Null]]) + println(implicitly[TypeTag[Nothing]] eq TypeTag.Nothing) + println(implicitly[TypeTag[Nothing]]) +} \ No newline at end of file diff --git a/test/pending/neg/reify_packed.check b/test/pending/neg/reify_packed.check new file mode 100644 index 0000000000..adba330d56 --- /dev/null +++ b/test/pending/neg/reify_packed.check @@ -0,0 +1,4 @@ +reify_packed.scala:6: error: implementation restriction: cannot reify block of type List[_$1] 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/pending/neg/reify_packed.scala b/test/pending/neg/reify_packed.scala new file mode 100644 index 0000000000..0240f2a4b5 --- /dev/null +++ b/test/pending/neg/reify_packed.scala @@ -0,0 +1,10 @@ +object Test extends App { + reify { + class C { override def toString() = "C" } + val ret = List((new C, new C)) + ret.asInstanceOf[List[_]] + }; + + val toolbox = mkToolBox() + println(toolbox.runExpr(code.tree)) +} diff --git a/test/pending/run/macro-expand-default.flags b/test/pending/run/macro-expand-default.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-expand-default.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-expand-default/Impls_1.scala b/test/pending/run/macro-expand-default/Impls_1.scala new file mode 100644 index 0000000000..fefe8fc4e2 --- /dev/null +++ b/test/pending/run/macro-expand-default/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = { + import c.mirror._ + val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) + Expr[Unit](body) + } +} diff --git a/test/pending/run/macro-expand-default/Macros_Test_2.scala b/test/pending/run/macro-expand-default/Macros_Test_2.scala new file mode 100644 index 0000000000..92fe84d04a --- /dev/null +++ b/test/pending/run/macro-expand-default/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Test extends App { + def foo(x: Int = 2, y: Int = -40) = macro Impls.foo + foo(y = -40, x = 2) + foo(x = 2, y = -40) + foo(x = 100) + foo(y = 100) + foo() +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-implicit-macro-has-context-bound.check b/test/pending/run/macro-expand-implicit-macro-has-context-bound.check new file mode 100644 index 0000000000..ac4213d6e9 --- /dev/null +++ b/test/pending/run/macro-expand-implicit-macro-has-context-bound.check @@ -0,0 +1 @@ +43 \ No newline at end of file diff --git a/test/pending/run/macro-expand-implicit-macro-has-context-bound.flags b/test/pending/run/macro-expand-implicit-macro-has-context-bound.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-expand-implicit-macro-has-context-bound.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-expand-implicit-macro-has-context-bound/Impls_1.scala b/test/pending/run/macro-expand-implicit-macro-has-context-bound/Impls_1.scala new file mode 100644 index 0000000000..5c50576281 --- /dev/null +++ b/test/pending/run/macro-expand-implicit-macro-has-context-bound/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = { + import c.mirror._ + val plusOne = Apply(Select(evidence.tree, newTermName("plus")), List(x.tree, Literal(Constant(1)))) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusOne)) + Expr[Unit](body) + } +} diff --git a/test/pending/run/macro-expand-implicit-macro-has-context-bound/Macros_Test_2.scala b/test/pending/run/macro-expand-implicit-macro-has-context-bound/Macros_Test_2.scala new file mode 100644 index 0000000000..7d16b773a6 --- /dev/null +++ b/test/pending/run/macro-expand-implicit-macro-has-context-bound/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo[U: Numeric](x: U) = macro Impls.foo[U] + foo(42) +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-named.flags b/test/pending/run/macro-expand-named.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-expand-named.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-expand-named/Impls_1.scala b/test/pending/run/macro-expand-named/Impls_1.scala new file mode 100644 index 0000000000..fefe8fc4e2 --- /dev/null +++ b/test/pending/run/macro-expand-named/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = { + import c.mirror._ + val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) + Expr[Unit](body) + } +} diff --git a/test/pending/run/macro-expand-named/Macros_Test_2.scala b/test/pending/run/macro-expand-named/Macros_Test_2.scala new file mode 100644 index 0000000000..abebcf8448 --- /dev/null +++ b/test/pending/run/macro-expand-named/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + def foo(x: Int, y: Int) = macro Impls.foo + foo(y = -40, x = 2) + foo(x = 2, y = -40) +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-e1.check b/test/pending/run/macro-expand-tparams-prefix-e1.check new file mode 100644 index 0000000000..4fa05a7678 --- /dev/null +++ b/test/pending/run/macro-expand-tparams-prefix-e1.check @@ -0,0 +1,3 @@ +TypeTag(List[Int]) +TypeTag(String) +TypeTag(Boolean) diff --git a/test/pending/run/macro-expand-tparams-prefix-e1.flags b/test/pending/run/macro-expand-tparams-prefix-e1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-expand-tparams-prefix-e1.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala new file mode 100644 index 0000000000..bc880fdf77 --- /dev/null +++ b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + import c.mirror._ + Block(List( + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Literal(Constant(()))) + } +} diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Macros_Test_2.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Macros_Test_2.scala new file mode 100644 index 0000000000..5c863804d0 --- /dev/null +++ b/test/pending/run/macro-expand-tparams-prefix-e1/Macros_Test_2.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + class D[T: TypeTag] { + class C[U: TypeTag] { + def foo[V] = macro Impls.foo[List[T], U, V] + foo[Boolean] + } + } + + val outer1 = new D[Int] + new outer1.C[String] +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-f1.check b/test/pending/run/macro-expand-tparams-prefix-f1.check new file mode 100644 index 0000000000..d15226143a --- /dev/null +++ b/test/pending/run/macro-expand-tparams-prefix-f1.check @@ -0,0 +1,3 @@ +TypeTag(List[T]) +TypeTag(U) +TypeTag(Boolean) diff --git a/test/pending/run/macro-expand-tparams-prefix-f1.flags b/test/pending/run/macro-expand-tparams-prefix-f1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-expand-tparams-prefix-f1.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala new file mode 100644 index 0000000000..bc880fdf77 --- /dev/null +++ b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + import c.mirror._ + Block(List( + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Literal(Constant(()))) + } +} diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Macros_Test_2.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Macros_Test_2.scala new file mode 100644 index 0000000000..bc8e7ac75c --- /dev/null +++ b/test/pending/run/macro-expand-tparams-prefix-f1/Macros_Test_2.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + class D[T] { + class C[U] { + def foo[V] = macro Impls.foo[List[T], U, V] + foo[Boolean] + } + } + + val outer1 = new D[Int] + new outer1.C[String] +} \ No newline at end of file diff --git a/test/pending/run/macro-overload.check b/test/pending/run/macro-overload.check deleted file mode 100644 index 764f914e48..0000000000 --- a/test/pending/run/macro-overload.check +++ /dev/null @@ -1,4 +0,0 @@ -object-Int -object-String -class-Int -class-String \ No newline at end of file diff --git a/test/pending/run/macro-overload.flags b/test/pending/run/macro-overload.flags deleted file mode 100644 index 7fea2ff901..0000000000 --- a/test/pending/run/macro-overload.flags +++ /dev/null @@ -1 +0,0 @@ --Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-overload/Macros_1.scala b/test/pending/run/macro-overload/Macros_1.scala deleted file mode 100644 index f24c69ea7b..0000000000 --- a/test/pending/run/macro-overload/Macros_1.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Macros { - def macro bar(x: Int): Int = Apply(Select(Select(Ident("scala"), newTermName("Predef")), newTermName("println")), List(Literal(Constant("object-Int")))) - def macro bar(x: String): String = Apply(Select(Select(Ident("scala"), newTermName("Predef")), newTermName("println")), List(Literal(Constant("object-String")))) -} - -class Macros { - def macro bar(x: Int): Int = Apply(Select(Select(Ident("scala"), newTermName("Predef")), newTermName("println")), List(Literal(Constant("class-Int")))) - def macro bar(x: String): String = Apply(Select(Select(Ident("scala"), newTermName("Predef")), newTermName("println")), List(Literal(Constant("class-String")))) -} \ No newline at end of file diff --git a/test/pending/run/macro-overload/Test_2.scala b/test/pending/run/macro-overload/Test_2.scala deleted file mode 100644 index 75f6572e03..0000000000 --- a/test/pending/run/macro-overload/Test_2.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test extends App { - Macros.bar(2) - Macros.bar("2") - new Macros.bar(2) - new Macros.bar("2") -} \ No newline at end of file diff --git a/test/pending/run/macro-quasiinvalidbody-a.check b/test/pending/run/macro-quasiinvalidbody-a.check new file mode 100644 index 0000000000..f70d7bba4a --- /dev/null +++ b/test/pending/run/macro-quasiinvalidbody-a.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/test/pending/run/macro-quasiinvalidbody-a.flags b/test/pending/run/macro-quasiinvalidbody-a.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-quasiinvalidbody-a.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala b/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala new file mode 100644 index 0000000000..0da37cd5c0 --- /dev/null +++ b/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.makro.{Context => Ctx} + +trait Impls { + def impl(c: Ctx)(x: c.Expr[Any]) = x +} \ No newline at end of file diff --git a/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala b/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala new file mode 100644 index 0000000000..04a43080bd --- /dev/null +++ b/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros extends Impls { + def foo(x: Any) = macro impl +} + +object Test extends App { + import Macros._ + println(foo(42)) +} \ No newline at end of file diff --git a/test/pending/run/macro-quasiinvalidbody-b.check b/test/pending/run/macro-quasiinvalidbody-b.check new file mode 100644 index 0000000000..f70d7bba4a --- /dev/null +++ b/test/pending/run/macro-quasiinvalidbody-b.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/test/pending/run/macro-quasiinvalidbody-b.flags b/test/pending/run/macro-quasiinvalidbody-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-quasiinvalidbody-b.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala b/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala new file mode 100644 index 0000000000..d84d04974f --- /dev/null +++ b/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala @@ -0,0 +1,7 @@ +import scala.reflect.makro.{Context => Ctx} + +trait ImplContainer { + object Impls { + def foo(c: Ctx)(x: c.Expr[Any]) = x + } +} \ No newline at end of file diff --git a/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala b/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala new file mode 100644 index 0000000000..82f88b62e4 --- /dev/null +++ b/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros extends ImplContainer { + def foo(x: Any) = macro Impls.foo +} + +object Test extends App { + import Macros._ + println(foo(42)) +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-array.flags b/test/pending/run/macro-reify-array.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-reify-array.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-reify-array/Macros_1.scala b/test/pending/run/macro-reify-array/Macros_1.scala new file mode 100644 index 0000000000..af42321484 --- /dev/null +++ b/test/pending/run/macro-reify-array/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def foo[T](s: String) = macro Impls.foo[T] + + object Impls { + def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify { + Array(s.eval) + } + } +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-array/Test_2.scala b/test/pending/run/macro-reify-array/Test_2.scala new file mode 100644 index 0000000000..e40d5b40e0 --- /dev/null +++ b/test/pending/run/macro-reify-array/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val arr = Macros.foo("hello", "world") + println(arr.getClass) +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-eval-vs-value.flags b/test/pending/run/macro-reify-eval-vs-value.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-reify-eval-vs-value.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-reify-eval-vs-value/Macros_1.scala b/test/pending/run/macro-reify-eval-vs-value/Macros_1.scala new file mode 100644 index 0000000000..98dd93b0f8 --- /dev/null +++ b/test/pending/run/macro-reify-eval-vs-value/Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def fooEval(s: String) = macro Impls.fooEval + def fooValue(s: String) = macro Impls.fooValue + + object Impls { + def fooEval(c: Ctx)(s: c.Expr[String]) = c.reify { + println("hello " + s.eval) + println("hello " + s.eval) + } + + def fooValue(c: Ctx)(s: c.Expr[String]) = c.reify { + { + println("hello " + s.value) + def sayHello = println(s.value) + sayHello + } + println("hello " + s.eval); + { + println("hello " + s.eval) + } + } + } +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-eval-vs-value/Test_2.scala b/test/pending/run/macro-reify-eval-vs-value/Test_2.scala new file mode 100644 index 0000000000..8e62e6e0e7 --- /dev/null +++ b/test/pending/run/macro-reify-eval-vs-value/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + Macros.fooEval({ println("in ur logz"); "world"}) + println("======================") + Macros.fooValue({ println("i can has cheezburger?"); "world"}) +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags.check b/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags.check new file mode 100644 index 0000000000..7e4b000c52 --- /dev/null +++ b/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags.check @@ -0,0 +1,2 @@ +TypeTag(List[Int]) +TypeTag(List[List[Int]]) diff --git a/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala b/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala new file mode 100644 index 0000000000..4b264d83af --- /dev/null +++ b/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooTypeTagHK[C[_]: GroundTypeTag, T: GroundTypeTag] = { + println(implicitly[GroundTypeTag[C[T]]]) + println(implicitly[GroundTypeTag[List[C[T]]]]) + } + fooTypeTagHK[List, Int] +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-tagful-b.check b/test/pending/run/macro-reify-tagful-b.check new file mode 100644 index 0000000000..5bd9fe2156 --- /dev/null +++ b/test/pending/run/macro-reify-tagful-b.check @@ -0,0 +1 @@ +List(List(hello world)) diff --git a/test/pending/run/macro-reify-tagful-b.flags b/test/pending/run/macro-reify-tagful-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-reify-tagful-b.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-reify-tagful-b/Macros_1.scala b/test/pending/run/macro-reify-tagful-b/Macros_1.scala new file mode 100644 index 0000000000..38b839330b --- /dev/null +++ b/test/pending/run/macro-reify-tagful-b/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def foo[T](s: T) = macro Impls.foo[List[T]] + + object Impls { + def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify { + List(s.eval) + } + } +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-tagful-b/Test_2.scala b/test/pending/run/macro-reify-tagful-b/Test_2.scala new file mode 100644 index 0000000000..142234901f --- /dev/null +++ b/test/pending/run/macro-reify-tagful-b/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val list: List[List[String]] = Macros.foo(List("hello world")) + println(list) +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-tagless-b.check b/test/pending/run/macro-reify-tagless-b.check new file mode 100644 index 0000000000..49acd94ad6 --- /dev/null +++ b/test/pending/run/macro-reify-tagless-b.check @@ -0,0 +1,3 @@ +error: macro must not return an expr that contains free type variables (namely: T). have you forgot to use c.TypeTag annotations for type parameters external to a reifee? + +java.lang.Error: reflective compilation has failed diff --git a/test/pending/run/macro-reify-tagless-b.flags b/test/pending/run/macro-reify-tagless-b.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/pending/run/macro-reify-tagless-b.flags @@ -0,0 +1 @@ +-Xmacros \ No newline at end of file diff --git a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala new file mode 100644 index 0000000000..fac7ba5b98 --- /dev/null +++ b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.makro.{Context => Ctx} + +object Macros { + def foo[T](s: T) = macro Impls.foo[List[T]] + + object Impls { + def foo[T](c: Ctx)(s: c.Expr[T]) = c.reify { + List(s.eval) + } + } +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-tagless-b/Test_2.scala b/test/pending/run/macro-reify-tagless-b/Test_2.scala new file mode 100644 index 0000000000..419ee42101 --- /dev/null +++ b/test/pending/run/macro-reify-tagless-b/Test_2.scala @@ -0,0 +1,11 @@ +object Test extends App { + //val list: List[String] = Macros.foo("hello world") + //println(list) + + import scala.reflect.mirror._ + val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass))) + val rhs = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant("hello world")))) + val list = ValDef(NoMods, newTermName("list"), tpt, rhs) + val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name)))) + println(tree.eval) +} diff --git a/test/pending/run/macro-reify-typetag-hktypeparams-notags.check b/test/pending/run/macro-reify-typetag-hktypeparams-notags.check new file mode 100644 index 0000000000..db8a19d5f7 --- /dev/null +++ b/test/pending/run/macro-reify-typetag-hktypeparams-notags.check @@ -0,0 +1,2 @@ +TypeTag(C[T]) +TypeTag(List[C[T]]) diff --git a/test/pending/run/macro-reify-typetag-hktypeparams-notags/Test.scala b/test/pending/run/macro-reify-typetag-hktypeparams-notags/Test.scala new file mode 100644 index 0000000000..9a370189a7 --- /dev/null +++ b/test/pending/run/macro-reify-typetag-hktypeparams-notags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooNoTypeTagHK[C[_], T] = { + println(implicitly[TypeTag[C[T]]]) + println(implicitly[TypeTag[List[C[T]]]]) + } + fooNoTypeTagHK[List, Int] +} \ No newline at end of file diff --git a/test/pending/run/macro-reify-typetag-hktypeparams-tags.check b/test/pending/run/macro-reify-typetag-hktypeparams-tags.check new file mode 100644 index 0000000000..7e4b000c52 --- /dev/null +++ b/test/pending/run/macro-reify-typetag-hktypeparams-tags.check @@ -0,0 +1,2 @@ +TypeTag(List[Int]) +TypeTag(List[List[Int]]) diff --git a/test/pending/run/macro-reify-typetag-hktypeparams-tags/Test.scala b/test/pending/run/macro-reify-typetag-hktypeparams-tags/Test.scala new file mode 100644 index 0000000000..0358da9b0d --- /dev/null +++ b/test/pending/run/macro-reify-typetag-hktypeparams-tags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.mirror._ + +object Test extends App { + def fooTypeTagHK[C[_]: TypeTag, T: TypeTag] = { + println(implicitly[TypeTag[C[T]]]) + println(implicitly[TypeTag[List[C[T]]]]) + } + fooTypeTagHK[List, Int] +} \ No newline at end of file diff --git a/test/pending/run/reify_addressbook.scala b/test/pending/run/reify_addressbook.scala index 54dd5545bd..7cb6dc08fd 100644 --- a/test/pending/run/reify_addressbook.scala +++ b/test/pending/run/reify_addressbook.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { case class Person(name: String, age: Int) /** An AddressBook takes a variable number of arguments @@ -62,9 +60,5 @@ object Test extends App { ; println(page) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/reify_brainf_ck.scala b/test/pending/run/reify_brainf_ck.scala index 0034644b81..e4bcb257bd 100644 --- a/test/pending/run/reify_brainf_ck.scala +++ b/test/pending/run/reify_brainf_ck.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { import scala.annotation._ trait Func[T] { @@ -76,9 +74,5 @@ object Test extends App { <.#>+++++++++++[<+++++>-]<.>++++++++[<++ +>-]<.+++.------.--------.[-]>++++++++[<++++> -]<+.[-]++++++++++.""") - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/reify_callccinterpreter.scala b/test/pending/run/reify_callccinterpreter.scala index 96ae9c5c17..0e23f75dcc 100644 --- a/test/pending/run/reify_callccinterpreter.scala +++ b/test/pending/run/reify_callccinterpreter.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { type Answer = Value; /** @@ -85,9 +83,5 @@ object Test extends App { println(test(term0)) println(test(term1)) println(test(term2)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/reify_classfileann_b.check b/test/pending/run/reify_classfileann_b.check deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/pending/run/reify_classfileann_b.scala b/test/pending/run/reify_classfileann_b.scala deleted file mode 100644 index c31826377a..0000000000 --- a/test/pending/run/reify_classfileann_b.scala +++ /dev/null @@ -1,24 +0,0 @@ -import scala.reflect._ -import scala.reflect.api._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - -class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends ClassfileAnnotation - -object Test extends App { - // test 1: reify - val tree = scala.reflect.Code.lift{ - class C { - def x: Int = { - 2: @ann(bar="1", quux=Array("2", "3"), baz = new ann(bar = "4")) - } - } - }.tree - println(tree.toString) - - // test 2: import and compile - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(tree) -} \ No newline at end of file diff --git a/test/pending/run/reify_closure2b.scala b/test/pending/run/reify_closure2b.scala index b9c0063290..f9ed16d309 100644 --- a/test/pending/run/reify_closure2b.scala +++ b/test/pending/run/reify_closure2b.scala @@ -1,17 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - object Test extends App { def foo(y: Int): Int => Int = { class Foo(y: Int) { - val fun = reflect.Code.lift{(x: Int) => { + val fun = reflect.mirror.reify{(x: Int) => { x + y }} } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/pending/run/reify_closure3b.scala b/test/pending/run/reify_closure3b.scala index 8f161dbff3..8ef0a60c66 100644 --- a/test/pending/run/reify_closure3b.scala +++ b/test/pending/run/reify_closure3b.scala @@ -1,19 +1,14 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - object Test extends App { def foo(y: Int): Int => Int = { class Foo(y: Int) { def y1 = y - val fun = reflect.Code.lift{(x: Int) => { + val fun = reflect.mirror.reify{(x: Int) => { x + y1 }} } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/pending/run/reify_closure4b.scala b/test/pending/run/reify_closure4b.scala index 238795d4dd..9eeb01b459 100644 --- a/test/pending/run/reify_closure4b.scala +++ b/test/pending/run/reify_closure4b.scala @@ -1,19 +1,14 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - object Test extends App { def foo(y: Int): Int => Int = { class Foo(y: Int) { val y1 = y - val fun = reflect.Code.lift{(x: Int) => { + val fun = reflect.mirror.reify{(x: Int) => { x + y1 }} } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/pending/run/reify_closure5b.scala b/test/pending/run/reify_closure5b.scala index bdb2583e8a..51f1ec318d 100644 --- a/test/pending/run/reify_closure5b.scala +++ b/test/pending/run/reify_closure5b.scala @@ -1,17 +1,12 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - object Test extends App { def foo[T](ys: List[T]): Int => Int = { class Foo[T](ys: List[T]) { - val fun = reflect.Code.lift{(x: Int) => { + val fun = reflect.mirror.reify{(x: Int) => { x + ys.length }} } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(new Foo(ys).fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/pending/run/reify_closure8b.check b/test/pending/run/reify_closure8b.check deleted file mode 100644 index 9a037142aa..0000000000 --- a/test/pending/run/reify_closure8b.check +++ /dev/null @@ -1 +0,0 @@ -10 \ No newline at end of file diff --git a/test/pending/run/reify_closure8b.scala b/test/pending/run/reify_closure8b.scala deleted file mode 100644 index 38031c217b..0000000000 --- a/test/pending/run/reify_closure8b.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.reflect.Code._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - -object Test extends App { - class Foo(y: Int) { - def fun = lift{y} - } - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - val dyn = toolbox.runExpr(new Foo(10).fun.tree) - val foo = dyn.asInstanceOf[Int] - println(foo) -} diff --git a/test/pending/run/reify_closure9a.scala b/test/pending/run/reify_closure9a.scala index 185f4ffca1..1fc18cfa13 100644 --- a/test/pending/run/reify_closure9a.scala +++ b/test/pending/run/reify_closure9a.scala @@ -1,16 +1,11 @@ -import scala.reflect.Code._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - +import scala.reflect.mirror._ object Test extends App { def foo(y: Int) = { class Foo(val y: Int) { - def fun = lift{y} + def fun = reify{y} } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int] } diff --git a/test/pending/run/reify_closure9b.scala b/test/pending/run/reify_closure9b.scala index ad279fac6d..32b05d00ee 100644 --- a/test/pending/run/reify_closure9b.scala +++ b/test/pending/run/reify_closure9b.scala @@ -1,16 +1,11 @@ -import scala.reflect.Code._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - +import scala.reflect.mirror._ object Test extends App { def foo(y: Int) = { class Foo(y: Int) { - def fun = lift{y} + def fun = reify{y} } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int] } diff --git a/test/pending/run/reify_closures11.scala b/test/pending/run/reify_closures11.scala index 2c4177b8f2..ceb224c6d6 100644 --- a/test/pending/run/reify_closures11.scala +++ b/test/pending/run/reify_closures11.scala @@ -1,16 +1,11 @@ -import scala.reflect.Code._ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - +import scala.reflect.mirror._ object Test extends App { def fun() = { def z() = 2 - lift{z} + reify{z} } - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) + val toolbox = mkToolBox() val dyn = toolbox.runExpr(fun().tree) val foo = dyn.asInstanceOf[Int] println(foo) diff --git a/test/pending/run/reify_csv.scala b/test/pending/run/reify_csv.scala index a6a616fab0..966521575c 100644 --- a/test/pending/run/reify_csv.scala +++ b/test/pending/run/reify_csv.scala @@ -1,6 +1,4 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { val csv = """ @@ -18,7 +16,7 @@ object Test extends App { val fields = csv.head.split(";").map{_.trim()}.toList println(fields) - val code = scala.reflect.Code.lift({ + reify({ object Csv { case class record(`phase name`: String, id: String, description: String) @@ -33,9 +31,5 @@ object Test extends App { } Csv.record.parse(csv) foreach println - }) - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }).eval } diff --git a/test/pending/run/reify_gadts.scala b/test/pending/run/reify_gadts.scala index 9feb7a5726..652a7d99d8 100644 --- a/test/pending/run/reify_gadts.scala +++ b/test/pending/run/reify_gadts.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { /* The syntax tree of a toy language */ abstract class Term[T] @@ -36,9 +34,5 @@ object Test extends App { } println( eval(If(IsZero(Lit(1)), Lit(41), Succ(Lit(41))))) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/reify_lazyevaluation.scala b/test/pending/run/reify_lazyevaluation.scala index 0720a7c979..1a0c858914 100644 --- a/test/pending/run/reify_lazyevaluation.scala +++ b/test/pending/run/reify_lazyevaluation.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { object lazyLib { /** Delay the evaluation of an expression until it is needed. */ @@ -56,9 +54,5 @@ object Test extends App { println("sl2 = " + sl2) println("sl2() = " + sl2()) println("sl2 = " + sl2) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/reify_newimpl_07.scala b/test/pending/run/reify_newimpl_07.scala new file mode 100644 index 0000000000..13ca6bda8b --- /dev/null +++ b/test/pending/run/reify_newimpl_07.scala @@ -0,0 +1,13 @@ +import scala.reflect.mirror._ + +object Test extends App { + { + class C(val y: Int) { + val code = reify { + reify{y}.eval + } + } + + println(new C(2).code.eval) + } +} \ No newline at end of file diff --git a/test/pending/run/reify_newimpl_08.scala b/test/pending/run/reify_newimpl_08.scala new file mode 100644 index 0000000000..e2faa3c9af --- /dev/null +++ b/test/pending/run/reify_newimpl_08.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + val code = reify { + class C(val y: Int) { + val code = reify { + reify{y}.eval + } + } + + new C(2).code.eval + } + + println(code.eval) +} \ No newline at end of file diff --git a/test/pending/run/reify_newimpl_35.scala b/test/pending/run/reify_newimpl_35.scala new file mode 100644 index 0000000000..5e1d163e9e --- /dev/null +++ b/test/pending/run/reify_newimpl_35.scala @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-free-types" + def code = """ +import scala.reflect.mirror._ +def foo[T: TypeTag] = reify{List[T]()} +println(foo) + """ +} diff --git a/test/pending/run/reify_newimpl_46.scala b/test/pending/run/reify_newimpl_46.scala new file mode 100644 index 0000000000..840d695e83 --- /dev/null +++ b/test/pending/run/reify_newimpl_46.scala @@ -0,0 +1,12 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C[T[_] >: Null] { + val code = reify{val x: T[String] = null; println("ima worx"); x} + println(freeTypes(code)) + val T = freeTypes(code)(0) + mkToolBox().runExpr(code, Map(T -> definitions.ListClass.asType)) + } + + new C[List] +} \ No newline at end of file diff --git a/test/pending/run/reify_newimpl_53.scala b/test/pending/run/reify_newimpl_53.scala new file mode 100644 index 0000000000..26645dea6a --- /dev/null +++ b/test/pending/run/reify_newimpl_53.scala @@ -0,0 +1,15 @@ +import scala.reflect.mirror._ + +object Test extends App { + class C[T >: Null] { + val code = reify{ + val tt = implicitly[TypeTag[T]] + println("mah typetag is: %s".format(tt)) + } + println(freeTypes(code)) + val T = freeTypes(code)(0) + mkToolBox().runExpr(code, Map(T -> definitions.StringClass.asType)) + } + + new C[String] +} \ No newline at end of file diff --git a/test/pending/run/reify_properties.scala b/test/pending/run/reify_properties.scala index 265c344b8e..5cacc262ac 100644 --- a/test/pending/run/reify_properties.scala +++ b/test/pending/run/reify_properties.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { /** A mutable property whose getter and setter may be customized. */ case class Property[T](init: T) { private var value: T = init @@ -54,9 +52,5 @@ object Test extends App { println("user1: " + user1) println("user2: " + user2) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/reify_simpleinterpreter.scala b/test/pending/run/reify_simpleinterpreter.scala index 4762afb3cc..2193edeea7 100644 --- a/test/pending/run/reify_simpleinterpreter.scala +++ b/test/pending/run/reify_simpleinterpreter.scala @@ -1,9 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { case class M[A](value: A) { def bind[B](k: A => M[B]): M[B] = k(value) def map[B](f: A => B): M[B] = bind(x => unitM(f(x))) @@ -73,9 +71,5 @@ object Test extends App { println(test(term0)) println(test(term1)) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/t5258a.check b/test/pending/run/t5258a.check new file mode 100644 index 0000000000..4e0b2da04c --- /dev/null +++ b/test/pending/run/t5258a.check @@ -0,0 +1 @@ +int \ No newline at end of file diff --git a/test/pending/run/t5258a.scala b/test/pending/run/t5258a.scala new file mode 100644 index 0000000000..755d135468 --- /dev/null +++ b/test/pending/run/t5258a.scala @@ -0,0 +1,5 @@ +object Test extends App { + reify { + println(classOf[Int]) + }.eval +} \ No newline at end of file diff --git a/test/pending/run/t5258b.scala b/test/pending/run/t5258b.scala index 3a603095b3..8ad1ff114e 100644 --- a/test/pending/run/t5258b.scala +++ b/test/pending/run/t5258b.scala @@ -1,14 +1,6 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - object Test extends App { - val code = scala.reflect.Code.lift{ + reify { class C println(classOf[C]) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } \ No newline at end of file diff --git a/test/pending/run/t5258c.scala b/test/pending/run/t5258c.scala index b0d16ba0b1..1f76391162 100644 --- a/test/pending/run/t5258c.scala +++ b/test/pending/run/t5258c.scala @@ -1,14 +1,6 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - object Test extends App { - val code = scala.reflect.Code.lift{ + reify { object E extends Enumeration { val foo, bar = Value } println(E.foo) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } \ No newline at end of file diff --git a/test/pending/run/t5271_1.scala b/test/pending/run/t5271_1.scala index afbd8fe465..fae64350e3 100644 --- a/test/pending/run/t5271_1.scala +++ b/test/pending/run/t5271_1.scala @@ -1,13 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { case class C(foo: Int, bar: Int) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/t5271_2.scala b/test/pending/run/t5271_2.scala index d85d945973..d25e1fe804 100644 --- a/test/pending/run/t5271_2.scala +++ b/test/pending/run/t5271_2.scala @@ -1,15 +1,9 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { case class C(foo: Int, bar: Int) val c = C(2, 2) println(c.foo * c.bar) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/t5271_3.scala b/test/pending/run/t5271_3.scala index 5a624de903..65a03ae323 100644 --- a/test/pending/run/t5271_3.scala +++ b/test/pending/run/t5271_3.scala @@ -1,16 +1,10 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { object C { def qwe = 4 } case class C(foo: Int, bar: Int) val c = C(2, 2) println(c.foo * c.bar == C.qwe) - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } diff --git a/test/pending/run/t5418.scala b/test/pending/run/t5418.scala index fe813cf5ae..9b0a954e47 100644 --- a/test/pending/run/t5418.scala +++ b/test/pending/run/t5418.scala @@ -1,13 +1,7 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox +import scala.reflect.mirror._ object Test extends App { - val code = scala.reflect.Code.lift{ + reify { new Object().getClass - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - toolbox.runExpr(code.tree) + }.eval } \ No newline at end of file -- cgit v1.2.3