From 75d5eee8c7f4d83dd64bca989027925e5ff081b6 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Mon, 15 Jun 2015 18:19:06 +0200 Subject: Move tests that have " macro" or "reify" to disabled. --- .../attachments-typed-another-ident/Impls_1.scala | 18 ++++ .../Macros_Test_2.scala | 5 + .../pos/attachments-typed-ident/Impls_1.scala | 18 ++++ .../attachments-typed-ident/Macros_Test_2.scala | 4 + .../disabled/macro/pos/liftcode_polymorphic.scala | 12 +++ .../pos/macro-bundle-disambiguate-bundle.check | 0 .../pos/macro-bundle-disambiguate-bundle.scala | 14 +++ .../pos/macro-bundle-disambiguate-nonbundle.check | 0 .../pos/macro-bundle-disambiguate-nonbundle.scala | 14 +++ .../pos/macro-implicit-invalidate-on-error.check | 0 .../pos/macro-implicit-invalidate-on-error.scala | 25 +++++ .../disabled/macro/pos/macro-qmarkqmarkqmark.scala | 7 ++ tests/disabled/macro/pos/t5223.scala | 6 ++ tests/disabled/macro/pos/t5692a/Macros_1.scala | 6 ++ tests/disabled/macro/pos/t5692a/Test_2.scala | 3 + tests/disabled/macro/pos/t5692b/Macros_1.scala | 6 ++ tests/disabled/macro/pos/t5692b/Test_2.scala | 3 + tests/disabled/macro/pos/t5706.flags | 1 + tests/disabled/macro/pos/t5706.scala | 15 +++ tests/disabled/macro/pos/t5744/Macros_1.scala | 22 ++++ tests/disabled/macro/pos/t5744/Test_2.scala | 6 ++ tests/disabled/macro/pos/t6047.flags | 1 + tests/disabled/macro/pos/t6047.scala | 20 ++++ tests/disabled/macro/pos/t6386.scala | 5 + tests/disabled/macro/pos/t6447.scala | 18 ++++ tests/disabled/macro/pos/t6485a/Macros_1.scala | 5 + tests/disabled/macro/pos/t6485a/Test_2.scala | 5 + tests/disabled/macro/pos/t6485b/Test.scala | 10 ++ tests/disabled/macro/pos/t6516.scala | 19 ++++ tests/disabled/macro/pos/t7190.scala | 26 +++++ tests/disabled/macro/pos/t7377/Client_2.scala | 11 ++ tests/disabled/macro/pos/t7377/Macro_1.scala | 7 ++ tests/disabled/macro/pos/t7461/Macros_1.scala | 13 +++ tests/disabled/macro/pos/t7461/Test_2.scala | 3 + tests/disabled/macro/pos/t7516/A_1.scala | 9 ++ tests/disabled/macro/pos/t7516/B_2.scala | 4 + tests/disabled/macro/pos/t7649.flags | 1 + tests/disabled/macro/pos/t7649.scala | 20 ++++ tests/disabled/macro/pos/t7776.check | 0 tests/disabled/macro/pos/t7776.scala | 20 ++++ tests/disabled/macro/pos/t7987/Macro_1.scala | 6 ++ tests/disabled/macro/pos/t7987/Test_2.scala | 12 +++ tests/disabled/macro/pos/t8001/Macros_1.scala | 10 ++ tests/disabled/macro/pos/t8001/Test_2.scala | 4 + .../disabled/macro/pos/t8013/inpervolated_2.scala | 11 ++ .../disabled/macro/pos/t8013/inpervolator_1.scala | 33 ++++++ tests/disabled/macro/pos/t8064/Client_2.scala | 8 ++ tests/disabled/macro/pos/t8064/Macro_1.scala | 10 ++ tests/disabled/macro/pos/t8064b/Client_2.scala | 6 ++ tests/disabled/macro/pos/t8064b/Macro_1.scala | 11 ++ tests/disabled/macro/pos/t8209a/Macros_1.scala | 17 +++ tests/disabled/macro/pos/t8209a/Test_2.scala | 4 + tests/disabled/macro/pos/t8209b/Macros_1.scala | 17 +++ tests/disabled/macro/pos/t8209b/Test_2.scala | 4 + tests/disabled/macro/pos/t8352/Macros_1.scala | 7 ++ tests/disabled/macro/pos/t8352/Test_2.scala | 5 + tests/disabled/macro/run/exprs_serialize.check | 19 ++++ tests/disabled/macro/run/exprs_serialize.scala | 39 +++++++ .../macro/run/freetypes_false_alarm1.check | 1 + .../macro/run/freetypes_false_alarm1.scala | 10 ++ .../macro/run/idempotency-case-classes.check | 55 ++++++++++ .../macro/run/idempotency-case-classes.scala | 22 ++++ .../macro/run/idempotency-extractors.check | 5 + .../macro/run/idempotency-extractors.scala | 22 ++++ tests/disabled/macro/run/idempotency-labels.check | 15 +++ tests/disabled/macro/run/idempotency-labels.scala | 22 ++++ .../disabled/macro/run/idempotency-lazy-vals.check | 23 ++++ .../disabled/macro/run/idempotency-lazy-vals.scala | 27 +++++ tests/disabled/macro/run/idempotency-this.check | 4 + tests/disabled/macro/run/idempotency-this.scala | 22 ++++ tests/disabled/macro/run/macro-abort-fresh.check | 6 ++ tests/disabled/macro/run/macro-abort-fresh.flags | 1 + .../macro/run/macro-abort-fresh/Macros_1.scala | 15 +++ .../macro/run/macro-abort-fresh/Test_2.scala | 8 ++ .../disabled/macro/run/macro-auto-duplicate.check | 1 + .../macro/run/macro-auto-duplicate/Macros_1.scala | 17 +++ .../macro/run/macro-auto-duplicate/Test_2.scala | 3 + .../disabled/macro/run/macro-basic-ma-md-mi.check | 1 + .../disabled/macro/run/macro-basic-ma-md-mi.flags | 1 + .../macro/run/macro-basic-ma-md-mi/Impls_1.scala | 21 ++++ .../macro/run/macro-basic-ma-md-mi/Macros_2.scala | 10 ++ .../macro/run/macro-basic-ma-md-mi/Test_3.scala | 4 + tests/disabled/macro/run/macro-basic-ma-mdmi.check | 1 + tests/disabled/macro/run/macro-basic-ma-mdmi.flags | 1 + .../run/macro-basic-ma-mdmi/Impls_Macros_1.scala | 32 ++++++ .../macro/run/macro-basic-ma-mdmi/Test_2.scala | 4 + tests/disabled/macro/run/macro-basic-mamd-mi.check | 1 + tests/disabled/macro/run/macro-basic-mamd-mi.flags | 1 + .../macro/run/macro-basic-mamd-mi/Impls_1.scala | 19 ++++ .../run/macro-basic-mamd-mi/Macros_Test_2.scala | 15 +++ .../macro/run/macro-blackbox-materialization.check | 3 + .../macro-blackbox-materialization/Macros_1.scala | 16 +++ .../macro-blackbox-materialization/Test_2.scala | 5 + .../macro/run/macro-bodyexpandstoimpl.check | 1 + .../macro/run/macro-bodyexpandstoimpl.flags | 1 + .../run/macro-bodyexpandstoimpl/Impls_1.scala | 16 +++ .../macro-bodyexpandstoimpl/Macros_Test_2.scala | 10 ++ .../macro/run/macro-bundle-context-alias.check | 4 + .../run/macro-bundle-context-alias/Macros_1.scala | 38 +++++++ .../run/macro-bundle-context-alias/Test_2.scala | 6 ++ .../run/macro-bundle-context-refinement.check | 2 + .../macro-bundle-context-refinement/Macros_1.scala | 19 ++++ .../macro-bundle-context-refinement/Test_2.scala | 4 + tests/disabled/macro/run/macro-bundle-repl.check | 24 +++++ tests/disabled/macro/run/macro-bundle-repl.scala | 13 +++ tests/disabled/macro/run/macro-bundle-static.check | 6 ++ .../run/macro-bundle-static/Impls_Macros_1.scala | 30 ++++++ .../macro/run/macro-bundle-static/Test_2.scala | 8 ++ .../disabled/macro/run/macro-bundle-toplevel.check | 6 ++ .../disabled/macro/run/macro-bundle-toplevel.flags | 1 + .../run/macro-bundle-toplevel/Impls_Macros_1.scala | 25 +++++ .../macro/run/macro-bundle-toplevel/Test_2.scala | 8 ++ .../macro/run/macro-bundle-whitebox-decl.check | 6 ++ .../Impls_Macros_1.scala | 26 +++++ .../run/macro-bundle-whitebox-decl/Test_2.scala | 8 ++ .../macro/run/macro-bundle-whitebox-use-raw.check | 5 + .../macro-bundle-whitebox-use-raw/Macros_1.scala | 108 +++++++++++++++++++ .../run/macro-bundle-whitebox-use-raw/Test_2.scala | 19 ++++ .../run/macro-bundle-whitebox-use-refined.check | 5 + .../Macros_1.scala | 108 +++++++++++++++++++ .../macro-bundle-whitebox-use-refined/Test_2.scala | 19 ++++ .../macro/run/macro-def-path-dependent.check | 1 + .../macro/run/macro-def-path-dependent.flags | 1 + .../macro/run/macro-def-path-dependent/Dummy.scala | 3 + .../run/macro-def-path-dependent/Test_1.scala | 25 +++++ .../run/macro-def-path-dependent/Test_2.scala | 22 ++++ .../run/macro-def-path-dependent/Test_3.scala | 22 ++++ .../run/macro-def-path-dependent/Test_4.scala | 11 ++ .../run/macro-def-path-dependent/Test_5.scala | 9 ++ .../run/macro-def-path-dependent/Test_6.scala | 9 ++ .../disabled/macro/run/macro-default-params.check | 1 + .../macro/run/macro-default-params/Macros_1.scala | 27 +++++ .../macro/run/macro-default-params/Test_2.scala | 3 + .../macro/run/macro-divergence-spurious.check | 1 + .../macro-divergence-spurious/Impls_Macros_1.scala | 23 ++++ .../run/macro-divergence-spurious/Test_2.scala | 3 + tests/disabled/macro/run/macro-duplicate.check | 3 + tests/disabled/macro/run/macro-duplicate.flags | 1 + .../macro/run/macro-duplicate/Impls_Macros_1.scala | 29 +++++ .../macro/run/macro-duplicate/Test_2.scala | 6 ++ .../macro/run/macro-enclosingowner-detectvar.check | 16 +++ .../macro-enclosingowner-detectvar/Macros_1.scala | 14 +++ .../macro-enclosingowner-detectvar/Test_2.scala | 23 ++++ .../macro/run/macro-enclosingowner-sbt.check | 16 +++ .../run/macro-enclosingowner-sbt/Macros_1.scala | 14 +++ .../run/macro-enclosingowner-sbt/Test_2.scala | 23 ++++ tests/disabled/macro/run/macro-enclosures.check | 34 ++++++ tests/disabled/macro/run/macro-enclosures.flags | 1 + .../run/macro-enclosures/Impls_Macros_1.scala | 23 ++++ .../macro/run/macro-enclosures/Test_2.scala | 11 ++ .../macro/run/macro-expand-implicit-argument.check | 1 + .../macro/run/macro-expand-implicit-argument.flags | 1 + .../macro-expand-implicit-argument/Macros_1.scala | 59 ++++++++++ .../macro-expand-implicit-argument/Test_2.scala | 4 + .../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 | 11 ++ .../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 + .../Impls_1.scala | 9 ++ .../Macros_Test_2.scala | 12 +++ .../macro/run/macro-expand-multiple-arglists.check | 1 + .../macro/run/macro-expand-multiple-arglists.flags | 1 + .../macro-expand-multiple-arglists/Impls_1.scala | 10 ++ .../Macros_Test_2.scala | 4 + .../macro/run/macro-expand-nullary-generic.check | 6 ++ .../macro/run/macro-expand-nullary-generic.flags | 1 + .../run/macro-expand-nullary-generic/Impls_1.scala | 15 +++ .../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 | 15 +++ .../Macros_Test_2.scala | 15 +++ .../disabled/macro/run/macro-expand-overload.check | 6 ++ .../disabled/macro/run/macro-expand-overload.flags | 1 + .../macro/run/macro-expand-overload/Impls_1.scala | 15 +++ .../run/macro-expand-overload/Macros_Test_2.scala | 20 ++++ .../disabled/macro/run/macro-expand-override.check | 15 +++ .../disabled/macro/run/macro-expand-override.flags | 1 + .../macro/run/macro-expand-override/Impls_1.scala | 15 +++ .../run/macro-expand-override/Macros_Test_2.scala | 43 ++++++++ .../macro/run/macro-expand-recursive.check | 1 + .../macro/run/macro-expand-recursive.flags | 1 + .../macro/run/macro-expand-recursive/Impls_1.scala | 15 +++ .../run/macro-expand-recursive/Macros_Test_2.scala | 8 ++ .../macro/run/macro-expand-tparams-bounds.check | 2 + .../macro/run/macro-expand-tparams-bounds.flags | 1 + .../run/macro-expand-tparams-bounds/Impls_1.scala | 12 +++ .../Macros_Test_2.scala | 12 +++ .../macro/run/macro-expand-tparams-explicit.check | 1 + .../macro/run/macro-expand-tparams-explicit.flags | 1 + .../macro-expand-tparams-explicit/Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 4 + .../macro/run/macro-expand-tparams-implicit.check | 2 + .../macro/run/macro-expand-tparams-implicit.flags | 1 + .../macro-expand-tparams-implicit/Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 5 + .../macro/run/macro-expand-tparams-prefix.check | 20 ++++ .../macro/run/macro-expand-tparams-prefix.flags | 1 + .../run/macro-expand-tparams-prefix/Impls_1.scala | 39 +++++++ .../Macros_Test_2.scala | 57 ++++++++++ .../macro/run/macro-expand-unapply-a.check | 2 + .../macro/run/macro-expand-unapply-a.flags | 1 + .../macro-expand-unapply-a/Impls_Macros_1.scala | 15 +++ .../macro/run/macro-expand-unapply-a/Test_2.scala | 6 ++ ...pand-varargs-explicit-over-nonvarargs-bad.check | 4 + ...pand-varargs-explicit-over-nonvarargs-bad.flags | 1 + .../Impls_1.scala | 9 ++ .../Macros_Test_2.scala | 12 +++ ...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 ++ .../macro/run/macro-impl-default-params.check | 5 + .../macro/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 + tests/disabled/macro/run/macro-impl-relaxed.check | 4 + .../macro/run/macro-impl-relaxed/Macros_1.scala | 14 +++ .../macro/run/macro-impl-relaxed/Test_2.scala | 6 ++ .../macro/run/macro-impl-rename-context.check | 2 + .../macro/run/macro-impl-rename-context.flags | 1 + .../macro-impl-rename-context/Impls_Macros_1.scala | 12 +++ .../run/macro-impl-rename-context/Test_2.scala | 4 + .../macro/run/macro-impl-tparam-only-in-impl.check | 1 + .../macro/run/macro-impl-tparam-only-in-impl.flags | 1 + .../macro-impl-tparam-only-in-impl/Impls_1.scala | 5 + .../Macros_Test_2.scala | 8 ++ .../macro-impl-tparam-typetag-is-optional.check | 1 + .../macro-impl-tparam-typetag-is-optional.flags | 1 + .../Impls_1.scala | 9 ++ .../Macros_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 | 8 ++ .../macro/run/macro-invalidret-nontypeable.check | 3 + .../macro/run/macro-invalidret-nontypeable.flags | 1 + .../Impls_Macros_1.scala | 13 +++ .../run/macro-invalidret-nontypeable/Test_2.scala | 8 ++ .../macro/run/macro-invalidusage-badret.check | 5 + .../macro/run/macro-invalidusage-badret.flags | 1 + .../macro-invalidusage-badret/Impls_Macros_1.scala | 9 ++ .../run/macro-invalidusage-badret/Test_2.scala | 8 ++ ...alidusage-partialapplication-with-tparams.check | 3 + ...alidusage-partialapplication-with-tparams.flags | 1 + .../Impls_Macros_1.scala | 13 +++ .../Test_2.scala | 8 ++ .../macro-invalidusage-partialapplication.check | 3 + .../macro-invalidusage-partialapplication.flags | 1 + .../Impls_Macros_1.scala | 14 +++ .../Test_2.scala | 8 ++ tests/disabled/macro/run/macro-openmacros.check | 3 + tests/disabled/macro/run/macro-openmacros.flags | 2 + .../run/macro-openmacros/Impls_Macros_1.scala | 25 +++++ .../macro/run/macro-openmacros/Test_2.scala | 3 + .../macro/run/macro-parse-position-malformed.check | 1 + .../Impls_Macros_1.scala | 18 ++++ .../macro-parse-position-malformed/Test_2.scala | 3 + .../disabled/macro/run/macro-parse-position.check | 5 + .../disabled/macro/run/macro-parse-position.flags | 1 + .../run/macro-parse-position/Impls_Macros_1.scala | 12 +++ .../macro/run/macro-parse-position/Test_2.scala | 3 + .../macro/run/macro-quasiinvalidbody-c.check | 1 + .../macro/run/macro-quasiinvalidbody-c.flags | 1 + .../macro-quasiinvalidbody-c/Impls_Macros_1.scala | 9 ++ .../run/macro-quasiinvalidbody-c/Test_2.scala | 4 + tests/disabled/macro/run/macro-quasiquotes.check | 4 + .../macro/run/macro-quasiquotes/Macros_1.scala | 15 +++ .../macro/run/macro-quasiquotes/Test_2.scala | 5 + tests/disabled/macro/run/macro-range.check | 9 ++ tests/disabled/macro/run/macro-range.flags | 1 + .../disabled/macro/run/macro-range/Common_1.scala | 48 +++++++++ .../run/macro-range/Expansion_Impossible_2.scala | 53 +++++++++ .../run/macro-range/Expansion_Possible_3.scala | 7 ++ tests/disabled/macro/run/macro-rangepos-args.check | 1 + tests/disabled/macro/run/macro-rangepos-args.flags | 1 + .../macro/run/macro-rangepos-args/Macros_1.scala | 10 ++ .../macro/run/macro-rangepos-args/Test_2.scala | 4 + .../macro/run/macro-rangepos-subpatterns.check | 1 + .../macro/run/macro-rangepos-subpatterns.flags | 1 + .../run/macro-rangepos-subpatterns/Macros_1.scala | 18 ++++ .../run/macro-rangepos-subpatterns/Test_2.scala | 5 + .../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 | 7 ++ .../run/macro-reflective-mamd-normal-mi.check | 1 + .../macro-reflective-mamd-normal-mi/Impls_1.scala | 9 ++ .../Macros_Test_2.scala | 20 ++++ tests/disabled/macro/run/macro-reify-basic.check | 1 + tests/disabled/macro/run/macro-reify-basic.flags | 1 + .../macro/run/macro-reify-basic/Macros_1.scala | 11 ++ .../macro/run/macro-reify-basic/Test_2.scala | 3 + .../run/macro-reify-chained1/Impls_Macros_1.scala | 47 ++++++++ .../macro/run/macro-reify-chained1/Test_2.scala | 9 ++ .../run/macro-reify-chained2/Impls_Macros_1.scala | 47 ++++++++ .../macro/run/macro-reify-chained2/Test_2.scala | 9 ++ .../disabled/macro/run/macro-reify-freevars.check | 3 + .../disabled/macro/run/macro-reify-freevars.flags | 1 + .../macro/run/macro-reify-freevars/Macros_1.scala | 20 ++++ .../macro/run/macro-reify-freevars/Test_2.scala | 11 ++ .../run/macro-reify-nested-a1/Impls_Macros_1.scala | 47 ++++++++ .../macro/run/macro-reify-nested-a1/Test_2.scala | 9 ++ .../run/macro-reify-nested-a2/Impls_Macros_1.scala | 47 ++++++++ .../macro/run/macro-reify-nested-a2/Test_2.scala | 9 ++ .../run/macro-reify-nested-b1/Impls_Macros_1.scala | 47 ++++++++ .../macro/run/macro-reify-nested-b1/Test_2.scala | 9 ++ .../run/macro-reify-nested-b2/Impls_Macros_1.scala | 47 ++++++++ .../macro/run/macro-reify-nested-b2/Test_2.scala | 9 ++ .../macro/run/macro-reify-ref-to-packageless.check | 1 + .../macro/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 + .../run/macro-reify-splice-outside-reify.check | 1 + .../run/macro-reify-splice-outside-reify.flags | 1 + .../Impls_Macros_1.scala | 13 +++ .../macro-reify-splice-outside-reify/Test_2.scala | 8 ++ .../disabled/macro/run/macro-reify-staticXXX.check | 12 +++ .../disabled/macro/run/macro-reify-staticXXX.flags | 1 + .../macro/run/macro-reify-staticXXX/Macros_1.scala | 48 +++++++++ .../macro/run/macro-reify-staticXXX/Test_2.scala | 4 + .../disabled/macro/run/macro-reify-tagful-a.check | 1 + .../disabled/macro/run/macro-reify-tagful-a.flags | 1 + .../macro/run/macro-reify-tagful-a/Macros_1.scala | 12 +++ .../macro/run/macro-reify-tagful-a/Test_2.scala | 4 + .../disabled/macro/run/macro-reify-tagless-a.check | 3 + .../disabled/macro/run/macro-reify-tagless-a.flags | 1 + .../run/macro-reify-tagless-a/Impls_Macros_1.scala | 11 ++ .../macro/run/macro-reify-tagless-a/Test_2.scala | 14 +++ tests/disabled/macro/run/macro-reify-type.check | 1 + tests/disabled/macro/run/macro-reify-type.flags | 1 + .../macro/run/macro-reify-type/Macros_1.scala | 28 +++++ .../macro/run/macro-reify-type/Test_2.scala | 21 ++++ .../run/macro-reify-typetag-notypeparams.check | 2 + .../macro-reify-typetag-notypeparams/Test.scala | 6 ++ .../run/macro-reify-typetag-typeparams-tags.check | 2 + .../macro-reify-typetag-typeparams-tags/Test.scala | 9 ++ tests/disabled/macro/run/macro-reify-unreify.check | 1 + tests/disabled/macro/run/macro-reify-unreify.flags | 1 + .../macro/run/macro-reify-unreify/Macros_1.scala | 20 ++++ .../macro/run/macro-reify-unreify/Test_2.scala | 3 + tests/disabled/macro/run/macro-repl-basic.check | 52 +++++++++ tests/disabled/macro/run/macro-repl-basic.scala | 39 +++++++ .../disabled/macro/run/macro-repl-dontexpand.check | 16 +++ .../disabled/macro/run/macro-repl-dontexpand.scala | 11 ++ tests/disabled/macro/run/macro-settings.check | 1 + tests/disabled/macro/run/macro-settings.flags | 1 + .../macro/run/macro-settings/Impls_Macros_1.scala | 14 +++ .../disabled/macro/run/macro-settings/Test_2.scala | 3 + tests/disabled/macro/run/macro-sip19-revised.check | 5 + tests/disabled/macro/run/macro-sip19-revised.flags | 1 + .../run/macro-sip19-revised/Impls_Macros_1.scala | 35 ++++++ .../macro/run/macro-sip19-revised/Test_2.scala | 12 +++ tests/disabled/macro/run/macro-sip19.check | 5 + tests/disabled/macro/run/macro-sip19.flags | 1 + .../macro/run/macro-sip19/Impls_Macros_1.scala | 26 +++++ tests/disabled/macro/run/macro-sip19/Test_2.scala | 16 +++ tests/disabled/macro/run/macro-subpatterns.check | 3 + .../macro/run/macro-subpatterns/Macro_1.scala | 17 +++ .../macro/run/macro-subpatterns/Test_2.scala | 5 + .../macro/run/macro-system-properties.check | 22 ++++ .../macro/run/macro-system-properties.scala | 16 +++ .../run/macro-term-declared-in-annotation.check | 1 + .../run/macro-term-declared-in-annotation.flags | 1 + .../Impls_1.scala | 11 ++ .../Macros_2.scala | 8 ++ .../macro-term-declared-in-annotation/Test_3.scala | 3 + .../run/macro-term-declared-in-anonymous.check | 2 + .../run/macro-term-declared-in-anonymous.flags | 1 + .../macro-term-declared-in-anonymous/Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 6 ++ .../macro/run/macro-term-declared-in-block.check | 2 + .../macro/run/macro-term-declared-in-block.flags | 1 + .../run/macro-term-declared-in-block/Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 6 ++ .../run/macro-term-declared-in-class-class.check | 2 + .../run/macro-term-declared-in-class-class.flags | 1 + .../Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 10 ++ .../run/macro-term-declared-in-class-object.check | 2 + .../run/macro-term-declared-in-class-object.flags | 1 + .../Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 10 ++ .../macro/run/macro-term-declared-in-class.check | 2 + .../macro/run/macro-term-declared-in-class.flags | 1 + .../run/macro-term-declared-in-class/Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 7 ++ .../run/macro-term-declared-in-default-param.check | 5 + .../run/macro-term-declared-in-default-param.flags | 1 + .../Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 7 ++ .../macro-term-declared-in-implicit-class.check | 2 + .../macro-term-declared-in-implicit-class.flags | 1 + .../Impls_Macros_1.scala | 19 ++++ .../Test_2.scala | 4 + .../macro/run/macro-term-declared-in-method.check | 2 + .../macro/run/macro-term-declared-in-method.flags | 1 + .../macro-term-declared-in-method/Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 8 ++ .../run/macro-term-declared-in-object-class.check | 2 + .../run/macro-term-declared-in-object-class.flags | 1 + .../Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 10 ++ .../run/macro-term-declared-in-object-object.check | 2 + .../run/macro-term-declared-in-object-object.flags | 1 + .../Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 10 ++ .../macro/run/macro-term-declared-in-object.check | 2 + .../macro/run/macro-term-declared-in-object.flags | 1 + .../macro-term-declared-in-object/Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 7 ++ .../macro-term-declared-in-package-object.check | 2 + .../macro-term-declared-in-package-object.flags | 1 + .../Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 8 ++ .../run/macro-term-declared-in-refinement.check | 2 + .../run/macro-term-declared-in-refinement.flags | 1 + .../Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 8 ++ .../macro/run/macro-term-declared-in-trait.check | 15 +++ .../macro/run/macro-term-declared-in-trait.flags | 1 + .../run/macro-term-declared-in-trait/Impls_1.scala | 11 ++ .../Macros_Test_2.scala | 13 +++ .../run/macro-typecheck-implicitsdisabled.check | 2 + .../run/macro-typecheck-implicitsdisabled.flags | 1 + .../Impls_Macros_1.scala | 28 +++++ .../macro-typecheck-implicitsdisabled/Test_2.scala | 4 + .../macro/run/macro-typecheck-macrosdisabled.check | 32 ++++++ .../macro/run/macro-typecheck-macrosdisabled.flags | 1 + .../Impls_Macros_1.scala | 31 ++++++ .../macro-typecheck-macrosdisabled/Test_2.scala | 4 + .../run/macro-typecheck-macrosdisabled2.check | 32 ++++++ .../run/macro-typecheck-macrosdisabled2.flags | 1 + .../Impls_Macros_1.scala | 31 ++++++ .../macro-typecheck-macrosdisabled2/Test_2.scala | 4 + .../macro/run/macro-undetparams-consfromsls.check | 5 + .../macro/run/macro-undetparams-consfromsls.flags | 1 + .../Impls_Macros_1.scala | 24 +++++ .../run/macro-undetparams-consfromsls/Test_2.scala | 7 ++ .../macro/run/macro-undetparams-macroitself.check | 2 + .../macro/run/macro-undetparams-macroitself.flags | 1 + .../Impls_Macros_1.scala | 11 ++ .../run/macro-undetparams-macroitself/Test_2.scala | 4 + .../macro/run/macro-vampire-false-warning.check | 2 + .../macro/run/macro-vampire-false-warning.flags | 1 + .../run/macro-vampire-false-warning/Macros_1.scala | 52 +++++++++ .../run/macro-vampire-false-warning/Test_2.scala | 6 ++ .../macro-whitebox-dynamic-materialization.check | 2 + .../Macros_1.scala | 25 +++++ .../Test_2.scala | 4 + .../macro/run/macro-whitebox-extractor.check | 1 + .../run/macro-whitebox-extractor/Macros_1.scala | 21 ++++ .../run/macro-whitebox-extractor/Test_2.scala | 5 + .../macro-whitebox-fundep-materialization.check | 1 + .../Macros_1.scala | 39 +++++++ .../Test_2.scala | 12 +++ .../macro/run/macro-whitebox-structural.check | 1 + .../macro-whitebox-structural/Impls_Macros_1.scala | 16 +++ .../run/macro-whitebox-structural/Test_2.scala | 5 + .../run/macroPlugins-isBlackbox/Macros_2.scala | 11 ++ .../run/macroPlugins-isBlackbox/Plugin_1.scala | 21 ++++ .../macro/run/macroPlugins-isBlackbox/Test_3.flags | 1 + .../macro/run/macroPlugins-isBlackbox/Test_3.scala | 3 + .../run/macroPlugins-isBlackbox/scalac-plugin.xml | 4 + .../macro/run/macroPlugins-macroArgs.check | 2 + .../run/macroPlugins-macroArgs/Macros_2.scala | 11 ++ .../run/macroPlugins-macroArgs/Plugin_1.scala | 21 ++++ .../macro/run/macroPlugins-macroArgs/Test_3.flags | 1 + .../macro/run/macroPlugins-macroArgs/Test_3.scala | 4 + .../run/macroPlugins-macroArgs/scalac-plugin.xml | 4 + .../macro/run/macroPlugins-macroExpand.check | 2 + .../macro/run/macroPlugins-macroExpand.flags | 1 + .../run/macroPlugins-macroExpand/Macros_2.scala | 18 ++++ .../run/macroPlugins-macroExpand/Plugin_1.scala | 27 +++++ .../run/macroPlugins-macroExpand/Test_3.flags | 1 + .../run/macroPlugins-macroExpand/Test_3.scala | 4 + .../run/macroPlugins-macroExpand/scalac-plugin.xml | 4 + .../macro/run/macroPlugins-macroRuntime.check | 2 + .../run/macroPlugins-macroRuntime/Macros_2.scala | 11 ++ .../run/macroPlugins-macroRuntime/Plugin_1.scala | 20 ++++ .../run/macroPlugins-macroRuntime/Test_3.flags | 1 + .../run/macroPlugins-macroRuntime/Test_3.scala | 4 + .../macroPlugins-macroRuntime/scalac-plugin.xml | 4 + .../macro/run/macroPlugins-namerHooks.check | 45 ++++++++ .../macro/run/macroPlugins-namerHooks.scala | 39 +++++++ .../macro/run/macroPlugins-typedMacroBody.check | 2 + .../macro/run/macroPlugins-typedMacroBody.flags | 1 + .../run/macroPlugins-typedMacroBody/Macros_2.flags | 1 + .../run/macroPlugins-typedMacroBody/Macros_2.scala | 18 ++++ .../run/macroPlugins-typedMacroBody/Plugin_1.scala | 21 ++++ .../run/macroPlugins-typedMacroBody/Test_3.scala | 4 + .../macroPlugins-typedMacroBody/scalac-plugin.xml | 4 + .../macro/run/reflection-magicsymbols-invoke.check | 119 +++++++++++++++++++++ .../macro/run/reflection-magicsymbols-invoke.scala | 100 +++++++++++++++++ .../disabled/macro/run/reify-each-node-type.check | 35 ++++++ .../disabled/macro/run/reify-each-node-type.scala | 110 +++++++++++++++++++ .../macro/run/reify-repl-fail-gracefully.check | 17 +++ .../macro/run/reify-repl-fail-gracefully.scala | 10 ++ tests/disabled/macro/run/reify-staticXXX.check | 24 +++++ tests/disabled/macro/run/reify-staticXXX.scala | 56 ++++++++++ tests/disabled/macro/run/reify_ann1a.check | 30 ++++++ tests/disabled/macro/run/reify_ann1a.scala | 28 +++++ tests/disabled/macro/run/reify_ann1b.check | 35 ++++++ tests/disabled/macro/run/reify_ann1b.scala | 28 +++++ tests/disabled/macro/run/reify_ann2a.check | 44 ++++++++ tests/disabled/macro/run/reify_ann2a.scala | 28 +++++ tests/disabled/macro/run/reify_ann3.check | 21 ++++ tests/disabled/macro/run/reify_ann3.scala | 22 ++++ tests/disabled/macro/run/reify_ann4.check | 32 ++++++ tests/disabled/macro/run/reify_ann4.scala | 26 +++++ tests/disabled/macro/run/reify_ann5.check | 22 ++++ tests/disabled/macro/run/reify_ann5.scala | 23 ++++ tests/disabled/macro/run/reify_anonymous.check | 1 + tests/disabled/macro/run/reify_anonymous.scala | 8 ++ .../disabled/macro/run/reify_classfileann_a.check | 23 ++++ .../disabled/macro/run/reify_classfileann_a.scala | 22 ++++ .../disabled/macro/run/reify_classfileann_b.check | 25 +++++ .../disabled/macro/run/reify_classfileann_b.scala | 26 +++++ tests/disabled/macro/run/reify_closure1.check | 2 + tests/disabled/macro/run/reify_closure1.scala | 19 ++++ tests/disabled/macro/run/reify_closure2a.check | 2 + tests/disabled/macro/run/reify_closure2a.scala | 19 ++++ tests/disabled/macro/run/reify_closure3a.check | 2 + tests/disabled/macro/run/reify_closure3a.scala | 21 ++++ tests/disabled/macro/run/reify_closure4a.check | 2 + tests/disabled/macro/run/reify_closure4a.scala | 21 ++++ tests/disabled/macro/run/reify_closure5a.check | 2 + tests/disabled/macro/run/reify_closure5a.scala | 21 ++++ tests/disabled/macro/run/reify_closure6.check | 7 ++ tests/disabled/macro/run/reify_closure6.scala | 29 +++++ tests/disabled/macro/run/reify_closure7.check | 6 ++ tests/disabled/macro/run/reify_closure7.scala | 33 ++++++ tests/disabled/macro/run/reify_closure8a.check | 1 + tests/disabled/macro/run/reify_closure8a.scala | 15 +++ tests/disabled/macro/run/reify_closure8b.check | 3 + tests/disabled/macro/run/reify_closure8b.scala | 21 ++++ tests/disabled/macro/run/reify_closures10.check | 2 + tests/disabled/macro/run/reify_closures10.scala | 13 +++ tests/disabled/macro/run/reify_complex.check | 1 + tests/disabled/macro/run/reify_complex.scala | 25 +++++ tests/disabled/macro/run/reify_copypaste1.check | 2 + tests/disabled/macro/run/reify_copypaste1.scala | 19 ++++ tests/disabled/macro/run/reify_copypaste2.check | 1 + tests/disabled/macro/run/reify_copypaste2.scala | 10 ++ tests/disabled/macro/run/reify_csv.check | 10 ++ tests/disabled/macro/run/reify_csv.scala | 36 +++++++ .../disabled/macro/run/reify_extendbuiltins.check | 1 + .../disabled/macro/run/reify_extendbuiltins.scala | 17 +++ tests/disabled/macro/run/reify_for1.scala | 10 ++ .../disabled/macro/run/reify_fors_newpatmat.check | 5 + .../disabled/macro/run/reify_fors_newpatmat.scala | 101 +++++++++++++++++ .../disabled/macro/run/reify_fors_oldpatmat.check | 5 + .../disabled/macro/run/reify_fors_oldpatmat.scala | 101 +++++++++++++++++ tests/disabled/macro/run/reify_generic.check | 1 + tests/disabled/macro/run/reify_generic.scala | 9 ++ tests/disabled/macro/run/reify_generic2.check | 1 + tests/disabled/macro/run/reify_generic2.scala | 10 ++ tests/disabled/macro/run/reify_getter.check | 1 + tests/disabled/macro/run/reify_getter.scala | 18 ++++ tests/disabled/macro/run/reify_implicits-new.check | 1 + tests/disabled/macro/run/reify_implicits-new.scala | 18 ++++ tests/disabled/macro/run/reify_implicits-old.check | 1 + tests/disabled/macro/run/reify_implicits-old.scala | 17 +++ tests/disabled/macro/run/reify_inheritance.check | 1 + tests/disabled/macro/run/reify_inheritance.scala | 17 +++ tests/disabled/macro/run/reify_inner1.check | 1 + tests/disabled/macro/run/reify_inner1.scala | 16 +++ tests/disabled/macro/run/reify_inner2.check | 1 + tests/disabled/macro/run/reify_inner2.scala | 16 +++ tests/disabled/macro/run/reify_inner3.check | 1 + tests/disabled/macro/run/reify_inner3.scala | 16 +++ tests/disabled/macro/run/reify_inner4.check | 1 + tests/disabled/macro/run/reify_inner4.scala | 16 +++ .../disabled/macro/run/reify_lazyevaluation.check | 8 ++ .../disabled/macro/run/reify_lazyevaluation.scala | 61 +++++++++++ tests/disabled/macro/run/reify_lazyunit.check | 6 ++ tests/disabled/macro/run/reify_lazyunit.scala | 13 +++ .../disabled/macro/run/reify_maps_newpatmat.check | 4 + .../disabled/macro/run/reify_maps_newpatmat.scala | 20 ++++ .../disabled/macro/run/reify_maps_oldpatmat.check | 4 + .../disabled/macro/run/reify_maps_oldpatmat.scala | 20 ++++ .../reify_metalevel_breach_+0_refers_to_1.check | 1 + .../reify_metalevel_breach_+0_refers_to_1.scala | 18 ++++ .../reify_metalevel_breach_-1_refers_to_0_a.check | 1 + .../reify_metalevel_breach_-1_refers_to_0_a.scala | 16 +++ .../reify_metalevel_breach_-1_refers_to_0_b.check | 1 + .../reify_metalevel_breach_-1_refers_to_0_b.scala | 21 ++++ .../reify_metalevel_breach_-1_refers_to_1.check | 1 + .../reify_metalevel_breach_-1_refers_to_1.scala | 18 ++++ .../run/reify_nested_inner_refers_to_global.check | 1 + .../run/reify_nested_inner_refers_to_global.scala | 17 +++ .../run/reify_nested_inner_refers_to_local.check | 1 + .../run/reify_nested_inner_refers_to_local.scala | 17 +++ .../run/reify_nested_outer_refers_to_global.check | 1 + .../run/reify_nested_outer_refers_to_global.scala | 19 ++++ .../run/reify_nested_outer_refers_to_local.check | 1 + .../run/reify_nested_outer_refers_to_local.scala | 19 ++++ tests/disabled/macro/run/reify_newimpl_01.check | 1 + tests/disabled/macro/run/reify_newimpl_01.scala | 13 +++ tests/disabled/macro/run/reify_newimpl_02.check | 1 + tests/disabled/macro/run/reify_newimpl_02.scala | 13 +++ tests/disabled/macro/run/reify_newimpl_03.check | 1 + tests/disabled/macro/run/reify_newimpl_03.scala | 13 +++ tests/disabled/macro/run/reify_newimpl_04.check | 1 + tests/disabled/macro/run/reify_newimpl_04.scala | 13 +++ tests/disabled/macro/run/reify_newimpl_05.check | 1 + tests/disabled/macro/run/reify_newimpl_05.scala | 14 +++ tests/disabled/macro/run/reify_newimpl_06.check | 1 + tests/disabled/macro/run/reify_newimpl_06.scala | 13 +++ tests/disabled/macro/run/reify_newimpl_11.check | 4 + tests/disabled/macro/run/reify_newimpl_11.scala | 19 ++++ tests/disabled/macro/run/reify_newimpl_12.check | 1 + tests/disabled/macro/run/reify_newimpl_12.scala | 14 +++ tests/disabled/macro/run/reify_newimpl_13.check | 4 + tests/disabled/macro/run/reify_newimpl_13.scala | 21 ++++ tests/disabled/macro/run/reify_newimpl_14.check | 1 + tests/disabled/macro/run/reify_newimpl_14.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_15.check | 1 + tests/disabled/macro/run/reify_newimpl_15.scala | 15 +++ tests/disabled/macro/run/reify_newimpl_18.check | 1 + tests/disabled/macro/run/reify_newimpl_18.scala | 15 +++ tests/disabled/macro/run/reify_newimpl_19.check | 4 + tests/disabled/macro/run/reify_newimpl_19.scala | 20 ++++ tests/disabled/macro/run/reify_newimpl_20.check | 1 + tests/disabled/macro/run/reify_newimpl_20.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_21.check | 1 + tests/disabled/macro/run/reify_newimpl_21.scala | 20 ++++ tests/disabled/macro/run/reify_newimpl_22.check | 25 +++++ tests/disabled/macro/run/reify_newimpl_22.scala | 17 +++ tests/disabled/macro/run/reify_newimpl_23.check | 24 +++++ tests/disabled/macro/run/reify_newimpl_23.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_27.check | 1 + tests/disabled/macro/run/reify_newimpl_27.scala | 15 +++ tests/disabled/macro/run/reify_newimpl_29.check | 1 + tests/disabled/macro/run/reify_newimpl_29.scala | 15 +++ tests/disabled/macro/run/reify_newimpl_30.check | 4 + tests/disabled/macro/run/reify_newimpl_30.scala | 18 ++++ tests/disabled/macro/run/reify_newimpl_31.check | 1 + tests/disabled/macro/run/reify_newimpl_31.scala | 15 +++ tests/disabled/macro/run/reify_newimpl_33.check | 1 + tests/disabled/macro/run/reify_newimpl_33.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_35.check | 13 +++ tests/disabled/macro/run/reify_newimpl_35.scala | 10 ++ tests/disabled/macro/run/reify_newimpl_36.check | 1 + tests/disabled/macro/run/reify_newimpl_36.scala | 15 +++ tests/disabled/macro/run/reify_newimpl_37.check | 1 + tests/disabled/macro/run/reify_newimpl_37.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_38.check | 1 + tests/disabled/macro/run/reify_newimpl_38.scala | 15 +++ tests/disabled/macro/run/reify_newimpl_39.check | 1 + tests/disabled/macro/run/reify_newimpl_39.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_40.check | 1 + tests/disabled/macro/run/reify_newimpl_40.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_41.check | 3 + tests/disabled/macro/run/reify_newimpl_41.scala | 18 ++++ tests/disabled/macro/run/reify_newimpl_42.check | 3 + tests/disabled/macro/run/reify_newimpl_42.scala | 17 +++ tests/disabled/macro/run/reify_newimpl_43.check | 2 + tests/disabled/macro/run/reify_newimpl_43.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_44.check | 2 + tests/disabled/macro/run/reify_newimpl_44.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_45.check | 2 + tests/disabled/macro/run/reify_newimpl_45.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_47.check | 1 + tests/disabled/macro/run/reify_newimpl_47.scala | 17 +++ tests/disabled/macro/run/reify_newimpl_48.check | 1 + tests/disabled/macro/run/reify_newimpl_48.scala | 22 ++++ tests/disabled/macro/run/reify_newimpl_49.check | 3 + tests/disabled/macro/run/reify_newimpl_49.scala | 16 +++ tests/disabled/macro/run/reify_newimpl_50.check | 3 + tests/disabled/macro/run/reify_newimpl_50.scala | 15 +++ tests/disabled/macro/run/reify_newimpl_51.check | 3 + tests/disabled/macro/run/reify_newimpl_51.scala | 18 ++++ tests/disabled/macro/run/reify_newimpl_52.check | 3 + tests/disabled/macro/run/reify_newimpl_52.scala | 18 ++++ tests/disabled/macro/run/reify_printf.check | 1 + tests/disabled/macro/run/reify_printf.scala | 71 ++++++++++++ tests/disabled/macro/run/reify_properties.check | 2 + tests/disabled/macro/run/reify_properties.scala | 57 ++++++++++ .../macro/run/reify_renamed_term_basic.check | 1 + .../macro/run/reify_renamed_term_basic.scala | 20 ++++ .../run/reify_renamed_term_local_to_reifee.check | 1 + .../run/reify_renamed_term_local_to_reifee.scala | 20 ++++ .../run/reify_renamed_term_overloaded_method.check | 1 + .../run/reify_renamed_term_overloaded_method.scala | 17 +++ .../macro/run/reify_renamed_term_t5841.check | 1 + .../macro/run/reify_renamed_term_t5841.scala | 7 ++ .../macro/run/reify_renamed_type_basic.check | 1 + .../macro/run/reify_renamed_type_basic.scala | 16 +++ .../run/reify_renamed_type_local_to_reifee.check | 1 + .../run/reify_renamed_type_local_to_reifee.scala | 24 +++++ .../macro/run/reify_renamed_type_spliceable.check | 1 + .../macro/run/reify_renamed_type_spliceable.scala | 21 ++++ tests/disabled/macro/run/reify_sort.check | 2 + tests/disabled/macro/run/reify_sort.scala | 51 +++++++++ tests/disabled/macro/run/reify_sort1.check | 2 + tests/disabled/macro/run/reify_sort1.scala | 21 ++++ tests/disabled/macro/run/reify_this.check | 5 + tests/disabled/macro/run/reify_this.scala | 20 ++++ tests/disabled/macro/run/reify_timeofday.check | 1 + tests/disabled/macro/run/reify_timeofday.scala | 42 ++++++++ tests/disabled/macro/run/reify_typerefs_1a.check | 1 + tests/disabled/macro/run/reify_typerefs_1a.scala | 18 ++++ tests/disabled/macro/run/reify_typerefs_1b.check | 1 + tests/disabled/macro/run/reify_typerefs_1b.scala | 18 ++++ tests/disabled/macro/run/reify_typerefs_2a.check | 1 + tests/disabled/macro/run/reify_typerefs_2a.scala | 20 ++++ tests/disabled/macro/run/reify_typerefs_2b.check | 1 + tests/disabled/macro/run/reify_typerefs_2b.scala | 20 ++++ tests/disabled/macro/run/reify_typerefs_3a.check | 1 + tests/disabled/macro/run/reify_typerefs_3a.scala | 20 ++++ tests/disabled/macro/run/reify_typerefs_3b.check | 1 + tests/disabled/macro/run/reify_typerefs_3b.scala | 20 ++++ tests/disabled/macro/run/reify_varargs.check | 1 + tests/disabled/macro/run/reify_varargs.scala | 11 ++ tests/disabled/macro/run/repl-term-macros.check | 40 +++++++ tests/disabled/macro/run/repl-term-macros.scala | 20 ++++ tests/disabled/macro/run/runtimeEval1.check | 1 + tests/disabled/macro/run/runtimeEval1.scala | 9 ++ tests/disabled/macro/run/runtimeEval2.check | 1 + tests/disabled/macro/run/runtimeEval2.scala | 11 ++ tests/disabled/macro/run/showdecl.check | 34 ++++++ tests/disabled/macro/run/showdecl/Macros_1.scala | 30 ++++++ tests/disabled/macro/run/showdecl/Test_2.scala | 32 ++++++ tests/disabled/macro/run/showraw_mods.check | 1 + tests/disabled/macro/run/showraw_mods.scala | 6 ++ tests/disabled/macro/run/showraw_tree.check | 2 + tests/disabled/macro/run/showraw_tree.scala | 8 ++ tests/disabled/macro/run/showraw_tree_ids.check | 2 + tests/disabled/macro/run/showraw_tree_ids.scala | 9 ++ tests/disabled/macro/run/showraw_tree_kinds.check | 2 + tests/disabled/macro/run/showraw_tree_kinds.scala | 8 ++ .../macro/run/showraw_tree_types_ids.check | 12 +++ .../macro/run/showraw_tree_types_ids.scala | 11 ++ .../macro/run/showraw_tree_types_typed.check | 12 +++ .../macro/run/showraw_tree_types_typed.scala | 10 ++ .../macro/run/showraw_tree_types_untyped.check | 2 + .../macro/run/showraw_tree_types_untyped.scala | 8 ++ .../disabled/macro/run/showraw_tree_ultimate.check | 12 +++ .../disabled/macro/run/showraw_tree_ultimate.scala | 11 ++ tests/disabled/macro/run/t2886.check | 5 + tests/disabled/macro/run/t2886.scala | 9 ++ tests/disabled/macro/run/t5224.check | 14 +++ tests/disabled/macro/run/t5224.scala | 8 ++ tests/disabled/macro/run/t5225_1.check | 4 + tests/disabled/macro/run/t5225_1.scala | 6 ++ tests/disabled/macro/run/t5225_2.check | 4 + tests/disabled/macro/run/t5225_2.scala | 6 ++ tests/disabled/macro/run/t5229_1.scala | 8 ++ tests/disabled/macro/run/t5229_2.check | 2 + tests/disabled/macro/run/t5229_2.scala | 18 ++++ tests/disabled/macro/run/t5230.check | 2 + tests/disabled/macro/run/t5230.scala | 18 ++++ tests/disabled/macro/run/t5258a.check | 1 + tests/disabled/macro/run/t5258a.scala | 8 ++ tests/disabled/macro/run/t5266_1.check | 2 + tests/disabled/macro/run/t5266_1.scala | 15 +++ tests/disabled/macro/run/t5266_2.check | 2 + tests/disabled/macro/run/t5266_2.scala | 16 +++ tests/disabled/macro/run/t5269.check | 1 + tests/disabled/macro/run/t5269.scala | 16 +++ tests/disabled/macro/run/t5270.check | 1 + tests/disabled/macro/run/t5270.scala | 20 ++++ tests/disabled/macro/run/t5271_1.check | 12 +++ tests/disabled/macro/run/t5271_1.scala | 15 +++ tests/disabled/macro/run/t5271_2.check | 14 +++ tests/disabled/macro/run/t5271_2.scala | 17 +++ tests/disabled/macro/run/t5271_3.check | 21 ++++ tests/disabled/macro/run/t5271_3.scala | 18 ++++ tests/disabled/macro/run/t5271_4.scala | 8 ++ tests/disabled/macro/run/t5272_1_newpatmat.check | 1 + tests/disabled/macro/run/t5272_1_newpatmat.scala | 11 ++ tests/disabled/macro/run/t5272_1_oldpatmat.check | 1 + tests/disabled/macro/run/t5272_1_oldpatmat.scala | 11 ++ tests/disabled/macro/run/t5272_2_newpatmat.check | 1 + tests/disabled/macro/run/t5272_2_newpatmat.scala | 10 ++ tests/disabled/macro/run/t5272_2_oldpatmat.check | 1 + tests/disabled/macro/run/t5272_2_oldpatmat.scala | 10 ++ tests/disabled/macro/run/t5273_1_newpatmat.check | 1 + tests/disabled/macro/run/t5273_1_newpatmat.scala | 11 ++ tests/disabled/macro/run/t5273_1_oldpatmat.check | 1 + tests/disabled/macro/run/t5273_1_oldpatmat.scala | 11 ++ tests/disabled/macro/run/t5273_2a_newpatmat.check | 1 + tests/disabled/macro/run/t5273_2a_newpatmat.scala | 9 ++ tests/disabled/macro/run/t5273_2a_oldpatmat.check | 1 + tests/disabled/macro/run/t5273_2a_oldpatmat.scala | 9 ++ tests/disabled/macro/run/t5273_2b_newpatmat.check | 1 + tests/disabled/macro/run/t5273_2b_newpatmat.scala | 10 ++ tests/disabled/macro/run/t5273_2b_oldpatmat.check | 1 + tests/disabled/macro/run/t5273_2b_oldpatmat.scala | 10 ++ tests/disabled/macro/run/t5274_1.check | 3 + tests/disabled/macro/run/t5274_1.scala | 14 +++ tests/disabled/macro/run/t5274_2.check | 2 + tests/disabled/macro/run/t5274_2.scala | 51 +++++++++ tests/disabled/macro/run/t5275.check | 1 + tests/disabled/macro/run/t5275.scala | 9 ++ tests/disabled/macro/run/t5276_1a.check | 1 + tests/disabled/macro/run/t5276_1a.scala | 9 ++ tests/disabled/macro/run/t5276_1b.check | 1 + tests/disabled/macro/run/t5276_1b.scala | 9 ++ tests/disabled/macro/run/t5276_2a.check | 1 + tests/disabled/macro/run/t5276_2a.scala | 12 +++ tests/disabled/macro/run/t5276_2b.check | 1 + tests/disabled/macro/run/t5276_2b.scala | 13 +++ tests/disabled/macro/run/t5277_1.check | 1 + tests/disabled/macro/run/t5277_1.scala | 16 +++ tests/disabled/macro/run/t5277_2.check | 2 + tests/disabled/macro/run/t5277_2.scala | 12 +++ tests/disabled/macro/run/t5279.check | 1 + tests/disabled/macro/run/t5279.scala | 8 ++ tests/disabled/macro/run/t5334_1.check | 1 + tests/disabled/macro/run/t5334_1.scala | 15 +++ tests/disabled/macro/run/t5334_2.check | 1 + tests/disabled/macro/run/t5334_2.scala | 15 +++ tests/disabled/macro/run/t5335.check | 1 + tests/disabled/macro/run/t5335.scala | 8 ++ tests/disabled/macro/run/t5415.scala | 12 +++ tests/disabled/macro/run/t5418.scala | 8 ++ tests/disabled/macro/run/t5418a.check | 1 + tests/disabled/macro/run/t5418a.scala | 3 + tests/disabled/macro/run/t5418b.check | 2 + tests/disabled/macro/run/t5418b.scala | 11 ++ tests/disabled/macro/run/t5419.check | 1 + tests/disabled/macro/run/t5419.scala | 8 ++ tests/disabled/macro/run/t5704.check | 1 + tests/disabled/macro/run/t5704.flags | 1 + tests/disabled/macro/run/t5704.scala | 19 ++++ tests/disabled/macro/run/t5710-1.check | 1 + tests/disabled/macro/run/t5710-1.scala | 15 +++ tests/disabled/macro/run/t5710-2.check | 1 + tests/disabled/macro/run/t5710-2.scala | 15 +++ tests/disabled/macro/run/t5713.check | 1 + tests/disabled/macro/run/t5713.flags | 1 + .../disabled/macro/run/t5713/Impls_Macros_1.scala | 28 +++++ tests/disabled/macro/run/t5713/Test_2.scala | 5 + tests/disabled/macro/run/t5753_1.check | 1 + tests/disabled/macro/run/t5753_1.flags | 1 + .../macro/run/t5753_1/Impls_Macros_1.scala | 10 ++ tests/disabled/macro/run/t5753_1/Test_2.scala | 4 + tests/disabled/macro/run/t5753_2.check | 1 + tests/disabled/macro/run/t5753_2.flags | 1 + .../macro/run/t5753_2/Impls_Macros_1.scala | 10 ++ tests/disabled/macro/run/t5753_2/Test_2.scala | 4 + tests/disabled/macro/run/t5770.check | 10 ++ tests/disabled/macro/run/t5770.scala | 25 +++++ tests/disabled/macro/run/t5816.check | 1 + tests/disabled/macro/run/t5816.scala | 17 +++ tests/disabled/macro/run/t5824.check | 1 + tests/disabled/macro/run/t5824.scala | 8 ++ tests/disabled/macro/run/t5840.scala | 7 ++ tests/disabled/macro/run/t5894.scala | 18 ++++ tests/disabled/macro/run/t5903a.check | 1 + tests/disabled/macro/run/t5903a.flags | 1 + tests/disabled/macro/run/t5903a/Macros_1.scala | 28 +++++ tests/disabled/macro/run/t5903a/Test_2.scala | 6 ++ tests/disabled/macro/run/t5903b.check | 1 + tests/disabled/macro/run/t5903b.flags | 1 + tests/disabled/macro/run/t5903b/Macros_1.scala | 25 +++++ tests/disabled/macro/run/t5903b/Test_2.scala | 6 ++ tests/disabled/macro/run/t5903c.check | 1 + tests/disabled/macro/run/t5903c.flags | 1 + tests/disabled/macro/run/t5903c/Macros_1.scala | 23 ++++ tests/disabled/macro/run/t5903c/Test_2.scala | 6 ++ tests/disabled/macro/run/t5903d.check | 1 + tests/disabled/macro/run/t5903d.flags | 1 + tests/disabled/macro/run/t5903d/Macros_1.scala | 25 +++++ tests/disabled/macro/run/t5903d/Test_2.scala | 6 ++ tests/disabled/macro/run/t5923a.check | 3 + tests/disabled/macro/run/t5923a/Macros_1.scala | 53 +++++++++ tests/disabled/macro/run/t5923a/Test_2.scala | 5 + tests/disabled/macro/run/t5923d/Macros_1.scala | 9 ++ tests/disabled/macro/run/t5923d/Test_2.scala | 7 ++ tests/disabled/macro/run/t5940.scala | 41 +++++++ tests/disabled/macro/run/t6023.check | 12 +++ tests/disabled/macro/run/t6023.scala | 17 +++ tests/disabled/macro/run/t6187.check | 32 ++++++ tests/disabled/macro/run/t6187.scala | 18 ++++ tests/disabled/macro/run/t6187b.scala | 5 + tests/disabled/macro/run/t6221.check | 1 + tests/disabled/macro/run/t6221/Macros_1.scala | 23 ++++ tests/disabled/macro/run/t6221/Test_2.scala | 10 ++ tests/disabled/macro/run/t6379.check | 14 +++ tests/disabled/macro/run/t6379/Macros_1.scala | 26 +++++ tests/disabled/macro/run/t6379/Test_2.scala | 22 ++++ tests/disabled/macro/run/t6381.check | 19 ++++ tests/disabled/macro/run/t6381.scala | 15 +++ tests/disabled/macro/run/t6394a.check | 1 + tests/disabled/macro/run/t6394a.flags | 1 + tests/disabled/macro/run/t6394a/Macros_1.scala | 12 +++ tests/disabled/macro/run/t6394a/Test_2.scala | 4 + tests/disabled/macro/run/t6394b.check | 1 + tests/disabled/macro/run/t6394b.flags | 1 + tests/disabled/macro/run/t6394b/Macros_1.scala | 12 +++ tests/disabled/macro/run/t6394b/Test_2.scala | 4 + tests/disabled/macro/run/t6591_1.check | 1 + tests/disabled/macro/run/t6591_1.scala | 19 ++++ tests/disabled/macro/run/t6591_2.check | 1 + tests/disabled/macro/run/t6591_2.scala | 19 ++++ tests/disabled/macro/run/t6591_3.check | 1 + tests/disabled/macro/run/t6591_3.scala | 17 +++ tests/disabled/macro/run/t6591_5.check | 1 + tests/disabled/macro/run/t6591_5.scala | 23 ++++ tests/disabled/macro/run/t6591_6.check | 1 + tests/disabled/macro/run/t6591_6.scala | 24 +++++ tests/disabled/macro/run/t6591_7.check | 4 + tests/disabled/macro/run/t6591_7.scala | 27 +++++ tests/disabled/macro/run/t6662.check | 1 + tests/disabled/macro/run/t6662/Macro_1.scala | 8 ++ tests/disabled/macro/run/t6662/Test_2.scala | 8 ++ tests/disabled/macro/run/t6814.check | 7 ++ tests/disabled/macro/run/t6814/Macros_1.scala | 24 +++++ tests/disabled/macro/run/t6814/Test_2.scala | 3 + tests/disabled/macro/run/t6992.check | 4 + tests/disabled/macro/run/t6992/Macros_1.scala | 75 +++++++++++++ tests/disabled/macro/run/t6992/Test_2.scala | 14 +++ tests/disabled/macro/run/t7008-scala-defined.check | 7 ++ tests/disabled/macro/run/t7008-scala-defined.flags | 1 + .../run/t7008-scala-defined/Impls_Macros_2.scala | 13 +++ .../ScalaClassWithCheckedExceptions_1.scala | 6 ++ .../macro/run/t7008-scala-defined/Test_3.scala | 9 ++ tests/disabled/macro/run/t7008.check | 9 ++ .../disabled/macro/run/t7008/Impls_Macros_2.scala | 13 +++ .../t7008/JavaClassWithCheckedExceptions_1.java | 7 ++ tests/disabled/macro/run/t7008/Test_3.scala | 9 ++ tests/disabled/macro/run/t7044.check | 14 +++ tests/disabled/macro/run/t7044/Macros_1.scala | 26 +++++ tests/disabled/macro/run/t7044/Test_2.scala | 19 ++++ tests/disabled/macro/run/t7047.check | 3 + .../disabled/macro/run/t7047/Impls_Macros_1.scala | 19 ++++ tests/disabled/macro/run/t7047/Test_2.scala | 3 + tests/disabled/macro/run/t7157.check | 1 + .../disabled/macro/run/t7157/Impls_Macros_1.scala | 15 +++ tests/disabled/macro/run/t7157/Test_2.scala | 5 + tests/disabled/macro/run/t7185.check | 32 ++++++ tests/disabled/macro/run/t7185.scala | 12 +++ tests/disabled/macro/run/t7235.check | 4 + tests/disabled/macro/run/t7235.scala | 14 +++ tests/disabled/macro/run/t7240/Macros_1.scala | 48 +++++++++ tests/disabled/macro/run/t7240/Test_2.scala | 3 + tests/disabled/macro/run/t7375b.check | 4 + tests/disabled/macro/run/t7375b/Macros_1.scala | 18 ++++ tests/disabled/macro/run/t7375b/Test_2.scala | 3 + tests/disabled/macro/run/t7558.scala | 9 ++ tests/disabled/macro/run/t7617a.check | 2 + tests/disabled/macro/run/t7617a/Macros_1.scala | 22 ++++ tests/disabled/macro/run/t7617a/Test_2.scala | 5 + tests/disabled/macro/run/t7617b.check | 1 + tests/disabled/macro/run/t7617b/Macros_1.scala | 8 ++ tests/disabled/macro/run/t7617b/Test_2.scala | 11 ++ tests/disabled/macro/run/t7657.check | 3 + tests/disabled/macro/run/t7657/Macros_1.scala | 8 ++ tests/disabled/macro/run/t7657/Test_2.scala | 6 ++ tests/disabled/macro/run/t7777.check | 7 ++ tests/disabled/macro/run/t7777/Macros_1.scala | 17 +++ tests/disabled/macro/run/t7777/Test_2.scala | 6 ++ tests/disabled/macro/run/t7868b.check | 6 ++ tests/disabled/macro/run/t7868b.scala | 11 ++ tests/disabled/macro/run/t7871.check | 1 + tests/disabled/macro/run/t7871/Macros_1.scala | 27 +++++ tests/disabled/macro/run/t7871/Test_2.scala | 6 ++ tests/disabled/macro/run/t8048a.check | 1 + tests/disabled/macro/run/t8048a/Macros_1.scala | 11 ++ tests/disabled/macro/run/t8048a/Test_2.scala | 4 + tests/disabled/macro/run/t8048b.check | 3 + tests/disabled/macro/run/t8048b/Macros_1.scala | 37 +++++++ tests/disabled/macro/run/t8048b/Test_2.scala | 5 + tests/disabled/macro/run/t8104.check | 2 + tests/disabled/macro/run/t8104/Macros_1.scala | 11 ++ tests/disabled/macro/run/t8104/Test_2.scala | 19 ++++ tests/disabled/macro/run/t8192.check | 32 ++++++ tests/disabled/macro/run/t8192/Macros_1.scala | 45 ++++++++ tests/disabled/macro/run/t8192/Test_2.scala | 40 +++++++ tests/disabled/macro/run/t8321.check | 1 + tests/disabled/macro/run/t8321/Macros_1.scala | 11 ++ tests/disabled/macro/run/t8321/Test_2.scala | 3 + tests/disabled/macro/run/t8425.check | 1 + tests/disabled/macro/run/t8425/Macros_1.scala | 12 +++ tests/disabled/macro/run/t8425/Test_2.scala | 3 + tests/disabled/macro/run/t8437.check | 2 + tests/disabled/macro/run/t8437/Macros_1.scala | 18 ++++ tests/disabled/macro/run/t8437/Test_2.scala | 4 + .../macro/run/toolbox_console_reporter.check | 8 ++ .../macro/run/toolbox_console_reporter.scala | 28 +++++ .../macro/run/toolbox_current_run_compiles.check | 2 + .../macro/run/toolbox_current_run_compiles.scala | 28 +++++ .../run/toolbox_default_reporter_is_silent.check | 1 + .../run/toolbox_default_reporter_is_silent.scala | 16 +++ .../macro/run/toolbox_silent_reporter.check | 4 + .../macro/run/toolbox_silent_reporter.scala | 19 ++++ .../run/toolbox_typecheck_macrosdisabled.check | 41 +++++++ .../run/toolbox_typecheck_macrosdisabled.scala | 26 +++++ .../run/toolbox_typecheck_macrosdisabled2.check | 41 +++++++ .../run/toolbox_typecheck_macrosdisabled2.scala | 26 +++++ tests/disabled/macro/run/typecheck.check | 0 tests/disabled/macro/run/typecheck/Macros_1.scala | 12 +++ tests/disabled/macro/run/typecheck/Test_2.scala | 10 ++ tests/disabled/macro/run/typed-annotated.check | 1 + .../macro/run/typed-annotated/Macros_1.scala | 17 +++ .../macro/run/typed-annotated/Test_2.scala | 3 + 1020 files changed, 11391 insertions(+) create mode 100644 tests/disabled/macro/pos/attachments-typed-another-ident/Impls_1.scala create mode 100644 tests/disabled/macro/pos/attachments-typed-another-ident/Macros_Test_2.scala create mode 100644 tests/disabled/macro/pos/attachments-typed-ident/Impls_1.scala create mode 100644 tests/disabled/macro/pos/attachments-typed-ident/Macros_Test_2.scala create mode 100644 tests/disabled/macro/pos/liftcode_polymorphic.scala create mode 100644 tests/disabled/macro/pos/macro-bundle-disambiguate-bundle.check create mode 100644 tests/disabled/macro/pos/macro-bundle-disambiguate-bundle.scala create mode 100644 tests/disabled/macro/pos/macro-bundle-disambiguate-nonbundle.check create mode 100644 tests/disabled/macro/pos/macro-bundle-disambiguate-nonbundle.scala create mode 100644 tests/disabled/macro/pos/macro-implicit-invalidate-on-error.check create mode 100644 tests/disabled/macro/pos/macro-implicit-invalidate-on-error.scala create mode 100644 tests/disabled/macro/pos/macro-qmarkqmarkqmark.scala create mode 100644 tests/disabled/macro/pos/t5223.scala create mode 100644 tests/disabled/macro/pos/t5692a/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t5692a/Test_2.scala create mode 100644 tests/disabled/macro/pos/t5692b/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t5692b/Test_2.scala create mode 100644 tests/disabled/macro/pos/t5706.flags create mode 100644 tests/disabled/macro/pos/t5706.scala create mode 100644 tests/disabled/macro/pos/t5744/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t5744/Test_2.scala create mode 100644 tests/disabled/macro/pos/t6047.flags create mode 100644 tests/disabled/macro/pos/t6047.scala create mode 100644 tests/disabled/macro/pos/t6386.scala create mode 100644 tests/disabled/macro/pos/t6447.scala create mode 100644 tests/disabled/macro/pos/t6485a/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t6485a/Test_2.scala create mode 100644 tests/disabled/macro/pos/t6485b/Test.scala create mode 100644 tests/disabled/macro/pos/t6516.scala create mode 100644 tests/disabled/macro/pos/t7190.scala create mode 100644 tests/disabled/macro/pos/t7377/Client_2.scala create mode 100644 tests/disabled/macro/pos/t7377/Macro_1.scala create mode 100644 tests/disabled/macro/pos/t7461/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t7461/Test_2.scala create mode 100644 tests/disabled/macro/pos/t7516/A_1.scala create mode 100644 tests/disabled/macro/pos/t7516/B_2.scala create mode 100644 tests/disabled/macro/pos/t7649.flags create mode 100644 tests/disabled/macro/pos/t7649.scala create mode 100644 tests/disabled/macro/pos/t7776.check create mode 100644 tests/disabled/macro/pos/t7776.scala create mode 100644 tests/disabled/macro/pos/t7987/Macro_1.scala create mode 100644 tests/disabled/macro/pos/t7987/Test_2.scala create mode 100644 tests/disabled/macro/pos/t8001/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t8001/Test_2.scala create mode 100644 tests/disabled/macro/pos/t8013/inpervolated_2.scala create mode 100644 tests/disabled/macro/pos/t8013/inpervolator_1.scala create mode 100644 tests/disabled/macro/pos/t8064/Client_2.scala create mode 100644 tests/disabled/macro/pos/t8064/Macro_1.scala create mode 100644 tests/disabled/macro/pos/t8064b/Client_2.scala create mode 100644 tests/disabled/macro/pos/t8064b/Macro_1.scala create mode 100644 tests/disabled/macro/pos/t8209a/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t8209a/Test_2.scala create mode 100644 tests/disabled/macro/pos/t8209b/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t8209b/Test_2.scala create mode 100644 tests/disabled/macro/pos/t8352/Macros_1.scala create mode 100644 tests/disabled/macro/pos/t8352/Test_2.scala create mode 100644 tests/disabled/macro/run/exprs_serialize.check create mode 100644 tests/disabled/macro/run/exprs_serialize.scala create mode 100644 tests/disabled/macro/run/freetypes_false_alarm1.check create mode 100644 tests/disabled/macro/run/freetypes_false_alarm1.scala create mode 100644 tests/disabled/macro/run/idempotency-case-classes.check create mode 100644 tests/disabled/macro/run/idempotency-case-classes.scala create mode 100644 tests/disabled/macro/run/idempotency-extractors.check create mode 100644 tests/disabled/macro/run/idempotency-extractors.scala create mode 100644 tests/disabled/macro/run/idempotency-labels.check create mode 100644 tests/disabled/macro/run/idempotency-labels.scala create mode 100644 tests/disabled/macro/run/idempotency-lazy-vals.check create mode 100644 tests/disabled/macro/run/idempotency-lazy-vals.scala create mode 100644 tests/disabled/macro/run/idempotency-this.check create mode 100644 tests/disabled/macro/run/idempotency-this.scala create mode 100644 tests/disabled/macro/run/macro-abort-fresh.check create mode 100644 tests/disabled/macro/run/macro-abort-fresh.flags create mode 100644 tests/disabled/macro/run/macro-abort-fresh/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-abort-fresh/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-auto-duplicate.check create mode 100644 tests/disabled/macro/run/macro-auto-duplicate/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-auto-duplicate/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-basic-ma-md-mi.check create mode 100644 tests/disabled/macro/run/macro-basic-ma-md-mi.flags create mode 100644 tests/disabled/macro/run/macro-basic-ma-md-mi/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-basic-ma-md-mi/Macros_2.scala create mode 100644 tests/disabled/macro/run/macro-basic-ma-md-mi/Test_3.scala create mode 100644 tests/disabled/macro/run/macro-basic-ma-mdmi.check create mode 100644 tests/disabled/macro/run/macro-basic-ma-mdmi.flags create mode 100644 tests/disabled/macro/run/macro-basic-ma-mdmi/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-basic-ma-mdmi/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-basic-mamd-mi.check create mode 100644 tests/disabled/macro/run/macro-basic-mamd-mi.flags create mode 100644 tests/disabled/macro/run/macro-basic-mamd-mi/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-basic-mamd-mi/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-blackbox-materialization.check create mode 100644 tests/disabled/macro/run/macro-blackbox-materialization/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-blackbox-materialization/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-bodyexpandstoimpl.check create mode 100644 tests/disabled/macro/run/macro-bodyexpandstoimpl.flags create mode 100644 tests/disabled/macro/run/macro-bodyexpandstoimpl/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-bodyexpandstoimpl/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-bundle-context-alias.check create mode 100644 tests/disabled/macro/run/macro-bundle-context-alias/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-bundle-context-alias/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-bundle-context-refinement.check create mode 100644 tests/disabled/macro/run/macro-bundle-context-refinement/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-bundle-context-refinement/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-bundle-repl.check create mode 100644 tests/disabled/macro/run/macro-bundle-repl.scala create mode 100644 tests/disabled/macro/run/macro-bundle-static.check create mode 100644 tests/disabled/macro/run/macro-bundle-static/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-bundle-static/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-bundle-toplevel.check create mode 100644 tests/disabled/macro/run/macro-bundle-toplevel.flags create mode 100644 tests/disabled/macro/run/macro-bundle-toplevel/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-bundle-toplevel/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-decl.check create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-decl/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-decl/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-use-raw.check create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-use-raw/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-use-raw/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-use-refined.check create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-use-refined/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-bundle-whitebox-use-refined/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-def-path-dependent.check create mode 100644 tests/disabled/macro/run/macro-def-path-dependent.flags create mode 100644 tests/disabled/macro/run/macro-def-path-dependent/Dummy.scala create mode 100644 tests/disabled/macro/run/macro-def-path-dependent/Test_1.scala create mode 100644 tests/disabled/macro/run/macro-def-path-dependent/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-def-path-dependent/Test_3.scala create mode 100644 tests/disabled/macro/run/macro-def-path-dependent/Test_4.scala create mode 100644 tests/disabled/macro/run/macro-def-path-dependent/Test_5.scala create mode 100644 tests/disabled/macro/run/macro-def-path-dependent/Test_6.scala create mode 100644 tests/disabled/macro/run/macro-default-params.check create mode 100644 tests/disabled/macro/run/macro-default-params/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-default-params/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-divergence-spurious.check create mode 100644 tests/disabled/macro/run/macro-divergence-spurious/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-divergence-spurious/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-duplicate.check create mode 100644 tests/disabled/macro/run/macro-duplicate.flags create mode 100644 tests/disabled/macro/run/macro-duplicate/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-duplicate/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-enclosingowner-detectvar.check create mode 100644 tests/disabled/macro/run/macro-enclosingowner-detectvar/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-enclosingowner-detectvar/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-enclosingowner-sbt.check create mode 100644 tests/disabled/macro/run/macro-enclosingowner-sbt/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-enclosingowner-sbt/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-enclosures.check create mode 100644 tests/disabled/macro/run/macro-enclosures.flags create mode 100644 tests/disabled/macro/run/macro-enclosures/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-enclosures/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-argument.check create mode 100644 tests/disabled/macro/run/macro-expand-implicit-argument.flags create mode 100644 tests/disabled/macro/run/macro-expand-implicit-argument/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-argument/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit.check create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit.flags create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit.check create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit.flags create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-val.check create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-val.flags create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-val/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-view.check create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-view/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-multiple-arglists.check create mode 100644 tests/disabled/macro/run/macro-expand-multiple-arglists.flags create mode 100644 tests/disabled/macro/run/macro-expand-multiple-arglists/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-multiple-arglists/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-nullary-generic.check create mode 100644 tests/disabled/macro/run/macro-expand-nullary-generic.flags create mode 100644 tests/disabled/macro/run/macro-expand-nullary-generic/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-nullary-generic/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-nullary-nongeneric.check create mode 100644 tests/disabled/macro/run/macro-expand-nullary-nongeneric.flags create mode 100644 tests/disabled/macro/run/macro-expand-nullary-nongeneric/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-overload.check create mode 100644 tests/disabled/macro/run/macro-expand-overload.flags create mode 100644 tests/disabled/macro/run/macro-expand-overload/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-overload/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-override.check create mode 100644 tests/disabled/macro/run/macro-expand-override.flags create mode 100644 tests/disabled/macro/run/macro-expand-override/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-override/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-recursive.check create mode 100644 tests/disabled/macro/run/macro-expand-recursive.flags create mode 100644 tests/disabled/macro/run/macro-expand-recursive/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-recursive/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-tparams-bounds.check create mode 100644 tests/disabled/macro/run/macro-expand-tparams-bounds.flags create mode 100644 tests/disabled/macro/run/macro-expand-tparams-bounds/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-tparams-bounds/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-tparams-explicit.check create mode 100644 tests/disabled/macro/run/macro-expand-tparams-explicit.flags create mode 100644 tests/disabled/macro/run/macro-expand-tparams-explicit/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-tparams-explicit/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-tparams-implicit.check create mode 100644 tests/disabled/macro/run/macro-expand-tparams-implicit.flags create mode 100644 tests/disabled/macro/run/macro-expand-tparams-implicit/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-tparams-implicit/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-tparams-prefix.check create mode 100644 tests/disabled/macro/run/macro-expand-tparams-prefix.flags create mode 100644 tests/disabled/macro/run/macro-expand-tparams-prefix/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-tparams-prefix/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-unapply-a.check create mode 100644 tests/disabled/macro/run/macro-expand-unapply-a.flags create mode 100644 tests/disabled/macro/run/macro-expand-unapply-a/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-unapply-a/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad.flags create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good.check create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good.flags create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs.check create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs.flags create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs.check create mode 100644 tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs.flags create mode 100644 tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs.check create mode 100644 tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs.flags create mode 100644 tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-impl-default-params.check create mode 100644 tests/disabled/macro/run/macro-impl-default-params.flags create mode 100644 tests/disabled/macro/run/macro-impl-default-params/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-impl-default-params/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-impl-relaxed.check create mode 100644 tests/disabled/macro/run/macro-impl-relaxed/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-impl-relaxed/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-impl-rename-context.check create mode 100644 tests/disabled/macro/run/macro-impl-rename-context.flags create mode 100644 tests/disabled/macro/run/macro-impl-rename-context/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-impl-rename-context/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-impl-tparam-only-in-impl.check create mode 100644 tests/disabled/macro/run/macro-impl-tparam-only-in-impl.flags create mode 100644 tests/disabled/macro/run/macro-impl-tparam-only-in-impl/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional.check create mode 100644 tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional.flags create mode 100644 tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype.check create mode 100644 tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype.flags create mode 100644 tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-invalidret-nontypeable.check create mode 100644 tests/disabled/macro/run/macro-invalidret-nontypeable.flags create mode 100644 tests/disabled/macro/run/macro-invalidret-nontypeable/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-invalidret-nontypeable/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-invalidusage-badret.check create mode 100644 tests/disabled/macro/run/macro-invalidusage-badret.flags create mode 100644 tests/disabled/macro/run/macro-invalidusage-badret/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-invalidusage-badret/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams.check create mode 100644 tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams.flags create mode 100644 tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-invalidusage-partialapplication.check create mode 100644 tests/disabled/macro/run/macro-invalidusage-partialapplication.flags create mode 100644 tests/disabled/macro/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-invalidusage-partialapplication/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-openmacros.check create mode 100644 tests/disabled/macro/run/macro-openmacros.flags create mode 100644 tests/disabled/macro/run/macro-openmacros/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-openmacros/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-parse-position-malformed.check create mode 100644 tests/disabled/macro/run/macro-parse-position-malformed/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-parse-position-malformed/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-parse-position.check create mode 100644 tests/disabled/macro/run/macro-parse-position.flags create mode 100644 tests/disabled/macro/run/macro-parse-position/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-parse-position/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-quasiinvalidbody-c.check create mode 100644 tests/disabled/macro/run/macro-quasiinvalidbody-c.flags create mode 100644 tests/disabled/macro/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-quasiinvalidbody-c/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-quasiquotes.check create mode 100644 tests/disabled/macro/run/macro-quasiquotes/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-quasiquotes/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-range.check create mode 100644 tests/disabled/macro/run/macro-range.flags create mode 100644 tests/disabled/macro/run/macro-range/Common_1.scala create mode 100644 tests/disabled/macro/run/macro-range/Expansion_Impossible_2.scala create mode 100644 tests/disabled/macro/run/macro-range/Expansion_Possible_3.scala create mode 100644 tests/disabled/macro/run/macro-rangepos-args.check create mode 100644 tests/disabled/macro/run/macro-rangepos-args.flags create mode 100644 tests/disabled/macro/run/macro-rangepos-args/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-rangepos-args/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-rangepos-subpatterns.check create mode 100644 tests/disabled/macro/run/macro-rangepos-subpatterns.flags create mode 100644 tests/disabled/macro/run/macro-rangepos-subpatterns/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-rangepos-subpatterns/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reflective-ma-normal-mdmi.check create mode 100644 tests/disabled/macro/run/macro-reflective-ma-normal-mdmi.flags create mode 100644 tests/disabled/macro/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reflective-ma-normal-mdmi/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reflective-mamd-normal-mi.check create mode 100644 tests/disabled/macro/run/macro-reflective-mamd-normal-mi/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-basic.check create mode 100644 tests/disabled/macro/run/macro-reify-basic.flags create mode 100644 tests/disabled/macro/run/macro-reify-basic/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-basic/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-chained1/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-chained2/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-chained2/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-freevars.check create mode 100644 tests/disabled/macro/run/macro-reify-freevars.flags create mode 100644 tests/disabled/macro/run/macro-reify-freevars/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-freevars/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-nested-a1/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-nested-a1/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-nested-a2/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-nested-a2/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-nested-b1/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-nested-b1/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-nested-b2/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-nested-b2/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-ref-to-packageless.check create mode 100644 tests/disabled/macro/run/macro-reify-ref-to-packageless.flags create mode 100644 tests/disabled/macro/run/macro-reify-ref-to-packageless/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-ref-to-packageless/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-splice-outside-reify.check create mode 100644 tests/disabled/macro/run/macro-reify-splice-outside-reify.flags create mode 100644 tests/disabled/macro/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-splice-outside-reify/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-staticXXX.check create mode 100644 tests/disabled/macro/run/macro-reify-staticXXX.flags create mode 100644 tests/disabled/macro/run/macro-reify-staticXXX/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-staticXXX/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-tagful-a.check create mode 100644 tests/disabled/macro/run/macro-reify-tagful-a.flags create mode 100644 tests/disabled/macro/run/macro-reify-tagful-a/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-tagful-a/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-tagless-a.check create mode 100644 tests/disabled/macro/run/macro-reify-tagless-a.flags create mode 100644 tests/disabled/macro/run/macro-reify-tagless-a/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-tagless-a/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-type.check create mode 100644 tests/disabled/macro/run/macro-reify-type.flags create mode 100644 tests/disabled/macro/run/macro-reify-type/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-type/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-reify-typetag-notypeparams.check create mode 100644 tests/disabled/macro/run/macro-reify-typetag-notypeparams/Test.scala create mode 100644 tests/disabled/macro/run/macro-reify-typetag-typeparams-tags.check create mode 100644 tests/disabled/macro/run/macro-reify-typetag-typeparams-tags/Test.scala create mode 100644 tests/disabled/macro/run/macro-reify-unreify.check create mode 100644 tests/disabled/macro/run/macro-reify-unreify.flags create mode 100644 tests/disabled/macro/run/macro-reify-unreify/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-reify-unreify/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-repl-basic.check create mode 100644 tests/disabled/macro/run/macro-repl-basic.scala create mode 100644 tests/disabled/macro/run/macro-repl-dontexpand.check create mode 100644 tests/disabled/macro/run/macro-repl-dontexpand.scala create mode 100644 tests/disabled/macro/run/macro-settings.check create mode 100644 tests/disabled/macro/run/macro-settings.flags create mode 100644 tests/disabled/macro/run/macro-settings/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-settings/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-sip19-revised.check create mode 100644 tests/disabled/macro/run/macro-sip19-revised.flags create mode 100644 tests/disabled/macro/run/macro-sip19-revised/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-sip19-revised/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-sip19.check create mode 100644 tests/disabled/macro/run/macro-sip19.flags create mode 100644 tests/disabled/macro/run/macro-sip19/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-sip19/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-subpatterns.check create mode 100644 tests/disabled/macro/run/macro-subpatterns/Macro_1.scala create mode 100644 tests/disabled/macro/run/macro-subpatterns/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-system-properties.check create mode 100644 tests/disabled/macro/run/macro-system-properties.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-annotation.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-annotation.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-annotation/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-annotation/Macros_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-annotation/Test_3.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-anonymous.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-anonymous.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-anonymous/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-anonymous/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-block.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-block.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-block/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-block/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class-class.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class-class.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class-class/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class-class/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class-object.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class-object.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class-object/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class-object/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-class/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-default-param.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-default-param.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-default-param/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-default-param/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-implicit-class.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-implicit-class.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-implicit-class/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-method.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-method.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-method/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-method/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object-class.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object-class.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object-class/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object-class/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object-object.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object-object.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object-object/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object-object/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-object/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-package-object.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-package-object.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-package-object/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-package-object/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-refinement.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-refinement.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-refinement/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-refinement/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-trait.check create mode 100644 tests/disabled/macro/run/macro-term-declared-in-trait.flags create mode 100644 tests/disabled/macro/run/macro-term-declared-in-trait/Impls_1.scala create mode 100644 tests/disabled/macro/run/macro-term-declared-in-trait/Macros_Test_2.scala create mode 100644 tests/disabled/macro/run/macro-typecheck-implicitsdisabled.check create mode 100644 tests/disabled/macro/run/macro-typecheck-implicitsdisabled.flags create mode 100644 tests/disabled/macro/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-typecheck-implicitsdisabled/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-typecheck-macrosdisabled.check create mode 100644 tests/disabled/macro/run/macro-typecheck-macrosdisabled.flags create mode 100644 tests/disabled/macro/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-typecheck-macrosdisabled/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-typecheck-macrosdisabled2.check create mode 100644 tests/disabled/macro/run/macro-typecheck-macrosdisabled2.flags create mode 100644 tests/disabled/macro/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-typecheck-macrosdisabled2/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-undetparams-consfromsls.check create mode 100644 tests/disabled/macro/run/macro-undetparams-consfromsls.flags create mode 100644 tests/disabled/macro/run/macro-undetparams-consfromsls/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-undetparams-consfromsls/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-undetparams-macroitself.check create mode 100644 tests/disabled/macro/run/macro-undetparams-macroitself.flags create mode 100644 tests/disabled/macro/run/macro-undetparams-macroitself/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-undetparams-macroitself/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-vampire-false-warning.check create mode 100644 tests/disabled/macro/run/macro-vampire-false-warning.flags create mode 100644 tests/disabled/macro/run/macro-vampire-false-warning/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-vampire-false-warning/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-whitebox-dynamic-materialization.check create mode 100644 tests/disabled/macro/run/macro-whitebox-dynamic-materialization/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-whitebox-dynamic-materialization/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-whitebox-extractor.check create mode 100644 tests/disabled/macro/run/macro-whitebox-extractor/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-whitebox-extractor/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-whitebox-fundep-materialization.check create mode 100644 tests/disabled/macro/run/macro-whitebox-fundep-materialization/Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-whitebox-fundep-materialization/Test_2.scala create mode 100644 tests/disabled/macro/run/macro-whitebox-structural.check create mode 100644 tests/disabled/macro/run/macro-whitebox-structural/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/macro-whitebox-structural/Test_2.scala create mode 100644 tests/disabled/macro/run/macroPlugins-isBlackbox/Macros_2.scala create mode 100644 tests/disabled/macro/run/macroPlugins-isBlackbox/Plugin_1.scala create mode 100644 tests/disabled/macro/run/macroPlugins-isBlackbox/Test_3.flags create mode 100644 tests/disabled/macro/run/macroPlugins-isBlackbox/Test_3.scala create mode 100644 tests/disabled/macro/run/macroPlugins-isBlackbox/scalac-plugin.xml create mode 100644 tests/disabled/macro/run/macroPlugins-macroArgs.check create mode 100644 tests/disabled/macro/run/macroPlugins-macroArgs/Macros_2.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroArgs/Plugin_1.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroArgs/Test_3.flags create mode 100644 tests/disabled/macro/run/macroPlugins-macroArgs/Test_3.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroArgs/scalac-plugin.xml create mode 100644 tests/disabled/macro/run/macroPlugins-macroExpand.check create mode 100644 tests/disabled/macro/run/macroPlugins-macroExpand.flags create mode 100644 tests/disabled/macro/run/macroPlugins-macroExpand/Macros_2.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroExpand/Plugin_1.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroExpand/Test_3.flags create mode 100644 tests/disabled/macro/run/macroPlugins-macroExpand/Test_3.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroExpand/scalac-plugin.xml create mode 100644 tests/disabled/macro/run/macroPlugins-macroRuntime.check create mode 100644 tests/disabled/macro/run/macroPlugins-macroRuntime/Macros_2.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroRuntime/Plugin_1.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroRuntime/Test_3.flags create mode 100644 tests/disabled/macro/run/macroPlugins-macroRuntime/Test_3.scala create mode 100644 tests/disabled/macro/run/macroPlugins-macroRuntime/scalac-plugin.xml create mode 100644 tests/disabled/macro/run/macroPlugins-namerHooks.check create mode 100644 tests/disabled/macro/run/macroPlugins-namerHooks.scala create mode 100644 tests/disabled/macro/run/macroPlugins-typedMacroBody.check create mode 100644 tests/disabled/macro/run/macroPlugins-typedMacroBody.flags create mode 100644 tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.flags create mode 100644 tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.scala create mode 100644 tests/disabled/macro/run/macroPlugins-typedMacroBody/Plugin_1.scala create mode 100644 tests/disabled/macro/run/macroPlugins-typedMacroBody/Test_3.scala create mode 100644 tests/disabled/macro/run/macroPlugins-typedMacroBody/scalac-plugin.xml create mode 100644 tests/disabled/macro/run/reflection-magicsymbols-invoke.check create mode 100644 tests/disabled/macro/run/reflection-magicsymbols-invoke.scala create mode 100644 tests/disabled/macro/run/reify-each-node-type.check create mode 100644 tests/disabled/macro/run/reify-each-node-type.scala create mode 100644 tests/disabled/macro/run/reify-repl-fail-gracefully.check create mode 100644 tests/disabled/macro/run/reify-repl-fail-gracefully.scala create mode 100644 tests/disabled/macro/run/reify-staticXXX.check create mode 100644 tests/disabled/macro/run/reify-staticXXX.scala create mode 100644 tests/disabled/macro/run/reify_ann1a.check create mode 100644 tests/disabled/macro/run/reify_ann1a.scala create mode 100644 tests/disabled/macro/run/reify_ann1b.check create mode 100644 tests/disabled/macro/run/reify_ann1b.scala create mode 100644 tests/disabled/macro/run/reify_ann2a.check create mode 100644 tests/disabled/macro/run/reify_ann2a.scala create mode 100644 tests/disabled/macro/run/reify_ann3.check create mode 100644 tests/disabled/macro/run/reify_ann3.scala create mode 100644 tests/disabled/macro/run/reify_ann4.check create mode 100644 tests/disabled/macro/run/reify_ann4.scala create mode 100644 tests/disabled/macro/run/reify_ann5.check create mode 100644 tests/disabled/macro/run/reify_ann5.scala create mode 100644 tests/disabled/macro/run/reify_anonymous.check create mode 100644 tests/disabled/macro/run/reify_anonymous.scala create mode 100644 tests/disabled/macro/run/reify_classfileann_a.check create mode 100644 tests/disabled/macro/run/reify_classfileann_a.scala create mode 100644 tests/disabled/macro/run/reify_classfileann_b.check create mode 100644 tests/disabled/macro/run/reify_classfileann_b.scala create mode 100644 tests/disabled/macro/run/reify_closure1.check create mode 100644 tests/disabled/macro/run/reify_closure1.scala create mode 100644 tests/disabled/macro/run/reify_closure2a.check create mode 100644 tests/disabled/macro/run/reify_closure2a.scala create mode 100644 tests/disabled/macro/run/reify_closure3a.check create mode 100644 tests/disabled/macro/run/reify_closure3a.scala create mode 100644 tests/disabled/macro/run/reify_closure4a.check create mode 100644 tests/disabled/macro/run/reify_closure4a.scala create mode 100644 tests/disabled/macro/run/reify_closure5a.check create mode 100644 tests/disabled/macro/run/reify_closure5a.scala create mode 100644 tests/disabled/macro/run/reify_closure6.check create mode 100644 tests/disabled/macro/run/reify_closure6.scala create mode 100644 tests/disabled/macro/run/reify_closure7.check create mode 100644 tests/disabled/macro/run/reify_closure7.scala create mode 100644 tests/disabled/macro/run/reify_closure8a.check create mode 100644 tests/disabled/macro/run/reify_closure8a.scala create mode 100644 tests/disabled/macro/run/reify_closure8b.check create mode 100644 tests/disabled/macro/run/reify_closure8b.scala create mode 100644 tests/disabled/macro/run/reify_closures10.check create mode 100644 tests/disabled/macro/run/reify_closures10.scala create mode 100644 tests/disabled/macro/run/reify_complex.check create mode 100644 tests/disabled/macro/run/reify_complex.scala create mode 100644 tests/disabled/macro/run/reify_copypaste1.check create mode 100644 tests/disabled/macro/run/reify_copypaste1.scala create mode 100644 tests/disabled/macro/run/reify_copypaste2.check create mode 100644 tests/disabled/macro/run/reify_copypaste2.scala create mode 100644 tests/disabled/macro/run/reify_csv.check create mode 100644 tests/disabled/macro/run/reify_csv.scala create mode 100644 tests/disabled/macro/run/reify_extendbuiltins.check create mode 100644 tests/disabled/macro/run/reify_extendbuiltins.scala create mode 100644 tests/disabled/macro/run/reify_for1.scala create mode 100644 tests/disabled/macro/run/reify_fors_newpatmat.check create mode 100644 tests/disabled/macro/run/reify_fors_newpatmat.scala create mode 100644 tests/disabled/macro/run/reify_fors_oldpatmat.check create mode 100644 tests/disabled/macro/run/reify_fors_oldpatmat.scala create mode 100644 tests/disabled/macro/run/reify_generic.check create mode 100644 tests/disabled/macro/run/reify_generic.scala create mode 100644 tests/disabled/macro/run/reify_generic2.check create mode 100644 tests/disabled/macro/run/reify_generic2.scala create mode 100644 tests/disabled/macro/run/reify_getter.check create mode 100644 tests/disabled/macro/run/reify_getter.scala create mode 100644 tests/disabled/macro/run/reify_implicits-new.check create mode 100644 tests/disabled/macro/run/reify_implicits-new.scala create mode 100644 tests/disabled/macro/run/reify_implicits-old.check create mode 100644 tests/disabled/macro/run/reify_implicits-old.scala create mode 100644 tests/disabled/macro/run/reify_inheritance.check create mode 100644 tests/disabled/macro/run/reify_inheritance.scala create mode 100644 tests/disabled/macro/run/reify_inner1.check create mode 100644 tests/disabled/macro/run/reify_inner1.scala create mode 100644 tests/disabled/macro/run/reify_inner2.check create mode 100644 tests/disabled/macro/run/reify_inner2.scala create mode 100644 tests/disabled/macro/run/reify_inner3.check create mode 100644 tests/disabled/macro/run/reify_inner3.scala create mode 100644 tests/disabled/macro/run/reify_inner4.check create mode 100644 tests/disabled/macro/run/reify_inner4.scala create mode 100644 tests/disabled/macro/run/reify_lazyevaluation.check create mode 100644 tests/disabled/macro/run/reify_lazyevaluation.scala create mode 100644 tests/disabled/macro/run/reify_lazyunit.check create mode 100644 tests/disabled/macro/run/reify_lazyunit.scala create mode 100644 tests/disabled/macro/run/reify_maps_newpatmat.check create mode 100644 tests/disabled/macro/run/reify_maps_newpatmat.scala create mode 100644 tests/disabled/macro/run/reify_maps_oldpatmat.check create mode 100644 tests/disabled/macro/run/reify_maps_oldpatmat.scala create mode 100644 tests/disabled/macro/run/reify_metalevel_breach_+0_refers_to_1.check create mode 100644 tests/disabled/macro/run/reify_metalevel_breach_+0_refers_to_1.scala create mode 100644 tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_a.check create mode 100644 tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_a.scala create mode 100644 tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_b.check create mode 100644 tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_b.scala create mode 100644 tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_1.check create mode 100644 tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_1.scala create mode 100644 tests/disabled/macro/run/reify_nested_inner_refers_to_global.check create mode 100644 tests/disabled/macro/run/reify_nested_inner_refers_to_global.scala create mode 100644 tests/disabled/macro/run/reify_nested_inner_refers_to_local.check create mode 100644 tests/disabled/macro/run/reify_nested_inner_refers_to_local.scala create mode 100644 tests/disabled/macro/run/reify_nested_outer_refers_to_global.check create mode 100644 tests/disabled/macro/run/reify_nested_outer_refers_to_global.scala create mode 100644 tests/disabled/macro/run/reify_nested_outer_refers_to_local.check create mode 100644 tests/disabled/macro/run/reify_nested_outer_refers_to_local.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_01.check create mode 100644 tests/disabled/macro/run/reify_newimpl_01.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_02.check create mode 100644 tests/disabled/macro/run/reify_newimpl_02.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_03.check create mode 100644 tests/disabled/macro/run/reify_newimpl_03.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_04.check create mode 100644 tests/disabled/macro/run/reify_newimpl_04.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_05.check create mode 100644 tests/disabled/macro/run/reify_newimpl_05.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_06.check create mode 100644 tests/disabled/macro/run/reify_newimpl_06.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_11.check create mode 100644 tests/disabled/macro/run/reify_newimpl_11.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_12.check create mode 100644 tests/disabled/macro/run/reify_newimpl_12.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_13.check create mode 100644 tests/disabled/macro/run/reify_newimpl_13.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_14.check create mode 100644 tests/disabled/macro/run/reify_newimpl_14.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_15.check create mode 100644 tests/disabled/macro/run/reify_newimpl_15.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_18.check create mode 100644 tests/disabled/macro/run/reify_newimpl_18.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_19.check create mode 100644 tests/disabled/macro/run/reify_newimpl_19.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_20.check create mode 100644 tests/disabled/macro/run/reify_newimpl_20.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_21.check create mode 100644 tests/disabled/macro/run/reify_newimpl_21.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_22.check create mode 100644 tests/disabled/macro/run/reify_newimpl_22.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_23.check create mode 100644 tests/disabled/macro/run/reify_newimpl_23.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_27.check create mode 100644 tests/disabled/macro/run/reify_newimpl_27.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_29.check create mode 100644 tests/disabled/macro/run/reify_newimpl_29.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_30.check create mode 100644 tests/disabled/macro/run/reify_newimpl_30.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_31.check create mode 100644 tests/disabled/macro/run/reify_newimpl_31.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_33.check create mode 100644 tests/disabled/macro/run/reify_newimpl_33.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_35.check create mode 100644 tests/disabled/macro/run/reify_newimpl_35.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_36.check create mode 100644 tests/disabled/macro/run/reify_newimpl_36.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_37.check create mode 100644 tests/disabled/macro/run/reify_newimpl_37.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_38.check create mode 100644 tests/disabled/macro/run/reify_newimpl_38.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_39.check create mode 100644 tests/disabled/macro/run/reify_newimpl_39.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_40.check create mode 100644 tests/disabled/macro/run/reify_newimpl_40.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_41.check create mode 100644 tests/disabled/macro/run/reify_newimpl_41.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_42.check create mode 100644 tests/disabled/macro/run/reify_newimpl_42.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_43.check create mode 100644 tests/disabled/macro/run/reify_newimpl_43.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_44.check create mode 100644 tests/disabled/macro/run/reify_newimpl_44.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_45.check create mode 100644 tests/disabled/macro/run/reify_newimpl_45.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_47.check create mode 100644 tests/disabled/macro/run/reify_newimpl_47.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_48.check create mode 100644 tests/disabled/macro/run/reify_newimpl_48.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_49.check create mode 100644 tests/disabled/macro/run/reify_newimpl_49.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_50.check create mode 100644 tests/disabled/macro/run/reify_newimpl_50.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_51.check create mode 100644 tests/disabled/macro/run/reify_newimpl_51.scala create mode 100644 tests/disabled/macro/run/reify_newimpl_52.check create mode 100644 tests/disabled/macro/run/reify_newimpl_52.scala create mode 100644 tests/disabled/macro/run/reify_printf.check create mode 100644 tests/disabled/macro/run/reify_printf.scala create mode 100644 tests/disabled/macro/run/reify_properties.check create mode 100644 tests/disabled/macro/run/reify_properties.scala create mode 100644 tests/disabled/macro/run/reify_renamed_term_basic.check create mode 100644 tests/disabled/macro/run/reify_renamed_term_basic.scala create mode 100644 tests/disabled/macro/run/reify_renamed_term_local_to_reifee.check create mode 100644 tests/disabled/macro/run/reify_renamed_term_local_to_reifee.scala create mode 100644 tests/disabled/macro/run/reify_renamed_term_overloaded_method.check create mode 100644 tests/disabled/macro/run/reify_renamed_term_overloaded_method.scala create mode 100644 tests/disabled/macro/run/reify_renamed_term_t5841.check create mode 100644 tests/disabled/macro/run/reify_renamed_term_t5841.scala create mode 100644 tests/disabled/macro/run/reify_renamed_type_basic.check create mode 100644 tests/disabled/macro/run/reify_renamed_type_basic.scala create mode 100644 tests/disabled/macro/run/reify_renamed_type_local_to_reifee.check create mode 100644 tests/disabled/macro/run/reify_renamed_type_local_to_reifee.scala create mode 100644 tests/disabled/macro/run/reify_renamed_type_spliceable.check create mode 100644 tests/disabled/macro/run/reify_renamed_type_spliceable.scala create mode 100644 tests/disabled/macro/run/reify_sort.check create mode 100644 tests/disabled/macro/run/reify_sort.scala create mode 100644 tests/disabled/macro/run/reify_sort1.check create mode 100644 tests/disabled/macro/run/reify_sort1.scala create mode 100644 tests/disabled/macro/run/reify_this.check create mode 100644 tests/disabled/macro/run/reify_this.scala create mode 100644 tests/disabled/macro/run/reify_timeofday.check create mode 100644 tests/disabled/macro/run/reify_timeofday.scala create mode 100644 tests/disabled/macro/run/reify_typerefs_1a.check create mode 100644 tests/disabled/macro/run/reify_typerefs_1a.scala create mode 100644 tests/disabled/macro/run/reify_typerefs_1b.check create mode 100644 tests/disabled/macro/run/reify_typerefs_1b.scala create mode 100644 tests/disabled/macro/run/reify_typerefs_2a.check create mode 100644 tests/disabled/macro/run/reify_typerefs_2a.scala create mode 100644 tests/disabled/macro/run/reify_typerefs_2b.check create mode 100644 tests/disabled/macro/run/reify_typerefs_2b.scala create mode 100644 tests/disabled/macro/run/reify_typerefs_3a.check create mode 100644 tests/disabled/macro/run/reify_typerefs_3a.scala create mode 100644 tests/disabled/macro/run/reify_typerefs_3b.check create mode 100644 tests/disabled/macro/run/reify_typerefs_3b.scala create mode 100644 tests/disabled/macro/run/reify_varargs.check create mode 100644 tests/disabled/macro/run/reify_varargs.scala create mode 100644 tests/disabled/macro/run/repl-term-macros.check create mode 100644 tests/disabled/macro/run/repl-term-macros.scala create mode 100644 tests/disabled/macro/run/runtimeEval1.check create mode 100644 tests/disabled/macro/run/runtimeEval1.scala create mode 100644 tests/disabled/macro/run/runtimeEval2.check create mode 100644 tests/disabled/macro/run/runtimeEval2.scala create mode 100644 tests/disabled/macro/run/showdecl.check create mode 100644 tests/disabled/macro/run/showdecl/Macros_1.scala create mode 100644 tests/disabled/macro/run/showdecl/Test_2.scala create mode 100644 tests/disabled/macro/run/showraw_mods.check create mode 100644 tests/disabled/macro/run/showraw_mods.scala create mode 100644 tests/disabled/macro/run/showraw_tree.check create mode 100644 tests/disabled/macro/run/showraw_tree.scala create mode 100644 tests/disabled/macro/run/showraw_tree_ids.check create mode 100644 tests/disabled/macro/run/showraw_tree_ids.scala create mode 100644 tests/disabled/macro/run/showraw_tree_kinds.check create mode 100644 tests/disabled/macro/run/showraw_tree_kinds.scala create mode 100644 tests/disabled/macro/run/showraw_tree_types_ids.check create mode 100644 tests/disabled/macro/run/showraw_tree_types_ids.scala create mode 100644 tests/disabled/macro/run/showraw_tree_types_typed.check create mode 100644 tests/disabled/macro/run/showraw_tree_types_typed.scala create mode 100644 tests/disabled/macro/run/showraw_tree_types_untyped.check create mode 100644 tests/disabled/macro/run/showraw_tree_types_untyped.scala create mode 100644 tests/disabled/macro/run/showraw_tree_ultimate.check create mode 100644 tests/disabled/macro/run/showraw_tree_ultimate.scala create mode 100644 tests/disabled/macro/run/t2886.check create mode 100644 tests/disabled/macro/run/t2886.scala create mode 100644 tests/disabled/macro/run/t5224.check create mode 100644 tests/disabled/macro/run/t5224.scala create mode 100644 tests/disabled/macro/run/t5225_1.check create mode 100644 tests/disabled/macro/run/t5225_1.scala create mode 100644 tests/disabled/macro/run/t5225_2.check create mode 100644 tests/disabled/macro/run/t5225_2.scala create mode 100644 tests/disabled/macro/run/t5229_1.scala create mode 100644 tests/disabled/macro/run/t5229_2.check create mode 100644 tests/disabled/macro/run/t5229_2.scala create mode 100644 tests/disabled/macro/run/t5230.check create mode 100644 tests/disabled/macro/run/t5230.scala create mode 100644 tests/disabled/macro/run/t5258a.check create mode 100644 tests/disabled/macro/run/t5258a.scala create mode 100644 tests/disabled/macro/run/t5266_1.check create mode 100644 tests/disabled/macro/run/t5266_1.scala create mode 100644 tests/disabled/macro/run/t5266_2.check create mode 100644 tests/disabled/macro/run/t5266_2.scala create mode 100644 tests/disabled/macro/run/t5269.check create mode 100644 tests/disabled/macro/run/t5269.scala create mode 100644 tests/disabled/macro/run/t5270.check create mode 100644 tests/disabled/macro/run/t5270.scala create mode 100644 tests/disabled/macro/run/t5271_1.check create mode 100644 tests/disabled/macro/run/t5271_1.scala create mode 100644 tests/disabled/macro/run/t5271_2.check create mode 100644 tests/disabled/macro/run/t5271_2.scala create mode 100644 tests/disabled/macro/run/t5271_3.check create mode 100644 tests/disabled/macro/run/t5271_3.scala create mode 100644 tests/disabled/macro/run/t5271_4.scala create mode 100644 tests/disabled/macro/run/t5272_1_newpatmat.check create mode 100644 tests/disabled/macro/run/t5272_1_newpatmat.scala create mode 100644 tests/disabled/macro/run/t5272_1_oldpatmat.check create mode 100644 tests/disabled/macro/run/t5272_1_oldpatmat.scala create mode 100644 tests/disabled/macro/run/t5272_2_newpatmat.check create mode 100644 tests/disabled/macro/run/t5272_2_newpatmat.scala create mode 100644 tests/disabled/macro/run/t5272_2_oldpatmat.check create mode 100644 tests/disabled/macro/run/t5272_2_oldpatmat.scala create mode 100644 tests/disabled/macro/run/t5273_1_newpatmat.check create mode 100644 tests/disabled/macro/run/t5273_1_newpatmat.scala create mode 100644 tests/disabled/macro/run/t5273_1_oldpatmat.check create mode 100644 tests/disabled/macro/run/t5273_1_oldpatmat.scala create mode 100644 tests/disabled/macro/run/t5273_2a_newpatmat.check create mode 100644 tests/disabled/macro/run/t5273_2a_newpatmat.scala create mode 100644 tests/disabled/macro/run/t5273_2a_oldpatmat.check create mode 100644 tests/disabled/macro/run/t5273_2a_oldpatmat.scala create mode 100644 tests/disabled/macro/run/t5273_2b_newpatmat.check create mode 100644 tests/disabled/macro/run/t5273_2b_newpatmat.scala create mode 100644 tests/disabled/macro/run/t5273_2b_oldpatmat.check create mode 100644 tests/disabled/macro/run/t5273_2b_oldpatmat.scala create mode 100644 tests/disabled/macro/run/t5274_1.check create mode 100644 tests/disabled/macro/run/t5274_1.scala create mode 100644 tests/disabled/macro/run/t5274_2.check create mode 100644 tests/disabled/macro/run/t5274_2.scala create mode 100644 tests/disabled/macro/run/t5275.check create mode 100644 tests/disabled/macro/run/t5275.scala create mode 100644 tests/disabled/macro/run/t5276_1a.check create mode 100644 tests/disabled/macro/run/t5276_1a.scala create mode 100644 tests/disabled/macro/run/t5276_1b.check create mode 100644 tests/disabled/macro/run/t5276_1b.scala create mode 100644 tests/disabled/macro/run/t5276_2a.check create mode 100644 tests/disabled/macro/run/t5276_2a.scala create mode 100644 tests/disabled/macro/run/t5276_2b.check create mode 100644 tests/disabled/macro/run/t5276_2b.scala create mode 100644 tests/disabled/macro/run/t5277_1.check create mode 100644 tests/disabled/macro/run/t5277_1.scala create mode 100644 tests/disabled/macro/run/t5277_2.check create mode 100644 tests/disabled/macro/run/t5277_2.scala create mode 100644 tests/disabled/macro/run/t5279.check create mode 100644 tests/disabled/macro/run/t5279.scala create mode 100644 tests/disabled/macro/run/t5334_1.check create mode 100644 tests/disabled/macro/run/t5334_1.scala create mode 100644 tests/disabled/macro/run/t5334_2.check create mode 100644 tests/disabled/macro/run/t5334_2.scala create mode 100644 tests/disabled/macro/run/t5335.check create mode 100644 tests/disabled/macro/run/t5335.scala create mode 100644 tests/disabled/macro/run/t5415.scala create mode 100644 tests/disabled/macro/run/t5418.scala create mode 100644 tests/disabled/macro/run/t5418a.check create mode 100644 tests/disabled/macro/run/t5418a.scala create mode 100644 tests/disabled/macro/run/t5418b.check create mode 100644 tests/disabled/macro/run/t5418b.scala create mode 100644 tests/disabled/macro/run/t5419.check create mode 100644 tests/disabled/macro/run/t5419.scala create mode 100644 tests/disabled/macro/run/t5704.check create mode 100644 tests/disabled/macro/run/t5704.flags create mode 100644 tests/disabled/macro/run/t5704.scala create mode 100644 tests/disabled/macro/run/t5710-1.check create mode 100644 tests/disabled/macro/run/t5710-1.scala create mode 100644 tests/disabled/macro/run/t5710-2.check create mode 100644 tests/disabled/macro/run/t5710-2.scala create mode 100644 tests/disabled/macro/run/t5713.check create mode 100644 tests/disabled/macro/run/t5713.flags create mode 100644 tests/disabled/macro/run/t5713/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/t5713/Test_2.scala create mode 100644 tests/disabled/macro/run/t5753_1.check create mode 100644 tests/disabled/macro/run/t5753_1.flags create mode 100644 tests/disabled/macro/run/t5753_1/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/t5753_1/Test_2.scala create mode 100644 tests/disabled/macro/run/t5753_2.check create mode 100644 tests/disabled/macro/run/t5753_2.flags create mode 100644 tests/disabled/macro/run/t5753_2/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/t5753_2/Test_2.scala create mode 100644 tests/disabled/macro/run/t5770.check create mode 100644 tests/disabled/macro/run/t5770.scala create mode 100644 tests/disabled/macro/run/t5816.check create mode 100644 tests/disabled/macro/run/t5816.scala create mode 100644 tests/disabled/macro/run/t5824.check create mode 100644 tests/disabled/macro/run/t5824.scala create mode 100644 tests/disabled/macro/run/t5840.scala create mode 100644 tests/disabled/macro/run/t5894.scala create mode 100644 tests/disabled/macro/run/t5903a.check create mode 100644 tests/disabled/macro/run/t5903a.flags create mode 100644 tests/disabled/macro/run/t5903a/Macros_1.scala create mode 100644 tests/disabled/macro/run/t5903a/Test_2.scala create mode 100644 tests/disabled/macro/run/t5903b.check create mode 100644 tests/disabled/macro/run/t5903b.flags create mode 100644 tests/disabled/macro/run/t5903b/Macros_1.scala create mode 100644 tests/disabled/macro/run/t5903b/Test_2.scala create mode 100644 tests/disabled/macro/run/t5903c.check create mode 100644 tests/disabled/macro/run/t5903c.flags create mode 100644 tests/disabled/macro/run/t5903c/Macros_1.scala create mode 100644 tests/disabled/macro/run/t5903c/Test_2.scala create mode 100644 tests/disabled/macro/run/t5903d.check create mode 100644 tests/disabled/macro/run/t5903d.flags create mode 100644 tests/disabled/macro/run/t5903d/Macros_1.scala create mode 100644 tests/disabled/macro/run/t5903d/Test_2.scala create mode 100644 tests/disabled/macro/run/t5923a.check create mode 100644 tests/disabled/macro/run/t5923a/Macros_1.scala create mode 100644 tests/disabled/macro/run/t5923a/Test_2.scala create mode 100644 tests/disabled/macro/run/t5923d/Macros_1.scala create mode 100644 tests/disabled/macro/run/t5923d/Test_2.scala create mode 100644 tests/disabled/macro/run/t5940.scala create mode 100644 tests/disabled/macro/run/t6023.check create mode 100644 tests/disabled/macro/run/t6023.scala create mode 100644 tests/disabled/macro/run/t6187.check create mode 100644 tests/disabled/macro/run/t6187.scala create mode 100644 tests/disabled/macro/run/t6187b.scala create mode 100644 tests/disabled/macro/run/t6221.check create mode 100644 tests/disabled/macro/run/t6221/Macros_1.scala create mode 100644 tests/disabled/macro/run/t6221/Test_2.scala create mode 100644 tests/disabled/macro/run/t6379.check create mode 100644 tests/disabled/macro/run/t6379/Macros_1.scala create mode 100644 tests/disabled/macro/run/t6379/Test_2.scala create mode 100644 tests/disabled/macro/run/t6381.check create mode 100644 tests/disabled/macro/run/t6381.scala create mode 100644 tests/disabled/macro/run/t6394a.check create mode 100644 tests/disabled/macro/run/t6394a.flags create mode 100644 tests/disabled/macro/run/t6394a/Macros_1.scala create mode 100644 tests/disabled/macro/run/t6394a/Test_2.scala create mode 100644 tests/disabled/macro/run/t6394b.check create mode 100644 tests/disabled/macro/run/t6394b.flags create mode 100644 tests/disabled/macro/run/t6394b/Macros_1.scala create mode 100644 tests/disabled/macro/run/t6394b/Test_2.scala create mode 100644 tests/disabled/macro/run/t6591_1.check create mode 100644 tests/disabled/macro/run/t6591_1.scala create mode 100644 tests/disabled/macro/run/t6591_2.check create mode 100644 tests/disabled/macro/run/t6591_2.scala create mode 100644 tests/disabled/macro/run/t6591_3.check create mode 100644 tests/disabled/macro/run/t6591_3.scala create mode 100644 tests/disabled/macro/run/t6591_5.check create mode 100644 tests/disabled/macro/run/t6591_5.scala create mode 100644 tests/disabled/macro/run/t6591_6.check create mode 100644 tests/disabled/macro/run/t6591_6.scala create mode 100644 tests/disabled/macro/run/t6591_7.check create mode 100644 tests/disabled/macro/run/t6591_7.scala create mode 100644 tests/disabled/macro/run/t6662.check create mode 100644 tests/disabled/macro/run/t6662/Macro_1.scala create mode 100644 tests/disabled/macro/run/t6662/Test_2.scala create mode 100644 tests/disabled/macro/run/t6814.check create mode 100644 tests/disabled/macro/run/t6814/Macros_1.scala create mode 100644 tests/disabled/macro/run/t6814/Test_2.scala create mode 100644 tests/disabled/macro/run/t6992.check create mode 100644 tests/disabled/macro/run/t6992/Macros_1.scala create mode 100644 tests/disabled/macro/run/t6992/Test_2.scala create mode 100644 tests/disabled/macro/run/t7008-scala-defined.check create mode 100644 tests/disabled/macro/run/t7008-scala-defined.flags create mode 100644 tests/disabled/macro/run/t7008-scala-defined/Impls_Macros_2.scala create mode 100644 tests/disabled/macro/run/t7008-scala-defined/ScalaClassWithCheckedExceptions_1.scala create mode 100644 tests/disabled/macro/run/t7008-scala-defined/Test_3.scala create mode 100644 tests/disabled/macro/run/t7008.check create mode 100644 tests/disabled/macro/run/t7008/Impls_Macros_2.scala create mode 100644 tests/disabled/macro/run/t7008/JavaClassWithCheckedExceptions_1.java create mode 100644 tests/disabled/macro/run/t7008/Test_3.scala create mode 100644 tests/disabled/macro/run/t7044.check create mode 100644 tests/disabled/macro/run/t7044/Macros_1.scala create mode 100644 tests/disabled/macro/run/t7044/Test_2.scala create mode 100644 tests/disabled/macro/run/t7047.check create mode 100644 tests/disabled/macro/run/t7047/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/t7047/Test_2.scala create mode 100644 tests/disabled/macro/run/t7157.check create mode 100644 tests/disabled/macro/run/t7157/Impls_Macros_1.scala create mode 100644 tests/disabled/macro/run/t7157/Test_2.scala create mode 100644 tests/disabled/macro/run/t7185.check create mode 100644 tests/disabled/macro/run/t7185.scala create mode 100644 tests/disabled/macro/run/t7235.check create mode 100644 tests/disabled/macro/run/t7235.scala create mode 100644 tests/disabled/macro/run/t7240/Macros_1.scala create mode 100644 tests/disabled/macro/run/t7240/Test_2.scala create mode 100644 tests/disabled/macro/run/t7375b.check create mode 100644 tests/disabled/macro/run/t7375b/Macros_1.scala create mode 100644 tests/disabled/macro/run/t7375b/Test_2.scala create mode 100644 tests/disabled/macro/run/t7558.scala create mode 100644 tests/disabled/macro/run/t7617a.check create mode 100644 tests/disabled/macro/run/t7617a/Macros_1.scala create mode 100644 tests/disabled/macro/run/t7617a/Test_2.scala create mode 100644 tests/disabled/macro/run/t7617b.check create mode 100644 tests/disabled/macro/run/t7617b/Macros_1.scala create mode 100644 tests/disabled/macro/run/t7617b/Test_2.scala create mode 100644 tests/disabled/macro/run/t7657.check create mode 100644 tests/disabled/macro/run/t7657/Macros_1.scala create mode 100644 tests/disabled/macro/run/t7657/Test_2.scala create mode 100644 tests/disabled/macro/run/t7777.check create mode 100644 tests/disabled/macro/run/t7777/Macros_1.scala create mode 100644 tests/disabled/macro/run/t7777/Test_2.scala create mode 100644 tests/disabled/macro/run/t7868b.check create mode 100644 tests/disabled/macro/run/t7868b.scala create mode 100644 tests/disabled/macro/run/t7871.check create mode 100644 tests/disabled/macro/run/t7871/Macros_1.scala create mode 100644 tests/disabled/macro/run/t7871/Test_2.scala create mode 100644 tests/disabled/macro/run/t8048a.check create mode 100644 tests/disabled/macro/run/t8048a/Macros_1.scala create mode 100644 tests/disabled/macro/run/t8048a/Test_2.scala create mode 100644 tests/disabled/macro/run/t8048b.check create mode 100644 tests/disabled/macro/run/t8048b/Macros_1.scala create mode 100644 tests/disabled/macro/run/t8048b/Test_2.scala create mode 100644 tests/disabled/macro/run/t8104.check create mode 100644 tests/disabled/macro/run/t8104/Macros_1.scala create mode 100644 tests/disabled/macro/run/t8104/Test_2.scala create mode 100644 tests/disabled/macro/run/t8192.check create mode 100644 tests/disabled/macro/run/t8192/Macros_1.scala create mode 100644 tests/disabled/macro/run/t8192/Test_2.scala create mode 100644 tests/disabled/macro/run/t8321.check create mode 100644 tests/disabled/macro/run/t8321/Macros_1.scala create mode 100644 tests/disabled/macro/run/t8321/Test_2.scala create mode 100644 tests/disabled/macro/run/t8425.check create mode 100644 tests/disabled/macro/run/t8425/Macros_1.scala create mode 100644 tests/disabled/macro/run/t8425/Test_2.scala create mode 100644 tests/disabled/macro/run/t8437.check create mode 100644 tests/disabled/macro/run/t8437/Macros_1.scala create mode 100644 tests/disabled/macro/run/t8437/Test_2.scala create mode 100644 tests/disabled/macro/run/toolbox_console_reporter.check create mode 100644 tests/disabled/macro/run/toolbox_console_reporter.scala create mode 100644 tests/disabled/macro/run/toolbox_current_run_compiles.check create mode 100644 tests/disabled/macro/run/toolbox_current_run_compiles.scala create mode 100644 tests/disabled/macro/run/toolbox_default_reporter_is_silent.check create mode 100644 tests/disabled/macro/run/toolbox_default_reporter_is_silent.scala create mode 100644 tests/disabled/macro/run/toolbox_silent_reporter.check create mode 100644 tests/disabled/macro/run/toolbox_silent_reporter.scala create mode 100644 tests/disabled/macro/run/toolbox_typecheck_macrosdisabled.check create mode 100644 tests/disabled/macro/run/toolbox_typecheck_macrosdisabled.scala create mode 100644 tests/disabled/macro/run/toolbox_typecheck_macrosdisabled2.check create mode 100644 tests/disabled/macro/run/toolbox_typecheck_macrosdisabled2.scala create mode 100644 tests/disabled/macro/run/typecheck.check create mode 100644 tests/disabled/macro/run/typecheck/Macros_1.scala create mode 100644 tests/disabled/macro/run/typecheck/Test_2.scala create mode 100644 tests/disabled/macro/run/typed-annotated.check create mode 100644 tests/disabled/macro/run/typed-annotated/Macros_1.scala create mode 100644 tests/disabled/macro/run/typed-annotated/Test_2.scala (limited to 'tests/disabled') diff --git a/tests/disabled/macro/pos/attachments-typed-another-ident/Impls_1.scala b/tests/disabled/macro/pos/attachments-typed-another-ident/Impls_1.scala new file mode 100644 index 000000000..98062a9c7 --- /dev/null +++ b/tests/disabled/macro/pos/attachments-typed-another-ident/Impls_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +object MyAttachment + +object Macros { + def impl(c: Context) = { + import c.universe._ + import internal._ + val ident = updateAttachment(Ident(TermName("bar")), MyAttachment) + assert(attachments(ident).get[MyAttachment.type].isDefined, attachments(ident)) + val typed = c.typecheck(ident) + assert(attachments(typed).get[MyAttachment.type].isDefined, attachments(typed)) + c.Expr[Int](typed) + } + + def foo = macro impl +} diff --git a/tests/disabled/macro/pos/attachments-typed-another-ident/Macros_Test_2.scala b/tests/disabled/macro/pos/attachments-typed-another-ident/Macros_Test_2.scala new file mode 100644 index 000000000..022639bfe --- /dev/null +++ b/tests/disabled/macro/pos/attachments-typed-another-ident/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + def bar = 2 + Macros.foo +} + diff --git a/tests/disabled/macro/pos/attachments-typed-ident/Impls_1.scala b/tests/disabled/macro/pos/attachments-typed-ident/Impls_1.scala new file mode 100644 index 000000000..98062a9c7 --- /dev/null +++ b/tests/disabled/macro/pos/attachments-typed-ident/Impls_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +object MyAttachment + +object Macros { + def impl(c: Context) = { + import c.universe._ + import internal._ + val ident = updateAttachment(Ident(TermName("bar")), MyAttachment) + assert(attachments(ident).get[MyAttachment.type].isDefined, attachments(ident)) + val typed = c.typecheck(ident) + assert(attachments(typed).get[MyAttachment.type].isDefined, attachments(typed)) + c.Expr[Int](typed) + } + + def foo = macro impl +} diff --git a/tests/disabled/macro/pos/attachments-typed-ident/Macros_Test_2.scala b/tests/disabled/macro/pos/attachments-typed-ident/Macros_Test_2.scala new file mode 100644 index 000000000..45a0609de --- /dev/null +++ b/tests/disabled/macro/pos/attachments-typed-ident/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def bar = 2 + Macros.foo +} diff --git a/tests/disabled/macro/pos/liftcode_polymorphic.scala b/tests/disabled/macro/pos/liftcode_polymorphic.scala new file mode 100644 index 000000000..249f5a056 --- /dev/null +++ b/tests/disabled/macro/pos/liftcode_polymorphic.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ + +object Append extends App { + + def append[A](l1: List[A], l2: List[A]):List[A] = + l1 match { + case Nil => l2 + case x::xs => x :: append(xs, l2) + } + + println(reify(append _).tree) +} diff --git a/tests/disabled/macro/pos/macro-bundle-disambiguate-bundle.check b/tests/disabled/macro/pos/macro-bundle-disambiguate-bundle.check new file mode 100644 index 000000000..e69de29bb diff --git a/tests/disabled/macro/pos/macro-bundle-disambiguate-bundle.scala b/tests/disabled/macro/pos/macro-bundle-disambiguate-bundle.scala new file mode 100644 index 000000000..40d965b0e --- /dev/null +++ b/tests/disabled/macro/pos/macro-bundle-disambiguate-bundle.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +class Macros(val c: Context) { + def impl = ??? +} + +object Macros { + def impl(c: Context)(x: c.Tree) = ??? +} + +object Test extends App { + def foo: Unit = macro Macros.impl +} diff --git a/tests/disabled/macro/pos/macro-bundle-disambiguate-nonbundle.check b/tests/disabled/macro/pos/macro-bundle-disambiguate-nonbundle.check new file mode 100644 index 000000000..e69de29bb diff --git a/tests/disabled/macro/pos/macro-bundle-disambiguate-nonbundle.scala b/tests/disabled/macro/pos/macro-bundle-disambiguate-nonbundle.scala new file mode 100644 index 000000000..185177607 --- /dev/null +++ b/tests/disabled/macro/pos/macro-bundle-disambiguate-nonbundle.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +class Macros(val c: Context) { + def impl(x: c.Tree) = ??? +} + +object Macros { + def impl(c: Context) = ??? +} + +object Test extends App { + def foo: Unit = macro Macros.impl +} diff --git a/tests/disabled/macro/pos/macro-implicit-invalidate-on-error.check b/tests/disabled/macro/pos/macro-implicit-invalidate-on-error.check new file mode 100644 index 000000000..e69de29bb diff --git a/tests/disabled/macro/pos/macro-implicit-invalidate-on-error.scala b/tests/disabled/macro/pos/macro-implicit-invalidate-on-error.scala new file mode 100644 index 000000000..bb83e3cc3 --- /dev/null +++ b/tests/disabled/macro/pos/macro-implicit-invalidate-on-error.scala @@ -0,0 +1,25 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +trait LegacyLiftable[T] { + def apply(universe: scala.reflect.api.Universe, value: T): universe.Tree +} + +object LegacyLiftable { + implicit def liftCaseClass[T <: Product]: LegacyLiftable[T] = macro liftCaseClassImpl[T] + + def liftCaseClassImpl[T: c.WeakTypeTag](c: Context): c.Expr[LegacyLiftable[T]] = { + import c.universe._ + val tpe = weakTypeOf[T] + if (!tpe.typeSymbol.asClass.isCaseClass) c.abort(c.enclosingPosition, "denied") + val p = List(q"Literal(Constant(1))") + c.Expr[LegacyLiftable[T]] { q""" + new LegacyLiftable[$tpe] { + def apply(universe: scala.reflect.api.Universe, value: $tpe): universe.Tree = { + import universe._ + Apply(Select(Ident(TermName("C")), TermName("apply")), List(..$p)) + } + } + """ } + } +} diff --git a/tests/disabled/macro/pos/macro-qmarkqmarkqmark.scala b/tests/disabled/macro/pos/macro-qmarkqmarkqmark.scala new file mode 100644 index 000000000..de94d69d5 --- /dev/null +++ b/tests/disabled/macro/pos/macro-qmarkqmarkqmark.scala @@ -0,0 +1,7 @@ +import language.experimental.macros + +object Macros { + def foo1 = macro ??? + def foo2(x: Int) = macro ??? + def foo3[T] = macro ??? +} diff --git a/tests/disabled/macro/pos/t5223.scala b/tests/disabled/macro/pos/t5223.scala new file mode 100644 index 000000000..bfd1e153c --- /dev/null +++ b/tests/disabled/macro/pos/t5223.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Foo extends App { + reify{def printf(format: String, args: Any*): String = null } + reify{def printf(format: String, args: Any*): String = ("abc": @deprecated)} +} diff --git a/tests/disabled/macro/pos/t5692a/Macros_1.scala b/tests/disabled/macro/pos/t5692a/Macros_1.scala new file mode 100644 index 000000000..6e5069aff --- /dev/null +++ b/tests/disabled/macro/pos/t5692a/Macros_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl[T](c: Context) = { import c.universe._; c.Expr[Unit](q"()") } + def foo[T] = macro impl[T] +} diff --git a/tests/disabled/macro/pos/t5692a/Test_2.scala b/tests/disabled/macro/pos/t5692a/Test_2.scala new file mode 100644 index 000000000..72ecd9576 --- /dev/null +++ b/tests/disabled/macro/pos/t5692a/Test_2.scala @@ -0,0 +1,3 @@ +class Test { + def x = Macros.foo +} diff --git a/tests/disabled/macro/pos/t5692b/Macros_1.scala b/tests/disabled/macro/pos/t5692b/Macros_1.scala new file mode 100644 index 000000000..82109075f --- /dev/null +++ b/tests/disabled/macro/pos/t5692b/Macros_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl[T, U](c: Context) = { import c.universe._; c.Expr[Unit](q"()") } + def foo[T, U] = macro impl[T, U] +} diff --git a/tests/disabled/macro/pos/t5692b/Test_2.scala b/tests/disabled/macro/pos/t5692b/Test_2.scala new file mode 100644 index 000000000..72ecd9576 --- /dev/null +++ b/tests/disabled/macro/pos/t5692b/Test_2.scala @@ -0,0 +1,3 @@ +class Test { + def x = Macros.foo +} diff --git a/tests/disabled/macro/pos/t5706.flags b/tests/disabled/macro/pos/t5706.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/pos/t5706.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/pos/t5706.scala b/tests/disabled/macro/pos/t5706.scala new file mode 100644 index 000000000..6f0207366 --- /dev/null +++ b/tests/disabled/macro/pos/t5706.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.blackbox.{Context => BlackboxContext} +import scala.reflect.macros.whitebox.{Context => WhiteboxContext} + +class Logger { + def error1(message: String) = macro Impls.error1 + def error2(message: String) = macro Impls.error2 +} + +object Impls { + type LoggerContext1 = BlackboxContext { type PrefixType = Logger } + def error1(c: LoggerContext1)(message: c.Expr[String]): c.Expr[Unit] = ??? + + type LoggerContext2 = WhiteboxContext { type PrefixType = Logger } + def error2(c: LoggerContext2)(message: c.Expr[String]): c.Expr[Unit] = ??? +} diff --git a/tests/disabled/macro/pos/t5744/Macros_1.scala b/tests/disabled/macro/pos/t5744/Macros_1.scala new file mode 100644 index 000000000..11da37f17 --- /dev/null +++ b/tests/disabled/macro/pos/t5744/Macros_1.scala @@ -0,0 +1,22 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def foo[U: Numeric](x: U) = macro foo_impl[U] + def bar[U: Numeric : Equiv, Y <% String](x: U)(implicit s: String) = macro bar_impl[U, Y] + + def foo_impl[U](c: Context)(x: c.Expr[U])(numeric: c.Expr[Numeric[U]]) = { + import c.universe._ + val plusOne = Apply(Select(numeric.tree, newTermName("plus")), List(x.tree, Literal(Constant(1)))) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusOne)) + c.Expr[Unit](body) + } + + def bar_impl[U, Y](c: Context)(x: c.Expr[U])(numeric: c.Expr[Numeric[U]], equiv: c.Expr[Equiv[U]], viewAsString: c.Expr[Y => String], s: c.Expr[String]) = { + import c.universe._ + val plusOne = Apply(Select(numeric.tree, newTermName("plus")), List(x.tree, Literal(Constant(1)))) + val plusLen = Apply(Select(numeric.tree, newTermName("plus")), List(plusOne, Select(s.tree, newTermName("length")))) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusLen)) + c.Expr[Unit](body) + } +} diff --git a/tests/disabled/macro/pos/t5744/Test_2.scala b/tests/disabled/macro/pos/t5744/Test_2.scala new file mode 100644 index 000000000..dc3de03e4 --- /dev/null +++ b/tests/disabled/macro/pos/t5744/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import Macros._ + foo(42) + implicit val s = "" + bar(43) +} diff --git a/tests/disabled/macro/pos/t6047.flags b/tests/disabled/macro/pos/t6047.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/pos/t6047.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/pos/t6047.scala b/tests/disabled/macro/pos/t6047.scala new file mode 100644 index 000000000..e7d0c38c6 --- /dev/null +++ b/tests/disabled/macro/pos/t6047.scala @@ -0,0 +1,20 @@ +import scala.reflect.macros.blackbox.Context +import java.io.InputStream + +object Macros { + def unpack[A](input: InputStream): A = macro unpack_impl[A] + + def unpack_impl[A: c.WeakTypeTag](c: Context)(input: c.Expr[InputStream]): c.Expr[A] = { + import c.universe._ + + def unpackcode(tpe: c.Type): c.Expr[_] = { + if (tpe <:< implicitly[c.WeakTypeTag[Traversable[_]]].tpe) { + + } + ??? + } + + unpackcode(implicitly[c.WeakTypeTag[A]].tpe) + ??? + } + } diff --git a/tests/disabled/macro/pos/t6386.scala b/tests/disabled/macro/pos/t6386.scala new file mode 100644 index 000000000..4031ae267 --- /dev/null +++ b/tests/disabled/macro/pos/t6386.scala @@ -0,0 +1,5 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + reify(manifest[Some[_]]) +} diff --git a/tests/disabled/macro/pos/t6447.scala b/tests/disabled/macro/pos/t6447.scala new file mode 100644 index 000000000..6ef69d485 --- /dev/null +++ b/tests/disabled/macro/pos/t6447.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +class X { type T } + +object X { + // this works + def foo(x: X): x.T = macro fooImpl + def fooImpl(c: Context)(x: c.Expr[X]): c.Expr[x.value.T] = ??? + + // this doesn't + def bar(x: X, y: X): (x.T, y.T) = macro barImpl + def barImpl(c: Context)(x: c.Expr[X], y: c.Expr[X]): c.Expr[(x.value.T, y.value.T)] = ??? + + // neither does this + def baz(x: X)(xs: List[x.T]): Unit = macro bazImpl + def bazImpl(c: Context)(x: c.Expr[X])(xs: c.Expr[List[x.value.T]]): c.Expr[Unit] = ??? +} diff --git a/tests/disabled/macro/pos/t6485a/Macros_1.scala b/tests/disabled/macro/pos/t6485a/Macros_1.scala new file mode 100644 index 000000000..cc7dc3d3e --- /dev/null +++ b/tests/disabled/macro/pos/t6485a/Macros_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def crash(c: Context): c.Expr[Unit] = c.universe.reify(()) +} diff --git a/tests/disabled/macro/pos/t6485a/Test_2.scala b/tests/disabled/macro/pos/t6485a/Test_2.scala new file mode 100644 index 000000000..54e260ac7 --- /dev/null +++ b/tests/disabled/macro/pos/t6485a/Test_2.scala @@ -0,0 +1,5 @@ +import scala.language.experimental.macros + +final class Ops[T](val x: T) extends AnyVal { + def f = macro Macros.crash +} diff --git a/tests/disabled/macro/pos/t6485b/Test.scala b/tests/disabled/macro/pos/t6485b/Test.scala new file mode 100644 index 000000000..46d707073 --- /dev/null +++ b/tests/disabled/macro/pos/t6485b/Test.scala @@ -0,0 +1,10 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +final class Ops[T](val x: T) extends AnyVal { + def f = macro Macros.crash +} + +object Macros { + def crash(c: Context): c.Expr[Unit] = c.universe.reify(()) +} diff --git a/tests/disabled/macro/pos/t6516.scala b/tests/disabled/macro/pos/t6516.scala new file mode 100644 index 000000000..2980d83eb --- /dev/null +++ b/tests/disabled/macro/pos/t6516.scala @@ -0,0 +1,19 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context +import scala.collection.TraversableLike + +// This one compiles +object Test { + type Alias[T, CC[_]] = Context { type PrefixType = TraversableLike[T, CC[T]] } + def f() = macro f_impl + def f_impl(c: Alias[Int, List])() = ??? +} + +// This one doesn't +object Test2 { + type Ctx = scala.reflect.macros.blackbox.Context + type Alias[T, CC[_]] = Ctx { type PrefixType = TraversableLike[T, CC[T]] } + + def f() = macro f_impl + def f_impl(c: Alias[Int, List])() = ??? +} diff --git a/tests/disabled/macro/pos/t7190.scala b/tests/disabled/macro/pos/t7190.scala new file mode 100644 index 000000000..449e5c83f --- /dev/null +++ b/tests/disabled/macro/pos/t7190.scala @@ -0,0 +1,26 @@ +import scala.language.experimental.macros +import scala.reflect.macros._ + +trait A[T] { + def min[U >: T](implicit ord: Numeric[U]): T = macro A.min[T, U] +} + +object A { + def min[T: c.WeakTypeTag, U >: T: c.WeakTypeTag](c: Context)(ord: c.Expr[Numeric[U]]): c.Expr[T] = { + c.universe.reify { + ord.splice.zero.asInstanceOf[T] + } + } +} + +class B extends A[Int] { + override def min[U >: Int](implicit ord: Numeric[U]): Int = macro B.min[U] +} + +object B { + def min[U >: Int: c.WeakTypeTag](c: Context)(ord: c.Expr[Numeric[U]]): c.Expr[Int] = { + c.universe.reify { + ord.splice.zero.asInstanceOf[Int] + } + } +} diff --git a/tests/disabled/macro/pos/t7377/Client_2.scala b/tests/disabled/macro/pos/t7377/Client_2.scala new file mode 100644 index 000000000..5728956cc --- /dev/null +++ b/tests/disabled/macro/pos/t7377/Client_2.scala @@ -0,0 +1,11 @@ +object Test { + M.noop(List(1) match { case Nil => 0; case (x::xs) => x }) + + case class Foo(a: Int) + val FooAlias: Foo.type = Foo + M.noop(Foo(0) match { case FooAlias(_) => 0 }) + + case class Bar() + val BarAlias: Bar.type = Bar + M.noop(Bar() match { case BarAlias() => 0 }) +} diff --git a/tests/disabled/macro/pos/t7377/Macro_1.scala b/tests/disabled/macro/pos/t7377/Macro_1.scala new file mode 100644 index 000000000..b38687c8b --- /dev/null +++ b/tests/disabled/macro/pos/t7377/Macro_1.scala @@ -0,0 +1,7 @@ +import language.experimental._ +import scala.reflect.macros.blackbox.Context + +object M { + def noopImpl[A](c: Context)(expr: c.Expr[A]): c.Expr[A] = c.Expr(c.typecheck(c.untypecheck(expr.tree))) + def noop[A](expr: A): A = macro noopImpl[A] +} diff --git a/tests/disabled/macro/pos/t7461/Macros_1.scala b/tests/disabled/macro/pos/t7461/Macros_1.scala new file mode 100644 index 000000000..74ebf5af9 --- /dev/null +++ b/tests/disabled/macro/pos/t7461/Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + val wut = c.typecheck(Select(Literal(Constant(10)), newTermName("$minus")), silent = true) + // println(showRaw(wut, printIds = true, printTypes = true)) + c.Expr[Unit](q"()") + } + + def foo = macro impl +} diff --git a/tests/disabled/macro/pos/t7461/Test_2.scala b/tests/disabled/macro/pos/t7461/Test_2.scala new file mode 100644 index 000000000..866e3dc6f --- /dev/null +++ b/tests/disabled/macro/pos/t7461/Test_2.scala @@ -0,0 +1,3 @@ +class C { + def foo = Macros.foo +} diff --git a/tests/disabled/macro/pos/t7516/A_1.scala b/tests/disabled/macro/pos/t7516/A_1.scala new file mode 100644 index 000000000..3bd477dcd --- /dev/null +++ b/tests/disabled/macro/pos/t7516/A_1.scala @@ -0,0 +1,9 @@ +import scala.reflect._,macros._, scala.language.experimental.macros + +object A { + def impl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = { + val r = c.universe.reify { List(t.splice) } + c.Expr[List[T]]( c.untypecheck(r.tree) ) + } + def demo[T](t: T): List[T] = macro impl[T] +} diff --git a/tests/disabled/macro/pos/t7516/B_2.scala b/tests/disabled/macro/pos/t7516/B_2.scala new file mode 100644 index 000000000..1b8531bc8 --- /dev/null +++ b/tests/disabled/macro/pos/t7516/B_2.scala @@ -0,0 +1,4 @@ +object B { + final case class CV(p: Int = 3, g: Int = 2) + A.demo { val d = 4; CV(g = d); "a" } +} diff --git a/tests/disabled/macro/pos/t7649.flags b/tests/disabled/macro/pos/t7649.flags new file mode 100644 index 000000000..fcf951d90 --- /dev/null +++ b/tests/disabled/macro/pos/t7649.flags @@ -0,0 +1 @@ +-Yrangepos \ No newline at end of file diff --git a/tests/disabled/macro/pos/t7649.scala b/tests/disabled/macro/pos/t7649.scala new file mode 100644 index 000000000..d70dc05ea --- /dev/null +++ b/tests/disabled/macro/pos/t7649.scala @@ -0,0 +1,20 @@ +object Test { + val c: scala.reflect.macros.blackbox.Context = ??? + import c.universe._ + reify { + // The lookup of the implicit WeakTypeTag[Any] + // was triggering an unpositioned tree. + c.Expr[Any](q"0").splice + } + + import scala.reflect.ClassTag + def ct[A: ClassTag]: Expr[A] = ??? + def tt[A: TypeTag]: Expr[A] = ??? + def wtt[A: WeakTypeTag]: Expr[A] = ??? + + reify { + ct[String].splice + tt[String].splice + wtt[String].splice + } +} diff --git a/tests/disabled/macro/pos/t7776.check b/tests/disabled/macro/pos/t7776.check new file mode 100644 index 000000000..e69de29bb diff --git a/tests/disabled/macro/pos/t7776.scala b/tests/disabled/macro/pos/t7776.scala new file mode 100644 index 000000000..627d20dd6 --- /dev/null +++ b/tests/disabled/macro/pos/t7776.scala @@ -0,0 +1,20 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +class MacroErasure { + def app(f: Any => Any, x: Any): Any = macro MacroErasure.appMacro + def app[A](f: A => Any, x: Any): Any = macro MacroErasure.appMacroA[A] +} + +object MacroErasure { + def appMacro(c: Context)( + f: c.Expr[Any => Any], x: c.Expr[Any]): c.Expr[Any] = { + import c.universe._ + c.Expr(q"$f($x)") + } + def appMacroA[A](c: Context)(f: c.Expr[A => Any], x: c.Expr[Any])( + implicit tt: c.WeakTypeTag[A]): c.Expr[Any] = { + import c.universe._ + c.Expr(q"$f[${tt.tpe}]($x)") + } +} diff --git a/tests/disabled/macro/pos/t7987/Macro_1.scala b/tests/disabled/macro/pos/t7987/Macro_1.scala new file mode 100644 index 000000000..81f717b9c --- /dev/null +++ b/tests/disabled/macro/pos/t7987/Macro_1.scala @@ -0,0 +1,6 @@ +import scala.language.experimental._ + +object Macro { + def apply[A](a: A): A = macro impl[A] + def impl[A](c: reflect.macros.Context)(a: c.Expr[A]): c.Expr[A] = a +} diff --git a/tests/disabled/macro/pos/t7987/Test_2.scala b/tests/disabled/macro/pos/t7987/Test_2.scala new file mode 100644 index 000000000..aaa21ec4c --- /dev/null +++ b/tests/disabled/macro/pos/t7987/Test_2.scala @@ -0,0 +1,12 @@ +class C[T] { + def foo = 0 +} + +object Test { + implicit def AnyToC[T](a: Any): C[T] = new C[T] + // was: "macro not expanded" + Macro { + "".foo + () + } +} diff --git a/tests/disabled/macro/pos/t8001/Macros_1.scala b/tests/disabled/macro/pos/t8001/Macros_1.scala new file mode 100644 index 000000000..077082a9c --- /dev/null +++ b/tests/disabled/macro/pos/t8001/Macros_1.scala @@ -0,0 +1,10 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def foo: Unit = macro impl + def impl(c: Context) = { + import c.universe._ + q"()" + } +} diff --git a/tests/disabled/macro/pos/t8001/Test_2.scala b/tests/disabled/macro/pos/t8001/Test_2.scala new file mode 100644 index 000000000..55024506e --- /dev/null +++ b/tests/disabled/macro/pos/t8001/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + Macros.foo + (): Unit +} diff --git a/tests/disabled/macro/pos/t8013/inpervolated_2.scala b/tests/disabled/macro/pos/t8013/inpervolated_2.scala new file mode 100644 index 000000000..90e571b42 --- /dev/null +++ b/tests/disabled/macro/pos/t8013/inpervolated_2.scala @@ -0,0 +1,11 @@ +/* + * scalac: -Xfatal-warnings -Xlint + */ +package t8013 + +// unsuspecting user of perverse macro +trait User { + import Perverse.Impervolator + val foo = "bar" + Console println p"Hello, $foo" +} diff --git a/tests/disabled/macro/pos/t8013/inpervolator_1.scala b/tests/disabled/macro/pos/t8013/inpervolator_1.scala new file mode 100644 index 000000000..612e1d727 --- /dev/null +++ b/tests/disabled/macro/pos/t8013/inpervolator_1.scala @@ -0,0 +1,33 @@ + +package t8013 + +// perverse macro to confuse Xlint + +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Perverse { + + implicit class Impervolator(sc: StringContext) { + def p(args: Any*): String = macro pImpl + } + + // turn a nice interpolation into something that looks + // nothing like an interpolation or anything we might + // recognize, but which includes a "$id" in an apply. + def pImpl(c: Context)(args: c.Expr[Any]*): c.Expr[String] = { + import c.universe._ + val macroPos = c.macroApplication.pos + val text = macroPos.source.lineToString(macroPos.line - 1) substring macroPos.column + val tt = Literal(Constant(text)) + val tree = q"t8013.Perverse.pervert($tt)" + c.Expr[String](tree) + } + + // identity doesn't seem very perverse in this context + //def pervert(text: String): String = text + def pervert(text: String): String = { + Console println s"Perverting [$text]" + text + } +} diff --git a/tests/disabled/macro/pos/t8064/Client_2.scala b/tests/disabled/macro/pos/t8064/Client_2.scala new file mode 100644 index 000000000..42c9b21ce --- /dev/null +++ b/tests/disabled/macro/pos/t8064/Client_2.scala @@ -0,0 +1,8 @@ +object Test { + Macro { + def s = "" + Macro(s): @unchecked + ??? + } +} +// Was: a range position validation error (unpositioned tree) diff --git a/tests/disabled/macro/pos/t8064/Macro_1.scala b/tests/disabled/macro/pos/t8064/Macro_1.scala new file mode 100644 index 000000000..9f1e6955b --- /dev/null +++ b/tests/disabled/macro/pos/t8064/Macro_1.scala @@ -0,0 +1,10 @@ +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macro { + def apply(a: Any): Any = macro impl + + def impl(c: Context)(a: c.Tree): c.Tree = { + c.untypecheck(a) + } +} diff --git a/tests/disabled/macro/pos/t8064b/Client_2.scala b/tests/disabled/macro/pos/t8064b/Client_2.scala new file mode 100644 index 000000000..055b7a606 --- /dev/null +++ b/tests/disabled/macro/pos/t8064b/Client_2.scala @@ -0,0 +1,6 @@ +object Test { + Macro { + "".reverse + } +} +// Was: a range position validation error (tree with offset position enclosing tree with range position) diff --git a/tests/disabled/macro/pos/t8064b/Macro_1.scala b/tests/disabled/macro/pos/t8064b/Macro_1.scala new file mode 100644 index 000000000..60996bfec --- /dev/null +++ b/tests/disabled/macro/pos/t8064b/Macro_1.scala @@ -0,0 +1,11 @@ +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macro { + def apply(a: Any): Any = macro impl + def impl(c: Context)(a: c.Tree): c.Tree = { + import c.universe._ + + q"{$a; true}" + } +} diff --git a/tests/disabled/macro/pos/t8209a/Macros_1.scala b/tests/disabled/macro/pos/t8209a/Macros_1.scala new file mode 100644 index 000000000..5d7852cb7 --- /dev/null +++ b/tests/disabled/macro/pos/t8209a/Macros_1.scala @@ -0,0 +1,17 @@ +import scala.language.experimental.macros +import scala.language.implicitConversions +import scala.reflect.macros.blackbox.Context + +class A +object A { implicit def a2b(a: A): B = ??? } +class B +class C extends A + +object Macros { + def impl(c: Context) = { + import c.universe._ + q"new C" + } + + def foo: A = macro impl +} diff --git a/tests/disabled/macro/pos/t8209a/Test_2.scala b/tests/disabled/macro/pos/t8209a/Test_2.scala new file mode 100644 index 000000000..bedef776f --- /dev/null +++ b/tests/disabled/macro/pos/t8209a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val a: A = Macros.foo + val b: B = Macros.foo +} diff --git a/tests/disabled/macro/pos/t8209b/Macros_1.scala b/tests/disabled/macro/pos/t8209b/Macros_1.scala new file mode 100644 index 000000000..fa521d38d --- /dev/null +++ b/tests/disabled/macro/pos/t8209b/Macros_1.scala @@ -0,0 +1,17 @@ +import scala.language.experimental.macros +import scala.language.implicitConversions +import scala.reflect.macros.whitebox.Context + +class A +object A { implicit def a2b(a: A): B = ??? } +class B +class C extends A + +object Macros { + def impl(c: Context) = { + import c.universe._ + q"new C" + } + + def foo: A = macro impl +} diff --git a/tests/disabled/macro/pos/t8209b/Test_2.scala b/tests/disabled/macro/pos/t8209b/Test_2.scala new file mode 100644 index 000000000..bedef776f --- /dev/null +++ b/tests/disabled/macro/pos/t8209b/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val a: A = Macros.foo + val b: B = Macros.foo +} diff --git a/tests/disabled/macro/pos/t8352/Macros_1.scala b/tests/disabled/macro/pos/t8352/Macros_1.scala new file mode 100644 index 000000000..c1c63e57b --- /dev/null +++ b/tests/disabled/macro/pos/t8352/Macros_1.scala @@ -0,0 +1,7 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +object Macros { + def impl(c: Context)(x: c.Expr[Boolean]): c.Expr[Boolean] = x + def foo(x: Boolean): Boolean = macro impl +} diff --git a/tests/disabled/macro/pos/t8352/Test_2.scala b/tests/disabled/macro/pos/t8352/Test_2.scala new file mode 100644 index 000000000..1f84c3ca1 --- /dev/null +++ b/tests/disabled/macro/pos/t8352/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + def expectUnit(): Unit = { + Macros.foo(true) + } +} diff --git a/tests/disabled/macro/run/exprs_serialize.check b/tests/disabled/macro/run/exprs_serialize.check new file mode 100644 index 000000000..551823ccd --- /dev/null +++ b/tests/disabled/macro/run/exprs_serialize.check @@ -0,0 +1,19 @@ +Expr[Int(2)](2) +Expr[java.lang.String]({ + def foo = "hello"; + foo.$plus("world!") +}) +Expr[Boolean]({ + def foo(x: Int) = { + class Local extends AnyRef { + def () = { + super.(); + () + }; + val f = 2 + }; + val obj = new Local(); + x.$percent(obj.f).$eq$eq(0) + }; + foo(5) +}) diff --git a/tests/disabled/macro/run/exprs_serialize.scala b/tests/disabled/macro/run/exprs_serialize.scala new file mode 100644 index 000000000..85cf55e1c --- /dev/null +++ b/tests/disabled/macro/run/exprs_serialize.scala @@ -0,0 +1,39 @@ +import java.io._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends dotty.runtime.LegacyApp { + def test(expr: Expr[_]) = + try { + val fout = new ByteArrayOutputStream() + val out = new ObjectOutputStream(fout) + out.writeObject(expr) + out.close() + fout.close() + + val fin = new ByteArrayInputStream(fout.toByteArray) + val in = new ObjectInputStream(fin) + val reexpr = in.readObject().asInstanceOf[ru.Expr[_]].in(cm) + in.close() + fin.close() + + println(reexpr) + } catch { + case ex: Exception => + println(ex) + } + + test(reify(2)) + test(reify{def foo = "hello"; foo + "world!"}) + test(reify { + def foo(x: Int) = { + class Local { + val f = 2 + } + val obj = new Local + x % obj.f == 0 + } + foo(5) + }) +} diff --git a/tests/disabled/macro/run/freetypes_false_alarm1.check b/tests/disabled/macro/run/freetypes_false_alarm1.check new file mode 100644 index 000000000..085b3ee50 --- /dev/null +++ b/tests/disabled/macro/run/freetypes_false_alarm1.check @@ -0,0 +1 @@ +scala.List[Int] diff --git a/tests/disabled/macro/run/freetypes_false_alarm1.scala b/tests/disabled/macro/run/freetypes_false_alarm1.scala new file mode 100644 index 000000000..b06e10efe --- /dev/null +++ b/tests/disabled/macro/run/freetypes_false_alarm1.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + val ru = scala.reflect.runtime.universe + val tpe: ru.Type = ru.typeOf[List[Int]] + println(tpe) + }.eval +} diff --git a/tests/disabled/macro/run/idempotency-case-classes.check b/tests/disabled/macro/run/idempotency-case-classes.check new file mode 100644 index 000000000..5a8d0ad9d --- /dev/null +++ b/tests/disabled/macro/run/idempotency-case-classes.check @@ -0,0 +1,55 @@ +C(2,3) +() +{ + case class C extends AnyRef with Product with Serializable { + private[this] val x: Int = _; + def x: Int = C.this.x; + private[this] val y: Int = _; + def y: Int = C.this.y; + def (x: Int, y: Int): C = { + C.super.(); + () + }; + def copy(x: Int = x, y: Int = y): C = new C(x, y); + def copy$default$1: Int = C.this.x; + def copy$default$2: Int = C.this.y; + override def productPrefix: String = "C"; + def productArity: Int = 2; + def productElement(x$1: Int): Any = x$1 match { + case 0 => C.this.x + case 1 => C.this.y + case _ => throw new IndexOutOfBoundsException(x$1.toString()) + }; + override def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](C.this); + def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[C](); + override def hashCode(): Int = { + var acc: Int = -889275714; + acc = Statics.this.mix(acc, x); + acc = Statics.this.mix(acc, y); + Statics.this.finalizeHash(acc, 2) + }; + override def toString(): String = ScalaRunTime.this._toString(C.this); + override def equals(x$1: Any): Boolean = C.this.eq(x$1.asInstanceOf[Object]).||(x$1 match { + case (_: C) => true + case _ => false +}.&&({ + val C$1: C = x$1.asInstanceOf[C]; + C.this.x.==(C$1.x).&&(C.this.y.==(C$1.y)).&&(C$1.canEqual(C.this)) + })) + }; + object C extends scala.runtime.AbstractFunction2[Int,Int,C] with Serializable { + def (): C.type = { + C.super.(); + () + }; + final override def toString(): String = "C"; + case def apply(x: Int, y: Int): C = new C(x, y); + case def unapply(x$0: C): Option[(Int, Int)] = if (x$0.==(null)) + scala.this.None + else + Some.apply[(Int, Int)](scala.Tuple2.apply[Int, Int](x$0.x, x$0.y)); + private def readResolve(): Object = C + }; + Predef.println(C.apply(2, 3)) +} +error! diff --git a/tests/disabled/macro/run/idempotency-case-classes.scala b/tests/disabled/macro/run/idempotency-case-classes.scala new file mode 100644 index 000000000..8c2aa70dc --- /dev/null +++ b/tests/disabled/macro/run/idempotency-case-classes.scala @@ -0,0 +1,22 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val casee = reify { + case class C(x: Int, y: Int) + println(C(2, 3)) + } + println(casee.eval) + val tb = cm.mkToolBox() + val tcasee = tb.typecheck(casee.tree) + println(tcasee) + val rtcasee = tb.untypecheck(tcasee) + try { + println(tb.eval(rtcasee)) + } catch { + // this is the current behaviour, rather than the desired behavior; see SI-5467 + case _: ToolBoxError => println("error!") + } +} diff --git a/tests/disabled/macro/run/idempotency-extractors.check b/tests/disabled/macro/run/idempotency-extractors.check new file mode 100644 index 000000000..fcd50faa7 --- /dev/null +++ b/tests/disabled/macro/run/idempotency-extractors.check @@ -0,0 +1,5 @@ +2 +2 match { + case Test.this.Extractor.unapply() ((x @ _)) => x +} +error! diff --git a/tests/disabled/macro/run/idempotency-extractors.scala b/tests/disabled/macro/run/idempotency-extractors.scala new file mode 100644 index 000000000..f5d6cd193 --- /dev/null +++ b/tests/disabled/macro/run/idempotency-extractors.scala @@ -0,0 +1,22 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + object Extractor { def unapply(x: Int): Option[Int] = Some(x) } + val extractor = reify { + 2 match { case Extractor(x) => x } + } + println(extractor.eval) + val tb = cm.mkToolBox() + val textractor = tb.typecheck(extractor.tree) + println(textractor) + val rtextractor = tb.untypecheck(textractor) + try { + println(tb.eval(rtextractor)) + } catch { + // this is the current behaviour, rather than the desired behavior; see SI-5465 + case _: ToolBoxError => println("error!") + } +} diff --git a/tests/disabled/macro/run/idempotency-labels.check b/tests/disabled/macro/run/idempotency-labels.check new file mode 100644 index 000000000..8709efeb4 --- /dev/null +++ b/tests/disabled/macro/run/idempotency-labels.check @@ -0,0 +1,15 @@ +2 +{ + var x: Int = 0; + while$1(){ + if (x.<(2)) + { + x = x.+(1); + while$1() + } + else + () + }; + x +} +2 diff --git a/tests/disabled/macro/run/idempotency-labels.scala b/tests/disabled/macro/run/idempotency-labels.scala new file mode 100644 index 000000000..126063384 --- /dev/null +++ b/tests/disabled/macro/run/idempotency-labels.scala @@ -0,0 +1,22 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val label = reify { + var x = 0 + while (x < 2) { x += 1 } + x + } + println(label.eval) + val tb = cm.mkToolBox() + val tlabel = tb.typecheck(label.tree) + println(tlabel) + val rtlabel = tb.untypecheck(tlabel) + try { + println(tb.eval(rtlabel)) + } catch { + case _: ToolBoxError => println("error!") + } +} diff --git a/tests/disabled/macro/run/idempotency-lazy-vals.check b/tests/disabled/macro/run/idempotency-lazy-vals.check new file mode 100644 index 000000000..15afa5303 --- /dev/null +++ b/tests/disabled/macro/run/idempotency-lazy-vals.check @@ -0,0 +1,23 @@ +6 +{ + class C extends AnyRef { + def (): C = { + C.super.(); + () + }; + lazy private[this] val x: Int = _; + lazy def x: Int = { + C.this.x = 2; + C.this.x + }; + lazy private[this] val y: Int = _; + implicit lazy def y: Int = { + C.this.y = 3; + C.this.y + } + }; + val c: C = new C(); + import c._; + c.x.*(Predef.implicitly[Int](c.y)) +} +error! diff --git a/tests/disabled/macro/run/idempotency-lazy-vals.scala b/tests/disabled/macro/run/idempotency-lazy-vals.scala new file mode 100644 index 000000000..cb757f1ab --- /dev/null +++ b/tests/disabled/macro/run/idempotency-lazy-vals.scala @@ -0,0 +1,27 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val lazee = reify { + class C { + lazy val x = 2 + implicit lazy val y = 3 + } + val c = new C() + import c._ + x * implicitly[Int] + } + println(lazee.eval) + val tb = cm.mkToolBox() + val tlazee = tb.typecheck(lazee.tree) + println(tlazee) + val rtlazee = tb.untypecheck(tlazee) + try { + println(tb.eval(rtlazee)) + } catch { + // this is the current behaviour, rather than the desired behavior; see SI-5466 + case _: ToolBoxError => println("error!") + } +} diff --git a/tests/disabled/macro/run/idempotency-this.check b/tests/disabled/macro/run/idempotency-this.check new file mode 100644 index 000000000..88b8288ad --- /dev/null +++ b/tests/disabled/macro/run/idempotency-this.check @@ -0,0 +1,4 @@ +List() +List.apply[String]("") +Apply(TypeApply(Select(Ident(scala.collection.immutable.List), TermName("apply")), List(TypeTree().setOriginal(Select(Ident(scala.Predef), TypeName("String"))))), List(Literal(Constant("")))) +List() diff --git a/tests/disabled/macro/run/idempotency-this.scala b/tests/disabled/macro/run/idempotency-this.scala new file mode 100644 index 000000000..2e2f7cf66 --- /dev/null +++ b/tests/disabled/macro/run/idempotency-this.scala @@ -0,0 +1,22 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val thiss = reify { + List[String]("") + } + println(thiss.eval) + val tb = cm.mkToolBox() + val tthiss = tb.typecheck(thiss.tree) + println(tthiss) + println(showRaw(tthiss)) + val rtthiss = tb.untypecheck(tthiss) + try { + println(tb.eval(rtthiss)) + } catch { + // this is the current behaviour, rather than the desired behavior; see SI-5705 + case _: ToolBoxError => println("error!") + } +} diff --git a/tests/disabled/macro/run/macro-abort-fresh.check b/tests/disabled/macro/run/macro-abort-fresh.check new file mode 100644 index 000000000..5064b96ee --- /dev/null +++ b/tests/disabled/macro/run/macro-abort-fresh.check @@ -0,0 +1,6 @@ +fresh$macro$1 +qwe$macro$2 +qwe$macro$3 +reflective compilation has failed: + +blargh diff --git a/tests/disabled/macro/run/macro-abort-fresh.flags b/tests/disabled/macro/run/macro-abort-fresh.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-abort-fresh.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-abort-fresh/Macros_1.scala b/tests/disabled/macro/run/macro-abort-fresh/Macros_1.scala new file mode 100644 index 000000000..2b03512ef --- /dev/null +++ b/tests/disabled/macro/run/macro-abort-fresh/Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def impl(c: Context) = { + import c.universe._ + println(c.fresh()) + println(c.fresh("qwe")) + println(c.fresh(TypeName("qwe"))) + c.abort(NoPosition, "blargh") + } +} + +object Macros { + def foo = macro Impls.impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-abort-fresh/Test_2.scala b/tests/disabled/macro/run/macro-abort-fresh/Test_2.scala new file mode 100644 index 000000000..dea6e6d62 --- /dev/null +++ b/tests/disabled/macro/run/macro-abort-fresh/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Select(Ident(TermName("Macros")), TermName("foo")) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-auto-duplicate.check b/tests/disabled/macro/run/macro-auto-duplicate.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/macro-auto-duplicate.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/macro-auto-duplicate/Macros_1.scala b/tests/disabled/macro/run/macro-auto-duplicate/Macros_1.scala new file mode 100644 index 000000000..2c910e6af --- /dev/null +++ b/tests/disabled/macro/run/macro-auto-duplicate/Macros_1.scala @@ -0,0 +1,17 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + val x = Ident(newTermName("x")) + def defAndUseX(rhs: Tree) = { + Block(List(ValDef(NoMods, newTermName("x"), TypeTree(), rhs)), x) + } + val xi4 = defAndUseX(Literal(Constant(4))) + val xs2 = defAndUseX(Literal(Constant("2"))) + c.Expr[String](Apply(Select(xi4, newTermName("$plus")), List(xs2))) + } + + def foo = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-auto-duplicate/Test_2.scala b/tests/disabled/macro/run/macro-auto-duplicate/Test_2.scala new file mode 100644 index 000000000..eed62a0fe --- /dev/null +++ b/tests/disabled/macro/run/macro-auto-duplicate/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-basic-ma-md-mi.check b/tests/disabled/macro/run/macro-basic-ma-md-mi.check new file mode 100644 index 000000000..b74e882ae --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-ma-md-mi.check @@ -0,0 +1 @@ +31 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-basic-ma-md-mi.flags b/tests/disabled/macro/run/macro-basic-ma-md-mi.flags new file mode 100644 index 000000000..5e5dd6ce7 --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-ma-md-mi.flags @@ -0,0 +1 @@ +-language:experimental.macros diff --git a/tests/disabled/macro/run/macro-basic-ma-md-mi/Impls_1.scala b/tests/disabled/macro/run/macro-basic-ma-md-mi/Impls_1.scala new file mode 100644 index 000000000..fc75b99ef --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-ma-md-mi/Impls_1.scala @@ -0,0 +1,21 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) + c.Expr[Int](body) + } + + def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) + c.Expr[Int](body) + } + + def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) + c.Expr[Int](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-basic-ma-md-mi/Macros_2.scala b/tests/disabled/macro/run/macro-basic-ma-md-mi/Macros_2.scala new file mode 100644 index 000000000..527904374 --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-basic-ma-md-mi/Test_3.scala b/tests/disabled/macro/run/macro-basic-ma-md-mi/Test_3.scala new file mode 100644 index 000000000..9c45f59d7 --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-ma-md-mi/Test_3.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + import Macros.Shmacros._ + println(foo(2) + Macros.bar(2) * new Macros().quux(4)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-basic-ma-mdmi.check b/tests/disabled/macro/run/macro-basic-ma-mdmi.check new file mode 100644 index 000000000..b74e882ae --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-ma-mdmi.check @@ -0,0 +1 @@ +31 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-basic-ma-mdmi.flags b/tests/disabled/macro/run/macro-basic-ma-mdmi.flags new file mode 100644 index 000000000..5e5dd6ce7 --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-ma-mdmi.flags @@ -0,0 +1 @@ +-language:experimental.macros diff --git a/tests/disabled/macro/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-basic-ma-mdmi/Impls_Macros_1.scala new file mode 100644 index 000000000..73a5a971a --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-ma-mdmi/Impls_Macros_1.scala @@ -0,0 +1,32 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) + c.Expr[Int](body) + } + + def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) + c.Expr[Int](body) + } + + def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) + c.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/tests/disabled/macro/run/macro-basic-ma-mdmi/Test_2.scala b/tests/disabled/macro/run/macro-basic-ma-mdmi/Test_2.scala new file mode 100644 index 000000000..9c45f59d7 --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-ma-mdmi/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + import Macros.Shmacros._ + println(foo(2) + Macros.bar(2) * new Macros().quux(4)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-basic-mamd-mi.check b/tests/disabled/macro/run/macro-basic-mamd-mi.check new file mode 100644 index 000000000..b74e882ae --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-mamd-mi.check @@ -0,0 +1 @@ +31 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-basic-mamd-mi.flags b/tests/disabled/macro/run/macro-basic-mamd-mi.flags new file mode 100644 index 000000000..5e5dd6ce7 --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-mamd-mi.flags @@ -0,0 +1 @@ +-language:experimental.macros diff --git a/tests/disabled/macro/run/macro-basic-mamd-mi/Impls_1.scala b/tests/disabled/macro/run/macro-basic-mamd-mi/Impls_1.scala new file mode 100644 index 000000000..0be915c11 --- /dev/null +++ b/tests/disabled/macro/run/macro-basic-mamd-mi/Impls_1.scala @@ -0,0 +1,19 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))) + } + + def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))) + } + + def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) + c.Expr[Int](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-basic-mamd-mi/Macros_Test_2.scala b/tests/disabled/macro/run/macro-basic-mamd-mi/Macros_Test_2.scala new file mode 100644 index 000000000..9bfcbc4a7 --- /dev/null +++ b/tests/disabled/macro/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 dotty.runtime.LegacyApp { + import Macros.Shmacros._ + println(foo(2) + Macros.bar(2) * new Macros().quux(4)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-blackbox-materialization.check b/tests/disabled/macro/run/macro-blackbox-materialization.check new file mode 100644 index 000000000..7165b734a --- /dev/null +++ b/tests/disabled/macro/run/macro-blackbox-materialization.check @@ -0,0 +1,3 @@ +C(Int) +C(String) +C(Nothing) diff --git a/tests/disabled/macro/run/macro-blackbox-materialization/Macros_1.scala b/tests/disabled/macro/run/macro-blackbox-materialization/Macros_1.scala new file mode 100644 index 000000000..ea8d1bed1 --- /dev/null +++ b/tests/disabled/macro/run/macro-blackbox-materialization/Macros_1.scala @@ -0,0 +1,16 @@ +// For the full version of the test, take a look at run/t5923a + +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +case class C[T](t: String) +object C { + implicit def foo[T]: C[T] = macro Macros.impl[T] +} + +object Macros { + def impl[T: c.WeakTypeTag](c: Context) = { + import c.universe._ + reify(C[T](c.literal(weakTypeOf[T].toString).splice)) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-blackbox-materialization/Test_2.scala b/tests/disabled/macro/run/macro-blackbox-materialization/Test_2.scala new file mode 100644 index 000000000..1f0413bdf --- /dev/null +++ b/tests/disabled/macro/run/macro-blackbox-materialization/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + println(implicitly[C[Int]]) + println(implicitly[C[String]]) + println(implicitly[C[Nothing]]) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bodyexpandstoimpl.check b/tests/disabled/macro/run/macro-bodyexpandstoimpl.check new file mode 100644 index 000000000..f70d7bba4 --- /dev/null +++ b/tests/disabled/macro/run/macro-bodyexpandstoimpl.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bodyexpandstoimpl.flags b/tests/disabled/macro/run/macro-bodyexpandstoimpl.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-bodyexpandstoimpl.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bodyexpandstoimpl/Impls_1.scala b/tests/disabled/macro/run/macro-bodyexpandstoimpl/Impls_1.scala new file mode 100644 index 000000000..d46af4952 --- /dev/null +++ b/tests/disabled/macro/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -0,0 +1,16 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.{Context => BlackboxContext} +import scala.reflect.macros.whitebox.{Context => WhiteboxContext} + +object Impls { + def foo(c: BlackboxContext)(x: c.Expr[Int]) = x + + def refToFoo(dummy: Int): Int = macro refToFoo_impl + def refToFoo_impl(c: WhiteboxContext)(dummy: c.Expr[Int]) = { + import c.universe._ + val body = Select(Ident(TermName("Impls")), TermName("foo")) + val global = c.universe.asInstanceOf[scala.tools.nsc.Global] + global.analyzer.markMacroImplRef(body.asInstanceOf[global.Tree]) + c.Expr[Int](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bodyexpandstoimpl/Macros_Test_2.scala b/tests/disabled/macro/run/macro-bodyexpandstoimpl/Macros_Test_2.scala new file mode 100644 index 000000000..f0fe4a8e3 --- /dev/null +++ b/tests/disabled/macro/run/macro-bodyexpandstoimpl/Macros_Test_2.scala @@ -0,0 +1,10 @@ +import scala.language.experimental.macros + +object Macros { + def foo(x: Int): Int = macro Impls.refToFoo(42) +} + +object Test extends dotty.runtime.LegacyApp { + import Macros._ + println(foo(42)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-context-alias.check b/tests/disabled/macro/run/macro-bundle-context-alias.check new file mode 100644 index 000000000..55e4dfcf9 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-context-alias.check @@ -0,0 +1,4 @@ +C +C +C +C diff --git a/tests/disabled/macro/run/macro-bundle-context-alias/Macros_1.scala b/tests/disabled/macro/run/macro-bundle-context-alias/Macros_1.scala new file mode 100644 index 000000000..354c5e0d9 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-context-alias/Macros_1.scala @@ -0,0 +1,38 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.{Context => BlackboxContext} +import scala.reflect.macros.whitebox.{Context => WhiteboxContext} + +object Module { + type BBC = BlackboxContext + type RBBC = BBC { type PrefixType = C } + type WBC = WhiteboxContext + type RWBC = WBC { type PrefixType = C } + + class BlackboxBundle(val c: BBC) { + import c.universe._ + def impl = q"${c.prefix}" + } + + class RefinedBlackboxBundle(val c: RBBC) { + import c.universe._ + def impl = reify(c.prefix.splice) + } + + class WhiteboxBundle(val c: WBC) { + import c.universe._ + def impl = q"${c.prefix}" + } + + class RefinedWhiteboxBundle(val c: RWBC) { + import c.universe._ + def impl = reify(c.prefix.splice) + } +} + +class C { + def blackbox: C = macro Module.BlackboxBundle.impl + def refinedBlackbox: C = macro Module.RefinedBlackboxBundle.impl + def whitebox: C = macro Module.WhiteboxBundle.impl + def refinedWhitebox: C = macro Module.RefinedWhiteboxBundle.impl + override def toString = "C" +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-context-alias/Test_2.scala b/tests/disabled/macro/run/macro-bundle-context-alias/Test_2.scala new file mode 100644 index 000000000..6c70277de --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-context-alias/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + println(new C().blackbox) + println(new C().refinedBlackbox) + println(new C().whitebox) + println(new C().refinedWhitebox) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-context-refinement.check b/tests/disabled/macro/run/macro-bundle-context-refinement.check new file mode 100644 index 000000000..10f9ebb61 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-context-refinement.check @@ -0,0 +1,2 @@ +C +C diff --git a/tests/disabled/macro/run/macro-bundle-context-refinement/Macros_1.scala b/tests/disabled/macro/run/macro-bundle-context-refinement/Macros_1.scala new file mode 100644 index 000000000..d3a5d179c --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-context-refinement/Macros_1.scala @@ -0,0 +1,19 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.{Context => BlackboxContext} +import scala.reflect.macros.whitebox.{Context => WhiteboxContext} + +class BlackboxBundle(val c: BlackboxContext { type PrefixType = C }) { + import c.universe._ + def impl = reify(c.prefix.splice) +} + +class WhiteboxBundle(val c: WhiteboxContext { type PrefixType = C }) { + import c.universe._ + def impl = reify(c.prefix.splice) +} + +class C { + def blackbox: C = macro BlackboxBundle.impl + def whitebox: C = macro WhiteboxBundle.impl + override def toString = "C" +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-context-refinement/Test_2.scala b/tests/disabled/macro/run/macro-bundle-context-refinement/Test_2.scala new file mode 100644 index 000000000..d631b8f7e --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-context-refinement/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println(new C().blackbox) + println(new C().whitebox) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-repl.check b/tests/disabled/macro/run/macro-bundle-repl.check new file mode 100644 index 000000000..75c5c2add --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-repl.check @@ -0,0 +1,24 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.language.experimental.macros +import scala.language.experimental.macros + +scala> import scala.reflect.macros.blackbox.Context +import scala.reflect.macros.blackbox.Context + +scala> class Bar(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl +defined class Bar +defined term macro bar: Unit + +scala> bar + +scala> class Foo(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } } +defined class Foo + +scala> def foo: Unit = macro Foo.impl +defined term macro foo: Unit + +scala> foo + +scala> :quit diff --git a/tests/disabled/macro/run/macro-bundle-repl.scala b/tests/disabled/macro/run/macro-bundle-repl.scala new file mode 100644 index 000000000..808441845 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-repl.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context +class Bar(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl +bar +class Foo(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } } +def foo: Unit = macro Foo.impl +foo + """ +} diff --git a/tests/disabled/macro/run/macro-bundle-static.check b/tests/disabled/macro/run/macro-bundle-static.check new file mode 100644 index 000000000..37c8eaf27 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-static.check @@ -0,0 +1,6 @@ +() +Int +() +true +IntInt +true diff --git a/tests/disabled/macro/run/macro-bundle-static/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-bundle-static/Impls_Macros_1.scala new file mode 100644 index 000000000..0142e5d94 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-static/Impls_Macros_1.scala @@ -0,0 +1,30 @@ +import scala.reflect.macros.blackbox.Context +import scala.language.experimental.macros + +object Enclosing { + class Impl(val c: Context) { + def mono = { import c.universe._; c.Expr[Unit](q"()") } + def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") } + def weird = macro mono + } +} + +object Macros { + def mono = macro Enclosing.Impl.mono + def poly[T] = macro Enclosing.Impl.poly[T] +} + +package pkg { + object Enclosing { + class Impl(val c: Context) { + def mono = { import c.universe._; c.Expr[Boolean](q"true") } + def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + c.weakTypeOf[T].toString}") } + def weird = macro mono + } + } + + object Macros { + def mono = macro Enclosing.Impl.mono + def poly[T] = macro Enclosing.Impl.poly[T] + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-static/Test_2.scala b/tests/disabled/macro/run/macro-bundle-static/Test_2.scala new file mode 100644 index 000000000..cfc1e1563 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-static/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.mono) + println(Macros.poly[Int]) + println(new Enclosing.Impl(???).weird) + println(pkg.Macros.mono) + println(pkg.Macros.poly[Int]) + println(new pkg.Enclosing.Impl(???).weird) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-toplevel.check b/tests/disabled/macro/run/macro-bundle-toplevel.check new file mode 100644 index 000000000..37c8eaf27 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-toplevel.check @@ -0,0 +1,6 @@ +() +Int +() +true +IntInt +true diff --git a/tests/disabled/macro/run/macro-bundle-toplevel.flags b/tests/disabled/macro/run/macro-bundle-toplevel.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-toplevel.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-toplevel/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-bundle-toplevel/Impls_Macros_1.scala new file mode 100644 index 000000000..6fd7be3b2 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-toplevel/Impls_Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.macros.blackbox.Context + +class Impl(val c: Context) { + def mono = { import c.universe._; c.Expr[Unit](q"()") } + def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") } + def weird = macro mono +} + +object Macros { + def mono = macro Impl.mono + def poly[T] = macro Impl.poly[T] +} + +package pkg { + class Impl(val c: Context) { + def mono = { import c.universe._; c.Expr[Boolean](q"true") } + def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + c.weakTypeOf[T].toString}") } + def weird = macro mono + } + + object Macros { + def mono = macro Impl.mono + def poly[T] = macro Impl.poly[T] + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-toplevel/Test_2.scala b/tests/disabled/macro/run/macro-bundle-toplevel/Test_2.scala new file mode 100644 index 000000000..013baa348 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-toplevel/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.mono) + println(Macros.poly[Int]) + println(new Impl(???).weird) + println(pkg.Macros.mono) + println(pkg.Macros.poly[Int]) + println(new pkg.Impl(???).weird) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-decl.check b/tests/disabled/macro/run/macro-bundle-whitebox-decl.check new file mode 100644 index 000000000..37c8eaf27 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-decl.check @@ -0,0 +1,6 @@ +() +Int +() +true +IntInt +true diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-decl/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-bundle-whitebox-decl/Impls_Macros_1.scala new file mode 100644 index 000000000..5e1b11895 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-decl/Impls_Macros_1.scala @@ -0,0 +1,26 @@ +import scala.language.experimental.macros +import scala.reflect.macros.whitebox.Context + +class Impl(val c: Context) { + def mono = { import c.universe._; c.Expr[Unit](q"()") } + def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") } + def weird = macro mono +} + +object Macros { + def mono = macro Impl.mono + def poly[T] = macro Impl.poly[T] +} + +package pkg { + class Impl(val c: Context) { + def mono = { import c.universe._; c.Expr[Boolean](q"true") } + def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + c.weakTypeOf[T].toString}") } + def weird = macro mono + } + + object Macros { + def mono = macro Impl.mono + def poly[T] = macro Impl.poly[T] + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-decl/Test_2.scala b/tests/disabled/macro/run/macro-bundle-whitebox-decl/Test_2.scala new file mode 100644 index 000000000..013baa348 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-decl/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.mono) + println(Macros.poly[Int]) + println(new Impl(???).weird) + println(pkg.Macros.mono) + println(pkg.Macros.poly[Int]) + println(new pkg.Impl(???).weird) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-use-raw.check b/tests/disabled/macro/run/macro-bundle-whitebox-use-raw.check new file mode 100644 index 000000000..5679c5fab --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-use-raw.check @@ -0,0 +1,5 @@ +2 +(23,foo,true) +null +C2 +42 diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-use-raw/Macros_1.scala b/tests/disabled/macro/run/macro-bundle-whitebox-use-raw/Macros_1.scala new file mode 100644 index 000000000..de1863418 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-use-raw/Macros_1.scala @@ -0,0 +1,108 @@ +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +// whitebox use case #1: return type refinement + +class ReturnTypeRefinementBundle(val c: Context) { + import c.universe._ + def impl = { + q""" + trait Foo { + def x = 2 + } + new Foo {} + """ + } +} + +object ReturnTypeRefinement { + def foo: Any = macro ReturnTypeRefinementBundle.impl +} + +// whitebox use case #2: fundep materialization + +trait FundepMaterialization[T, U] { + def to(t : T) : U + // def from(u : U) : T +} + +class FundepMaterializationBundle(val c: Context) { + import c.universe._ + import definitions._ + import Flag._ + + def impl[T: c.WeakTypeTag, U: c.WeakTypeTag]: c.Expr[FundepMaterialization[T, U]] = { + val sym = c.weakTypeOf[T].typeSymbol + if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class") + val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x } + + def mkTpt() = { + val core = Ident(TupleClass(fields.length) orElse UnitClass) + if (fields.length == 0) core + else AppliedTypeTree(core, fields map (f => TypeTree(f.info))) + } + + def mkFrom() = { + if (fields.length == 0) Literal(Constant(Unit)) + else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim)))) + } + + val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template( + List(AppliedTypeTree(Ident(newTypeName("FundepMaterialization")), List(Ident(sym), mkTpt()))), + emptyValDef, + List( + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))), + DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom())))) + c.Expr[FundepMaterialization[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List()))) + } +} + +object FundepMaterialization { + implicit def materializeIso[T, U]: FundepMaterialization[T, U] = macro FundepMaterializationBundle.impl[T, U] +} + +// whitebox use case #3: dynamic materialization + +trait DynamicMaterialization[T] + +class C1(val x: Int) +class C2(val x: String) + +trait LowPriority { + implicit def lessSpecific[T]: DynamicMaterialization[T] = null +} + +object DynamicMaterialization extends LowPriority { + implicit def moreSpecific[T]: DynamicMaterialization[T] = macro DynamicMaterializationBundle.impl[T] +} + +class DynamicMaterializationBundle(val c: Context) { + import c.universe._ + def impl[T: c.WeakTypeTag] = { + val tpe = weakTypeOf[T] + if (tpe.members.exists(_.info =:= typeOf[Int])) + c.abort(c.enclosingPosition, "I don't like classes that contain integers") + q"new DynamicMaterialization[$tpe]{ override def toString = ${tpe.toString} }" + } +} + +// whitebox use case #4: extractor macros + +object ExtractorMacro { + def unapply(x: Int): Any = macro ExtractorBundle.unapplyImpl +} + +class ExtractorBundle(val c: Context) { + import c.universe._ + def unapplyImpl(x: Tree) = { + q""" + new { + class Match(x: Int) { + def isEmpty = false + def get = x + } + def unapply(x: Int) = new Match(x) + }.unapply($x) + """ + } +} diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-use-raw/Test_2.scala b/tests/disabled/macro/run/macro-bundle-whitebox-use-raw/Test_2.scala new file mode 100644 index 000000000..b28ebfd71 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-use-raw/Test_2.scala @@ -0,0 +1,19 @@ +object Test extends dotty.runtime.LegacyApp { + println(ReturnTypeRefinement.foo.x) + + case class Foo(i: Int, s: String, b: Boolean) + def foo[C, L](c: C)(implicit iso: FundepMaterialization[C, L]): L = iso.to(c) + locally { + val equiv = foo(Foo(23, "foo", true)) + def typed[T](t: => T) {} + typed[(Int, String, Boolean)](equiv) + println(equiv) + } + + println(implicitly[DynamicMaterialization[C1]]) + println(implicitly[DynamicMaterialization[C2]]) + + 42 match { + case ExtractorMacro(x) => println(x) + } +} diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-use-refined.check b/tests/disabled/macro/run/macro-bundle-whitebox-use-refined.check new file mode 100644 index 000000000..5679c5fab --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-use-refined.check @@ -0,0 +1,5 @@ +2 +(23,foo,true) +null +C2 +42 diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-use-refined/Macros_1.scala b/tests/disabled/macro/run/macro-bundle-whitebox-use-refined/Macros_1.scala new file mode 100644 index 000000000..de1863418 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-use-refined/Macros_1.scala @@ -0,0 +1,108 @@ +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +// whitebox use case #1: return type refinement + +class ReturnTypeRefinementBundle(val c: Context) { + import c.universe._ + def impl = { + q""" + trait Foo { + def x = 2 + } + new Foo {} + """ + } +} + +object ReturnTypeRefinement { + def foo: Any = macro ReturnTypeRefinementBundle.impl +} + +// whitebox use case #2: fundep materialization + +trait FundepMaterialization[T, U] { + def to(t : T) : U + // def from(u : U) : T +} + +class FundepMaterializationBundle(val c: Context) { + import c.universe._ + import definitions._ + import Flag._ + + def impl[T: c.WeakTypeTag, U: c.WeakTypeTag]: c.Expr[FundepMaterialization[T, U]] = { + val sym = c.weakTypeOf[T].typeSymbol + if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class") + val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x } + + def mkTpt() = { + val core = Ident(TupleClass(fields.length) orElse UnitClass) + if (fields.length == 0) core + else AppliedTypeTree(core, fields map (f => TypeTree(f.info))) + } + + def mkFrom() = { + if (fields.length == 0) Literal(Constant(Unit)) + else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim)))) + } + + val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template( + List(AppliedTypeTree(Ident(newTypeName("FundepMaterialization")), List(Ident(sym), mkTpt()))), + emptyValDef, + List( + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))), + DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom())))) + c.Expr[FundepMaterialization[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List()))) + } +} + +object FundepMaterialization { + implicit def materializeIso[T, U]: FundepMaterialization[T, U] = macro FundepMaterializationBundle.impl[T, U] +} + +// whitebox use case #3: dynamic materialization + +trait DynamicMaterialization[T] + +class C1(val x: Int) +class C2(val x: String) + +trait LowPriority { + implicit def lessSpecific[T]: DynamicMaterialization[T] = null +} + +object DynamicMaterialization extends LowPriority { + implicit def moreSpecific[T]: DynamicMaterialization[T] = macro DynamicMaterializationBundle.impl[T] +} + +class DynamicMaterializationBundle(val c: Context) { + import c.universe._ + def impl[T: c.WeakTypeTag] = { + val tpe = weakTypeOf[T] + if (tpe.members.exists(_.info =:= typeOf[Int])) + c.abort(c.enclosingPosition, "I don't like classes that contain integers") + q"new DynamicMaterialization[$tpe]{ override def toString = ${tpe.toString} }" + } +} + +// whitebox use case #4: extractor macros + +object ExtractorMacro { + def unapply(x: Int): Any = macro ExtractorBundle.unapplyImpl +} + +class ExtractorBundle(val c: Context) { + import c.universe._ + def unapplyImpl(x: Tree) = { + q""" + new { + class Match(x: Int) { + def isEmpty = false + def get = x + } + def unapply(x: Int) = new Match(x) + }.unapply($x) + """ + } +} diff --git a/tests/disabled/macro/run/macro-bundle-whitebox-use-refined/Test_2.scala b/tests/disabled/macro/run/macro-bundle-whitebox-use-refined/Test_2.scala new file mode 100644 index 000000000..b28ebfd71 --- /dev/null +++ b/tests/disabled/macro/run/macro-bundle-whitebox-use-refined/Test_2.scala @@ -0,0 +1,19 @@ +object Test extends dotty.runtime.LegacyApp { + println(ReturnTypeRefinement.foo.x) + + case class Foo(i: Int, s: String, b: Boolean) + def foo[C, L](c: C)(implicit iso: FundepMaterialization[C, L]): L = iso.to(c) + locally { + val equiv = foo(Foo(23, "foo", true)) + def typed[T](t: => T) {} + typed[(Int, String, Boolean)](equiv) + println(equiv) + } + + println(implicitly[DynamicMaterialization[C1]]) + println(implicitly[DynamicMaterialization[C2]]) + + 42 match { + case ExtractorMacro(x) => println(x) + } +} diff --git a/tests/disabled/macro/run/macro-def-path-dependent.check b/tests/disabled/macro/run/macro-def-path-dependent.check new file mode 100644 index 000000000..7658ad2c2 --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent.check @@ -0,0 +1 @@ +it works diff --git a/tests/disabled/macro/run/macro-def-path-dependent.flags b/tests/disabled/macro/run/macro-def-path-dependent.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-def-path-dependent/Dummy.scala b/tests/disabled/macro/run/macro-def-path-dependent/Dummy.scala new file mode 100644 index 000000000..2ccaa3940 --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent/Dummy.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + println("it works") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-def-path-dependent/Test_1.scala b/tests/disabled/macro/run/macro-def-path-dependent/Test_1.scala new file mode 100644 index 000000000..4161a6430 --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent/Test_1.scala @@ -0,0 +1,25 @@ +// NOTE: blocked by SI-8049 + +// package test1 +// +// import scala.reflect.macros.blackbox.Context +// +// trait Exprs { +// self: Universe => +// +// class Expr[T] +// } +// +// trait Reifiers { +// self: Universe => +// +// type Expr[T] +// +// def reify[T](expr: T): Expr[T] = macro Impls.reify[T] +// } +// +// trait Universe extends Exprs with Reifiers +// +// object Impls { +// def reify[T](cc: Context{ type PrefixType = Reifiers })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ??? +// } diff --git a/tests/disabled/macro/run/macro-def-path-dependent/Test_2.scala b/tests/disabled/macro/run/macro-def-path-dependent/Test_2.scala new file mode 100644 index 000000000..75a03b54e --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent/Test_2.scala @@ -0,0 +1,22 @@ +package test2 + +import scala.reflect.macros.blackbox.Context + +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: Context{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ??? +} diff --git a/tests/disabled/macro/run/macro-def-path-dependent/Test_3.scala b/tests/disabled/macro/run/macro-def-path-dependent/Test_3.scala new file mode 100644 index 000000000..1a5da8200 --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent/Test_3.scala @@ -0,0 +1,22 @@ +package test3 + +import scala.reflect.macros.blackbox.Context + +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: Context{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ??? +} diff --git a/tests/disabled/macro/run/macro-def-path-dependent/Test_4.scala b/tests/disabled/macro/run/macro-def-path-dependent/Test_4.scala new file mode 100644 index 000000000..67cb88ee6 --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent/Test_4.scala @@ -0,0 +1,11 @@ +package test4 + +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context +import scala.reflect.api.Universe + +object Test { + def materializeTypeTag[T](u: Universe)(e: T): u.TypeTag[T] = macro materializeTypeTag_impl[T] + + def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-def-path-dependent/Test_5.scala b/tests/disabled/macro/run/macro-def-path-dependent/Test_5.scala new file mode 100644 index 000000000..b518ce864 --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent/Test_5.scala @@ -0,0 +1,9 @@ +package test56 + +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context +import scala.reflect.api.Universe + +object Impls { + def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-def-path-dependent/Test_6.scala b/tests/disabled/macro/run/macro-def-path-dependent/Test_6.scala new file mode 100644 index 000000000..a8b50ce7d --- /dev/null +++ b/tests/disabled/macro/run/macro-def-path-dependent/Test_6.scala @@ -0,0 +1,9 @@ +package test56 + +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context +import scala.reflect.api.Universe + +object Macros { + def materializeTypeTag[T](u: Universe)(e: T): u.TypeTag[T] = macro Impls.materializeTypeTag_impl[T] +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-default-params.check b/tests/disabled/macro/run/macro-default-params.check new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/disabled/macro/run/macro-default-params.check @@ -0,0 +1 @@ +0 diff --git a/tests/disabled/macro/run/macro-default-params/Macros_1.scala b/tests/disabled/macro/run/macro-default-params/Macros_1.scala new file mode 100644 index 000000000..74588a1cf --- /dev/null +++ b/tests/disabled/macro/run/macro-default-params/Macros_1.scala @@ -0,0 +1,27 @@ +import scala.language.experimental.macros +import scala.reflect.macros.whitebox.Context + +object Macros { + def id[A]: A = null.asInstanceOf[A] + + def foo: Any = macro impl + def impl(c: Context): c.Tree = { + import c.universe._ + import Flag._ + + lazy val tpe = TypeTree(typeOf[Int]) + + /* If we used this line instead, it would work! */ + // lazy val tpe = tq"Int" + + lazy val param: ValDef = { + val p1 = q"val a: ${tpe.duplicate} = Macros.id[${tpe.duplicate}]" + ValDef(Modifiers(DEFAULTPARAM), p1.name, p1.tpt, p1.rhs) + } + + q""" + class C { def f($param) = a } + println(new C().f()) + """ + } +} diff --git a/tests/disabled/macro/run/macro-default-params/Test_2.scala b/tests/disabled/macro/run/macro-default-params/Test_2.scala new file mode 100644 index 000000000..d75fbd0db --- /dev/null +++ b/tests/disabled/macro/run/macro-default-params/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} diff --git a/tests/disabled/macro/run/macro-divergence-spurious.check b/tests/disabled/macro/run/macro-divergence-spurious.check new file mode 100644 index 000000000..19765bd50 --- /dev/null +++ b/tests/disabled/macro/run/macro-divergence-spurious.check @@ -0,0 +1 @@ +null diff --git a/tests/disabled/macro/run/macro-divergence-spurious/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-divergence-spurious/Impls_Macros_1.scala new file mode 100644 index 000000000..7ac8fccc3 --- /dev/null +++ b/tests/disabled/macro/run/macro-divergence-spurious/Impls_Macros_1.scala @@ -0,0 +1,23 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +trait Complex[T] + +class Foo(val bar: Bar) +class Bar(val s: String) + +object Complex { + def impl[T: c.WeakTypeTag](c: Context): c.Expr[Complex[T]] = { + import c.universe._ + val tpe = weakTypeOf[T] + for (f <- tpe.decls.collect{case f: TermSymbol if f.isParamAccessor && !f.isMethod => f}) { + val trecur = appliedType(typeOf[Complex[_]], List(f.info)) + val recur = c.inferImplicitValue(trecur, silent = true) + if (recur == EmptyTree) c.abort(c.enclosingPosition, s"couldn't synthesize $trecur") + } + c.Expr[Null](Literal(Constant(null))) + } + + implicit object ComplexString extends Complex[String] + implicit def genComplex[T]: Complex[T] = macro impl[T] +} diff --git a/tests/disabled/macro/run/macro-divergence-spurious/Test_2.scala b/tests/disabled/macro/run/macro-divergence-spurious/Test_2.scala new file mode 100644 index 000000000..0a9820701 --- /dev/null +++ b/tests/disabled/macro/run/macro-divergence-spurious/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + println(implicitly[Complex[Foo]]) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-duplicate.check b/tests/disabled/macro/run/macro-duplicate.check new file mode 100644 index 000000000..58781b719 --- /dev/null +++ b/tests/disabled/macro/run/macro-duplicate.check @@ -0,0 +1,3 @@ +Test_2.scala:5: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + Macros.foo + ^ diff --git a/tests/disabled/macro/run/macro-duplicate.flags b/tests/disabled/macro/run/macro-duplicate.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-duplicate.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-duplicate/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-duplicate/Impls_Macros_1.scala new file mode 100644 index 000000000..84fb2c5b6 --- /dev/null +++ b/tests/disabled/macro/run/macro-duplicate/Impls_Macros_1.scala @@ -0,0 +1,29 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + val Expr(Block((cdef: ClassDef) :: Nil, _)) = reify { class C { def x = 2 } } + val cdef1 = + new Transformer { + override def transform(tree: Tree): Tree = tree match { + case Template(_, _, ctor :: defs) => + val defs1 = defs collect { + case ddef @ DefDef(mods, name, tparams, vparamss, tpt, body) => + val future = Select(Select(Ident(TermName("scala")), TermName("concurrent")), TermName("Future")) + val Future = Select(Select(Ident(TermName("scala")), TermName("concurrent")), TypeName("Future")) + val tpt1 = if (tpt.isEmpty) tpt else AppliedTypeTree(Future, List(tpt)) + val body1 = Apply(future, List(body)) + val name1 = TermName("async" + name.toString.capitalize) + DefDef(mods, name1, tparams, vparamss, tpt1, body1) + } + Template(Nil, emptyValDef, ctor +: defs ::: defs1) + case _ => + super.transform(tree) + } + } transform cdef + c.Expr[Unit](Block(cdef1 :: Nil, Literal(Constant(())))) + } + + def foo = macro impl +} diff --git a/tests/disabled/macro/run/macro-duplicate/Test_2.scala b/tests/disabled/macro/run/macro-duplicate/Test_2.scala new file mode 100644 index 000000000..8706883b4 --- /dev/null +++ b/tests/disabled/macro/run/macro-duplicate/Test_2.scala @@ -0,0 +1,6 @@ +import scala.concurrent._ +import ExecutionContext.Implicits.global + +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-enclosingowner-detectvar.check b/tests/disabled/macro/run/macro-enclosingowner-detectvar.check new file mode 100644 index 000000000..c8f86ec73 --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosingowner-detectvar.check @@ -0,0 +1,16 @@ +(true,false,false,false) +(true,false,false,false) +(true,false,false,false) +(true,false,false,false) +(false,true,false,false) +(false,true,false,false) +(false,true,false,false) +(false,true,false,false) +(false,false,true,false) +(false,false,true,false) +(false,false,true,false) +(false,false,true,false) +(false,false,false,true) +(false,false,false,true) +(false,false,false,true) +(false,false,false,true) diff --git a/tests/disabled/macro/run/macro-enclosingowner-detectvar/Macros_1.scala b/tests/disabled/macro/run/macro-enclosingowner-detectvar/Macros_1.scala new file mode 100644 index 000000000..26ed64d8c --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosingowner-detectvar/Macros_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + def detectFlags(sym: TermSymbol): String = { + (sym.isVal, sym.isVar, !sym.isVal && !sym.isVar && !sym.isLazy, sym.isLazy).toString + } + q"println(${detectFlags(c.internal.enclosingOwner.asTerm)}); 42" + } + + def foo: Int = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-enclosingowner-detectvar/Test_2.scala b/tests/disabled/macro/run/macro-enclosingowner-detectvar/Test_2.scala new file mode 100644 index 000000000..edc0eb654 --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosingowner-detectvar/Test_2.scala @@ -0,0 +1,23 @@ +object Test extends dotty.runtime.LegacyApp { + val a1 = Macros.foo + val a2 = Predef.identity(Predef.identity(Macros.foo)) + val a3: Int = Macros.foo + val a4: Int = Predef.identity(Predef.identity(Macros.foo)) + + var b1 = Macros.foo + var b2 = Predef.identity(Predef.identity(Macros.foo)) + var b3: Int = Macros.foo + var b4: Int = Predef.identity(Predef.identity(Macros.foo)) + + def c1 = Macros.foo + def c2 = Predef.identity(Predef.identity(Macros.foo)) + def c3: Int = Macros.foo + def c4: Int = Predef.identity(Predef.identity(Macros.foo)) + c1; c2; c3; c4; + + lazy val d1 = Macros.foo + lazy val d2 = Predef.identity(Predef.identity(Macros.foo)) + lazy val d3: Int = Macros.foo + lazy val d4: Int = Predef.identity(Predef.identity(Macros.foo)) + d1; d2; d3; d4 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-enclosingowner-sbt.check b/tests/disabled/macro/run/macro-enclosingowner-sbt.check new file mode 100644 index 000000000..3c95698e9 --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosingowner-sbt.check @@ -0,0 +1,16 @@ +a1 +a2 +a3 +a4 +b1 +b2 +b3 +b4 +c1 +c2 +c3 +c4 +d1 +d2 +d3 +d4 diff --git a/tests/disabled/macro/run/macro-enclosingowner-sbt/Macros_1.scala b/tests/disabled/macro/run/macro-enclosingowner-sbt/Macros_1.scala new file mode 100644 index 000000000..a98a98486 --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosingowner-sbt/Macros_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + def enclosingName(sym: Symbol): String = { + sym.name.toString.stripSuffix(termNames.LOCAL_SUFFIX_STRING) + } + q"println(${enclosingName(c.internal.enclosingOwner).toString}); 42" + } + + def foo: Int = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-enclosingowner-sbt/Test_2.scala b/tests/disabled/macro/run/macro-enclosingowner-sbt/Test_2.scala new file mode 100644 index 000000000..edc0eb654 --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosingowner-sbt/Test_2.scala @@ -0,0 +1,23 @@ +object Test extends dotty.runtime.LegacyApp { + val a1 = Macros.foo + val a2 = Predef.identity(Predef.identity(Macros.foo)) + val a3: Int = Macros.foo + val a4: Int = Predef.identity(Predef.identity(Macros.foo)) + + var b1 = Macros.foo + var b2 = Predef.identity(Predef.identity(Macros.foo)) + var b3: Int = Macros.foo + var b4: Int = Predef.identity(Predef.identity(Macros.foo)) + + def c1 = Macros.foo + def c2 = Predef.identity(Predef.identity(Macros.foo)) + def c3: Int = Macros.foo + def c4: Int = Predef.identity(Predef.identity(Macros.foo)) + c1; c2; c3; c4; + + lazy val d1 = Macros.foo + lazy val d2 = Predef.identity(Predef.identity(Macros.foo)) + lazy val d3: Int = Macros.foo + lazy val d4: Int = Predef.identity(Predef.identity(Macros.foo)) + d1; d2; d3; d4 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-enclosures.check b/tests/disabled/macro/run/macro-enclosures.check new file mode 100644 index 000000000..b6fe7a4a9 --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosures.check @@ -0,0 +1,34 @@ +enclosingPackage = package test { + object Test extends scala.AnyRef { + def () = { + super.(); + () + }; + def test = Macros.foo + } +} +enclosingClass = object Test extends scala.AnyRef { + def () = { + super.(); + () + }; + def test = Macros.foo +} +enclosingImpl = object Test extends scala.AnyRef { + def () = { + super.(); + () + }; + def test = Macros.foo +} +enclosingTemplate = scala.AnyRef { + def () = { + super.(); + () + }; + def test = Macros.foo +} +enclosingMethod = def test = Macros.foo +enclosingDef = def test = Macros.foo +enclosingOwner = method test +enclosingOwnerChain = List(method test, object Test, package test, package ) diff --git a/tests/disabled/macro/run/macro-enclosures.flags b/tests/disabled/macro/run/macro-enclosures.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosures.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-enclosures/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-enclosures/Impls_Macros_1.scala new file mode 100644 index 000000000..564cdfa68 --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosures/Impls_Macros_1.scala @@ -0,0 +1,23 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + def chain(sym: Symbol): List[Symbol] = sym.owner match { + case NoSymbol => sym :: Nil + case owner => sym :: chain(owner) + } + q""" + println("enclosingPackage = " + ${c.enclosingPackage.toString}) + println("enclosingClass = " + ${c.enclosingClass.toString}) + println("enclosingImpl = " + ${c.enclosingImpl.toString}) + println("enclosingTemplate = " + ${c.enclosingTemplate.toString}) + println("enclosingMethod = " + ${c.enclosingMethod.toString}) + println("enclosingDef = " + ${c.enclosingDef.toString}) + println("enclosingOwner = " + ${c.internal.enclosingOwner.toString}) + println("enclosingOwnerChain = " + ${chain(c.internal.enclosingOwner).toString}) + """ + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-enclosures/Test_2.scala b/tests/disabled/macro/run/macro-enclosures/Test_2.scala new file mode 100644 index 000000000..8b8dc10cd --- /dev/null +++ b/tests/disabled/macro/run/macro-enclosures/Test_2.scala @@ -0,0 +1,11 @@ +object Test extends dotty.runtime.LegacyApp { + test.Test.test +} + +package test { + object Test { + def test = { + Macros.foo + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-argument.check b/tests/disabled/macro/run/macro-expand-implicit-argument.check new file mode 100644 index 000000000..15a62794a --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-argument.check @@ -0,0 +1 @@ +List(1, 2, 3) diff --git a/tests/disabled/macro/run/macro-expand-implicit-argument.flags b/tests/disabled/macro/run/macro-expand-implicit-argument.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-argument.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-argument/Macros_1.scala b/tests/disabled/macro/run/macro-expand-implicit-argument/Macros_1.scala new file mode 100644 index 000000000..465f313ef --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-argument/Macros_1.scala @@ -0,0 +1,59 @@ +import annotation.tailrec +import scala.math.{min, max} +import scala.{specialized => spec} + +import language.experimental.macros + +import scala.reflect.ClassTag +import scala.reflect.macros.blackbox.Context + +object Macros { + def alloc[@spec A:ClassTag](src:Array[A], s1:Int, len:Int) = { + val as = Array.ofDim[A](len) + System.arraycopy(src, s1, as, 0, len) + as + } + + /** + * Efficient alternative to Array.apply. + * + * "As seen on scala-internals!" + */ + def array[A](as:A*)(implicit ct: ClassTag[A]) = macro arrayMacro[A] + + /** + * Takes in something like: + * ArrayUtil.alloc[Int](11, 22, 33, 44)(ct) + * + * and builds a tree like: + * { + * val arr:Array[Int] = ct.newArray(4) + * arr.update(0, 11) + * arr.update(1, 22) + * arr.update(2, 33) + * arr.update(3, 44) + * arr + * } + */ + def arrayMacro[A:c.WeakTypeTag](c:Context)(as:c.Expr[A]*)(ct: c.Expr[ClassTag[A]]): c.Expr[Array[A]] = { + import c.mirror._ + import c.universe._ + def const(x:Int) = Literal(Constant(x)) + + val n = as.length + val arr = TermName("arr") + + val create = Apply(Select(ct.tree, TermName("newArray")), List(const(n))) + val arrtpe = TypeTree(implicitly[c.WeakTypeTag[Array[A]]].tpe) + val valdef = ValDef(Modifiers(), arr, arrtpe, create) + + val updates = (0 until n).map { + i => Apply(Select(Ident(arr), TermName("update")), List(const(i), as(i).tree)) + } + + val exprs = (Seq(valdef) ++ updates ++ Seq(Ident(arr))).toList + val block = Block(exprs.init, exprs.last) + + c.Expr[Array[A]](block) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-argument/Test_2.scala b/tests/disabled/macro/run/macro-expand-implicit-argument/Test_2.scala new file mode 100644 index 000000000..edb1de413 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-argument/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + import Macros._ + println(array(1, 2, 3).toList) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit.check b/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit.flags b/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala b/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala new file mode 100644 index 000000000..18c97956e --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(x.tree)) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala new file mode 100644 index 000000000..2f5648758 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + implicit val x = 42 + def foo(implicit x: Int): Unit = macro Impls.foo + foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit.check b/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit.check new file mode 100644 index 000000000..c205945d0 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit.check @@ -0,0 +1,2 @@ +Some(2) +2 diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit.flags b/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala b/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala new file mode 100644 index 000000000..aeceee5a5 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[String]): c.Expr[Option[Int]] = { + import c.universe._ + val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt")))) + c.Expr[Option[Int]](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala new file mode 100644 index 000000000..8f0fbe60e --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala @@ -0,0 +1,11 @@ +object Macros { + import scala.language.implicitConversions + implicit def foo(x: String): Option[Int] = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + import Macros._ + println("2": Option[Int]) + val s: Int = "2" getOrElse 0 + println(s) +} diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-val.check b/tests/disabled/macro/run/macro-expand-implicit-macro-is-val.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-val.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-val.flags b/tests/disabled/macro/run/macro-expand-implicit-macro-is-val.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-val.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-val/Impls_1.scala b/tests/disabled/macro/run/macro-expand-implicit-macro-is-val/Impls_1.scala new file mode 100644 index 000000000..fd267d32c --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-val/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.universe._ + val body = Literal(Constant(2)) + c.Expr[Int](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala new file mode 100644 index 000000000..3b851de05 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + implicit def foo: Int = macro Impls.foo + def bar(implicit x: Int) = println(x) + bar +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-view.check b/tests/disabled/macro/run/macro-expand-implicit-macro-is-view.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-view.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-view/Impls_1.scala b/tests/disabled/macro/run/macro-expand-implicit-macro-is-view/Impls_1.scala new file mode 100644 index 000000000..d72db872e --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-view/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[String]): c.Expr[Option[Int]] = { + import c.universe._ + val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt")))) + c.Expr[Option[Int]](body) + } +} diff --git a/tests/disabled/macro/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala new file mode 100644 index 000000000..c7b09435a --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala @@ -0,0 +1,12 @@ + +object Macros { + import scala.language.experimental.macros + import scala.language.implicitConversions + implicit def foo(x: String): Option[Int] = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + import Macros._ + def bar[T <% Option[Int]](x: T) = println(x) + println("2") +} diff --git a/tests/disabled/macro/run/macro-expand-multiple-arglists.check b/tests/disabled/macro/run/macro-expand-multiple-arglists.check new file mode 100644 index 000000000..c24b6ae77 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-multiple-arglists.check @@ -0,0 +1 @@ +38 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-multiple-arglists.flags b/tests/disabled/macro/run/macro-expand-multiple-arglists.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-multiple-arglists.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-multiple-arglists/Impls_1.scala b/tests/disabled/macro/run/macro-expand-multiple-arglists/Impls_1.scala new file mode 100644 index 000000000..9278633c1 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-multiple-arglists/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = { + import c.universe._ + val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum)) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-multiple-arglists/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-multiple-arglists/Macros_Test_2.scala new file mode 100644 index 000000000..09de5e02f --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-multiple-arglists/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + def foo(x: Int)(y: Int): Unit = macro Impls.foo + foo(40)(2) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-nullary-generic.check b/tests/disabled/macro/run/macro-expand-nullary-generic.check new file mode 100644 index 000000000..0470d239d --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-nullary-generic.check @@ -0,0 +1,6 @@ +fooNullary[Int] +fooEmpty[Int] +fooEmpty[Int] +barNullary[Int] +barEmpty[Int] +kkthxbai diff --git a/tests/disabled/macro/run/macro-expand-nullary-generic.flags b/tests/disabled/macro/run/macro-expand-nullary-generic.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-nullary-generic.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-nullary-generic/Impls_1.scala b/tests/disabled/macro/run/macro-expand-nullary-generic/Impls_1.scala new file mode 100644 index 000000000..9362d6c17 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-nullary-generic/Impls_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Impls { + def impl[T: c.WeakTypeTag](c: Context)(meth: String) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(s"$meth[${c.weakTypeOf[T]}]")))) + c.Expr[Unit](body) + } + + def fooNullary[T: c.WeakTypeTag](c: Context) = impl[T](c)("fooNullary") + def fooEmpty[T: c.WeakTypeTag](c: Context)() = impl[T](c)("fooEmpty") + def barNullary[T: c.WeakTypeTag](c: Context)(x: c.Expr[Int]) = impl[T](c)("barNullary") + def barEmpty[T: c.WeakTypeTag](c: Context)(x: c.Expr[Int])() = impl[T](c)("barEmpty") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-nullary-generic/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-nullary-generic/Macros_Test_2.scala new file mode 100644 index 000000000..da418c63c --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-nullary-generic/Macros_Test_2.scala @@ -0,0 +1,15 @@ +object Macros { + def foo1[T]: Unit = macro Impls.fooNullary[T] + def foo2[T](): Unit = macro Impls.fooEmpty[T] + def bar1[T](x: Int): Unit = macro Impls.barNullary[T] + def bar2[T](x: Int)(): Unit = macro Impls.barEmpty[T] +} + +object Test extends dotty.runtime.LegacyApp { + 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/tests/disabled/macro/run/macro-expand-nullary-nongeneric.check b/tests/disabled/macro/run/macro-expand-nullary-nongeneric.check new file mode 100644 index 000000000..cb7e76639 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-nullary-nongeneric.check @@ -0,0 +1,6 @@ +fooNullary +fooEmpty +fooEmpty +barNullary +barEmpty +kkthxbai diff --git a/tests/disabled/macro/run/macro-expand-nullary-nongeneric.flags b/tests/disabled/macro/run/macro-expand-nullary-nongeneric.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-nullary-nongeneric.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-nullary-nongeneric/Impls_1.scala b/tests/disabled/macro/run/macro-expand-nullary-nongeneric/Impls_1.scala new file mode 100644 index 000000000..c8c3d255c --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-nullary-nongeneric/Impls_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Impls { + def impl(c: Context)(meth: String) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(meth)))) + c.Expr[Unit](body) + } + + def fooNullary(c: Context) = impl(c)("fooNullary") + def fooEmpty(c: Context)() = impl(c)("fooEmpty") + def barNullary(c: Context)(x: c.Expr[Int]) = impl(c)("barNullary") + def barEmpty(c: Context)(x: c.Expr[Int])() = impl(c)("barEmpty") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala new file mode 100644 index 000000000..a14d981ce --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala @@ -0,0 +1,15 @@ +object Macros { + def foo1: Unit = macro Impls.fooNullary + def foo2(): Unit = macro Impls.fooEmpty + def bar1(x: Int): Unit = macro Impls.barNullary + def bar2(x: Int)(): Unit = macro Impls.barEmpty +} + +object Test extends dotty.runtime.LegacyApp { + Macros.foo1 + Macros.foo2 + Macros.foo2() + Macros.bar1(42) + Macros.bar2(42)() + println("kkthxbai") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-overload.check b/tests/disabled/macro/run/macro-expand-overload.check new file mode 100644 index 000000000..a2b7b0e78 --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-expand-overload.flags b/tests/disabled/macro/run/macro-expand-overload.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-overload.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-overload/Impls_1.scala b/tests/disabled/macro/run/macro-expand-overload/Impls_1.scala new file mode 100644 index 000000000..ef9d01d4e --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-overload/Impls_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def impl(c: Context)(tag: String, x: c.Expr[_]) = { + import c.{prefix => prefix} + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) + c.Expr[Unit](body) + } + + def fooObjectString(c: Context)(x: c.Expr[_]) = impl(c)("fooObjectString", x) + def fooObjectInt(c: Context)(x: c.Expr[_]) = impl(c)("fooObjectInt", x) + def fooClassString(c: Context)(x: c.Expr[_]) = impl(c)("fooClassString", x) + def fooClassInt(c: Context)(x: c.Expr[_]) = impl(c)("fooClassInt", x) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-overload/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-overload/Macros_Test_2.scala new file mode 100644 index 000000000..b367f35b7 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-overload/Macros_Test_2.scala @@ -0,0 +1,20 @@ +object Macros { + def foo(x: String): Unit = macro Impls.fooObjectString + def foo(x: Int): Unit = macro Impls.fooObjectInt + def foo(x: Boolean): Unit = println("fooObjectBoolean") +} + +class Macros { + def foo(x: String): Unit = macro Impls.fooClassString + def foo(x: Int): Unit = macro Impls.fooClassInt + def foo(x: Boolean): Unit = println("fooClassBoolean") +} + +object Test extends dotty.runtime.LegacyApp { + 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/tests/disabled/macro/run/macro-expand-override.check b/tests/disabled/macro/run/macro-expand-override.check new file mode 100644 index 000000000..b41dc156c --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-expand-override.flags b/tests/disabled/macro/run/macro-expand-override.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-override.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-override/Impls_1.scala b/tests/disabled/macro/run/macro-expand-override/Impls_1.scala new file mode 100644 index 000000000..e6ce18f17 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-override/Impls_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def impl(c: Context)(tag: String, x: c.Expr[_]) = { + import c.{prefix => prefix} + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) + c.Expr[Unit](body) + } + + def fooBString(c: Context)(x: c.Expr[_]) = impl(c)("fooBString", x) + def fooBInt(c: Context)(x: c.Expr[_]) = impl(c)("fooBInt", x) + def fooDInt(c: Context)(x: c.Expr[_]) = impl(c)("fooDInt", x) + def fooZString(c: Context)(x: c.Expr[_]) = impl(c)("fooZString", x) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-override/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-override/Macros_Test_2.scala new file mode 100644 index 000000000..46c1f49cc --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-override/Macros_Test_2.scala @@ -0,0 +1,43 @@ +class B { + def foo(x: String): Unit = macro Impls.fooBString + def foo(x: Int): Unit = macro Impls.fooBInt + def foo(x: Boolean): Unit = println("fooBBoolean") +} + +class D extends B { + //override def foo(x: String): Unit = println("fooDString") => method cannot override a macro + override def foo(x: Int): Unit = macro Impls.fooDInt +} + +class Z extends D { + override def foo(x: String): Unit = macro Impls.fooZString + override def foo(x: Boolean): Unit = println("fooZBoolean") +} + +object Test extends dotty.runtime.LegacyApp { + + 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/tests/disabled/macro/run/macro-expand-recursive.check b/tests/disabled/macro/run/macro-expand-recursive.check new file mode 100644 index 000000000..7658ad2c2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-recursive.check @@ -0,0 +1 @@ +it works diff --git a/tests/disabled/macro/run/macro-expand-recursive.flags b/tests/disabled/macro/run/macro-expand-recursive.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-recursive.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-recursive/Impls_1.scala b/tests/disabled/macro/run/macro-expand-recursive/Impls_1.scala new file mode 100644 index 000000000..3def2d2fb --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-recursive/Impls_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))) + c.Expr[Unit](body) + } + + def fooFoo(c: Context) = { + import c.universe._ + val body = Select(Ident(TermName("Macros")), TermName("foo")) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-recursive/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-recursive/Macros_Test_2.scala new file mode 100644 index 000000000..e8a88afc9 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-recursive/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo: Unit = macro Impls.foo + def fooFoo: Unit = macro Impls.fooFoo +} + +object Test extends dotty.runtime.LegacyApp { + Macros.fooFoo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-bounds.check b/tests/disabled/macro/run/macro-expand-tparams-bounds.check new file mode 100644 index 000000000..317e9677c --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-bounds.check @@ -0,0 +1,2 @@ +hello +hello diff --git a/tests/disabled/macro/run/macro-expand-tparams-bounds.flags b/tests/disabled/macro/run/macro-expand-tparams-bounds.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-bounds.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-bounds/Impls_1.scala b/tests/disabled/macro/run/macro-expand-tparams-bounds/Impls_1.scala new file mode 100644 index 000000000..95aaa1c3d --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-bounds/Impls_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.blackbox.Context + +object Impls1 { + def foo[U <: String](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello")""") } +} + +class C +class D extends C + +object Impls2 { + def foo[U <: C](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello")""") } +} diff --git a/tests/disabled/macro/run/macro-expand-tparams-bounds/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-tparams-bounds/Macros_Test_2.scala new file mode 100644 index 000000000..f1cab82ec --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-bounds/Macros_Test_2.scala @@ -0,0 +1,12 @@ +object Macros1 { + def foo[U <: String]: Unit = macro Impls1.foo[U] +} + +object Macros2 { + def foo[T <: D]: Unit = macro Impls2.foo[T] +} + +object Test extends dotty.runtime.LegacyApp { + Macros1.foo[String] + Macros2.foo[D] +} diff --git a/tests/disabled/macro/run/macro-expand-tparams-explicit.check b/tests/disabled/macro/run/macro-expand-tparams-explicit.check new file mode 100644 index 000000000..b6b4f6fa3 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-explicit.check @@ -0,0 +1 @@ +WeakTypeTag[Int] diff --git a/tests/disabled/macro/run/macro-expand-tparams-explicit.flags b/tests/disabled/macro/run/macro-expand-tparams-explicit.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-explicit.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-explicit/Impls_1.scala b/tests/disabled/macro/run/macro-expand-tparams-explicit/Impls_1.scala new file mode 100644 index 000000000..c33ac6d1b --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-explicit/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo[U: c.WeakTypeTag](c: Context) = { + import c.universe._ + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-explicit/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-tparams-explicit/Macros_Test_2.scala new file mode 100644 index 000000000..14154ee03 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-explicit/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + def foo[U]: Unit = macro Impls.foo[U] + foo[Int] +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-implicit.check b/tests/disabled/macro/run/macro-expand-tparams-implicit.check new file mode 100644 index 000000000..a9bf55423 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-implicit.check @@ -0,0 +1,2 @@ +WeakTypeTag[Int] +WeakTypeTag[String] diff --git a/tests/disabled/macro/run/macro-expand-tparams-implicit.flags b/tests/disabled/macro/run/macro-expand-tparams-implicit.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-implicit.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-implicit/Impls_1.scala b/tests/disabled/macro/run/macro-expand-tparams-implicit/Impls_1.scala new file mode 100644 index 000000000..32cee0d5f --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-implicit/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-implicit/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-tparams-implicit/Macros_Test_2.scala new file mode 100644 index 000000000..386817469 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-implicit/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + def foo[U](x: U): Unit = macro Impls.foo[U] + foo(42) + foo("42") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-prefix.check b/tests/disabled/macro/run/macro-expand-tparams-prefix.check new file mode 100644 index 000000000..739795806 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-prefix.check @@ -0,0 +1,20 @@ +===Macros1=== +WeakTypeTag[Int] +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros2=== +WeakTypeTag[Boolean] WeakTypeTag[Int] +WeakTypeTag[Boolean] WeakTypeTag[String] +===Macros3=== +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros4=== +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros5=== +WeakTypeTag[T] +WeakTypeTag[U] +WeakTypeTag[Boolean] diff --git a/tests/disabled/macro/run/macro-expand-tparams-prefix.flags b/tests/disabled/macro/run/macro-expand-tparams-prefix.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-prefix.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-tparams-prefix/Impls_1.scala b/tests/disabled/macro/run/macro-expand-tparams-prefix/Impls_1.scala new file mode 100644 index 000000000..289f07162 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-prefix/Impls_1.scala @@ -0,0 +1,39 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Impls1 { + def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val U = implicitly[c.WeakTypeTag[U]] + c.Expr[Unit](q"println(${U.toString})") + } +} + +object Impls2 { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val T = implicitly[c.WeakTypeTag[T]] + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) + c.Expr[Unit](q"""println(${T.toString} + " " + ${U.toString})""") + } +} + +object Impls345 { + def foo[T, U: c.WeakTypeTag, V](c: Context)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { + import c.universe._ + c.Expr(q""" + println(${T.toString}) + println(${implicitly[c.WeakTypeTag[U]].toString}) + println(${V.toString}) + """) + } +} + +object Macros4 { + class D[T] { + class C[U] { + def foo[V] = macro Impls345.foo[T, U, V] + } + } +} diff --git a/tests/disabled/macro/run/macro-expand-tparams-prefix/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-tparams-prefix/Macros_Test_2.scala new file mode 100644 index 000000000..8916f03e4 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-tparams-prefix/Macros_Test_2.scala @@ -0,0 +1,57 @@ +object Macros1 { + class C[T] { + def foo[U](x: U): Unit = macro Impls1.foo[U] + } +} + +object Macros2 { + class C[T] { + def foo[U](x: U): Unit = macro Impls2.foo[T, U] + } +} + +object Macros3 { + class D[T] { + class C[U] { + def foo[V]: Unit = macro Impls345.foo[T, U, V] + } + } +} + +// object Macros4 is declared in Impls_1.scala + +object Macros5 { + class D[T] { + class C[U] { + def foo[V]: Unit = macro Impls345.foo[T, U, V] + foo[Boolean] + } + } +} + +object Test extends dotty.runtime.LegacyApp { + println("===Macros1===") + new Macros1.C[Int]().foo(42) + new Macros1.C[Boolean]().foo(42) + new Macros1.C[Int]().foo("42") + new Macros1.C[String]().foo(true) + + println("===Macros2===") + object D2 extends Macros2.C[Boolean] + D2.foo(42) + D2.foo("42") + + println("===Macros3===") + val outer31 = new Macros3.D[Int] + val outer32 = new outer31.C[String] + outer32.foo[Boolean] + + println("===Macros4===") + val outer41 = new Macros4.D[Int] + val outer42 = new outer41.C[String] + outer42.foo[Boolean] + + println("===Macros5===") + val outer1 = new Macros5.D[Int] + new outer1.C[String] +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-unapply-a.check b/tests/disabled/macro/run/macro-expand-unapply-a.check new file mode 100644 index 000000000..7c2976e51 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-unapply-a.check @@ -0,0 +1,2 @@ +(1,2) +(1,2,3) diff --git a/tests/disabled/macro/run/macro-expand-unapply-a.flags b/tests/disabled/macro/run/macro-expand-unapply-a.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-unapply-a.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-unapply-a/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-expand-unapply-a/Impls_Macros_1.scala new file mode 100644 index 000000000..64f16c6a8 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-unapply-a/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.whitebox.Context + +object Helper { + def unapplySeq[T](x: List[T]): Option[Seq[T]] = List.unapplySeq[T](x) +} + +object Macros { + def impl[T: c.WeakTypeTag](c: Context)(x: c.Expr[List[T]]) = { + c.universe.reify(Helper.unapplySeq(x.splice)) + } + + object UnapplyMacro { + def unapplySeq[T](x: List[T]): Option[Seq[T]] = macro impl[T] + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-unapply-a/Test_2.scala b/tests/disabled/macro/run/macro-expand-unapply-a/Test_2.scala new file mode 100644 index 000000000..ce52df802 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-unapply-a/Test_2.scala @@ -0,0 +1,6 @@ +import Macros._ + +object Test extends dotty.runtime.LegacyApp { + List(1, 2) match { case UnapplyMacro(x, y) => println((x, y)) } + List(1, 2, 3) match { case UnapplyMacro(x, y, z) => println((x, y, z)) } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check new file mode 100644 index 000000000..2709b5703 --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad.flags b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala new file mode 100644 index 000000000..18af84583 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(xs: c.Expr[Int]*) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala new file mode 100644 index 000000000..868fb8d91 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala @@ -0,0 +1,12 @@ +object Macros { + def foo(xs: Int*): Unit = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(typeNames.WILDCARD_STAR)))) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good.check b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good.check new file mode 100644 index 000000000..fe90caed3 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good.check @@ -0,0 +1 @@ +List(1, 2, 3, 4, 5) diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good.flags b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala new file mode 100644 index 000000000..eb067c25a --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(xs: c.Expr[Int]*) = { + import c.universe._ + val stripped_xs = xs map (_.tree) toList match { + case List(Typed(stripped, Ident(wildstar))) if wildstar == typeNames.WILDCARD_STAR => List(stripped) + case _ => ??? + } + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), stripped_xs) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala new file mode 100644 index 000000000..7eba411cd --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(xs: Int*): Unit = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + val numbers = List(1, 2, 3, 4, 5) + Macros.foo(numbers: _*) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs.check b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs.check new file mode 100644 index 000000000..fe90caed3 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs.check @@ -0,0 +1 @@ +List(1, 2, 3, 4, 5) diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs.flags b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala new file mode 100644 index 000000000..64ab7de02 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def myprintln(xs: Int*) = { + println(xs) + } + + def foo(c: Context)(xs: c.Expr[Int]*) = { + import c.universe._ + val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala new file mode 100644 index 000000000..7eba411cd --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo(xs: Int*): Unit = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + val numbers = List(1, 2, 3, 4, 5) + Macros.foo(numbers: _*) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs.check b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs.check new file mode 100644 index 000000000..bcfab1984 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs.check @@ -0,0 +1 @@ +(1,2,3,4,5) diff --git a/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs.flags b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala new file mode 100644 index 000000000..18af84583 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(xs: c.Expr[Int]*) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala new file mode 100644 index 000000000..f50a5d742 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala @@ -0,0 +1,7 @@ +object Macros { + def foo(xs: Int*): Unit = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + Macros.foo(1, 2, 3, 4, 5) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs.check b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs.check new file mode 100644 index 000000000..2c174a8a9 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs.check @@ -0,0 +1 @@ +WrappedArray(1, 2, 3, 4, 5) diff --git a/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs.flags b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala new file mode 100644 index 000000000..64ab7de02 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def myprintln(xs: Int*) = { + println(xs) + } + + def foo(c: Context)(xs: c.Expr[Int]*) = { + import c.universe._ + val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala new file mode 100644 index 000000000..f50a5d742 --- /dev/null +++ b/tests/disabled/macro/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala @@ -0,0 +1,7 @@ +object Macros { + def foo(xs: Int*): Unit = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + Macros.foo(1, 2, 3, 4, 5) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-default-params.check b/tests/disabled/macro/run/macro-impl-default-params.check new file mode 100644 index 000000000..b32e34570 --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-impl-default-params.flags b/tests/disabled/macro/run/macro-impl-default-params.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-default-params.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-default-params/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-impl-default-params/Impls_Macros_1.scala new file mode 100644 index 000000000..9b1d0eed3 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-default-params/Impls_Macros_1.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo_targs[T, U: c.WeakTypeTag](c: Context = null)(x: c.Expr[Int] = null) = { + import c.{prefix => prefix} + import c.universe._ + val U = implicitly[c.WeakTypeTag[U]] + c.Expr[Unit](q""" + println("invoking foo_targs...") + println("type of prefix is: " + ${prefix.staticType.toString}) + println("type of prefix tree is: " + ${prefix.tree.tpe.toString}) + println("U is: " + ${U.tpe.toString}) + """) + } +} + +class Macros[T] { + def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U] +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-default-params/Test_2.scala b/tests/disabled/macro/run/macro-impl-default-params/Test_2.scala new file mode 100644 index 000000000..476c881f8 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-default-params/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println("foo_targs:") + new Macros[Int]().foo_targs[String](42) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-relaxed.check b/tests/disabled/macro/run/macro-impl-relaxed.check new file mode 100644 index 000000000..487b11653 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-relaxed.check @@ -0,0 +1,4 @@ +2 +2 +2 +2 diff --git a/tests/disabled/macro/run/macro-impl-relaxed/Macros_1.scala b/tests/disabled/macro/run/macro-impl-relaxed/Macros_1.scala new file mode 100644 index 000000000..420eb2a39 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-relaxed/Macros_1.scala @@ -0,0 +1,14 @@ +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def implUU(c: Context)(x: c.Tree): c.Tree = x + def implTU(c: Context)(x: c.Expr[Int]): c.Tree = x.tree + def implUT(c: Context)(x: c.Tree): c.Expr[Int] = c.Expr[Int](x) + def implTT(c: Context)(x: c.Expr[Int]): c.Expr[Int] = x + + def fooUU(x: Int): Int = macro implUU + def fooTU(x: Int): Int = macro implTU + def fooUT(x: Int): Int = macro implUT + def fooTT(x: Int): Int = macro implTT +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-relaxed/Test_2.scala b/tests/disabled/macro/run/macro-impl-relaxed/Test_2.scala new file mode 100644 index 000000000..460626272 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-relaxed/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.fooUU(2)) + println(Macros.fooTU(2)) + println(Macros.fooUT(2)) + println(Macros.fooTT(2)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-rename-context.check b/tests/disabled/macro/run/macro-impl-rename-context.check new file mode 100644 index 000000000..6a34e5fd8 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-rename-context.check @@ -0,0 +1,2 @@ +foo +invoking foo... diff --git a/tests/disabled/macro/run/macro-impl-rename-context.flags b/tests/disabled/macro/run/macro-impl-rename-context.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-rename-context.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-rename-context/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-impl-rename-context/Impls_Macros_1.scala new file mode 100644 index 000000000..acc47fcde --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-rename-context/Impls_Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(unconventionalName: Context)(x: unconventionalName.Expr[Int]) = { + import unconventionalName.universe._ + unconventionalName.Expr[Unit](q"""println("invoking foo...")""") + } +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/tests/disabled/macro/run/macro-impl-rename-context/Test_2.scala b/tests/disabled/macro/run/macro-impl-rename-context/Test_2.scala new file mode 100644 index 000000000..6b1cdecd0 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-rename-context/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println("foo") + Macros.foo(42) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-tparam-only-in-impl.check b/tests/disabled/macro/run/macro-impl-tparam-only-in-impl.check new file mode 100644 index 000000000..3b18e512d --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-tparam-only-in-impl.check @@ -0,0 +1 @@ +hello world diff --git a/tests/disabled/macro/run/macro-impl-tparam-only-in-impl.flags b/tests/disabled/macro/run/macro-impl-tparam-only-in-impl.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-tparam-only-in-impl.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-tparam-only-in-impl/Impls_1.scala b/tests/disabled/macro/run/macro-impl-tparam-only-in-impl/Impls_1.scala new file mode 100644 index 000000000..705defb18 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-tparam-only-in-impl/Impls_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo[U <: String](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } +} diff --git a/tests/disabled/macro/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala b/tests/disabled/macro/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala new file mode 100644 index 000000000..b626ce35e --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Macros { + def foo: Unit = macro Impls.foo[String] +} + +object Test extends dotty.runtime.LegacyApp { + import Macros._ + foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional.check b/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional.check new file mode 100644 index 000000000..b4a0f394c --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional.check @@ -0,0 +1 @@ +don't know U diff --git a/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional.flags b/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala b/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala new file mode 100644 index 000000000..fc72e7a97 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo[U](c: Context) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("don't know U")))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala b/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala new file mode 100644 index 000000000..14154ee03 --- /dev/null +++ b/tests/disabled/macro/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + def foo[U]: Unit = macro Impls.foo[U] + foo[Int] +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype.check b/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype.check new file mode 100644 index 000000000..1d531f6d8 --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype.flags b/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala new file mode 100644 index 000000000..603500b59 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context): c.Expr[Int] = { + import c.universe._ + c.Expr(Literal(Constant("42"))) + } +} + +object Macros { + def foo: Int = macro Impls.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala b/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala new file mode 100644 index 000000000..dea6e6d62 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Select(Ident(TermName("Macros")), TermName("foo")) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidret-nontypeable.check b/tests/disabled/macro/run/macro-invalidret-nontypeable.check new file mode 100644 index 000000000..25cef2c78 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidret-nontypeable.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +not found: value IDoNotExist diff --git a/tests/disabled/macro/run/macro-invalidret-nontypeable.flags b/tests/disabled/macro/run/macro-invalidret-nontypeable.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidret-nontypeable.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidret-nontypeable/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-invalidret-nontypeable/Impls_Macros_1.scala new file mode 100644 index 000000000..b6b961174 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidret-nontypeable/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.universe._ + val body = Ident(TermName("IDoNotExist")) + c.Expr[Int](body) + } +} + +object Macros { + def foo = macro Impls.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidret-nontypeable/Test_2.scala b/tests/disabled/macro/run/macro-invalidret-nontypeable/Test_2.scala new file mode 100644 index 000000000..26de1d9de --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidret-nontypeable/Test_2.scala @@ -0,0 +1,8 @@ + object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Select(Ident(TermName("Macros")), TermName("foo")) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidusage-badret.check b/tests/disabled/macro/run/macro-invalidusage-badret.check new file mode 100644 index 000000000..e79550043 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-badret.check @@ -0,0 +1,5 @@ +reflective compilation has failed: + +type mismatch; + found : Int + required: String diff --git a/tests/disabled/macro/run/macro-invalidusage-badret.flags b/tests/disabled/macro/run/macro-invalidusage-badret.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-badret.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidusage-badret/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-invalidusage-badret/Impls_Macros_1.scala new file mode 100644 index 000000000..0d4c5755f --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-badret/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int]) = x +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/tests/disabled/macro/run/macro-invalidusage-badret/Test_2.scala b/tests/disabled/macro/run/macro-invalidusage-badret/Test_2.scala new file mode 100644 index 000000000..1d208aeb1 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-badret/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Typed(Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))), Ident(TypeName("String"))) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams.check b/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams.check new file mode 100644 index 000000000..6cbcb9e5a --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +too few argument lists for macro invocation diff --git a/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams.flags b/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala new file mode 100644 index 000000000..8b5c59bde --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo[T: c.WeakTypeTag](c: Context)(x: c.Expr[T]) = { + import c.universe._ + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(x.tree.toString)))) + c.Expr[Unit](body) + } +} + +object Macros { + def foo[T](x: T) = macro Impls.foo[T] +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala b/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala new file mode 100644 index 000000000..ba763eda5 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Select(Ident(TermName("Macros")), TermName("foo")) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/tests/disabled/macro/run/macro-invalidusage-partialapplication.check b/tests/disabled/macro/run/macro-invalidusage-partialapplication.check new file mode 100644 index 000000000..6cbcb9e5a --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-partialapplication.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +too few argument lists for macro invocation diff --git a/tests/disabled/macro/run/macro-invalidusage-partialapplication.flags b/tests/disabled/macro/run/macro-invalidusage-partialapplication.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-partialapplication.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala new file mode 100644 index 000000000..6970b4dd7 --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = { + import c.universe._ + val sum = Apply(Select(x.tree, TermName("$plus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum)) + c.Expr[Unit](body) + } +} + +object Macros { + def foo(x: Int)(y: Int) = macro Impls.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-invalidusage-partialapplication/Test_2.scala b/tests/disabled/macro/run/macro-invalidusage-partialapplication/Test_2.scala new file mode 100644 index 000000000..a0b90ee6b --- /dev/null +++ b/tests/disabled/macro/run/macro-invalidusage-partialapplication/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(40)))) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/tests/disabled/macro/run/macro-openmacros.check b/tests/disabled/macro/run/macro-openmacros.check new file mode 100644 index 000000000..ba0ae3ff4 --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-openmacros.flags b/tests/disabled/macro/run/macro-openmacros.flags new file mode 100644 index 000000000..2433c055a --- /dev/null +++ b/tests/disabled/macro/run/macro-openmacros.flags @@ -0,0 +1,2 @@ +-Yrangepos:false +-language:experimental.macros diff --git a/tests/disabled/macro/run/macro-openmacros/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-openmacros/Impls_Macros_1.scala new file mode 100644 index 000000000..b60ca90d9 --- /dev/null +++ b/tests/disabled/macro/run/macro-openmacros/Impls_Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.macros.blackbox.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 dir = c.enclosingUnit.source.file.file.getCanonicalFile.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.universe._ + val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), TermName("foo"))) else c.Expr[Unit](Literal(Constant(()))) + c.universe.reify { + println(c.Expr[String](Literal(Constant(normalizePaths(c.enclosingMacros.toString)))).splice) + next.splice + } + } + + def foo = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-openmacros/Test_2.scala b/tests/disabled/macro/run/macro-openmacros/Test_2.scala new file mode 100644 index 000000000..d75fbd0db --- /dev/null +++ b/tests/disabled/macro/run/macro-openmacros/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} diff --git a/tests/disabled/macro/run/macro-parse-position-malformed.check b/tests/disabled/macro/run/macro-parse-position-malformed.check new file mode 100644 index 000000000..00f0bc5b6 --- /dev/null +++ b/tests/disabled/macro/run/macro-parse-position-malformed.check @@ -0,0 +1 @@ +failed with 'source-,line-1,offset=7' position and '')' expected but eof found.' message diff --git a/tests/disabled/macro/run/macro-parse-position-malformed/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-parse-position-malformed/Impls_Macros_1.scala new file mode 100644 index 000000000..b623d8820 --- /dev/null +++ b/tests/disabled/macro/run/macro-parse-position-malformed/Impls_Macros_1.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context +import scala.reflect.macros.ParseException + +object Macros { + def impl(c: Context)() = { + import c.universe._ + val out = try { + c.parse("foo(bar") + "didn't fail" + } catch { + case e: ParseException => + s"failed with '${e.pos}' position and '${e.msg}' message" + } + c.Expr[String](Literal(Constant(out))) + } + def foo(): String = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-parse-position-malformed/Test_2.scala b/tests/disabled/macro/run/macro-parse-position-malformed/Test_2.scala new file mode 100644 index 000000000..1b04d2af2 --- /dev/null +++ b/tests/disabled/macro/run/macro-parse-position-malformed/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo) +} diff --git a/tests/disabled/macro/run/macro-parse-position.check b/tests/disabled/macro/run/macro-parse-position.check new file mode 100644 index 000000000..3da032069 --- /dev/null +++ b/tests/disabled/macro/run/macro-parse-position.check @@ -0,0 +1,5 @@ +false +source-,line-1,offset=4 +8 +foo bar + diff --git a/tests/disabled/macro/run/macro-parse-position.flags b/tests/disabled/macro/run/macro-parse-position.flags new file mode 100644 index 000000000..ea7fc37e1 --- /dev/null +++ b/tests/disabled/macro/run/macro-parse-position.flags @@ -0,0 +1 @@ +-Yrangepos:false diff --git a/tests/disabled/macro/run/macro-parse-position/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-parse-position/Impls_Macros_1.scala new file mode 100644 index 000000000..dd20fd291 --- /dev/null +++ b/tests/disabled/macro/run/macro-parse-position/Impls_Macros_1.scala @@ -0,0 +1,12 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context)() = { + import c.universe._ + val t = c.parse("foo bar") + val out = s"${t.pos == NoPosition}\n${t.pos}\n${t.pos.source.content.length}\n${new String(t.pos.source.content)}" + c.Expr[String](Literal(Constant(out))) + } + def foo(): String = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-parse-position/Test_2.scala b/tests/disabled/macro/run/macro-parse-position/Test_2.scala new file mode 100644 index 000000000..1b04d2af2 --- /dev/null +++ b/tests/disabled/macro/run/macro-parse-position/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo) +} diff --git a/tests/disabled/macro/run/macro-quasiinvalidbody-c.check b/tests/disabled/macro/run/macro-quasiinvalidbody-c.check new file mode 100644 index 000000000..f70d7bba4 --- /dev/null +++ b/tests/disabled/macro/run/macro-quasiinvalidbody-c.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-quasiinvalidbody-c.flags b/tests/disabled/macro/run/macro-quasiinvalidbody-c.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-quasiinvalidbody-c.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala new file mode 100644 index 000000000..df189b70d --- /dev/null +++ b/tests/disabled/macro/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + object Impls { + def foo(c: Context)(x: c.Expr[Any]) = x + } + + def foo(x: Any) = macro Impls.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-quasiinvalidbody-c/Test_2.scala b/tests/disabled/macro/run/macro-quasiinvalidbody-c/Test_2.scala new file mode 100644 index 000000000..91053843d --- /dev/null +++ b/tests/disabled/macro/run/macro-quasiinvalidbody-c/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + import Macros._ + println(foo(42)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-quasiquotes.check b/tests/disabled/macro/run/macro-quasiquotes.check new file mode 100644 index 000000000..94ebaf900 --- /dev/null +++ b/tests/disabled/macro/run/macro-quasiquotes.check @@ -0,0 +1,4 @@ +1 +2 +3 +4 diff --git a/tests/disabled/macro/run/macro-quasiquotes/Macros_1.scala b/tests/disabled/macro/run/macro-quasiquotes/Macros_1.scala new file mode 100644 index 000000000..764542a87 --- /dev/null +++ b/tests/disabled/macro/run/macro-quasiquotes/Macros_1.scala @@ -0,0 +1,15 @@ +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +class Impls(val c: Context) { + import c.universe._ + def impl1 = q"println(1)" + def impl2 = q"{ println(2); println(3) }" + def impl3 = q"4" +} + +object Macros { + def m1: Unit = macro Impls.impl1 + def m2: Unit = macro Impls.impl2 + def m3: Int = macro Impls.impl3 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-quasiquotes/Test_2.scala b/tests/disabled/macro/run/macro-quasiquotes/Test_2.scala new file mode 100644 index 000000000..b7d203197 --- /dev/null +++ b/tests/disabled/macro/run/macro-quasiquotes/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.m1 + Macros.m2 + println(Macros.m3) +} diff --git a/tests/disabled/macro/run/macro-range.check b/tests/disabled/macro/run/macro-range.check new file mode 100644 index 000000000..071939893 --- /dev/null +++ b/tests/disabled/macro/run/macro-range.check @@ -0,0 +1,9 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/tests/disabled/macro/run/macro-range.flags b/tests/disabled/macro/run/macro-range.flags new file mode 100644 index 000000000..5e5dd6ce7 --- /dev/null +++ b/tests/disabled/macro/run/macro-range.flags @@ -0,0 +1 @@ +-language:experimental.macros diff --git a/tests/disabled/macro/run/macro-range/Common_1.scala b/tests/disabled/macro/run/macro-range/Common_1.scala new file mode 100644 index 000000000..35d2efd76 --- /dev/null +++ b/tests/disabled/macro/run/macro-range/Common_1.scala @@ -0,0 +1,48 @@ +import scala.reflect.macros.blackbox.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.universe._ + import internal._ + + 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) setType(tree1, 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, TermName(op)), List(right)) +} diff --git a/tests/disabled/macro/run/macro-range/Expansion_Impossible_2.scala b/tests/disabled/macro/run/macro-range/Expansion_Impossible_2.scala new file mode 100644 index 000000000..b3c2fa348 --- /dev/null +++ b/tests/disabled/macro/run/macro-range/Expansion_Impossible_2.scala @@ -0,0 +1,53 @@ +import scala.reflect.macros.blackbox.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.universe._ + import Flag._ + + val initName = termNames.CONSTRUCTOR + // Either: + // scala"{ var i = $low; val h = $hi; while (i < h) { $f(i); i = i + 1 } } + // or: + // scala"($_this: RangeDefault).foreach($f)" + c.Expr(c.prefix.tree match { + case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" => + val iname = TermName("$i") + val hname = TermName("$h") + def iref = Ident(iname) + def href = Ident(hname) + val labelname = TermName("$while") + val cond = makeBinop(iref, "$less", href) + val body = Block( + List(makeApply(f.tree, List(iref))), + Assign(iref, makeBinop(iref, "$plus", Literal(Constant(1))))) + val generated = + Block( + List( + ValDef(Modifiers(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.tree, Ident(TypeName("RangeDefault"))), + TermName("foreach")), + List(f.tree)) + }) + } +} + +class Range(val from: Int, val to: Int) extends RangeDefault { + override def foreach(f: Int => Unit): Unit = macro Impls.foreach +} + +object Test extends dotty.runtime.LegacyApp { + new Range(1, 10) foreach println +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-range/Expansion_Possible_3.scala b/tests/disabled/macro/run/macro-range/Expansion_Possible_3.scala new file mode 100644 index 000000000..b1fbba765 --- /dev/null +++ b/tests/disabled/macro/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 dotty.runtime.LegacyApp { + new Range(1, 10) foreach println +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-rangepos-args.check b/tests/disabled/macro/run/macro-rangepos-args.check new file mode 100644 index 000000000..d779505c6 --- /dev/null +++ b/tests/disabled/macro/run/macro-rangepos-args.check @@ -0,0 +1 @@ +Line: 3. Width: 5. diff --git a/tests/disabled/macro/run/macro-rangepos-args.flags b/tests/disabled/macro/run/macro-rangepos-args.flags new file mode 100644 index 000000000..fcf951d90 --- /dev/null +++ b/tests/disabled/macro/run/macro-rangepos-args.flags @@ -0,0 +1 @@ +-Yrangepos \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-rangepos-args/Macros_1.scala b/tests/disabled/macro/run/macro-rangepos-args/Macros_1.scala new file mode 100644 index 000000000..97b938613 --- /dev/null +++ b/tests/disabled/macro/run/macro-rangepos-args/Macros_1.scala @@ -0,0 +1,10 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context)(x: c.Tree): c.Tree = { + import c.universe._ + Literal(Constant(s"Line: ${x.pos.line}. Width: ${x.pos.end - x.pos.start}.")) + } + def pos(x: Any): String = macro impl +} diff --git a/tests/disabled/macro/run/macro-rangepos-args/Test_2.scala b/tests/disabled/macro/run/macro-rangepos-args/Test_2.scala new file mode 100644 index 000000000..936b945c7 --- /dev/null +++ b/tests/disabled/macro/run/macro-rangepos-args/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + val x = 2 + println(Macros.pos(x + 2)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-rangepos-subpatterns.check b/tests/disabled/macro/run/macro-rangepos-subpatterns.check new file mode 100644 index 000000000..760e15d01 --- /dev/null +++ b/tests/disabled/macro/run/macro-rangepos-subpatterns.check @@ -0,0 +1 @@ +The width of the subpattern is: 2 diff --git a/tests/disabled/macro/run/macro-rangepos-subpatterns.flags b/tests/disabled/macro/run/macro-rangepos-subpatterns.flags new file mode 100644 index 000000000..fcf951d90 --- /dev/null +++ b/tests/disabled/macro/run/macro-rangepos-subpatterns.flags @@ -0,0 +1 @@ +-Yrangepos \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-rangepos-subpatterns/Macros_1.scala b/tests/disabled/macro/run/macro-rangepos-subpatterns/Macros_1.scala new file mode 100644 index 000000000..0f3086234 --- /dev/null +++ b/tests/disabled/macro/run/macro-rangepos-subpatterns/Macros_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +object Extractor { + def unapply(x: Any): Any = macro unapplyImpl + def unapplyImpl(c: Context)(x: c.Tree) = { + import c.universe._ + import internal._ + val pos = subpatterns(x).get.head.pos + q""" + new { + def isEmpty = false + def get = ${"The width of the subpattern is: " + (pos.end - pos.start + 1)} + def unapply(x: Any) = this + }.unapply($x) + """ + } +} diff --git a/tests/disabled/macro/run/macro-rangepos-subpatterns/Test_2.scala b/tests/disabled/macro/run/macro-rangepos-subpatterns/Test_2.scala new file mode 100644 index 000000000..b9b308cea --- /dev/null +++ b/tests/disabled/macro/run/macro-rangepos-subpatterns/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + 42 match { + case Extractor(a) => println(a) + } +} diff --git a/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi.check b/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi.check new file mode 100644 index 000000000..ac4213d6e --- /dev/null +++ b/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi.check @@ -0,0 +1 @@ +43 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi.flags b/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala new file mode 100644 index 000000000..e964da210 --- /dev/null +++ b/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) + c.Expr[Int](body) + } +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi/Test_2.scala b/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi/Test_2.scala new file mode 100644 index 000000000..b8d969b83 --- /dev/null +++ b/tests/disabled/macro/run/macro-reflective-ma-normal-mdmi/Test_2.scala @@ -0,0 +1,7 @@ +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) + println(cm.mkToolBox().eval(tree)) +} diff --git a/tests/disabled/macro/run/macro-reflective-mamd-normal-mi.check b/tests/disabled/macro/run/macro-reflective-mamd-normal-mi.check new file mode 100644 index 000000000..920a13966 --- /dev/null +++ b/tests/disabled/macro/run/macro-reflective-mamd-normal-mi.check @@ -0,0 +1 @@ +43 diff --git a/tests/disabled/macro/run/macro-reflective-mamd-normal-mi/Impls_1.scala b/tests/disabled/macro/run/macro-reflective-mamd-normal-mi/Impls_1.scala new file mode 100644 index 000000000..e62db783b --- /dev/null +++ b/tests/disabled/macro/run/macro-reflective-mamd-normal-mi/Impls_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) + c.Expr[Int](body) + } +} diff --git a/tests/disabled/macro/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/tests/disabled/macro/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala new file mode 100644 index 000000000..0b867e787 --- /dev/null +++ b/tests/disabled/macro/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala @@ -0,0 +1,20 @@ +//object Macros { +// def foo(x: Int) = macro Impls.foo +//} + +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.universe.Flag._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + + val macrobody = Select(Ident(TermName("Impls")), TermName("foo")) + val macroparam = ValDef(NoMods, TermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree) + val macrodef = DefDef(Modifiers(MACRO), TermName("foo"), Nil, List(List(macroparam)), Ident(TypeName("Int")), macrobody) + val modulector = DefDef(NoMods, termNames.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))) + val module = ModuleDef(NoMods, TermName("Macros"), Template(Nil, noSelfType, List(modulector, macrodef))) + val macroapp = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) + val tree = Block(List(macrodef, module), macroapp) + val toolbox = cm.mkToolBox(options = "-language:experimental.macros") + println(toolbox.eval(tree)) +} diff --git a/tests/disabled/macro/run/macro-reify-basic.check b/tests/disabled/macro/run/macro-reify-basic.check new file mode 100644 index 000000000..3b18e512d --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-basic.check @@ -0,0 +1 @@ +hello world diff --git a/tests/disabled/macro/run/macro-reify-basic.flags b/tests/disabled/macro/run/macro-reify-basic.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-basic.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-basic/Macros_1.scala b/tests/disabled/macro/run/macro-reify-basic/Macros_1.scala new file mode 100644 index 000000000..1cf2a8a40 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-basic/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def foo(s: String) = macro Impls.foo + + object Impls { + def foo(c: Context)(s: c.Expr[String]) = c.universe.reify { + println("hello " + s.splice) + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-basic/Test_2.scala b/tests/disabled/macro/run/macro-reify-basic/Test_2.scala new file mode 100644 index 000000000..26b2c7d9f --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-basic/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo("world") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala new file mode 100644 index 000000000..7f877b272 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-chained1/Impls_Macros_1.scala @@ -0,0 +1,47 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.macros.blackbox.Context +import scala.language.experimental.macros + +case class Utils[C <: Context]( c:C ) { + import c.universe._ + import c.{Tree=>_} + object removeDoubleReify extends c.universe.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + import internal._ + val element_type = implicitly[c.WeakTypeTag[S]].tpe + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.universe.reify{ Queryable.factory[S]( foo.splice )} + } + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] + (c: Context) + (projection: c.Expr[T => S]): c.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:ru.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-chained1/Test_2.scala b/tests/disabled/macro/run/macro-reify-chained1/Test_2.scala new file mode 100644 index 000000000..01a021893 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-chained1/Test_2.scala @@ -0,0 +1,9 @@ +object Test extends dotty.runtime.LegacyApp{ + val q : Queryable[Any] = new Queryable[Any] + q.map(x => x).map(x => x) + + locally { + val q : Queryable[Any] = new Queryable[Any] + q.map(x => x).map(x => x) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-chained2/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-chained2/Impls_Macros_1.scala new file mode 100644 index 000000000..965b19104 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-chained2/Impls_Macros_1.scala @@ -0,0 +1,47 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +case class Utils[C <: Context]( c:C ) { + import c.universe._ + import c.{Tree=>_} + object removeDoubleReify extends c.universe.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + import internal._ + val element_type = implicitly[c.WeakTypeTag[S]].tpe + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.universe.reify{ Queryable.factory[S]( foo.splice )} + } + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] + (c: Context) + (projection: c.Expr[T => S]): c.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:ru.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-chained2/Test_2.scala b/tests/disabled/macro/run/macro-reify-chained2/Test_2.scala new file mode 100644 index 000000000..01a021893 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-chained2/Test_2.scala @@ -0,0 +1,9 @@ +object Test extends dotty.runtime.LegacyApp{ + val q : Queryable[Any] = new Queryable[Any] + q.map(x => x).map(x => x) + + locally { + val q : Queryable[Any] = new Queryable[Any] + q.map(x => x).map(x => x) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-freevars.check b/tests/disabled/macro/run/macro-reify-freevars.check new file mode 100644 index 000000000..f618e307b --- /dev/null +++ b/tests/disabled/macro/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:9:9. Have you forgotten to use splice when splicing this variable into a reifee? If you have troubles tracking free term variables, consider using -Xlog-free-terms diff --git a/tests/disabled/macro/run/macro-reify-freevars.flags b/tests/disabled/macro/run/macro-reify-freevars.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-freevars.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-freevars/Macros_1.scala b/tests/disabled/macro/run/macro-reify-freevars/Macros_1.scala new file mode 100644 index 000000000..912f602c6 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-freevars/Macros_1.scala @@ -0,0 +1,20 @@ +package scala.collection.slick + +object QueryableMacros{ + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] + (c: scala.reflect.macros.blackbox.Context) + (projection: c.Expr[T => S]) + : c.Expr[scala.collection.slick.Queryable[S]] = { + import c.universe._ + val code = EmptyTree + c.universe.reify{ + Queryable.factory[S]( code.asInstanceOf[reflect.runtime.universe.Tree] ) + } + } +} +class Queryable[T]{ + def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] +} +object Queryable{ + def factory[S]( projection:reflect.runtime.universe.Tree ) : Queryable[S] = null +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-freevars/Test_2.scala b/tests/disabled/macro/run/macro-reify-freevars/Test_2.scala new file mode 100644 index 000000000..11c8128cd --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-freevars/Test_2.scala @@ -0,0 +1,11 @@ +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val q = New(AppliedTypeTree(Select(Select(Select(Ident(TermName("scala")), TermName("collection")), TermName("slick")), TypeName("Queryable")), List(Ident(TermName("Int"))))) + val x = ValDef(NoMods, TermName("x"), Ident(TermName("Int")), EmptyTree) + val fn = Function(List(x), Apply(Select(Ident(TermName("x")), TermName("$plus")), List(Literal(Constant("5"))))) + val tree = Apply(Select(q, TermName("map")), List(fn)) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-nested-a1/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-nested-a1/Impls_Macros_1.scala new file mode 100644 index 000000000..7f877b272 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-nested-a1/Impls_Macros_1.scala @@ -0,0 +1,47 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.macros.blackbox.Context +import scala.language.experimental.macros + +case class Utils[C <: Context]( c:C ) { + import c.universe._ + import c.{Tree=>_} + object removeDoubleReify extends c.universe.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + import internal._ + val element_type = implicitly[c.WeakTypeTag[S]].tpe + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.universe.reify{ Queryable.factory[S]( foo.splice )} + } + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] + (c: Context) + (projection: c.Expr[T => S]): c.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:ru.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-nested-a1/Test_2.scala b/tests/disabled/macro/run/macro-reify-nested-a1/Test_2.scala new file mode 100644 index 000000000..37282cad7 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-nested-a1/Test_2.scala @@ -0,0 +1,9 @@ +object Test extends dotty.runtime.LegacyApp{ + val q : Queryable[Any] = new Queryable[Any] + q.map(e1 => q.map(e2=>e1)) + + locally { + val q : Queryable[Any] = new Queryable[Any] + q.map(e1 => q.map(e2=>e1)) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-nested-a2/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-nested-a2/Impls_Macros_1.scala new file mode 100644 index 000000000..965b19104 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-nested-a2/Impls_Macros_1.scala @@ -0,0 +1,47 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +case class Utils[C <: Context]( c:C ) { + import c.universe._ + import c.{Tree=>_} + object removeDoubleReify extends c.universe.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + import internal._ + val element_type = implicitly[c.WeakTypeTag[S]].tpe + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.universe.reify{ Queryable.factory[S]( foo.splice )} + } + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] + (c: Context) + (projection: c.Expr[T => S]): c.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:ru.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-nested-a2/Test_2.scala b/tests/disabled/macro/run/macro-reify-nested-a2/Test_2.scala new file mode 100644 index 000000000..37282cad7 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-nested-a2/Test_2.scala @@ -0,0 +1,9 @@ +object Test extends dotty.runtime.LegacyApp{ + val q : Queryable[Any] = new Queryable[Any] + q.map(e1 => q.map(e2=>e1)) + + locally { + val q : Queryable[Any] = new Queryable[Any] + q.map(e1 => q.map(e2=>e1)) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-nested-b1/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-nested-b1/Impls_Macros_1.scala new file mode 100644 index 000000000..7f877b272 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-nested-b1/Impls_Macros_1.scala @@ -0,0 +1,47 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.macros.blackbox.Context +import scala.language.experimental.macros + +case class Utils[C <: Context]( c:C ) { + import c.universe._ + import c.{Tree=>_} + object removeDoubleReify extends c.universe.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + import internal._ + val element_type = implicitly[c.WeakTypeTag[S]].tpe + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.universe.reify{ Queryable.factory[S]( foo.splice )} + } + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] + (c: Context) + (projection: c.Expr[T => S]): c.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:ru.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-nested-b1/Test_2.scala b/tests/disabled/macro/run/macro-reify-nested-b1/Test_2.scala new file mode 100644 index 000000000..b9d6846dc --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-nested-b1/Test_2.scala @@ -0,0 +1,9 @@ +object Test extends dotty.runtime.LegacyApp{ + val q : Queryable[Any] = new Queryable[Any] + q.map(e1 => q.map(e2=>e1).map(e2=>e1)) + + locally { + 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/tests/disabled/macro/run/macro-reify-nested-b2/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-nested-b2/Impls_Macros_1.scala new file mode 100644 index 000000000..965b19104 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-nested-b2/Impls_Macros_1.scala @@ -0,0 +1,47 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +case class Utils[C <: Context]( c:C ) { + import c.universe._ + import c.{Tree=>_} + object removeDoubleReify extends c.universe.Transformer { + def apply( tree:Tree ) = transform(tree) + override def transform(tree: Tree): Tree = { + super.transform { + tree match { + case Apply(TypeApply(Select(_this, termname), _), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case Apply(Select(_this, termname), reification::Nil ) + if termname.toString == "factory" => c.unreifyTree(reification) + case _ => tree + } + } + } + } +} +object QueryableMacros{ + def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + import internal._ + val element_type = implicitly[c.WeakTypeTag[S]].tpe + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck( + Utils[c.type](c).removeDoubleReify( + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) + ).asInstanceOf[Tree] + ))) + c.universe.reify{ Queryable.factory[S]( foo.splice )} + } + def map[T:c.WeakTypeTag, S:c.WeakTypeTag] + (c: Context) + (projection: c.Expr[T => S]): c.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:ru.Expr[Queryable[S]] ) : Queryable[S] = null +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-nested-b2/Test_2.scala b/tests/disabled/macro/run/macro-reify-nested-b2/Test_2.scala new file mode 100644 index 000000000..b9d6846dc --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-nested-b2/Test_2.scala @@ -0,0 +1,9 @@ +object Test extends dotty.runtime.LegacyApp{ + val q : Queryable[Any] = new Queryable[Any] + q.map(e1 => q.map(e2=>e1).map(e2=>e1)) + + locally { + 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/tests/disabled/macro/run/macro-reify-ref-to-packageless.check b/tests/disabled/macro/run/macro-reify-ref-to-packageless.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-ref-to-packageless.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/macro-reify-ref-to-packageless.flags b/tests/disabled/macro/run/macro-reify-ref-to-packageless.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-ref-to-packageless.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-ref-to-packageless/Impls_1.scala b/tests/disabled/macro/run/macro-reify-ref-to-packageless/Impls_1.scala new file mode 100644 index 000000000..38ec6f022 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-ref-to-packageless/Impls_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + val `Answer to the Ultimate Question of Life, the Universe, and Everything` = 42 + def foo(c: Context) = c.universe.reify { `Answer to the Ultimate Question of Life, the Universe, and Everything` } +} diff --git a/tests/disabled/macro/run/macro-reify-ref-to-packageless/Test_2.scala b/tests/disabled/macro/run/macro-reify-ref-to-packageless/Test_2.scala new file mode 100644 index 000000000..ff5b60a6a --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-ref-to-packageless/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + def foo: Int = macro Impls.foo + println(foo) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-splice-outside-reify.check b/tests/disabled/macro/run/macro-reify-splice-outside-reify.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-splice-outside-reify.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/macro-reify-splice-outside-reify.flags b/tests/disabled/macro/run/macro-reify-splice-outside-reify.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-splice-outside-reify.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala new file mode 100644 index 000000000..f038d8714 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context)(x: c.Expr[Int]) = { + import c.universe._ + val x1 = c.Expr[Int](c.untypecheck(x.tree)) + c.Expr[Int](Literal(Constant(c.eval(x1)))) + } +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/tests/disabled/macro/run/macro-reify-splice-outside-reify/Test_2.scala b/tests/disabled/macro/run/macro-reify-splice-outside-reify/Test_2.scala new file mode 100644 index 000000000..f99d40dad --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-splice-outside-reify/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) + try println(cm.mkToolBox().eval(tree)) + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/tests/disabled/macro/run/macro-reify-staticXXX.check b/tests/disabled/macro/run/macro-reify-staticXXX.check new file mode 100644 index 000000000..2894fa584 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-staticXXX.check @@ -0,0 +1,12 @@ +object +class +object > object +object > class +package > object +package > class +object +class +object > object +object > class +package > object +package > class \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-staticXXX.flags b/tests/disabled/macro/run/macro-reify-staticXXX.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-staticXXX.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-staticXXX/Macros_1.scala b/tests/disabled/macro/run/macro-reify-staticXXX/Macros_1.scala new file mode 100644 index 000000000..2993218bb --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-staticXXX/Macros_1.scala @@ -0,0 +1,48 @@ +import scala.reflect.macros.blackbox.Context + +object B { override def toString = "object" } +class C { override def toString = "class" } + +package foo { + object B { override def toString = "package > object" } + class C { override def toString = "package > class" } +} + +object foo { + object B { override def toString = "object > object" } + class C { override def toString = "object > class" } +} + +object packageless { + def impl(c: Context) = { + import c.universe._ + reify { + println(B) + println(new C) + println(foo.B) + println(new foo.C) + println(_root_.foo.B) + println(new _root_.foo.C) + } + } + + def test = macro impl +} + +package packageful { + object Test { + def impl(c: Context) = { + import c.universe._ + reify { + println(B) + println(new C) + println(foo.B) + println(new foo.C) + println(_root_.foo.B) + println(new _root_.foo.C) + } + } + + def test = macro impl + } +} diff --git a/tests/disabled/macro/run/macro-reify-staticXXX/Test_2.scala b/tests/disabled/macro/run/macro-reify-staticXXX/Test_2.scala new file mode 100644 index 000000000..4c02e26f6 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-staticXXX/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + packageless.test + packageful.Test.test +} diff --git a/tests/disabled/macro/run/macro-reify-tagful-a.check b/tests/disabled/macro/run/macro-reify-tagful-a.check new file mode 100644 index 000000000..3f4c71999 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-tagful-a.check @@ -0,0 +1 @@ +List(hello world) diff --git a/tests/disabled/macro/run/macro-reify-tagful-a.flags b/tests/disabled/macro/run/macro-reify-tagful-a.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-tagful-a.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-tagful-a/Macros_1.scala b/tests/disabled/macro/run/macro-reify-tagful-a/Macros_1.scala new file mode 100644 index 000000000..6f061fd26 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-tagful-a/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Macros { + def foo[T](s: T) = macro Impls.foo[T] + + object Impls { + def foo[T: c.WeakTypeTag](c: Context)(s: c.Expr[T]) = c.universe.reify { + List(s.splice) + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-tagful-a/Test_2.scala b/tests/disabled/macro/run/macro-reify-tagful-a/Test_2.scala new file mode 100644 index 000000000..5095ddcaa --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-tagful-a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + val list: List[String] = Macros.foo("hello world") + println(list) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-tagless-a.check b/tests/disabled/macro/run/macro-reify-tagless-a.check new file mode 100644 index 000000000..d160e8043 --- /dev/null +++ b/tests/disabled/macro/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 forgotten to use c.WeakTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/tests/disabled/macro/run/macro-reify-tagless-a.flags b/tests/disabled/macro/run/macro-reify-tagless-a.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-tagless-a.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-tagless-a/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-reify-tagless-a/Impls_Macros_1.scala new file mode 100644 index 000000000..faac3e3a3 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-tagless-a/Impls_Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def foo[T](s: T) = macro Impls.foo[T] + + object Impls { + def foo[T](c: Context)(s: c.Expr[T]) = c.universe.reify { + List[T](s.splice) + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-tagless-a/Test_2.scala b/tests/disabled/macro/run/macro-reify-tagless-a/Test_2.scala new file mode 100644 index 000000000..af882664d --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-tagless-a/Test_2.scala @@ -0,0 +1,14 @@ +object Test extends dotty.runtime.LegacyApp { + //val list: List[String] = Macros.foo("hello world") + //println(list) + + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass))) + val rhs = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant("hello world")))) + val list = ValDef(NoMods, TermName("list"), tpt, rhs) + val tree = Block(List(list), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Ident(list.name)))) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/tests/disabled/macro/run/macro-reify-type.check b/tests/disabled/macro/run/macro-reify-type.check new file mode 100644 index 000000000..ea5e70e10 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-type.check @@ -0,0 +1 @@ +[B, That](f: Int => B)(implicit bf: scala.collection.generic.CanBuildFrom[List[Int],B,That])That \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-type.flags b/tests/disabled/macro/run/macro-reify-type.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-type.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-type/Macros_1.scala b/tests/disabled/macro/run/macro-reify-type/Macros_1.scala new file mode 100644 index 000000000..c38cf8aa5 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-type/Macros_1.scala @@ -0,0 +1,28 @@ +import scala.reflect.macros.blackbox.Context +import scala.reflect.runtime.{universe => ru} + +object StaticReflect { + def method[A](name: String): ru.Type = macro methodImpl[A] + + def methodImpl[A: c.WeakTypeTag](c: Context)(name: c.Expr[String]): c.Expr[ru.Type] = { + import c.universe._ + import internal._ + + val nameName: TermName = name.tree match { + case Literal(Constant(str: String)) => TermName(str) + case _ => c.error(c.enclosingPosition, s"Method name not constant.") ; return reify(ru.NoType) + } + val clazz = weakTypeOf[A] + + clazz member nameName match { + case NoSymbol => c.error(c.enclosingPosition, s"No member called $nameName in $clazz.") ; reify(ru.NoType) + case member => + val mtpe = member infoIn clazz + val mtag = c.reifyType(gen.mkRuntimeUniverseRef, Select(gen.mkRuntimeUniverseRef, TermName("rootMirror")), mtpe) + val mtree = Select(mtag, TermName("tpe")) + + c.Expr[ru.Type](mtree) + } + } + +} diff --git a/tests/disabled/macro/run/macro-reify-type/Test_2.scala b/tests/disabled/macro/run/macro-reify-type/Test_2.scala new file mode 100644 index 000000000..c9e56d718 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-type/Test_2.scala @@ -0,0 +1,21 @@ +import StaticReflect._ + +object Test extends dotty.runtime.LegacyApp { + //println(method[List[Int]]("distinct")) + println(method[List[Int]]("map")) + //val $u: scala.reflect.runtime.universe.type = scala.reflect.runtime.universe; + //val $m: $u.Mirror = scala.reflect.runtime.universe.rootMirror; + //import $u._, $m._, Flag._, internal._ + //val tpe = { + // val symdef$B2 = reificationSupport.newNestedSymbol(reificationSupport.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TypeName("B"), NoPosition, DEFERRED | PARAM, false); + // val symdef$That2 = reificationSupport.newNestedSymbol(reificationSupport.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TypeName("That"), NoPosition, DEFERRED | PARAM, false); + // val symdef$f2 = reificationSupport.newNestedSymbol(reificationSupport.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TermName("f"), NoPosition, PARAM, false); + // val symdef$bf2 = reificationSupport.newNestedSymbol(reificationSupport.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TermName("bf"), NoPosition, IMPLICIT | PARAM, false); + // reificationSupport.setInfo(symdef$B2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor)); + // reificationSupport.setInfo(symdef$That2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor)); + // reificationSupport.setInfo(symdef$f2, TypeRef(ThisType(staticPackage("scala").asModule.moduleClass), staticClass("scala.Function1"), List(staticClass("scala.Int").asType.toTypeConstructor, TypeRef(NoPrefix, symdef$B2, List())))); + // reificationSupport.setInfo(symdef$bf2, TypeRef(ThisType(staticPackage("scala.collection.generic").asModule.moduleClass), staticClass("scala.collection.generic.CanBuildFrom"), List(TypeRef(ThisType(staticPackage("scala.collection.immutable").asModule.moduleClass), staticClass("scala.collection.immutable.List"), List(staticClass("scala.Int").asType.toTypeConstructor)), TypeRef(NoPrefix, symdef$B2, List()), TypeRef(NoPrefix, symdef$That2, List())))); + // PolyType(List(symdef$B2, symdef$That2), MethodType(List(symdef$f2), MethodType(List(symdef$bf2), TypeRef(NoPrefix, symdef$That2, List())))) + //} + //println(tpe) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-typetag-notypeparams.check b/tests/disabled/macro/run/macro-reify-typetag-notypeparams.check new file mode 100644 index 000000000..7732c10d7 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-typetag-notypeparams.check @@ -0,0 +1,2 @@ +TypeTag[Int] +TypeTag[List[Int]] diff --git a/tests/disabled/macro/run/macro-reify-typetag-notypeparams/Test.scala b/tests/disabled/macro/run/macro-reify-typetag-notypeparams/Test.scala new file mode 100644 index 000000000..1eff6e93f --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-typetag-notypeparams/Test.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + println(implicitly[TypeTag[Int]]) + println(implicitly[TypeTag[List[Int]]]) +} diff --git a/tests/disabled/macro/run/macro-reify-typetag-typeparams-tags.check b/tests/disabled/macro/run/macro-reify-typetag-typeparams-tags.check new file mode 100644 index 000000000..7732c10d7 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-typetag-typeparams-tags.check @@ -0,0 +1,2 @@ +TypeTag[Int] +TypeTag[List[Int]] diff --git a/tests/disabled/macro/run/macro-reify-typetag-typeparams-tags/Test.scala b/tests/disabled/macro/run/macro-reify-typetag-typeparams-tags/Test.scala new file mode 100644 index 000000000..4540bb6b3 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-typetag-typeparams-tags/Test.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + def fooTypeTag[T: TypeTag] = { + println(implicitly[TypeTag[T]]) + println(implicitly[TypeTag[List[T]]]) + } + fooTypeTag[Int] +} diff --git a/tests/disabled/macro/run/macro-reify-unreify.check b/tests/disabled/macro/run/macro-reify-unreify.check new file mode 100644 index 000000000..7a6d53c47 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-unreify.check @@ -0,0 +1 @@ +hello world = Expr[java.lang.String("hello world")]("hello world") diff --git a/tests/disabled/macro/run/macro-reify-unreify.flags b/tests/disabled/macro/run/macro-reify-unreify.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-unreify.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-unreify/Macros_1.scala b/tests/disabled/macro/run/macro-reify-unreify/Macros_1.scala new file mode 100644 index 000000000..d92dfa3e2 --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-unreify/Macros_1.scala @@ -0,0 +1,20 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def foo(s: String) = macro Impls.foo + + object Impls { + def foo(c: Context)(s: c.Expr[String]) = { + import c.universe._ + import internal._ + + val world = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, s.tree) + val greeting = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world))))) + val typedGreeting = c.Expr[String](greeting) + + c.universe.reify { + println("hello " + s.splice + " = " + typedGreeting.splice) + } + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-reify-unreify/Test_2.scala b/tests/disabled/macro/run/macro-reify-unreify/Test_2.scala new file mode 100644 index 000000000..26b2c7d9f --- /dev/null +++ b/tests/disabled/macro/run/macro-reify-unreify/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo("world") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-repl-basic.check b/tests/disabled/macro/run/macro-repl-basic.check new file mode 100644 index 000000000..fab03d155 --- /dev/null +++ b/tests/disabled/macro/run/macro-repl-basic.check @@ -0,0 +1,52 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import language.experimental.macros +import language.experimental.macros + +scala> import scala.reflect.macros.blackbox.Context +import scala.reflect.macros.blackbox.Context + +scala> + +scala> object Impls { + def foo(c: Context)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) + c.Expr[Int](body) + } + + def bar(c: Context)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) + c.Expr[Int](body) + } + + def quux(c: Context)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) + c.Expr[Int](body) + } +} +defined object Impls + +scala> 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 +} +defined object Macros +defined class Macros + +scala> + +scala> import Macros.Shmacros._ +import Macros.Shmacros._ + +scala> println(foo(2) + Macros.bar(2) * new Macros().quux(4)) +31 + +scala> :quit diff --git a/tests/disabled/macro/run/macro-repl-basic.scala b/tests/disabled/macro/run/macro-repl-basic.scala new file mode 100644 index 000000000..217f3bc0e --- /dev/null +++ b/tests/disabled/macro/run/macro-repl-basic.scala @@ -0,0 +1,39 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |import language.experimental.macros + |import scala.reflect.macros.blackbox.Context + | + |object Impls { + | def foo(c: Context)(x: c.Expr[Int]) = { + | import c.universe._ + | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) + | c.Expr[Int](body) + | } + | + | def bar(c: Context)(x: c.Expr[Int]) = { + | import c.universe._ + | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) + | c.Expr[Int](body) + | } + | + | def quux(c: Context)(x: c.Expr[Int]) = { + | import c.universe._ + | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) + | c.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 + |} + | + |import Macros.Shmacros._ + |println(foo(2) + Macros.bar(2) * new Macros().quux(4)) + |""".stripMargin +} diff --git a/tests/disabled/macro/run/macro-repl-dontexpand.check b/tests/disabled/macro/run/macro-repl-dontexpand.check new file mode 100644 index 000000000..6ecc9245f --- /dev/null +++ b/tests/disabled/macro/run/macro-repl-dontexpand.check @@ -0,0 +1,16 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> def bar1(c: scala.reflect.macros.blackbox.Context) = ??? +bar1: (c: scala.reflect.macros.blackbox.Context)Nothing + +scala> def foo1 = macro bar1 +defined term macro foo1: Nothing + +scala> def bar2(c: scala.reflect.macros.whitebox.Context) = ??? +bar2: (c: scala.reflect.macros.whitebox.Context)Nothing + +scala> def foo2 = macro bar2 +defined term macro foo2: Nothing + +scala> :quit diff --git a/tests/disabled/macro/run/macro-repl-dontexpand.scala b/tests/disabled/macro/run/macro-repl-dontexpand.scala new file mode 100644 index 000000000..920f40084 --- /dev/null +++ b/tests/disabled/macro/run/macro-repl-dontexpand.scala @@ -0,0 +1,11 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-language:experimental.macros" + def code = """ + |def bar1(c: scala.reflect.macros.blackbox.Context) = ??? + |def foo1 = macro bar1 + |def bar2(c: scala.reflect.macros.whitebox.Context) = ??? + |def foo2 = macro bar2 + |""".stripMargin +} diff --git a/tests/disabled/macro/run/macro-settings.check b/tests/disabled/macro/run/macro-settings.check new file mode 100644 index 000000000..050d53cdb --- /dev/null +++ b/tests/disabled/macro/run/macro-settings.check @@ -0,0 +1 @@ +List(hello=1) diff --git a/tests/disabled/macro/run/macro-settings.flags b/tests/disabled/macro/run/macro-settings.flags new file mode 100644 index 000000000..15479e30b --- /dev/null +++ b/tests/disabled/macro/run/macro-settings.flags @@ -0,0 +1 @@ +-language:experimental.macros -Xmacro-settings:hello=1 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-settings/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-settings/Impls_Macros_1.scala new file mode 100644 index 000000000..851a98720 --- /dev/null +++ b/tests/disabled/macro/run/macro-settings/Impls_Macros_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def impl(c: Context) = { + import c.universe._ + reify { + println(c.Expr[String](Literal(Constant(c.settings.toString))).splice) + } + } +} + +object Macros { + def foo = macro Impls.impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-settings/Test_2.scala b/tests/disabled/macro/run/macro-settings/Test_2.scala new file mode 100644 index 000000000..0fc472aa6 --- /dev/null +++ b/tests/disabled/macro/run/macro-settings/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-sip19-revised.check b/tests/disabled/macro/run/macro-sip19-revised.check new file mode 100644 index 000000000..86c3d819b --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-sip19-revised.flags b/tests/disabled/macro/run/macro-sip19-revised.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-sip19-revised.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-sip19-revised/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-sip19-revised/Impls_Macros_1.scala new file mode 100644 index 000000000..ded4d85cf --- /dev/null +++ b/tests/disabled/macro/run/macro-sip19-revised/Impls_Macros_1.scala @@ -0,0 +1,35 @@ +import scala.reflect.macros.whitebox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + + val inscope = c.inferImplicitValue(c.mirror.staticClass("SourceLocation").toType) + val outer = c.Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null))) + + val Apply(fun, args) = c.enclosingImplicits(0).tree + val fileName = fun.pos.source.file.file.getName + val line = fun.pos.line + val charOffset = fun.pos.point + def literal[T](x: T) = c.Expr[T](Literal(Constant(x))) + c.universe.reify { SourceLocation1(outer.splice, literal(fileName).splice, literal(line).splice, literal(charOffset).splice) } + } + + 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 \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-sip19-revised/Test_2.scala b/tests/disabled/macro/run/macro-sip19-revised/Test_2.scala new file mode 100644 index 000000000..483665ae4 --- /dev/null +++ b/tests/disabled/macro/run/macro-sip19-revised/Test_2.scala @@ -0,0 +1,12 @@ +import Macros._ + +object Test extends dotty.runtime.LegacyApp { + 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/tests/disabled/macro/run/macro-sip19.check b/tests/disabled/macro/run/macro-sip19.check new file mode 100644 index 000000000..07cfd8c1e --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/macro-sip19.flags b/tests/disabled/macro/run/macro-sip19.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-sip19.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-sip19/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-sip19/Impls_Macros_1.scala new file mode 100644 index 000000000..f66ab7147 --- /dev/null +++ b/tests/disabled/macro/run/macro-sip19/Impls_Macros_1.scala @@ -0,0 +1,26 @@ +import scala.reflect.macros.whitebox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + val Apply(fun, args) = c.enclosingImplicits(0).tree + val fileName = fun.pos.source.file.file.getName + val line = fun.pos.line + val charOffset = fun.pos.point + def literal[T](x: T) = c.Expr[T](Literal(Constant(x))) + c.universe.reify { SourceLocation(literal(fileName).splice, literal(line).splice, literal(charOffset).splice) } + } + + 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 +) \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-sip19/Test_2.scala b/tests/disabled/macro/run/macro-sip19/Test_2.scala new file mode 100644 index 000000000..0255f1381 --- /dev/null +++ b/tests/disabled/macro/run/macro-sip19/Test_2.scala @@ -0,0 +1,16 @@ +import Macros._ + +object Test extends dotty.runtime.LegacyApp { + 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/tests/disabled/macro/run/macro-subpatterns.check b/tests/disabled/macro/run/macro-subpatterns.check new file mode 100644 index 000000000..4997146cf --- /dev/null +++ b/tests/disabled/macro/run/macro-subpatterns.check @@ -0,0 +1,3 @@ +Some(List((a @ Extractor((b @ Extractor((c @ _))))))) +Some(List((b @ Extractor((c @ _))))) +Some(List((c @ _))) diff --git a/tests/disabled/macro/run/macro-subpatterns/Macro_1.scala b/tests/disabled/macro/run/macro-subpatterns/Macro_1.scala new file mode 100644 index 000000000..e009e411a --- /dev/null +++ b/tests/disabled/macro/run/macro-subpatterns/Macro_1.scala @@ -0,0 +1,17 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +object Extractor { + def unapply(x: Any): Any = macro unapplyImpl + def unapplyImpl(c: Context)(x: c.Tree) = { + import c.universe._ + import internal._ + q""" + new { + def isEmpty = false + def get = ${subpatterns(x).toString} + def unapply(x: Any) = this + }.unapply($x) + """ + } +} diff --git a/tests/disabled/macro/run/macro-subpatterns/Test_2.scala b/tests/disabled/macro/run/macro-subpatterns/Test_2.scala new file mode 100644 index 000000000..b19bd9b9b --- /dev/null +++ b/tests/disabled/macro/run/macro-subpatterns/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + 42 match { + case Extractor(a @ Extractor(b @ Extractor(c))) => println(a); println(b); println(c) + } +} diff --git a/tests/disabled/macro/run/macro-system-properties.check b/tests/disabled/macro/run/macro-system-properties.check new file mode 100644 index 000000000..e2e2bd32b --- /dev/null +++ b/tests/disabled/macro/run/macro-system-properties.check @@ -0,0 +1,22 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.language.experimental._, scala.reflect.macros.blackbox.Context +import scala.language.experimental._ +import scala.reflect.macros.blackbox.Context + +scala> object GrabContext { + def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context]) + // System.properties lets you stash true globals (unlike statics which are classloader scoped) + def impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") } + def grab(): Unit = macro impl + } +defined object GrabContext + +scala> object Test { class C(implicit a: Any) { GrabContext.grab } } +defined object Test + +scala> object Test { class C(implicit a: Any) { GrabContext.grab } } +defined object Test + +scala> :quit diff --git a/tests/disabled/macro/run/macro-system-properties.scala b/tests/disabled/macro/run/macro-system-properties.scala new file mode 100644 index 000000000..db88eb7df --- /dev/null +++ b/tests/disabled/macro/run/macro-system-properties.scala @@ -0,0 +1,16 @@ +import scala.tools.nsc._ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + import scala.language.experimental._, scala.reflect.macros.blackbox.Context + object GrabContext { + def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context]) + // System.properties lets you stash true globals (unlike statics which are classloader scoped) + def impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") } + def grab(): Unit = macro impl + } + object Test { class C(implicit a: Any) { GrabContext.grab } } + object Test { class C(implicit a: Any) { GrabContext.grab } } + """ +} diff --git a/tests/disabled/macro/run/macro-term-declared-in-annotation.check b/tests/disabled/macro/run/macro-term-declared-in-annotation.check new file mode 100644 index 000000000..7658ad2c2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-annotation.check @@ -0,0 +1 @@ +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-annotation.flags b/tests/disabled/macro/run/macro-term-declared-in-annotation.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-annotation.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-annotation/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-annotation/Impls_1.scala new file mode 100644 index 000000000..c4bcfbc1b --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-annotation/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Literal(Constant("this is deprecated"))) + c.Expr[String](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-annotation/Macros_2.scala b/tests/disabled/macro/run/macro-term-declared-in-annotation/Macros_2.scala new file mode 100644 index 000000000..40d71c62f --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-annotation/Macros_2.scala @@ -0,0 +1,8 @@ +class foo(val bar: String) extends annotation.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/tests/disabled/macro/run/macro-term-declared-in-annotation/Test_3.scala b/tests/disabled/macro/run/macro-term-declared-in-annotation/Test_3.scala new file mode 100644 index 000000000..322ef9eb1 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-annotation/Test_3.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Api.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-anonymous.check b/tests/disabled/macro/run/macro-term-declared-in-anonymous.check new file mode 100644 index 000000000..09b8d015a --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-anonymous.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Test.this.macros) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-anonymous.flags b/tests/disabled/macro/run/macro-term-declared-in-anonymous.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-anonymous.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-anonymous/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-anonymous/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-anonymous/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-anonymous/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-anonymous/Macros_Test_2.scala new file mode 100644 index 000000000..894947e1e --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-anonymous/Macros_Test_2.scala @@ -0,0 +1,6 @@ +import scala.language.reflectiveCalls + +object Test extends dotty.runtime.LegacyApp { + val macros = new { def foo: Unit = macro Impls.foo } + macros.foo +} diff --git a/tests/disabled/macro/run/macro-term-declared-in-block.check b/tests/disabled/macro/run/macro-term-declared-in-block.check new file mode 100644 index 000000000..5e687db8b --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-block.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing]() +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-block.flags b/tests/disabled/macro/run/macro-term-declared-in-block.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-block.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-block/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-block/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-block/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-block/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-block/Macros_Test_2.scala new file mode 100644 index 000000000..eba5e4961 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-block/Macros_Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + { + def foo: Unit = macro Impls.foo + foo + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class-class.check b/tests/disabled/macro/run/macro-term-declared-in-class-class.check new file mode 100644 index 000000000..47248d7af --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class-class.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](new Test.this.outer.Macros()) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-class-class.flags b/tests/disabled/macro/run/macro-term-declared-in-class-class.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class-class.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class-class/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-class-class/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class-class/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class-class/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-class-class/Macros_Test_2.scala new file mode 100644 index 000000000..7f813a30d --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class-class/Macros_Test_2.scala @@ -0,0 +1,10 @@ +class Macros { + class Macros { + def foo: Unit = macro Impls.foo + } +} + +object Test extends dotty.runtime.LegacyApp { + val outer = new Macros() + new outer.Macros().foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class-object.check b/tests/disabled/macro/run/macro-term-declared-in-class-object.check new file mode 100644 index 000000000..35af59e40 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class-object.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Test.this.outer.Macros) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-class-object.flags b/tests/disabled/macro/run/macro-term-declared-in-class-object.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class-object.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class-object/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-class-object/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class-object/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class-object/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-class-object/Macros_Test_2.scala new file mode 100644 index 000000000..12c6328c9 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class-object/Macros_Test_2.scala @@ -0,0 +1,10 @@ +class Macros { + object Macros { + def foo: Unit = macro Impls.foo + } +} + +object Test extends dotty.runtime.LegacyApp { + val outer = new Macros() + outer.Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class.check b/tests/disabled/macro/run/macro-term-declared-in-class.check new file mode 100644 index 000000000..a1c1d7af8 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](new Macros()) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-class.flags b/tests/disabled/macro/run/macro-term-declared-in-class.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-class/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-class/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-class/Macros_Test_2.scala new file mode 100644 index 000000000..0c9a7ccf0 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-class/Macros_Test_2.scala @@ -0,0 +1,7 @@ +class Macros { + def foo: Unit = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + new Macros().foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-default-param.check b/tests/disabled/macro/run/macro-term-declared-in-default-param.check new file mode 100644 index 000000000..6decd7aa4 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-default-param.check @@ -0,0 +1,5 @@ +prefix = Expr[Nothing]() +it works +it works +prefix = Expr[Nothing]() +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-default-param.flags b/tests/disabled/macro/run/macro-term-declared-in-default-param.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-default-param.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-default-param/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-default-param/Impls_1.scala new file mode 100644 index 000000000..ef0f13613 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-default-param/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Literal(Constant("it works"))) + c.Expr[String](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-default-param/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-default-param/Macros_Test_2.scala new file mode 100644 index 000000000..856a4e44f --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-default-param/Macros_Test_2.scala @@ -0,0 +1,7 @@ +object Test extends dotty.runtime.LegacyApp { + def foo(bar: String = { def foo: String = macro Impls.foo; foo }) = println(bar) + + foo() + foo("it works") + foo() +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-implicit-class.check b/tests/disabled/macro/run/macro-term-declared-in-implicit-class.check new file mode 100644 index 000000000..5dc968c08 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-implicit-class.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Macros.foo("2")) +Some(2) diff --git a/tests/disabled/macro/run/macro-term-declared-in-implicit-class.flags b/tests/disabled/macro/run/macro-term-declared-in-implicit-class.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-implicit-class.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala new file mode 100644 index 000000000..ef00f6ff3 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala @@ -0,0 +1,19 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def toOptionOfInt(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, TermName("x")), TermName("toInt"))))) + c.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 + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-implicit-class/Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-implicit-class/Test_2.scala new file mode 100644 index 000000000..fd67062be --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-implicit-class/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + import Macros._ + println("2".toOptionOfInt) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-method.check b/tests/disabled/macro/run/macro-term-declared-in-method.check new file mode 100644 index 000000000..5e687db8b --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-method.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing]() +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-method.flags b/tests/disabled/macro/run/macro-term-declared-in-method.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-method.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-method/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-method/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-method/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-method/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-method/Macros_Test_2.scala new file mode 100644 index 000000000..d40eb4c60 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-method/Macros_Test_2.scala @@ -0,0 +1,8 @@ +object Test extends dotty.runtime.LegacyApp { + def bar() = { + def foo: Unit = macro Impls.foo + foo + } + + bar() +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object-class.check b/tests/disabled/macro/run/macro-term-declared-in-object-class.check new file mode 100644 index 000000000..47248d7af --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object-class.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](new Test.this.outer.Macros()) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-object-class.flags b/tests/disabled/macro/run/macro-term-declared-in-object-class.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object-class.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object-class/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-object-class/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object-class/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object-class/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-object-class/Macros_Test_2.scala new file mode 100644 index 000000000..89aed84c7 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object-class/Macros_Test_2.scala @@ -0,0 +1,10 @@ +object Macros { + class Macros { + def foo: Unit = macro Impls.foo + } +} + +object Test extends dotty.runtime.LegacyApp { + val outer = Macros + new outer.Macros().foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object-object.check b/tests/disabled/macro/run/macro-term-declared-in-object-object.check new file mode 100644 index 000000000..35af59e40 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object-object.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Test.this.outer.Macros) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-object-object.flags b/tests/disabled/macro/run/macro-term-declared-in-object-object.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object-object.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object-object/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-object-object/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object-object/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object-object/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-object-object/Macros_Test_2.scala new file mode 100644 index 000000000..c5950fe61 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object-object/Macros_Test_2.scala @@ -0,0 +1,10 @@ +object Macros { + object Macros { + def foo: Unit = macro Impls.foo + } +} + +object Test extends dotty.runtime.LegacyApp { + val outer = Macros + outer.Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object.check b/tests/disabled/macro/run/macro-term-declared-in-object.check new file mode 100644 index 000000000..4d955a96b --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Macros) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-object.flags b/tests/disabled/macro/run/macro-term-declared-in-object.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-object/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-object/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-object/Macros_Test_2.scala new file mode 100644 index 000000000..f89a21d92 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-object/Macros_Test_2.scala @@ -0,0 +1,7 @@ +object Macros { + def foo: Unit = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-package-object.check b/tests/disabled/macro/run/macro-term-declared-in-package-object.check new file mode 100644 index 000000000..bc0069178 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-package-object.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Macros.`package`) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-package-object.flags b/tests/disabled/macro/run/macro-term-declared-in-package-object.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-package-object.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-package-object/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-package-object/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-package-object/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-package-object/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-package-object/Macros_Test_2.scala new file mode 100644 index 000000000..69f3803ba --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-package-object/Macros_Test_2.scala @@ -0,0 +1,8 @@ +package object Macros { + def foo: Unit = macro Impls.foo +} + +object Test extends dotty.runtime.LegacyApp { + import Macros._ + foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-refinement.check b/tests/disabled/macro/run/macro-term-declared-in-refinement.check new file mode 100644 index 000000000..09b8d015a --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-refinement.check @@ -0,0 +1,2 @@ +prefix = Expr[Nothing](Test.this.macros) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-refinement.flags b/tests/disabled/macro/run/macro-term-declared-in-refinement.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-refinement.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-refinement/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-refinement/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-refinement/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-refinement/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-refinement/Macros_Test_2.scala new file mode 100644 index 000000000..49192291e --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-refinement/Macros_Test_2.scala @@ -0,0 +1,8 @@ +import scala.language.reflectiveCalls + +class Base + +object Test extends dotty.runtime.LegacyApp { + val macros = new Base { def foo: Unit = macro Impls.foo } + macros.foo +} diff --git a/tests/disabled/macro/run/macro-term-declared-in-trait.check b/tests/disabled/macro/run/macro-term-declared-in-trait.check new file mode 100644 index 000000000..0f3756ddb --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-trait.check @@ -0,0 +1,15 @@ +prefix = Expr[Nothing]({ + final class $anon extends AnyRef with Base { + def (): <$anon: Base> = { + $anon.super.(); + () + }; + + }; + new $anon() +}) +it works +prefix = Expr[Nothing](Macros) +it works +prefix = Expr[Nothing](new Macros()) +it works diff --git a/tests/disabled/macro/run/macro-term-declared-in-trait.flags b/tests/disabled/macro/run/macro-term-declared-in-trait.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-trait.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-trait/Impls_1.scala b/tests/disabled/macro/run/macro-term-declared-in-trait/Impls_1.scala new file mode 100644 index 000000000..c43f5f3f5 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-trait/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) + c.Expr[Unit](body) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-term-declared-in-trait/Macros_Test_2.scala b/tests/disabled/macro/run/macro-term-declared-in-trait/Macros_Test_2.scala new file mode 100644 index 000000000..5780aba45 --- /dev/null +++ b/tests/disabled/macro/run/macro-term-declared-in-trait/Macros_Test_2.scala @@ -0,0 +1,13 @@ +trait Base { + def foo: Unit = macro Impls.foo +} + +object Macros extends Base + +class Macros extends Base + +object Test extends dotty.runtime.LegacyApp { + (new Base {}).foo + Macros.foo + new Macros().foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-typecheck-implicitsdisabled.check b/tests/disabled/macro/run/macro-typecheck-implicitsdisabled.check new file mode 100644 index 000000000..91d8fabd7 --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-implicitsdisabled.check @@ -0,0 +1,2 @@ +scala.this.Predef.ArrowAssoc[Int](1).->[Int](2) +scala.reflect.macros.TypecheckException: value -> is not a member of Int diff --git a/tests/disabled/macro/run/macro-typecheck-implicitsdisabled.flags b/tests/disabled/macro/run/macro-typecheck-implicitsdisabled.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-implicitsdisabled.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala new file mode 100644 index 000000000..956331cfa --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala @@ -0,0 +1,28 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl_with_implicits_enabled(c: Context) = { + import c.universe._ + + val tree1 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) + val ttree1 = c.typecheck(tree1, withImplicitViewsDisabled = false) + c.Expr[String](Literal(Constant(ttree1.toString))) + } + + def foo_with_implicits_enabled = macro impl_with_implicits_enabled + + def impl_with_implicits_disabled(c: Context) = { + import c.universe._ + + try { + val tree2 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) + val ttree2 = c.typecheck(tree2, withImplicitViewsDisabled = true) + c.Expr[String](Literal(Constant(ttree2.toString))) + } catch { + case ex: Throwable => + c.Expr[String](Literal(Constant(ex.toString))) + } + } + + def foo_with_implicits_disabled = macro impl_with_implicits_disabled +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-typecheck-implicitsdisabled/Test_2.scala b/tests/disabled/macro/run/macro-typecheck-implicitsdisabled/Test_2.scala new file mode 100644 index 000000000..87d3148e9 --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-implicitsdisabled/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo_with_implicits_enabled) + println(Macros.foo_with_implicits_disabled) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-typecheck-macrosdisabled.check b/tests/disabled/macro/run/macro-typecheck-macrosdisabled.check new file mode 100644 index 000000000..c618d22d8 --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-macrosdisabled.check @@ -0,0 +1,32 @@ +({ + val $u: reflect.runtime.universe.type = scala.reflect.runtime.`package`.universe; + val $m: $u.Mirror = scala.reflect.runtime.`package`.universe.runtimeMirror(this.getClass().getClassLoader()); + $u.Expr.apply[Int(2)]($m, { + final class $treecreator1 extends TreeCreator { + def (): $treecreator1 = { + $treecreator1.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Literal.apply($u.Constant.apply(2)) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Int(2)]($m, { + final class $typecreator2 extends TypeCreator { + def (): $typecreator2 = { + $typecreator2.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.internal.reificationSupport.ConstantType($u.Constant.apply(2)) + } + }; + new $typecreator2() + })) +}: reflect.runtime.universe.Expr[Int]) +ru.reify[Int](2) diff --git a/tests/disabled/macro/run/macro-typecheck-macrosdisabled.flags b/tests/disabled/macro/run/macro-typecheck-macrosdisabled.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-macrosdisabled.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala new file mode 100644 index 000000000..0e549f4ab --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala @@ -0,0 +1,31 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl_with_macros_enabled(c: Context) = { + import c.universe._ + + val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe")) + val tree1 = Apply(Select(ru, TermName("reify")), List(Literal(Constant(2)))) + val ttree1 = c.typecheck(tree1, withMacrosDisabled = false) + c.Expr[String](Literal(Constant(ttree1.toString))) + } + + def foo_with_macros_enabled = macro impl_with_macros_enabled + + def impl_with_macros_disabled(c: Context) = { + import c.universe._ + import internal._ + + val rupkg = c.mirror.staticModule("scala.reflect.runtime.package") + val rusym = reificationSupport.selectTerm(rupkg, "universe") + val NullaryMethodType(rutpe) = rusym.info + val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe) + reificationSupport.setInfo(ru, rutpe) + + val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) + val ttree2 = c.typecheck(tree2, withMacrosDisabled = true) + c.Expr[String](Literal(Constant(ttree2.toString))) + } + + def foo_with_macros_disabled = macro impl_with_macros_disabled +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-typecheck-macrosdisabled/Test_2.scala b/tests/disabled/macro/run/macro-typecheck-macrosdisabled/Test_2.scala new file mode 100644 index 000000000..887f28c8c --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-macrosdisabled/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo_with_macros_enabled) + println(Macros.foo_with_macros_disabled) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-typecheck-macrosdisabled2.check b/tests/disabled/macro/run/macro-typecheck-macrosdisabled2.check new file mode 100644 index 000000000..2e862a608 --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-macrosdisabled2.check @@ -0,0 +1,32 @@ +({ + val $u: reflect.runtime.universe.type = scala.reflect.runtime.`package`.universe; + val $m: $u.Mirror = scala.reflect.runtime.`package`.universe.runtimeMirror(this.getClass().getClassLoader()); + $u.Expr.apply[Array[Int]]($m, { + final class $treecreator1 extends TreeCreator { + def (): $treecreator1 = { + $treecreator1.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Apply.apply($u.Select.apply($u.internal.reificationSupport.mkIdent($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Array[Int]]($m, { + final class $typecreator2 extends TypeCreator { + def (): $typecreator2 = { + $typecreator2.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.internal.reificationSupport.TypeRef($u.internal.reificationSupport.ThisType($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) + } + }; + new $typecreator2() + })) +}: reflect.runtime.universe.Expr[Array[Int]]) +ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/tests/disabled/macro/run/macro-typecheck-macrosdisabled2.flags b/tests/disabled/macro/run/macro-typecheck-macrosdisabled2.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-macrosdisabled2.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala new file mode 100644 index 000000000..f99f5d2f8 --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala @@ -0,0 +1,31 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl_with_macros_enabled(c: Context) = { + import c.universe._ + + val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe")) + val tree1 = Apply(Select(ru, TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) + val ttree1 = c.typecheck(tree1, withMacrosDisabled = false) + c.Expr[String](Literal(Constant(ttree1.toString))) + } + + def foo_with_macros_enabled = macro impl_with_macros_enabled + + def impl_with_macros_disabled(c: Context) = { + import c.universe._ + import internal._ + + val rupkg = c.mirror.staticModule("scala.reflect.runtime.package") + val rusym = reificationSupport.selectTerm(rupkg, "universe") + val NullaryMethodType(rutpe) = rusym.info + val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe) + reificationSupport.setInfo(ru, rutpe) + + val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) + val ttree2 = c.typecheck(tree2, withMacrosDisabled = true) + c.Expr[String](Literal(Constant(ttree2.toString))) + } + + def foo_with_macros_disabled = macro impl_with_macros_disabled +} diff --git a/tests/disabled/macro/run/macro-typecheck-macrosdisabled2/Test_2.scala b/tests/disabled/macro/run/macro-typecheck-macrosdisabled2/Test_2.scala new file mode 100644 index 000000000..887f28c8c --- /dev/null +++ b/tests/disabled/macro/run/macro-typecheck-macrosdisabled2/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo_with_macros_enabled) + println(Macros.foo_with_macros_disabled) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-undetparams-consfromsls.check b/tests/disabled/macro/run/macro-undetparams-consfromsls.check new file mode 100644 index 000000000..3fee58d9c --- /dev/null +++ b/tests/disabled/macro/run/macro-undetparams-consfromsls.check @@ -0,0 +1,5 @@ +A = WeakTypeTag[Int] +B = WeakTypeTag[Nothing] +List(1) +A = WeakTypeTag[Any] +List(abc, 1) diff --git a/tests/disabled/macro/run/macro-undetparams-consfromsls.flags b/tests/disabled/macro/run/macro-undetparams-consfromsls.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-undetparams-consfromsls.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-undetparams-consfromsls/Impls_Macros_1.scala new file mode 100644 index 000000000..5df5f96aa --- /dev/null +++ b/tests/disabled/macro/run/macro-undetparams-consfromsls/Impls_Macros_1.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Macros { + def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = { + import c.universe._ + reify { + println("A = " + c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[A]].toString))).splice) + x.splice :: xs.splice + } + } + + def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = { + import c.universe._ + reify { + println("B = " + c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[B]].toString))).splice) + 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/tests/disabled/macro/run/macro-undetparams-consfromsls/Test_2.scala b/tests/disabled/macro/run/macro-undetparams-consfromsls/Test_2.scala new file mode 100644 index 000000000..338684401 --- /dev/null +++ b/tests/disabled/macro/run/macro-undetparams-consfromsls/Test_2.scala @@ -0,0 +1,7 @@ +object Test extends dotty.runtime.LegacyApp { + 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/tests/disabled/macro/run/macro-undetparams-macroitself.check b/tests/disabled/macro/run/macro-undetparams-macroitself.check new file mode 100644 index 000000000..a9bf55423 --- /dev/null +++ b/tests/disabled/macro/run/macro-undetparams-macroitself.check @@ -0,0 +1,2 @@ +WeakTypeTag[Int] +WeakTypeTag[String] diff --git a/tests/disabled/macro/run/macro-undetparams-macroitself.flags b/tests/disabled/macro/run/macro-undetparams-macroitself.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/macro-undetparams-macroitself.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-undetparams-macroitself/Impls_Macros_1.scala new file mode 100644 index 000000000..1eb257e1d --- /dev/null +++ b/tests/disabled/macro/run/macro-undetparams-macroitself/Impls_Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl[T: c.WeakTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = { + import c.universe._ + reify { println(c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[T]].toString))).splice) } + } + + def foo[T](foo: T) = macro impl[T] +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-undetparams-macroitself/Test_2.scala b/tests/disabled/macro/run/macro-undetparams-macroitself/Test_2.scala new file mode 100644 index 000000000..c315f3508 --- /dev/null +++ b/tests/disabled/macro/run/macro-undetparams-macroitself/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo(42) + Macros.foo("42") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-vampire-false-warning.check b/tests/disabled/macro/run/macro-vampire-false-warning.check new file mode 100644 index 000000000..4792e70f3 --- /dev/null +++ b/tests/disabled/macro/run/macro-vampire-false-warning.check @@ -0,0 +1,2 @@ +2 +3 diff --git a/tests/disabled/macro/run/macro-vampire-false-warning.flags b/tests/disabled/macro/run/macro-vampire-false-warning.flags new file mode 100644 index 000000000..e8fb65d50 --- /dev/null +++ b/tests/disabled/macro/run/macro-vampire-false-warning.flags @@ -0,0 +1 @@ +-Xfatal-warnings \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-vampire-false-warning/Macros_1.scala b/tests/disabled/macro/run/macro-vampire-false-warning/Macros_1.scala new file mode 100644 index 000000000..63c34b3ab --- /dev/null +++ b/tests/disabled/macro/run/macro-vampire-false-warning/Macros_1.scala @@ -0,0 +1,52 @@ +// As per http://meta.plasm.us/posts/2013/08/31/feeding-our-vampires/ + +import scala.annotation.StaticAnnotation +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +class body(tree: Any) extends StaticAnnotation + +object Macros { + def selFieldImpl(c: Context) = { + import c.universe._ + val field = c.macroApplication.symbol + val bodyAnn = field.annotations.filter(_.tree.tpe <:< typeOf[body]).head + c.Expr[Any](bodyAnn.tree.children(1)) + } + + def mkObjectImpl(c: Context)(xs: c.Expr[Any]*) = { + import c.universe._ + import Flag._ + // val kvps = xs.toList map { case q"${_}(${Literal(Constant(name: String))}).->[${_}]($value)" => name -> value } + val kvps = xs.map(_.tree).toList map { case Apply(TypeApply(Select(Apply(_, List(Literal(Constant(name: String)))), _), _), List(value)) => name -> value } + // val fields = kvps map { case (k, v) => q"@body($v) def ${TermName(k)} = macro Macros.selFieldImpl" } + val fields = kvps map { case (k, v) => DefDef( + Modifiers(MACRO, typeNames.EMPTY, List(Apply(Select(New(Ident(TypeName("body"))), termNames.CONSTRUCTOR), List(v)))), + TermName(k), Nil, Nil, Ident(TypeName("Any")), Select(Ident(TermName("Macros")), TermName("selFieldImpl"))) } + // q"import scala.language.experimental.macros; class Workaround { ..$fields }; new Workaround{}" + c.Expr[Any](Block( + List( + Import(Select(Select(Ident(TermName("scala")), TermName("language")), TermName("experimental")), List(ImportSelector(TermName("macros"), 51, TermName("macros"), 51))), + ClassDef( + NoMods, TypeName("Workaround"), Nil, + Template( + List(Select(Ident(TermName("scala")), TypeName("AnyRef"))), noSelfType, + DefDef( + NoMods, termNames.CONSTRUCTOR, Nil, List(Nil), TypeTree(), + Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))) + +: fields)), + ClassDef( + Modifiers(FINAL), TypeName("$anon"), Nil, + Template( + List(Ident(TypeName("Workaround"))), noSelfType, + List( + DefDef( + NoMods, termNames.CONSTRUCTOR, Nil, List(Nil), TypeTree(), + Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))))))), + Apply(Select(New(Ident(TypeName("$anon"))), termNames.CONSTRUCTOR), List()))) + } +} + +object mkObject { + def apply(xs: Any*): Any = macro Macros.mkObjectImpl +} diff --git a/tests/disabled/macro/run/macro-vampire-false-warning/Test_2.scala b/tests/disabled/macro/run/macro-vampire-false-warning/Test_2.scala new file mode 100644 index 000000000..d28849b88 --- /dev/null +++ b/tests/disabled/macro/run/macro-vampire-false-warning/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + val foo = mkObject("x" -> "2", "y" -> 3) + println(foo.x) + println(foo.y) + // println(foo.z) => will result in a compilation error +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-whitebox-dynamic-materialization.check b/tests/disabled/macro/run/macro-whitebox-dynamic-materialization.check new file mode 100644 index 000000000..ccec8e5b2 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-dynamic-materialization.check @@ -0,0 +1,2 @@ +null +C2 diff --git a/tests/disabled/macro/run/macro-whitebox-dynamic-materialization/Macros_1.scala b/tests/disabled/macro/run/macro-whitebox-dynamic-materialization/Macros_1.scala new file mode 100644 index 000000000..aaf27c289 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-dynamic-materialization/Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +trait Foo[T] + +class C1(val x: Int) +class C2(val x: String) + +trait LowPriority { + implicit def lessSpecific[T]: Foo[T] = null +} + +object Foo extends LowPriority { + implicit def moreSpecific[T]: Foo[T] = macro Macros.impl[T] +} + +object Macros { + def impl[T: c.WeakTypeTag](c: Context) = { + import c.universe._ + val tpe = weakTypeOf[T] + if (tpe.members.exists(_.info =:= typeOf[Int])) + c.abort(c.enclosingPosition, "I don't like classes that contain integers") + q"new Foo[$tpe]{ override def toString = ${tpe.toString} }" + } +} diff --git a/tests/disabled/macro/run/macro-whitebox-dynamic-materialization/Test_2.scala b/tests/disabled/macro/run/macro-whitebox-dynamic-materialization/Test_2.scala new file mode 100644 index 000000000..10d89dd3c --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-dynamic-materialization/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println(implicitly[Foo[C1]]) + println(implicitly[Foo[C2]]) +} diff --git a/tests/disabled/macro/run/macro-whitebox-extractor.check b/tests/disabled/macro/run/macro-whitebox-extractor.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-extractor.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/macro-whitebox-extractor/Macros_1.scala b/tests/disabled/macro/run/macro-whitebox-extractor/Macros_1.scala new file mode 100644 index 000000000..d394c0241 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-extractor/Macros_1.scala @@ -0,0 +1,21 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +object Extractor { + def unapply(x: Int): Any = macro Macros.unapplyImpl +} + +object Macros { + def unapplyImpl(c: Context)(x: c.Tree) = { + import c.universe._ + q""" + new { + class Match(x: Int) { + def isEmpty = false + def get = x + } + def unapply(x: Int) = new Match(x) + }.unapply($x) + """ + } +} diff --git a/tests/disabled/macro/run/macro-whitebox-extractor/Test_2.scala b/tests/disabled/macro/run/macro-whitebox-extractor/Test_2.scala new file mode 100644 index 000000000..7c354ecd6 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-extractor/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + 42 match { + case Extractor(x) => println(x) + } +} diff --git a/tests/disabled/macro/run/macro-whitebox-fundep-materialization.check b/tests/disabled/macro/run/macro-whitebox-fundep-materialization.check new file mode 100644 index 000000000..bed742910 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-fundep-materialization.check @@ -0,0 +1 @@ +(23,foo,true) diff --git a/tests/disabled/macro/run/macro-whitebox-fundep-materialization/Macros_1.scala b/tests/disabled/macro/run/macro-whitebox-fundep-materialization/Macros_1.scala new file mode 100644 index 000000000..5e89e6b2f --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-fundep-materialization/Macros_1.scala @@ -0,0 +1,39 @@ +import scala.language.experimental.macros +import scala.reflect.macros.whitebox.Context + +trait Iso[T, U] { + def to(t : T) : U + // def from(u : U) : T +} + +object Iso { + implicit def materializeIso[T, U]: Iso[T, U] = macro impl[T, U] + def impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context): c.Expr[Iso[T, U]] = { + import c.universe._ + import definitions._ + import Flag._ + + val sym = c.weakTypeOf[T].typeSymbol + if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class") + val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x } + + def mkTpt() = { + val core = Ident(TupleClass(fields.length) orElse UnitClass) + if (fields.length == 0) core + else AppliedTypeTree(core, fields map (f => TypeTree(f.info))) + } + + def mkFrom() = { + if (fields.length == 0) Literal(Constant(Unit)) + else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim)))) + } + + val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template( + List(AppliedTypeTree(Ident(newTypeName("Iso")), List(Ident(sym), mkTpt()))), + emptyValDef, + List( + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))), + DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom())))) + c.Expr[Iso[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List()))) + } +} diff --git a/tests/disabled/macro/run/macro-whitebox-fundep-materialization/Test_2.scala b/tests/disabled/macro/run/macro-whitebox-fundep-materialization/Test_2.scala new file mode 100644 index 000000000..72183ba86 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-fundep-materialization/Test_2.scala @@ -0,0 +1,12 @@ +// see the comments for macroExpand.onDelayed for an explanation of what's tested here +object Test extends dotty.runtime.LegacyApp { + case class Foo(i: Int, s: String, b: Boolean) + def foo[C, L](c: C)(implicit iso: Iso[C, L]): L = iso.to(c) + + { + val equiv = foo(Foo(23, "foo", true)) + def typed[T](t: => T) {} + typed[(Int, String, Boolean)](equiv) + println(equiv) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-whitebox-structural.check b/tests/disabled/macro/run/macro-whitebox-structural.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-structural.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/macro-whitebox-structural/Impls_Macros_1.scala b/tests/disabled/macro/run/macro-whitebox-structural/Impls_Macros_1.scala new file mode 100644 index 000000000..45fdb79c3 --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-structural/Impls_Macros_1.scala @@ -0,0 +1,16 @@ +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + q""" + trait Foo { + def x = 2 + } + new Foo {} + """ + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macro-whitebox-structural/Test_2.scala b/tests/disabled/macro/run/macro-whitebox-structural/Test_2.scala new file mode 100644 index 000000000..6fa47e1dd --- /dev/null +++ b/tests/disabled/macro/run/macro-whitebox-structural/Test_2.scala @@ -0,0 +1,5 @@ +import Macros._ + +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo.x) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-isBlackbox/Macros_2.scala b/tests/disabled/macro/run/macroPlugins-isBlackbox/Macros_2.scala new file mode 100644 index 000000000..a90dd702d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-isBlackbox/Macros_2.scala @@ -0,0 +1,11 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + q"42" + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-isBlackbox/Plugin_1.scala b/tests/disabled/macro/run/macroPlugins-isBlackbox/Plugin_1.scala new file mode 100644 index 000000000..b78a18ea6 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-isBlackbox/Plugin_1.scala @@ -0,0 +1,21 @@ +package isblackbox + +import scala.tools.nsc.Global +import scala.tools.nsc.plugins.{Plugin => NscPlugin} + +class Plugin(val global: Global) extends NscPlugin { + import global._ + import analyzer._ + import scala.reflect.internal.Mode + + val name = "isBlackbox" + val description = "A sample analyzer plugin that overrides isBlackbox." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsIsBlackbox(macroDef: Symbol): Option[Boolean] = { + Some(false) + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-isBlackbox/Test_3.flags b/tests/disabled/macro/run/macroPlugins-isBlackbox/Test_3.flags new file mode 100644 index 000000000..966df731d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-isBlackbox/Test_3.flags @@ -0,0 +1 @@ +-Xplugin:. \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-isBlackbox/Test_3.scala b/tests/disabled/macro/run/macroPlugins-isBlackbox/Test_3.scala new file mode 100644 index 000000000..f191e5de3 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-isBlackbox/Test_3.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + val x: Int = Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-isBlackbox/scalac-plugin.xml b/tests/disabled/macro/run/macroPlugins-isBlackbox/scalac-plugin.xml new file mode 100644 index 000000000..09b9c1464 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-isBlackbox/scalac-plugin.xml @@ -0,0 +1,4 @@ + + is-blackbox + isblackbox.Plugin + \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroArgs.check b/tests/disabled/macro/run/macroPlugins-macroArgs.check new file mode 100644 index 000000000..a68f8069b --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroArgs.check @@ -0,0 +1,2 @@ +hijacked 1 +hijacked 2 diff --git a/tests/disabled/macro/run/macroPlugins-macroArgs/Macros_2.scala b/tests/disabled/macro/run/macroPlugins-macroArgs/Macros_2.scala new file mode 100644 index 000000000..b19b8f18d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroArgs/Macros_2.scala @@ -0,0 +1,11 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context)(arg: c.Tree) = { + import c.universe._ + q"""println($arg)""" + } + + def foo(arg: String): Unit = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroArgs/Plugin_1.scala b/tests/disabled/macro/run/macroPlugins-macroArgs/Plugin_1.scala new file mode 100644 index 000000000..23e80ced3 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroArgs/Plugin_1.scala @@ -0,0 +1,21 @@ +package macroArgs + +import scala.tools.nsc.Global +import scala.tools.nsc.plugins.{Plugin => NscPlugin} + +class Plugin(val global: Global) extends NscPlugin { + import global._ + import analyzer._ + + val name = "macroArgs" + val description = "A sample analyzer plugin that overrides macroArgs." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsMacroArgs(typer: Typer, expandee: Tree): Option[MacroArgs] = { + val MacroArgs(c, List(Literal(Constant(s: String)))) = standardMacroArgs(typer, expandee) + Some(MacroArgs(c, List(Literal(Constant("hijacked " + s))))) + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroArgs/Test_3.flags b/tests/disabled/macro/run/macroPlugins-macroArgs/Test_3.flags new file mode 100644 index 000000000..966df731d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroArgs/Test_3.flags @@ -0,0 +1 @@ +-Xplugin:. \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroArgs/Test_3.scala b/tests/disabled/macro/run/macroPlugins-macroArgs/Test_3.scala new file mode 100644 index 000000000..8d3be78bb --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroArgs/Test_3.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo("1") + Macros.foo("2") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroArgs/scalac-plugin.xml b/tests/disabled/macro/run/macroPlugins-macroArgs/scalac-plugin.xml new file mode 100644 index 000000000..0849f0f4e --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroArgs/scalac-plugin.xml @@ -0,0 +1,4 @@ + + macro-args + macroArgs.Plugin + \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroExpand.check b/tests/disabled/macro/run/macroPlugins-macroExpand.check new file mode 100644 index 000000000..6f685c2af --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroExpand.check @@ -0,0 +1,2 @@ +expanded into println("impl1") +expanded into println("impl2") diff --git a/tests/disabled/macro/run/macroPlugins-macroExpand.flags b/tests/disabled/macro/run/macroPlugins-macroExpand.flags new file mode 100644 index 000000000..ea7fc37e1 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroExpand.flags @@ -0,0 +1 @@ +-Yrangepos:false diff --git a/tests/disabled/macro/run/macroPlugins-macroExpand/Macros_2.scala b/tests/disabled/macro/run/macroPlugins-macroExpand/Macros_2.scala new file mode 100644 index 000000000..c9c88ad2f --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroExpand/Macros_2.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl1(c: Context) = { + import c.universe._ + q"""println("impl1")""" + } + + def impl2(c: Context) = { + import c.universe._ + q"""println("impl2")""" + } + + def foo1: Unit = macro impl1 + + def foo2: Unit = macro impl2 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroExpand/Plugin_1.scala b/tests/disabled/macro/run/macroPlugins-macroExpand/Plugin_1.scala new file mode 100644 index 000000000..13df85cb2 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroExpand/Plugin_1.scala @@ -0,0 +1,27 @@ +package macroExpand + +import scala.tools.nsc.Global +import scala.tools.nsc.plugins.{Plugin => NscPlugin} + +class Plugin(val global: Global) extends NscPlugin { + import global._ + import analyzer._ + import scala.reflect.internal.Mode + + val name = "macroExpand" + val description = "A sample analyzer plugin that overrides macroExpand." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsMacroExpand(typer: Typer, expandee: Tree, mode: Mode, pt: Type): Option[Tree] = { + object expander extends DefMacroExpander(typer, expandee, mode, pt) { + override def onSuccess(expanded: Tree) = { + val message = s"expanded into ${expanded.toString}" + typer.typed(q"println($message)") + } + } + Some(expander(expandee)) + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroExpand/Test_3.flags b/tests/disabled/macro/run/macroPlugins-macroExpand/Test_3.flags new file mode 100644 index 000000000..966df731d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroExpand/Test_3.flags @@ -0,0 +1 @@ +-Xplugin:. \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroExpand/Test_3.scala b/tests/disabled/macro/run/macroPlugins-macroExpand/Test_3.scala new file mode 100644 index 000000000..a730821f2 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroExpand/Test_3.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo1 + Macros.foo2 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroExpand/scalac-plugin.xml b/tests/disabled/macro/run/macroPlugins-macroExpand/scalac-plugin.xml new file mode 100644 index 000000000..860150865 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroExpand/scalac-plugin.xml @@ -0,0 +1,4 @@ + + macro-expand + macroExpand.Plugin + \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroRuntime.check b/tests/disabled/macro/run/macroPlugins-macroRuntime.check new file mode 100644 index 000000000..af16d1ac3 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroRuntime.check @@ -0,0 +1,2 @@ +hijacked +hijacked diff --git a/tests/disabled/macro/run/macroPlugins-macroRuntime/Macros_2.scala b/tests/disabled/macro/run/macroPlugins-macroRuntime/Macros_2.scala new file mode 100644 index 000000000..b19b8f18d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroRuntime/Macros_2.scala @@ -0,0 +1,11 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context)(arg: c.Tree) = { + import c.universe._ + q"""println($arg)""" + } + + def foo(arg: String): Unit = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroRuntime/Plugin_1.scala b/tests/disabled/macro/run/macroPlugins-macroRuntime/Plugin_1.scala new file mode 100644 index 000000000..a55adadb4 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroRuntime/Plugin_1.scala @@ -0,0 +1,20 @@ +package macroRuntime + +import scala.tools.nsc.Global +import scala.tools.nsc.plugins.{Plugin => NscPlugin} + +class Plugin(val global: Global) extends NscPlugin { + import global._ + import analyzer._ + + val name = "macroRuntime" + val description = "A sample analyzer plugin that overrides macroRuntime." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsMacroRuntime(expandee: Tree): Option[MacroRuntime] = Some({ + case MacroArgs(_, List(msg)) => q"""println("hijacked")""" + }) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroRuntime/Test_3.flags b/tests/disabled/macro/run/macroPlugins-macroRuntime/Test_3.flags new file mode 100644 index 000000000..966df731d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroRuntime/Test_3.flags @@ -0,0 +1 @@ +-Xplugin:. \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroRuntime/Test_3.scala b/tests/disabled/macro/run/macroPlugins-macroRuntime/Test_3.scala new file mode 100644 index 000000000..8d3be78bb --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroRuntime/Test_3.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo("1") + Macros.foo("2") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-macroRuntime/scalac-plugin.xml b/tests/disabled/macro/run/macroPlugins-macroRuntime/scalac-plugin.xml new file mode 100644 index 000000000..8001af105 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-macroRuntime/scalac-plugin.xml @@ -0,0 +1,4 @@ + + macro-runtime + macroRuntime.Plugin + \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-namerHooks.check b/tests/disabled/macro/run/macroPlugins-namerHooks.check new file mode 100644 index 000000000..c2db5935d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-namerHooks.check @@ -0,0 +1,45 @@ +enterSym(package { case class C extends scala.Product with scala.Serializable { val x: Int = _; val y: Int = _; def (x: Int, y: Int) = { super.(); () } } }) +enterSym(case class C extends scala.Product with scala.Serializable { val x: Int = _; val y: Int = _; def (x: Int, y: Int) = { super.(); () } }) +ensureCompanionObject(case class C extends scala.Product with scala.Serializable { val x: Int = _; val y: Int = _; def (x: Int, y: Int) = { super.(); () } }, ...) +enterSym( object C extends runtime.this.AbstractFunction2[Int, Int, C] { def () = { super.(); () }; final override def toString() = "C" }) +enterStat(case class C extends scala.Product with scala.Serializable { val x: Int = _; val y: Int = _; def (x: Int, y: Int) = { super.(); () } }) +enterSym( val x: Int = _) +enterSym( val y: Int = _) +enterSym(def (x: Int, y: Int) = { super.(); () }) +enterSym( def copy(x = x, y = y) = new C(x, y)) +enterStat( private[this] val x: Int = _) +enterStat( private[this] val y: Int = _) +enterStat(def (x: Int, y: Int) = { super.(); () }) +enterSym( private[this] val x: Int = _) +enterSym( private[this] val y: Int = _) +enterSym(def (x: Int, y: Int) = { super.(); () }) +enterSym(super.()) +enterStat(super.()) +enterSym( def copy$default$1 = x) +enterSym( def copy$default$2 = y) +enterSym( var acc: Int = -889275714) +enterSym(acc = Statics.this.mix(acc, x)) +enterSym(acc = Statics.this.mix(acc, y)) +enterStat( var acc: Int = -889275714) +enterStat(acc = Statics.this.mix(acc, x)) +enterStat(acc = Statics.this.mix(acc, y)) +enterSym( val C$1: C = x$1.asInstanceOf[C]) +enterStat( val C$1: C = x$1.asInstanceOf[C]) +enterSym(def () = { super.(); () }) +enterSym(final override def toString() = "C") +enterSym(case def apply(x: Int, y: Int): C = new C(x, y)) +enterSym(case def unapply(x$0: C) = if (x$0.==(null)) scala.this.None else Some(scala.Tuple2(x$0.x, x$0.y))) +enterStat(def () = { super.(); () }) +enterStat(final override def toString() = "C") +enterSym(def () = { super.(); () }) +enterSym(final override def toString() = "C") +enterSym(super.()) +enterStat(super.()) +enterSym(case val x1: Int = x$1) +enterStat(case val x1: Int = x$1) +enterSym(case val x1: Any = x$1) +enterSym(case5(){ if (x1.isInstanceOf[C]) matchEnd4(true) else case6() }) +enterSym(case6(){ matchEnd4(false) }) +enterStat(case val x1: Any = x$1) +enterStat(case5(){ if (x1.isInstanceOf[C]) matchEnd4(true) else case6() }) +enterStat(case6(){ matchEnd4(false) }) diff --git a/tests/disabled/macro/run/macroPlugins-namerHooks.scala b/tests/disabled/macro/run/macroPlugins-namerHooks.scala new file mode 100644 index 000000000..302429b19 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-namerHooks.scala @@ -0,0 +1,39 @@ +import scala.tools.partest._ +import scala.tools.nsc._ + +object Test extends DirectTest { + override def extraSettings: String = "-usejavacp" + + def code = """ + case class C(x: Int, y: Int) + """.trim + + def show() { + val global = newCompiler() + import global._ + import analyzer._ + + val output = collection.mutable.ListBuffer[String]() + def log(what: String) = output += what.replace(String.format("%n"), " ") + + object macroPlugin extends MacroPlugin { + override def pluginsEnterSym(namer: Namer, tree: Tree): Boolean = { + log(s"enterSym($tree)") + namer.standardEnterSym(tree) + true + } + override def pluginsEnsureCompanionObject(namer: Namer, cdef: ClassDef, creator: ClassDef => Tree = companionModuleDef(_)): Option[Symbol] = { + log(s"ensureCompanionObject($cdef, ...)") + Some(namer.standardEnsureCompanionObject(cdef, creator)) + } + override def pluginsEnterStats(typer: Typer, stats: List[Tree]): List[Tree] = { + stats.foreach(stat => log(s"enterStat($stat)")) + stats + } + } + + addMacroPlugin(macroPlugin) + compileString(global)(code) + println(output.mkString("\n")) + } +} diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody.check b/tests/disabled/macro/run/macroPlugins-typedMacroBody.check new file mode 100644 index 000000000..b6f843618 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody.check @@ -0,0 +1,2 @@ +impl1 +impl2 diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody.flags b/tests/disabled/macro/run/macroPlugins-typedMacroBody.flags new file mode 100644 index 000000000..ea7fc37e1 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody.flags @@ -0,0 +1 @@ +-Yrangepos:false diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.flags b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.flags new file mode 100644 index 000000000..966df731d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.flags @@ -0,0 +1 @@ +-Xplugin:. \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.scala b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.scala new file mode 100644 index 000000000..80acfec65 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl1(c: Context) = { + import c.universe._ + q"""println("impl1")""" + } + + def impl2(c: Context) = { + import c.universe._ + q"""println("impl2")""" + } + + def foo1: Unit = macro 1 + + def foo2: Unit = macro 2 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/Plugin_1.scala b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Plugin_1.scala new file mode 100644 index 000000000..e99cf7f75 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Plugin_1.scala @@ -0,0 +1,21 @@ +package typedMacroBody + +import scala.tools.nsc.Global +import scala.tools.nsc.plugins.{Plugin => NscPlugin} + +class Plugin(val global: Global) extends NscPlugin { + import global._ + import analyzer._ + + val name = "typedMacroBody" + val description = "A sample analyzer plugin that overrides typedMacroBody." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsTypedMacroBody(typer: Typer, ddef: DefDef): Option[Tree] = { + val DefDef(_, _, _, _, _, Literal(Constant(num: Int))) = ddef + Some(standardTypedMacroBody(typer, copyDefDef(ddef)(rhs = Ident(TermName("impl" + num))))) + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/Test_3.scala b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Test_3.scala new file mode 100644 index 000000000..a730821f2 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Test_3.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo1 + Macros.foo2 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/scalac-plugin.xml b/tests/disabled/macro/run/macroPlugins-typedMacroBody/scalac-plugin.xml new file mode 100644 index 000000000..e223fa5dc --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/scalac-plugin.xml @@ -0,0 +1,4 @@ + + typed-macro-body + typedMacroBody.Plugin + \ No newline at end of file diff --git a/tests/disabled/macro/run/reflection-magicsymbols-invoke.check b/tests/disabled/macro/run/reflection-magicsymbols-invoke.check new file mode 100644 index 000000000..f580296ae --- /dev/null +++ b/tests/disabled/macro/run/reflection-magicsymbols-invoke.check @@ -0,0 +1,119 @@ +============ +Any +it's important to print the list of Any's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +method !=: (x$1: Any)Boolean +method ##: ()Int +method ==: (x$1: Any)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toString: ()java.lang.String +testing Any.!=: false +testing Any.##: 50 +testing Any.==: true +testing Any.asInstanceOf: class scala.ScalaReflectionException: Any.asInstanceOf requires a type argument, it cannot be invoked with mirrors +testing Any.asInstanceOf: class scala.ScalaReflectionException: final def asInstanceOf[T0]: T0 takes 0 arguments +testing Any.equals: true +testing Any.getClass: class java.lang.String +testing Any.hashCode: 50 +testing Any.isInstanceOf: class scala.ScalaReflectionException: Any.isInstanceOf requires a type argument, it cannot be invoked with mirrors +testing Any.isInstanceOf: class scala.ScalaReflectionException: final def isInstanceOf[T0]: Boolean takes 0 arguments +testing Any.toString: 2 +============ +AnyVal +it's important to print the list of AnyVal's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor AnyVal: ()AnyVal +method getClass: ()Class[_ <: AnyVal] +testing AnyVal.: class scala.ScalaReflectionException: unsupported symbol constructor AnyVal when invoking bytecodeless method mirror for def (): AnyVal (bound to null) +testing AnyVal.getClass: class scala.ScalaReflectionException: expected a member of class Integer, you provided method scala.AnyVal.getClass +============ +AnyRef +it's important to print the list of AnyRef's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Object: ()java.lang.Object +method !=: (x$1: Any)Boolean +method ##: ()Int +method $asInstanceOf: [T0]()T0 +method $isInstanceOf: [T0]()Boolean +method ==: (x$1: Any)Boolean +method asInstanceOf: [T0]=> T0 +method clone: ()java.lang.Object +method eq: (x$1: AnyRef)Boolean +method equals: (x$1: Any)Boolean +method finalize: ()Unit +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method ne: (x$1: AnyRef)Boolean +method notify: ()Unit +method notifyAll: ()Unit +method synchronized: [T0](x$1: T0)T0 +method toString: ()java.lang.String +method wait: ()Unit +method wait: (x$1: Long)Unit +method wait: (x$1: Long, x$2: Int)Unit +testing Object.!=: false +testing Object.##: 50 +testing Object.$asInstanceOf: class scala.ScalaReflectionException: AnyRef.$asInstanceOf is an internal method, it cannot be invoked with mirrors +testing Object.$asInstanceOf: class scala.ScalaReflectionException: final def $asInstanceOf[T0](): T0 takes 0 arguments +testing Object.$isInstanceOf: class scala.ScalaReflectionException: AnyRef.$isInstanceOf is an internal method, it cannot be invoked with mirrors +testing Object.$isInstanceOf: class scala.ScalaReflectionException: final def $isInstanceOf[T0](): Boolean takes 0 arguments +testing Object.==: true +testing Object.clone: class java.lang.CloneNotSupportedException: java.lang.String +testing Object.eq: true +testing Object.equals: true +testing Object.finalize: () +testing Object.getClass: class java.lang.String +testing Object.hashCode: 50 +testing Object.ne: false +testing Object.notify: class java.lang.IllegalMonitorStateException: null +testing Object.notifyAll: class java.lang.IllegalMonitorStateException: null +testing Object.synchronized: 2 +testing Object.toString: 2 +TODO: also test AnyRef.wait overloads +============ +Array +it's important to print the list of Array's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Array: (_length: Int)Array[T] +method !=: (x$1: Any)Boolean +method ##: ()Int +method $asInstanceOf: [T0]()T0 +method $isInstanceOf: [T0]()Boolean +method ==: (x$1: Any)Boolean +method apply: (i: Int)T +method asInstanceOf: [T0]=> T0 +method clone: ()Array[T] +method eq: (x$1: AnyRef)Boolean +method equals: (x$1: Any)Boolean +method finalize: ()Unit +method getClass: ()java.lang.Class[_] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method length: => Int +method ne: (x$1: AnyRef)Boolean +method notify: ()Unit +method notifyAll: ()Unit +method synchronized: [T0](x$1: T0)T0 +method toString: ()java.lang.String +method update: (i: Int, x: T)Unit +method wait: ()Unit +method wait: (x$1: Long)Unit +method wait: (x$1: Long, x$2: Int)Unit +value _length: Int +testing Array.length: 2 +testing Array.apply: 1 +testing Array.update: () +testing Array.clone: List(1, 2) +============ +Other +testing String.+: 23 +============ +CTM +testing Predef.classOf: class scala.ScalaReflectionException: Predef.classOf is a compile-time function, it cannot be invoked with mirrors +testing Predef.classOf: class scala.ScalaReflectionException: def classOf[T]: Class[T] takes 0 arguments +testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.api.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors diff --git a/tests/disabled/macro/run/reflection-magicsymbols-invoke.scala b/tests/disabled/macro/run/reflection-magicsymbols-invoke.scala new file mode 100644 index 000000000..bbcf8f524 --- /dev/null +++ b/tests/disabled/macro/run/reflection-magicsymbols-invoke.scala @@ -0,0 +1,100 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe.definitions._ +import scala.reflect.runtime.{currentMirror => cm} + +package scala { + object ExceptionUtils { + def unwrapThrowable(ex: Throwable): Throwable = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + } +} + +object Test extends dotty.runtime.LegacyApp { + def key(sym: Symbol) = sym + ": " + sym.info + def test(tpe: Type, receiver: Any, method: String, args: Any*): Unit = { + def wrap[T](op: => T) = + try { + var result = op.asInstanceOf[AnyRef] + if (scala.runtime.ScalaRunTime.isArray(result)) + result = scala.runtime.ScalaRunTime.toObjectArray(result).toList + println(result) + } catch { + case ex: Throwable => + val realex = scala.ExceptionUtils.unwrapThrowable(ex) + println(realex.getClass + ": " + realex.getMessage) + } + print(s"testing ${tpe.typeSymbol.name}.$method: ") + wrap({ + if (method == termNames.CONSTRUCTOR.toString) { + val ctor = tpe.decl(termNames.CONSTRUCTOR).asMethod + cm.reflectClass(ctor.owner.asClass).reflectConstructor(ctor)(args: _*) + } else { + val meth = tpe.decl(TermName(method).encodedName.toTermName).asMethod + cm.reflect(receiver).reflectMethod(meth)(args: _*) + } + }) + } + + println("============\nAny") + println("it's important to print the list of Any's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[Any].members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[Any], "2", "!=", "2") + test(typeOf[Any], "2", "##") + test(typeOf[Any], "2", "==", "2") + test(typeOf[Any], "2", "asInstanceOf") + test(typeOf[Any], "2", "asInstanceOf", typeOf[String]) + test(typeOf[Any], "2", "equals", "2") + test(typeOf[Any], "2", "getClass") + test(typeOf[Any], "2", "hashCode") + test(typeOf[Any], "2", "isInstanceOf") + test(typeOf[Any], "2", "isInstanceOf", typeOf[String]) + test(typeOf[Any], "2", "toString") + + println("============\nAnyVal") + println("it's important to print the list of AnyVal's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[AnyVal].decls.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[AnyVal], null, termNames.CONSTRUCTOR.toString) + test(typeOf[AnyVal], 2, "getClass") + + println("============\nAnyRef") + println("it's important to print the list of AnyRef's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[AnyRef].members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[AnyRef], "2", "!=", "2") + test(typeOf[AnyRef], "2", "##") + test(typeOf[AnyRef], "2", "$asInstanceOf") + test(typeOf[AnyRef], "2", "$asInstanceOf", typeOf[String]) + test(typeOf[AnyRef], "2", "$isInstanceOf") + test(typeOf[AnyRef], "2", "$isInstanceOf", typeOf[String]) + test(typeOf[AnyRef], "2", "==", "2") + test(typeOf[AnyRef], "2", "clone") + test(typeOf[AnyRef], "2", "eq", "2") + test(typeOf[AnyRef], "2", "equals", "2") + test(typeOf[AnyRef], "2", "finalize") + test(typeOf[AnyRef], "2", "getClass") + test(typeOf[AnyRef], "2", "hashCode") + test(typeOf[AnyRef], "2", "ne", "2") + test(typeOf[AnyRef], "2", "notify") + test(typeOf[AnyRef], "2", "notifyAll") + test(typeOf[AnyRef], "2", "synchronized", "2") + test(typeOf[AnyRef], "2", "toString") + println("TODO: also test AnyRef.wait overloads") + + println("============\nArray") + println("it's important to print the list of Array's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + ArrayClass.info.members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(ArrayClass.info, Array(1, 2), "length") + test(ArrayClass.info, Array(1, 2), "apply", 0) + test(ArrayClass.info, Array(1, 2), "update", 0, 0) + test(ArrayClass.info, Array(1, 2), "clone") + + println("============\nOther") + test(typeOf[String], "2", "+", 3) + + println("============\nCTM") + test(PredefModule.moduleClass.info, Predef, "classOf") + test(PredefModule.moduleClass.info, Predef, "classOf", typeOf[String]) + test(typeOf[scala.reflect.api.Universe], scala.reflect.runtime.universe, "reify", "2") +} diff --git a/tests/disabled/macro/run/reify-each-node-type.check b/tests/disabled/macro/run/reify-each-node-type.check new file mode 100644 index 000000000..afc65add7 --- /dev/null +++ b/tests/disabled/macro/run/reify-each-node-type.check @@ -0,0 +1,35 @@ + 1 s Ident + 2 r.List Select + 3 r.List.apply() Apply + 4 r.List.apply(1) Literal + 5 r.List.apply[Int]() TypeApply + 6 (1: Int) Typed + 7 (null: r.List[Int]) AppliedTypeTree + 8 { (); () } Block + 9 { val x: Int = 0; () } ValDef +10 { val x = 0; () } TypeTree +11 if (true) () else () If +12 { def f: Unit = (); () } DefDef +13 { def m = NN.super.q; () } Super +14 { abstract trait A extends AnyRef; () } ClassDef Template +15 { def f(x: Any): Unit = (); () } EmptyTree +16 (null: r.D with r.E) CompoundTypeTree +17 { type T = Int; () } TypeDef +18 { type CC[T <: r.D] = r.C[T]; () } TypeBoundsTree +19 try { 0 } finally Predef.println("") Try +20 ((x: Int) => x) Function +21 { var v = 1; v = 2 } Assign +22 { class A extends AnyRef { def () = { super.(); This +23 new r.List[Int]() New +24 0: @unchecked Annotated +25 (null: r.Outer#Inner) SelectFromTypeTree +26 (null: Nil.type) SingletonTypeTree +27 (null: T forSome { type T }) ExistentialTypeTree +28 { import r.{A, B=>C}; () } Import +29 { def f: Int = return 0; () } Return +30 { object x extends AnyRef { def () = { super.(); ModuleDef +31 throw new Exception() Throw +32 0 match { case _ => 0 } Match CaseDef +33 0 match { case (1| 2) => 0 } Alternative +34 NN.q match { case (x @ r.List) => 0 } Bind +35 NN.q match { case r.UnSeq(1, (_)*) => 0 } Star diff --git a/tests/disabled/macro/run/reify-each-node-type.scala b/tests/disabled/macro/run/reify-each-node-type.scala new file mode 100644 index 000000000..43d32e59d --- /dev/null +++ b/tests/disabled/macro/run/reify-each-node-type.scala @@ -0,0 +1,110 @@ + +import scala.language.{ existentials, postfixOps } +import scala.reflect.runtime.universe._ + +object r { + class A + class B + class List[+A] + object List { def apply[A](xs: A*): List[A] = new List[A] } + object Nil extends List[Nothing] + + trait OuterP[A] { + trait Inner + trait InnerP[B] + } + trait Outer { + trait Inner + trait InnerP[B] + } + object Un { def unapply(x: Any) = Some(5) } + object UnSeq { def unapplySeq(x: Any) = Some(Seq(5)) } + class C[T] + class D + trait E + + trait SN { + def q: Any = null + } +} + +object s { + import r._ + + trait NN extends SN { + def act[T](expr: Expr[T]): Unit + + act(reify { s /* Ident */ }) + act(reify { r.List /* Select */ }) + act(reify { List() /* Apply */ }) + act(reify { List(1) /* Literal */ }) + act(reify { List[Int]() /* TypeApply */ }) + act(reify { 1: Int /* Typed */ }) + act(reify { null: List[Int] /* AppliedTypeTree */ }) + act(reify { () ; () /* Block */ }) + act(reify { val x: Int = 0 /* ValDef */ }) + act(reify { val x = 0 /* TypeTree */ }) + act(reify { if (true) () /* If */ }) + act(reify { def f: Unit = { } /* DefDef */ }) + act(reify { def m = super.q /* Super */ }) + act(reify { trait A /* ClassDef Template */ }) + act(reify { def f(x: Any): Unit = { } /* EmptyTree */ }) + act(reify { null: D with E /* CompoundTypeTree */ }) + act(reify { type T = Int /* TypeDef */ }) + act(reify { type CC[T <: D] = C[T] /* TypeBoundsTree */ }) + act(reify { try 0 finally println("") /* Try */ }) + act(reify { (x: Int) => x /* Function */ }) + act(reify { var v = 1 ; v = 2 /* Assign */ }) + act(reify { class A() { def this(x: A) = this() } /* This */ }) + act(reify { new List[Int] /* New */ }) + act(reify { 0: @unchecked /* Annotated */ }) + act(reify { null: Outer#Inner /* SelectFromTypeTree */ }) + act(reify { null: Nil.type /* SingletonTypeTree */ }) + act(reify { null: (T forSome { type T }) /* ExistentialTypeTree */ }) + act(reify { import r.{ A, B => C }; /* Import */ }) + act(reify { def f: Int = return 0 /* Return */ }) + act(reify { object x /* ModuleDef */ }) + act(reify { throw new java.lang.Exception /* Throw */ }) + act(reify { 0 match { case _ => 0 } /* Match CaseDef */ }) + act(reify { 0 match { case 1 | 2 => 0 } /* Alternative */ }) + act(reify { q match { case x @ List => 0 } /* Bind */ }) + act(reify { q match { case UnSeq(1, _*) => 0 } /* Star */ }) + + // ``unexpected: bound type that doesn't have a tpe: Ident(newTypeName("Int"))'' + // act(reify { r.List[T forSome { type T <: Int }]() }) // Was crashing , no longer + // + // error: exception during macro expansion: + // scala.MatchError: collection.this.Seq.unapplySeq[A] (of class scala.reflect.internal.Trees$TypeApply) + // at scala.reflect.reify.phases.Reshape$$anon$1.extractExtractor$1(Reshape.scala:73) + // at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:82) + // at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:24) + // at scala.reflect.internal.Trees$class.itransform(Trees.scala:1290) + // + // act(reify { r.List[Any]() match { case Seq(1, _*) => 1 } } ) + + // act(reify { List[OuterP[Int]#InnerP[Byte]]() }) + // + // SI-7243 + // + // test/files/run/reify-each-node-type.scala:85: error: Cannot materialize r.List.apply[r.OuterP[Int]#InnerP[Byte]]() as { ... } because: + // scala.reflect.macros.TypecheckException: value TypeTreeWithDeferredRefCheck is not a member of type parameter U + // act(reify { List[OuterP[Int]#InnerP[Byte]]() }) + // ^ + // one error found + } +} + +object Test { + var idx = 0 + val seen = scala.collection.mutable.Set[String]() + + object N extends s.NN { + def act[T](expr: Expr[T]): Unit = { + idx += 1 + val ts = expr.tree filter (_ => true) map (_.getClass.getName split "[.$]" last) filterNot seen distinct; + println("%2d %60s %s".format(idx, expr.tree.toString.replaceAll("""\s+""", " ").take(60), ts mkString " ")) + seen ++= ts + } + } + def main(args: Array[String]): Unit = N +} diff --git a/tests/disabled/macro/run/reify-repl-fail-gracefully.check b/tests/disabled/macro/run/reify-repl-fail-gracefully.check new file mode 100644 index 000000000..c9e69744d --- /dev/null +++ b/tests/disabled/macro/run/reify-repl-fail-gracefully.check @@ -0,0 +1,17 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import language.experimental.macros +import language.experimental.macros + +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ + +scala> + +scala> reify +:12: error: too few argument lists for macro invocation + reify + ^ + +scala> :quit diff --git a/tests/disabled/macro/run/reify-repl-fail-gracefully.scala b/tests/disabled/macro/run/reify-repl-fail-gracefully.scala new file mode 100644 index 000000000..ed6d6cb6c --- /dev/null +++ b/tests/disabled/macro/run/reify-repl-fail-gracefully.scala @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |import language.experimental.macros + |import scala.reflect.runtime.universe._ + | + |reify + """.stripMargin +} diff --git a/tests/disabled/macro/run/reify-staticXXX.check b/tests/disabled/macro/run/reify-staticXXX.check new file mode 100644 index 000000000..37102b29e --- /dev/null +++ b/tests/disabled/macro/run/reify-staticXXX.check @@ -0,0 +1,24 @@ +object +object +class +class +object > object +object > object +object > class +object > class +package > object +package > object +package > class +package > class +object +object +class +class +object > object +object > object +object > class +object > class +package > object +package > object +package > class +package > class diff --git a/tests/disabled/macro/run/reify-staticXXX.scala b/tests/disabled/macro/run/reify-staticXXX.scala new file mode 100644 index 000000000..cfbd756ec --- /dev/null +++ b/tests/disabled/macro/run/reify-staticXXX.scala @@ -0,0 +1,56 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object B { override def toString = "object" } +class C { override def toString = "class" } + +package foo1 { + object B { override def toString = "package > object" } + class C { override def toString = "package > class" } +} + +object Foo2 { + object B { override def toString = "object > object" } + class C { override def toString = "object > class" } +} + +object packageless { + def test = { + println(B) + println(reify(B).eval) + println(new C) + println(reify(new C).eval) + println(Foo2.B) + println(reify(Foo2.B).eval) + println(new Foo2.C) + println(reify(new Foo2.C).eval) + println(_root_.foo1.B) + println(reify(_root_.foo1.B).eval) + println(new _root_.foo1.C) + println(reify(new _root_.foo1.C).eval) + } +} + +package packageful { + object Test { + def test = { + println(B) + println(reify(B).eval) + println(new C) + println(reify(new C).eval) + println(Foo2.B) + println(reify(Foo2.B).eval) + println(new Foo2.C) + println(reify(new Foo2.C).eval) + println(_root_.foo1.B) + println(reify(_root_.foo1.B).eval) + println(new _root_.foo1.C) + println(reify(new _root_.foo1.C).eval) + } + } +} + +object Test extends dotty.runtime.LegacyApp { + packageless.test + packageful.Test.test +} diff --git a/tests/disabled/macro/run/reify_ann1a.check b/tests/disabled/macro/run/reify_ann1a.check new file mode 100644 index 000000000..71841ff83 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann1a.check @@ -0,0 +1,30 @@ +{ + @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T] extends AnyRef { + @new ann(List.apply("3a")) @new ann(List.apply("3b")) private[this] val x: T @ann(List.apply("4a")) @ann(List.apply("4b")) = _; + def (@new ann(List.apply("3a")) @new ann(List.apply("3b")) x: T @ann(List.apply("4a")) @ann(List.apply("4b"))) = { + super.(); + () + }; + @new ann(List.apply("5a")) @new ann(List.apply("5b")) def f(x: Int @ann(List.apply("6a")) @ann(List.apply("6b"))) = { + @new ann(List.apply("7a")) @new ann(List.apply("7b")) val r = x.$plus(3): @ann(List.apply("8a")): @ann(List.apply("8b")); + val s = (4: Int @ann(List.apply("9a")) @ann(List.apply("9b"))); + r.$plus(s) + } + }; + () +} +{ + @ann(List.apply[String]("1a")) @ann(List.apply[String]("1b")) class C[@ann(List.apply[String]("2a")) @ann(List.apply[String]("2b")) T] extends AnyRef { + @ann(List.apply[String]("3a")) @ann(List.apply[String]("3b")) private[this] val x: T @ann(List.apply[String]("4b")) @ann(List.apply[String]("4a")) = _; + def (@ann(List.apply[String]("3a")) @ann(List.apply[String]("3b")) x: T @ann(List.apply[String]("4b")) @ann(List.apply[String]("4a"))): C[T] = { + C.super.(); + () + }; + @ann(List.apply[String]("5a")) @ann(List.apply[String]("5b")) def f(x: Int @ann(List.apply[String]("6b")) @ann(List.apply[String]("6a"))): Int = { + @ann(List.apply[String]("7a")) @ann(List.apply[String]("7b")) val r: Int @ann(List.apply[String]("8b")) @ann(List.apply[String]("8a")) = ((x.+(3): Int @ann(List.apply[String]("8a"))): Int @ann(List.apply[String]("8b")) @ann(List.apply[String]("8a"))); + val s: Int @ann(List.apply[String]("9b")) @ann(List.apply[String]("9a")) = (4: Int @ann(List.apply[String]("9b")) @ann(List.apply[String]("9a"))); + r.+(s) + } + }; + () +} diff --git a/tests/disabled/macro/run/reify_ann1a.scala b/tests/disabled/macro/run/reify_ann1a.scala new file mode 100644 index 000000000..9252ddcf7 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann1a.scala @@ -0,0 +1,28 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +class ann(bar: List[String]) extends annotation.StaticAnnotation + +object Test extends dotty.runtime.LegacyApp { + // test 1: reify + 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")) + 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 = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/reify_ann1b.check b/tests/disabled/macro/run/reify_ann1b.check new file mode 100644 index 000000000..a046dafea --- /dev/null +++ b/tests/disabled/macro/run/reify_ann1b.check @@ -0,0 +1,35 @@ +reify_ann1b.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String) extends annotation.ClassfileAnnotation + ^ +{ + @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T] extends 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 = "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 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) + } + }; + () +} diff --git a/tests/disabled/macro/run/reify_ann1b.scala b/tests/disabled/macro/run/reify_ann1b.scala new file mode 100644 index 000000000..d3c6a4da3 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann1b.scala @@ -0,0 +1,28 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +class ann(bar: String) extends annotation.ClassfileAnnotation + +object Test extends dotty.runtime.LegacyApp { + // test 1: reify + 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") + val s = 4: Int @ann(bar="9a") @ann(bar="9b") + r + s + } + } + }.tree + println(tree.toString) + + // test 2: import and typecheck + val toolbox = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/reify_ann2a.check b/tests/disabled/macro/run/reify_ann2a.check new file mode 100644 index 000000000..a26fa4204 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann2a.check @@ -0,0 +1,44 @@ +{ + class ann extends StaticAnnotation { + private[this] val bar: `package`.List[Predef.String] = _; + def (bar: `package`.List[Predef.String]) = { + super.(); + () + } + }; + @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T] extends AnyRef { + @new ann(List.apply("3a")) @new ann(List.apply("3b")) private[this] val x: T @ann(List.apply("4a")) @ann(List.apply("4b")) = _; + def (@new ann(List.apply("3a")) @new ann(List.apply("3b")) x: T @ann(List.apply("4a")) @ann(List.apply("4b"))) = { + super.(); + () + }; + @new ann(List.apply("5a")) @new ann(List.apply("5b")) def f(x: Int @ann(List.apply("6a")) @ann(List.apply("6b"))) = { + @new ann(List.apply("7a")) @new ann(List.apply("7b")) val r = x.$plus(3): @ann(List.apply("8a")): @ann(List.apply("8b")); + val s = (4: Int @ann(List.apply("9a")) @ann(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(List.apply[String]("1a")) @ann(List.apply[String]("1b")) class C[@ann(List.apply[String]("2a")) @ann(List.apply[String]("2b")) T] extends AnyRef { + @ann(List.apply[String]("3a")) @ann(List.apply[String]("3b")) private[this] val x: T @ann(List.apply[String]("4b")) @ann(List.apply[String]("4a")) = _; + def (@ann(List.apply[String]("3a")) @ann(List.apply[String]("3b")) x: T @ann(List.apply[String]("4b")) @ann(List.apply[String]("4a"))): C[T] = { + C.super.(); + () + }; + @ann(List.apply[String]("5a")) @ann(List.apply[String]("5b")) def f(x: Int @ann(List.apply[String]("6b")) @ann(List.apply[String]("6a"))): Int = { + @ann(List.apply[String]("7a")) @ann(List.apply[String]("7b")) val r: Int @ann(List.apply[String]("8b")) @ann(List.apply[String]("8a")) = ((x.+(3): Int @ann(List.apply[String]("8a"))): Int @ann(List.apply[String]("8b")) @ann(List.apply[String]("8a"))); + val s: Int @ann(List.apply[String]("9b")) @ann(List.apply[String]("9a")) = (4: Int @ann(List.apply[String]("9b")) @ann(List.apply[String]("9a"))); + r.+(s) + } + }; + () +} diff --git a/tests/disabled/macro/run/reify_ann2a.scala b/tests/disabled/macro/run/reify_ann2a.scala new file mode 100644 index 000000000..861cb6297 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann2a.scala @@ -0,0 +1,28 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + // test 1: reify + val tree = reify{ + class ann(bar: List[String]) extends annotation.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 = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/reify_ann3.check b/tests/disabled/macro/run/reify_ann3.check new file mode 100644 index 000000000..4f1c61cf0 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann3.check @@ -0,0 +1,21 @@ +{ + class Tree[A, +B] extends AnyRef { + @new inline @getter() final val key: A = _; + def (key: A) = { + super.(); + () + } + }; + () +} +{ + class Tree[A, +B] extends AnyRef { + 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/tests/disabled/macro/run/reify_ann3.scala b/tests/disabled/macro/run/reify_ann3.scala new file mode 100644 index 000000000..7eadd569b --- /dev/null +++ b/tests/disabled/macro/run/reify_ann3.scala @@ -0,0 +1,22 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.annotation._ +import scala.annotation.meta._ + +object Test extends dotty.runtime.LegacyApp { + // 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 = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/reify_ann4.check b/tests/disabled/macro/run/reify_ann4.check new file mode 100644 index 000000000..8bf5fe324 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann4.check @@ -0,0 +1,32 @@ +{ + class D extends StaticAnnotation { + def () = { + super.(); + () + } + }; + class C extends AnyRef { + def () = { + super.(); + () + } + }; + val c1 = new C @D(); + () +} +{ + class D extends scala.annotation.Annotation with scala.annotation.StaticAnnotation { + def (): D = { + D.super.(); + () + } + }; + class C extends AnyRef { + def (): C = { + C.super.(); + () + } + }; + val c1: C = new C @D(); + () +} diff --git a/tests/disabled/macro/run/reify_ann4.scala b/tests/disabled/macro/run/reify_ann4.scala new file mode 100644 index 000000000..074ceb815 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann4.scala @@ -0,0 +1,26 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.annotation._ +import scala.annotation.meta._ + +object Test extends dotty.runtime.LegacyApp { + // 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 = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/reify_ann5.check b/tests/disabled/macro/run/reify_ann5.check new file mode 100644 index 000000000..1ec0457e5 --- /dev/null +++ b/tests/disabled/macro/run/reify_ann5.check @@ -0,0 +1,22 @@ +{ + class C extends AnyRef { + @new inline @beanGetter() @new BeanProperty() val x: Int = _; + def (x: Int) = { + super.(); + () + } + }; + () +} +{ + class C extends AnyRef { + @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/tests/disabled/macro/run/reify_ann5.scala b/tests/disabled/macro/run/reify_ann5.scala new file mode 100644 index 000000000..84e5bda9c --- /dev/null +++ b/tests/disabled/macro/run/reify_ann5.scala @@ -0,0 +1,23 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.annotation._ +import scala.annotation.meta._ +import scala.beans._ + +object Test extends dotty.runtime.LegacyApp { + // 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 = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/reify_anonymous.check b/tests/disabled/macro/run/reify_anonymous.check new file mode 100644 index 000000000..b8626c4cf --- /dev/null +++ b/tests/disabled/macro/run/reify_anonymous.check @@ -0,0 +1 @@ +4 diff --git a/tests/disabled/macro/run/reify_anonymous.scala b/tests/disabled/macro/run/reify_anonymous.scala new file mode 100644 index 000000000..a7aad4065 --- /dev/null +++ b/tests/disabled/macro/run/reify_anonymous.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + println(new {def x = 2; def y = x * x}.y) + }.eval +} diff --git a/tests/disabled/macro/run/reify_classfileann_a.check b/tests/disabled/macro/run/reify_classfileann_a.check new file mode 100644 index 000000000..51f255b23 --- /dev/null +++ b/tests/disabled/macro/run/reify_classfileann_a.check @@ -0,0 +1,23 @@ +reify_classfileann_a.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation + ^ +{ + @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends AnyRef { + def () = { + super.(); + () + } + }; + () +} +{ + @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4")) class C extends AnyRef { + def (): C = { + C.super.(); + () + } + }; + () +} diff --git a/tests/disabled/macro/run/reify_classfileann_a.scala b/tests/disabled/macro/run/reify_classfileann_a.scala new file mode 100644 index 000000000..74546df37 --- /dev/null +++ b/tests/disabled/macro/run/reify_classfileann_a.scala @@ -0,0 +1,22 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation + +object Test extends dotty.runtime.LegacyApp { + // test 1: reify + 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 toolbox = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/reify_classfileann_b.check b/tests/disabled/macro/run/reify_classfileann_b.check new file mode 100644 index 000000000..05f2e5bfc --- /dev/null +++ b/tests/disabled/macro/run/reify_classfileann_b.check @@ -0,0 +1,25 @@ +reify_classfileann_b.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation + ^ +{ + class C extends AnyRef { + def () = { + super.(); + () + }; + def x: Int = 2: @ann(bar = "1",quux = Array("2", "3"),baz = new ann(bar = "4")) + }; + () +} +{ + class C extends AnyRef { + def (): C = { + C.super.(); + () + }; + def x: Int = (2: Int(2) @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4"))) + }; + () +} diff --git a/tests/disabled/macro/run/reify_classfileann_b.scala b/tests/disabled/macro/run/reify_classfileann_b.scala new file mode 100644 index 000000000..920d671f9 --- /dev/null +++ b/tests/disabled/macro/run/reify_classfileann_b.scala @@ -0,0 +1,26 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation + +object Test extends dotty.runtime.LegacyApp { + // 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 = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/reify_closure1.check b/tests/disabled/macro/run/reify_closure1.check new file mode 100644 index 000000000..b2f7f08c1 --- /dev/null +++ b/tests/disabled/macro/run/reify_closure1.check @@ -0,0 +1,2 @@ +10 +10 diff --git a/tests/disabled/macro/run/reify_closure1.scala b/tests/disabled/macro/run/reify_closure1.scala new file mode 100644 index 000000000..6a5684b2a --- /dev/null +++ b/tests/disabled/macro/run/reify_closure1.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + def foo[T](ys: List[T]): Int => Int = { + val fun = reify{(x: Int) => { + x + }} + + val toolbox = cm.mkToolBox() + val dyn = toolbox.eval(fun.tree) + dyn.asInstanceOf[Int => Int] + } + + println(foo(List(1, 2, 3))(10)) + println(foo(List(1, 2, 3, 4))(10)) +} diff --git a/tests/disabled/macro/run/reify_closure2a.check b/tests/disabled/macro/run/reify_closure2a.check new file mode 100644 index 000000000..c1f3abd7e --- /dev/null +++ b/tests/disabled/macro/run/reify_closure2a.check @@ -0,0 +1,2 @@ +11 +12 diff --git a/tests/disabled/macro/run/reify_closure2a.scala b/tests/disabled/macro/run/reify_closure2a.scala new file mode 100644 index 000000000..cc194bc6d --- /dev/null +++ b/tests/disabled/macro/run/reify_closure2a.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + def foo(y: Int): Int => Int = { + val fun = reify{(x: Int) => { + x + y + }} + + val toolbox = cm.mkToolBox() + val dyn = toolbox.eval(fun.tree) + dyn.asInstanceOf[Int => Int] + } + + println(foo(1)(10)) + println(foo(2)(10)) +} diff --git a/tests/disabled/macro/run/reify_closure3a.check b/tests/disabled/macro/run/reify_closure3a.check new file mode 100644 index 000000000..c1f3abd7e --- /dev/null +++ b/tests/disabled/macro/run/reify_closure3a.check @@ -0,0 +1,2 @@ +11 +12 diff --git a/tests/disabled/macro/run/reify_closure3a.scala b/tests/disabled/macro/run/reify_closure3a.scala new file mode 100644 index 000000000..0d540d1dd --- /dev/null +++ b/tests/disabled/macro/run/reify_closure3a.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + def foo(y: Int): Int => Int = { + def y1 = y + + val fun = reify{(x: Int) => { + x + y1 + }} + + val toolbox = cm.mkToolBox() + val dyn = toolbox.eval(fun.tree) + dyn.asInstanceOf[Int => Int] + } + + println(foo(1)(10)) + println(foo(2)(10)) +} diff --git a/tests/disabled/macro/run/reify_closure4a.check b/tests/disabled/macro/run/reify_closure4a.check new file mode 100644 index 000000000..c1f3abd7e --- /dev/null +++ b/tests/disabled/macro/run/reify_closure4a.check @@ -0,0 +1,2 @@ +11 +12 diff --git a/tests/disabled/macro/run/reify_closure4a.scala b/tests/disabled/macro/run/reify_closure4a.scala new file mode 100644 index 000000000..373c3b2fa --- /dev/null +++ b/tests/disabled/macro/run/reify_closure4a.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + def foo(y: Int): Int => Int = { + val y1 = y + + val fun = reify{(x: Int) => { + x + y1 + }} + + val toolbox = cm.mkToolBox() + val dyn = toolbox.eval(fun.tree) + dyn.asInstanceOf[Int => Int] + } + + println(foo(1)(10)) + println(foo(2)(10)) +} diff --git a/tests/disabled/macro/run/reify_closure5a.check b/tests/disabled/macro/run/reify_closure5a.check new file mode 100644 index 000000000..df9e19c59 --- /dev/null +++ b/tests/disabled/macro/run/reify_closure5a.check @@ -0,0 +1,2 @@ +13 +14 diff --git a/tests/disabled/macro/run/reify_closure5a.scala b/tests/disabled/macro/run/reify_closure5a.scala new file mode 100644 index 000000000..e2bd24ad2 --- /dev/null +++ b/tests/disabled/macro/run/reify_closure5a.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + def foo[T: TypeTag](ys: List[T]): Int => Int = { + val fun = reify{(x: Int) => { + x + ys.length + }} + + val toolbox = cm.mkToolBox() + val dyn = toolbox.eval(fun.tree) + dyn.asInstanceOf[Int => Int] + } + + var fun1 = foo(List(1, 2, 3)) + println(fun1(10)) + var fun2 = foo(List(1, 2, 3, 4)) + println(fun2(10)) +} diff --git a/tests/disabled/macro/run/reify_closure6.check b/tests/disabled/macro/run/reify_closure6.check new file mode 100644 index 000000000..b9de4c6ba --- /dev/null +++ b/tests/disabled/macro/run/reify_closure6.check @@ -0,0 +1,7 @@ +q = 1 +y = 1 +first invocation = 15 +q = 2 +y = 1 +second invocation = 17 +q after second invocation = 2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_closure6.scala b/tests/disabled/macro/run/reify_closure6.scala new file mode 100644 index 000000000..1c3589cdf --- /dev/null +++ b/tests/disabled/macro/run/reify_closure6.scala @@ -0,0 +1,29 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + var q = 0 + def foo[T: TypeTag](ys: List[T]): Int => Int = { + val z = 1 + var y = 0 + val fun = reify{(x: Int) => { + y += 1 + q += 1 + println("q = " + q) + println("y = " + y) + x + ys.length * z + q + y + }} + + val toolbox = cm.mkToolBox() + val dyn = toolbox.eval(fun.tree) + dyn.asInstanceOf[Int => Int] + } + + 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) +} diff --git a/tests/disabled/macro/run/reify_closure7.check b/tests/disabled/macro/run/reify_closure7.check new file mode 100644 index 000000000..bf58b52bc --- /dev/null +++ b/tests/disabled/macro/run/reify_closure7.check @@ -0,0 +1,6 @@ +q = 1 +y = 1 +first invocation = 15 +q = 2 +y = 2 +second invocation = 17 diff --git a/tests/disabled/macro/run/reify_closure7.scala b/tests/disabled/macro/run/reify_closure7.scala new file mode 100644 index 000000000..93f2f22a4 --- /dev/null +++ b/tests/disabled/macro/run/reify_closure7.scala @@ -0,0 +1,33 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + var q = 0 + var clo: Int => Int = null + def foo[T: TypeTag](ys: List[T]): Int => Int = { + val z = 1 + var y = 0 + val fun = reify{(x: Int) => { + y += 1 + q += 1 + println("q = " + q) + println("y = " + y) + x + ys.length * z + q + y + }} + + if (clo == null) { + val toolbox = cm.mkToolBox() + val dyn = toolbox.eval(fun.tree) + clo = dyn.asInstanceOf[Int => Int] + } + + clo + } + + 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/tests/disabled/macro/run/reify_closure8a.check b/tests/disabled/macro/run/reify_closure8a.check new file mode 100644 index 000000000..9a037142a --- /dev/null +++ b/tests/disabled/macro/run/reify_closure8a.check @@ -0,0 +1 @@ +10 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_closure8a.scala b/tests/disabled/macro/run/reify_closure8a.scala new file mode 100644 index 000000000..ad343dd15 --- /dev/null +++ b/tests/disabled/macro/run/reify_closure8a.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + class Foo(val y: Int) { + def fun = reify{y} + } + + val toolbox = cm.mkToolBox() + val dyn = toolbox.eval(new Foo(10).fun.tree) + val foo = dyn.asInstanceOf[Int] + println(foo) +} diff --git a/tests/disabled/macro/run/reify_closure8b.check b/tests/disabled/macro/run/reify_closure8b.check new file mode 100644 index 000000000..5d48d3ab3 --- /dev/null +++ b/tests/disabled/macro/run/reify_closure8b.check @@ -0,0 +1,3 @@ +scala.tools.reflect.ToolBoxError: reflective compilation has failed: + +value y is not a member of Test.Foo diff --git a/tests/disabled/macro/run/reify_closure8b.scala b/tests/disabled/macro/run/reify_closure8b.scala new file mode 100644 index 000000000..f28b18e01 --- /dev/null +++ b/tests/disabled/macro/run/reify_closure8b.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + // 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 = cm.mkToolBox().eval(new Foo(10).fun.tree) + val foo = dyn.asInstanceOf[Int] + println(foo) + } catch { + case ex: Throwable => + println(ex) + } +} diff --git a/tests/disabled/macro/run/reify_closures10.check b/tests/disabled/macro/run/reify_closures10.check new file mode 100644 index 000000000..fd3c81a4d --- /dev/null +++ b/tests/disabled/macro/run/reify_closures10.check @@ -0,0 +1,2 @@ +5 +5 diff --git a/tests/disabled/macro/run/reify_closures10.scala b/tests/disabled/macro/run/reify_closures10.scala new file mode 100644 index 000000000..9c486e436 --- /dev/null +++ b/tests/disabled/macro/run/reify_closures10.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val x = 2 + val y = 3 + val code = reify{println(x + y); x + y} + + val toolbox = cm.mkToolBox() + println(toolbox.eval(code.tree)) +} diff --git a/tests/disabled/macro/run/reify_complex.check b/tests/disabled/macro/run/reify_complex.check new file mode 100644 index 000000000..7df35e33a --- /dev/null +++ b/tests/disabled/macro/run/reify_complex.check @@ -0,0 +1 @@ +3.0+4.0*i diff --git a/tests/disabled/macro/run/reify_complex.scala b/tests/disabled/macro/run/reify_complex.scala new file mode 100644 index 000000000..45b72d899 --- /dev/null +++ b/tests/disabled/macro/run/reify_complex.scala @@ -0,0 +1,25 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class Complex(val re: Double, val im: Double) { + def + (that: Complex) = + new Complex(re + that.re, im + that.im) + def - (that: Complex) = + new Complex(re - that.re, im - that.im) + def * (that: Complex) = + new Complex(re * that.re - im * that.im, + re * that.im + im * that.re) + def / (that: Complex) = { + val denom = that.re * that.re + that.im * that.im + new Complex((re * that.re + im * that.im) / denom, + (im * that.re - re * that.im) / denom) + } + override def toString = + re + (if (im < 0) "-" + (-im) else "+" + im) + "*i" + } + val x = new Complex(2, 1); val y = new Complex(1, 3) + println(x + y) + }.eval +} diff --git a/tests/disabled/macro/run/reify_copypaste1.check b/tests/disabled/macro/run/reify_copypaste1.check new file mode 100644 index 000000000..b204f9c45 --- /dev/null +++ b/tests/disabled/macro/run/reify_copypaste1.check @@ -0,0 +1,2 @@ +List(1, 2) + diff --git a/tests/disabled/macro/run/reify_copypaste1.scala b/tests/disabled/macro/run/reify_copypaste1.scala new file mode 100644 index 000000000..e255403ad --- /dev/null +++ b/tests/disabled/macro/run/reify_copypaste1.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe.definitions._ +import scala.reflect.runtime.universe.Flag._ +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val stdout = System.out + val output = new java.io.ByteArrayOutputStream() + System.setOut(new java.io.PrintStream(output)) + val toolBox = currentMirror.mkToolBox(options = "-Yreify-copypaste") + val reify = Select(Select(Select(Select(Ident(ScalaPackage), TermName("reflect")), TermName("runtime")), TermName("universe")), TermName("reify")) + val reifee = Block(List(ValDef(Modifiers(LAZY), TermName("x"), TypeTree(), Apply(Ident(ListModule), List(Literal(Constant(1)), Literal(Constant(2)))))), Ident(TermName("x"))) + toolBox.eval(Apply(reify, List(reifee))) + val Block(List(tpeCopypaste, exprCopypaste @ ModuleDef(_, _, Template(_, _, (_ :: stats) :+ expr))), Literal(Constant(()))) = toolBox.parse(output.toString()) + output.reset() + toolBox.eval(Block(stats, expr)) + stdout.println(output.toString) +} diff --git a/tests/disabled/macro/run/reify_copypaste2.check b/tests/disabled/macro/run/reify_copypaste2.check new file mode 100644 index 000000000..f5c107696 --- /dev/null +++ b/tests/disabled/macro/run/reify_copypaste2.check @@ -0,0 +1 @@ +`package`.universe.reify(Test.this.x) diff --git a/tests/disabled/macro/run/reify_copypaste2.scala b/tests/disabled/macro/run/reify_copypaste2.scala new file mode 100644 index 000000000..2f9bea1fe --- /dev/null +++ b/tests/disabled/macro/run/reify_copypaste2.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val x = 2 + val outer = reify{reify{x}} + println(outer.tree) +} diff --git a/tests/disabled/macro/run/reify_csv.check b/tests/disabled/macro/run/reify_csv.check new file mode 100644 index 000000000..b56f4bb50 --- /dev/null +++ b/tests/disabled/macro/run/reify_csv.check @@ -0,0 +1,10 @@ +List(phase name, id, description) +record(parser,1,parse source into ASTs, perform simple desugaring) +record(namer,2,resolve names, attach symbols to named trees) +record(packageobjects,3,load package objects) +record(typer,4,the meat and potatoes: type the trees) +record(superaccessors,5,add super accessors in traits and nested classes) +record(pickler,6,serialize symbol tables) +record(refchecks,7,reference/override checking, translate nested objects) +record(selectiveanf,8,) +record(liftcode,9,reify trees) diff --git a/tests/disabled/macro/run/reify_csv.scala b/tests/disabled/macro/run/reify_csv.scala new file mode 100644 index 000000000..1c567c904 --- /dev/null +++ b/tests/disabled/macro/run/reify_csv.scala @@ -0,0 +1,36 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val csv = """ + | phase name; id; description + | parser; 1; parse source into ASTs, perform simple desugaring + | namer; 2; resolve names, attach symbols to named trees + |packageobjects; 3; load package objects + | typer; 4; the meat and potatoes: type the trees + |superaccessors; 5; add super accessors in traits and nested classes + | pickler; 6; serialize symbol tables + | refchecks; 7; reference/override checking, translate nested objects + | selectiveanf; 8; + | liftcode; 9; reify trees""".stripMargin.split("\n").map{_.trim()}.drop(1).toList + + val fields = csv.head.split(";").map{_.trim()}.toList + println(fields) + + reify({ + object Csv { + case class record(`phase name`: String, id: String, description: String) + + object record { + def parse(lines: List[String]) = { + lines drop(1) map { line => line.split(";", -1).toList match { + case phase$whitespace$name :: id :: description :: _ => record(phase$whitespace$name.trim(), id.trim(), description.trim()) + case _ => throw new Exception("format error") + }} + } + } + } + + Csv.record.parse(csv) foreach println + }).eval +} diff --git a/tests/disabled/macro/run/reify_extendbuiltins.check b/tests/disabled/macro/run/reify_extendbuiltins.check new file mode 100644 index 000000000..a48033a30 --- /dev/null +++ b/tests/disabled/macro/run/reify_extendbuiltins.check @@ -0,0 +1 @@ +10! = 3628800 diff --git a/tests/disabled/macro/run/reify_extendbuiltins.scala b/tests/disabled/macro/run/reify_extendbuiltins.scala new file mode 100644 index 000000000..3056db6e4 --- /dev/null +++ b/tests/disabled/macro/run/reify_extendbuiltins.scala @@ -0,0 +1,17 @@ + +import scala.language.{ implicitConversions, postfixOps } +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + def fact(n: Int): BigInt = + if (n == 0) 1 else fact(n-1) * n + class Factorizer(n: Int) { + def ! = fact(n) + } + implicit def int2fact(n: Int) = new Factorizer(n) + + println("10! = " + (10!)) + }.eval +} diff --git a/tests/disabled/macro/run/reify_for1.scala b/tests/disabled/macro/run/reify_for1.scala new file mode 100644 index 000000000..1233782ad --- /dev/null +++ b/tests/disabled/macro/run/reify_for1.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + 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) + }.eval +} diff --git a/tests/disabled/macro/run/reify_fors_newpatmat.check b/tests/disabled/macro/run/reify_fors_newpatmat.check new file mode 100644 index 000000000..eefddedc2 --- /dev/null +++ b/tests/disabled/macro/run/reify_fors_newpatmat.check @@ -0,0 +1,5 @@ +Persons over 20: John Richard +divisors(34) = List(1, 2, 17, 34) +findNums(15) = (4,1) (5,2) (6,1) (7,4) (8,3) (8,5) (9,2) (9,4) (10,1) (10,3) (10,7) (11,2) (11,6) (11,8) (12,1) (12,5) (12,7) (13,4) (13,6) (13,10) (14,3) (14,5) (14,9) +average(List(3.5, 5.0, 4.5)) = 4.333333333333333 +scalProd(List(3.5, 5.0, 4.5), List(2.0, 1.0, 3.0)) = 25.5 diff --git a/tests/disabled/macro/run/reify_fors_newpatmat.scala b/tests/disabled/macro/run/reify_fors_newpatmat.scala new file mode 100644 index 000000000..d366169a4 --- /dev/null +++ b/tests/disabled/macro/run/reify_fors_newpatmat.scala @@ -0,0 +1,101 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + object Persons { + /** A list of persons. To create a list, we use Predef.List + * which takes a variable number of arguments and constructs + * a list out of them. + */ + val persons = List( + new Person("Bob", 17), + new Person("John", 40), + new Person("Richard", 68) + ) + + /** A Person class. 'val' constructor parameters become + * public members of the class. + */ + class Person(val name: String, val age: Int) + + /** Return an iterator over persons that are older than 20. + */ + def olderThan20(xs: Seq[Person]): Iterator[String] = + olderThan20(xs.iterator) + + /** Return an iterator over persons older than 20, given + * an iterator over persons. + */ + def olderThan20(xs: Iterator[Person]): Iterator[String] = { + + // The first expression is called a 'generator' and makes + // 'p' take values from 'xs'. The second expression is + // called a 'filter' and it is a boolean expression which + // selects only persons older than 20. There can be more than + // one generator and filter. The 'yield' expression is evaluated + // for each 'p' which satisfies the filters and used to assemble + // the resulting iterator + for (p <- xs if p.age > 20) yield p.name + } + } + + /** Some functions over lists of numbers which demonstrate + * the use of for comprehensions. + */ + object Numeric { + + /** Return the divisors of n. */ + def divisors(n: Int): List[Int] = + for (i <- List.range(1, n+1) if n % i == 0) yield i + + /** Is 'n' a prime number? */ + def isPrime(n: Int) = divisors(n).length == 2 + + /** Return pairs of numbers whose sum is prime. */ + def findNums(n: Int): Iterable[(Int, Int)] = { + + // a for comprehension using two generators + for (i <- 1 until n; + j <- 1 until (i-1); + if isPrime(i + j)) yield (i, j) + } + + /** Return the sum of the elements of 'xs'. */ + def sum(xs: List[Double]): Double = + xs.foldLeft(0.0) { (x, y) => x + y } + + /** Return the sum of pairwise product of the two lists. */ + def scalProd(xs: List[Double], ys: List[Double]) = + sum(for((x, y) <- xs zip ys) yield x * y); + + /** Remove duplicate elements in 'xs'. */ + def removeDuplicates[A](xs: List[A]): List[A] = + if (xs.isEmpty) + xs + else + xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x) + } + + // import all members of object 'persons' in the current scope + import Persons._ + + print("Persons over 20:") + olderThan20(persons) foreach { x => print(" " + x) } + println + + import Numeric._ + + println("divisors(34) = " + divisors(34)) + + print("findNums(15) =") + findNums(15) foreach { x => print(" " + x) } + println + + val xs = List(3.5, 5.0, 4.5) + println("average(" + xs + ") = " + sum(xs) / xs.length) + + val ys = List(2.0, 1.0, 3.0) + println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys)) + }.eval +} diff --git a/tests/disabled/macro/run/reify_fors_oldpatmat.check b/tests/disabled/macro/run/reify_fors_oldpatmat.check new file mode 100644 index 000000000..eefddedc2 --- /dev/null +++ b/tests/disabled/macro/run/reify_fors_oldpatmat.check @@ -0,0 +1,5 @@ +Persons over 20: John Richard +divisors(34) = List(1, 2, 17, 34) +findNums(15) = (4,1) (5,2) (6,1) (7,4) (8,3) (8,5) (9,2) (9,4) (10,1) (10,3) (10,7) (11,2) (11,6) (11,8) (12,1) (12,5) (12,7) (13,4) (13,6) (13,10) (14,3) (14,5) (14,9) +average(List(3.5, 5.0, 4.5)) = 4.333333333333333 +scalProd(List(3.5, 5.0, 4.5), List(2.0, 1.0, 3.0)) = 25.5 diff --git a/tests/disabled/macro/run/reify_fors_oldpatmat.scala b/tests/disabled/macro/run/reify_fors_oldpatmat.scala new file mode 100644 index 000000000..d366169a4 --- /dev/null +++ b/tests/disabled/macro/run/reify_fors_oldpatmat.scala @@ -0,0 +1,101 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + object Persons { + /** A list of persons. To create a list, we use Predef.List + * which takes a variable number of arguments and constructs + * a list out of them. + */ + val persons = List( + new Person("Bob", 17), + new Person("John", 40), + new Person("Richard", 68) + ) + + /** A Person class. 'val' constructor parameters become + * public members of the class. + */ + class Person(val name: String, val age: Int) + + /** Return an iterator over persons that are older than 20. + */ + def olderThan20(xs: Seq[Person]): Iterator[String] = + olderThan20(xs.iterator) + + /** Return an iterator over persons older than 20, given + * an iterator over persons. + */ + def olderThan20(xs: Iterator[Person]): Iterator[String] = { + + // The first expression is called a 'generator' and makes + // 'p' take values from 'xs'. The second expression is + // called a 'filter' and it is a boolean expression which + // selects only persons older than 20. There can be more than + // one generator and filter. The 'yield' expression is evaluated + // for each 'p' which satisfies the filters and used to assemble + // the resulting iterator + for (p <- xs if p.age > 20) yield p.name + } + } + + /** Some functions over lists of numbers which demonstrate + * the use of for comprehensions. + */ + object Numeric { + + /** Return the divisors of n. */ + def divisors(n: Int): List[Int] = + for (i <- List.range(1, n+1) if n % i == 0) yield i + + /** Is 'n' a prime number? */ + def isPrime(n: Int) = divisors(n).length == 2 + + /** Return pairs of numbers whose sum is prime. */ + def findNums(n: Int): Iterable[(Int, Int)] = { + + // a for comprehension using two generators + for (i <- 1 until n; + j <- 1 until (i-1); + if isPrime(i + j)) yield (i, j) + } + + /** Return the sum of the elements of 'xs'. */ + def sum(xs: List[Double]): Double = + xs.foldLeft(0.0) { (x, y) => x + y } + + /** Return the sum of pairwise product of the two lists. */ + def scalProd(xs: List[Double], ys: List[Double]) = + sum(for((x, y) <- xs zip ys) yield x * y); + + /** Remove duplicate elements in 'xs'. */ + def removeDuplicates[A](xs: List[A]): List[A] = + if (xs.isEmpty) + xs + else + xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x) + } + + // import all members of object 'persons' in the current scope + import Persons._ + + print("Persons over 20:") + olderThan20(persons) foreach { x => print(" " + x) } + println + + import Numeric._ + + println("divisors(34) = " + divisors(34)) + + print("findNums(15) =") + findNums(15) foreach { x => print(" " + x) } + println + + val xs = List(3.5, 5.0, 4.5) + println("average(" + xs + ") = " + sum(xs) / xs.length) + + val ys = List(2.0, 1.0, 3.0) + println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys)) + }.eval +} diff --git a/tests/disabled/macro/run/reify_generic.check b/tests/disabled/macro/run/reify_generic.check new file mode 100644 index 000000000..b8626c4cf --- /dev/null +++ b/tests/disabled/macro/run/reify_generic.check @@ -0,0 +1 @@ +4 diff --git a/tests/disabled/macro/run/reify_generic.scala b/tests/disabled/macro/run/reify_generic.scala new file mode 100644 index 000000000..4221dbf6c --- /dev/null +++ b/tests/disabled/macro/run/reify_generic.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + val product = List(1, 2, 3).head * List[Any](4, 2, 0).head.asInstanceOf[Int] + println(product) + }.eval +} diff --git a/tests/disabled/macro/run/reify_generic2.check b/tests/disabled/macro/run/reify_generic2.check new file mode 100644 index 000000000..b8626c4cf --- /dev/null +++ b/tests/disabled/macro/run/reify_generic2.check @@ -0,0 +1 @@ +4 diff --git a/tests/disabled/macro/run/reify_generic2.scala b/tests/disabled/macro/run/reify_generic2.scala new file mode 100644 index 000000000..6941d9ff7 --- /dev/null +++ b/tests/disabled/macro/run/reify_generic2.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class C + val product = List(new C, new C).length * List[C](new C, new C).length + println(product) + }.eval +} diff --git a/tests/disabled/macro/run/reify_getter.check b/tests/disabled/macro/run/reify_getter.check new file mode 100644 index 000000000..5ef4ff4d0 --- /dev/null +++ b/tests/disabled/macro/run/reify_getter.check @@ -0,0 +1 @@ +evaluated = 2 diff --git a/tests/disabled/macro/run/reify_getter.scala b/tests/disabled/macro/run/reify_getter.scala new file mode 100644 index 000000000..18c9a1a32 --- /dev/null +++ b/tests/disabled/macro/run/reify_getter.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + class C { + val x = 2 + } + + new C().x + } + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_implicits-new.check b/tests/disabled/macro/run/reify_implicits-new.check new file mode 100644 index 000000000..e3aeb20f6 --- /dev/null +++ b/tests/disabled/macro/run/reify_implicits-new.check @@ -0,0 +1 @@ +x = List(1, 2, 3, 4) diff --git a/tests/disabled/macro/run/reify_implicits-new.scala b/tests/disabled/macro/run/reify_implicits-new.scala new file mode 100644 index 000000000..5ff90871a --- /dev/null +++ b/tests/disabled/macro/run/reify_implicits-new.scala @@ -0,0 +1,18 @@ + +import scala.language.{ implicitConversions, reflectiveCalls } +import scala.reflect.{ClassTag, classTag} +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + implicit def arrayWrapper[A : ClassTag](x: Array[A]) = + new { + def sort(p: (A, A) => Boolean) = { + util.Sorting.stableSort(x, p); x + } + } + val x = Array(2, 3, 1, 4) + println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) + }.eval +} diff --git a/tests/disabled/macro/run/reify_implicits-old.check b/tests/disabled/macro/run/reify_implicits-old.check new file mode 100644 index 000000000..e3aeb20f6 --- /dev/null +++ b/tests/disabled/macro/run/reify_implicits-old.check @@ -0,0 +1 @@ +x = List(1, 2, 3, 4) diff --git a/tests/disabled/macro/run/reify_implicits-old.scala b/tests/disabled/macro/run/reify_implicits-old.scala new file mode 100644 index 000000000..ccd9375d6 --- /dev/null +++ b/tests/disabled/macro/run/reify_implicits-old.scala @@ -0,0 +1,17 @@ + +import scala.language.{ implicitConversions, reflectiveCalls } +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + implicit def arrayWrapper[A : ClassManifest](x: Array[A]) = + new { + def sort(p: (A, A) => Boolean) = { + util.Sorting.stableSort(x, p); x + } + } + val x = Array(2, 3, 1, 4) + println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) + }.eval +} diff --git a/tests/disabled/macro/run/reify_inheritance.check b/tests/disabled/macro/run/reify_inheritance.check new file mode 100644 index 000000000..25bf17fc5 --- /dev/null +++ b/tests/disabled/macro/run/reify_inheritance.check @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_inheritance.scala b/tests/disabled/macro/run/reify_inheritance.scala new file mode 100644 index 000000000..f4fb49edc --- /dev/null +++ b/tests/disabled/macro/run/reify_inheritance.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class C { + def x = 2 + def y = x * x + } + + class D extends C { + override def x = 3 + } + + println(new D().y * new C().x) + }.eval +} diff --git a/tests/disabled/macro/run/reify_inner1.check b/tests/disabled/macro/run/reify_inner1.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_inner1.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_inner1.scala b/tests/disabled/macro/run/reify_inner1.scala new file mode 100644 index 000000000..bae49f910 --- /dev/null +++ b/tests/disabled/macro/run/reify_inner1.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class C { + class D { + val x = 2 + } + } + + val outer = new C() + val inner = new outer.D() + println(inner.x) + }.eval +} diff --git a/tests/disabled/macro/run/reify_inner2.check b/tests/disabled/macro/run/reify_inner2.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_inner2.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_inner2.scala b/tests/disabled/macro/run/reify_inner2.scala new file mode 100644 index 000000000..fbe54b072 --- /dev/null +++ b/tests/disabled/macro/run/reify_inner2.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class C { + object D { + val x = 2 + } + } + + val outer = new C() + val inner = outer.D + println(inner.x) + }.eval +} diff --git a/tests/disabled/macro/run/reify_inner3.check b/tests/disabled/macro/run/reify_inner3.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_inner3.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_inner3.scala b/tests/disabled/macro/run/reify_inner3.scala new file mode 100644 index 000000000..004041b7d --- /dev/null +++ b/tests/disabled/macro/run/reify_inner3.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + object C { + class D { + val x = 2 + } + } + + val outer = C + val inner = new outer.D + println(inner.x) + }.eval +} diff --git a/tests/disabled/macro/run/reify_inner4.check b/tests/disabled/macro/run/reify_inner4.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_inner4.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_inner4.scala b/tests/disabled/macro/run/reify_inner4.scala new file mode 100644 index 000000000..5292cf040 --- /dev/null +++ b/tests/disabled/macro/run/reify_inner4.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + object C { + object D { + val x = 2 + } + } + + val outer = C + val inner = outer.D + println(inner.x) + }.eval +} diff --git a/tests/disabled/macro/run/reify_lazyevaluation.check b/tests/disabled/macro/run/reify_lazyevaluation.check new file mode 100644 index 000000000..1c7f96cd9 --- /dev/null +++ b/tests/disabled/macro/run/reify_lazyevaluation.check @@ -0,0 +1,8 @@ +s = Susp(?) +evaluating... +s() = 3 +s = Susp(3) +2 + s = 5 +sl2 = Susp(?) +sl2() = Some(3) +sl2 = Susp(Some(3)) diff --git a/tests/disabled/macro/run/reify_lazyevaluation.scala b/tests/disabled/macro/run/reify_lazyevaluation.scala new file mode 100644 index 000000000..564e7f1cd --- /dev/null +++ b/tests/disabled/macro/run/reify_lazyevaluation.scala @@ -0,0 +1,61 @@ + +import scala.language.{ implicitConversions } +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + object lazyLib { + + /** Delay the evaluation of an expression until it is needed. */ + def delay[A](value: => A): Susp[A] = new SuspImpl[A](value) + + /** Get the value of a delayed expression. */ + implicit def force[A](s: Susp[A]): A = s() + + /** + * Data type of suspended computations. (The name froms from ML.) + */ + abstract class Susp[+A] extends Function0[A] + + /** + * Implementation of suspended computations, separated from the + * abstract class so that the type parameter can be invariant. + */ + class SuspImpl[A](lazyValue: => A) extends Susp[A] { + private var maybeValue: Option[A] = None + + override def apply() = maybeValue match { + case None => + val value = lazyValue + maybeValue = Some(value) + value + case Some(value) => + value + } + + override def toString() = maybeValue match { + case None => "Susp(?)" + case Some(value) => "Susp(" + value + ")" + } + } + } + + import lazyLib._ + + val s: Susp[Int] = delay { println("evaluating..."); 3 } + + println("s = " + s) // show that s is unevaluated + println("s() = " + s()) // evaluate s + println("s = " + s) // show that the value is saved + println("2 + s = " + (2 + s)) // implicit call to force() + + val sl = delay { Some(3) } + val sl1: Susp[Some[Int]] = sl + val sl2: Susp[Option[Int]] = sl1 // the type is covariant + + println("sl2 = " + sl2) + println("sl2() = " + sl2()) + println("sl2 = " + sl2) + }.eval +} diff --git a/tests/disabled/macro/run/reify_lazyunit.check b/tests/disabled/macro/run/reify_lazyunit.check new file mode 100644 index 000000000..579ecfe8a --- /dev/null +++ b/tests/disabled/macro/run/reify_lazyunit.check @@ -0,0 +1,6 @@ +reify_lazyunit.scala:6: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + lazy val x = { 0; println("12")} + ^ +12 +one +two diff --git a/tests/disabled/macro/run/reify_lazyunit.scala b/tests/disabled/macro/run/reify_lazyunit.scala new file mode 100644 index 000000000..70caf4f33 --- /dev/null +++ b/tests/disabled/macro/run/reify_lazyunit.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + lazy val x = { 0; println("12")} + x + println("one") + x + println("two") + }.eval +} + diff --git a/tests/disabled/macro/run/reify_maps_newpatmat.check b/tests/disabled/macro/run/reify_maps_newpatmat.check new file mode 100644 index 000000000..08cbbb135 --- /dev/null +++ b/tests/disabled/macro/run/reify_maps_newpatmat.check @@ -0,0 +1,4 @@ +red has code: 16711680 +Unknown color: green +Unknown color: blue +turquoise has code: 65535 diff --git a/tests/disabled/macro/run/reify_maps_newpatmat.scala b/tests/disabled/macro/run/reify_maps_newpatmat.scala new file mode 100644 index 000000000..18adb5c36 --- /dev/null +++ b/tests/disabled/macro/run/reify_maps_newpatmat.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + val colors = Map("red" -> 0xFF0000, + "turquoise" -> 0x00FFFF, + "black" -> 0x000000, + "orange" -> 0xFF8040, + "brown" -> 0x804000) + for (name <- List("red", "green", "blue", "turquoise")) println( + colors.get(name) match { + case Some(code) => + name + " has code: " + code + case None => + "Unknown color: " + name + } + ) + }.eval +} diff --git a/tests/disabled/macro/run/reify_maps_oldpatmat.check b/tests/disabled/macro/run/reify_maps_oldpatmat.check new file mode 100644 index 000000000..08cbbb135 --- /dev/null +++ b/tests/disabled/macro/run/reify_maps_oldpatmat.check @@ -0,0 +1,4 @@ +red has code: 16711680 +Unknown color: green +Unknown color: blue +turquoise has code: 65535 diff --git a/tests/disabled/macro/run/reify_maps_oldpatmat.scala b/tests/disabled/macro/run/reify_maps_oldpatmat.scala new file mode 100644 index 000000000..18adb5c36 --- /dev/null +++ b/tests/disabled/macro/run/reify_maps_oldpatmat.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + val colors = Map("red" -> 0xFF0000, + "turquoise" -> 0x00FFFF, + "black" -> 0x000000, + "orange" -> 0xFF8040, + "brown" -> 0x804000) + for (name <- List("red", "green", "blue", "turquoise")) println( + colors.get(name) match { + case Some(code) => + name + " has code: " + code + case None => + "Unknown color: " + name + } + ) + }.eval +} diff --git a/tests/disabled/macro/run/reify_metalevel_breach_+0_refers_to_1.check b/tests/disabled/macro/run/reify_metalevel_breach_+0_refers_to_1.check new file mode 100644 index 000000000..5bfed17f8 --- /dev/null +++ b/tests/disabled/macro/run/reify_metalevel_breach_+0_refers_to_1.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_metalevel_breach_+0_refers_to_1.scala b/tests/disabled/macro/run/reify_metalevel_breach_+0_refers_to_1.scala new file mode 100644 index 000000000..2f930c25e --- /dev/null +++ b/tests/disabled/macro/run/reify_metalevel_breach_+0_refers_to_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val code = reify{ + val x = 2 + val inner = reify{x} +// was: inner.splice + inner.eval + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_a.check b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_a.check new file mode 100644 index 000000000..5bfed17f8 --- /dev/null +++ b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_a.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_a.scala b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_a.scala new file mode 100644 index 000000000..526ed3d13 --- /dev/null +++ b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_a.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val x = 2 + val outer = reify{reify{x}} +// was: val code = reify{outer.splice.splice} + val code = reify{outer.eval.eval} + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_b.check b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_b.check new file mode 100644 index 000000000..5bfed17f8 --- /dev/null +++ b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_b.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_b.scala b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_b.scala new file mode 100644 index 000000000..96793c634 --- /dev/null +++ b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_0_b.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val x = 2 + val code = reify{ + { + val inner = reify{reify{x}} +// was: inner.splice + inner.eval +// was: }.splice + }.eval + } + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_1.check b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_1.check new file mode 100644 index 000000000..5bfed17f8 --- /dev/null +++ b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_1.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_1.scala b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_1.scala new file mode 100644 index 000000000..0fc985b6a --- /dev/null +++ b/tests/disabled/macro/run/reify_metalevel_breach_-1_refers_to_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val code = reify{ + val x = 2 + val inner = reify{reify{x}} +// was: inner.splice.splice + inner.eval.eval + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_nested_inner_refers_to_global.check b/tests/disabled/macro/run/reify_nested_inner_refers_to_global.check new file mode 100644 index 000000000..5ef4ff4d0 --- /dev/null +++ b/tests/disabled/macro/run/reify_nested_inner_refers_to_global.check @@ -0,0 +1 @@ +evaluated = 2 diff --git a/tests/disabled/macro/run/reify_nested_inner_refers_to_global.scala b/tests/disabled/macro/run/reify_nested_inner_refers_to_global.scala new file mode 100644 index 000000000..41d378e91 --- /dev/null +++ b/tests/disabled/macro/run/reify_nested_inner_refers_to_global.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = { + val x = 2 + reify{ + reify{x}.splice + } + } + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_nested_inner_refers_to_local.check b/tests/disabled/macro/run/reify_nested_inner_refers_to_local.check new file mode 100644 index 000000000..5bfed17f8 --- /dev/null +++ b/tests/disabled/macro/run/reify_nested_inner_refers_to_local.check @@ -0,0 +1 @@ +evaluated = 2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_nested_inner_refers_to_local.scala b/tests/disabled/macro/run/reify_nested_inner_refers_to_local.scala new file mode 100644 index 000000000..102278c84 --- /dev/null +++ b/tests/disabled/macro/run/reify_nested_inner_refers_to_local.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val code = reify{ + val x = 2 +// was: reify{x}.eval + reify{x}.eval + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_nested_outer_refers_to_global.check b/tests/disabled/macro/run/reify_nested_outer_refers_to_global.check new file mode 100644 index 000000000..5ef4ff4d0 --- /dev/null +++ b/tests/disabled/macro/run/reify_nested_outer_refers_to_global.check @@ -0,0 +1 @@ +evaluated = 2 diff --git a/tests/disabled/macro/run/reify_nested_outer_refers_to_global.scala b/tests/disabled/macro/run/reify_nested_outer_refers_to_global.scala new file mode 100644 index 000000000..bff5dc407 --- /dev/null +++ b/tests/disabled/macro/run/reify_nested_outer_refers_to_global.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = { + val x = 2 + val outer = reify{x} + reify{ + val x = 42 + outer.splice + }; + } + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_nested_outer_refers_to_local.check b/tests/disabled/macro/run/reify_nested_outer_refers_to_local.check new file mode 100644 index 000000000..5ef4ff4d0 --- /dev/null +++ b/tests/disabled/macro/run/reify_nested_outer_refers_to_local.check @@ -0,0 +1 @@ +evaluated = 2 diff --git a/tests/disabled/macro/run/reify_nested_outer_refers_to_local.scala b/tests/disabled/macro/run/reify_nested_outer_refers_to_local.scala new file mode 100644 index 000000000..70c400bc2 --- /dev/null +++ b/tests/disabled/macro/run/reify_nested_outer_refers_to_local.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val outer = { + val x = 2 + reify{x} + } + val code = reify{ + val x = 42 + outer.splice + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_newimpl_01.check b/tests/disabled/macro/run/reify_newimpl_01.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_01.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_01.scala b/tests/disabled/macro/run/reify_newimpl_01.scala new file mode 100644 index 000000000..1a5f96b53 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_01.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + val x = 2 + val code = reify { + x + } + println(code.eval) + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_02.check b/tests/disabled/macro/run/reify_newimpl_02.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_02.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_02.scala b/tests/disabled/macro/run/reify_newimpl_02.scala new file mode 100644 index 000000000..1ef3f03ed --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_02.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + var x = 2 + val code = reify { + x + } + println(code.eval) + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_03.check b/tests/disabled/macro/run/reify_newimpl_03.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_03.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_03.scala b/tests/disabled/macro/run/reify_newimpl_03.scala new file mode 100644 index 000000000..531bc76fe --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_03.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + val code = reify { + val x = 2 + reify{x}.eval + } + println(code.eval) + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_04.check b/tests/disabled/macro/run/reify_newimpl_04.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_04.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_04.scala b/tests/disabled/macro/run/reify_newimpl_04.scala new file mode 100644 index 000000000..b6071f843 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_04.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + val code = reify { + var x = 2 + reify{x}.eval + } + println(code.eval) + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_05.check b/tests/disabled/macro/run/reify_newimpl_05.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_05.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_05.scala b/tests/disabled/macro/run/reify_newimpl_05.scala new file mode 100644 index 000000000..0ff5bb07c --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_05.scala @@ -0,0 +1,14 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + val code = reify { + var x = 2 + def y = x // forcibly captures x + reify{x}.eval + } + println(code.eval) + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_06.check b/tests/disabled/macro/run/reify_newimpl_06.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_06.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_06.scala b/tests/disabled/macro/run/reify_newimpl_06.scala new file mode 100644 index 000000000..8743da100 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_06.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + class C(val y: Int) { + val code = reify { + reify{y}.eval + } + } + + println(new C(2).code.eval) +} diff --git a/tests/disabled/macro/run/reify_newimpl_11.check b/tests/disabled/macro/run/reify_newimpl_11.check new file mode 100644 index 000000000..c019c6db2 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_11.check @@ -0,0 +1,4 @@ +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_11.scala:6:11 +have you forgotten 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/tests/disabled/macro/run/reify_newimpl_11.scala b/tests/disabled/macro/run/reify_newimpl_11.scala new file mode 100644 index 000000000..bb08808c2 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_11.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + class C[T] { + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + try { + new C[Int] + } catch { + case ex: Throwable => + println(ex) + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_12.check b/tests/disabled/macro/run/reify_newimpl_12.check new file mode 100644 index 000000000..220bd6875 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_12.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_12.scala b/tests/disabled/macro/run/reify_newimpl_12.scala new file mode 100644 index 000000000..c2b9d42ca --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_12.scala @@ -0,0 +1,14 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + class C[T: TypeTag] { + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + new C[Int] +} diff --git a/tests/disabled/macro/run/reify_newimpl_13.check b/tests/disabled/macro/run/reify_newimpl_13.check new file mode 100644 index 000000000..13e3c9af1 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_13.check @@ -0,0 +1,4 @@ +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_13.scala:7:13 +have you forgotten 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/tests/disabled/macro/run/reify_newimpl_13.scala b/tests/disabled/macro/run/reify_newimpl_13.scala new file mode 100644 index 000000000..79a99c334 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_13.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + class C[T] { + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + try { + new C[Int] + } catch { + case ex: Throwable => + println(ex) + } + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_14.check b/tests/disabled/macro/run/reify_newimpl_14.check new file mode 100644 index 000000000..220bd6875 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_14.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_14.scala b/tests/disabled/macro/run/reify_newimpl_14.scala new file mode 100644 index 000000000..af2c7f136 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_14.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + class C[T: TypeTag] { + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + new C[Int] + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_15.check b/tests/disabled/macro/run/reify_newimpl_15.check new file mode 100644 index 000000000..220bd6875 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_15.check @@ -0,0 +1 @@ +List(2) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_15.scala b/tests/disabled/macro/run/reify_newimpl_15.scala new file mode 100644 index 000000000..4bcfc7107 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_15.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + class C { + type T = Int + val code = reify { + List[T](2) + } + println(code.eval) + } + + new C +} diff --git a/tests/disabled/macro/run/reify_newimpl_18.check b/tests/disabled/macro/run/reify_newimpl_18.check new file mode 100644 index 000000000..c23af69b0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_18.check @@ -0,0 +1 @@ +List(2) diff --git a/tests/disabled/macro/run/reify_newimpl_18.scala b/tests/disabled/macro/run/reify_newimpl_18.scala new file mode 100644 index 000000000..e60bed8c7 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_18.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + class C[U: TypeTag] { + type T = U + val code = reify { + List[T](2.asInstanceOf[T]) + } + println(code.eval) + } + + new C[Int] +} diff --git a/tests/disabled/macro/run/reify_newimpl_19.check b/tests/disabled/macro/run/reify_newimpl_19.check new file mode 100644 index 000000000..c749d4f10 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_19.check @@ -0,0 +1,4 @@ +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_19.scala:7:10 +have you forgotten 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/tests/disabled/macro/run/reify_newimpl_19.scala b/tests/disabled/macro/run/reify_newimpl_19.scala new file mode 100644 index 000000000..eaa6ca206 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_19.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + 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) + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_20.check b/tests/disabled/macro/run/reify_newimpl_20.check new file mode 100644 index 000000000..c23af69b0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_20.check @@ -0,0 +1 @@ +List(2) diff --git a/tests/disabled/macro/run/reify_newimpl_20.scala b/tests/disabled/macro/run/reify_newimpl_20.scala new file mode 100644 index 000000000..c483e0b7e --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_20.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + 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! +} diff --git a/tests/disabled/macro/run/reify_newimpl_21.check b/tests/disabled/macro/run/reify_newimpl_21.check new file mode 100644 index 000000000..c23af69b0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_21.check @@ -0,0 +1 @@ +List(2) diff --git a/tests/disabled/macro/run/reify_newimpl_21.scala b/tests/disabled/macro/run/reify_newimpl_21.scala new file mode 100644 index 000000000..0875ede6b --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_21.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + 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) +} diff --git a/tests/disabled/macro/run/reify_newimpl_22.check b/tests/disabled/macro/run/reify_newimpl_22.check new file mode 100644 index 000000000..952f384a1 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_22.check @@ -0,0 +1,25 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ + +scala> import scala.tools.reflect.ToolBox +import scala.tools.reflect.ToolBox + +scala> import scala.tools.reflect.Eval +import scala.tools.reflect.Eval + +scala> { + val x = 2 + val code = reify { + x + } + println(code.eval) +} +:15: free term: Ident(TermName("x")) defined by res0 in :14:21 + val code = reify { + ^ +2 + +scala> :quit diff --git a/tests/disabled/macro/run/reify_newimpl_22.scala b/tests/disabled/macro/run/reify_newimpl_22.scala new file mode 100644 index 000000000..8512620a1 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_22.scala @@ -0,0 +1,17 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-free-terms" + def code = """ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval +{ + val x = 2 + val code = reify { + x + } + println(code.eval) +} + """ +} \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_23.check b/tests/disabled/macro/run/reify_newimpl_23.check new file mode 100644 index 000000000..b7e9bfdfb --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_23.check @@ -0,0 +1,24 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ + +scala> import scala.tools.reflect.ToolBox +import scala.tools.reflect.ToolBox + +scala> import scala.tools.reflect.Eval +import scala.tools.reflect.Eval + +scala> def foo[T]{ + val code = reify { + List[T]() + } + println(code.eval) +} +:13: free type: Ident(TypeName("T")) defined by foo in :12:16 + val code = reify { + ^ +foo: [T]=> Unit + +scala> :quit diff --git a/tests/disabled/macro/run/reify_newimpl_23.scala b/tests/disabled/macro/run/reify_newimpl_23.scala new file mode 100644 index 000000000..d4c2a68ce --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_23.scala @@ -0,0 +1,16 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def extraSettings = "-Xlog-free-types" + def code = """ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval +def foo[T]{ + val code = reify { + List[T]() + } + println(code.eval) +} + """ +} \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_27.check b/tests/disabled/macro/run/reify_newimpl_27.check new file mode 100644 index 000000000..c23af69b0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_27.check @@ -0,0 +1 @@ +List(2) diff --git a/tests/disabled/macro/run/reify_newimpl_27.scala b/tests/disabled/macro/run/reify_newimpl_27.scala new file mode 100644 index 000000000..332dbec91 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_27.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + object C { + type T = Int + val code = reify { + List[T](2) + } + println(code.eval) + } + + C +} diff --git a/tests/disabled/macro/run/reify_newimpl_29.check b/tests/disabled/macro/run/reify_newimpl_29.check new file mode 100644 index 000000000..c23af69b0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_29.check @@ -0,0 +1 @@ +List(2) diff --git a/tests/disabled/macro/run/reify_newimpl_29.scala b/tests/disabled/macro/run/reify_newimpl_29.scala new file mode 100644 index 000000000..1865075f4 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_29.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + class C { + type T = Int + val code = reify { + List[C#T](2) + } + println(code.eval) + } + + new C +} diff --git a/tests/disabled/macro/run/reify_newimpl_30.check b/tests/disabled/macro/run/reify_newimpl_30.check new file mode 100644 index 000000000..7557c750a --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_30.check @@ -0,0 +1,4 @@ +reflective toolbox failed due to unresolved free type variables: + C defined by in reify_newimpl_30.scala:7:11 +have you forgotten 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/tests/disabled/macro/run/reify_newimpl_30.scala b/tests/disabled/macro/run/reify_newimpl_30.scala new file mode 100644 index 000000000..afc199d50 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_30.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.{ ToolBox, ToolBoxError } +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + class C { + type T = Int + val code = reify { + List[C#T](2) + } + try { println(code.eval) } + catch { case e: ToolBoxError => println(e.getMessage) } + } + + new C + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_31.check b/tests/disabled/macro/run/reify_newimpl_31.check new file mode 100644 index 000000000..c23af69b0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_31.check @@ -0,0 +1 @@ +List(2) diff --git a/tests/disabled/macro/run/reify_newimpl_31.scala b/tests/disabled/macro/run/reify_newimpl_31.scala new file mode 100644 index 000000000..535c9b67b --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_31.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + object C { + type T = Int + val code = reify { + List[C.T](2) + } + println(code.eval) + } + + C +} diff --git a/tests/disabled/macro/run/reify_newimpl_33.check b/tests/disabled/macro/run/reify_newimpl_33.check new file mode 100644 index 000000000..c23af69b0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_33.check @@ -0,0 +1 @@ +List(2) diff --git a/tests/disabled/macro/run/reify_newimpl_33.scala b/tests/disabled/macro/run/reify_newimpl_33.scala new file mode 100644 index 000000000..55a808eda --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_33.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + object C { + type T = Int + val c = C + val code = reify { + List[c.T](2) + } + println(code.eval) + } + + C +} diff --git a/tests/disabled/macro/run/reify_newimpl_35.check b/tests/disabled/macro/run/reify_newimpl_35.check new file mode 100644 index 000000000..bd9b3a2fb --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_35.check @@ -0,0 +1,13 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ + +scala> def foo[T: TypeTag] = reify{List[T]()} +foo: [T](implicit evidence$1: reflect.runtime.universe.TypeTag[T])reflect.runtime.universe.Expr[List[T]] + +scala> println(foo) +Expr[List[Nothing]](Nil) + +scala> :quit diff --git a/tests/disabled/macro/run/reify_newimpl_35.scala b/tests/disabled/macro/run/reify_newimpl_35.scala new file mode 100644 index 000000000..f2ebf5181 --- /dev/null +++ b/tests/disabled/macro/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.runtime.universe._ +def foo[T: TypeTag] = reify{List[T]()} +println(foo) + """ +} diff --git a/tests/disabled/macro/run/reify_newimpl_36.check b/tests/disabled/macro/run/reify_newimpl_36.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_36.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/reify_newimpl_36.scala b/tests/disabled/macro/run/reify_newimpl_36.scala new file mode 100644 index 000000000..19f8617c6 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_36.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + val x = 42 + def foo() = reify(reify(x)); + { + val x = 2 + val code1 = foo() + val code2 = code1.eval + println(code2.eval) + } + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_37.check b/tests/disabled/macro/run/reify_newimpl_37.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_37.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/reify_newimpl_37.scala b/tests/disabled/macro/run/reify_newimpl_37.scala new file mode 100644 index 000000000..5eeda2125 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_37.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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) + } + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_38.check b/tests/disabled/macro/run/reify_newimpl_38.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_38.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/reify_newimpl_38.scala b/tests/disabled/macro/run/reify_newimpl_38.scala new file mode 100644 index 000000000..a313b7d8d --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_38.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + val x = 42 + def foo() = reify{ val y = x; reify(y) }; + { + val x = 2 + val code1 = foo() + val code2 = code1.eval + println(code2.eval) + } + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_39.check b/tests/disabled/macro/run/reify_newimpl_39.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_39.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/reify_newimpl_39.scala b/tests/disabled/macro/run/reify_newimpl_39.scala new file mode 100644 index 000000000..4b779fc07 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_39.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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) + } + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_40.check b/tests/disabled/macro/run/reify_newimpl_40.check new file mode 100644 index 000000000..cc0001ab3 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_40.check @@ -0,0 +1 @@ +74088 diff --git a/tests/disabled/macro/run/reify_newimpl_40.scala b/tests/disabled/macro/run/reify_newimpl_40.scala new file mode 100644 index 000000000..1bc37973f --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_40.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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) + } + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_41.check b/tests/disabled/macro/run/reify_newimpl_41.check new file mode 100644 index 000000000..0b427f2ee --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_41.check @@ -0,0 +1,3 @@ +42 +44 +43 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_41.scala b/tests/disabled/macro/run/reify_newimpl_41.scala new file mode 100644 index 000000000..514e206a3 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_41.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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 + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_42.check b/tests/disabled/macro/run/reify_newimpl_42.check new file mode 100644 index 000000000..0b427f2ee --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_42.check @@ -0,0 +1,3 @@ +42 +44 +43 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_42.scala b/tests/disabled/macro/run/reify_newimpl_42.scala new file mode 100644 index 000000000..64c1cf345 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_42.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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 + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_43.check b/tests/disabled/macro/run/reify_newimpl_43.check new file mode 100644 index 000000000..7a754f414 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_43.check @@ -0,0 +1,2 @@ +1 +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_43.scala b/tests/disabled/macro/run/reify_newimpl_43.scala new file mode 100644 index 000000000..736536cb3 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_43.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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 + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_44.check b/tests/disabled/macro/run/reify_newimpl_44.check new file mode 100644 index 000000000..7a754f414 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_44.check @@ -0,0 +1,2 @@ +1 +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_44.scala b/tests/disabled/macro/run/reify_newimpl_44.scala new file mode 100644 index 000000000..736536cb3 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_44.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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 + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_45.check b/tests/disabled/macro/run/reify_newimpl_45.check new file mode 100644 index 000000000..6e14f71e2 --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/reify_newimpl_45.scala b/tests/disabled/macro/run/reify_newimpl_45.scala new file mode 100644 index 000000000..cfda46a6a --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_45.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import internal._ + +object Test extends dotty.runtime.LegacyApp { + class C[T >: Null] { + val code = reify{val x: T = "2".asInstanceOf[T]; println("ima worx: %s".format(x)); x} + println(freeTypes(code.tree)) + val tree = substituteSymbols(code.tree, freeTypes(code.tree), List(definitions.StringClass)) + cm.mkToolBox().eval(tree) + } + + new C[String] +} diff --git a/tests/disabled/macro/run/reify_newimpl_47.check b/tests/disabled/macro/run/reify_newimpl_47.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_47.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_47.scala b/tests/disabled/macro/run/reify_newimpl_47.scala new file mode 100644 index 000000000..c0ad6cbe5 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_47.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val outer = { + val x = 2 + reify{x} + } + + val code = reify{ + val x = 42 + outer.splice + } + + println(code.eval) +} diff --git a/tests/disabled/macro/run/reify_newimpl_48.check b/tests/disabled/macro/run/reify_newimpl_48.check new file mode 100644 index 000000000..f11c82a4c --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_48.check @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_48.scala b/tests/disabled/macro/run/reify_newimpl_48.scala new file mode 100644 index 000000000..7d1c1d642 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_48.scala @@ -0,0 +1,22 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val outer1 = { + val x = 2 + reify{x} + } + + val outer2 = { + val x = 3 + reify{x} + } + + val code = reify{ + val x = 4 + x + outer1.splice + outer2.splice + } + + println(code.eval) +} diff --git a/tests/disabled/macro/run/reify_newimpl_49.check b/tests/disabled/macro/run/reify_newimpl_49.check new file mode 100644 index 000000000..d8a621df0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_49.check @@ -0,0 +1,3 @@ +3 +3 +5 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_49.scala b/tests/disabled/macro/run/reify_newimpl_49.scala new file mode 100644 index 000000000..61ddfafa3 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_49.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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 + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_50.check b/tests/disabled/macro/run/reify_newimpl_50.check new file mode 100644 index 000000000..d8a621df0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_50.check @@ -0,0 +1,3 @@ +3 +3 +5 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_50.scala b/tests/disabled/macro/run/reify_newimpl_50.scala new file mode 100644 index 000000000..8ecdeb55c --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_50.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + var y = 1 + def x = { y += 2; y } + val code = reify { + println(x) + println(y) + println(x) + } + code.eval + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_51.check b/tests/disabled/macro/run/reify_newimpl_51.check new file mode 100644 index 000000000..9a4ddeacd --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_51.check @@ -0,0 +1,3 @@ +2 +1 +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_51.scala b/tests/disabled/macro/run/reify_newimpl_51.scala new file mode 100644 index 000000000..8a4a325f0 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_51.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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 + } +} diff --git a/tests/disabled/macro/run/reify_newimpl_52.check b/tests/disabled/macro/run/reify_newimpl_52.check new file mode 100644 index 000000000..9359a2b21 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_52.check @@ -0,0 +1,3 @@ +2 +2 +1 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_newimpl_52.scala b/tests/disabled/macro/run/reify_newimpl_52.scala new file mode 100644 index 000000000..4dc82b145 --- /dev/null +++ b/tests/disabled/macro/run/reify_newimpl_52.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + { + 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 + } +} diff --git a/tests/disabled/macro/run/reify_printf.check b/tests/disabled/macro/run/reify_printf.check new file mode 100644 index 000000000..3b18e512d --- /dev/null +++ b/tests/disabled/macro/run/reify_printf.check @@ -0,0 +1 @@ +hello world diff --git a/tests/disabled/macro/run/reify_printf.scala b/tests/disabled/macro/run/reify_printf.scala new file mode 100644 index 000000000..b957c41bb --- /dev/null +++ b/tests/disabled/macro/run/reify_printf.scala @@ -0,0 +1,71 @@ +import java.io.{ ByteArrayOutputStream, PrintStream } +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.reflect.api._ +import scala.reflect.api.Trees +import scala.reflect.internal.Types +import scala.util.matching.Regex + +object Test extends dotty.runtime.LegacyApp { + //val output = new ByteArrayOutputStream() + //Console.setOut(new PrintStream(output)) + val toolbox = cm.mkToolBox() + + val tree = tree_printf(reify("hello %s").tree, reify("world").tree) + val evaluated = toolbox.eval(tree) + //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]): _*) + */ + + var i = 0 + def gensym(name: String) = { i += 1; TermName(name + i) } + + def createTempValDef( value : Tree, tpe : Type ) : (Option[Tree],Tree) = { + val local = gensym("temp") + ( + Some( + ValDef( + NoMods + , local + , TypeTree(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, typeOf[Int] ) + case "%s" => createTempValDef( paramsStack.pop, typeOf[String] ) + case "%%" => { + (None:Option[Tree], Literal(Constant("%"))) + } + case part => { + (None:Option[Tree], Literal(Constant(part))) + } + } + + val evals = for ((Some(eval), _) <- parsed if eval != None) yield (eval: Tree) + val prints = for ((_, ref) <- parsed) yield + Apply( + Select( + Select( + Ident( TermName("scala") ) + , TermName("Predef") + ) + , TermName("print") + ) + , List(ref) + ): Tree + Block((evals ++ prints).toList, Literal(Constant(()))) + } +} diff --git a/tests/disabled/macro/run/reify_properties.check b/tests/disabled/macro/run/reify_properties.check new file mode 100644 index 000000000..d769bea4b --- /dev/null +++ b/tests/disabled/macro/run/reify_properties.check @@ -0,0 +1,2 @@ +user1: MR. ROBERT +user2: MR. BOB KUZ diff --git a/tests/disabled/macro/run/reify_properties.scala b/tests/disabled/macro/run/reify_properties.scala new file mode 100644 index 000000000..b6ce5f305 --- /dev/null +++ b/tests/disabled/macro/run/reify_properties.scala @@ -0,0 +1,57 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + /** A mutable property whose getter and setter may be customized. */ + case class Property[T](init: T) { + private var value: T = init + + /** The getter function, defaults to identity. */ + private var setter: T => T = identity[T] + + /** The setter function, defaults to identity. */ + private var getter: T => T = identity[T] + + /** Retrive the value held in this property. */ + def apply(): T = getter(value) + + /** Update the value held in this property, through the setter. */ + def update(newValue: T) = value = setter(newValue) + + /** Change the getter. */ + def get(newGetter: T => T) = { getter = newGetter; this } + + /** Change the setter */ + def set(newSetter: T => T) = { setter = newSetter; this } + } + + class User { + // Create a property with custom getter and setter + val firstname = Property("") + .get { v => v.toUpperCase() } + .set { v => "Mr. " + v } + val lastname = Property("") + + /** Scala provides syntactic sugar for calling 'apply'. Simply + * adding a list of arguments between parenthesis (in this case, + * an empty list) is translated to a call to 'apply' with those + * arguments. + */ + override def toString() = firstname() + " " + lastname() + } + + val user1 = new User + + // Syntactic sugar for 'update': an assignment is translated to a + // call to method 'update' + user1.firstname() = "Robert" + + val user2 = new User + user2.firstname() = "bob" + user2.lastname() = "KUZ" + + println("user1: " + user1) + println("user2: " + user2) + }.eval +} diff --git a/tests/disabled/macro/run/reify_renamed_term_basic.check b/tests/disabled/macro/run/reify_renamed_term_basic.check new file mode 100644 index 000000000..e78f94fff --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_term_basic.check @@ -0,0 +1 @@ +((),(),()) diff --git a/tests/disabled/macro/run/reify_renamed_term_basic.scala b/tests/disabled/macro/run/reify_renamed_term_basic.scala new file mode 100644 index 000000000..7971d3d11 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_term_basic.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object A { + object B { + val c = () + } +} + +object Test extends dotty.runtime.LegacyApp { + import A.{B => X} + import A.B.{c => y} + import X.{c => z} + + val expr = reify ( + X.c, y, z + ) + + println(expr.eval) +} diff --git a/tests/disabled/macro/run/reify_renamed_term_local_to_reifee.check b/tests/disabled/macro/run/reify_renamed_term_local_to_reifee.check new file mode 100644 index 000000000..e78f94fff --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_term_local_to_reifee.check @@ -0,0 +1 @@ +((),(),()) diff --git a/tests/disabled/macro/run/reify_renamed_term_local_to_reifee.scala b/tests/disabled/macro/run/reify_renamed_term_local_to_reifee.scala new file mode 100644 index 000000000..b93279376 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_term_local_to_reifee.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object A { + object B { + val c = () + } +} + +object Test extends dotty.runtime.LegacyApp { + val expr = reify { + import A.{B => X} + import A.B.{c => y} + import X.{c => z} + + (X.c, y, z) + } + + println(expr.eval) +} diff --git a/tests/disabled/macro/run/reify_renamed_term_overloaded_method.check b/tests/disabled/macro/run/reify_renamed_term_overloaded_method.check new file mode 100644 index 000000000..48082f72f --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_term_overloaded_method.check @@ -0,0 +1 @@ +12 diff --git a/tests/disabled/macro/run/reify_renamed_term_overloaded_method.scala b/tests/disabled/macro/run/reify_renamed_term_overloaded_method.scala new file mode 100644 index 000000000..1f7897679 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_term_overloaded_method.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object O { + def show(i: Int) = i.toString + def show(s: String) = s +} + +object Test extends dotty.runtime.LegacyApp { + import O.{show => s} + + val expr = reify { + s("1") + s(2) + } + + println(expr.eval) +} diff --git a/tests/disabled/macro/run/reify_renamed_term_t5841.check b/tests/disabled/macro/run/reify_renamed_term_t5841.check new file mode 100644 index 000000000..6031277b7 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_term_t5841.check @@ -0,0 +1 @@ +class scala.reflect.runtime.JavaUniverse diff --git a/tests/disabled/macro/run/reify_renamed_term_t5841.scala b/tests/disabled/macro/run/reify_renamed_term_t5841.scala new file mode 100644 index 000000000..d4c051c1b --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_term_t5841.scala @@ -0,0 +1,7 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + println(reify{ru}.eval.getClass) +} diff --git a/tests/disabled/macro/run/reify_renamed_type_basic.check b/tests/disabled/macro/run/reify_renamed_type_basic.check new file mode 100644 index 000000000..6a452c185 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_type_basic.check @@ -0,0 +1 @@ +() diff --git a/tests/disabled/macro/run/reify_renamed_type_basic.scala b/tests/disabled/macro/run/reify_renamed_type_basic.scala new file mode 100644 index 000000000..50506e144 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_type_basic.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object O { + type A = Unit +} + +object Test extends dotty.runtime.LegacyApp { + import O.{A => X} + + def expr = reify { + val a: X = () + } + + println(expr.eval) +} diff --git a/tests/disabled/macro/run/reify_renamed_type_local_to_reifee.check b/tests/disabled/macro/run/reify_renamed_type_local_to_reifee.check new file mode 100644 index 000000000..6a452c185 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_type_local_to_reifee.check @@ -0,0 +1 @@ +() diff --git a/tests/disabled/macro/run/reify_renamed_type_local_to_reifee.scala b/tests/disabled/macro/run/reify_renamed_type_local_to_reifee.scala new file mode 100644 index 000000000..01280e993 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_type_local_to_reifee.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object O { + type A = Unit +} + +object Test extends dotty.runtime.LegacyApp { + val expr = reify { + import O.{A => X} + + val a: X = () + + object P { + type B = Unit + } + + import P.{B => Y} + + val b: Y = () + } + + println(expr.eval) +} diff --git a/tests/disabled/macro/run/reify_renamed_type_spliceable.check b/tests/disabled/macro/run/reify_renamed_type_spliceable.check new file mode 100644 index 000000000..6a452c185 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_type_spliceable.check @@ -0,0 +1 @@ +() diff --git a/tests/disabled/macro/run/reify_renamed_type_spliceable.scala b/tests/disabled/macro/run/reify_renamed_type_spliceable.scala new file mode 100644 index 000000000..6a34d1722 --- /dev/null +++ b/tests/disabled/macro/run/reify_renamed_type_spliceable.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +abstract class C { + type T >: Null +} + +object Test extends dotty.runtime.LegacyApp { + def foo(c: C) = { + import c.{T => U} + reify { + val x: U = null + } + } + + val expr = foo(new C { + type T = AnyRef + }) + + println(expr.eval) +} diff --git a/tests/disabled/macro/run/reify_sort.check b/tests/disabled/macro/run/reify_sort.check new file mode 100644 index 000000000..375536cc2 --- /dev/null +++ b/tests/disabled/macro/run/reify_sort.check @@ -0,0 +1,2 @@ +[6,2,8,5,1] +[1,2,5,6,8] diff --git a/tests/disabled/macro/run/reify_sort.scala b/tests/disabled/macro/run/reify_sort.scala new file mode 100644 index 000000000..b484111ed --- /dev/null +++ b/tests/disabled/macro/run/reify_sort.scala @@ -0,0 +1,51 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + /** Nested methods can use and even update everything + * visible in their scope (including local variables or + * arguments of enclosing methods). + */ + def sort(a: Array[Int]): Unit = { + + def swap(i: Int, j: Int): Unit = { + val t = a(i); a(i) = a(j); a(j) = t + } + + def sort1(l: Int, r: Int): Unit = { + val pivot = a((l + r) / 2) + var i = l + var j = r + while (i <= j) { + while (a(i) < pivot) i += 1 + while (a(j) > pivot) j -= 1 + if (i <= j) { + swap(i, j) + i += 1 + j -= 1 + } + } + if (l < j) sort1(l, j) + if (j < r) sort1(i, r) + } + + if (a.length > 0) + sort1(0, a.length - 1) + } + + def println(ar: Array[Int]): Unit = { + def print1 = { + def iter(i: Int): String = + ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "") + if (ar.length == 0) "" else iter(0) + } + Console.println("[" + print1 + "]") + } + + val ar = Array(6, 2, 8, 5, 1) + println(ar) + sort(ar) + println(ar) + }.eval +} diff --git a/tests/disabled/macro/run/reify_sort1.check b/tests/disabled/macro/run/reify_sort1.check new file mode 100644 index 000000000..0d3080514 --- /dev/null +++ b/tests/disabled/macro/run/reify_sort1.check @@ -0,0 +1,2 @@ +List(6, 2, 8, 5, 1) +List(1, 2, 5, 6, 8) diff --git a/tests/disabled/macro/run/reify_sort1.scala b/tests/disabled/macro/run/reify_sort1.scala new file mode 100644 index 000000000..24ca06283 --- /dev/null +++ b/tests/disabled/macro/run/reify_sort1.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + def sort(a: List[Int]): List[Int] = { + if (a.length < 2) + a + else { + val pivot = a(a.length / 2) + sort(a.filter(_ < pivot)) ::: + a.filter(_ == pivot) ::: + sort(a.filter(_ > pivot)) + } + } + + val xs = List(6, 2, 8, 5, 1) + println(xs) + println(sort(xs)) + }.eval +} diff --git a/tests/disabled/macro/run/reify_this.check b/tests/disabled/macro/run/reify_this.check new file mode 100644 index 000000000..af3d0652a --- /dev/null +++ b/tests/disabled/macro/run/reify_this.check @@ -0,0 +1,5 @@ +foo +false +2 +bar +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_this.scala b/tests/disabled/macro/run/reify_this.scala new file mode 100644 index 000000000..339fcca54 --- /dev/null +++ b/tests/disabled/macro/run/reify_this.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +trait Transvaal { + def eval(tree: Expr[_]) = tree.eval +} + +object Test extends dotty.runtime.LegacyApp with Transvaal { + // select a value from package + eval(reify{println("foo")}) + eval(reify{println((new Object).toString == (new Object).toString)}) + + // select a type from package + 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(reify{println(x)}) +} diff --git a/tests/disabled/macro/run/reify_timeofday.check b/tests/disabled/macro/run/reify_timeofday.check new file mode 100644 index 000000000..3fd3b76a6 --- /dev/null +++ b/tests/disabled/macro/run/reify_timeofday.check @@ -0,0 +1 @@ +DateError diff --git a/tests/disabled/macro/run/reify_timeofday.scala b/tests/disabled/macro/run/reify_timeofday.scala new file mode 100644 index 000000000..ff30a962b --- /dev/null +++ b/tests/disabled/macro/run/reify_timeofday.scala @@ -0,0 +1,42 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class DateError extends Exception + + /** Simulating properties in Scala + * (example 4.2.1 in ScalaReference.pdf) + */ + class TimeOfDayVar { + private var h, m, s: Int = 0 + + def hours = h + + /** A method 'ident_=' is a setter for 'ident'. 'code.ident = ...' will + * be translated to a call to 'ident_=' + */ + def hours_= (h: Int) = + if (0 <= h && h < 24) this.h = h + else throw new DateError() + + def minutes = m + def minutes_= (m: Int) = + if (0 <= m && m < 60) this.m = m + else throw new DateError() + + def seconds = s + def seconds_= (s: Int) = + if (0 <= s && s < 60) this.s = s + else throw new DateError() + } + + val d = new TimeOfDayVar + d.hours = 8; d.minutes = 30; d.seconds = 0 + try { d.hours = 25 // throws a DateError exception + } catch { + case de: DateError => println("DateError") + case e: Exception => println("Exception") + } + }.eval +} diff --git a/tests/disabled/macro/run/reify_typerefs_1a.check b/tests/disabled/macro/run/reify_typerefs_1a.check new file mode 100644 index 000000000..919c298ba --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_1a.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_typerefs_1a.scala b/tests/disabled/macro/run/reify_typerefs_1a.scala new file mode 100644 index 000000000..b4f608a95 --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_1a.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +class Expression { + override def toString = "Expression" +} + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + List(new Expression, new Expression) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_typerefs_1b.check b/tests/disabled/macro/run/reify_typerefs_1b.check new file mode 100644 index 000000000..919c298ba --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_1b.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_typerefs_1b.scala b/tests/disabled/macro/run/reify_typerefs_1b.scala new file mode 100644 index 000000000..7c4d025f0 --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_1b.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Expression { + override def toString = "Expression" +} + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + List(Expression, Expression) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_typerefs_2a.check b/tests/disabled/macro/run/reify_typerefs_2a.check new file mode 100644 index 000000000..919c298ba --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_2a.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_typerefs_2a.scala b/tests/disabled/macro/run/reify_typerefs_2a.scala new file mode 100644 index 000000000..a2d5676c0 --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_2a.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +package foo { + class Expression { + override def toString = "Expression" + } +} + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + List(new foo.Expression, new foo.Expression) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_typerefs_2b.check b/tests/disabled/macro/run/reify_typerefs_2b.check new file mode 100644 index 000000000..919c298ba --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_2b.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_typerefs_2b.scala b/tests/disabled/macro/run/reify_typerefs_2b.scala new file mode 100644 index 000000000..f5543eaf6 --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_2b.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +package foo { + object Expression { + override def toString = "Expression" + } +} + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + List(foo.Expression, foo.Expression) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_typerefs_3a.check b/tests/disabled/macro/run/reify_typerefs_3a.check new file mode 100644 index 000000000..919c298ba --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_3a.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_typerefs_3a.scala b/tests/disabled/macro/run/reify_typerefs_3a.scala new file mode 100644 index 000000000..8d81721f1 --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_3a.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object foo { + class Expression { + override def toString = "Expression" + } +} + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + List(new foo.Expression, new foo.Expression) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_typerefs_3b.check b/tests/disabled/macro/run/reify_typerefs_3b.check new file mode 100644 index 000000000..919c298ba --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_3b.check @@ -0,0 +1 @@ +evaluated = List(Expression, Expression) \ No newline at end of file diff --git a/tests/disabled/macro/run/reify_typerefs_3b.scala b/tests/disabled/macro/run/reify_typerefs_3b.scala new file mode 100644 index 000000000..212f40fc0 --- /dev/null +++ b/tests/disabled/macro/run/reify_typerefs_3b.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object foo { + object Expression { + override def toString = "Expression" + } +} + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + List(foo.Expression, foo.Expression) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/reify_varargs.check b/tests/disabled/macro/run/reify_varargs.check new file mode 100644 index 000000000..e300a570a --- /dev/null +++ b/tests/disabled/macro/run/reify_varargs.check @@ -0,0 +1 @@ +Message=On the fifth of August there was a disturbance in the Force on planet Hoth. diff --git a/tests/disabled/macro/run/reify_varargs.scala b/tests/disabled/macro/run/reify_varargs.scala new file mode 100644 index 000000000..36777fe98 --- /dev/null +++ b/tests/disabled/macro/run/reify_varargs.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + 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) + }.eval +} diff --git a/tests/disabled/macro/run/repl-term-macros.check b/tests/disabled/macro/run/repl-term-macros.check new file mode 100644 index 000000000..2cd0b93cd --- /dev/null +++ b/tests/disabled/macro/run/repl-term-macros.check @@ -0,0 +1,40 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.reflect.macros.blackbox.Context +import scala.reflect.macros.blackbox.Context + +scala> import language.experimental.macros +import language.experimental.macros + +scala> + +scala> def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") } +impl1: (c: scala.reflect.macros.blackbox.Context)c.Expr[Unit] + +scala> def foo1: Unit = macro impl1 +defined term macro foo1: Unit + +scala> foo1 + +scala> + +scala> def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") } +impl2: (c: scala.reflect.macros.blackbox.Context)()c.Expr[Unit] + +scala> def foo2(): Unit = macro impl2 +defined term macro foo2: ()Unit + +scala> foo2() + +scala> + +scala> def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") } +impl3: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit] + +scala> def foo3(x: Int)(y: Int): Unit = macro impl3 +defined term macro foo3: (x: Int)(y: Int)Unit + +scala> foo3(2)(3) + +scala> :quit diff --git a/tests/disabled/macro/run/repl-term-macros.scala b/tests/disabled/macro/run/repl-term-macros.scala new file mode 100644 index 000000000..32892b731 --- /dev/null +++ b/tests/disabled/macro/run/repl-term-macros.scala @@ -0,0 +1,20 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") } +def foo1: Unit = macro impl1 +foo1 + +def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") } +def foo2(): Unit = macro impl2 +foo2() + +def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") } +def foo3(x: Int)(y: Int): Unit = macro impl3 +foo3(2)(3) + """ +} \ No newline at end of file diff --git a/tests/disabled/macro/run/runtimeEval1.check b/tests/disabled/macro/run/runtimeEval1.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/runtimeEval1.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/runtimeEval1.scala b/tests/disabled/macro/run/runtimeEval1.scala new file mode 100644 index 000000000..0202dfd06 --- /dev/null +++ b/tests/disabled/macro/run/runtimeEval1.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + val x = 2 + println(x) + }.eval +} diff --git a/tests/disabled/macro/run/runtimeEval2.check b/tests/disabled/macro/run/runtimeEval2.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/runtimeEval2.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/runtimeEval2.scala b/tests/disabled/macro/run/runtimeEval2.scala new file mode 100644 index 000000000..2708f9dbc --- /dev/null +++ b/tests/disabled/macro/run/runtimeEval2.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val x = 2 + val outer = reify{reify{x}} + println(outer.eval.eval) +} diff --git a/tests/disabled/macro/run/showdecl.check b/tests/disabled/macro/run/showdecl.check new file mode 100644 index 000000000..b8d7f94c5 --- /dev/null +++ b/tests/disabled/macro/run/showdecl.check @@ -0,0 +1,34 @@ +compile-time +uninitialized D: class D extends +initialized D: class D extends C +uninitialized x: val x: +initialized x: val x: Int +uninitialized y: lazy val y: +initialized y: lazy val y: Int +uninitialized z: def z: +initialized z: def z: Int +uninitialized t: def t: +initialized t: def t[T <: Int](x: D)(y: x.W): Int +uninitialized W: type W = String +initialized W: type W = String +uninitialized C: class C extends +initialized C: class C extends D +uninitialized O: object O +initialized O: object O +runtime +autoinitialized D: class D extends C +autoinitialized D: class D extends C +autoinitialized x: val x: Int +autoinitialized x: val x: Int +autoinitialized y: lazy val y: Int +autoinitialized y: lazy val y: Int +autoinitialized z: def z: Int +autoinitialized z: def z: Int +autoinitialized t: def t[T <: Int](x: D)(y: x.W): Int +autoinitialized t: def t[T <: Int](x: D)(y: x.W): Int +autoinitialized W: type W = String +autoinitialized W: type W = String +autoinitialized C: class C extends D +autoinitialized C: class C extends D +autoinitialized O: object O +autoinitialized O: object O diff --git a/tests/disabled/macro/run/showdecl/Macros_1.scala b/tests/disabled/macro/run/showdecl/Macros_1.scala new file mode 100644 index 000000000..c68dd275d --- /dev/null +++ b/tests/disabled/macro/run/showdecl/Macros_1.scala @@ -0,0 +1,30 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +object Macros { + def impl(c: Context) = { + var messages = List[String]() + def println(msg: String) = messages :+= msg + + import c.universe._ + def test(sym: Symbol): Unit = { + println(s"uninitialized ${sym.name}: ${showDecl(sym)}") + sym.info + println(s"initialized ${sym.name}: ${showDecl(sym)}") + } + + println("compile-time") + test(c.mirror.staticClass("D")) + test(c.mirror.staticClass("D").info.member(TermName("x"))) + test(c.mirror.staticClass("D").info.member(TermName("y"))) + test(c.mirror.staticClass("D").info.member(TermName("z"))) + test(c.mirror.staticClass("D").info.member(TermName("t"))) + test(c.mirror.staticClass("D").info.member(TypeName("W"))) + test(c.mirror.staticClass("D").info.member(TypeName("C"))) + test(c.mirror.staticClass("D").info.member(TermName("O"))) + + q"..${messages.map(msg => q"println($msg)")}" + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/showdecl/Test_2.scala b/tests/disabled/macro/run/showdecl/Test_2.scala new file mode 100644 index 000000000..fc212ab05 --- /dev/null +++ b/tests/disabled/macro/run/showdecl/Test_2.scala @@ -0,0 +1,32 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends dotty.runtime.LegacyApp { + def test(sym: Symbol): Unit = { + println(s"autoinitialized ${sym.name}: ${showDecl(sym)}") + sym.info + println(s"autoinitialized ${sym.name}: ${showDecl(sym)}") + } + + Macros.foo + println("runtime") + test(symbolOf[D]) + test(typeOf[D].member(TermName("x"))) + test(typeOf[D].member(TermName("y"))) + test(typeOf[D].member(TermName("z"))) + test(typeOf[D].member(TermName("t"))) + test(typeOf[D].member(TypeName("W"))) + test(typeOf[D].member(TypeName("C"))) + test(typeOf[D].member(TermName("O"))) +} + +class C +class D extends C { + val x = 2 + lazy val y = 3 + var z = 4 + def t[T <: Int](x: D)(y: x.W) = 5 + type W = String + class C extends D + object O extends C +} diff --git a/tests/disabled/macro/run/showraw_mods.check b/tests/disabled/macro/run/showraw_mods.check new file mode 100644 index 000000000..4d3416042 --- /dev/null +++ b/tests/disabled/macro/run/showraw_mods.check @@ -0,0 +1 @@ +Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), TypeName("C"), List(), Template(List(Ident(TypeName("AnyRef"))), noSelfType, List(DefDef(Modifiers(), TermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), TermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), TermName("y"), TypeTree(), Select(This(TypeName("C")), TermName("x"))), ValDef(Modifiers(LAZY), TermName("z"), TypeTree(), Select(This(TypeName("C")), TermName("y"))))))), Literal(Constant(()))) diff --git a/tests/disabled/macro/run/showraw_mods.scala b/tests/disabled/macro/run/showraw_mods.scala new file mode 100644 index 000000000..872685c37 --- /dev/null +++ b/tests/disabled/macro/run/showraw_mods.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + val tree = reify{trait C { private[this] val x = 2; var y = x; lazy val z = y }} + println(showRaw(tree.tree)) +} diff --git a/tests/disabled/macro/run/showraw_tree.check b/tests/disabled/macro/run/showraw_tree.check new file mode 100644 index 000000000..d8cb1fde0 --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree.check @@ -0,0 +1,2 @@ +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Select(Ident(scala.Predef), TypeName("String")), Select(Ident(scala.Predef), TypeName("String"))))), termNames.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Select(Ident(scala.Predef), TypeName("String")), Select(Ident(scala.Predef), TypeName("String"))))), termNames.CONSTRUCTOR), List()) diff --git a/tests/disabled/macro/run/showraw_tree.scala b/tests/disabled/macro/run/showraw_tree.scala new file mode 100644 index 000000000..fbd4c1dfa --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + val tree1 = reify(new collection.immutable.HashMap[String, String]) + val tree2 = reify(new collection.mutable.HashMap[String, String]) + println(showRaw(tree1.tree)) + println(showRaw(tree2.tree)) +} diff --git a/tests/disabled/macro/run/showraw_tree_ids.check b/tests/disabled/macro/run/showraw_tree_ids.check new file mode 100644 index 000000000..d7a7aa595 --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_ids.check @@ -0,0 +1,2 @@ +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#), List(Select(Ident(scala.Predef#), TypeName("String")), Select(Ident(scala.Predef#), TypeName("String"))))), termNames.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#), List(Select(Ident(scala.Predef#), TypeName("String")), Select(Ident(scala.Predef#), TypeName("String"))))), termNames.CONSTRUCTOR), List()) diff --git a/tests/disabled/macro/run/showraw_tree_ids.scala b/tests/disabled/macro/run/showraw_tree_ids.scala new file mode 100644 index 000000000..739ea55b5 --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_ids.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + val tree1 = reify(new collection.immutable.HashMap[String, String]) + val tree2 = reify(new collection.mutable.HashMap[String, String]) + def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#") + println(stabilize(showRaw(tree1.tree, printIds = true))) + println(stabilize(showRaw(tree2.tree, printIds = true))) +} diff --git a/tests/disabled/macro/run/showraw_tree_kinds.check b/tests/disabled/macro/run/showraw_tree_kinds.check new file mode 100644 index 000000000..85939b02f --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_kinds.check @@ -0,0 +1,2 @@ +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Select(Ident(scala.Predef#MOD), TypeName("String")), Select(Ident(scala.Predef#MOD), TypeName("String"))))), termNames.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Select(Ident(scala.Predef#MOD), TypeName("String")), Select(Ident(scala.Predef#MOD), TypeName("String"))))), termNames.CONSTRUCTOR), List()) diff --git a/tests/disabled/macro/run/showraw_tree_kinds.scala b/tests/disabled/macro/run/showraw_tree_kinds.scala new file mode 100644 index 000000000..0891015ac --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_kinds.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + val tree1 = reify(new collection.immutable.HashMap[String, String]) + val tree2 = reify(new collection.mutable.HashMap[String, String]) + println(showRaw(tree1.tree, printKinds = true)) + println(showRaw(tree2.tree, printKinds = true)) +} diff --git a/tests/disabled/macro/run/showraw_tree_types_ids.check b/tests/disabled/macro/run/showraw_tree_types_ids.check new file mode 100644 index 000000000..75347463c --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_types_ids.check @@ -0,0 +1,12 @@ +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#), TypeName("String")#)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#), TypeName("String")#)))))), termNames.CONSTRUCTOR#), List()) +[1] TypeRef(ThisType(scala.collection.immutable#), scala.collection.immutable.HashMap#, List(TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List()), TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#), scala.collection.immutable.HashMap#, List(TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List()), TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List())))) +[3] TypeRef(ThisType(scala.collection.immutable#), scala.collection.immutable.HashMap#, List()) +[4] TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List()) +[5] SingleType(ThisType(scala#), scala.Predef#) +Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap#), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#), TypeName("String")#)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#), TypeName("String")#)))))), termNames.CONSTRUCTOR#), List()) +[4] TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List()) +[5] SingleType(ThisType(scala#), scala.Predef#) +[6] TypeRef(ThisType(scala.collection.mutable#), scala.collection.mutable.HashMap#, List(TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List()), TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List()))) +[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#), scala.collection.mutable.HashMap#, List(TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List()), TypeRef(SingleType(ThisType(scala#), scala.Predef#), TypeName("String")#, List())))) +[8] TypeRef(ThisType(scala.collection.mutable#), scala.collection.mutable.HashMap#, List()) diff --git a/tests/disabled/macro/run/showraw_tree_types_ids.scala b/tests/disabled/macro/run/showraw_tree_types_ids.scala new file mode 100644 index 000000000..30f51c549 --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_types_ids.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val tb = runtimeMirror(getClass.getClassLoader).mkToolBox() + val tree1 = reify(new collection.immutable.HashMap[String, String]) + val tree2 = reify(new collection.mutable.HashMap[String, String]) + def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#") + println(stabilize(showRaw(tb.typecheck(tree1.tree), printIds = true, printTypes = true))) + println(stabilize(showRaw(tb.typecheck(tree2.tree), printIds = true, printTypes = true))) +} diff --git a/tests/disabled/macro/run/showraw_tree_types_typed.check b/tests/disabled/macro/run/showraw_tree_types_typed.check new file mode 100644 index 000000000..de691e369 --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_types_typed.check @@ -0,0 +1,12 @@ +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))))))), termNames.CONSTRUCTOR), List()) +[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())))) +[3] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List()) +[4] TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()) +[5] SingleType(ThisType(scala), scala.Predef) +Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))))))), termNames.CONSTRUCTOR), List()) +[4] TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()) +[5] SingleType(ThisType(scala), scala.Predef) +[6] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()))) +[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())))) +[8] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List()) diff --git a/tests/disabled/macro/run/showraw_tree_types_typed.scala b/tests/disabled/macro/run/showraw_tree_types_typed.scala new file mode 100644 index 000000000..e24eac9f8 --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_types_typed.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val tb = runtimeMirror(getClass.getClassLoader).mkToolBox() + val tree1 = reify(new collection.immutable.HashMap[String, String]) + val tree2 = reify(new collection.mutable.HashMap[String, String]) + println(showRaw(tb.typecheck(tree1.tree), printTypes = true)) + println(showRaw(tb.typecheck(tree2.tree), printTypes = true)) +} diff --git a/tests/disabled/macro/run/showraw_tree_types_untyped.check b/tests/disabled/macro/run/showraw_tree_types_untyped.check new file mode 100644 index 000000000..d8cb1fde0 --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_types_untyped.check @@ -0,0 +1,2 @@ +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Select(Ident(scala.Predef), TypeName("String")), Select(Ident(scala.Predef), TypeName("String"))))), termNames.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Select(Ident(scala.Predef), TypeName("String")), Select(Ident(scala.Predef), TypeName("String"))))), termNames.CONSTRUCTOR), List()) diff --git a/tests/disabled/macro/run/showraw_tree_types_untyped.scala b/tests/disabled/macro/run/showraw_tree_types_untyped.scala new file mode 100644 index 000000000..87dfd7242 --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_types_untyped.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + val tree1 = reify(new collection.immutable.HashMap[String, String]) + val tree2 = reify(new collection.mutable.HashMap[String, String]) + println(showRaw(tree1.tree, printTypes = true)) + println(showRaw(tree2.tree, printTypes = true)) +} diff --git a/tests/disabled/macro/run/showraw_tree_ultimate.check b/tests/disabled/macro/run/showraw_tree_ultimate.check new file mode 100644 index 000000000..81efcc05a --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_ultimate.check @@ -0,0 +1,12 @@ +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap##CLS), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef##MOD), TypeName("String")##TPE)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef##MOD), TypeName("String")##TPE)))))), termNames.CONSTRUCTOR##PCTOR), List()) +[1] TypeRef(ThisType(scala.collection.immutable##PKC), scala.collection.immutable.HashMap##CLS, List(TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List()), TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable##PKC), scala.collection.immutable.HashMap##CLS, List(TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List()), TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List())))) +[3] TypeRef(ThisType(scala.collection.immutable##PKC), scala.collection.immutable.HashMap##CLS, List()) +[4] TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List()) +[5] SingleType(ThisType(scala##PKC), scala.Predef##MOD) +Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap##CLS), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef##MOD), TypeName("String")##TPE)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef##MOD), TypeName("String")##TPE)))))), termNames.CONSTRUCTOR##CTOR), List()) +[4] TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List()) +[5] SingleType(ThisType(scala##PKC), scala.Predef##MOD) +[6] TypeRef(ThisType(scala.collection.mutable##PKC), scala.collection.mutable.HashMap##CLS, List(TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List()), TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List()))) +[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable##PKC), scala.collection.mutable.HashMap##CLS, List(TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List()), TypeRef(SingleType(ThisType(scala##PKC), scala.Predef##MOD), TypeName("String")##TPE, List())))) +[8] TypeRef(ThisType(scala.collection.mutable##PKC), scala.collection.mutable.HashMap##CLS, List()) diff --git a/tests/disabled/macro/run/showraw_tree_ultimate.scala b/tests/disabled/macro/run/showraw_tree_ultimate.scala new file mode 100644 index 000000000..0a97622ad --- /dev/null +++ b/tests/disabled/macro/run/showraw_tree_ultimate.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val tb = runtimeMirror(getClass.getClassLoader).mkToolBox() + val tree1 = reify(new collection.immutable.HashMap[String, String]) + val tree2 = reify(new collection.mutable.HashMap[String, String]) + def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#") + println(stabilize(showRaw(tb.typecheck(tree1.tree), printIds = true, printKinds = true, printTypes = true))) + println(stabilize(showRaw(tb.typecheck(tree2.tree), printIds = true, printKinds = true, printTypes = true))) +} diff --git a/tests/disabled/macro/run/t2886.check b/tests/disabled/macro/run/t2886.check new file mode 100644 index 000000000..61e36948b --- /dev/null +++ b/tests/disabled/macro/run/t2886.check @@ -0,0 +1,5 @@ +((x: Predef.String) => { + val x$1 = x; + val x$2 = x; + Test.this.test(x$2, x$1) +}) diff --git a/tests/disabled/macro/run/t2886.scala b/tests/disabled/macro/run/t2886.scala new file mode 100644 index 000000000..44783a5d8 --- /dev/null +++ b/tests/disabled/macro/run/t2886.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test { + def test(name: String, address: String) = null + def main(args: Array[String]) = { + val tree = reify((x:String) => test(address=x,name=x)).tree + println(tree) + } +} diff --git a/tests/disabled/macro/run/t5224.check b/tests/disabled/macro/run/t5224.check new file mode 100644 index 000000000..b11480acd --- /dev/null +++ b/tests/disabled/macro/run/t5224.check @@ -0,0 +1,14 @@ +t5224.scala:3: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class Foo(bar: String) extends annotation.ClassfileAnnotation + ^ +{ + @new Foo(bar = "qwe") class C extends AnyRef { + def () = { + super.(); + () + } + }; + () +} diff --git a/tests/disabled/macro/run/t5224.scala b/tests/disabled/macro/run/t5224.scala new file mode 100644 index 000000000..d0cd9a455 --- /dev/null +++ b/tests/disabled/macro/run/t5224.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ + +class Foo(bar: String) extends annotation.ClassfileAnnotation + +object Test extends dotty.runtime.LegacyApp { + val tree = reify{@Foo(bar = "qwe") class C}.tree + println(tree.toString) +} diff --git a/tests/disabled/macro/run/t5225_1.check b/tests/disabled/macro/run/t5225_1.check new file mode 100644 index 000000000..1a47aacfd --- /dev/null +++ b/tests/disabled/macro/run/t5225_1.check @@ -0,0 +1,4 @@ +{ + @new transient() @new volatile() var x = 2; + () +} diff --git a/tests/disabled/macro/run/t5225_1.scala b/tests/disabled/macro/run/t5225_1.scala new file mode 100644 index 000000000..a553e83ce --- /dev/null +++ b/tests/disabled/macro/run/t5225_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + val tree = reify{@transient @volatile var x = 2}.tree + println(tree.toString) +} diff --git a/tests/disabled/macro/run/t5225_2.check b/tests/disabled/macro/run/t5225_2.check new file mode 100644 index 000000000..477ea4eb6 --- /dev/null +++ b/tests/disabled/macro/run/t5225_2.check @@ -0,0 +1,4 @@ +{ + def foo(@new elidable(0) x: Int) = ""; + () +} diff --git a/tests/disabled/macro/run/t5225_2.scala b/tests/disabled/macro/run/t5225_2.scala new file mode 100644 index 000000000..54e7fec1f --- /dev/null +++ b/tests/disabled/macro/run/t5225_2.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + val tree = reify{def foo(@annotation.elidable(0) x: Int) = ""}.tree + println(tree.toString) +} diff --git a/tests/disabled/macro/run/t5229_1.scala b/tests/disabled/macro/run/t5229_1.scala new file mode 100644 index 000000000..62341fdbb --- /dev/null +++ b/tests/disabled/macro/run/t5229_1.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + object C + }.eval +} diff --git a/tests/disabled/macro/run/t5229_2.check b/tests/disabled/macro/run/t5229_2.check new file mode 100644 index 000000000..43c25b96a --- /dev/null +++ b/tests/disabled/macro/run/t5229_2.check @@ -0,0 +1,2 @@ +2 +evaluated = () diff --git a/tests/disabled/macro/run/t5229_2.scala b/tests/disabled/macro/run/t5229_2.scala new file mode 100644 index 000000000..a9cd08947 --- /dev/null +++ b/tests/disabled/macro/run/t5229_2.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + object C { + val x = 2 + } + + println(C.x) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/t5230.check b/tests/disabled/macro/run/t5230.check new file mode 100644 index 000000000..43c25b96a --- /dev/null +++ b/tests/disabled/macro/run/t5230.check @@ -0,0 +1,2 @@ +2 +evaluated = () diff --git a/tests/disabled/macro/run/t5230.scala b/tests/disabled/macro/run/t5230.scala new file mode 100644 index 000000000..5c934c345 --- /dev/null +++ b/tests/disabled/macro/run/t5230.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + class C { + val x = 2 + } + + println(new C().x) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/t5258a.check b/tests/disabled/macro/run/t5258a.check new file mode 100644 index 000000000..4e0b2da04 --- /dev/null +++ b/tests/disabled/macro/run/t5258a.check @@ -0,0 +1 @@ +int \ No newline at end of file diff --git a/tests/disabled/macro/run/t5258a.scala b/tests/disabled/macro/run/t5258a.scala new file mode 100644 index 000000000..5a22a251c --- /dev/null +++ b/tests/disabled/macro/run/t5258a.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + println(classOf[Int]) + }.eval +} diff --git a/tests/disabled/macro/run/t5266_1.check b/tests/disabled/macro/run/t5266_1.check new file mode 100644 index 000000000..35f20802e --- /dev/null +++ b/tests/disabled/macro/run/t5266_1.check @@ -0,0 +1,2 @@ +2 +evaluated = () \ No newline at end of file diff --git a/tests/disabled/macro/run/t5266_1.scala b/tests/disabled/macro/run/t5266_1.scala new file mode 100644 index 000000000..5ed943ee6 --- /dev/null +++ b/tests/disabled/macro/run/t5266_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + def x = 2 + println(x) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/t5266_2.check b/tests/disabled/macro/run/t5266_2.check new file mode 100644 index 000000000..35f20802e --- /dev/null +++ b/tests/disabled/macro/run/t5266_2.check @@ -0,0 +1,2 @@ +2 +evaluated = () \ No newline at end of file diff --git a/tests/disabled/macro/run/t5266_2.scala b/tests/disabled/macro/run/t5266_2.scala new file mode 100644 index 000000000..c8c3ab824 --- /dev/null +++ b/tests/disabled/macro/run/t5266_2.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + def x = 2 + def y = x + println(y) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/t5269.check b/tests/disabled/macro/run/t5269.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/t5269.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/t5269.scala b/tests/disabled/macro/run/t5269.scala new file mode 100644 index 000000000..dbaa1d1d8 --- /dev/null +++ b/tests/disabled/macro/run/t5269.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + trait Z { + val z = 2 + } + + class X extends Z { + def println() = Predef.println(z) + } + + new X().println() + }.eval +} diff --git a/tests/disabled/macro/run/t5270.check b/tests/disabled/macro/run/t5270.check new file mode 100644 index 000000000..08839f6bb --- /dev/null +++ b/tests/disabled/macro/run/t5270.check @@ -0,0 +1 @@ +200 diff --git a/tests/disabled/macro/run/t5270.scala b/tests/disabled/macro/run/t5270.scala new file mode 100644 index 000000000..03ba765fd --- /dev/null +++ b/tests/disabled/macro/run/t5270.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class Y { + def y = 100 + } + + trait Z { this: Y => + val z = 2 * y + } + + class X extends Y with Z { + def println() = Predef.println(z) + } + + new X().println() + }.eval +} diff --git a/tests/disabled/macro/run/t5271_1.check b/tests/disabled/macro/run/t5271_1.check new file mode 100644 index 000000000..544b4d276 --- /dev/null +++ b/tests/disabled/macro/run/t5271_1.check @@ -0,0 +1,12 @@ +{ + case class C extends Product with Serializable { + val foo: Int = _; + val bar: Int = _; + def (foo: Int, bar: Int) = { + super.(); + () + } + }; + () +} +() diff --git a/tests/disabled/macro/run/t5271_1.scala b/tests/disabled/macro/run/t5271_1.scala new file mode 100644 index 000000000..cdae3df58 --- /dev/null +++ b/tests/disabled/macro/run/t5271_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + case class C(foo: Int, bar: Int) + }; + + val toolbox = cm.mkToolBox() + println(code.tree) + println(code.eval) +} diff --git a/tests/disabled/macro/run/t5271_2.check b/tests/disabled/macro/run/t5271_2.check new file mode 100644 index 000000000..1df88872a --- /dev/null +++ b/tests/disabled/macro/run/t5271_2.check @@ -0,0 +1,14 @@ +{ + 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); + Predef.println(c.foo.$times(c.bar)) +} +4 +() diff --git a/tests/disabled/macro/run/t5271_2.scala b/tests/disabled/macro/run/t5271_2.scala new file mode 100644 index 000000000..654fa7b30 --- /dev/null +++ b/tests/disabled/macro/run/t5271_2.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + case class C(foo: Int, bar: Int) + val c = C(2, 2) + println(c.foo * c.bar) + }; + + val toolbox = cm.mkToolBox() + println(code.tree) + println(code.eval) +} diff --git a/tests/disabled/macro/run/t5271_3.check b/tests/disabled/macro/run/t5271_3.check new file mode 100644 index 000000000..99aacc2ce --- /dev/null +++ b/tests/disabled/macro/run/t5271_3.check @@ -0,0 +1,21 @@ +{ + object C extends AnyRef { + 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); + Predef.println(c.foo.$times(c.bar).$eq$eq(C.qwe)) +} +true +() diff --git a/tests/disabled/macro/run/t5271_3.scala b/tests/disabled/macro/run/t5271_3.scala new file mode 100644 index 000000000..2fa4cea77 --- /dev/null +++ b/tests/disabled/macro/run/t5271_3.scala @@ -0,0 +1,18 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + 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 toolbox = cm.mkToolBox() + println(code.tree) + println(code.eval) +} diff --git a/tests/disabled/macro/run/t5271_4.scala b/tests/disabled/macro/run/t5271_4.scala new file mode 100644 index 000000000..03cca7c48 --- /dev/null +++ b/tests/disabled/macro/run/t5271_4.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + case object C + }.eval +} diff --git a/tests/disabled/macro/run/t5272_1_newpatmat.check b/tests/disabled/macro/run/t5272_1_newpatmat.check new file mode 100644 index 000000000..9f8d6f24e --- /dev/null +++ b/tests/disabled/macro/run/t5272_1_newpatmat.check @@ -0,0 +1 @@ +okay \ No newline at end of file diff --git a/tests/disabled/macro/run/t5272_1_newpatmat.scala b/tests/disabled/macro/run/t5272_1_newpatmat.scala new file mode 100644 index 000000000..30d0c875d --- /dev/null +++ b/tests/disabled/macro/run/t5272_1_newpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + 2 match { + case 2 => println("okay") + case _ => println("not okay") + } + }.eval +} diff --git a/tests/disabled/macro/run/t5272_1_oldpatmat.check b/tests/disabled/macro/run/t5272_1_oldpatmat.check new file mode 100644 index 000000000..9f8d6f24e --- /dev/null +++ b/tests/disabled/macro/run/t5272_1_oldpatmat.check @@ -0,0 +1 @@ +okay \ No newline at end of file diff --git a/tests/disabled/macro/run/t5272_1_oldpatmat.scala b/tests/disabled/macro/run/t5272_1_oldpatmat.scala new file mode 100644 index 000000000..30d0c875d --- /dev/null +++ b/tests/disabled/macro/run/t5272_1_oldpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + 2 match { + case 2 => println("okay") + case _ => println("not okay") + } + }.eval +} diff --git a/tests/disabled/macro/run/t5272_2_newpatmat.check b/tests/disabled/macro/run/t5272_2_newpatmat.check new file mode 100644 index 000000000..549f3f3af --- /dev/null +++ b/tests/disabled/macro/run/t5272_2_newpatmat.check @@ -0,0 +1 @@ +okay2 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5272_2_newpatmat.scala b/tests/disabled/macro/run/t5272_2_newpatmat.scala new file mode 100644 index 000000000..436f0fd4f --- /dev/null +++ b/tests/disabled/macro/run/t5272_2_newpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + 2 match { + case x => println("okay" + x) + } + }.eval +} diff --git a/tests/disabled/macro/run/t5272_2_oldpatmat.check b/tests/disabled/macro/run/t5272_2_oldpatmat.check new file mode 100644 index 000000000..549f3f3af --- /dev/null +++ b/tests/disabled/macro/run/t5272_2_oldpatmat.check @@ -0,0 +1 @@ +okay2 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5272_2_oldpatmat.scala b/tests/disabled/macro/run/t5272_2_oldpatmat.scala new file mode 100644 index 000000000..436f0fd4f --- /dev/null +++ b/tests/disabled/macro/run/t5272_2_oldpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + 2 match { + case x => println("okay" + x) + } + }.eval +} diff --git a/tests/disabled/macro/run/t5273_1_newpatmat.check b/tests/disabled/macro/run/t5273_1_newpatmat.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/t5273_1_newpatmat.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/t5273_1_newpatmat.scala b/tests/disabled/macro/run/t5273_1_newpatmat.scala new file mode 100644 index 000000000..1ed2ce79a --- /dev/null +++ b/tests/disabled/macro/run/t5273_1_newpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + List(1, 2, 3) match { + case foo :: bar :: _ => println(foo * bar) + case _ => println("this is getting out of hand!") + } + }.eval +} diff --git a/tests/disabled/macro/run/t5273_1_oldpatmat.check b/tests/disabled/macro/run/t5273_1_oldpatmat.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/t5273_1_oldpatmat.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/t5273_1_oldpatmat.scala b/tests/disabled/macro/run/t5273_1_oldpatmat.scala new file mode 100644 index 000000000..1ed2ce79a --- /dev/null +++ b/tests/disabled/macro/run/t5273_1_oldpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + List(1, 2, 3) match { + case foo :: bar :: _ => println(foo * bar) + case _ => println("this is getting out of hand!") + } + }.eval +} diff --git a/tests/disabled/macro/run/t5273_2a_newpatmat.check b/tests/disabled/macro/run/t5273_2a_newpatmat.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/t5273_2a_newpatmat.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5273_2a_newpatmat.scala b/tests/disabled/macro/run/t5273_2a_newpatmat.scala new file mode 100644 index 000000000..cb4c15146 --- /dev/null +++ b/tests/disabled/macro/run/t5273_2a_newpatmat.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + val foo :: bar :: _ = List(1, 2, 3) + println(foo * bar) + }.eval +} diff --git a/tests/disabled/macro/run/t5273_2a_oldpatmat.check b/tests/disabled/macro/run/t5273_2a_oldpatmat.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/t5273_2a_oldpatmat.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5273_2a_oldpatmat.scala b/tests/disabled/macro/run/t5273_2a_oldpatmat.scala new file mode 100644 index 000000000..cb4c15146 --- /dev/null +++ b/tests/disabled/macro/run/t5273_2a_oldpatmat.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + val foo :: bar :: _ = List(1, 2, 3) + println(foo * bar) + }.eval +} diff --git a/tests/disabled/macro/run/t5273_2b_newpatmat.check b/tests/disabled/macro/run/t5273_2b_newpatmat.check new file mode 100644 index 000000000..c551774ca --- /dev/null +++ b/tests/disabled/macro/run/t5273_2b_newpatmat.check @@ -0,0 +1 @@ +name = American Dollar, shortname = USD, value = 2,8567 diff --git a/tests/disabled/macro/run/t5273_2b_newpatmat.scala b/tests/disabled/macro/run/t5273_2b_newpatmat.scala new file mode 100644 index 000000000..ca4a31566 --- /dev/null +++ b/tests/disabled/macro/run/t5273_2b_newpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + 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)) + }.eval +} diff --git a/tests/disabled/macro/run/t5273_2b_oldpatmat.check b/tests/disabled/macro/run/t5273_2b_oldpatmat.check new file mode 100644 index 000000000..c551774ca --- /dev/null +++ b/tests/disabled/macro/run/t5273_2b_oldpatmat.check @@ -0,0 +1 @@ +name = American Dollar, shortname = USD, value = 2,8567 diff --git a/tests/disabled/macro/run/t5273_2b_oldpatmat.scala b/tests/disabled/macro/run/t5273_2b_oldpatmat.scala new file mode 100644 index 000000000..ca4a31566 --- /dev/null +++ b/tests/disabled/macro/run/t5273_2b_oldpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + 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)) + }.eval +} diff --git a/tests/disabled/macro/run/t5274_1.check b/tests/disabled/macro/run/t5274_1.check new file mode 100644 index 000000000..fca8bc3d3 --- /dev/null +++ b/tests/disabled/macro/run/t5274_1.check @@ -0,0 +1,3 @@ +50! = 30414093201713378043612608166064768844377641568960512000000000000 +49! = 608281864034267560872252163321295376887552831379210240000000000 +50!/49! = 50 diff --git a/tests/disabled/macro/run/t5274_1.scala b/tests/disabled/macro/run/t5274_1.scala new file mode 100644 index 000000000..bc0ba99e4 --- /dev/null +++ b/tests/disabled/macro/run/t5274_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + def factorial(n: BigInt): BigInt = + if (n == 0) 1 else n * factorial(n-1) + + val f50 = factorial(50); val f49 = factorial(49) + println("50! = " + f50) + println("49! = " + f49) + println("50!/49! = " + (f50 / f49)) + }.eval +} diff --git a/tests/disabled/macro/run/t5274_2.check b/tests/disabled/macro/run/t5274_2.check new file mode 100644 index 000000000..375536cc2 --- /dev/null +++ b/tests/disabled/macro/run/t5274_2.check @@ -0,0 +1,2 @@ +[6,2,8,5,1] +[1,2,5,6,8] diff --git a/tests/disabled/macro/run/t5274_2.scala b/tests/disabled/macro/run/t5274_2.scala new file mode 100644 index 000000000..b484111ed --- /dev/null +++ b/tests/disabled/macro/run/t5274_2.scala @@ -0,0 +1,51 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + /** Nested methods can use and even update everything + * visible in their scope (including local variables or + * arguments of enclosing methods). + */ + def sort(a: Array[Int]): Unit = { + + def swap(i: Int, j: Int): Unit = { + val t = a(i); a(i) = a(j); a(j) = t + } + + def sort1(l: Int, r: Int): Unit = { + val pivot = a((l + r) / 2) + var i = l + var j = r + while (i <= j) { + while (a(i) < pivot) i += 1 + while (a(j) > pivot) j -= 1 + if (i <= j) { + swap(i, j) + i += 1 + j -= 1 + } + } + if (l < j) sort1(l, j) + if (j < r) sort1(i, r) + } + + if (a.length > 0) + sort1(0, a.length - 1) + } + + def println(ar: Array[Int]): Unit = { + def print1 = { + def iter(i: Int): String = + ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "") + if (ar.length == 0) "" else iter(0) + } + Console.println("[" + print1 + "]") + } + + val ar = Array(6, 2, 8, 5, 1) + println(ar) + sort(ar) + println(ar) + }.eval +} diff --git a/tests/disabled/macro/run/t5275.check b/tests/disabled/macro/run/t5275.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/t5275.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/t5275.scala b/tests/disabled/macro/run/t5275.scala new file mode 100644 index 000000000..38b77abab --- /dev/null +++ b/tests/disabled/macro/run/t5275.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class C(val foo: Int) + println(new C(2).foo) + }.eval +} diff --git a/tests/disabled/macro/run/t5276_1a.check b/tests/disabled/macro/run/t5276_1a.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/t5276_1a.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5276_1a.scala b/tests/disabled/macro/run/t5276_1a.scala new file mode 100644 index 000000000..ad76b2e69 --- /dev/null +++ b/tests/disabled/macro/run/t5276_1a.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + lazy val x = 2 + println(x) + }.eval +} diff --git a/tests/disabled/macro/run/t5276_1b.check b/tests/disabled/macro/run/t5276_1b.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/t5276_1b.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5276_1b.scala b/tests/disabled/macro/run/t5276_1b.scala new file mode 100644 index 000000000..8f11bdc6e --- /dev/null +++ b/tests/disabled/macro/run/t5276_1b.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + implicit lazy val x = 2 + println(implicitly[Int]) + }.eval +} diff --git a/tests/disabled/macro/run/t5276_2a.check b/tests/disabled/macro/run/t5276_2a.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/t5276_2a.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5276_2a.scala b/tests/disabled/macro/run/t5276_2a.scala new file mode 100644 index 000000000..7086fc983 --- /dev/null +++ b/tests/disabled/macro/run/t5276_2a.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class C { + lazy val x = 2 + } + + println(new C().x) + }.eval +} diff --git a/tests/disabled/macro/run/t5276_2b.check b/tests/disabled/macro/run/t5276_2b.check new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/disabled/macro/run/t5276_2b.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5276_2b.scala b/tests/disabled/macro/run/t5276_2b.scala new file mode 100644 index 000000000..cccc76a2d --- /dev/null +++ b/tests/disabled/macro/run/t5276_2b.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + class C { + implicit lazy val x = 2 + def y = implicitly[Int] + } + + println(new C().y) + }.eval +} diff --git a/tests/disabled/macro/run/t5277_1.check b/tests/disabled/macro/run/t5277_1.check new file mode 100644 index 000000000..a48033a30 --- /dev/null +++ b/tests/disabled/macro/run/t5277_1.check @@ -0,0 +1 @@ +10! = 3628800 diff --git a/tests/disabled/macro/run/t5277_1.scala b/tests/disabled/macro/run/t5277_1.scala new file mode 100644 index 000000000..580098666 --- /dev/null +++ b/tests/disabled/macro/run/t5277_1.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +import scala.language.{ implicitConversions, postfixOps } +object Test extends dotty.runtime.LegacyApp { + reify { + def fact(n: Int): BigInt = + if (n == 0) 1 else fact(n-1) * n + class Factorizer(n: Int) { + def ! = fact(n) + } + implicit def int2fact(n: Int) = new Factorizer(n) + + println("10! = " + (10!)) + }.eval +} diff --git a/tests/disabled/macro/run/t5277_2.check b/tests/disabled/macro/run/t5277_2.check new file mode 100644 index 000000000..ca017e2a4 --- /dev/null +++ b/tests/disabled/macro/run/t5277_2.check @@ -0,0 +1,2 @@ +2() +1() diff --git a/tests/disabled/macro/run/t5277_2.scala b/tests/disabled/macro/run/t5277_2.scala new file mode 100644 index 000000000..33e31da27 --- /dev/null +++ b/tests/disabled/macro/run/t5277_2.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + def p(implicit i: Int) = print(i) + implicit val v = 2 + + println(p) + println(p(1)) + }.eval +} diff --git a/tests/disabled/macro/run/t5279.check b/tests/disabled/macro/run/t5279.check new file mode 100644 index 000000000..f599e28b8 --- /dev/null +++ b/tests/disabled/macro/run/t5279.check @@ -0,0 +1 @@ +10 diff --git a/tests/disabled/macro/run/t5279.scala b/tests/disabled/macro/run/t5279.scala new file mode 100644 index 000000000..ed1510204 --- /dev/null +++ b/tests/disabled/macro/run/t5279.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + println(new Integer(10)) + }.eval +} diff --git a/tests/disabled/macro/run/t5334_1.check b/tests/disabled/macro/run/t5334_1.check new file mode 100644 index 000000000..96d80cd6c --- /dev/null +++ b/tests/disabled/macro/run/t5334_1.check @@ -0,0 +1 @@ +C \ No newline at end of file diff --git a/tests/disabled/macro/run/t5334_1.scala b/tests/disabled/macro/run/t5334_1.scala new file mode 100644 index 000000000..58954c2f9 --- /dev/null +++ b/tests/disabled/macro/run/t5334_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + class C { override def toString = "C" } + val ret = new C + ret.asInstanceOf[Object] + }; + + val toolbox = cm.mkToolBox() + println(toolbox.eval(code.tree)) +} diff --git a/tests/disabled/macro/run/t5334_2.check b/tests/disabled/macro/run/t5334_2.check new file mode 100644 index 000000000..613d286a1 --- /dev/null +++ b/tests/disabled/macro/run/t5334_2.check @@ -0,0 +1 @@ +List((C,C)) \ No newline at end of file diff --git a/tests/disabled/macro/run/t5334_2.scala b/tests/disabled/macro/run/t5334_2.scala new file mode 100644 index 000000000..105819405 --- /dev/null +++ b/tests/disabled/macro/run/t5334_2.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + class C { override def toString() = "C" } + val ret = List((new C, new C)) + ret.asInstanceOf[List[Any]] + }; + + val toolbox = cm.mkToolBox() + println(toolbox.eval(code.tree)) +} diff --git a/tests/disabled/macro/run/t5335.check b/tests/disabled/macro/run/t5335.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/t5335.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/t5335.scala b/tests/disabled/macro/run/t5335.scala new file mode 100644 index 000000000..c85c5730e --- /dev/null +++ b/tests/disabled/macro/run/t5335.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + println(new {def x = 2}.x) + }.eval +} diff --git a/tests/disabled/macro/run/t5415.scala b/tests/disabled/macro/run/t5415.scala new file mode 100644 index 000000000..cdc90b8ae --- /dev/null +++ b/tests/disabled/macro/run/t5415.scala @@ -0,0 +1,12 @@ +object Test extends dotty.runtime.LegacyApp{ + case class Queryable2[T]() { def filter(predicate: T => Boolean) = ??? } + trait CoffeesTable{ def sales : Int } + val q = Queryable2[CoffeesTable]() + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{universe => ru} + val code = reify{q.filter(_.sales > 5)} + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val toolbox = cm.mkToolBox() + val ttree = toolbox.typecheck(code.tree) +} diff --git a/tests/disabled/macro/run/t5418.scala b/tests/disabled/macro/run/t5418.scala new file mode 100644 index 000000000..beec4370d --- /dev/null +++ b/tests/disabled/macro/run/t5418.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + new Object().getClass + }.eval +} diff --git a/tests/disabled/macro/run/t5418a.check b/tests/disabled/macro/run/t5418a.check new file mode 100644 index 000000000..527022936 --- /dev/null +++ b/tests/disabled/macro/run/t5418a.check @@ -0,0 +1 @@ +Expr[Class[_ <: java.lang.Object]](new Object().getClass()) diff --git a/tests/disabled/macro/run/t5418a.scala b/tests/disabled/macro/run/t5418a.scala new file mode 100644 index 000000000..722348685 --- /dev/null +++ b/tests/disabled/macro/run/t5418a.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + println(scala.reflect.runtime.universe.reify(new Object().getClass)) +} diff --git a/tests/disabled/macro/run/t5418b.check b/tests/disabled/macro/run/t5418b.check new file mode 100644 index 000000000..f036a4be8 --- /dev/null +++ b/tests/disabled/macro/run/t5418b.check @@ -0,0 +1,2 @@ +new Object().getClass() +TypeRef(ThisType(java.lang), java.lang.Class, List(TypeRef(NoPrefix, TypeName("?0"), List()))) diff --git a/tests/disabled/macro/run/t5418b.scala b/tests/disabled/macro/run/t5418b.scala new file mode 100644 index 000000000..650700ae2 --- /dev/null +++ b/tests/disabled/macro/run/t5418b.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val tb = cm.mkToolBox() + val untyped = reify(new Object().getClass).tree + val typed = tb.typecheck(untyped) + println(typed) + println(showRaw(typed.tpe)) +} diff --git a/tests/disabled/macro/run/t5419.check b/tests/disabled/macro/run/t5419.check new file mode 100644 index 000000000..a9c0f262e --- /dev/null +++ b/tests/disabled/macro/run/t5419.check @@ -0,0 +1 @@ +5: @Foo.asInstanceOf[Int] diff --git a/tests/disabled/macro/run/t5419.scala b/tests/disabled/macro/run/t5419.scala new file mode 100644 index 000000000..e0ee02a5c --- /dev/null +++ b/tests/disabled/macro/run/t5419.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ + +class Foo extends annotation.StaticAnnotation + +object Test extends dotty.runtime.LegacyApp { + val tree = reify{(5: @Foo).asInstanceOf[Int]}.tree + println(tree.toString) +} diff --git a/tests/disabled/macro/run/t5704.check b/tests/disabled/macro/run/t5704.check new file mode 100644 index 000000000..102e3209c --- /dev/null +++ b/tests/disabled/macro/run/t5704.check @@ -0,0 +1 @@ +String diff --git a/tests/disabled/macro/run/t5704.flags b/tests/disabled/macro/run/t5704.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/t5704.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/t5704.scala b/tests/disabled/macro/run/t5704.scala new file mode 100644 index 000000000..b9765ebb6 --- /dev/null +++ b/tests/disabled/macro/run/t5704.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + class MyQuerycollection{ + def findUserByName( name:String ) = { + val tree = reify{ "test" == name }.tree + val toolbox = cm.mkToolBox() + toolbox.typecheck(tree) match{ + case Apply(Select(lhs,op),rhs::Nil) => + println(rhs.tpe) + } + } + } + val qc = new MyQuerycollection + qc.findUserByName("some value") +} diff --git a/tests/disabled/macro/run/t5710-1.check b/tests/disabled/macro/run/t5710-1.check new file mode 100644 index 000000000..eac2025ae --- /dev/null +++ b/tests/disabled/macro/run/t5710-1.check @@ -0,0 +1 @@ +evaluated = (abc,abc) diff --git a/tests/disabled/macro/run/t5710-1.scala b/tests/disabled/macro/run/t5710-1.scala new file mode 100644 index 000000000..5548ca4ca --- /dev/null +++ b/tests/disabled/macro/run/t5710-1.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + val (x, y) = ("abc": Any) match { case x => (x, x) } + (x, y) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/t5710-2.check b/tests/disabled/macro/run/t5710-2.check new file mode 100644 index 000000000..eac2025ae --- /dev/null +++ b/tests/disabled/macro/run/t5710-2.check @@ -0,0 +1 @@ +evaluated = (abc,abc) diff --git a/tests/disabled/macro/run/t5710-2.scala b/tests/disabled/macro/run/t5710-2.scala new file mode 100644 index 000000000..c5129ce34 --- /dev/null +++ b/tests/disabled/macro/run/t5710-2.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + val (x, y) = "abc" match { case x => (x, x) } + (x, y) + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.eval(code.tree) + println("evaluated = " + evaluated) +} diff --git a/tests/disabled/macro/run/t5713.check b/tests/disabled/macro/run/t5713.check new file mode 100644 index 000000000..1419eb9d7 --- /dev/null +++ b/tests/disabled/macro/run/t5713.check @@ -0,0 +1 @@ +err diff --git a/tests/disabled/macro/run/t5713.flags b/tests/disabled/macro/run/t5713.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/t5713.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/t5713/Impls_Macros_1.scala b/tests/disabled/macro/run/t5713/Impls_Macros_1.scala new file mode 100644 index 000000000..7b04197cf --- /dev/null +++ b/tests/disabled/macro/run/t5713/Impls_Macros_1.scala @@ -0,0 +1,28 @@ +package m + +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Level extends Enumeration { + val Error = Value(5) +} + +object Logger { + def error(message: String): Unit = macro LoggerMacros.error +} + +private object LoggerMacros { + + type LoggerContext = Context { type PrefixType = Logger.type } + + def error(c: LoggerContext)(message: c.Expr[String]): c.Expr[Unit] = + log(c)(c.universe.reify(Level.Error), message) + + private def log(c: LoggerContext)(level: c.Expr[Level.Value], message: c.Expr[String]): c.Expr[Unit] = +// was: if (level.splice.id < 4) // TODO Remove hack! + if (c.eval(level).id < 4) // TODO Remove hack! + c.universe.reify(()) + else { + c.universe.reify(println(message.splice)) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5713/Test_2.scala b/tests/disabled/macro/run/t5713/Test_2.scala new file mode 100644 index 000000000..7e4d02a80 --- /dev/null +++ b/tests/disabled/macro/run/t5713/Test_2.scala @@ -0,0 +1,5 @@ +import m._ + +object Test extends dotty.runtime.LegacyApp { + Logger.error("err") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5753_1.check b/tests/disabled/macro/run/t5753_1.check new file mode 100644 index 000000000..f70d7bba4 --- /dev/null +++ b/tests/disabled/macro/run/t5753_1.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5753_1.flags b/tests/disabled/macro/run/t5753_1.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/t5753_1.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/t5753_1/Impls_Macros_1.scala b/tests/disabled/macro/run/t5753_1/Impls_Macros_1.scala new file mode 100644 index 000000000..ce0713885 --- /dev/null +++ b/tests/disabled/macro/run/t5753_1/Impls_Macros_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +trait Impls { + def impl(c: Context)(x: c.Expr[Any]) = x +} + +object Macros extends Impls { + def foo(x: Any) = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5753_1/Test_2.scala b/tests/disabled/macro/run/t5753_1/Test_2.scala new file mode 100644 index 000000000..413eefff3 --- /dev/null +++ b/tests/disabled/macro/run/t5753_1/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + import Macros._ + println(foo(42)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5753_2.check b/tests/disabled/macro/run/t5753_2.check new file mode 100644 index 000000000..f70d7bba4 --- /dev/null +++ b/tests/disabled/macro/run/t5753_2.check @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/tests/disabled/macro/run/t5753_2.flags b/tests/disabled/macro/run/t5753_2.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/t5753_2.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/t5753_2/Impls_Macros_1.scala b/tests/disabled/macro/run/t5753_2/Impls_Macros_1.scala new file mode 100644 index 000000000..d446d37bd --- /dev/null +++ b/tests/disabled/macro/run/t5753_2/Impls_Macros_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.macros.blackbox.Context + +trait Macro_T { + def foo[T](c: Context)(s: c.Expr[T]) = s +} + +object Macros { + def foo[T](s: T) = macro Impls.foo[T] + object Impls extends Macro_T +} diff --git a/tests/disabled/macro/run/t5753_2/Test_2.scala b/tests/disabled/macro/run/t5753_2/Test_2.scala new file mode 100644 index 000000000..413eefff3 --- /dev/null +++ b/tests/disabled/macro/run/t5753_2/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + import Macros._ + println(foo(42)) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5770.check b/tests/disabled/macro/run/t5770.check new file mode 100644 index 000000000..f00c965d8 --- /dev/null +++ b/tests/disabled/macro/run/t5770.check @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/tests/disabled/macro/run/t5770.scala b/tests/disabled/macro/run/t5770.scala new file mode 100644 index 000000000..409efb2d1 --- /dev/null +++ b/tests/disabled/macro/run/t5770.scala @@ -0,0 +1,25 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect._ + +object Test extends dotty.runtime.LegacyApp { + var i = 0 + val action = reify { i += 1; println(i) }.tree + + val tb1 = cm.mkToolBox() + tb1.eval(action) + tb1.eval(action) + tb1.eval(action) + tb1.frontEnd.reset() + tb1.eval(action) + tb1.eval(action) + + val tb2 = cm.mkToolBox() + tb2.eval(action) + tb2.frontEnd.reset() + tb2.eval(action) + tb2.eval(action) + tb2.frontEnd.reset() + tb2.eval(action) + tb2.eval(action) +} diff --git a/tests/disabled/macro/run/t5816.check b/tests/disabled/macro/run/t5816.check new file mode 100644 index 000000000..8e58ace9b --- /dev/null +++ b/tests/disabled/macro/run/t5816.check @@ -0,0 +1 @@ +5.+(Test.this.y) diff --git a/tests/disabled/macro/run/t5816.scala b/tests/disabled/macro/run/t5816.scala new file mode 100644 index 000000000..4c2a5bcb7 --- /dev/null +++ b/tests/disabled/macro/run/t5816.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val toolbox = cm.mkToolBox() + + def printSource[T](expr: Expr[T]): Unit = { + val ttree = toolbox typecheck expr.tree + println(ttree.toString) + } + + var y = 3 + printSource(reify { + 5 + y + }) +} diff --git a/tests/disabled/macro/run/t5824.check b/tests/disabled/macro/run/t5824.check new file mode 100644 index 000000000..3774da60e --- /dev/null +++ b/tests/disabled/macro/run/t5824.check @@ -0,0 +1 @@ +a b c diff --git a/tests/disabled/macro/run/t5824.scala b/tests/disabled/macro/run/t5824.scala new file mode 100644 index 000000000..c5cfc280f --- /dev/null +++ b/tests/disabled/macro/run/t5824.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends dotty.runtime.LegacyApp { + reify { + println("%s %s %s".format(List("a", "b", "c"): _*)) + }.eval +} diff --git a/tests/disabled/macro/run/t5840.scala b/tests/disabled/macro/run/t5840.scala new file mode 100644 index 000000000..ba2376f0f --- /dev/null +++ b/tests/disabled/macro/run/t5840.scala @@ -0,0 +1,7 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + reify { + class C[T <: String with Singleton] + } +} diff --git a/tests/disabled/macro/run/t5894.scala b/tests/disabled/macro/run/t5894.scala new file mode 100644 index 000000000..c67a46def --- /dev/null +++ b/tests/disabled/macro/run/t5894.scala @@ -0,0 +1,18 @@ +import scala.reflect.macros.blackbox.Context +import scala.language.experimental.macros + +class Test + +object Test { + def foo: Unit = macro fooImpl + def fooImpl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") } + + def main(args: Array[String]): Unit = { + try { + val method = classOf[Test].getMethod("foo") + sys.error("Static forwarder generated for macro: " + method) + } catch { + case _: NoSuchMethodException => // okay + } + } +} diff --git a/tests/disabled/macro/run/t5903a.check b/tests/disabled/macro/run/t5903a.check new file mode 100644 index 000000000..ce6efd812 --- /dev/null +++ b/tests/disabled/macro/run/t5903a.check @@ -0,0 +1 @@ +(SomeTree,SomeTree) diff --git a/tests/disabled/macro/run/t5903a.flags b/tests/disabled/macro/run/t5903a.flags new file mode 100644 index 000000000..02ecab49e --- /dev/null +++ b/tests/disabled/macro/run/t5903a.flags @@ -0,0 +1 @@ +-Xlog-reflective-calls \ No newline at end of file diff --git a/tests/disabled/macro/run/t5903a/Macros_1.scala b/tests/disabled/macro/run/t5903a/Macros_1.scala new file mode 100644 index 000000000..5d084ceed --- /dev/null +++ b/tests/disabled/macro/run/t5903a/Macros_1.scala @@ -0,0 +1,28 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +trait Tree +case object SomeTree extends Tree + +object NewQuasiquotes { + implicit class QuasiquoteInterpolation(c: StringContext) { + object nq { + def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl + } + } +} + +object QuasiquoteMacros { + def unapplyImpl(c: Context)(t: c.Tree) = { + import c.universe._ + q""" + new { + def isEmpty = false + def get = this + def _1 = SomeTree + def _2 = SomeTree + def unapply(t: Tree) = this + }.unapply($t) + """ + } +} diff --git a/tests/disabled/macro/run/t5903a/Test_2.scala b/tests/disabled/macro/run/t5903a/Test_2.scala new file mode 100644 index 000000000..55a8320b3 --- /dev/null +++ b/tests/disabled/macro/run/t5903a/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + import NewQuasiquotes._ + SomeTree match { + case nq"$x + $y" => println((x, y)) + } +} diff --git a/tests/disabled/macro/run/t5903b.check b/tests/disabled/macro/run/t5903b.check new file mode 100644 index 000000000..75891bc67 --- /dev/null +++ b/tests/disabled/macro/run/t5903b.check @@ -0,0 +1 @@ +oops diff --git a/tests/disabled/macro/run/t5903b.flags b/tests/disabled/macro/run/t5903b.flags new file mode 100644 index 000000000..02ecab49e --- /dev/null +++ b/tests/disabled/macro/run/t5903b.flags @@ -0,0 +1 @@ +-Xlog-reflective-calls \ No newline at end of file diff --git a/tests/disabled/macro/run/t5903b/Macros_1.scala b/tests/disabled/macro/run/t5903b/Macros_1.scala new file mode 100644 index 000000000..29a05f7fe --- /dev/null +++ b/tests/disabled/macro/run/t5903b/Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +object Interpolation { + implicit class TestInterpolation(c: StringContext) { + object t { + def unapply[T](x: T): Any = macro Macros.unapplyImpl[T] + } + } +} + +object Macros { + def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = { + import c.universe._ + q""" + new { + def isEmpty = false + def get = this + def _1 = 2 + def unapply(x: Int) = this + override def toString = "oops" + }.unapply($x) + """ + } +} diff --git a/tests/disabled/macro/run/t5903b/Test_2.scala b/tests/disabled/macro/run/t5903b/Test_2.scala new file mode 100644 index 000000000..23a92225d --- /dev/null +++ b/tests/disabled/macro/run/t5903b/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + import Interpolation._ + 2 match { + case t"$x" => println(x) + } +} diff --git a/tests/disabled/macro/run/t5903c.check b/tests/disabled/macro/run/t5903c.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/t5903c.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/t5903c.flags b/tests/disabled/macro/run/t5903c.flags new file mode 100644 index 000000000..02ecab49e --- /dev/null +++ b/tests/disabled/macro/run/t5903c.flags @@ -0,0 +1 @@ +-Xlog-reflective-calls \ No newline at end of file diff --git a/tests/disabled/macro/run/t5903c/Macros_1.scala b/tests/disabled/macro/run/t5903c/Macros_1.scala new file mode 100644 index 000000000..34fe1d880 --- /dev/null +++ b/tests/disabled/macro/run/t5903c/Macros_1.scala @@ -0,0 +1,23 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +object Interpolation { + implicit class TestInterpolation(c: StringContext) { + object t { + def unapply[T](x: T): Any = macro Macros.unapplyImpl[T] + } + } +} + +object Macros { + def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = { + import c.universe._ + q""" + new { + def isEmpty = false + def get = 2 + def unapply(x: Int) = this + }.unapply($x) + """ + } +} diff --git a/tests/disabled/macro/run/t5903c/Test_2.scala b/tests/disabled/macro/run/t5903c/Test_2.scala new file mode 100644 index 000000000..23a92225d --- /dev/null +++ b/tests/disabled/macro/run/t5903c/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + import Interpolation._ + 2 match { + case t"$x" => println(x) + } +} diff --git a/tests/disabled/macro/run/t5903d.check b/tests/disabled/macro/run/t5903d.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/t5903d.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/t5903d.flags b/tests/disabled/macro/run/t5903d.flags new file mode 100644 index 000000000..02ecab49e --- /dev/null +++ b/tests/disabled/macro/run/t5903d.flags @@ -0,0 +1 @@ +-Xlog-reflective-calls \ No newline at end of file diff --git a/tests/disabled/macro/run/t5903d/Macros_1.scala b/tests/disabled/macro/run/t5903d/Macros_1.scala new file mode 100644 index 000000000..f1f8dc1fd --- /dev/null +++ b/tests/disabled/macro/run/t5903d/Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +object Interpolation { + implicit class TestInterpolation(c: StringContext) { + object t { + def unapply(x: Int): Any = macro Macros.unapplyImpl + } + } +} + +object Macros { + def unapplyImpl(c: Context)(x: c.Tree) = { + import c.universe._ + q""" + new { + class Match(x: Int) { + def isEmpty = false + def get = x + } + def unapply(x: Int) = new Match(x) + }.unapply($x) + """ + } +} diff --git a/tests/disabled/macro/run/t5903d/Test_2.scala b/tests/disabled/macro/run/t5903d/Test_2.scala new file mode 100644 index 000000000..5df60f024 --- /dev/null +++ b/tests/disabled/macro/run/t5903d/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + import Interpolation._ + 42 match { + case t"$x" => println(x) + } +} diff --git a/tests/disabled/macro/run/t5923a.check b/tests/disabled/macro/run/t5923a.check new file mode 100644 index 000000000..7165b734a --- /dev/null +++ b/tests/disabled/macro/run/t5923a.check @@ -0,0 +1,3 @@ +C(Int) +C(String) +C(Nothing) diff --git a/tests/disabled/macro/run/t5923a/Macros_1.scala b/tests/disabled/macro/run/t5923a/Macros_1.scala new file mode 100644 index 000000000..9050fd4b1 --- /dev/null +++ b/tests/disabled/macro/run/t5923a/Macros_1.scala @@ -0,0 +1,53 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +case class C[T](t: String) +object C { + implicit def foo[T]: C[T] = macro Macros.impl[T] +} + +object Macros { + def impl[T](c: Context)(ttag: c.WeakTypeTag[T]) = { + import c.universe._ + import internal._ + val ttag0 = ttag; + { + // When we're expanding implicitly[C[Nothing]], the type inferencer will see + // that foo[T] returns C[T] and that we request an implicit of type C[Nothing]. + // + // Then the type inferencer will try to match C[T] against C[Nothing] and infer everything it can infer + // from that match, but not more (e.g. if we were returning Iso[T, U] and the type we were looking at was Iso[Foo, L], + // we wouldn't want U to be auto-inferred to Nothing, as it usually happens with normal methods, + // but would rather want it to remain unknown, so that our macro could take a stab at inferring it: + // see the comments in this commit for more information). + // + // Equipped with common sense, in our case of C[T] and C[Nothing] we would expect T to be inferred as Nothing, and then we + // would expect T in the corresponding macro invocation to be Nothing. Unfortunately it is not that simple. + // + // Internally the type inferencer uses Nothing as a dummy value, which stands for "don't know how to + // infer this type parameter". In the Iso example, matching Iso[T, U] against Iso[Foo, L] would result in + // T being inferred as Foo and U being inferred as Nothing (!!). Then the type inferencer will think: + // "Aha! U ended up being Nothing. This means that I failed to infer it, + // therefore the result of my work is: T -> Foo, U -> still unknown". + // + // That's all very good and works very well until Nothing is a genuine result of type inference, + // as in our original example of inferring T in C[T] from C[Nothing]. In that case, the inferencer becomes confused + // and here in the macro implementation we get weakTypeOf[T] equal to some dummy type carrying a type parameter + // instead of Nothing. + // + // This eccentric behavior of the type inferencer is a long-standing problem in scalac, + // so the best one can do for now until it's fixed is to work around, manually converting + // suspicious T's into Nothings. Of course, this means that we would have to approximate, + // because there's no way to know whether having T here stands for a failed attempt to infer Nothing + // or for a failed attempt to infer anything, but at least we're in full control of making the best + // of this sad situation. + implicit def ttag: WeakTypeTag[T] = { + val tpe = ttag0.tpe + val sym = tpe.typeSymbol.asType + if (sym.isParameter && !isSkolem(sym)) TypeTag.Nothing.asInstanceOf[TypeTag[T]] + else ttag0 + } + reify(C[T](c.Expr[String](Literal(Constant(weakTypeOf[T].toString))).splice)) + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5923a/Test_2.scala b/tests/disabled/macro/run/t5923a/Test_2.scala new file mode 100644 index 000000000..1f0413bdf --- /dev/null +++ b/tests/disabled/macro/run/t5923a/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + println(implicitly[C[Int]]) + println(implicitly[C[String]]) + println(implicitly[C[Nothing]]) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5923d/Macros_1.scala b/tests/disabled/macro/run/t5923d/Macros_1.scala new file mode 100644 index 000000000..1400674d4 --- /dev/null +++ b/tests/disabled/macro/run/t5923d/Macros_1.scala @@ -0,0 +1,9 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +trait MappedRow +trait RowMapper[T <: MappedRow] +object RowMapper { + implicit def mapper[T <: MappedRow]: RowMapper[T] = macro impl[T] + def impl[T <: MappedRow : c.WeakTypeTag](c: Context) = c.universe.reify(new RowMapper[T]{}) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5923d/Test_2.scala b/tests/disabled/macro/run/t5923d/Test_2.scala new file mode 100644 index 000000000..e9c446209 --- /dev/null +++ b/tests/disabled/macro/run/t5923d/Test_2.scala @@ -0,0 +1,7 @@ +class RowA extends MappedRow +class RowB extends MappedRow + +object Test extends dotty.runtime.LegacyApp { + implicitly[RowMapper[RowA]] + implicitly[RowMapper[RowB]] +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t5940.scala b/tests/disabled/macro/run/t5940.scala new file mode 100644 index 000000000..856070821 --- /dev/null +++ b/tests/disabled/macro/run/t5940.scala @@ -0,0 +1,41 @@ +import scala.tools.partest._ + +object Test extends DirectTest { + def code = ??? + + def macros_1 = """ + import scala.reflect.macros.blackbox.Context + + object Impls { + def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") } + } + + object Macros { + //import Impls._ + def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") } + def foo: Unit = macro impl + } + """ + def compileMacros() = { + val classpath = List(sys.props("partest.lib"), sys.props("partest.reflect")) mkString sys.props("path.separator") + compileString(newCompiler("-language:experimental.macros", "-cp", classpath, "-d", testOutput.path))(macros_1) + } + + def test_2 = """ + object Test extends dotty.runtime.LegacyApp { + println(Macros.foo) + } + """ + def compileTest() = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(test_2) + } + + def show(): Unit = { + log("Compiling Macros_1...") + if (compileMacros()) { + log("Compiling Test_2...") + if (compileTest()) log("Success!") else log("Failed...") + } + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6023.check b/tests/disabled/macro/run/t6023.check new file mode 100644 index 000000000..ee9356523 --- /dev/null +++ b/tests/disabled/macro/run/t6023.check @@ -0,0 +1,12 @@ +{ + abstract trait Foo extends AnyRef { + def a: Int + }; + () +} +{ + abstract trait Foo extends AnyRef { + def a: Int + }; + () +} diff --git a/tests/disabled/macro/run/t6023.scala b/tests/disabled/macro/run/t6023.scala new file mode 100644 index 000000000..9ec8724a4 --- /dev/null +++ b/tests/disabled/macro/run/t6023.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + // test 1: reify + val tree = reify{ trait Foo { val a: Int } }.tree + println(tree.toString) + + // test 2: import and typecheck + val toolbox = cm.mkToolBox() + val ttree = toolbox.typecheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} diff --git a/tests/disabled/macro/run/t6187.check b/tests/disabled/macro/run/t6187.check new file mode 100644 index 000000000..9a9e266ec --- /dev/null +++ b/tests/disabled/macro/run/t6187.check @@ -0,0 +1,32 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.language.experimental.macros, scala.reflect.macros.blackbox.Context +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +scala> def macroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = { + val r = c.universe.reify { List(t.splice) } + c.Expr[List[T]]( c.untypecheck(r.tree) ) +} +macroImpl: [T](c: scala.reflect.macros.blackbox.Context)(t: c.Expr[T])(implicit evidence$1: c.WeakTypeTag[T])c.Expr[List[T]] + +scala> def demo[T](t: T): List[T] = macro macroImpl[T] +defined term macro demo: [T](t: T)List[T] + +scala> def m[T](t: T): List[List[T]] = + demo( List((t,true)) collect { case (x,true) => x } ) +m: [T](t: T)List[List[T]] + +scala> m(List(1)) +res0: List[List[List[Int]]] = List(List(List(1))) + +scala> // Showing we haven't added unreachable warnings + +scala> List(1) collect { case x => x } +res1: List[Int] = List(1) + +scala> List("") collect { case x => x } +res2: List[String] = List("") + +scala> :quit diff --git a/tests/disabled/macro/run/t6187.scala b/tests/disabled/macro/run/t6187.scala new file mode 100644 index 000000000..7a39cfd9e --- /dev/null +++ b/tests/disabled/macro/run/t6187.scala @@ -0,0 +1,18 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def code = """ +import scala.language.experimental.macros, scala.reflect.macros.blackbox.Context +def macroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = { + val r = c.universe.reify { List(t.splice) } + c.Expr[List[T]]( c.untypecheck(r.tree) ) +} +def demo[T](t: T): List[T] = macro macroImpl[T] +def m[T](t: T): List[List[T]] = + demo( List((t,true)) collect { case (x,true) => x } ) +m(List(1)) +// Showing we haven't added unreachable warnings +List(1) collect { case x => x } +List("") collect { case x => x } + """.trim +} diff --git a/tests/disabled/macro/run/t6187b.scala b/tests/disabled/macro/run/t6187b.scala new file mode 100644 index 000000000..412880f38 --- /dev/null +++ b/tests/disabled/macro/run/t6187b.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + val x: PartialFunction[Int, Int] = { case 1 => 1 } + val o: Any = "" + assert(x.applyOrElse(0, (_: Int) => o) == "") +} diff --git a/tests/disabled/macro/run/t6221.check b/tests/disabled/macro/run/t6221.check new file mode 100644 index 000000000..aa1bdd0e6 --- /dev/null +++ b/tests/disabled/macro/run/t6221.check @@ -0,0 +1 @@ +((x) => x.$percent(2).$eq$eq(0)) diff --git a/tests/disabled/macro/run/t6221/Macros_1.scala b/tests/disabled/macro/run/t6221/Macros_1.scala new file mode 100644 index 000000000..0aeaa00c8 --- /dev/null +++ b/tests/disabled/macro/run/t6221/Macros_1.scala @@ -0,0 +1,23 @@ +import language.experimental.macros +import language.implicitConversions +import scala.reflect.macros.blackbox.Context +import scala.reflect.runtime.universe.Tree + +class ReflectiveClosure[A, B](val tree: Tree, fn: A => B) extends (A => B) { + def apply(x: A) = fn(x) +} + +object ReflectiveClosure { + implicit def reflectClosure[A, B](f: A => B): ReflectiveClosure[A, B] = macro Macros.reflectiveClosureImpl[A, B] +} + +object Macros { + def reflectiveClosureImpl[A, B](c: Context)(f: c.Expr[A => B]): c.Expr[ReflectiveClosure[A, B]] = { + import c.universe._ + import internal._ + val u = gen.mkRuntimeUniverseRef + val m = EmptyTree + val tree = c.Expr[scala.reflect.runtime.universe.Tree](Select(c.reifyTree(u, m, f.tree), newTermName("tree"))) + c.universe.reify(new ReflectiveClosure(tree.splice, f.splice)) + } +} diff --git a/tests/disabled/macro/run/t6221/Test_2.scala b/tests/disabled/macro/run/t6221/Test_2.scala new file mode 100644 index 000000000..bc295d437 --- /dev/null +++ b/tests/disabled/macro/run/t6221/Test_2.scala @@ -0,0 +1,10 @@ +object Test extends dotty.runtime.LegacyApp { + implicit class PimpedList[T](val list: List[T]) { + def query(predicate: ReflectiveClosure[T, Boolean]): List[T] = { + println(predicate.tree) + list filter predicate + } + } + + List(1, 2, 3).query(x => x % 2 == 0) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6379.check b/tests/disabled/macro/run/t6379.check new file mode 100644 index 000000000..3e5dfec62 --- /dev/null +++ b/tests/disabled/macro/run/t6379.check @@ -0,0 +1,14 @@ +compile-time +uninitialized close: List(class IOException) +initialized close: List(class IOException) +uninitialized productElement: List(class IndexOutOfBoundsException) +initialized productElement: List(class IndexOutOfBoundsException) +uninitialized read: List(class IOException) +initialized read: List(class IOException) +runtime +uninitialized close: List(class IOException) +initialized close: List(class IOException) +uninitialized productElement: List(class IndexOutOfBoundsException) +initialized productElement: List(class IndexOutOfBoundsException) +uninitialized read: List(class IOException) +initialized read: List(class IOException) diff --git a/tests/disabled/macro/run/t6379/Macros_1.scala b/tests/disabled/macro/run/t6379/Macros_1.scala new file mode 100644 index 000000000..4f3daf497 --- /dev/null +++ b/tests/disabled/macro/run/t6379/Macros_1.scala @@ -0,0 +1,26 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros +import java.io._ + +object Macros { + def impl(c: Context) = { + var messages = List[String]() + def println(msg: String) = messages :+= msg + + import c.universe._ + def test(sym: MethodSymbol): Unit = { + println(s"uninitialized ${sym.name}: ${sym.exceptions}") + sym.info + println(s"initialized ${sym.name}: ${sym.exceptions}") + } + + println("compile-time") + test(typeOf[Closeable].declaration(TermName("close")).asMethod) + test(typeOf[Product1[_]].declaration(TermName("productElement")).asMethod) + test(c.mirror.staticClass("Reader").info.decl(TermName("read")).asMethod) + + q"..${messages.map(msg => q"println($msg)")}" + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6379/Test_2.scala b/tests/disabled/macro/run/t6379/Test_2.scala new file mode 100644 index 000000000..05bdd5575 --- /dev/null +++ b/tests/disabled/macro/run/t6379/Test_2.scala @@ -0,0 +1,22 @@ +import java.io._ +import scala.reflect.runtime.universe._ + +class Reader(fname: String) { + private val in = new BufferedReader(new FileReader(fname)) + @throws[IOException]("if the file doesn't exist") + def read() = in.read() +} + +object Test extends dotty.runtime.LegacyApp { + def test(sym: MethodSymbol): Unit = { + println(s"uninitialized ${sym.name}: ${sym.exceptions}") + sym.info + println(s"initialized ${sym.name}: ${sym.exceptions}") + } + + Macros.foo + println("runtime") + test(typeOf[Closeable].decl(TermName("close")).asMethod) + test(typeOf[Product1[_]].decl(TermName("productElement")).asMethod) + test(typeOf[Reader].decl(TermName("read")).asMethod) +} diff --git a/tests/disabled/macro/run/t6381.check b/tests/disabled/macro/run/t6381.check new file mode 100644 index 000000000..49c6a784a --- /dev/null +++ b/tests/disabled/macro/run/t6381.check @@ -0,0 +1,19 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.language.experimental.macros +import scala.language.experimental.macros + +scala> def pos_impl(c: scala.reflect.macros.blackbox.Context): c.Expr[String] = { + import c.universe._ + c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString))) +} +pos_impl: (c: scala.reflect.macros.blackbox.Context)c.Expr[String] + +scala> def pos: String = macro pos_impl +defined term macro pos: String + +scala> pos +res0: String = class scala.reflect.internal.util.RangePosition + +scala> :quit diff --git a/tests/disabled/macro/run/t6381.scala b/tests/disabled/macro/run/t6381.scala new file mode 100644 index 000000000..5a687c10c --- /dev/null +++ b/tests/disabled/macro/run/t6381.scala @@ -0,0 +1,15 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |import scala.language.experimental.macros + |def pos_impl(c: scala.reflect.macros.blackbox.Context): c.Expr[String] = { + | import c.universe._ + | c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString))) + |} + |def pos: String = macro pos_impl + |pos + |""".stripMargin.trim + + override def extraSettings: String = "-Yrangepos" +} diff --git a/tests/disabled/macro/run/t6394a.check b/tests/disabled/macro/run/t6394a.check new file mode 100644 index 000000000..2a02d41ce --- /dev/null +++ b/tests/disabled/macro/run/t6394a.check @@ -0,0 +1 @@ +TEST diff --git a/tests/disabled/macro/run/t6394a.flags b/tests/disabled/macro/run/t6394a.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/t6394a.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/t6394a/Macros_1.scala b/tests/disabled/macro/run/t6394a/Macros_1.scala new file mode 100644 index 000000000..376d85ba6 --- /dev/null +++ b/tests/disabled/macro/run/t6394a/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c:Context): c.Expr[Any] = { + import c.universe._ + + val selfTree = This(c.enclosingImpl.symbol.asModule.moduleClass) + c.Expr[AnyRef](selfTree) + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6394a/Test_2.scala b/tests/disabled/macro/run/t6394a/Test_2.scala new file mode 100644 index 000000000..989ab3031 --- /dev/null +++ b/tests/disabled/macro/run/t6394a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo) + override def toString = "TEST" +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6394b.check b/tests/disabled/macro/run/t6394b.check new file mode 100644 index 000000000..2a02d41ce --- /dev/null +++ b/tests/disabled/macro/run/t6394b.check @@ -0,0 +1 @@ +TEST diff --git a/tests/disabled/macro/run/t6394b.flags b/tests/disabled/macro/run/t6394b.flags new file mode 100644 index 000000000..cd66464f2 --- /dev/null +++ b/tests/disabled/macro/run/t6394b.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/tests/disabled/macro/run/t6394b/Macros_1.scala b/tests/disabled/macro/run/t6394b/Macros_1.scala new file mode 100644 index 000000000..1a747816e --- /dev/null +++ b/tests/disabled/macro/run/t6394b/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c:Context): c.Expr[Any] = { + import c.universe._ + + val selfTree = This(typeNames.EMPTY) + c.Expr[AnyRef](selfTree) + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6394b/Test_2.scala b/tests/disabled/macro/run/t6394b/Test_2.scala new file mode 100644 index 000000000..989ab3031 --- /dev/null +++ b/tests/disabled/macro/run/t6394b/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo) + override def toString = "TEST" +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6591_1.check b/tests/disabled/macro/run/t6591_1.check new file mode 100644 index 000000000..d1d448f28 --- /dev/null +++ b/tests/disabled/macro/run/t6591_1.check @@ -0,0 +1 @@ +Block(List(ValDef(Modifiers(), TermName("v"), Select(Ident(A), TypeName("I")), Select(Ident(A), TermName("impl")))), Ident(TermName("v"))) diff --git a/tests/disabled/macro/run/t6591_1.scala b/tests/disabled/macro/run/t6591_1.scala new file mode 100644 index 000000000..8c152f68a --- /dev/null +++ b/tests/disabled/macro/run/t6591_1.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +trait O { trait I } + +object A extends O { + val impl = new I {} +} + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + val v: A.I = A.impl + v + } + println(showRaw(code.tree)) + + val v: A.I = code.eval +} diff --git a/tests/disabled/macro/run/t6591_2.check b/tests/disabled/macro/run/t6591_2.check new file mode 100644 index 000000000..a2930b174 --- /dev/null +++ b/tests/disabled/macro/run/t6591_2.check @@ -0,0 +1 @@ +Block(List(ValDef(Modifiers(), TermName("v"), SelectFromTypeTree(Ident(A), TypeName("I")), Select(Apply(Select(New(Ident(A)), termNames.CONSTRUCTOR), List()), TermName("impl")))), Ident(TermName("v"))) diff --git a/tests/disabled/macro/run/t6591_2.scala b/tests/disabled/macro/run/t6591_2.scala new file mode 100644 index 000000000..9e6c917e8 --- /dev/null +++ b/tests/disabled/macro/run/t6591_2.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +trait O { trait I } + +class A extends O { + val impl = new I {} +} + +object Test extends dotty.runtime.LegacyApp { + val code = reify { + val v: A#I = (new A).impl + v + } + println(showRaw(code.tree)) + + val v: A#I = code.eval +} diff --git a/tests/disabled/macro/run/t6591_3.check b/tests/disabled/macro/run/t6591_3.check new file mode 100644 index 000000000..362aafd11 --- /dev/null +++ b/tests/disabled/macro/run/t6591_3.check @@ -0,0 +1 @@ +Block(List(ValDef(Modifiers(), TermName("v"), Select(This(TypeName("A")), TypeName("I")), Apply(Select(New(Select(This(TypeName("A")), TypeName("I"))), termNames.CONSTRUCTOR), List()))), Ident(TermName("v"))) diff --git a/tests/disabled/macro/run/t6591_3.scala b/tests/disabled/macro/run/t6591_3.scala new file mode 100644 index 000000000..5069b800e --- /dev/null +++ b/tests/disabled/macro/run/t6591_3.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +class O { class I } + +object A extends O { + val code = reify { + val v: I = new I + v + } + println(showRaw(code.tree)) +} + +object Test extends dotty.runtime.LegacyApp { + val v: A.I = A.code.eval +} diff --git a/tests/disabled/macro/run/t6591_5.check b/tests/disabled/macro/run/t6591_5.check new file mode 100644 index 000000000..4ebc2236a --- /dev/null +++ b/tests/disabled/macro/run/t6591_5.check @@ -0,0 +1 @@ +Expr(Block(List(ValDef(Modifiers(), TermName("v"), Select(Select(This(TypeName("A")), TermName("x")), TypeName("I")), Select(Ident(scala.Predef), TermName("$qmark$qmark$qmark")))), Ident(TermName("v")))) diff --git a/tests/disabled/macro/run/t6591_5.scala b/tests/disabled/macro/run/t6591_5.scala new file mode 100644 index 000000000..dfb4cd5ad --- /dev/null +++ b/tests/disabled/macro/run/t6591_5.scala @@ -0,0 +1,23 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval +import java.lang.reflect.InvocationTargetException + +class O { class I } + +object A extends O { + val x = new O + val code = reify { + val v: x.I = ??? + v + } + println(showRaw(code)) +} + +object Test extends dotty.runtime.LegacyApp { + try { + val v: A.x.I = A.code.eval + } catch { + case ex: InvocationTargetException if ex.getCause.isInstanceOf[NotImplementedError] => + } +} diff --git a/tests/disabled/macro/run/t6591_6.check b/tests/disabled/macro/run/t6591_6.check new file mode 100644 index 000000000..940e2026f --- /dev/null +++ b/tests/disabled/macro/run/t6591_6.check @@ -0,0 +1 @@ +Expr(Block(List(ValDef(Modifiers(), TermName("v"), Select(Select(Ident(TermName("A")), TermName("x")), TypeName("I")), Select(Ident(scala.Predef), TermName("$qmark$qmark$qmark")))), Ident(TermName("v")))) diff --git a/tests/disabled/macro/run/t6591_6.scala b/tests/disabled/macro/run/t6591_6.scala new file mode 100644 index 000000000..afb2da229 --- /dev/null +++ b/tests/disabled/macro/run/t6591_6.scala @@ -0,0 +1,24 @@ +import scala.language.existentials +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval +import java.lang.reflect.InvocationTargetException + +class O { class I } + +class A extends O { + val x = new O + val code = reify { + val v: x.I = ??? + v + } + println(showRaw(code)) +} + +object Test extends dotty.runtime.LegacyApp { + try { + val v = (new A).code.eval + } catch { + case ex: InvocationTargetException if ex.getCause.isInstanceOf[NotImplementedError] => + } +} diff --git a/tests/disabled/macro/run/t6591_7.check b/tests/disabled/macro/run/t6591_7.check new file mode 100644 index 000000000..e21a3669b --- /dev/null +++ b/tests/disabled/macro/run/t6591_7.check @@ -0,0 +1,4 @@ +name = x, stable = true +name = y, stable = true +name = z, stable = false +name = C, stable = true diff --git a/tests/disabled/macro/run/t6591_7.scala b/tests/disabled/macro/run/t6591_7.scala new file mode 100644 index 000000000..cec0d2cda --- /dev/null +++ b/tests/disabled/macro/run/t6591_7.scala @@ -0,0 +1,27 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval +import internal._ + +object Test extends dotty.runtime.LegacyApp { + locally { + val x = 2 + def y = 3 + var z = 4 + class C { + var w = 5 + locally { + val expr = reify(x + y + z + w) + // blocked by SI-7103, though it's not the focus of this test + // therefore I'm just commenting out the evaluation + // println(expr.eval) + freeTerms(expr.tree) foreach (ft => { + // blocked by SI-7104, though it's not the focus of this test + // therefore I'm just commenting out the call to info + // println(s"name = ${ft.name}, sig = ${ft.info}, stable = ${ft.isStable}") + println(s"name = ${ft.name}, stable = ${ft.isStable}") + }) + } + } + new C() + } +} diff --git a/tests/disabled/macro/run/t6662.check b/tests/disabled/macro/run/t6662.check new file mode 100644 index 000000000..6a452c185 --- /dev/null +++ b/tests/disabled/macro/run/t6662.check @@ -0,0 +1 @@ +() diff --git a/tests/disabled/macro/run/t6662/Macro_1.scala b/tests/disabled/macro/run/t6662/Macro_1.scala new file mode 100644 index 000000000..419859772 --- /dev/null +++ b/tests/disabled/macro/run/t6662/Macro_1.scala @@ -0,0 +1,8 @@ +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Demo { + def id[T](a: T): T = macro idImpl[T] + + def idImpl[T: c.WeakTypeTag](c: Context)(a: c.Expr[T]): c.Expr[T] = a +} diff --git a/tests/disabled/macro/run/t6662/Test_2.scala b/tests/disabled/macro/run/t6662/Test_2.scala new file mode 100644 index 000000000..82ac54cb4 --- /dev/null +++ b/tests/disabled/macro/run/t6662/Test_2.scala @@ -0,0 +1,8 @@ +// Macro usage: + +object Test { + def main(args: Array[String]) { + val s = Demo id (()) + println(s) + } +} diff --git a/tests/disabled/macro/run/t6814.check b/tests/disabled/macro/run/t6814.check new file mode 100644 index 000000000..97ada7720 --- /dev/null +++ b/tests/disabled/macro/run/t6814.check @@ -0,0 +1,7 @@ +List[Int] +scala.collection.immutable.List.type +object java.lang.RuntimeException is not a value +List[Int] +List +scala.collection.immutable.List.type +scala.collection.immutable.List.type does not take parameters diff --git a/tests/disabled/macro/run/t6814/Macros_1.scala b/tests/disabled/macro/run/t6814/Macros_1.scala new file mode 100644 index 000000000..0257f451d --- /dev/null +++ b/tests/disabled/macro/run/t6814/Macros_1.scala @@ -0,0 +1,24 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + + def test(tree: Tree, mode: c.TypecheckMode): String = { + try c.typecheck(tree, mode, silent = false).tpe.toString + catch { case c.TypecheckException(_, msg) => msg } + } + + q""" + println(${test(q"List(1, 2)", c.TERMmode)}) + println(${test(q"List", c.TERMmode)}) + println(${test(q"RuntimeException", c.TERMmode)}) + println(${test(tq"List[Int]", c.TYPEmode)}) + println(${test(tq"List", c.TYPEmode)}) + println(${test(q"List", c.TYPEmode)}) + println(${test(q"List(1, 2)", c.TYPEmode)}) + """ + } + def foo: Unit = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6814/Test_2.scala b/tests/disabled/macro/run/t6814/Test_2.scala new file mode 100644 index 000000000..0fc472aa6 --- /dev/null +++ b/tests/disabled/macro/run/t6814/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6992.check b/tests/disabled/macro/run/t6992.check new file mode 100644 index 000000000..021f32ec9 --- /dev/null +++ b/tests/disabled/macro/run/t6992.check @@ -0,0 +1,4 @@ +Test.foo.T +Int +42 +42 diff --git a/tests/disabled/macro/run/t6992/Macros_1.scala b/tests/disabled/macro/run/t6992/Macros_1.scala new file mode 100644 index 000000000..f578f2b3c --- /dev/null +++ b/tests/disabled/macro/run/t6992/Macros_1.scala @@ -0,0 +1,75 @@ +import scala.language.experimental.macros +import scala.reflect.macros.whitebox.Context + +object Macros { + def foo(name: String): Any = macro foo_impl + def foo_impl(c: Context)(name: c.Expr[String]) = { + import c.universe._ + + val Literal(Constant(lit: String)) = name.tree + val anon = newTypeName(c.fresh) + + c.Expr(Block( + ClassDef( + Modifiers(Flag.FINAL), anon, Nil, Template( + Nil, noSelfType, List( + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), + TypeDef(Modifiers(), TypeName(lit), Nil, TypeTree(typeOf[Int])) + ) + ) + ), + Apply(Select(New(Ident(anon)), termNames.CONSTRUCTOR), Nil) + )) + } + + def bar(name: String): Any = macro bar_impl + def bar_impl(c: Context)(name: c.Expr[String]) = { + import c.universe._ + + val Literal(Constant(lit: String)) = name.tree + val anon = newTypeName(c.fresh) + + c.Expr(Block( + ClassDef( + Modifiers(Flag.FINAL), anon, Nil, Template( + Nil, noSelfType, List( + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), + DefDef( + Modifiers(), TermName(lit), Nil, Nil, TypeTree(), + c.literal(42).tree + ) + ) + ) + ), + Apply(Select(New(Ident(anon)), termNames.CONSTRUCTOR), Nil) + )) + } + + def baz(name: String): Any = macro baz_impl + def baz_impl(c: Context)(name: c.Expr[String]) = { + import c.universe._ + + val Literal(Constant(lit: String)) = name.tree + val anon = newTypeName(c.fresh) + val wrapper = newTypeName(c.fresh) + + c.Expr(Block( + ClassDef( + Modifiers(), anon, Nil, Template( + Nil, emptyValDef, List( + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), + DefDef( + Modifiers(), TermName(lit), Nil, Nil, TypeTree(), + c.literal(42).tree + ) + ) + ) + ), + ClassDef( + Modifiers(Flag.FINAL), wrapper, Nil, + Template(Ident(anon) :: Nil, noSelfType, DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))) :: Nil) + ), + Apply(Select(New(Ident(wrapper)), termNames.CONSTRUCTOR), Nil) + )) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t6992/Test_2.scala b/tests/disabled/macro/run/t6992/Test_2.scala new file mode 100644 index 000000000..5d1a64eac --- /dev/null +++ b/tests/disabled/macro/run/t6992/Test_2.scala @@ -0,0 +1,14 @@ +import scala.language.reflectiveCalls + +object Test extends dotty.runtime.LegacyApp { + val foo = Macros.foo("T") + val ttpe = scala.reflect.runtime.universe.weakTypeOf[foo.T] + println(ttpe) + println(ttpe.typeSymbol.info) + + val bar = Macros.bar("test") + println(bar.test) + + val baz = Macros.baz("test") + println(baz.test) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7008-scala-defined.check b/tests/disabled/macro/run/t7008-scala-defined.check new file mode 100644 index 000000000..84ed62619 --- /dev/null +++ b/tests/disabled/macro/run/t7008-scala-defined.check @@ -0,0 +1,7 @@ +: List(throws[NullPointerException]("")) +bar: List(throws[E1]("")) +baz: List(throws[IllegalStateException]("")) +============= +: List(throws[NullPointerException]("")) +bar: List(throws[E1]("")) +baz: List(throws[IllegalStateException]("")) diff --git a/tests/disabled/macro/run/t7008-scala-defined.flags b/tests/disabled/macro/run/t7008-scala-defined.flags new file mode 100644 index 000000000..49f2d2c4c --- /dev/null +++ b/tests/disabled/macro/run/t7008-scala-defined.flags @@ -0,0 +1 @@ +-Ybackend:GenASM diff --git a/tests/disabled/macro/run/t7008-scala-defined/Impls_Macros_2.scala b/tests/disabled/macro/run/t7008-scala-defined/Impls_Macros_2.scala new file mode 100644 index 000000000..330db8da7 --- /dev/null +++ b/tests/disabled/macro/run/t7008-scala-defined/Impls_Macros_2.scala @@ -0,0 +1,13 @@ +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + val decls = c.typeOf[ScalaClassWithCheckedExceptions_1[_]].decls.toList + val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL) + reify(println(c.Expr[String](Literal(Constant(s))).splice)) + } + + def foo = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7008-scala-defined/ScalaClassWithCheckedExceptions_1.scala b/tests/disabled/macro/run/t7008-scala-defined/ScalaClassWithCheckedExceptions_1.scala new file mode 100644 index 000000000..7783c873e --- /dev/null +++ b/tests/disabled/macro/run/t7008-scala-defined/ScalaClassWithCheckedExceptions_1.scala @@ -0,0 +1,6 @@ +class ScalaClassWithCheckedExceptions_1[E1 <: Exception] @throws[NullPointerException]("") () { + @throws[E1]("") def bar() {} + @throws[IllegalStateException]("") def baz(x: Int) {} + // FIXME: SI-7066 + // @throws[E2]("") def foo[E2 <: Exception] {} +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7008-scala-defined/Test_3.scala b/tests/disabled/macro/run/t7008-scala-defined/Test_3.scala new file mode 100644 index 000000000..23adb88b2 --- /dev/null +++ b/tests/disabled/macro/run/t7008-scala-defined/Test_3.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + Macros.foo + println("=============") + + val decls = typeOf[ScalaClassWithCheckedExceptions_1[_]].decls.toList + decls sortBy (_.name.toString) foreach (decl => println(s"${decl.name}: ${decl.annotations}")) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7008.check b/tests/disabled/macro/run/t7008.check new file mode 100644 index 000000000..ee077f90f --- /dev/null +++ b/tests/disabled/macro/run/t7008.check @@ -0,0 +1,9 @@ +: List(throws[NullPointerException](classOf[java.lang.NullPointerException])) +bar: List(throws[Exception](classOf[java.lang.Exception])) +baz: List(throws[IllegalStateException](classOf[java.lang.IllegalStateException])) +foo: List(throws[Exception](classOf[java.lang.Exception])) +============= +: List(throws[java.lang.NullPointerException](classOf[java.lang.NullPointerException])) +bar: List(throws[java.lang.Exception](classOf[java.lang.Exception])) +baz: List(throws[java.lang.IllegalStateException](classOf[java.lang.IllegalStateException])) +foo: List(throws[java.lang.Exception](classOf[java.lang.Exception])) diff --git a/tests/disabled/macro/run/t7008/Impls_Macros_2.scala b/tests/disabled/macro/run/t7008/Impls_Macros_2.scala new file mode 100644 index 000000000..3c6fe116c --- /dev/null +++ b/tests/disabled/macro/run/t7008/Impls_Macros_2.scala @@ -0,0 +1,13 @@ +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + val decls = c.typeOf[JavaClassWithCheckedExceptions_1[_]].decls.toList + val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL) + reify(println(c.Expr[String](Literal(Constant(s))).splice)) + } + + def foo = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7008/JavaClassWithCheckedExceptions_1.java b/tests/disabled/macro/run/t7008/JavaClassWithCheckedExceptions_1.java new file mode 100644 index 000000000..dda212830 --- /dev/null +++ b/tests/disabled/macro/run/t7008/JavaClassWithCheckedExceptions_1.java @@ -0,0 +1,7 @@ +class JavaClassWithCheckedExceptions_1 { + public JavaClassWithCheckedExceptions_1() throws NullPointerException {} + + public void bar() throws E1 {} + public void baz(int x) throws IllegalStateException {} + public void foo() throws E2 {} +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7008/Test_3.scala b/tests/disabled/macro/run/t7008/Test_3.scala new file mode 100644 index 000000000..00e0eb684 --- /dev/null +++ b/tests/disabled/macro/run/t7008/Test_3.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends dotty.runtime.LegacyApp { + Macros.foo + println("=============") + + val decls = typeOf[JavaClassWithCheckedExceptions_1[_]].decls.toList + decls sortBy (_.name.toString) foreach (decl => println(s"${decl.name}: ${decl.annotations}")) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7044.check b/tests/disabled/macro/run/t7044.check new file mode 100644 index 000000000..ab523873b --- /dev/null +++ b/tests/disabled/macro/run/t7044.check @@ -0,0 +1,14 @@ +compile-time +uninitialized File: +initialized File: +uninitialized BitSet: +initialized BitSet: +uninitialized C: Test_2.scala +initialized C: Test_2.scala +runtime +autoinitialized File: true +autoinitialized File: true +autoinitialized BitSet: true +autoinitialized BitSet: true +autoinitialized C: true +autoinitialized C: true diff --git a/tests/disabled/macro/run/t7044/Macros_1.scala b/tests/disabled/macro/run/t7044/Macros_1.scala new file mode 100644 index 000000000..3b3f8c338 --- /dev/null +++ b/tests/disabled/macro/run/t7044/Macros_1.scala @@ -0,0 +1,26 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +object Macros { + def impl(c: Context) = { + var messages = List[String]() + def println(msg: String) = messages :+= msg + + import c.universe._ + def test(tpe: Type): Unit = { + val sym = tpe.typeSymbol + println(s"uninitialized ${sym.name}: ${sym.pos.source.file.name}") + internal.initialize(sym) + println(s"initialized ${sym.name}: ${sym.pos.source.file.name}") + } + + println("compile-time") + test(typeOf[java.io.File]) + test(typeOf[scala.collection.BitSet]) + test(c.mirror.staticClass("C").toType) + + q"..${messages.map(msg => q"println($msg)")}" + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7044/Test_2.scala b/tests/disabled/macro/run/t7044/Test_2.scala new file mode 100644 index 000000000..e7a34d04c --- /dev/null +++ b/tests/disabled/macro/run/t7044/Test_2.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +class C + +object Test extends dotty.runtime.LegacyApp { + def test(tpe: Type): Unit = { + val sym = tpe.typeSymbol + println(s"autoinitialized ${sym.name}: ${sym.pos.source.file.name} ${sym.pos.source.file.sizeOption.nonEmpty}") + internal.initialize(sym) + println(s"autoinitialized ${sym.name}: ${sym.pos.source.file.name} ${sym.pos.source.file.sizeOption.nonEmpty}") + } + + Macros.foo + println("runtime") + test(typeOf[java.io.File]) + test(typeOf[scala.collection.BitSet]) + test(typeOf[C]) +} diff --git a/tests/disabled/macro/run/t7047.check b/tests/disabled/macro/run/t7047.check new file mode 100644 index 000000000..32bd58109 --- /dev/null +++ b/tests/disabled/macro/run/t7047.check @@ -0,0 +1,3 @@ +Test_2.scala:2: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + Macros.foo + ^ diff --git a/tests/disabled/macro/run/t7047/Impls_Macros_1.scala b/tests/disabled/macro/run/t7047/Impls_Macros_1.scala new file mode 100644 index 000000000..787ea6cfe --- /dev/null +++ b/tests/disabled/macro/run/t7047/Impls_Macros_1.scala @@ -0,0 +1,19 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +class Foo + +object Macros { + def impl(c: Context) = { + import c.universe._ + try { + c.inferImplicitValue(typeOf[Foo], silent = false) + c.abort(c.enclosingPosition, "silent=false is not working") + } catch { + case _: Exception => + } + c.Expr[Null](Literal(Constant(null))) + } + + def foo = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7047/Test_2.scala b/tests/disabled/macro/run/t7047/Test_2.scala new file mode 100644 index 000000000..0fc472aa6 --- /dev/null +++ b/tests/disabled/macro/run/t7047/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7157.check b/tests/disabled/macro/run/t7157.check new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/disabled/macro/run/t7157.check @@ -0,0 +1 @@ +1 diff --git a/tests/disabled/macro/run/t7157/Impls_Macros_1.scala b/tests/disabled/macro/run/t7157/Impls_Macros_1.scala new file mode 100644 index 000000000..cc258b016 --- /dev/null +++ b/tests/disabled/macro/run/t7157/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +object Macros { + object AImpl { + def a(ctx: Context)(args: ctx.Expr[Any]*): ctx.Expr[Unit] = { + import ctx.universe._ + ctx.Expr[Unit](Apply(Ident(TermName("println")), List(Literal(Constant(1))))) + } + } + + implicit class A(context: StringContext) { + def a(args: Any*): Unit = macro AImpl.a + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7157/Test_2.scala b/tests/disabled/macro/run/t7157/Test_2.scala new file mode 100644 index 000000000..be0d54d75 --- /dev/null +++ b/tests/disabled/macro/run/t7157/Test_2.scala @@ -0,0 +1,5 @@ +import Macros._ + +object Test extends dotty.runtime.LegacyApp { + a"" +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7185.check b/tests/disabled/macro/run/t7185.check new file mode 100644 index 000000000..e4f80a8ff --- /dev/null +++ b/tests/disabled/macro/run/t7185.check @@ -0,0 +1,32 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.tools.reflect.ToolBox +import scala.tools.reflect.ToolBox + +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ + +scala> object O { def apply() = 0 } +defined object O + +scala> val ORef = reify { O }.tree +ORef: reflect.runtime.universe.Tree = $read.O + +scala> val tree = Apply(Block(Nil, Block(Nil, ORef)), Nil) +tree: reflect.runtime.universe.Apply = +{ + { + $read.O + } +}() + +scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typecheck(tree): Any} +res0: Any = +{ + { + $read.O.apply() + } +} + +scala> :quit diff --git a/tests/disabled/macro/run/t7185.scala b/tests/disabled/macro/run/t7185.scala new file mode 100644 index 000000000..62d64246b --- /dev/null +++ b/tests/disabled/macro/run/t7185.scala @@ -0,0 +1,12 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def code = """ +import scala.tools.reflect.ToolBox +import scala.reflect.runtime.universe._ +object O { def apply() = 0 } +val ORef = reify { O }.tree +val tree = Apply(Block(Nil, Block(Nil, ORef)), Nil) +{val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typecheck(tree): Any} +""" +} diff --git a/tests/disabled/macro/run/t7235.check b/tests/disabled/macro/run/t7235.check new file mode 100644 index 000000000..9cb9c55a0 --- /dev/null +++ b/tests/disabled/macro/run/t7235.check @@ -0,0 +1,4 @@ +C +List(C) +private val _ = _ +List() diff --git a/tests/disabled/macro/run/t7235.scala b/tests/disabled/macro/run/t7235.scala new file mode 100644 index 000000000..2e6af545d --- /dev/null +++ b/tests/disabled/macro/run/t7235.scala @@ -0,0 +1,14 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +class C + +object Test extends dotty.runtime.LegacyApp { + val Block(List(ValDef(_, _, tpt: CompoundTypeTree, _)), _) = reify{ val x: C{} = ??? }.tree + println(tpt) + println(tpt.templ.parents) + println(tpt.templ.self) + println(tpt.templ.body) +} diff --git a/tests/disabled/macro/run/t7240/Macros_1.scala b/tests/disabled/macro/run/t7240/Macros_1.scala new file mode 100644 index 000000000..b24b607d1 --- /dev/null +++ b/tests/disabled/macro/run/t7240/Macros_1.scala @@ -0,0 +1,48 @@ +package bakery + +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +trait FailureCake { + implicit def liftAnyFails[T: Manifest]: Any = ??? + + // This works + // implicit def liftAny[T]: Any = ??? +} + +object Bakery { + + def failure: Any = macro failureImpl + def failureImpl(c: Context): c.Expr[Any] = { + import c.universe._ + + def dslTrait(dslName: String) = { + val names = dslName.split("\\.").toList.reverse + assert(names.length >= 1, "DSL trait name must be in the valid format. DSL trait name is " + dslName) + + val tpeName = newTypeName(names.head) + names.tail.reverse match { + case head :: tail ⇒ + Select(tail.foldLeft[Tree](Ident(newTermName(head)))((tree, name) ⇒ Select(tree, newTermName(name))), tpeName) + case Nil ⇒ + Ident(tpeName) + } + } + + def composeDSL(transformedBody: Tree) = + ClassDef(Modifiers(), newTypeName("eval"), List(), Template( + List(dslTrait("bakery.FailureCake")), + emptyValDef, + List( + DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), + Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))), + DefDef(Modifiers(), newTermName("main"), List(), List(List()), Ident(newTypeName("Any")), transformedBody)))) + + def constructor = Apply(Select(New(Ident(newTypeName("eval"))), termNames.CONSTRUCTOR), List()) + + c.eval(c.Expr[Any]( + c.untypecheck(Block(composeDSL(Literal(Constant(1))), constructor)))) + + c.Expr[Any](Literal(Constant(1))) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7240/Test_2.scala b/tests/disabled/macro/run/t7240/Test_2.scala new file mode 100644 index 000000000..27d2893d3 --- /dev/null +++ b/tests/disabled/macro/run/t7240/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + val v = bakery.Bakery.failure +} diff --git a/tests/disabled/macro/run/t7375b.check b/tests/disabled/macro/run/t7375b.check new file mode 100644 index 000000000..d7578e28b --- /dev/null +++ b/tests/disabled/macro/run/t7375b.check @@ -0,0 +1,4 @@ +Predef.this.classOf[C1] +Predef.this.classOf[C2] +Predef.this.classOf[C1] +Predef.this.classOf[C2] diff --git a/tests/disabled/macro/run/t7375b/Macros_1.scala b/tests/disabled/macro/run/t7375b/Macros_1.scala new file mode 100644 index 000000000..b6090e730 --- /dev/null +++ b/tests/disabled/macro/run/t7375b/Macros_1.scala @@ -0,0 +1,18 @@ +import language.experimental.macros +import scala.reflect.macros.blackbox.Context + +class C1(val n: Int) extends AnyVal +class C2(val n: Int) extends AnyRef + +object Macros { + type F1 = C1 + type F2 = C2 + + def foo = macro impl + def impl(c: Context) = { + import c.universe._ + def test[T: c.TypeTag] = reify(println(c.Expr[String](Literal(Constant(c.reifyRuntimeClass(c.typeOf[T]).toString))).splice)).tree + def tests = Block(List(test[C1], test[C2], test[F1], test[F2]), Literal(Constant(()))) + c.Expr[Unit](tests) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7375b/Test_2.scala b/tests/disabled/macro/run/t7375b/Test_2.scala new file mode 100644 index 000000000..0fc472aa6 --- /dev/null +++ b/tests/disabled/macro/run/t7375b/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7558.scala b/tests/disabled/macro/run/t7558.scala new file mode 100644 index 000000000..26163555f --- /dev/null +++ b/tests/disabled/macro/run/t7558.scala @@ -0,0 +1,9 @@ +object Test extends dotty.runtime.LegacyApp { + val cm = reflect.runtime.currentMirror + val u = cm.universe + import scala.tools.reflect.ToolBox + val tb = cm.mkToolBox() + val t = { var x = "ab".toList; u.reify { x = x.reverse; x }.tree } + val evaluated = tb.eval(t) + assert(evaluated == "ba".toList, evaluated) +} diff --git a/tests/disabled/macro/run/t7617a.check b/tests/disabled/macro/run/t7617a.check new file mode 100644 index 000000000..94954abda --- /dev/null +++ b/tests/disabled/macro/run/t7617a.check @@ -0,0 +1,2 @@ +hello +world diff --git a/tests/disabled/macro/run/t7617a/Macros_1.scala b/tests/disabled/macro/run/t7617a/Macros_1.scala new file mode 100644 index 000000000..77b18c20e --- /dev/null +++ b/tests/disabled/macro/run/t7617a/Macros_1.scala @@ -0,0 +1,22 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +object Macros { + def getValueImpl[T](c: Context): c.Expr[T] = { + import c.universe._ + c.Expr[T](Apply(Select(c.prefix.tree, newTermName("getVal")), Nil)) + } + def setValueImpl[T](c: Context)(value: c.Expr[T]): c.Expr[Unit] = { + import c.universe._ + c.Expr[Unit](Apply(Select(c.prefix.tree, newTermName("setVal")), List(value.tree))) + } +} + +object Module { + private var _val: String = "hello" + def setVal(value: String): Unit = this._val = value + def getVal(): String = this._val + + def value: String = macro Macros.getValueImpl[String] + def value_=(value: String): Unit = macro Macros.setValueImpl[String] +} diff --git a/tests/disabled/macro/run/t7617a/Test_2.scala b/tests/disabled/macro/run/t7617a/Test_2.scala new file mode 100644 index 000000000..aaf268a8c --- /dev/null +++ b/tests/disabled/macro/run/t7617a/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + println(Module.value) + Module.value = "world" + println(Module.value) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7617b.check b/tests/disabled/macro/run/t7617b.check new file mode 100644 index 000000000..81ec7e8b7 --- /dev/null +++ b/tests/disabled/macro/run/t7617b.check @@ -0,0 +1 @@ +foo = 2 diff --git a/tests/disabled/macro/run/t7617b/Macros_1.scala b/tests/disabled/macro/run/t7617b/Macros_1.scala new file mode 100644 index 000000000..90fcfda47 --- /dev/null +++ b/tests/disabled/macro/run/t7617b/Macros_1.scala @@ -0,0 +1,8 @@ +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context)(name: c.Expr[String])(value: c.Expr[Any]) = { + import c.universe._ + reify(println(s"${name.splice} = ${value.splice}")) + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7617b/Test_2.scala b/tests/disabled/macro/run/t7617b/Test_2.scala new file mode 100644 index 000000000..0ce77a1c7 --- /dev/null +++ b/tests/disabled/macro/run/t7617b/Test_2.scala @@ -0,0 +1,11 @@ +import scala.language.dynamics +import language.experimental.macros + +class C extends Dynamic { + def updateDynamic(name: String)(value: Any): Unit = macro Macros.impl +} + +object Test extends dotty.runtime.LegacyApp { + val c = new C + c.foo = 2 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7657.check b/tests/disabled/macro/run/t7657.check new file mode 100644 index 000000000..c25d8d1c1 --- /dev/null +++ b/tests/disabled/macro/run/t7657.check @@ -0,0 +1,3 @@ +() +() +() diff --git a/tests/disabled/macro/run/t7657/Macros_1.scala b/tests/disabled/macro/run/t7657/Macros_1.scala new file mode 100644 index 000000000..a883f76bc --- /dev/null +++ b/tests/disabled/macro/run/t7657/Macros_1.scala @@ -0,0 +1,8 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +trait T { def t(): Unit } +abstract class A extends T { override def t(): Unit = () } + +object Macro { def t(c: Context)(): c.Expr[Unit] = c.universe.reify(()) } +class C extends A { override def t(): Unit = macro Macro.t } diff --git a/tests/disabled/macro/run/t7657/Test_2.scala b/tests/disabled/macro/run/t7657/Test_2.scala new file mode 100644 index 000000000..68dfb5c8b --- /dev/null +++ b/tests/disabled/macro/run/t7657/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + val c = new C() + println(c.t()) + println((c: T).t()) + println((c: A).t()) +} diff --git a/tests/disabled/macro/run/t7777.check b/tests/disabled/macro/run/t7777.check new file mode 100644 index 000000000..162ff2d2a --- /dev/null +++ b/tests/disabled/macro/run/t7777.check @@ -0,0 +1,7 @@ +foo(1, 2) +bar(4, 5) +foo(3) +bar(7) +apply(6) +apply(9) +foo(8) diff --git a/tests/disabled/macro/run/t7777/Macros_1.scala b/tests/disabled/macro/run/t7777/Macros_1.scala new file mode 100644 index 000000000..1dc6d6740 --- /dev/null +++ b/tests/disabled/macro/run/t7777/Macros_1.scala @@ -0,0 +1,17 @@ +import scala.language.experimental.macros +import scala.language.dynamics +import scala.reflect.macros.whitebox.Context + +class DynMacro extends Dynamic { + def applyDynamic(s: String)(xs: Any*): DynMacro = + macro DynMacro.applyDynamicMacro +} + +object DynMacro extends DynMacro { + def applyDynamicMacro(c: Context)(s: c.Expr[String])(xs: c.Expr[Any]*): c.Expr[DynMacro] = { + import c.universe._ + val Literal(Constant(n: String)) = s.tree + val args = xs.map(_.tree.toString).mkString("(", ", ", ")") + c.Expr(q"println(${ n + args }); ${c.prefix.tree}") + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7777/Test_2.scala b/tests/disabled/macro/run/t7777/Test_2.scala new file mode 100644 index 000000000..7f84f64e4 --- /dev/null +++ b/tests/disabled/macro/run/t7777/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + DynMacro.foo(1, 2) // prints "foo(1, 2)" + DynMacro.foo(3).bar(4, 5) // prints "bar(4, 5)", then "foo(3)" + DynMacro(6).bar(7) // prints "bar(7)", then "apply(6)" + DynMacro.foo(8)(9) // Fails! +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t7868b.check b/tests/disabled/macro/run/t7868b.check new file mode 100644 index 000000000..6577c4bc4 --- /dev/null +++ b/tests/disabled/macro/run/t7868b.check @@ -0,0 +1,6 @@ +Expr[Int]({ + val x = (0: Short): @unchecked match { + case A((x @ _)) => x + }; + x +}) diff --git a/tests/disabled/macro/run/t7868b.scala b/tests/disabled/macro/run/t7868b.scala new file mode 100644 index 000000000..33d33f10a --- /dev/null +++ b/tests/disabled/macro/run/t7868b.scala @@ -0,0 +1,11 @@ +object A { + def unapply(n: Int): Option[Int] = Some(1) +} + +object Test extends dotty.runtime.LegacyApp { + import reflect.runtime.universe._ + println(reify { + val A(x) = (0: Short) + x + }) +} diff --git a/tests/disabled/macro/run/t7871.check b/tests/disabled/macro/run/t7871.check new file mode 100644 index 000000000..ce6efd812 --- /dev/null +++ b/tests/disabled/macro/run/t7871.check @@ -0,0 +1 @@ +(SomeTree,SomeTree) diff --git a/tests/disabled/macro/run/t7871/Macros_1.scala b/tests/disabled/macro/run/t7871/Macros_1.scala new file mode 100644 index 000000000..dca250812 --- /dev/null +++ b/tests/disabled/macro/run/t7871/Macros_1.scala @@ -0,0 +1,27 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +trait Tree +case object SomeTree extends Tree + +object NewQuasiquotes { + implicit class QuasiquoteInterpolation(c: StringContext) { + object nq { + def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl + } + } +} + +object QuasiquoteMacros { + def unapplyImpl(c: Context)(t: c.Tree) = { + import c.universe._ + q""" + new { + def unapply(t: Tree) = t match { + case SomeTree => Some((SomeTree, SomeTree)) + case _ => None + } + }.unapply($t) + """ + } +} diff --git a/tests/disabled/macro/run/t7871/Test_2.scala b/tests/disabled/macro/run/t7871/Test_2.scala new file mode 100644 index 000000000..55a8320b3 --- /dev/null +++ b/tests/disabled/macro/run/t7871/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends dotty.runtime.LegacyApp { + import NewQuasiquotes._ + SomeTree match { + case nq"$x + $y" => println((x, y)) + } +} diff --git a/tests/disabled/macro/run/t8048a.check b/tests/disabled/macro/run/t8048a.check new file mode 100644 index 000000000..8fb9e26e8 --- /dev/null +++ b/tests/disabled/macro/run/t8048a.check @@ -0,0 +1 @@ +Some(2) diff --git a/tests/disabled/macro/run/t8048a/Macros_1.scala b/tests/disabled/macro/run/t8048a/Macros_1.scala new file mode 100644 index 000000000..d13e851d9 --- /dev/null +++ b/tests/disabled/macro/run/t8048a/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.whitebox.Context +import scala.language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + q"if (true) Some(2) else None" + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8048a/Test_2.scala b/tests/disabled/macro/run/t8048a/Test_2.scala new file mode 100644 index 000000000..623a22a3a --- /dev/null +++ b/tests/disabled/macro/run/t8048a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + val x: Option[Int] = Macros.foo + println(x) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8048b.check b/tests/disabled/macro/run/t8048b.check new file mode 100644 index 000000000..083edaac2 --- /dev/null +++ b/tests/disabled/macro/run/t8048b.check @@ -0,0 +1,3 @@ +2 +2 +2 diff --git a/tests/disabled/macro/run/t8048b/Macros_1.scala b/tests/disabled/macro/run/t8048b/Macros_1.scala new file mode 100644 index 000000000..520a6fac0 --- /dev/null +++ b/tests/disabled/macro/run/t8048b/Macros_1.scala @@ -0,0 +1,37 @@ +// see the following discussions to understand what's being tested here: +// * https://issues.scala-lang.org/browse/SI-6992 +// * https://issues.scala-lang.org/browse/SI-8048 +// * http://stackoverflow.com/questions/14370842/getting-a-structural-type-with-an-anonymous-classs-methods-from-a-macro +// * http://stackoverflow.com/questions/18480707/method-cannot-be-accessed-in-macro-generated-class/18485004#18485004 +// * https://groups.google.com/forum/#!topic/scala-internals/eXQt-BPm4i8 + +import scala.language.experimental.macros +import scala.reflect.macros.whitebox.Context + +object Macros { + def impl1(c: Context) = { + import c.universe._ + q""" + trait Foo { def x = 2 } + new Foo {} + """ + } + def foo1: Any = macro impl1 + + def impl2(c: Context) = { + import c.universe._ + q""" + class Foo { def x = 2 } + new Foo + """ + } + def foo2: Any = macro impl2 + + def impl3(c: Context) = { + import c.universe._ + q""" + new { def x = 2 } + """ + } + def foo3: Any = macro impl3 +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8048b/Test_2.scala b/tests/disabled/macro/run/t8048b/Test_2.scala new file mode 100644 index 000000000..8474a34ec --- /dev/null +++ b/tests/disabled/macro/run/t8048b/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo1.x) + println(Macros.foo2.x) + println(Macros.foo3.x) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8104.check b/tests/disabled/macro/run/t8104.check new file mode 100644 index 000000000..40523a286 --- /dev/null +++ b/tests/disabled/macro/run/t8104.check @@ -0,0 +1,2 @@ +WeakTypeTag[.this.Repr] +(Int, Int) diff --git a/tests/disabled/macro/run/t8104/Macros_1.scala b/tests/disabled/macro/run/t8104/Macros_1.scala new file mode 100644 index 000000000..e135bd807 --- /dev/null +++ b/tests/disabled/macro/run/t8104/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.whitebox.Context + +object Macros { + def impl[T](c: Context)(implicit T: c.WeakTypeTag[T]) = { + import c.universe._ + import definitions._ + val fields = T.tpe.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x } + val Repr = appliedType(TupleClass(fields.length).asType.toType, fields.map(_.info)) + q"new Generic[$T]{ type Repr = $Repr }" + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8104/Test_2.scala b/tests/disabled/macro/run/t8104/Test_2.scala new file mode 100644 index 000000000..4e97cdf9d --- /dev/null +++ b/tests/disabled/macro/run/t8104/Test_2.scala @@ -0,0 +1,19 @@ +trait Generic[T] { type Repr } +object Generic { + type Aux[T, Repr0] = Generic[T] { type Repr = Repr0 } + import scala.language.experimental.macros + implicit def materializeGeneric[T, Repr]: Generic.Aux[T, Repr] = macro Macros.impl[T] +} + +object Test extends dotty.runtime.LegacyApp { + case class C(x: Int, y: Int) + + import scala.reflect.runtime.universe._ + def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: WeakTypeTag[Repr]) = { + println(tag) + println(tag.tpe.typeSymbol.info) + } + reprify(C(40, 2)) + + implicitly[Generic.Aux[C, (Int, Int)]] +} diff --git a/tests/disabled/macro/run/t8192.check b/tests/disabled/macro/run/t8192.check new file mode 100644 index 000000000..2423a7acb --- /dev/null +++ b/tests/disabled/macro/run/t8192.check @@ -0,0 +1,32 @@ +compile-time +package scala +primary constructor: NoSymbol +object List +primary constructor: def (): scala.collection.immutable.List.type => true +def (): scala.collection.immutable.List.type => true +trait Product1 +primary constructor: def $init$(): Unit => true +class UninitializedFieldError +primary constructor: def (msg: String): UninitializedFieldError => true +def (msg: String): UninitializedFieldError => true +def (obj: Any): UninitializedFieldError => false +class C +primary constructor: def (x: Int): C => true +def (x: Int): C => true +def (x: String): C => false +runtime +package scala +primary constructor: NoSymbol +object List +primary constructor: def (): scala.collection.immutable.List.type => true +def (): scala.collection.immutable.List.type => true +trait Product1 +primary constructor: def $init$(): Unit => true +class UninitializedFieldError +primary constructor: def (msg: String): UninitializedFieldError => true +def (msg: String): UninitializedFieldError => true +def (obj: Any): UninitializedFieldError => false +class C +primary constructor: def (x: Int): C => true +def (x: Int): C => true +def (x: String): C => false diff --git a/tests/disabled/macro/run/t8192/Macros_1.scala b/tests/disabled/macro/run/t8192/Macros_1.scala new file mode 100644 index 000000000..72fb2cf31 --- /dev/null +++ b/tests/disabled/macro/run/t8192/Macros_1.scala @@ -0,0 +1,45 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros +import java.io._ + +object Macros { + def impl(c: Context) = { + var messages = List[String]() + def println(msg: String) = messages :+= msg + + import c.universe._ + def test(sym: ClassSymbol): Unit = { + def fullyInitializeSymbol(sym: Symbol): Unit = { + val internal = c.universe.asInstanceOf[scala.reflect.internal.SymbolTable] + internal.definitions.fullyInitializeSymbol(sym.asInstanceOf[internal.Symbol]) + } + def defString(sym: Symbol): String = { + val internal = c.universe.asInstanceOf[scala.reflect.internal.SymbolTable] + sym.asInstanceOf[internal.Symbol].defString + } + def showCtor(sym: Symbol): String = { + fullyInitializeSymbol(sym) + if (sym == NoSymbol) "NoSymbol" + else s"${defString(sym)} => ${sym.asMethod.isPrimaryConstructor}" + } + sym.info + println(sym.toString) + println(s"primary constructor: ${showCtor(sym.primaryConstructor)}") + val ctors = sym.info.members.filter(_.name == termNames.CONSTRUCTOR).map(sym => showCtor(sym)) + ctors.toList.sorted.foreach(println) + } + + println("compile-time") + // SI-8367 primaryConstructor for Java-defined classes is unstable, so I'm commenting this out + // test(typeOf[File].typeSymbol.asClass) + test(definitions.ScalaPackageClass) + test(definitions.ListModule.moduleClass.asClass) + test(typeOf[Product1[_]].typeSymbol.asClass) + test(typeOf[UninitializedFieldError].typeSymbol.asClass) + test(c.mirror.staticClass("C").asClass) + + q"..${messages.map(msg => q"println($msg)")}" + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8192/Test_2.scala b/tests/disabled/macro/run/t8192/Test_2.scala new file mode 100644 index 000000000..dec90ab66 --- /dev/null +++ b/tests/disabled/macro/run/t8192/Test_2.scala @@ -0,0 +1,40 @@ +import java.io._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} + +class C(x: Int) { + def this(x: String) = this(x.toInt) +} + +object Test extends dotty.runtime.LegacyApp { + def test(sym: ClassSymbol): Unit = { + def fullyInitializeSymbol(sym: Symbol): Unit = { + val internal = ru.asInstanceOf[scala.reflect.internal.SymbolTable] + internal.definitions.fullyInitializeSymbol(sym.asInstanceOf[internal.Symbol]) + } + def defString(sym: Symbol): String = { + val internal = ru.asInstanceOf[scala.reflect.internal.SymbolTable] + sym.asInstanceOf[internal.Symbol].defString + } + def showCtor(sym: Symbol): String = { + fullyInitializeSymbol(sym) + if (sym == NoSymbol) "NoSymbol" + else s"${defString(sym)} => ${sym.asMethod.isPrimaryConstructor}" + } + sym.info + println(sym.toString) + println(s"primary constructor: ${showCtor(sym.primaryConstructor)}") + val ctors = sym.info.members.filter(_.name == termNames.CONSTRUCTOR).map(sym => showCtor(sym)) + ctors.toList.sorted.foreach(println) + } + + Macros.foo + println("runtime") + // SI-8367 primaryConstructor for Java-defined classes is unstable, so I'm commenting this out + // test(typeOf[File].typeSymbol.asClass) + test(definitions.ScalaPackageClass) + test(definitions.ListModule.moduleClass.asClass) + test(typeOf[Product1[_]].typeSymbol.asClass) + test(typeOf[UninitializedFieldError].typeSymbol.asClass) + test(typeOf[C].typeSymbol.asClass) +} diff --git a/tests/disabled/macro/run/t8321.check b/tests/disabled/macro/run/t8321.check new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/tests/disabled/macro/run/t8321.check @@ -0,0 +1 @@ +2 diff --git a/tests/disabled/macro/run/t8321/Macros_1.scala b/tests/disabled/macro/run/t8321/Macros_1.scala new file mode 100644 index 000000000..70e44fc76 --- /dev/null +++ b/tests/disabled/macro/run/t8321/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +class Bundle(val c: Context) { + import c.universe._ + def impl = q"new { val x = 2 }" +} + +object Macros { + def foo: Any = macro Bundle.impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8321/Test_2.scala b/tests/disabled/macro/run/t8321/Test_2.scala new file mode 100644 index 000000000..d49442117 --- /dev/null +++ b/tests/disabled/macro/run/t8321/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + println(Macros.foo.x) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8425.check b/tests/disabled/macro/run/t8425.check new file mode 100644 index 000000000..8379fa0a7 --- /dev/null +++ b/tests/disabled/macro/run/t8425.check @@ -0,0 +1 @@ +List(fresh$macro$1, $macro$2) diff --git a/tests/disabled/macro/run/t8425/Macros_1.scala b/tests/disabled/macro/run/t8425/Macros_1.scala new file mode 100644 index 000000000..71a96518e --- /dev/null +++ b/tests/disabled/macro/run/t8425/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def foo: Unit = macro impl + def impl(c: Context) = { + import c.universe._ + val test1 = c.freshName() + val test2 = c.freshName("$") + q"println(List($test1, $test2))" + } +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8425/Test_2.scala b/tests/disabled/macro/run/t8425/Test_2.scala new file mode 100644 index 000000000..0fc472aa6 --- /dev/null +++ b/tests/disabled/macro/run/t8425/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8437.check b/tests/disabled/macro/run/t8437.check new file mode 100644 index 000000000..fd3c81a4d --- /dev/null +++ b/tests/disabled/macro/run/t8437.check @@ -0,0 +1,2 @@ +5 +5 diff --git a/tests/disabled/macro/run/t8437/Macros_1.scala b/tests/disabled/macro/run/t8437/Macros_1.scala new file mode 100644 index 000000000..6286ea2a8 --- /dev/null +++ b/tests/disabled/macro/run/t8437/Macros_1.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros._ + +abstract class AbstractBundle(val c: blackbox.Context) { + import c.Expr + import c.universe._ + def foo: Expr[Int] = Expr[Int](q"5") +} + +class ConcreteBundle(override val c: blackbox.Context) extends AbstractBundle(c) { + import c.Expr + val bar: Expr[Int] = foo +} + +object InvokeBundle { + def foo: Int = macro ConcreteBundle.foo // nope + def bar: Int = macro ConcreteBundle.bar // yep +} \ No newline at end of file diff --git a/tests/disabled/macro/run/t8437/Test_2.scala b/tests/disabled/macro/run/t8437/Test_2.scala new file mode 100644 index 000000000..fef54005f --- /dev/null +++ b/tests/disabled/macro/run/t8437/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + println(InvokeBundle.foo) + println(InvokeBundle.bar) +} \ No newline at end of file diff --git a/tests/disabled/macro/run/toolbox_console_reporter.check b/tests/disabled/macro/run/toolbox_console_reporter.check new file mode 100644 index 000000000..1395c6874 --- /dev/null +++ b/tests/disabled/macro/run/toolbox_console_reporter.check @@ -0,0 +1,8 @@ +hello +============compiler console============= +warning: method foo in object Utils is deprecated: test + +========================================= +============compiler messages============ +Info(NoPosition,method foo in object Utils is deprecated: test,WARNING) +========================================= diff --git a/tests/disabled/macro/run/toolbox_console_reporter.scala b/tests/disabled/macro/run/toolbox_console_reporter.scala new file mode 100644 index 000000000..53cbcb0fb --- /dev/null +++ b/tests/disabled/macro/run/toolbox_console_reporter.scala @@ -0,0 +1,28 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, mkConsoleFrontEnd} + +object Test extends dotty.runtime.LegacyApp { + //val oldErr = Console.err; + val baos = new java.io.ByteArrayOutputStream() + val errs = new java.io.PrintStream(baos) + (Console withErr errs) { + val toolbox = cm.mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation") + toolbox.eval(reify{ + object Utils { + @deprecated("test", "2.10.0") + def foo: Unit = { println("hello") } + } + + Utils.foo + }.tree) + println("============compiler console=============") + errs.flush() + println(baos.toString); + println("=========================================") + println("============compiler messages============") + toolbox.frontEnd.infos.foreach(println(_)) + println("=========================================") + } +} diff --git a/tests/disabled/macro/run/toolbox_current_run_compiles.check b/tests/disabled/macro/run/toolbox_current_run_compiles.check new file mode 100644 index 000000000..da29283aa --- /dev/null +++ b/tests/disabled/macro/run/toolbox_current_run_compiles.check @@ -0,0 +1,2 @@ +true +false diff --git a/tests/disabled/macro/run/toolbox_current_run_compiles.scala b/tests/disabled/macro/run/toolbox_current_run_compiles.scala new file mode 100644 index 000000000..702741c2e --- /dev/null +++ b/tests/disabled/macro/run/toolbox_current_run_compiles.scala @@ -0,0 +1,28 @@ +package pkg { + import scala.reflect.macros.blackbox.Context + import scala.language.experimental.macros + + object Macros { + def impl[T: c.WeakTypeTag](c: Context) = { + import c.universe._ + val sym = c.weakTypeOf[T].typeSymbol + val g = c.universe.asInstanceOf[scala.tools.nsc.Global] + c.Expr[Boolean](Literal(Constant(g.currentRun.compiles(sym.asInstanceOf[g.Symbol])))) + } + def compiles[T]: Boolean = macro impl[T] + } +} + +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val cm = ru.runtimeMirror(getClass.getClassLoader) + val toolbox = cm.mkToolBox() + toolbox.eval(toolbox.parse("""{ + class C + println(pkg.Macros.compiles[C]) + println(pkg.Macros.compiles[Object]) + }""")) +} diff --git a/tests/disabled/macro/run/toolbox_default_reporter_is_silent.check b/tests/disabled/macro/run/toolbox_default_reporter_is_silent.check new file mode 100644 index 000000000..ce0136250 --- /dev/null +++ b/tests/disabled/macro/run/toolbox_default_reporter_is_silent.check @@ -0,0 +1 @@ +hello diff --git a/tests/disabled/macro/run/toolbox_default_reporter_is_silent.scala b/tests/disabled/macro/run/toolbox_default_reporter_is_silent.scala new file mode 100644 index 000000000..694720721 --- /dev/null +++ b/tests/disabled/macro/run/toolbox_default_reporter_is_silent.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + val toolbox = cm.mkToolBox() + toolbox.eval(reify{ + object Utils { + @deprecated("test", "2.10.0") + def foo: Unit = { println("hello") } + } + + Utils.foo + }.tree) +} diff --git a/tests/disabled/macro/run/toolbox_silent_reporter.check b/tests/disabled/macro/run/toolbox_silent_reporter.check new file mode 100644 index 000000000..2d05b1e3f --- /dev/null +++ b/tests/disabled/macro/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/tests/disabled/macro/run/toolbox_silent_reporter.scala b/tests/disabled/macro/run/toolbox_silent_reporter.scala new file mode 100644 index 000000000..72109b822 --- /dev/null +++ b/tests/disabled/macro/run/toolbox_silent_reporter.scala @@ -0,0 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, mkSilentFrontEnd} + +object Test extends dotty.runtime.LegacyApp { + val toolbox = cm.mkToolBox(options = "-deprecation", frontEnd = mkSilentFrontEnd()) + toolbox.eval(reify{ + object Utils { + @deprecated("test", "2.10.0") + def foo: Unit = { println("hello") } + } + + Utils.foo + }.tree) + println("============compiler messages============") + toolbox.frontEnd.infos.foreach(println(_)) + println("=========================================") +} diff --git a/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled.check b/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled.check new file mode 100644 index 000000000..62de37582 --- /dev/null +++ b/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled.check @@ -0,0 +1,41 @@ +({ + val $u: ru.type = ru; + val $m: $u.Mirror = ru.runtimeMirror({ + final class $anon extends scala.AnyRef { + def (): <$anon: AnyRef> = { + $anon.super.(); + () + }; + () + }; + new $anon() +}.getClass().getClassLoader()); + $u.Expr.apply[Int(2)]($m, { + final class $treecreator1 extends TreeCreator { + def (): $treecreator1 = { + $treecreator1.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Literal.apply($u.Constant.apply(2)) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Int(2)]($m, { + final class $typecreator2 extends TypeCreator { + def (): $typecreator2 = { + $typecreator2.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.internal.reificationSupport.ConstantType($u.Constant.apply(2)) + } + }; + new $typecreator2() + })) +}: ru.Expr[Int]) +ru.reify[Int](2) diff --git a/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled.scala b/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled.scala new file mode 100644 index 000000000..2aa0202e7 --- /dev/null +++ b/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled.scala @@ -0,0 +1,26 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import internal._ + +// Note: If you're looking at this test and you don't know why, you may +// have accidentally changed the way type tags reify. If so, validate +// that your changes are accurate and update the check file. + +object Test extends dotty.runtime.LegacyApp { + val toolbox = cm.mkToolBox() + val rupkg = cm.staticModule("scala.reflect.runtime.package") + val rusym = reificationSupport.selectTerm(rupkg, "universe") + val NullaryMethodType(rutpe) = rusym.info + val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe) + reificationSupport.setInfo(ru, rutpe) + + val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) + val ttree1 = toolbox.typecheck(tree1, withMacrosDisabled = false) + println(ttree1) + + val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) + val ttree2 = toolbox.typecheck(tree2, withMacrosDisabled = true) + println(ttree2) +} diff --git a/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled2.check b/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled2.check new file mode 100644 index 000000000..86f89504d --- /dev/null +++ b/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled2.check @@ -0,0 +1,41 @@ +({ + val $u: ru.type = ru; + val $m: $u.Mirror = ru.runtimeMirror({ + final class $anon extends scala.AnyRef { + def (): <$anon: AnyRef> = { + $anon.super.(); + () + }; + () + }; + new $anon() +}.getClass().getClassLoader()); + $u.Expr.apply[Array[Int]]($m, { + final class $treecreator1 extends TreeCreator { + def (): $treecreator1 = { + $treecreator1.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Apply.apply($u.Select.apply($u.internal.reificationSupport.mkIdent($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Array[Int]]($m, { + final class $typecreator2 extends TypeCreator { + def (): $typecreator2 = { + $typecreator2.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.internal.reificationSupport.TypeRef($u.internal.reificationSupport.ThisType($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) + } + }; + new $typecreator2() + })) +}: ru.Expr[Array[Int]]) +ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled2.scala b/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled2.scala new file mode 100644 index 000000000..c554110ed --- /dev/null +++ b/tests/disabled/macro/run/toolbox_typecheck_macrosdisabled2.scala @@ -0,0 +1,26 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import internal._ + +// Note: If you're looking at this test and you don't know why, you may +// have accidentally changed the way type tags reify. If so, validate +// that your changes are accurate and update the check file. + +object Test extends dotty.runtime.LegacyApp { + val toolbox = cm.mkToolBox() + val rupkg = cm.staticModule("scala.reflect.runtime.package") + val rusym = reificationSupport.selectTerm(rupkg, "universe") + val NullaryMethodType(rutpe) = rusym.info + val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe) + reificationSupport.setInfo(ru, rutpe) + + val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) + val ttree1 = toolbox.typecheck(tree1, withMacrosDisabled = false) + println(ttree1) + + val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) + val ttree2 = toolbox.typecheck(tree2, withMacrosDisabled = true) + println(ttree2) +} diff --git a/tests/disabled/macro/run/typecheck.check b/tests/disabled/macro/run/typecheck.check new file mode 100644 index 000000000..e69de29bb diff --git a/tests/disabled/macro/run/typecheck/Macros_1.scala b/tests/disabled/macro/run/typecheck/Macros_1.scala new file mode 100644 index 000000000..ee1c8da76 --- /dev/null +++ b/tests/disabled/macro/run/typecheck/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + c.typecheck(q"class C") + q"()" + } + + def foo: Any = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/typecheck/Test_2.scala b/tests/disabled/macro/run/typecheck/Test_2.scala new file mode 100644 index 000000000..b79cc3b31 --- /dev/null +++ b/tests/disabled/macro/run/typecheck/Test_2.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends dotty.runtime.LegacyApp { + Macros.foo + + val tb = cm.mkToolBox() + tb.typecheck(q"class C") +} \ No newline at end of file diff --git a/tests/disabled/macro/run/typed-annotated.check b/tests/disabled/macro/run/typed-annotated.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/tests/disabled/macro/run/typed-annotated.check @@ -0,0 +1 @@ +42 diff --git a/tests/disabled/macro/run/typed-annotated/Macros_1.scala b/tests/disabled/macro/run/typed-annotated/Macros_1.scala new file mode 100644 index 000000000..4f0660dc4 --- /dev/null +++ b/tests/disabled/macro/run/typed-annotated/Macros_1.scala @@ -0,0 +1,17 @@ +import scala.reflect.macros.blackbox.Context +import language.experimental.macros + +class ann extends scala.annotation.StaticAnnotation + +object Macros { + def impl(c: Context) = { + import c.universe._ + // val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), termNames.CONSTRUCTOR), List()), Ident(newTypeName("Int"))) + val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), termNames.CONSTRUCTOR), List()), TypeTree(weakTypeOf[Int])) + c.Expr[Unit](Block( + List(ValDef(Modifiers(), newTermName("x"), tpt, Literal(Constant(42)))), + Apply(Ident(newTermName("println")), List(Ident(newTermName("x")))))) + } + + def foo = macro impl +} \ No newline at end of file diff --git a/tests/disabled/macro/run/typed-annotated/Test_2.scala b/tests/disabled/macro/run/typed-annotated/Test_2.scala new file mode 100644 index 000000000..0fc472aa6 --- /dev/null +++ b/tests/disabled/macro/run/typed-annotated/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo +} \ No newline at end of file -- cgit v1.2.3