From 7b0f0a142bb526f4bd108a8c208ec9a8952398c9 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Mon, 4 Jun 2012 13:53:13 +0200 Subject: repairs the tests after the refactoring spree --- test/disabled/lib | 1 - test/files/codelib/code.jar.desired.sha1 | 2 +- test/files/jvm/manifests-new.check | 12 +-- test/files/jvm/manifests-new.scala | 12 ++- test/files/jvm/serialization-new.scala | 4 +- test/files/neg/classtags_contextbound_b.check | 2 +- test/files/neg/classtags_contextbound_b.scala | 2 + test/files/neg/classtags_contextbound_c.check | 2 +- test/files/neg/classtags_contextbound_c.scala | 2 + test/files/neg/classtags_dont_use_typetags.check | 2 +- test/files/neg/classtags_dont_use_typetags.scala | 2 + ...op_classmanifests_arenot_concretetypetags.check | 6 +- ...op_classmanifests_arenot_concretetypetags.scala | 4 +- .../neg/interop_classtags_arenot_manifests.check | 4 +- .../neg/interop_classtags_arenot_manifests.scala | 3 + ...op_concretetypetags_arenot_classmanifests.check | 4 + ...op_concretetypetags_arenot_classmanifests.scala | 11 +++ ...interop_concretetypetags_arenot_classtags.check | 4 + ...interop_concretetypetags_arenot_classtags.scala | 12 +++ ...petags_without_classtags_arenot_manifests.check | 6 ++ ...petags_without_classtags_arenot_manifests.scala | 12 +++ ...interop_erasuretags_arenot_classmanifests.check | 4 - ...interop_erasuretags_arenot_classmanifests.scala | 9 -- .../neg/interop_erasuretags_arenot_manifests.check | 4 - .../neg/interop_erasuretags_arenot_manifests.scala | 9 -- .../interop_typetags_arenot_classmanifests.check | 2 +- .../interop_typetags_arenot_classmanifests.scala | 2 + .../neg/interop_typetags_arenot_classtags.check | 4 + .../neg/interop_typetags_arenot_classtags.scala | 12 +++ .../neg/interop_typetags_arenot_manifests.check | 2 +- .../neg/interop_typetags_arenot_manifests.scala | 2 + .../macro-basic-mamdmi/Impls_Macros_Test_1.scala | 12 +-- test/files/neg/macro-invalidimpl-f/Impls_1.scala | 6 +- test/files/neg/macro-invalidimpl-g/Impls_1.scala | 6 +- .../neg/macro-invalidsig-context-bounds.check | 8 +- .../macro-invalidsig-context-bounds/Impls_1.scala | 5 +- .../neg/macro-invalidsig-ctx-badargc/Impls_1.scala | 2 - test/files/neg/macro-invalidsig-ctx-badtype.check | 14 +-- .../neg/macro-invalidsig-ctx-badtype/Impls_1.scala | 2 +- .../neg/macro-invalidsig-implicit-params.check | 2 +- .../Impls_Macros_1.scala | 9 +- .../neg/macro-invalidsig-params-badtype.check | 14 +-- .../Impls_Macros_1.scala | 2 +- .../neg/macro-invalidsig-tparams-badtype.check | 2 +- .../macro-invalidsig-tparams-badtype/Impls_1.scala | 2 +- .../Impls_1.scala | 3 +- .../Impls_1.scala | 3 +- .../Impls_1.scala | 5 +- .../Impls_1.scala | 6 +- .../Impls_1.scala | 6 +- .../Test.scala | 2 +- .../Test.scala | 2 +- .../Test.scala | 2 +- .../neg/macro-without-xmacros-a/Impls_1.scala | 14 +-- .../neg/macro-without-xmacros-b/Impls_1.scala | 14 +-- test/files/neg/reify_ann2b.check | 8 +- test/files/neg/reify_ann2b.scala | 7 +- .../reify_metalevel_breach_+0_refers_to_1.check | 7 ++ .../reify_metalevel_breach_+0_refers_to_1.scala | 16 +++ .../reify_metalevel_breach_-1_refers_to_0_a.check | 7 ++ .../reify_metalevel_breach_-1_refers_to_0_a.scala | 14 +++ .../reify_metalevel_breach_-1_refers_to_0_b.check | 7 ++ .../reify_metalevel_breach_-1_refers_to_0_b.scala | 18 ++++ .../reify_metalevel_breach_-1_refers_to_1.check | 7 ++ .../reify_metalevel_breach_-1_refers_to_1.scala | 16 +++ .../neg/reify_nested_inner_refers_to_local.check | 7 ++ .../neg/reify_nested_inner_refers_to_local.scala | 15 +++ test/files/neg/t3692-new.check | 2 +- test/files/neg/t3692-new.scala | 1 + test/files/neg/t5334_1.check | 2 +- test/files/neg/t5334_1.scala | 5 +- test/files/neg/t5334_2.check | 2 +- test/files/neg/t5334_2.scala | 5 +- test/files/neg/t5452-new.check | 6 +- test/files/neg/t5452-new.scala | 6 +- test/files/neg/t5452-old.scala | 2 +- test/files/pos/contextbounds-implicits-new.scala | 4 +- test/files/pos/implicits-new.scala | 5 +- test/files/pos/liftcode_polymorphic.scala | 25 +++-- test/files/pos/manifest1-new.scala | 4 +- test/files/pos/nothing_manifest_disambig-new.scala | 2 + test/files/pos/spec-constr-new.scala | 4 +- test/files/pos/spec-doubledef-new.scala | 4 +- test/files/pos/spec-fields-new.scala | 4 +- test/files/pos/spec-params-new.scala | 4 +- test/files/pos/spec-sparsearray-new.scala | 3 +- test/files/pos/t1381-new.scala | 4 +- test/files/pos/t2795-new.scala | 4 +- test/files/pos/t3363-new.scala | 4 +- test/files/pos/t3498-new.scala | 2 + test/files/pos/t5223.scala | 4 +- test/files/pos/t5305.scala | 2 +- test/files/pos/t531.scala | 4 +- test/files/pos/t532.scala | 4 +- test/files/pos/t5769.scala | 1 + test/files/pos/t5809.scala | 11 +-- test/files/pos/typetags.scala | 12 +++ test/files/presentation/ide-bug-1000531.check | 2 +- .../memory-leaks/MemoryLeaksTest.scala | 40 ++++---- test/files/run/arrayclone-new.scala | 4 +- test/files/run/arraytags_basic.scala | 2 + test/files/run/arraytags_core.scala | 2 + test/files/run/arraytags_usage.scala | 2 + test/files/run/classtags_contextbound.scala | 2 + test/files/run/classtags_core.check | 60 ++++++------ test/files/run/classtags_core.scala | 6 +- test/files/run/classtags_multi.scala | 2 + .../files/run/classtags_use_concretetypetags.scala | 3 - test/files/run/concretetypetags_core.check | 60 ++++++------ test/files/run/concretetypetags_core.scala | 6 +- test/files/run/concretetypetags_multi.scala | 12 ++- test/files/run/ctries-new/main.scala | 6 +- test/files/run/ctries-old/main.scala | 12 +-- test/files/run/erasuretags_abstract.check | 4 - test/files/run/erasuretags_abstract.scala | 9 -- test/files/run/erasuretags_basic.check | 24 ----- test/files/run/erasuretags_basic.scala | 21 ---- test/files/run/erasuretags_core.check | 32 ------ test/files/run/erasuretags_core.scala | 34 ------- test/files/run/erasuretags_usage.scala | 12 --- test/files/run/existentials-in-compiler.scala | 9 +- test/files/run/existentials3-new.check | 48 ++++----- test/files/run/existentials3-new.scala | 14 +-- test/files/run/freetypes_false_alarm1.check | 1 + test/files/run/freetypes_false_alarm1.scala | 10 ++ test/files/run/freetypes_false_alarm2.check | 1 + test/files/run/freetypes_false_alarm2.scala | 8 ++ test/files/run/getClassTest-new.scala | 6 +- .../interop_classmanifests_arenot_typetags.check | 3 + .../interop_classmanifests_arenot_typetags.scala | 11 +++ ...erop_classmanifests_arepartially_typetags.check | 6 -- ...erop_classmanifests_arepartially_typetags.scala | 10 -- .../run/interop_classtags_are_classmanifests.scala | 3 + ...terop_concretetypetags_are_classmanifests.check | 3 - ...terop_concretetypetags_are_classmanifests.scala | 9 -- .../interop_concretetypetags_are_manifests.check | 2 +- .../interop_concretetypetags_are_manifests.scala | 5 +- .../run/interop_manifests_are_classtags.check | 6 -- .../run/interop_manifests_are_classtags.scala | 4 +- .../interop_manifests_are_concretetypetags.check | 9 +- .../interop_manifests_are_concretetypetags.scala | 5 +- .../files/run/interop_manifests_are_typetags.check | 9 +- .../files/run/interop_manifests_are_typetags.scala | 5 +- test/files/run/macro-abort-fresh/Macros_1.scala | 2 +- test/files/run/macro-abort-fresh/Test_2.scala | 6 +- test/files/run/macro-basic-ma-md-mi/Impls_1.scala | 14 +-- .../run/macro-basic-ma-mdmi/Impls_Macros_1.scala | 12 +-- test/files/run/macro-basic-mamd-mi/Impls_1.scala | 14 +-- .../run/macro-bodyexpandstoimpl/Impls_1.scala | 4 +- .../run/macro-declared-in-annotation/Impls_1.scala | 6 +- .../run/macro-declared-in-anonymous/Impls_1.scala | 6 +- .../run/macro-declared-in-block/Impls_1.scala | 6 +- .../macro-declared-in-class-class/Impls_1.scala | 6 +- .../macro-declared-in-class-object/Impls_1.scala | 6 +- .../run/macro-declared-in-class/Impls_1.scala | 6 +- .../macro-declared-in-default-param/Impls_1.scala | 6 +- .../Impls_Macros_1.scala | 6 +- .../run/macro-declared-in-method/Impls_1.scala | 6 +- .../macro-declared-in-object-class/Impls_1.scala | 6 +- .../macro-declared-in-object-object/Impls_1.scala | 6 +- .../run/macro-declared-in-object/Impls_1.scala | 6 +- .../macro-declared-in-package-object/Impls_1.scala | 6 +- .../run/macro-declared-in-refinement/Impls_1.scala | 6 +- .../run/macro-declared-in-trait/Impls_1.scala | 6 +- .../run/macro-def-infer-return-type-b/Test_2.scala | 8 +- .../Impls_Macros_1.scala | 3 +- .../Impls_1.scala | 6 +- .../Impls_1.scala | 6 +- .../Impls_1.scala | 6 +- .../Impls_1.scala | 6 +- .../macro-expand-multiple-arglists/Impls_1.scala | 6 +- .../run/macro-expand-nullary-generic/Impls_1.scala | 7 +- .../macro-expand-nullary-nongeneric/Impls_1.scala | 6 +- test/files/run/macro-expand-overload/Impls_1.scala | 6 +- test/files/run/macro-expand-override/Impls_1.scala | 6 +- .../files/run/macro-expand-recursive/Impls_1.scala | 10 +- .../macro-expand-tparams-explicit/Impls_1.scala | 7 +- .../macro-expand-tparams-implicit/Impls_1.scala | 7 +- .../macro-expand-tparams-optional/Impls_1.scala | 6 +- .../macro-expand-tparams-prefix-a/Impls_1.scala | 7 +- .../macro-expand-tparams-prefix-b/Impls_1.scala | 7 +- .../macro-expand-tparams-prefix-c1/Impls_1.scala | 7 +- .../Impls_Macros_1.scala | 7 +- .../macro-expand-tparams-prefix-d1/Impls_1.scala | 7 +- .../Impls_1.scala | 6 +- .../Macros_Test_2.scala | 6 +- .../Impls_1.scala | 6 +- .../Impls_1.scala | 6 +- .../Impls_1.scala | 6 +- .../Impls_1.scala | 6 +- .../macro-impl-default-params/Impls_Macros_1.scala | 9 +- .../macro-impl-rename-context/Impls_Macros_1.scala | 4 +- .../Impls_Macros_1.scala | 4 +- .../Test_2.scala | 6 +- .../Impls_Macros_1.scala | 6 +- .../run/macro-invalidret-nontypeable/Test_2.scala | 6 +- .../run/macro-invalidusage-badret/Test_2.scala | 8 +- .../Impls_Macros_1.scala | 4 +- .../Test_2.scala | 6 +- .../run/macro-openmacros/Impls_Macros_1.scala | 12 +-- test/files/run/macro-range/Common_1.scala | 3 +- .../run/macro-range/Expansion_Impossible_2.scala | 10 +- .../Impls_Macros_1.scala | 4 +- .../macro-reflective-ma-normal-mdmi/Test_2.scala | 6 +- .../macro-reflective-mamd-normal-mi/Impls_1.scala | 6 +- .../Macros_Test_2.scala | 9 +- test/files/run/macro-reify-basic/Macros_1.scala | 2 +- test/files/run/macro-reify-eval-eval.check | 1 - test/files/run/macro-reify-eval-eval.flags | 1 - .../files/run/macro-reify-eval-eval/Macros_1.scala | 12 --- test/files/run/macro-reify-eval-eval/Test_2.scala | 3 - .../files/run/macro-reify-eval-outside-reify.check | 1 - .../files/run/macro-reify-eval-outside-reify.flags | 1 - .../Impls_Macros_1.scala | 12 --- .../macro-reify-eval-outside-reify/Test_2.scala | 5 - test/files/run/macro-reify-freevars.check | 6 +- test/files/run/macro-reify-freevars/Macros_1.scala | 11 ++- test/files/run/macro-reify-freevars/Test_2.scala | 6 +- .../Test.scala | 2 +- .../Test.scala | 2 +- .../run/macro-reify-nested-a/Impls_Macros_1.scala | 30 +++--- .../run/macro-reify-nested-b/Impls_Macros_1.scala | 30 +++--- .../run/macro-reify-splice-outside-reify.check | 1 + .../run/macro-reify-splice-outside-reify.flags | 1 + .../Impls_Macros_1.scala | 24 +++++ .../macro-reify-splice-outside-reify/Test_2.scala | 8 ++ test/files/run/macro-reify-splice-splice.check | 1 + test/files/run/macro-reify-splice-splice.flags | 1 + .../run/macro-reify-splice-splice/Macros_1.scala | 12 +++ .../run/macro-reify-splice-splice/Test_2.scala | 3 + test/files/run/macro-reify-tagful-a/Macros_1.scala | 3 +- .../run/macro-reify-tagless-a/Impls_Macros_1.scala | 2 +- test/files/run/macro-reify-tagless-a/Test_2.scala | 6 +- .../macro-reify-typetag-notypeparams/Test.scala | 2 +- .../Test.scala | 2 +- .../run/macro-reify-typetag-typeparams-tags.check | 2 +- .../macro-reify-typetag-typeparams-tags/Test.scala | 2 +- .../run/macro-reify-typetag-usegroundtypetag.check | 2 +- .../Test.scala | 2 +- test/files/run/macro-reify-unreify.check | 2 +- test/files/run/macro-reify-unreify/Macros_1.scala | 10 +- .../run/macro-reify-value-outside-reify.check | 1 - .../run/macro-reify-value-outside-reify.flags | 1 - .../Impls_Macros_1.scala | 12 --- .../macro-reify-value-outside-reify/Test_2.scala | 6 -- test/files/run/macro-repl-basic.check | 108 ++++++++++----------- test/files/run/macro-repl-basic.scala | 12 +-- test/files/run/macro-settings/Impls_Macros_1.scala | 2 +- .../run/macro-sip19-revised/Impls_Macros_1.scala | 10 +- test/files/run/macro-sip19/Impls_Macros_1.scala | 6 +- .../Impls_Macros_1.scala | 4 +- .../files/run/macro-typecheck-macrosdisabled.check | 38 +++++++- .../Impls_Macros_1.scala | 18 ++-- .../run/macro-typecheck-macrosdisabled2.check | 38 +++++++- .../Impls_Macros_1.scala | 20 ++-- .../Impls_Macros_1.scala | 7 +- .../run/macro-undetparams-implicitval/Test.scala | 2 + .../Impls_Macros_1.scala | 3 +- test/files/run/manifests-new.scala | 16 +-- test/files/run/newTags.check | 5 + test/files/run/newTags.scala | 14 +++ test/files/run/primitive-sigs-2-new.scala | 3 +- test/files/run/reflect-overload.scala | 21 ++-- test/files/run/reflection-implClass-new.scala | 38 -------- test/files/run/reflection-implClass-old.scala | 38 -------- test/files/run/reflection-implClass.scala | 40 ++++++++ test/files/run/reflection-repl.check | 9 ++ test/files/run/reflection-repl.scala | 7 ++ test/files/run/reflection-simple.scala | 3 +- test/files/run/reflinit.check | 1 + test/files/run/reflinit.scala | 6 ++ test/files/run/reify-repl-fail-gracefully.check | 42 ++++---- test/files/run/reify-repl-fail-gracefully.scala | 2 +- test/files/run/reify_ann1a.check | 12 +-- test/files/run/reify_ann1a.scala | 7 +- test/files/run/reify_ann1b.scala | 7 +- test/files/run/reify_ann2a.check | 16 +-- test/files/run/reify_ann2a.scala | 7 +- test/files/run/reify_ann3.scala | 9 +- test/files/run/reify_ann4.scala | 9 +- test/files/run/reify_ann5.scala | 9 +- test/files/run/reify_anonymous.scala | 5 +- test/files/run/reify_classfileann_a.scala | 7 +- test/files/run/reify_classfileann_b.scala | 7 +- test/files/run/reify_closure1.scala | 9 +- test/files/run/reify_closure2a.scala | 9 +- test/files/run/reify_closure3a.scala | 9 +- test/files/run/reify_closure4a.scala | 9 +- test/files/run/reify_closure5a.scala | 9 +- test/files/run/reify_closure6.scala | 7 +- test/files/run/reify_closure7.scala | 9 +- test/files/run/reify_closure8a.scala | 9 +- test/files/run/reify_closure8b.check | 2 +- test/files/run/reify_closure8b.scala | 9 +- test/files/run/reify_closures10.scala | 9 +- test/files/run/reify_complex.scala | 5 +- test/files/run/reify_copypaste1.check | 2 + test/files/run/reify_copypaste1.scala | 19 ++++ test/files/run/reify_copypaste2.check | 1 + test/files/run/reify_copypaste2.scala | 10 ++ test/files/run/reify_csv.scala | 3 +- test/files/run/reify_extendbuiltins.scala | 5 +- test/files/run/reify_for1.scala | 5 +- test/files/run/reify_fors.check | 5 - test/files/run/reify_fors.flags | 0 test/files/run/reify_fors.scala | 100 ------------------- test/files/run/reify_fors_newpatmat.check | 5 + test/files/run/reify_fors_newpatmat.scala | 101 +++++++++++++++++++ test/files/run/reify_fors_oldpatmat.check | 5 + test/files/run/reify_fors_oldpatmat.flags | 0 test/files/run/reify_fors_oldpatmat.scala | 101 +++++++++++++++++++ test/files/run/reify_generic.scala | 5 +- test/files/run/reify_generic2.scala | 5 +- test/files/run/reify_getter.scala | 9 +- test/files/run/reify_implicits-new.scala | 6 +- test/files/run/reify_implicits-old.scala | 5 +- test/files/run/reify_inheritance.scala | 5 +- test/files/run/reify_inner1.scala | 5 +- test/files/run/reify_inner2.scala | 5 +- test/files/run/reify_inner3.scala | 5 +- test/files/run/reify_inner4.scala | 5 +- test/files/run/reify_lazyevaluation.scala | 3 +- test/files/run/reify_maps.check | 4 - test/files/run/reify_maps.flags | 0 test/files/run/reify_maps.scala | 19 ---- test/files/run/reify_maps_newpatmat.check | 4 + test/files/run/reify_maps_newpatmat.scala | 20 ++++ test/files/run/reify_maps_oldpatmat.check | 4 + test/files/run/reify_maps_oldpatmat.flags | 0 test/files/run/reify_maps_oldpatmat.scala | 20 ++++ .../reify_metalevel_breach_+0_refers_to_1.scala | 11 ++- .../reify_metalevel_breach_-1_refers_to_0_a.scala | 11 ++- .../reify_metalevel_breach_-1_refers_to_0_b.scala | 12 ++- .../reify_metalevel_breach_-1_refers_to_1.scala | 11 ++- .../run/reify_nested_inner_refers_to_global.scala | 11 ++- .../run/reify_nested_inner_refers_to_local.scala | 11 ++- .../run/reify_nested_outer_refers_to_global.scala | 11 ++- .../run/reify_nested_outer_refers_to_local.scala | 11 ++- test/files/run/reify_newimpl_01.scala | 4 +- test/files/run/reify_newimpl_02.scala | 4 +- test/files/run/reify_newimpl_03.scala | 4 +- test/files/run/reify_newimpl_04.scala | 4 +- test/files/run/reify_newimpl_05.scala | 4 +- test/files/run/reify_newimpl_06.scala | 4 +- test/files/run/reify_newimpl_09.scala | 4 +- test/files/run/reify_newimpl_10.scala | 4 +- test/files/run/reify_newimpl_11.check | 4 +- test/files/run/reify_newimpl_11.scala | 4 +- test/files/run/reify_newimpl_12.scala | 4 +- test/files/run/reify_newimpl_13.check | 4 +- test/files/run/reify_newimpl_13.scala | 4 +- test/files/run/reify_newimpl_14.scala | 4 +- test/files/run/reify_newimpl_15.scala | 4 +- test/files/run/reify_newimpl_16.scala | 4 +- test/files/run/reify_newimpl_17.check | 4 +- test/files/run/reify_newimpl_17.scala | 4 +- test/files/run/reify_newimpl_18.scala | 4 +- test/files/run/reify_newimpl_19.check | 4 +- test/files/run/reify_newimpl_19.scala | 4 +- test/files/run/reify_newimpl_20.scala | 4 +- test/files/run/reify_newimpl_21.scala | 4 +- test/files/run/reify_newimpl_22.check | 12 ++- test/files/run/reify_newimpl_22.scala | 6 +- test/files/run/reify_newimpl_23.check | 12 ++- test/files/run/reify_newimpl_23.scala | 6 +- test/files/run/reify_newimpl_24.check | 24 ----- test/files/run/reify_newimpl_24.scala | 16 --- test/files/run/reify_newimpl_25.check | 6 +- test/files/run/reify_newimpl_25.scala | 4 +- test/files/run/reify_newimpl_26.check | 6 +- test/files/run/reify_newimpl_26.scala | 4 +- test/files/run/reify_newimpl_27.scala | 4 +- test/files/run/reify_newimpl_28.scala | 4 +- test/files/run/reify_newimpl_29.scala | 4 +- test/files/run/reify_newimpl_30.scala | 4 +- test/files/run/reify_newimpl_31.scala | 4 +- test/files/run/reify_newimpl_32.scala | 4 +- test/files/run/reify_newimpl_33.scala | 4 +- test/files/run/reify_newimpl_34.scala | 4 +- test/files/run/reify_newimpl_35.check | 17 ++++ test/files/run/reify_newimpl_35.scala | 10 ++ test/files/run/reify_newimpl_36.scala | 3 +- test/files/run/reify_newimpl_37.scala | 3 +- test/files/run/reify_newimpl_38.scala | 3 +- test/files/run/reify_newimpl_39.scala | 3 +- test/files/run/reify_newimpl_40.scala | 3 +- test/files/run/reify_newimpl_41.scala | 3 +- test/files/run/reify_newimpl_42.scala | 3 +- test/files/run/reify_newimpl_43.scala | 3 +- test/files/run/reify_newimpl_44.scala | 3 +- test/files/run/reify_newimpl_45.scala | 11 ++- test/files/run/reify_newimpl_47.scala | 8 +- test/files/run/reify_newimpl_48.scala | 8 +- test/files/run/reify_newimpl_49.scala | 3 +- test/files/run/reify_newimpl_50.scala | 3 +- test/files/run/reify_newimpl_51.scala | 3 +- test/files/run/reify_newimpl_52.scala | 3 +- test/files/run/reify_printf.scala | 24 ++--- test/files/run/reify_properties.scala | 3 +- test/files/run/reify_sort.scala | 5 +- test/files/run/reify_sort1.scala | 5 +- test/files/run/reify_this.scala | 5 +- test/files/run/reify_timeofday.scala | 5 +- test/files/run/reify_typerefs_1a.scala | 9 +- test/files/run/reify_typerefs_1b.scala | 9 +- test/files/run/reify_typerefs_2a.scala | 9 +- test/files/run/reify_typerefs_2b.scala | 9 +- test/files/run/reify_typerefs_3a.scala | 9 +- test/files/run/reify_typerefs_3b.scala | 9 +- test/files/run/reify_varargs.scala | 5 +- test/files/run/runtimeEval1.check | 1 + test/files/run/runtimeEval1.scala | 9 ++ test/files/run/runtimeEval2.check | 1 + test/files/run/runtimeEval2.scala | 11 +++ test/files/run/t0421-new.scala | 4 +- test/files/run/t0677-new.scala | 4 +- test/files/run/t1195-new.check | 12 +-- test/files/run/t1195-new.scala | 6 +- test/files/run/t2236-new.scala | 4 +- test/files/run/t2886.scala | 4 +- test/files/run/t3507-new.check | 2 +- test/files/run/t3507-new.scala | 4 +- test/files/run/t4110-new.check | 4 +- test/files/run/t4110-new.scala | 4 +- test/files/run/t4216.check | 71 +++++++------- test/files/run/t4216.scala | 1 + test/files/run/t5224.scala | 2 +- test/files/run/t5225_1.scala | 2 +- test/files/run/t5225_2.scala | 2 +- test/files/run/t5229_1.scala | 5 +- test/files/run/t5229_2.scala | 9 +- test/files/run/t5230.scala | 9 +- test/files/run/t5256a.check | 8 +- test/files/run/t5256a.scala | 12 ++- test/files/run/t5256b.check | 6 +- test/files/run/t5256b.scala | 12 ++- test/files/run/t5256c.check | 6 ++ test/files/run/t5256c.scala | 12 +++ test/files/run/t5256d.check | 26 +++-- test/files/run/t5256d.scala | 13 ++- test/files/run/t5256e.check | 8 +- test/files/run/t5256e.scala | 13 +-- test/files/run/t5256f.check | 16 ++- test/files/run/t5256f.scala | 17 ++-- test/files/run/t5256g.check | 3 + test/files/run/t5256g.scala | 13 +++ test/files/run/t5256h.check | 7 ++ test/files/run/t5256h.scala | 10 ++ test/files/run/t5258a.scala | 3 +- test/files/run/t5266_1.scala | 7 +- test/files/run/t5266_2.scala | 9 +- test/files/run/t5269.scala | 5 +- test/files/run/t5270.scala | 5 +- test/files/run/t5271_1.scala | 10 +- test/files/run/t5271_2.scala | 10 +- test/files/run/t5271_3.scala | 10 +- test/files/run/t5271_4.scala | 5 +- test/files/run/t5272_1.check | 1 - test/files/run/t5272_1.flags | 0 test/files/run/t5272_1.scala | 10 -- test/files/run/t5272_1_newpatmat.check | 1 + test/files/run/t5272_1_newpatmat.scala | 11 +++ test/files/run/t5272_1_oldpatmat.check | 1 + test/files/run/t5272_1_oldpatmat.flags | 0 test/files/run/t5272_1_oldpatmat.scala | 11 +++ test/files/run/t5272_2.check | 1 - test/files/run/t5272_2.flags | 0 test/files/run/t5272_2.scala | 9 -- test/files/run/t5272_2_newpatmat.check | 1 + test/files/run/t5272_2_newpatmat.scala | 10 ++ test/files/run/t5272_2_oldpatmat.check | 1 + test/files/run/t5272_2_oldpatmat.flags | 0 test/files/run/t5272_2_oldpatmat.scala | 10 ++ test/files/run/t5273_1.check | 1 - test/files/run/t5273_1.flags | 0 test/files/run/t5273_1.scala | 10 -- test/files/run/t5273_1_newpatmat.check | 1 + test/files/run/t5273_1_newpatmat.scala | 11 +++ test/files/run/t5273_1_oldpatmat.check | 1 + test/files/run/t5273_1_oldpatmat.flags | 0 test/files/run/t5273_1_oldpatmat.scala | 11 +++ test/files/run/t5273_2a.check | 1 - test/files/run/t5273_2a.flags | 0 test/files/run/t5273_2a.scala | 8 -- test/files/run/t5273_2a_newpatmat.check | 1 + test/files/run/t5273_2a_newpatmat.scala | 9 ++ test/files/run/t5273_2a_oldpatmat.check | 1 + test/files/run/t5273_2a_oldpatmat.flags | 0 test/files/run/t5273_2a_oldpatmat.scala | 9 ++ test/files/run/t5273_2b.check | 1 - test/files/run/t5273_2b.flags | 0 test/files/run/t5273_2b.scala | 9 -- test/files/run/t5273_2b_newpatmat.check | 1 + test/files/run/t5273_2b_newpatmat.scala | 10 ++ test/files/run/t5273_2b_oldpatmat.check | 1 + test/files/run/t5273_2b_oldpatmat.flags | 0 test/files/run/t5273_2b_oldpatmat.scala | 10 ++ test/files/run/t5274_1.scala | 5 +- test/files/run/t5274_2.scala | 5 +- test/files/run/t5275.scala | 5 +- test/files/run/t5276_1a.scala | 5 +- test/files/run/t5276_1b.scala | 5 +- test/files/run/t5276_2a.scala | 5 +- test/files/run/t5276_2b.scala | 5 +- test/files/run/t5277_1.scala | 5 +- test/files/run/t5277_2.scala | 5 +- test/files/run/t5279.scala | 5 +- test/files/run/t5334_1.scala | 9 +- test/files/run/t5334_2.scala | 9 +- test/files/run/t5335.scala | 5 +- test/files/run/t5415.scala | 8 +- test/files/run/t5419.scala | 2 +- test/files/run/t5423.scala | 10 +- test/files/run/t5704.check | 2 +- test/files/run/t5704.scala | 9 +- test/files/run/t5713/Impls_Macros_1.scala | 5 +- test/files/run/toolbox_console_reporter.scala | 4 +- .../run/toolbox_default_reporter_is_silent.scala | 9 +- test/files/run/toolbox_silent_reporter.scala | 7 +- .../run/toolbox_typecheck_implicitsdisabled.check | 2 +- .../run/toolbox_typecheck_implicitsdisabled.scala | 7 +- .../run/toolbox_typecheck_macrosdisabled.check | 38 +++++++- .../run/toolbox_typecheck_macrosdisabled.scala | 21 ++-- .../run/toolbox_typecheck_macrosdisabled2.check | 38 +++++++- .../run/toolbox_typecheck_macrosdisabled2.scala | 19 ++-- test/files/run/typetags_core.check | 60 ++++++------ test/files/run/typetags_core.scala | 6 +- test/files/run/typetags_multi.check | 10 +- test/files/run/typetags_multi.scala | 12 ++- test/files/scalacheck/array-new.scala | 3 +- test/files/specialized/spec-matrix-new.scala | 4 +- test/files/speclib/instrumented.jar.desired.sha1 | 2 +- .../library/scala/runtime/ScalaRunTime.scala | 32 +++--- test/instrumented/srt.patch | 10 +- test/pending/neg/reify_packed.scala | 9 +- test/pending/pos/inference.scala | 20 ++-- .../pending/run/macro-expand-default/Impls_1.scala | 4 +- .../Impls_1.scala | 6 +- ...o-expand-implicit-macro-has-context-bound.check | 1 - ...o-expand-implicit-macro-has-context-bound.flags | 1 - .../Impls_1.scala | 10 -- .../Macros_Test_2.scala | 4 - .../run/macro-expand-macro-has-context-bound.check | 1 + .../run/macro-expand-macro-has-context-bound.flags | 1 + .../Impls_1.scala | 10 ++ .../Macros_Test_2.scala | 4 + test/pending/run/macro-expand-named/Impls_1.scala | 4 +- .../macro-expand-tparams-prefix-e1/Impls_1.scala | 4 +- .../Macros_Test_2.scala | 2 +- .../macro-expand-tparams-prefix-f1/Impls_1.scala | 4 +- .../Macros_Test_2.scala | 2 +- test/pending/run/macro-reify-array/Macros_1.scala | 2 +- test/pending/run/macro-reify-eval-vs-value.flags | 1 - .../run/macro-reify-eval-vs-value/Macros_1.scala | 25 ----- .../run/macro-reify-eval-vs-value/Test_2.scala | 5 - .../Test.scala | 2 +- .../run/macro-reify-tagful-b/Macros_1.scala | 2 +- .../run/macro-reify-tagless-b/Impls_Macros_1.scala | 2 +- .../pending/run/macro-reify-tagless-b/Test_2.scala | 6 +- .../Test.scala | 2 +- .../Test.scala | 2 +- test/pending/run/reify_addressbook.scala | 3 +- test/pending/run/reify_brainf_ck.scala | 3 +- test/pending/run/reify_callccinterpreter.scala | 3 +- test/pending/run/reify_closure2b.scala | 11 ++- test/pending/run/reify_closure3b.scala | 11 ++- test/pending/run/reify_closure4b.scala | 11 ++- test/pending/run/reify_closure5b.scala | 11 ++- test/pending/run/reify_closure9a.scala | 10 +- test/pending/run/reify_closure9b.scala | 10 +- test/pending/run/reify_closures11.scala | 10 +- test/pending/run/reify_gadts.scala | 3 +- test/pending/run/reify_newimpl_07.scala | 5 +- test/pending/run/reify_newimpl_08.scala | 7 +- test/pending/run/reify_newimpl_35.scala | 10 -- test/pending/run/reify_newimpl_46.scala | 13 ++- test/pending/run/reify_newimpl_53.scala | 13 ++- test/pending/run/reify_simpleinterpreter.scala | 2 +- test/pending/run/t5256c.check | 0 test/pending/run/t5256c.scala | 10 -- test/pending/run/t5256g.check | 0 test/pending/run/t5256g.scala | 11 --- test/pending/run/t5256h.check | 8 -- test/pending/run/t5256h.scala | 8 -- test/pending/run/t5258b.scala | 3 +- test/pending/run/t5258c.scala | 3 +- test/pending/run/t5418.scala | 3 +- test/pending/run/t5427a.scala | 2 +- test/pending/run/t5427b.scala | 2 +- test/pending/run/t5427c.scala | 2 +- test/pending/run/t5427d.scala | 2 +- test/pending/shootout/meteor.scala | 3 +- 592 files changed, 2821 insertions(+), 1943 deletions(-) delete mode 120000 test/disabled/lib create mode 100644 test/files/neg/interop_concretetypetags_arenot_classmanifests.check create mode 100644 test/files/neg/interop_concretetypetags_arenot_classmanifests.scala create mode 100644 test/files/neg/interop_concretetypetags_arenot_classtags.check create mode 100644 test/files/neg/interop_concretetypetags_arenot_classtags.scala create mode 100644 test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.check create mode 100644 test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala delete mode 100644 test/files/neg/interop_erasuretags_arenot_classmanifests.check delete mode 100644 test/files/neg/interop_erasuretags_arenot_classmanifests.scala delete mode 100644 test/files/neg/interop_erasuretags_arenot_manifests.check delete mode 100644 test/files/neg/interop_erasuretags_arenot_manifests.scala create mode 100644 test/files/neg/interop_typetags_arenot_classtags.check create mode 100644 test/files/neg/interop_typetags_arenot_classtags.scala create mode 100644 test/files/neg/reify_metalevel_breach_+0_refers_to_1.check create mode 100644 test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala create mode 100644 test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check create mode 100644 test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala create mode 100644 test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check create mode 100644 test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala create mode 100644 test/files/neg/reify_metalevel_breach_-1_refers_to_1.check create mode 100644 test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala create mode 100644 test/files/neg/reify_nested_inner_refers_to_local.check create mode 100644 test/files/neg/reify_nested_inner_refers_to_local.scala create mode 100644 test/files/pos/typetags.scala delete mode 100644 test/files/run/classtags_use_concretetypetags.scala delete mode 100644 test/files/run/erasuretags_abstract.check delete mode 100644 test/files/run/erasuretags_abstract.scala delete mode 100644 test/files/run/erasuretags_basic.check delete mode 100644 test/files/run/erasuretags_basic.scala delete mode 100644 test/files/run/erasuretags_core.check delete mode 100644 test/files/run/erasuretags_core.scala delete mode 100644 test/files/run/erasuretags_usage.scala create mode 100644 test/files/run/freetypes_false_alarm1.check create mode 100644 test/files/run/freetypes_false_alarm1.scala create mode 100644 test/files/run/freetypes_false_alarm2.check create mode 100644 test/files/run/freetypes_false_alarm2.scala create mode 100644 test/files/run/interop_classmanifests_arenot_typetags.check create mode 100644 test/files/run/interop_classmanifests_arenot_typetags.scala delete mode 100644 test/files/run/interop_classmanifests_arepartially_typetags.check delete mode 100644 test/files/run/interop_classmanifests_arepartially_typetags.scala delete mode 100644 test/files/run/interop_concretetypetags_are_classmanifests.check delete mode 100644 test/files/run/interop_concretetypetags_are_classmanifests.scala delete mode 100644 test/files/run/macro-reify-eval-eval.check delete mode 100644 test/files/run/macro-reify-eval-eval.flags delete mode 100644 test/files/run/macro-reify-eval-eval/Macros_1.scala delete mode 100644 test/files/run/macro-reify-eval-eval/Test_2.scala delete mode 100644 test/files/run/macro-reify-eval-outside-reify.check delete mode 100644 test/files/run/macro-reify-eval-outside-reify.flags delete mode 100644 test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala delete mode 100644 test/files/run/macro-reify-eval-outside-reify/Test_2.scala create mode 100644 test/files/run/macro-reify-splice-outside-reify.check create mode 100644 test/files/run/macro-reify-splice-outside-reify.flags create mode 100644 test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala create mode 100644 test/files/run/macro-reify-splice-outside-reify/Test_2.scala create mode 100644 test/files/run/macro-reify-splice-splice.check create mode 100644 test/files/run/macro-reify-splice-splice.flags create mode 100644 test/files/run/macro-reify-splice-splice/Macros_1.scala create mode 100644 test/files/run/macro-reify-splice-splice/Test_2.scala delete mode 100644 test/files/run/macro-reify-value-outside-reify.check delete mode 100644 test/files/run/macro-reify-value-outside-reify.flags delete mode 100644 test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala delete mode 100644 test/files/run/macro-reify-value-outside-reify/Test_2.scala create mode 100644 test/files/run/newTags.check create mode 100644 test/files/run/newTags.scala delete mode 100644 test/files/run/reflection-implClass-new.scala delete mode 100644 test/files/run/reflection-implClass-old.scala create mode 100644 test/files/run/reflection-implClass.scala create mode 100644 test/files/run/reflection-repl.check create mode 100644 test/files/run/reflection-repl.scala create mode 100644 test/files/run/reflinit.check create mode 100644 test/files/run/reflinit.scala create mode 100644 test/files/run/reify_copypaste1.check create mode 100644 test/files/run/reify_copypaste1.scala create mode 100644 test/files/run/reify_copypaste2.check create mode 100644 test/files/run/reify_copypaste2.scala delete mode 100644 test/files/run/reify_fors.check delete mode 100644 test/files/run/reify_fors.flags delete mode 100644 test/files/run/reify_fors.scala create mode 100644 test/files/run/reify_fors_newpatmat.check create mode 100644 test/files/run/reify_fors_newpatmat.scala create mode 100644 test/files/run/reify_fors_oldpatmat.check create mode 100644 test/files/run/reify_fors_oldpatmat.flags create mode 100644 test/files/run/reify_fors_oldpatmat.scala delete mode 100644 test/files/run/reify_maps.check delete mode 100644 test/files/run/reify_maps.flags delete mode 100644 test/files/run/reify_maps.scala create mode 100644 test/files/run/reify_maps_newpatmat.check create mode 100644 test/files/run/reify_maps_newpatmat.scala create mode 100644 test/files/run/reify_maps_oldpatmat.check create mode 100644 test/files/run/reify_maps_oldpatmat.flags create mode 100644 test/files/run/reify_maps_oldpatmat.scala delete mode 100644 test/files/run/reify_newimpl_24.check delete mode 100644 test/files/run/reify_newimpl_24.scala create mode 100644 test/files/run/reify_newimpl_35.check create mode 100644 test/files/run/reify_newimpl_35.scala create mode 100644 test/files/run/runtimeEval1.check create mode 100644 test/files/run/runtimeEval1.scala create mode 100644 test/files/run/runtimeEval2.check create mode 100644 test/files/run/runtimeEval2.scala create mode 100644 test/files/run/t5256c.check create mode 100644 test/files/run/t5256c.scala create mode 100644 test/files/run/t5256g.check create mode 100644 test/files/run/t5256g.scala create mode 100644 test/files/run/t5256h.check create mode 100644 test/files/run/t5256h.scala delete mode 100644 test/files/run/t5272_1.check delete mode 100644 test/files/run/t5272_1.flags delete mode 100644 test/files/run/t5272_1.scala create mode 100644 test/files/run/t5272_1_newpatmat.check create mode 100644 test/files/run/t5272_1_newpatmat.scala create mode 100644 test/files/run/t5272_1_oldpatmat.check create mode 100644 test/files/run/t5272_1_oldpatmat.flags create mode 100644 test/files/run/t5272_1_oldpatmat.scala delete mode 100644 test/files/run/t5272_2.check delete mode 100644 test/files/run/t5272_2.flags delete mode 100644 test/files/run/t5272_2.scala create mode 100644 test/files/run/t5272_2_newpatmat.check create mode 100644 test/files/run/t5272_2_newpatmat.scala create mode 100644 test/files/run/t5272_2_oldpatmat.check create mode 100644 test/files/run/t5272_2_oldpatmat.flags create mode 100644 test/files/run/t5272_2_oldpatmat.scala delete mode 100644 test/files/run/t5273_1.check delete mode 100644 test/files/run/t5273_1.flags delete mode 100644 test/files/run/t5273_1.scala create mode 100644 test/files/run/t5273_1_newpatmat.check create mode 100644 test/files/run/t5273_1_newpatmat.scala create mode 100644 test/files/run/t5273_1_oldpatmat.check create mode 100644 test/files/run/t5273_1_oldpatmat.flags create mode 100644 test/files/run/t5273_1_oldpatmat.scala delete mode 100644 test/files/run/t5273_2a.check delete mode 100644 test/files/run/t5273_2a.flags delete mode 100644 test/files/run/t5273_2a.scala create mode 100644 test/files/run/t5273_2a_newpatmat.check create mode 100644 test/files/run/t5273_2a_newpatmat.scala create mode 100644 test/files/run/t5273_2a_oldpatmat.check create mode 100644 test/files/run/t5273_2a_oldpatmat.flags create mode 100644 test/files/run/t5273_2a_oldpatmat.scala delete mode 100644 test/files/run/t5273_2b.check delete mode 100644 test/files/run/t5273_2b.flags delete mode 100644 test/files/run/t5273_2b.scala create mode 100644 test/files/run/t5273_2b_newpatmat.check create mode 100644 test/files/run/t5273_2b_newpatmat.scala create mode 100644 test/files/run/t5273_2b_oldpatmat.check create mode 100644 test/files/run/t5273_2b_oldpatmat.flags create mode 100644 test/files/run/t5273_2b_oldpatmat.scala delete mode 100644 test/pending/run/macro-expand-implicit-macro-has-context-bound.check delete mode 100644 test/pending/run/macro-expand-implicit-macro-has-context-bound.flags delete mode 100644 test/pending/run/macro-expand-implicit-macro-has-context-bound/Impls_1.scala delete mode 100644 test/pending/run/macro-expand-implicit-macro-has-context-bound/Macros_Test_2.scala create mode 100644 test/pending/run/macro-expand-macro-has-context-bound.check create mode 100644 test/pending/run/macro-expand-macro-has-context-bound.flags create mode 100644 test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala create mode 100644 test/pending/run/macro-expand-macro-has-context-bound/Macros_Test_2.scala delete mode 100644 test/pending/run/macro-reify-eval-vs-value.flags delete mode 100644 test/pending/run/macro-reify-eval-vs-value/Macros_1.scala delete mode 100644 test/pending/run/macro-reify-eval-vs-value/Test_2.scala delete mode 100644 test/pending/run/reify_newimpl_35.scala delete mode 100644 test/pending/run/t5256c.check delete mode 100644 test/pending/run/t5256c.scala delete mode 100644 test/pending/run/t5256g.check delete mode 100644 test/pending/run/t5256g.scala delete mode 100644 test/pending/run/t5256h.check delete mode 100644 test/pending/run/t5256h.scala diff --git a/test/disabled/lib b/test/disabled/lib deleted file mode 120000 index c1294f7c38..0000000000 --- a/test/disabled/lib +++ /dev/null @@ -1 +0,0 @@ -../files/lib \ No newline at end of file diff --git a/test/files/codelib/code.jar.desired.sha1 b/test/files/codelib/code.jar.desired.sha1 index 21c4dccb30..d2b8d9add9 100644 --- a/test/files/codelib/code.jar.desired.sha1 +++ b/test/files/codelib/code.jar.desired.sha1 @@ -1 +1 @@ -3ddb9fded6e19ca591a78b8a294284c9e945da30 ?code.jar +e737b123d31eede5594ceda07caafed1673ec472 ?code.jar diff --git a/test/files/jvm/manifests-new.check b/test/files/jvm/manifests-new.check index 896a5c1cef..43e24fb73c 100644 --- a/test/files/jvm/manifests-new.check +++ b/test/files/jvm/manifests-new.check @@ -2,25 +2,25 @@ x=(), t=ConcreteTypeTag[Unit], k=TypeRef, s=class Unit x=true, t=ConcreteTypeTag[Boolean], k=TypeRef, s=class Boolean x=a, t=ConcreteTypeTag[Char], k=TypeRef, s=class Char x=1, t=ConcreteTypeTag[Int], k=TypeRef, s=class Int -x=abc, t=ConcreteTypeTag[String], k=TypeRef, s=class String +x=abc, t=ConcreteTypeTag[java.lang.String], k=TypeRef, s=class String x='abc, t=ConcreteTypeTag[Symbol], k=TypeRef, s=class Symbol x=List(()), t=ConcreteTypeTag[List[Unit]], k=TypeRef, s=class List x=List(true), t=ConcreteTypeTag[List[Boolean]], k=TypeRef, s=class List x=List(1), t=ConcreteTypeTag[List[Int]], k=TypeRef, s=class List -x=List(abc), t=ConcreteTypeTag[List[String]], k=TypeRef, s=class List +x=List(abc), t=ConcreteTypeTag[List[java.lang.String]], k=TypeRef, s=class List x=List('abc), t=ConcreteTypeTag[List[Symbol]], k=TypeRef, s=class List x=[Z, t=ConcreteTypeTag[Array[Boolean]], k=TypeRef, s=class Array x=[C, t=ConcreteTypeTag[Array[Char]], k=TypeRef, s=class Array x=[I, t=ConcreteTypeTag[Array[Int]], k=TypeRef, s=class Array -x=[Ljava.lang.String;, t=ConcreteTypeTag[Array[String]], k=TypeRef, s=class Array +x=[Ljava.lang.String;, t=ConcreteTypeTag[Array[java.lang.String]], k=TypeRef, s=class Array x=[Lscala.Symbol;, t=ConcreteTypeTag[Array[Symbol]], k=TypeRef, s=class Array x=((),()), t=ConcreteTypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2 x=(true,false), t=ConcreteTypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2 x=(1,2), t=ConcreteTypeTag[(Int, Int)], k=TypeRef, s=class Tuple2 -x=(abc,xyz), t=ConcreteTypeTag[(String, String)], k=TypeRef, s=class Tuple2 +x=(abc,xyz), t=ConcreteTypeTag[(java.lang.String, java.lang.String)], k=TypeRef, s=class Tuple2 x=('abc,'xyz), t=ConcreteTypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2 x=Test$, t=ConcreteTypeTag[Test.type], k=SingleType, s=object Test @@ -31,8 +31,8 @@ x=Foo, t=ConcreteTypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo x=Foo, t=ConcreteTypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo x=Foo, t=ConcreteTypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo -x=Test1$$anon$1, t=ConcreteTypeTag[Bar[String]], k=RefinedType, s= -x=Test1$$anon$2, t=ConcreteTypeTag[Bar[String]], k=RefinedType, s= +x=Test1$$anon$1, t=ConcreteTypeTag[Bar[java.lang.String]], k=RefinedType, s= +x=Test1$$anon$2, t=ConcreteTypeTag[Bar[java.lang.String]], k=RefinedType, s= ()=() true=true diff --git a/test/files/jvm/manifests-new.scala b/test/files/jvm/manifests-new.scala index d02f6ee608..b5d0e0f7d7 100644 --- a/test/files/jvm/manifests-new.scala +++ b/test/files/jvm/manifests-new.scala @@ -1,3 +1,6 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + object Test extends App { Test1 Test2 @@ -58,12 +61,12 @@ object Test2 { println("true="+load[Boolean](dump(true))) println("a="+load[Char](dump('a'))) println("1="+load[Int](dump(1))) - println("'abc="+load[Symbol](dump('abc))) + println("'abc="+load[scala.Symbol](dump('abc))) println() println("List(())="+load[List[Unit]](dump(List(())))) println("List(true)="+load[List[Boolean]](dump(List(true)))) - println("List('abc)="+load[List[Symbol]](dump(List('abc)))) + println("List('abc)="+load[List[scala.Symbol]](dump(List('abc)))) println() def loadArray[T](x: Array[Byte])(implicit t: reflect.ClassTag[Array[T]]) = @@ -98,12 +101,11 @@ trait TestUtil { val in = new ObjectInputStream(new ByteArrayInputStream(buffer)) in.readObject().asInstanceOf[A] } - import scala.reflect._ def print[T](x: T)(implicit t: ConcreteTypeTag[T]) { // todo. type tags are not yet serializable // val t1: ConcreteTypeTag[T] = read(write(t)) val t1: ConcreteTypeTag[T] = t val x1 = x.toString.replaceAll("@[0-9a-z]+$", "") - println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.sym.toString) + println("x="+x1+", t="+t1+", k="+t1.tpe.kind+", s="+t1.tpe.typeSymbol.toString) } -} +} \ No newline at end of file diff --git a/test/files/jvm/serialization-new.scala b/test/files/jvm/serialization-new.scala index bb971fdf36..d9c23dc0e1 100644 --- a/test/files/jvm/serialization-new.scala +++ b/test/files/jvm/serialization-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + //############################################################################ // Serialization //############################################################################ @@ -648,4 +650,4 @@ object Test9_parallel { println("Error in Test5_parallel: " + e) throw e } -} +} \ No newline at end of file diff --git a/test/files/neg/classtags_contextbound_b.check b/test/files/neg/classtags_contextbound_b.check index f1f48bed72..e08ab504bc 100644 --- a/test/files/neg/classtags_contextbound_b.check +++ b/test/files/neg/classtags_contextbound_b.check @@ -1,4 +1,4 @@ -classtags_contextbound_b.scala:3: error: No ClassTag available for T +classtags_contextbound_b.scala:5: error: No ClassTag available for T def foo[T] = mkArray[T] ^ one error found diff --git a/test/files/neg/classtags_contextbound_b.scala b/test/files/neg/classtags_contextbound_b.scala index 3247a8ff29..a189f9aa65 100644 --- a/test/files/neg/classtags_contextbound_b.scala +++ b/test/files/neg/classtags_contextbound_b.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { def mkArray[T: ClassTag] = Array[T]() def foo[T] = mkArray[T] diff --git a/test/files/neg/classtags_contextbound_c.check b/test/files/neg/classtags_contextbound_c.check index a1c5eddfe1..73b451d61c 100644 --- a/test/files/neg/classtags_contextbound_c.check +++ b/test/files/neg/classtags_contextbound_c.check @@ -1,4 +1,4 @@ -classtags_contextbound_c.scala:2: error: No ArrayTag available for T +classtags_contextbound_c.scala:4: error: No ArrayTag available for T def mkArray[T] = Array[T]() ^ one error found diff --git a/test/files/neg/classtags_contextbound_c.scala b/test/files/neg/classtags_contextbound_c.scala index 0b63f8407e..54c616ce7e 100644 --- a/test/files/neg/classtags_contextbound_c.scala +++ b/test/files/neg/classtags_contextbound_c.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { def mkArray[T] = Array[T]() def foo[T: ClassTag] = mkArray[T] diff --git a/test/files/neg/classtags_dont_use_typetags.check b/test/files/neg/classtags_dont_use_typetags.check index c7d2fba35b..c12b2874dc 100644 --- a/test/files/neg/classtags_dont_use_typetags.check +++ b/test/files/neg/classtags_dont_use_typetags.check @@ -1,4 +1,4 @@ -classtags_dont_use_typetags.scala:2: error: No ArrayTag available for T +classtags_dont_use_typetags.scala:4: error: No ArrayTag available for T def foo[T: TypeTag] = Array[T]() ^ one error found diff --git a/test/files/neg/classtags_dont_use_typetags.scala b/test/files/neg/classtags_dont_use_typetags.scala index 0f675f71aa..2eb842b860 100644 --- a/test/files/neg/classtags_dont_use_typetags.scala +++ b/test/files/neg/classtags_dont_use_typetags.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def foo[T: TypeTag] = Array[T]() } \ No newline at end of file diff --git a/test/files/neg/interop_classmanifests_arenot_concretetypetags.check b/test/files/neg/interop_classmanifests_arenot_concretetypetags.check index d6fa564df4..e51324f241 100644 --- a/test/files/neg/interop_classmanifests_arenot_concretetypetags.check +++ b/test/files/neg/interop_classmanifests_arenot_concretetypetags.check @@ -1,4 +1,4 @@ -interop_classmanifests_arenot_concretetypetags.scala:3: error: No ConcreteTypeTag available for T - println(concreteTypeTag[T]) - ^ +interop_classmanifests_arenot_concretetypetags.scala:5: error: No ConcreteTypeTag available for T + println(implicitly[ConcreteTypeTag[T]]) + ^ one error found diff --git a/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala b/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala index 5b1ed55e47..f130f162cd 100644 --- a/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala +++ b/test/files/neg/interop_classmanifests_arenot_concretetypetags.scala @@ -1,6 +1,8 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def classManifestIsnotConcreteTypeTag[T: ClassManifest] = { - println(concreteTypeTag[T]) + println(implicitly[ConcreteTypeTag[T]]) } classManifestIsnotConcreteTypeTag[Int] diff --git a/test/files/neg/interop_classtags_arenot_manifests.check b/test/files/neg/interop_classtags_arenot_manifests.check index 95f6a94d4b..2d1a896872 100644 --- a/test/files/neg/interop_classtags_arenot_manifests.check +++ b/test/files/neg/interop_classtags_arenot_manifests.check @@ -1,7 +1,7 @@ -interop_classtags_arenot_manifests.scala:3: error: No Manifest available for T. +interop_classtags_arenot_manifests.scala:6: error: No Manifest available for T. println(manifest[T]) ^ -interop_classtags_arenot_manifests.scala:11: error: No Manifest available for T. +interop_classtags_arenot_manifests.scala:14: error: No Manifest available for T. println(manifest[T]) ^ two errors found diff --git a/test/files/neg/interop_classtags_arenot_manifests.scala b/test/files/neg/interop_classtags_arenot_manifests.scala index 7351f7e305..5c4130ad6d 100644 --- a/test/files/neg/interop_classtags_arenot_manifests.scala +++ b/test/files/neg/interop_classtags_arenot_manifests.scala @@ -1,3 +1,6 @@ +import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} + object Test extends App { def arrayTagIsnotManifest[T: ArrayTag] = { println(manifest[T]) diff --git a/test/files/neg/interop_concretetypetags_arenot_classmanifests.check b/test/files/neg/interop_concretetypetags_arenot_classmanifests.check new file mode 100644 index 0000000000..e2dacad6c2 --- /dev/null +++ b/test/files/neg/interop_concretetypetags_arenot_classmanifests.check @@ -0,0 +1,4 @@ +interop_concretetypetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T] + println(classManifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_concretetypetags_arenot_classmanifests.scala b/test/files/neg/interop_concretetypetags_arenot_classmanifests.scala new file mode 100644 index 0000000000..70c87a78a6 --- /dev/null +++ b/test/files/neg/interop_concretetypetags_arenot_classmanifests.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def concreteTypeTagIsnotClassManifest[T: ConcreteTypeTag] = { + println(classManifest[T]) + } + + concreteTypeTagIsnotClassManifest[Int] + concreteTypeTagIsnotClassManifest[String] + concreteTypeTagIsnotClassManifest[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/interop_concretetypetags_arenot_classtags.check b/test/files/neg/interop_concretetypetags_arenot_classtags.check new file mode 100644 index 0000000000..7a7d3bcef5 --- /dev/null +++ b/test/files/neg/interop_concretetypetags_arenot_classtags.check @@ -0,0 +1,4 @@ +interop_concretetypetags_arenot_classtags.scala:6: error: No ClassTag available for T + println(classTag[T]) + ^ +one error found diff --git a/test/files/neg/interop_concretetypetags_arenot_classtags.scala b/test/files/neg/interop_concretetypetags_arenot_classtags.scala new file mode 100644 index 0000000000..74e51e8a7a --- /dev/null +++ b/test/files/neg/interop_concretetypetags_arenot_classtags.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def concreteTypeTagIsnotClassTag[T: ConcreteTypeTag] = { + println(classTag[T]) + } + + concreteTypeTagIsnotClassTag[Int] + concreteTypeTagIsnotClassTag[String] + concreteTypeTagIsnotClassTag[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.check b/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.check new file mode 100644 index 0000000000..fc550abb4d --- /dev/null +++ b/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.check @@ -0,0 +1,6 @@ +interop_concretetypetags_without_classtags_arenot_manifests.scala:6: error: to create a manifest here, it is necessary to interoperate with the type tag `evidence$1` in scope. +however typetag -> manifest conversion requires a class tag for the corresponding type to be present. +to proceed add a class tag to the type `T` (e.g. by introducing a context bound) and recompile. + println(manifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala b/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala new file mode 100644 index 0000000000..b9db4ac121 --- /dev/null +++ b/test/files/neg/interop_concretetypetags_without_classtags_arenot_manifests.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + +object Test extends App { + def concreteTypeTagIsManifest[T: ConcreteTypeTag] = { + println(manifest[T]) + } + + concreteTypeTagIsManifest[Int] + concreteTypeTagIsManifest[String] + concreteTypeTagIsManifest[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/interop_erasuretags_arenot_classmanifests.check b/test/files/neg/interop_erasuretags_arenot_classmanifests.check deleted file mode 100644 index 4bb81108d1..0000000000 --- a/test/files/neg/interop_erasuretags_arenot_classmanifests.check +++ /dev/null @@ -1,4 +0,0 @@ -interop_erasuretags_arenot_classmanifests.scala:3: error: could not find implicit value for parameter m: ClassManifest[T] - println(classManifest[T]) - ^ -one error found diff --git a/test/files/neg/interop_erasuretags_arenot_classmanifests.scala b/test/files/neg/interop_erasuretags_arenot_classmanifests.scala deleted file mode 100644 index cf7d1ac257..0000000000 --- a/test/files/neg/interop_erasuretags_arenot_classmanifests.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def erasureTagIsnotClassManifest[T: ErasureTag] = { - println(classManifest[T]) - } - - erasureTagIsnotClassManifest[Int] - erasureTagIsnotClassManifest[String] - erasureTagIsnotClassManifest[Array[Int]] -} \ No newline at end of file diff --git a/test/files/neg/interop_erasuretags_arenot_manifests.check b/test/files/neg/interop_erasuretags_arenot_manifests.check deleted file mode 100644 index da3c03d371..0000000000 --- a/test/files/neg/interop_erasuretags_arenot_manifests.check +++ /dev/null @@ -1,4 +0,0 @@ -interop_erasuretags_arenot_manifests.scala:3: error: No Manifest available for T. - println(manifest[T]) - ^ -one error found diff --git a/test/files/neg/interop_erasuretags_arenot_manifests.scala b/test/files/neg/interop_erasuretags_arenot_manifests.scala deleted file mode 100644 index 5c326549d8..0000000000 --- a/test/files/neg/interop_erasuretags_arenot_manifests.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def erasureTagIsnotManifest[T: ErasureTag] = { - println(manifest[T]) - } - - erasureTagIsnotManifest[Int] - erasureTagIsnotManifest[String] - erasureTagIsnotManifest[Array[Int]] -} \ No newline at end of file diff --git a/test/files/neg/interop_typetags_arenot_classmanifests.check b/test/files/neg/interop_typetags_arenot_classmanifests.check index 9ed4fd43d4..403625b4da 100644 --- a/test/files/neg/interop_typetags_arenot_classmanifests.check +++ b/test/files/neg/interop_typetags_arenot_classmanifests.check @@ -1,4 +1,4 @@ -interop_typetags_arenot_classmanifests.scala:3: error: could not find implicit value for parameter m: ClassManifest[T] +interop_typetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T] println(classManifest[T]) ^ one error found diff --git a/test/files/neg/interop_typetags_arenot_classmanifests.scala b/test/files/neg/interop_typetags_arenot_classmanifests.scala index b1fbb7b5a6..d07f4726f5 100644 --- a/test/files/neg/interop_typetags_arenot_classmanifests.scala +++ b/test/files/neg/interop_typetags_arenot_classmanifests.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def typeTagIsnotClassManifest[T: TypeTag] = { println(classManifest[T]) diff --git a/test/files/neg/interop_typetags_arenot_classtags.check b/test/files/neg/interop_typetags_arenot_classtags.check new file mode 100644 index 0000000000..673ad2f941 --- /dev/null +++ b/test/files/neg/interop_typetags_arenot_classtags.check @@ -0,0 +1,4 @@ +interop_typetags_arenot_classtags.scala:6: error: No ClassTag available for T + println(classTag[T]) + ^ +one error found diff --git a/test/files/neg/interop_typetags_arenot_classtags.scala b/test/files/neg/interop_typetags_arenot_classtags.scala new file mode 100644 index 0000000000..072c12adb0 --- /dev/null +++ b/test/files/neg/interop_typetags_arenot_classtags.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def typeTagIsnotClassTag[T: TypeTag] = { + println(classTag[T]) + } + + typeTagIsnotClassTag[Int] + typeTagIsnotClassTag[String] + typeTagIsnotClassTag[Array[Int]] +} \ No newline at end of file diff --git a/test/files/neg/interop_typetags_arenot_manifests.check b/test/files/neg/interop_typetags_arenot_manifests.check index 7761a747ff..e5a7adf340 100644 --- a/test/files/neg/interop_typetags_arenot_manifests.check +++ b/test/files/neg/interop_typetags_arenot_manifests.check @@ -1,4 +1,4 @@ -interop_typetags_arenot_manifests.scala:3: error: No Manifest available for T. +interop_typetags_arenot_manifests.scala:5: error: No Manifest available for T. println(manifest[T]) ^ one error found diff --git a/test/files/neg/interop_typetags_arenot_manifests.scala b/test/files/neg/interop_typetags_arenot_manifests.scala index 4e2a04489b..7ed1f3857b 100644 --- a/test/files/neg/interop_typetags_arenot_manifests.scala +++ b/test/files/neg/interop_typetags_arenot_manifests.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def typeTagIsnotManifest[T: TypeTag] = { println(manifest[T]) diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala index e9876e32e9..8abde907bb 100644 --- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala +++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala @@ -2,21 +2,21 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - Expr[Int](body) + c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) + c.Expr[Int](body) } } diff --git a/test/files/neg/macro-invalidimpl-f/Impls_1.scala b/test/files/neg/macro-invalidimpl-f/Impls_1.scala index 06c6efbb1f..3b8f15b90c 100644 --- a/test/files/neg/macro-invalidimpl-f/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-f/Impls_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def fooNullary(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) - Expr[Unit](body) + c.Expr[Unit](body) } def fooEmpty(c: Ctx)() = fooNullary(c) -} +} \ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-g/Impls_1.scala b/test/files/neg/macro-invalidimpl-g/Impls_1.scala index 06c6efbb1f..3b8f15b90c 100644 --- a/test/files/neg/macro-invalidimpl-g/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-g/Impls_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def fooNullary(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) - Expr[Unit](body) + c.Expr[Unit](body) } def fooEmpty(c: Ctx)() = fooNullary(c) -} +} \ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index 0401993335..b2ce4b1caa 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,4 +1,4 @@ -Impls_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences - def foo[U: c.TypeTag: Numeric](c: Ctx) = { - ^ -one error found +Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than TypeTag evidences + def foo[U: c.TypeTag: Numeric](c: Ctx) = { + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala index 2eb2ab3947..2eef7aac8b 100644 --- a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala @@ -1,8 +1,9 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag: Numeric](c: Ctx) = { - import c.mirror._ + import c.universe._ Literal(Constant(42)) } -} +} \ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala index da28944d27..4d5d29158f 100644 --- a/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-ctx-badargc/Impls_1.scala @@ -1,5 +1,3 @@ -import scala.reflect.api.{Mirror => Ctx} - object Impls { def foo = ??? } diff --git a/test/files/neg/macro-invalidsig-ctx-badtype.check b/test/files/neg/macro-invalidsig-ctx-badtype.check index 3913a8e3cb..b1702bbca6 100644 --- a/test/files/neg/macro-invalidsig-ctx-badtype.check +++ b/test/files/neg/macro-invalidsig-ctx-badtype.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context): c.Expr[Any] - found : (c: scala.reflect.api.Mirror): Nothing -type mismatch for parameter c: scala.reflect.makro.Context does not conform to scala.reflect.api.Mirror - def foo = macro Impls.foo - ^ -one error found +Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context): c.Expr[Any] + found : (c: scala.reflect.api.Universe): Nothing +type mismatch for parameter c: scala.reflect.makro.Context does not conform to scala.reflect.api.Universe + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala index 747a2e9ca8..cf1a4cf85c 100644 --- a/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-ctx-badtype/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.api.{Mirror => Ctx} +import scala.reflect.api.{Universe => Ctx} object Impls { def foo(c: Ctx) = ??? diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check index 0dd1c27b50..6416ed0a09 100644 --- a/test/files/neg/macro-invalidsig-implicit-params.check +++ b/test/files/neg/macro-invalidsig-implicit-params.check @@ -1,4 +1,4 @@ -Impls_Macros_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences +Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than TypeTag evidences def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { ^ one error found diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala index 662ad2ab52..5bfe73ec59 100644 --- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala @@ -1,18 +1,19 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticTpe)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.TypeTag[U]].tpe)))), Literal(Constant(()))) - Expr[Unit](body) + c.Expr[Unit](body) } } class Macros[T] { def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U] -} +} \ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index 71a65aec84..e4f67e650a 100644 --- a/test/files/neg/macro-invalidsig-params-badtype.check +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context)(x: c.Expr[Int]): c.Expr[Any] - found : (c: scala.reflect.makro.Context)(x: c.mirror.Tree): Nothing -type mismatch for parameter x: c.Expr[Int] does not conform to c.mirror.Tree - def foo(x: Int) = macro Impls.foo - ^ -one error found +Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.makro.Context)(x: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.makro.Context)(x: c.universe.Tree): Nothing +type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Tree + def foo(x: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala index 29220c1c82..6393e6d395 100644 --- a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala @@ -1,7 +1,7 @@ import scala.reflect.makro.{Context => Ctx} object Impls { - def foo(c: Ctx)(x: c.mirror.Tree) = ??? + def foo(c: Ctx)(x: c.universe.Tree) = ??? } object Macros { diff --git a/test/files/neg/macro-invalidsig-tparams-badtype.check b/test/files/neg/macro-invalidsig-tparams-badtype.check index bd1acc4a0a..9166db3574 100644 --- a/test/files/neg/macro-invalidsig-tparams-badtype.check +++ b/test/files/neg/macro-invalidsig-tparams-badtype.check @@ -1,6 +1,6 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape: required: (c: scala.reflect.makro.Context): c.Expr[Any] - found : (c: scala.reflect.makro.Context)(U: c.mirror.Type): Nothing + found : (c: scala.reflect.makro.Context)(U: c.universe.Type): Nothing number of parameter sections differ def foo[U] = macro Impls.foo[U] ^ diff --git a/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala index b43251df33..9886331502 100644 --- a/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala @@ -1,5 +1,5 @@ import scala.reflect.makro.{Context => Ctx} object Impls { - def foo[U](c: Ctx)(U: c.mirror.Type) = ??? + def foo[U](c: Ctx)(U: c.universe.Type) = ??? } diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala index bbe5b4e519..ea472e6f91 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala @@ -1,5 +1,6 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag](c: Ctx) = ??? -} +} \ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala index db79ddbcd8..c4eb3d9b4a 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala @@ -1,3 +1,4 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { @@ -7,4 +8,4 @@ object Impls { println(V) c.literalUnit } -} +} \ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala index 43c5a2acd5..41facc881e 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala @@ -1,11 +1,12 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T: c.TypeTag, U: c.TypeTag, V](c: Ctx)(implicit V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ + import c.universe._ println(implicitly[c.TypeTag[T]]) println(implicitly[c.TypeTag[U]]) println(V) c.literalUnit } -} +} \ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala index 8e52613b6d..31e758e9a0 100644 --- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala index 0b127f5a59..d6493caad9 100644 --- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala +++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala @@ -3,13 +3,13 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) - Expr[Unit](body) + c.Expr[Unit](body) } def fooBString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBString", x) def fooBInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBInt", x) def fooDInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooDInt", x) def fooZString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooZString", x) -} +} \ No newline at end of file diff --git a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala index 1302999da6..c0c9156b60 100644 --- a/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala +++ b/test/files/neg/macro-reify-groundtypetag-hktypeparams-notags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooNoTypeTagHK[C[_], T] = { diff --git a/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala b/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala index d2276ce333..a247c3fe7b 100644 --- a/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala +++ b/test/files/neg/macro-reify-groundtypetag-typeparams-notags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooNoTypeTag[T] = { diff --git a/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala b/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala index d82cdc33e9..52b5c1078d 100644 --- a/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala +++ b/test/files/neg/macro-reify-groundtypetag-usetypetag/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTag[T: TypeTag] = { diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala index e6cee46e85..0b6fbe240e 100644 --- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala @@ -2,17 +2,17 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) } def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) } def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) } -} +} \ No newline at end of file diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala index e6cee46e85..0b6fbe240e 100644 --- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala @@ -2,17 +2,17 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) } def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) } def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) } -} +} \ No newline at end of file diff --git a/test/files/neg/reify_ann2b.check b/test/files/neg/reify_ann2b.check index 52bdbe5b7c..1cef405bef 100644 --- a/test/files/neg/reify_ann2b.check +++ b/test/files/neg/reify_ann2b.check @@ -1,4 +1,4 @@ -reify_ann2b.scala:6: error: inner classes cannot be classfile annotations - class ann(bar: String) extends annotation.ClassfileAnnotation - ^ -one error found +reify_ann2b.scala:9: error: inner classes cannot be classfile annotations + class ann(bar: String) extends annotation.ClassfileAnnotation + ^ +one error found diff --git a/test/files/neg/reify_ann2b.scala b/test/files/neg/reify_ann2b.scala index 397d00210d..2076af34c8 100644 --- a/test/files/neg/reify_ann2b.scala +++ b/test/files/neg/reify_ann2b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { // test 1: reify @@ -16,7 +19,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check new file mode 100644 index 0000000000..efdbd7e282 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check @@ -0,0 +1,7 @@ +reify_metalevel_breach_+0_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `.eval` instead. + inner.splice + ^ +one error found diff --git a/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala new file mode 100644 index 0000000000..9499960480 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.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 App { + val code = reify{ + val x = 2 + val inner = reify{x} + inner.splice + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} \ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check new file mode 100644 index 0000000000..91755c789a --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check @@ -0,0 +1,7 @@ +reify_metalevel_breach_-1_refers_to_0_a.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `.eval` instead. + val code = reify{outer.splice.splice} + ^ +one error found diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala new file mode 100644 index 0000000000..e6aaeb9426 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.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 + +object Test extends App { + val x = 2 + val outer = reify{reify{x}} + val code = reify{outer.splice.splice} + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} \ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check new file mode 100644 index 0000000000..f703bfb05f --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check @@ -0,0 +1,7 @@ +reify_metalevel_breach_-1_refers_to_0_b.scala:12: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `.eval` instead. + }.splice + ^ +one error found diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala new file mode 100644 index 0000000000..16dcae8683 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.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 App { + val x = 2 + val code = reify{ + { + val inner = reify{reify{x}} + inner.splice + }.splice + } + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} \ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check new file mode 100644 index 0000000000..068e4accd2 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check @@ -0,0 +1,7 @@ +reify_metalevel_breach_-1_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `.eval` instead. + inner.splice.splice + ^ +one error found diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala new file mode 100644 index 0000000000..9600489f35 --- /dev/null +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.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 App { + val code = reify{ + val x = 2 + val inner = reify{reify{x}} + inner.splice.splice + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} \ No newline at end of file diff --git a/test/files/neg/reify_nested_inner_refers_to_local.check b/test/files/neg/reify_nested_inner_refers_to_local.check new file mode 100644 index 0000000000..3f897bded9 --- /dev/null +++ b/test/files/neg/reify_nested_inner_refers_to_local.check @@ -0,0 +1,7 @@ +reify_nested_inner_refers_to_local.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `.eval` instead. + reify{x}.splice + ^ +one error found diff --git a/test/files/neg/reify_nested_inner_refers_to_local.scala b/test/files/neg/reify_nested_inner_refers_to_local.scala new file mode 100644 index 0000000000..fcbc1f7865 --- /dev/null +++ b/test/files/neg/reify_nested_inner_refers_to_local.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 App { + val code = reify{ + val x = 2 + reify{x}.splice + }; + + val toolbox = cm.mkToolBox() + val evaluated = toolbox.runExpr(code.tree) + println("evaluated = " + evaluated) +} \ No newline at end of file diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check index e013daca74..349e4fe48a 100644 --- a/test/files/neg/t3692-new.check +++ b/test/files/neg/t3692-new.check @@ -1,4 +1,4 @@ -t3692-new.scala:15: error: unreachable code +t3692-new.scala:16: error: unreachable code case m2: Map[T, Int] => new java.util.HashMap[T, Integer] ^ one error found diff --git a/test/files/neg/t3692-new.scala b/test/files/neg/t3692-new.scala index 46874b02e3..cebdcea393 100644 --- a/test/files/neg/t3692-new.scala +++ b/test/files/neg/t3692-new.scala @@ -1,3 +1,4 @@ +import scala.reflect.{ClassTag, classTag} import java.lang.Integer object Tester { diff --git a/test/files/neg/t5334_1.check b/test/files/neg/t5334_1.check index 1d5a7cbc01..eca854964a 100644 --- a/test/files/neg/t5334_1.check +++ b/test/files/neg/t5334_1.check @@ -1,4 +1,4 @@ -t5334_1.scala:4: error: implementation restriction: cannot reify block of type C that involves a type declared inside the block being reified. consider casting the return value to a suitable type +t5334_1.scala:5: error: implementation restriction: cannot reify block of type C that involves a type declared inside the block being reified. consider casting the return value to a suitable type reify { ^ one error found diff --git a/test/files/neg/t5334_1.scala b/test/files/neg/t5334_1.scala index a7de5a0915..b75badb145 100644 --- a/test/files/neg/t5334_1.scala +++ b/test/files/neg/t5334_1.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { class C { override def toString = "C" } new C }.eval -} +} \ No newline at end of file diff --git a/test/files/neg/t5334_2.check b/test/files/neg/t5334_2.check index a62bfff7a5..e21f0d5967 100644 --- a/test/files/neg/t5334_2.check +++ b/test/files/neg/t5334_2.check @@ -1,4 +1,4 @@ -t5334_2.scala:4: error: implementation restriction: cannot reify block of type List[(C, C)] that involves a type declared inside the block being reified. consider casting the return value to a suitable type +t5334_2.scala:5: error: implementation restriction: cannot reify block of type List[(C, C)] that involves a type declared inside the block being reified. consider casting the return value to a suitable type reify { ^ one error found diff --git a/test/files/neg/t5334_2.scala b/test/files/neg/t5334_2.scala index fc6dfcd0c1..e082e3b8e3 100644 --- a/test/files/neg/t5334_2.scala +++ b/test/files/neg/t5334_2.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { class C { override def toString() = "C" } List((new C, new C)) }.eval -} +} \ No newline at end of file diff --git a/test/files/neg/t5452-new.check b/test/files/neg/t5452-new.check index bbd3734f74..4bbeff3644 100644 --- a/test/files/neg/t5452-new.check +++ b/test/files/neg/t5452-new.check @@ -1,7 +1,7 @@ -t5452-new.scala:28: error: overloaded method value apply with alternatives: +t5452-new.scala:30: error: overloaded method value apply with alternatives: ()Queryable[CoffeesTable] - (t: Tree)(implicit evidence$2: ClassTag[CoffeesTable])Nothing - (implicit evidence$1: ClassTag[CoffeesTable])Nothing + (t: Tree)(implicit evidence$2: scala.reflect.ClassTag[CoffeesTable])Nothing + (implicit evidence$1: scala.reflect.ClassTag[CoffeesTable])Nothing cannot be applied to (Queryable[CoffeesTable]) Queryable[CoffeesTable]( q.treeFilter(null) ) ^ diff --git a/test/files/neg/t5452-new.scala b/test/files/neg/t5452-new.scala index c829de7d7c..b74b1550bd 100644 --- a/test/files/neg/t5452-new.scala +++ b/test/files/neg/t5452-new.scala @@ -1,7 +1,9 @@ +import scala.reflect.{ClassTag, classTag} + // /scala/trac/5452/a.scala // Mon Feb 13 22:52:36 PST 2012 -// import scala.reflect.mirror._ +// import scala.reflect.runtime.universe._ trait Tree @@ -26,4 +28,4 @@ trait CoffeesTable{ object Test extends App{ val q = new Queryable[CoffeesTable] Queryable[CoffeesTable]( q.treeFilter(null) ) -} +} \ No newline at end of file diff --git a/test/files/neg/t5452-old.scala b/test/files/neg/t5452-old.scala index 1032db7a4b..4f6dcbbe46 100644 --- a/test/files/neg/t5452-old.scala +++ b/test/files/neg/t5452-old.scala @@ -1,7 +1,7 @@ // /scala/trac/5452/a.scala // Mon Feb 13 22:52:36 PST 2012 -// import scala.reflect.mirror._ +// import scala.reflect.runtime.universe._ trait Tree diff --git a/test/files/pos/contextbounds-implicits-new.scala b/test/files/pos/contextbounds-implicits-new.scala index 71b3cca36f..327c4a98dc 100644 --- a/test/files/pos/contextbounds-implicits-new.scala +++ b/test/files/pos/contextbounds-implicits-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + /* Tests implicit parameters in the presence of context bounds. * See Section 7.4 of the Scala Language Specification. */ @@ -5,4 +7,4 @@ class C { def f[T: TypeTag, S: TypeTag](x: T, y: S)(implicit p: C) { } -} +} \ No newline at end of file diff --git a/test/files/pos/implicits-new.scala b/test/files/pos/implicits-new.scala index 7eb7e100c3..0afbda1c3c 100644 --- a/test/files/pos/implicits-new.scala +++ b/test/files/pos/implicits-new.scala @@ -1,3 +1,6 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ArrayTag, arrayTag} + // #1435 object t1435 { implicit def a(s:String):String = error("") @@ -86,4 +89,4 @@ package foo2709 { // Problem with specs object specsProblem { println(implicitly[ConcreteTypeTag[Class[_]]]) -} +} \ No newline at end of file diff --git a/test/files/pos/liftcode_polymorphic.scala b/test/files/pos/liftcode_polymorphic.scala index 9c59b34bee..8f537d278a 100644 --- a/test/files/pos/liftcode_polymorphic.scala +++ b/test/files/pos/liftcode_polymorphic.scala @@ -1,13 +1,12 @@ -import scala.reflect.mirror._ - -object Append extends Application { - - 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) -} - +import scala.reflect.runtime.universe._ + +object Append extends Application { + + 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/test/files/pos/manifest1-new.scala b/test/files/pos/manifest1-new.scala index 645bd42665..3907d7854b 100644 --- a/test/files/pos/manifest1-new.scala +++ b/test/files/pos/manifest1-new.scala @@ -1,4 +1,4 @@ -import scala.reflect.TypeTag +import scala.reflect.runtime.universe._ object Test { def foo[T](x: T)(implicit m: TypeTag[T]) { @@ -18,4 +18,4 @@ object Test { val d: D = new D { type T = String; val m = stringm; val x = "x" } import d.m foo(d.x) -} +} \ No newline at end of file diff --git a/test/files/pos/nothing_manifest_disambig-new.scala b/test/files/pos/nothing_manifest_disambig-new.scala index a60b0fdbf8..ed3a9e8fb1 100644 --- a/test/files/pos/nothing_manifest_disambig-new.scala +++ b/test/files/pos/nothing_manifest_disambig-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { def mani[T: TypeTag](xs: T) = xs mani(List()) diff --git a/test/files/pos/spec-constr-new.scala b/test/files/pos/spec-constr-new.scala index 7cd02b0680..a117e99fef 100644 --- a/test/files/pos/spec-constr-new.scala +++ b/test/files/pos/spec-constr-new.scala @@ -1,7 +1,9 @@ +import scala.reflect.{ArrayTag, arrayTag} + class SparseArray2[@specialized(Int) T:ArrayTag](val maxSize: Int, initialLength:Int = 3) { private var data = new Array[T](initialLength); private var index = new Array[Int](initialLength); // comment out to compile correctly data.length + 3; -} +} \ No newline at end of file diff --git a/test/files/pos/spec-doubledef-new.scala b/test/files/pos/spec-doubledef-new.scala index 33f1e82b6e..ad9c6399a5 100644 --- a/test/files/pos/spec-doubledef-new.scala +++ b/test/files/pos/spec-doubledef-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { def fn[@specialized T, @specialized U](t : T => Int, u : U => Int) : T = null.asInstanceOf[T] @@ -25,4 +27,4 @@ abstract class B[T, @specialized(scala.Int) U : TypeTag, @specialized(scala.Int) Pair(u, v2) } } -} +} \ No newline at end of file diff --git a/test/files/pos/spec-fields-new.scala b/test/files/pos/spec-fields-new.scala index ddd8bd6624..54bbe27893 100644 --- a/test/files/pos/spec-fields-new.scala +++ b/test/files/pos/spec-fields-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + abstract class Foo[@specialized T: ArrayTag, U <: Ordered[U]](x: T, size: Int) { var y: T var z: T = x @@ -7,4 +9,4 @@ abstract class Foo[@specialized T: ArrayTag, U <: Ordered[U]](x: T, size: Int) { def getZ = z def setZ(zz: T) = z = zz -} +} \ No newline at end of file diff --git a/test/files/pos/spec-params-new.scala b/test/files/pos/spec-params-new.scala index 5fe0c82d40..bf89f3920a 100644 --- a/test/files/pos/spec-params-new.scala +++ b/test/files/pos/spec-params-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + class Foo[@specialized A: ArrayTag] { // conflicting in bounds, expect a normalized member calling m @@ -29,4 +31,4 @@ class Foo[@specialized A: ArrayTag] { val xs = new Array[A](1) xs(0) = x } -} +} \ No newline at end of file diff --git a/test/files/pos/spec-sparsearray-new.scala b/test/files/pos/spec-sparsearray-new.scala index 0659bf7926..99156d677b 100644 --- a/test/files/pos/spec-sparsearray-new.scala +++ b/test/files/pos/spec-sparsearray-new.scala @@ -1,3 +1,4 @@ +import scala.reflect.{ArrayTag, arrayTag} import scala.collection.mutable.MapLike class SparseArray[@specialized(Int) T:ArrayTag] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { @@ -21,4 +22,4 @@ class SparseArray[@specialized(Int) T:ArrayTag] extends collection.mutable.Map[I def -=(ind: Int) = error("ignore") def +=(kv: (Int,T)) = error("ignore") override final def iterator = error("ignore") -} +} \ No newline at end of file diff --git a/test/files/pos/t1381-new.scala b/test/files/pos/t1381-new.scala index 8781ef4fdb..57e0f31fba 100644 --- a/test/files/pos/t1381-new.scala +++ b/test/files/pos/t1381-new.scala @@ -1,4 +1,4 @@ -import scala.reflect.TypeTag +import scala.reflect.runtime.universe._ class D[V <: Variable] @@ -28,4 +28,4 @@ abstract class EV[T](initval:T) extends PV[T](initval) with IV { override def d : ID[VT] = null // Comment this out to eliminate crash protected var indx = d.index(initval) -} +} \ No newline at end of file diff --git a/test/files/pos/t2795-new.scala b/test/files/pos/t2795-new.scala index af9c4e8b1c..67c34ec263 100644 --- a/test/files/pos/t2795-new.scala +++ b/test/files/pos/t2795-new.scala @@ -1,5 +1,7 @@ package t1 +import scala.reflect.{ArrayTag, arrayTag} + trait Element[T] { } @@ -14,4 +16,4 @@ trait Transform { self: Config => def processBlock(block: Array[T]): Unit = { var X = new Array[T](1) } -} +} \ No newline at end of file diff --git a/test/files/pos/t3363-new.scala b/test/files/pos/t3363-new.scala index 270462745c..e609f4d55f 100644 --- a/test/files/pos/t3363-new.scala +++ b/test/files/pos/t3363-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object TestCase { //now matter if you put (abstract) class or trait it will fail in all cases @@ -15,4 +17,4 @@ object TestCase { println(Map(1 -> "2") is List(2)) } - } + } \ No newline at end of file diff --git a/test/files/pos/t3498-new.scala b/test/files/pos/t3498-new.scala index 653c50042a..7388e53e3e 100644 --- a/test/files/pos/t3498-new.scala +++ b/test/files/pos/t3498-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + abstract class A[T, @specialized(scala.Int) U : ArrayTag] { def f(state: T): Array[U] } diff --git a/test/files/pos/t5223.scala b/test/files/pos/t5223.scala index 398630dc61..0b2528e367 100644 --- a/test/files/pos/t5223.scala +++ b/test/files/pos/t5223.scala @@ -1,6 +1,6 @@ -import scala.reflect.mirror._ +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": @cloneable)} -} +} \ No newline at end of file diff --git a/test/files/pos/t5305.scala b/test/files/pos/t5305.scala index 4c32cd7c6d..c0237ca3bd 100644 --- a/test/files/pos/t5305.scala +++ b/test/files/pos/t5305.scala @@ -7,7 +7,7 @@ object t5305 { } in { - import O.{F, v} + import O.{F, v} type x = {type l = (F, v.type)} // not found: type F } } diff --git a/test/files/pos/t531.scala b/test/files/pos/t531.scala index 5176912ef0..d53539f34f 100644 --- a/test/files/pos/t531.scala +++ b/test/files/pos/t531.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def titi = { @@ -8,4 +8,4 @@ object Test extends App { }} () } -} +} \ No newline at end of file diff --git a/test/files/pos/t532.scala b/test/files/pos/t532.scala index a319fdfa27..7c33637b5d 100644 --- a/test/files/pos/t532.scala +++ b/test/files/pos/t532.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def titi: Unit = { @@ -8,4 +8,4 @@ object Test extends App { }} () } -} +} \ No newline at end of file diff --git a/test/files/pos/t5769.scala b/test/files/pos/t5769.scala index 723d37bfee..523fe08a60 100644 --- a/test/files/pos/t5769.scala +++ b/test/files/pos/t5769.scala @@ -1,4 +1,5 @@ // a.scala +import scala.reflect.{ArrayTag, arrayTag} class A { type AI = Array[Int] diff --git a/test/files/pos/t5809.scala b/test/files/pos/t5809.scala index 8f6ce708d2..133e13c4ed 100644 --- a/test/files/pos/t5809.scala +++ b/test/files/pos/t5809.scala @@ -1,10 +1,5 @@ -package scala.reflect - -package object api { - implicit class PimpedExpr[T](expr: Universe # Expr[T]) { - def runtimeEval: T = { - println("hello, dear") - expr.eval - } +package object foo { + implicit class PimpedInt(foo: Int) { + def bar = ??? } } \ No newline at end of file diff --git a/test/files/pos/typetags.scala b/test/files/pos/typetags.scala new file mode 100644 index 0000000000..33390d7b89 --- /dev/null +++ b/test/files/pos/typetags.scala @@ -0,0 +1,12 @@ +import scala.reflect.{basis => rb} +import scala.reflect.runtime.{universe => ru} + +object Test { + def main(args: Array[String]) { + def foo(implicit t: rb.TypeTag[List[Int]]) { + println(t) + val t2: ru.TypeTag[_] = t in ru.rootMirror + println(t2) + } + } +} diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index dcbd440801..14ae7ab04a 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -97,7 +97,7 @@ retrieved 124 members [accessible: true] `method synchronized[T0](x$1: T0)T0` [accessible: true] `method take(n: Int)Iterator[B]` [accessible: true] `method takeWhile(p: B => Boolean)Iterator[B]` -[accessible: true] `method toArray[B >: B](implicit evidence$1: ArrayTag[B])Array[B]` +[accessible: true] `method toArray[B >: B](implicit evidence$1: scala.reflect.ArrayTag[B])Array[B]` [accessible: true] `method toBuffer[B >: B]=> scala.collection.mutable.Buffer[B]` [accessible: true] `method toIndexedSeq=> scala.collection.immutable.IndexedSeq[B]` [accessible: true] `method toIterable=> Iterable[B]` diff --git a/test/files/presentation/memory-leaks/MemoryLeaksTest.scala b/test/files/presentation/memory-leaks/MemoryLeaksTest.scala index 45b38da85b..6e2c0a6c43 100644 --- a/test/files/presentation/memory-leaks/MemoryLeaksTest.scala +++ b/test/files/presentation/memory-leaks/MemoryLeaksTest.scala @@ -7,16 +7,16 @@ import scala.tools.nsc.util._ import scala.tools.nsc.io._ /** This test runs the presentation compiler on the Scala compiler project itself and records memory consumption. - * + * * The test scenario is to open Typers, Trees and Types, then repeatedly add and remove one character * in Typers.scala. Each step causes the parser, namer, and type checker to run. - * - * At each step we record the memory usage after the GC has run. At the end of the test, + * + * At each step we record the memory usage after the GC has run. At the end of the test, * simple linear regression is used to compute the straight line that best fits the * curve, and if the slope is higher than 1 (meaning a leak of 1MB/run), we fail the test. - * + * * The Scala compiler sources are assumed to be under 'basedir/src/compiler'. - * + * * The individual data points are saved under 'usedMem-.txt', under the test project * directory. Use the cool graph-it.R (https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core.tests/graph-it.R) * script to see the memory curve for the given test run. @@ -40,7 +40,7 @@ object Test extends InteractiveTest { val typesUnit = AbstractFile.getFile(baseDir.parent.parent.parent.parent / "src/compiler/scala/reflect/internal/Types.scala") val treesUnit = AbstractFile.getFile(baseDir.parent.parent.parent.parent / "src/compiler/scala/reflect/internal/Trees.scala") - askReload(Seq(new BatchSourceFile(typerUnit), new BatchSourceFile(typesUnit), new BatchSourceFile(treesUnit))) + askReload(Seq(new BatchSourceFile(typerUnit), new BatchSourceFile(typesUnit), new BatchSourceFile(treesUnit))) typeCheckWith(treesUnit, new String(treesUnit.toCharArray)) typeCheckWith(typesUnit, new String(typesUnit.toCharArray)) @@ -58,12 +58,12 @@ object Test extends InteractiveTest { usedMem / mega // report size in MB } - + //dumpDataToFile(filename, usedMem) // drop the first two measurements, since the compiler needs some memory when initializing val (a, b) = linearModel((3L to N).toSeq, usedMem.drop(2)) //println("LinearModel: constant: %.4f\tslope:%.4f".format(a, b)) - + if (b > 1.0) println("Rate of memory consumption is alarming! %.4f MB/run".format(b)) else @@ -84,33 +84,33 @@ object Test extends InteractiveTest { } outputFile.close() } - - - /** Return the linear model of these values, (a, b). First value is the constant factor, + + + /** Return the linear model of these values, (a, b). First value is the constant factor, * second value is the slope, i.e. `y = a + bx` - * - * The linear model of a set of points is a straight line that minimizes the square distance + * + * The linear model of a set of points is a straight line that minimizes the square distance * between the each point and the line. - * + * * See: http://en.wikipedia.org/wiki/Simple_linear_regression */ def linearModel(xs: Seq[Long], ys: Seq[Long]): (Double, Double) = { require(xs.length == ys.length) - + def mean(v: Seq[Long]): Double = v.sum.toDouble / v.length - + val meanXs = mean(xs) val meanYs = mean(ys) - + val beta = (mean((xs, ys).zipped.map(_ * _)) - meanXs * meanYs) / (mean(xs.map(x => x * x)) - meanXs * meanXs) val alfa = meanYs - beta * meanXs - + (alfa, beta) } /** Run the given closure and return the amount of used memory at the end of its execution. - * - * Runs the GC before and after the execution of `f'. + * + * Runs the GC before and after the execution of `f'. */ def withGC(f: => Unit): Long = { val r = Runtime.getRuntime diff --git a/test/files/run/arrayclone-new.scala b/test/files/run/arrayclone-new.scala index a4ba021409..a8fb9ee58c 100644 --- a/test/files/run/arrayclone-new.scala +++ b/test/files/run/arrayclone-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App{ BooleanArrayClone; ByteArrayClone; @@ -103,4 +105,4 @@ object PolymorphicArrayClone{ val y : Array[Int] = mangled.it; // make sure it's unboxed testIt(mangled.it, 0, 1); -} +} \ No newline at end of file diff --git a/test/files/run/arraytags_basic.scala b/test/files/run/arraytags_basic.scala index edc20e9bc1..629ee26192 100644 --- a/test/files/run/arraytags_basic.scala +++ b/test/files/run/arraytags_basic.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App { def test[T: ArrayTag] = { println(implicitly[ArrayTag[T]].newArray(10).getClass) diff --git a/test/files/run/arraytags_core.scala b/test/files/run/arraytags_core.scala index a59ae24f30..58b9094230 100644 --- a/test/files/run/arraytags_core.scala +++ b/test/files/run/arraytags_core.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App { println(implicitly[ArrayTag[Byte]].newArray(10).getClass) println(implicitly[ArrayTag[Byte]].wrap.newArray(10).getClass) diff --git a/test/files/run/arraytags_usage.scala b/test/files/run/arraytags_usage.scala index 60b0a8f218..507e91987b 100644 --- a/test/files/run/arraytags_usage.scala +++ b/test/files/run/arraytags_usage.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App { def foo[T] = { class MyArrayTag extends ArrayTag[T] { diff --git a/test/files/run/classtags_contextbound.scala b/test/files/run/classtags_contextbound.scala index 5bb0ae8d80..2f12792154 100644 --- a/test/files/run/classtags_contextbound.scala +++ b/test/files/run/classtags_contextbound.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { def mkArray[T: ClassTag] = Array[T]() def foo[T: ClassTag] = mkArray[T] diff --git a/test/files/run/classtags_core.check b/test/files/run/classtags_core.check index ebccfcd54c..7beada3f1c 100644 --- a/test/files/run/classtags_core.check +++ b/test/files/run/classtags_core.check @@ -1,32 +1,28 @@ -true -ClassTag[byte] -true -ClassTag[short] -true -ClassTag[char] -true -ClassTag[int] -true -ClassTag[long] -true -ClassTag[float] -true -ClassTag[double] -true -ClassTag[boolean] -true -ClassTag[void] -true -ClassTag[class java.lang.Object] -true -ClassTag[class java.lang.Object] -true -ClassTag[class java.lang.Object] -true -ClassTag[class java.lang.Object] -true -ClassTag[class scala.runtime.Null$] -true -ClassTag[class scala.runtime.Nothing$] -true -ClassTag[class java.lang.String] +true +ClassTag[byte] +true +ClassTag[short] +true +ClassTag[char] +true +ClassTag[int] +true +ClassTag[long] +true +ClassTag[float] +true +ClassTag[double] +true +ClassTag[boolean] +true +ClassTag[void] +true +ClassTag[class java.lang.Object] +true +ClassTag[class java.lang.Object] +true +ClassTag[class scala.runtime.Null$] +true +ClassTag[class scala.runtime.Nothing$] +true +ClassTag[class java.lang.String] diff --git a/test/files/run/classtags_core.scala b/test/files/run/classtags_core.scala index 9f2031377d..17c69d9c41 100644 --- a/test/files/run/classtags_core.scala +++ b/test/files/run/classtags_core.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { println(implicitly[ClassTag[Byte]] eq ClassTag.Byte) println(implicitly[ClassTag[Byte]]) @@ -21,10 +23,6 @@ object Test extends App { println(implicitly[ClassTag[Any]]) println(implicitly[ClassTag[Object]] eq ClassTag.Object) println(implicitly[ClassTag[Object]]) - println(implicitly[ClassTag[AnyVal]] eq ClassTag.AnyVal) - println(implicitly[ClassTag[AnyVal]]) - println(implicitly[ClassTag[AnyRef]] eq ClassTag.AnyRef) - println(implicitly[ClassTag[AnyRef]]) println(implicitly[ClassTag[Null]] eq ClassTag.Null) println(implicitly[ClassTag[Null]]) println(implicitly[ClassTag[Nothing]] eq ClassTag.Nothing) diff --git a/test/files/run/classtags_multi.scala b/test/files/run/classtags_multi.scala index 5aafb55223..b4b47bcf0e 100644 --- a/test/files/run/classtags_multi.scala +++ b/test/files/run/classtags_multi.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + object Test extends App { println(classTag[Int]) println(classTag[Array[Int]]) diff --git a/test/files/run/classtags_use_concretetypetags.scala b/test/files/run/classtags_use_concretetypetags.scala deleted file mode 100644 index 57e7085cec..0000000000 --- a/test/files/run/classtags_use_concretetypetags.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - def foo[T: ConcreteTypeTag] = Array[T]() -} \ No newline at end of file diff --git a/test/files/run/concretetypetags_core.check b/test/files/run/concretetypetags_core.check index f124aa6a35..e5308bf9c7 100644 --- a/test/files/run/concretetypetags_core.check +++ b/test/files/run/concretetypetags_core.check @@ -1,32 +1,28 @@ -true -ConcreteTypeTag[Byte] -true -ConcreteTypeTag[Short] -true -ConcreteTypeTag[Char] -true -ConcreteTypeTag[Int] -true -ConcreteTypeTag[Long] -true -ConcreteTypeTag[Float] -true -ConcreteTypeTag[Double] -true -ConcreteTypeTag[Boolean] -true -ConcreteTypeTag[Unit] -true -ConcreteTypeTag[Any] -true -ConcreteTypeTag[Object] -true -ConcreteTypeTag[AnyVal] -true -ConcreteTypeTag[AnyRef] -true -ConcreteTypeTag[Null] -true -ConcreteTypeTag[Nothing] -true -ConcreteTypeTag[String] +true +ConcreteTypeTag[Byte] +true +ConcreteTypeTag[Short] +true +ConcreteTypeTag[Char] +true +ConcreteTypeTag[Int] +true +ConcreteTypeTag[Long] +true +ConcreteTypeTag[Float] +true +ConcreteTypeTag[Double] +true +ConcreteTypeTag[Boolean] +true +ConcreteTypeTag[Unit] +true +ConcreteTypeTag[Any] +true +ConcreteTypeTag[java.lang.Object] +true +ConcreteTypeTag[Null] +true +ConcreteTypeTag[Nothing] +true +ConcreteTypeTag[java.lang.String] diff --git a/test/files/run/concretetypetags_core.scala b/test/files/run/concretetypetags_core.scala index b6cfea3895..ea7060ec6c 100644 --- a/test/files/run/concretetypetags_core.scala +++ b/test/files/run/concretetypetags_core.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { println(implicitly[ConcreteTypeTag[Byte]] eq ConcreteTypeTag.Byte) println(implicitly[ConcreteTypeTag[Byte]]) @@ -21,10 +23,6 @@ object Test extends App { println(implicitly[ConcreteTypeTag[Any]]) println(implicitly[ConcreteTypeTag[Object]] eq ConcreteTypeTag.Object) println(implicitly[ConcreteTypeTag[Object]]) - println(implicitly[ConcreteTypeTag[AnyVal]] eq ConcreteTypeTag.AnyVal) - println(implicitly[ConcreteTypeTag[AnyVal]]) - println(implicitly[ConcreteTypeTag[AnyRef]] eq ConcreteTypeTag.AnyRef) - println(implicitly[ConcreteTypeTag[AnyRef]]) println(implicitly[ConcreteTypeTag[Null]] eq ConcreteTypeTag.Null) println(implicitly[ConcreteTypeTag[Null]]) println(implicitly[ConcreteTypeTag[Nothing]] eq ConcreteTypeTag.Nothing) diff --git a/test/files/run/concretetypetags_multi.scala b/test/files/run/concretetypetags_multi.scala index 7e19d7db34..0b5d648877 100644 --- a/test/files/run/concretetypetags_multi.scala +++ b/test/files/run/concretetypetags_multi.scala @@ -1,7 +1,9 @@ +import scala.reflect.runtime.universe._ + object Test extends App { - println(concreteTypeTag[Int]) - println(concreteTypeTag[Array[Int]]) - println(concreteTypeTag[Array[Array[Int]]]) - println(concreteTypeTag[Array[Array[Array[Int]]]]) - println(concreteTypeTag[Array[Array[Array[Array[Int]]]]]) + println(implicitly[ConcreteTypeTag[Int]]) + println(implicitly[ConcreteTypeTag[Array[Int]]]) + println(implicitly[ConcreteTypeTag[Array[Array[Int]]]]) + println(implicitly[ConcreteTypeTag[Array[Array[Array[Int]]]]]) + println(implicitly[ConcreteTypeTag[Array[Array[Array[Array[Int]]]]]]) } \ No newline at end of file diff --git a/test/files/run/ctries-new/main.scala b/test/files/run/ctries-new/main.scala index 1d40dab6c5..d7fe087e4d 100644 --- a/test/files/run/ctries-new/main.scala +++ b/test/files/run/ctries-new/main.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + @@ -35,11 +37,11 @@ trait Spec { var produced = false try body catch { - case e => if (e.getClass == implicitly[ClassTag[T]].erasure) produced = true + case e => if (e.getClass == implicitly[ClassTag[T]].runtimeClass) produced = true } finally { assert(produced, "Did not produce exception of type: " + implicitly[ClassTag[T]]) } } } -} +} \ No newline at end of file diff --git a/test/files/run/ctries-old/main.scala b/test/files/run/ctries-old/main.scala index 8db7fcef54..78ba7f0db1 100644 --- a/test/files/run/ctries-old/main.scala +++ b/test/files/run/ctries-old/main.scala @@ -6,30 +6,30 @@ object Test { - + def main(args: Array[String]) { ConcurrentMapSpec.test() IteratorSpec.test() LNodeSpec.test() SnapshotSpec.test() } - + } trait Spec { - + implicit def str2ops(s: String) = new { def in[U](body: =>U) { // just execute body body } } - + implicit def any2ops(a: Any) = new { def shouldEqual(other: Any) = assert(a == other) } - + def evaluating[U](body: =>U) = new { def shouldProduce[T <: Throwable: ClassManifest]() = { var produced = false @@ -41,5 +41,5 @@ trait Spec { } } } - + } diff --git a/test/files/run/erasuretags_abstract.check b/test/files/run/erasuretags_abstract.check deleted file mode 100644 index 17e7204664..0000000000 --- a/test/files/run/erasuretags_abstract.check +++ /dev/null @@ -1,4 +0,0 @@ -class java.lang.Object -class java.lang.Object -class java.lang.Object -int diff --git a/test/files/run/erasuretags_abstract.scala b/test/files/run/erasuretags_abstract.scala deleted file mode 100644 index 8e4ad0d090..0000000000 --- a/test/files/run/erasuretags_abstract.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def foo1[T] = erasureTag[T] - println(foo1[Int].erasure) - println(foo1[String].erasure) - println(foo1[Array[Int]].erasure) - - def foo2[T <: Int] = erasureTag[T] - println(foo2[Int].erasure) -} \ No newline at end of file diff --git a/test/files/run/erasuretags_basic.check b/test/files/run/erasuretags_basic.check deleted file mode 100644 index c02a4d32af..0000000000 --- a/test/files/run/erasuretags_basic.check +++ /dev/null @@ -1,24 +0,0 @@ -int -class [I -class scala.collection.immutable.List -class [Lscala.collection.immutable.List; -class scala.collection.immutable.List -class [Lscala.collection.immutable.List; -interface scala.collection.immutable.Map -class [Lscala.collection.immutable.Map; -class [I -class [[I -class [Lscala.collection.immutable.List; -class [[Lscala.collection.immutable.List; -class [Lscala.collection.immutable.List; -class [[Lscala.collection.immutable.List; -class [Lscala.collection.immutable.Map; -class [[Lscala.collection.immutable.Map; -class [[I -class [[[I -class [[Lscala.collection.immutable.List; -class [[[Lscala.collection.immutable.List; -class [[Lscala.collection.immutable.List; -class [[[Lscala.collection.immutable.List; -class [[Lscala.collection.immutable.Map; -class [[[Lscala.collection.immutable.Map; diff --git a/test/files/run/erasuretags_basic.scala b/test/files/run/erasuretags_basic.scala deleted file mode 100644 index d894fdf2e9..0000000000 --- a/test/files/run/erasuretags_basic.scala +++ /dev/null @@ -1,21 +0,0 @@ -object Test extends App { - def test[T: ErasureTag] = { - println(implicitly[ErasureTag[T]].erasure) - println(implicitly[ErasureTag[Array[T]]].erasure) - } - - test[Int] - test[List[Int]] - test[List[String]] - test[Map[Int, String]] - - test[Array[Int]] - test[Array[List[Int]]] - test[Array[List[String]]] - test[Array[Map[Int, String]]] - - test[Array[Array[Int]]] - test[Array[Array[List[Int]]]] - test[Array[Array[List[String]]]] - test[Array[Array[Map[Int, String]]]] -} \ No newline at end of file diff --git a/test/files/run/erasuretags_core.check b/test/files/run/erasuretags_core.check deleted file mode 100644 index 2c544678d1..0000000000 --- a/test/files/run/erasuretags_core.check +++ /dev/null @@ -1,32 +0,0 @@ -byte -class [B -short -class [S -char -class [C -int -class [I -long -class [J -float -class [F -double -class [D -boolean -class [Z -void -class [Lscala.runtime.BoxedUnit; -class java.lang.Object -class [Ljava.lang.Object; -class java.lang.Object -class [Ljava.lang.Object; -class java.lang.Object -class [Ljava.lang.Object; -class java.lang.Object -class [Ljava.lang.Object; -class scala.runtime.Null$ -class [Lscala.runtime.Null$; -class scala.runtime.Nothing$ -class [Lscala.runtime.Nothing$; -class java.lang.String -class [Ljava.lang.String; diff --git a/test/files/run/erasuretags_core.scala b/test/files/run/erasuretags_core.scala deleted file mode 100644 index 5ed06dcd31..0000000000 --- a/test/files/run/erasuretags_core.scala +++ /dev/null @@ -1,34 +0,0 @@ -object Test extends App { - println(implicitly[ErasureTag[Byte]].erasure) - println(implicitly[ErasureTag[Array[Byte]]].erasure) - println(implicitly[ErasureTag[Short]].erasure) - println(implicitly[ErasureTag[Array[Short]]].erasure) - println(implicitly[ErasureTag[Char]].erasure) - println(implicitly[ErasureTag[Array[Char]]].erasure) - println(implicitly[ErasureTag[Int]].erasure) - println(implicitly[ErasureTag[Array[Int]]].erasure) - println(implicitly[ErasureTag[Long]].erasure) - println(implicitly[ErasureTag[Array[Long]]].erasure) - println(implicitly[ErasureTag[Float]].erasure) - println(implicitly[ErasureTag[Array[Float]]].erasure) - println(implicitly[ErasureTag[Double]].erasure) - println(implicitly[ErasureTag[Array[Double]]].erasure) - println(implicitly[ErasureTag[Boolean]].erasure) - println(implicitly[ErasureTag[Array[Boolean]]].erasure) - println(implicitly[ErasureTag[Unit]].erasure) - println(implicitly[ErasureTag[Array[Unit]]].erasure) - println(implicitly[ErasureTag[Any]].erasure) - println(implicitly[ErasureTag[Array[Any]]].erasure) - println(implicitly[ErasureTag[Object]].erasure) - println(implicitly[ErasureTag[Array[Object]]].erasure) - println(implicitly[ErasureTag[AnyVal]].erasure) - println(implicitly[ErasureTag[Array[AnyVal]]].erasure) - println(implicitly[ErasureTag[AnyRef]].erasure) - println(implicitly[ErasureTag[Array[AnyRef]]].erasure) - println(implicitly[ErasureTag[Null]].erasure) - println(implicitly[ErasureTag[Array[Null]]].erasure) - println(implicitly[ErasureTag[Nothing]].erasure) - println(implicitly[ErasureTag[Array[Nothing]]].erasure) - println(implicitly[ErasureTag[String]].erasure) - println(implicitly[ErasureTag[Array[String]]].erasure) -} \ No newline at end of file diff --git a/test/files/run/erasuretags_usage.scala b/test/files/run/erasuretags_usage.scala deleted file mode 100644 index 16e53af071..0000000000 --- a/test/files/run/erasuretags_usage.scala +++ /dev/null @@ -1,12 +0,0 @@ -object Test extends App { - def foo[T] = { - class MyErasureTag(_erasure: Class[_]) extends ErasureTag[T] { - def erasure: Class[T] = _erasure.asInstanceOf[Class[T]] - } - - implicit val tag = new MyErasureTag(classOf[Int]) - println(typeTag[T]) - println(typeTag[T].tpe) - println(typeTag[T].erasure) - } -} \ No newline at end of file diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala index 8c04e4782c..1f314aa4e0 100644 --- a/test/files/run/existentials-in-compiler.scala +++ b/test/files/run/existentials-in-compiler.scala @@ -4,6 +4,7 @@ import scala.collection.{ mutable, immutable, generic } object Test extends CompilerTest { import global._ + import rootMirror._ import definitions._ override def code = """ @@ -21,7 +22,7 @@ package extest { trait Cov07[-A <: AnyRef, +B] { } trait Cov08[-A <: AnyRef, B] { } trait Cov09[-A <: AnyRef, -B] { } - + trait Cov11[+A <: AnyRef, +B <: List[_]] { } trait Cov12[+A <: AnyRef, B <: List[_]] { } trait Cov13[+A <: AnyRef, -B <: List[_]] { } @@ -31,7 +32,7 @@ package extest { trait Cov17[-A <: AnyRef, +B <: List[_]] { } trait Cov18[-A <: AnyRef, B <: List[_]] { } trait Cov19[-A <: AnyRef, -B <: List[_]] { } - + trait Cov21[+A, +B] { } trait Cov22[+A, B] { } trait Cov23[+A, -B] { } @@ -41,7 +42,7 @@ package extest { trait Cov27[-A, +B] { } trait Cov28[-A, B] { } trait Cov29[-A, -B] { } - + trait Cov31[+A, +B, C <: ((A, B))] { } trait Cov32[+A, B, C <: ((A, B))] { } trait Cov33[+A, -B, C <: ((A, _))] { } @@ -51,7 +52,7 @@ package extest { trait Cov37[-A, +B, C <: ((_, B))] { } trait Cov38[-A, B, C <: ((_, B))] { } trait Cov39[-A, -B, C <: ((_, _))] { } - + trait Cov41[+A >: Null, +B] { } trait Cov42[+A >: Null, B] { } trait Cov43[+A >: Null, -B] { } diff --git a/test/files/run/existentials3-new.check b/test/files/run/existentials3-new.check index 66674fbbd6..0d6f694a68 100644 --- a/test/files/run/existentials3-new.check +++ b/test/files/run/existentials3-new.check @@ -1,24 +1,24 @@ -ConcreteTypeTag[Bar.type], t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton -ConcreteTypeTag[Bar], t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar} -ConcreteTypeTag[Test.ToS], t=RefinedType, s=f3 -ConcreteTypeTag[Test.ToS], t=RefinedType, s=f4 -ConcreteTypeTag[Test.ToS], t=RefinedType, s=f5 -ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 -ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 -ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with Test.ToS -ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with A with Test.ToS -TypeTag[List[Object{type T1}#T1]], t=TypeRef, s=class List -ConcreteTypeTag[List[Seq[Int]]], t=TypeRef, s=class List -ConcreteTypeTag[List[Seq[U forSome { type U <: Int }]]], t=TypeRef, s=class List -ConcreteTypeTag[Bar.type], t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton -ConcreteTypeTag[Bar], t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar} -ConcreteTypeTag[Test.ToS], t=RefinedType, s=g3 -ConcreteTypeTag[Test.ToS], t=RefinedType, s=g4 -ConcreteTypeTag[Test.ToS], t=RefinedType, s=g5 -ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 -ConcreteTypeTag[() => Test.ToS], t=TypeRef, s=class Function0 -ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with Test.ToS -ConcreteTypeTag[$anon], t=AbstractTypeRef, s= <: B with A with Test.ToS -TypeTag[List[Object{type T1}#T1]], t=TypeRef, s=class List -ConcreteTypeTag[List[Seq[Int]]], t=TypeRef, s=class List -ConcreteTypeTag[List[Seq[U forSome { type U <: Int }]]], t=TypeRef, s=class List +Bar.type, t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton +Bar, t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar} +Test.ToS, t=RefinedType, s=f3 +Test.ToS, t=RefinedType, s=f4 +Test.ToS, t=RefinedType, s=f5 +() => Test.ToS, t=TypeRef, s=class Function0 +() => Test.ToS, t=TypeRef, s=class Function0 +$anon, t=AbstractTypeRef, s= <: B with Test.ToS +$anon, t=AbstractTypeRef, s= <: B with A with Test.ToS +List[java.lang.Object{type T1}#T1], t=TypeRef, s=class List +List[Seq[Int]], t=TypeRef, s=class List +List[Seq[U forSome { type U <: Int }]], t=TypeRef, s=class List +Bar.type, t=AbstractTypeRef, s= <: scala.runtime.AbstractFunction0[Bar] with Serializable{case def unapply(x$0: Bar): Boolean} with Singleton +Bar, t=AbstractTypeRef, s= <: Test.ToS with Product with Serializable{def copy(): Bar} +Test.ToS, t=RefinedType, s=g3 +Test.ToS, t=RefinedType, s=g4 +Test.ToS, t=RefinedType, s=g5 +() => Test.ToS, t=TypeRef, s=class Function0 +() => Test.ToS, t=TypeRef, s=class Function0 +$anon, t=AbstractTypeRef, s= <: B with Test.ToS +$anon, t=AbstractTypeRef, s= <: B with A with Test.ToS +List[java.lang.Object{type T1}#T1], t=TypeRef, s=class List +List[Seq[Int]], t=TypeRef, s=class List +List[Seq[U forSome { type U <: Int }]], t=TypeRef, s=class List diff --git a/test/files/run/existentials3-new.scala b/test/files/run/existentials3-new.scala index 32129a04c6..5e1490b778 100644 --- a/test/files/run/existentials3-new.scala +++ b/test/files/run/existentials3-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { trait ToS { final override def toString = getClass.getName } @@ -31,12 +33,12 @@ object Test { val g11 = { abstract class A extends Seq[Int] ; List[A]() } val g12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } - def printTag(t: TypeTag[_]) = { - val s = if (t.sym.isFreeType) t.sym.typeSignature.toString else t.sym.toString - println("%s, t=%s, s=%s".format(t, t.tpe.kind, s)) + def printTpe(t: Type) = { + val s = if (t.typeSymbol.isFreeType) t.typeSymbol.typeSignature.toString else t.typeSymbol.toString + println("%s, t=%s, s=%s".format(t, t.kind, s)) } - def m[T: ConcreteTypeTag](x: T) = printTag(concreteTypeTag[T]) - def m2[T: TypeTag](x: T) = printTag(typeTag[T]) + def m[T: ConcreteTypeTag](x: T) = printTpe(typeOf[T]) + def m2[T: TypeTag](x: T) = printTpe(typeOf[T]) // tags do work for f10/g10 def main(args: Array[String]): Unit = { @@ -75,4 +77,4 @@ object Misc { } def g1 = o1.f1 _ def g2 = o1.f2 _ -} +} \ No newline at end of file diff --git a/test/files/run/freetypes_false_alarm1.check b/test/files/run/freetypes_false_alarm1.check new file mode 100644 index 0000000000..92efacc2b7 --- /dev/null +++ b/test/files/run/freetypes_false_alarm1.check @@ -0,0 +1 @@ +List[Int] diff --git a/test/files/run/freetypes_false_alarm1.scala b/test/files/run/freetypes_false_alarm1.scala new file mode 100644 index 0000000000..8d6797f792 --- /dev/null +++ b/test/files/run/freetypes_false_alarm1.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val ru = scala.reflect.runtime.universe + val tpe: ru.Type = ru.typeOf[List[Int]] + println(tpe) + }.eval +} \ No newline at end of file diff --git a/test/files/run/freetypes_false_alarm2.check b/test/files/run/freetypes_false_alarm2.check new file mode 100644 index 0000000000..02e4a84d62 --- /dev/null +++ b/test/files/run/freetypes_false_alarm2.check @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/test/files/run/freetypes_false_alarm2.scala b/test/files/run/freetypes_false_alarm2.scala new file mode 100644 index 0000000000..3499f13fba --- /dev/null +++ b/test/files/run/freetypes_false_alarm2.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.tools.reflect.Eval + +object Test extends App { + val tpe = typeOf[ru.Type] + println(tpe.typeSymbol.isFreeType) +} \ No newline at end of file diff --git a/test/files/run/getClassTest-new.scala b/test/files/run/getClassTest-new.scala index 89778ca2d3..7d8ec930f4 100644 --- a/test/files/run/getClassTest-new.scala +++ b/test/files/run/getClassTest-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + class AnyVals { def f1 = (5: Any).getClass def f2 = (5: AnyVal).getClass @@ -52,7 +54,7 @@ class MoreAnyRefs { object Test { def returnTypes[T: ClassTag] = ( - classTag[T].erasure.getMethods.toList + classTag[T].runtimeClass.getMethods.toList filter (_.getName startsWith "f") sortBy (_.getName) map (m => m.getName + ": " + m.getGenericReturnType.toString) @@ -63,4 +65,4 @@ object Test { returnTypes[AnyRefs] foreach println returnTypes[MoreAnyRefs] foreach println } -} +} \ No newline at end of file diff --git a/test/files/run/interop_classmanifests_arenot_typetags.check b/test/files/run/interop_classmanifests_arenot_typetags.check new file mode 100644 index 0000000000..d67491ed75 --- /dev/null +++ b/test/files/run/interop_classmanifests_arenot_typetags.check @@ -0,0 +1,3 @@ +T +T +T diff --git a/test/files/run/interop_classmanifests_arenot_typetags.scala b/test/files/run/interop_classmanifests_arenot_typetags.scala new file mode 100644 index 0000000000..d65a5124d7 --- /dev/null +++ b/test/files/run/interop_classmanifests_arenot_typetags.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def classManifestIsnotTypeTag[T: ClassManifest] = { + println(typeOf[T]) + } + + classManifestIsnotTypeTag[Int] + classManifestIsnotTypeTag[String] + classManifestIsnotTypeTag[Array[Int]] +} \ No newline at end of file diff --git a/test/files/run/interop_classmanifests_arepartially_typetags.check b/test/files/run/interop_classmanifests_arepartially_typetags.check deleted file mode 100644 index 3dfcdccbec..0000000000 --- a/test/files/run/interop_classmanifests_arepartially_typetags.check +++ /dev/null @@ -1,6 +0,0 @@ -T -int -T -class java.lang.String -T -class [I diff --git a/test/files/run/interop_classmanifests_arepartially_typetags.scala b/test/files/run/interop_classmanifests_arepartially_typetags.scala deleted file mode 100644 index 9bc1f32e86..0000000000 --- a/test/files/run/interop_classmanifests_arepartially_typetags.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends App { - def classManifestIspartiallyTypeTag[T: ClassManifest] = { - println(typeTag[T].tpe) - println(typeTag[T].erasure) - } - - classManifestIspartiallyTypeTag[Int] - classManifestIspartiallyTypeTag[String] - classManifestIspartiallyTypeTag[Array[Int]] -} \ No newline at end of file diff --git a/test/files/run/interop_classtags_are_classmanifests.scala b/test/files/run/interop_classtags_are_classmanifests.scala index 309c99a3f5..498a947879 100644 --- a/test/files/run/interop_classtags_are_classmanifests.scala +++ b/test/files/run/interop_classtags_are_classmanifests.scala @@ -1,3 +1,6 @@ +import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.{ClassTag, classTag} + object Test extends App { def arrayTagIsClassManifest[T: ArrayTag] = { println(classManifest[T]) diff --git a/test/files/run/interop_concretetypetags_are_classmanifests.check b/test/files/run/interop_concretetypetags_are_classmanifests.check deleted file mode 100644 index c59e92d4eb..0000000000 --- a/test/files/run/interop_concretetypetags_are_classmanifests.check +++ /dev/null @@ -1,3 +0,0 @@ -Int -java.lang.String -Array[Int] diff --git a/test/files/run/interop_concretetypetags_are_classmanifests.scala b/test/files/run/interop_concretetypetags_are_classmanifests.scala deleted file mode 100644 index b578d7e626..0000000000 --- a/test/files/run/interop_concretetypetags_are_classmanifests.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def concreteTypeTagIsClassManifest[T: ConcreteTypeTag] = { - println(classManifest[T]) - } - - concreteTypeTagIsClassManifest[Int] - concreteTypeTagIsClassManifest[String] - concreteTypeTagIsClassManifest[Array[Int]] -} \ No newline at end of file diff --git a/test/files/run/interop_concretetypetags_are_manifests.check b/test/files/run/interop_concretetypetags_are_manifests.check index c59e92d4eb..871167e3ab 100644 --- a/test/files/run/interop_concretetypetags_are_manifests.check +++ b/test/files/run/interop_concretetypetags_are_manifests.check @@ -1,3 +1,3 @@ -Int +int java.lang.String Array[Int] diff --git a/test/files/run/interop_concretetypetags_are_manifests.scala b/test/files/run/interop_concretetypetags_are_manifests.scala index 731410bc10..84647a3a5a 100644 --- a/test/files/run/interop_concretetypetags_are_manifests.scala +++ b/test/files/run/interop_concretetypetags_are_manifests.scala @@ -1,5 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.ClassTag + object Test extends App { - def concreteTypeTagIsManifest[T: ConcreteTypeTag] = { + def concreteTypeTagIsManifest[T: ConcreteTypeTag : ClassTag] = { println(manifest[T]) } diff --git a/test/files/run/interop_manifests_are_classtags.check b/test/files/run/interop_manifests_are_classtags.check index 07ff6b984a..aaf4aba012 100644 --- a/test/files/run/interop_manifests_are_classtags.check +++ b/test/files/run/interop_manifests_are_classtags.check @@ -1,24 +1,18 @@ Int -Int List() List(0, 0, 0, 0, 0) java.lang.String -java.lang.String List() List(null, null, null, null, null) Array[Int] -Array[Int] List() List(null, null, null, null, null) Int -Int List() List(0, 0, 0, 0, 0) java.lang.String -java.lang.String List() List(null, null, null, null, null) Array[Int] -Array[Int] List() List(null, null, null, null, null) diff --git a/test/files/run/interop_manifests_are_classtags.scala b/test/files/run/interop_manifests_are_classtags.scala index 582cea3467..d2b8bdea5c 100644 --- a/test/files/run/interop_manifests_are_classtags.scala +++ b/test/files/run/interop_manifests_are_classtags.scala @@ -1,7 +1,8 @@ +import scala.reflect.{ArrayTag, ClassTag, arrayTag, classTag} + object Test extends App { def classManifestIsClassTag[T: ClassManifest] = { println(arrayTag[T]) - println(erasureTag[T]) println(Array[T]().toList) println(new Array[T](5).toList) } @@ -12,7 +13,6 @@ object Test extends App { def manifestIsClassTag[T: Manifest] = { println(arrayTag[T]) - println(erasureTag[T]) println(Array[T]().toList) println(new Array[T](5).toList) } diff --git a/test/files/run/interop_manifests_are_concretetypetags.check b/test/files/run/interop_manifests_are_concretetypetags.check index edab85ecf1..c59e92d4eb 100644 --- a/test/files/run/interop_manifests_are_concretetypetags.check +++ b/test/files/run/interop_manifests_are_concretetypetags.check @@ -1,6 +1,3 @@ -Int -int -String -class java.lang.String -Array[Int] -class [I +Int +java.lang.String +Array[Int] diff --git a/test/files/run/interop_manifests_are_concretetypetags.scala b/test/files/run/interop_manifests_are_concretetypetags.scala index 0b82a56d0a..85ad748173 100644 --- a/test/files/run/interop_manifests_are_concretetypetags.scala +++ b/test/files/run/interop_manifests_are_concretetypetags.scala @@ -1,7 +1,8 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def manifestIsConcreteTypeTag[T: Manifest] = { - println(concreteTypeTag[T].tpe) - println(concreteTypeTag[T].erasure) + println(implicitly[ConcreteTypeTag[T]].tpe) } manifestIsConcreteTypeTag[Int] diff --git a/test/files/run/interop_manifests_are_typetags.check b/test/files/run/interop_manifests_are_typetags.check index edab85ecf1..c59e92d4eb 100644 --- a/test/files/run/interop_manifests_are_typetags.check +++ b/test/files/run/interop_manifests_are_typetags.check @@ -1,6 +1,3 @@ -Int -int -String -class java.lang.String -Array[Int] -class [I +Int +java.lang.String +Array[Int] diff --git a/test/files/run/interop_manifests_are_typetags.scala b/test/files/run/interop_manifests_are_typetags.scala index 03a7b7b6d5..294d3c22de 100644 --- a/test/files/run/interop_manifests_are_typetags.scala +++ b/test/files/run/interop_manifests_are_typetags.scala @@ -1,7 +1,8 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def manifestIsTypeTag[T: Manifest] = { - println(typeTag[T].tpe) - println(typeTag[T].erasure) + println(typeOf[T]) } manifestIsTypeTag[Int] diff --git a/test/files/run/macro-abort-fresh/Macros_1.scala b/test/files/run/macro-abort-fresh/Macros_1.scala index 4186c4c4a6..440d1e2915 100644 --- a/test/files/run/macro-abort-fresh/Macros_1.scala +++ b/test/files/run/macro-abort-fresh/Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.makro.Context object Impls { def impl(c: Context) = { - import c.mirror._ + import c.universe._ println(c.fresh()) println(c.fresh("qwe")) println(c.fresh(newTypeName("qwe"))) diff --git a/test/files/run/macro-abort-fresh/Test_2.scala b/test/files/run/macro-abort-fresh/Test_2.scala index ecf48b9752..c6caa2b585 100644 --- a/test/files/run/macro-abort-fresh/Test_2.scala +++ b/test/files/run/macro-abort-fresh/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } \ No newline at end of file diff --git a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala index 3f23e349d5..039488ba3e 100644 --- a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala +++ b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala @@ -2,20 +2,20 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - Expr[Int](body) + c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) + c.Expr[Int](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala index 44bfe861e3..6e1e37a485 100644 --- a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala +++ b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala @@ -2,21 +2,21 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - Expr[Int](body) + c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) + c.Expr[Int](body) } } diff --git a/test/files/run/macro-basic-mamd-mi/Impls_1.scala b/test/files/run/macro-basic-mamd-mi/Impls_1.scala index 82d2cce2f5..96d26741f7 100644 --- a/test/files/run/macro-basic-mamd-mi/Impls_1.scala +++ b/test/files/run/macro-basic-mamd-mi/Impls_1.scala @@ -2,18 +2,18 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ - Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) + import c.universe._ + c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) + c.Expr[Int](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala index 5c5ec2c999..7de1e59cc7 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -5,8 +5,8 @@ object Impls { def refToFoo(dummy: Int) = macro refToFoo_impl def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val body = Select(Ident(newTermName("Impls")), newTermName("foo")) - Expr[Int](body) + c.Expr[Int](body) } } \ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-declared-in-annotation/Impls_1.scala index a1234a7374..2b309e1cc8 100644 --- a/test/files/run/macro-declared-in-annotation/Impls_1.scala +++ b/test/files/run/macro-declared-in-annotation/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Literal(Constant("this is deprecated"))) - Expr[String](body) + c.Expr[String](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-declared-in-anonymous/Impls_1.scala index c0827ace31..d95dbd42c6 100644 --- a/test/files/run/macro-declared-in-anonymous/Impls_1.scala +++ b/test/files/run/macro-declared-in-anonymous/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-declared-in-block/Impls_1.scala index c0827ace31..d95dbd42c6 100644 --- a/test/files/run/macro-declared-in-block/Impls_1.scala +++ b/test/files/run/macro-declared-in-block/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-class/Impls_1.scala b/test/files/run/macro-declared-in-class-class/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-class-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-class-class/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-object/Impls_1.scala b/test/files/run/macro-declared-in-class-object/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-class-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-class-object/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-class/Impls_1.scala b/test/files/run/macro-declared-in-class/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-class/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-declared-in-default-param/Impls_1.scala index e45095812a..5e7351e954 100644 --- a/test/files/run/macro-declared-in-default-param/Impls_1.scala +++ b/test/files/run/macro-declared-in-default-param/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Literal(Constant("it works"))) - Expr[String](body) + c.Expr[String](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala index 8605d4a8be..e5fb4bcdf3 100644 --- a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala +++ b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala @@ -3,10 +3,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def toOptionOfInt(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, newTermName("x")), newTermName("toInt"))))) - Expr[Option[Int]](body) + c.Expr[Option[Int]](body) } } @@ -16,4 +16,4 @@ object Macros { class Foo(val x: String) { def toOptionOfInt = macro Impls.toOptionOfInt } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-declared-in-method/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-method/Impls_1.scala +++ b/test/files/run/macro-declared-in-method/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-class/Impls_1.scala b/test/files/run/macro-declared-in-object-class/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-object-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-object-class/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-object/Impls_1.scala b/test/files/run/macro-declared-in-object-object/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-object-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-object-object/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-object/Impls_1.scala b/test/files/run/macro-declared-in-object/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-object/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-package-object/Impls_1.scala b/test/files/run/macro-declared-in-package-object/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-package-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-package-object/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-refinement/Impls_1.scala b/test/files/run/macro-declared-in-refinement/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-refinement/Impls_1.scala +++ b/test/files/run/macro-declared-in-refinement/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-declared-in-trait/Impls_1.scala index c2e6933582..5c61086a40 100644 --- a/test/files/run/macro-declared-in-trait/Impls_1.scala +++ b/test/files/run/macro-declared-in-trait/Impls_1.scala @@ -3,9 +3,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(printPrefix, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Test_2.scala b/test/files/run/macro-def-infer-return-type-b/Test_2.scala index f8f15b4224..0f84859545 100644 --- a/test/files/run/macro-def-infer-return-type-b/Test_2.scala +++ b/test/files/run/macro-def-infer-return-type-b/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } -} \ No newline at end of file +} diff --git a/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala index 32f03e778e..aca7f999d5 100644 --- a/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala @@ -1,3 +1,4 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.Context import scala.reflect.api.Universe @@ -5,4 +6,4 @@ object Test { def materializeTypeTag[T](u: Universe)(e: T) = macro materializeTypeTag_impl[T] def materializeTypeTag_impl[T: c.TypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala index 39db275e1c..b59555539c 100644 --- a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(x.tree)) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala index 0262485994..68ead9b9a5 100644 --- a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { - import c.mirror._ + import c.universe._ val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt")))) - Expr[Option[Int]](body) + c.Expr[Option[Int]](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala index 510d8502f6..a1dd5aa801 100644 --- a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Literal(Constant(2)) - Expr[Int](body) + c.Expr[Int](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala index 0262485994..68ead9b9a5 100644 --- a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { - import c.mirror._ + import c.universe._ val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt")))) - Expr[Option[Int]](body) + c.Expr[Option[Int]](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala index ae1c50eace..2c1748bc29 100644 --- a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala +++ b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala index 10352594f5..edbe6d504a 100644 --- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala @@ -1,14 +1,15 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def impl[T: c.TypeTag](c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.TypeTag[T]])))) - Expr[Unit](body) + c.Expr[Unit](body) } def fooNullary[T: c.TypeTag](c: Ctx) = impl[T](c) def fooEmpty[T: c.TypeTag](c: Ctx)() = impl[T](c) def barNullary[T: c.TypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) def barEmpty[T: c.TypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala index 7dc58abba8..0d849a085d 100644 --- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala @@ -2,13 +2,13 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def impl(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) - Expr[Unit](body) + c.Expr[Unit](body) } def fooNullary(c: Ctx) = impl(c) def fooEmpty(c: Ctx)() = impl(c) def barNullary(c: Ctx)(x: c.Expr[Int]) = impl(c) def barEmpty(c: Ctx)(x: c.Expr[Int])() = impl(c) -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-overload/Impls_1.scala b/test/files/run/macro-expand-overload/Impls_1.scala index 1dc4adc20e..f4646d43df 100644 --- a/test/files/run/macro-expand-overload/Impls_1.scala +++ b/test/files/run/macro-expand-overload/Impls_1.scala @@ -3,13 +3,13 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) - Expr[Unit](body) + c.Expr[Unit](body) } def fooObjectString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooObjectString", x) def fooObjectInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooObjectInt", x) def fooClassString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooClassString", x) def fooClassInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooClassInt", x) -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-override/Impls_1.scala b/test/files/run/macro-expand-override/Impls_1.scala index 0b127f5a59..d6493caad9 100644 --- a/test/files/run/macro-expand-override/Impls_1.scala +++ b/test/files/run/macro-expand-override/Impls_1.scala @@ -3,13 +3,13 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) - Expr[Unit](body) + c.Expr[Unit](body) } def fooBString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBString", x) def fooBInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBInt", x) def fooDInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooDInt", x) def fooZString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooZString", x) -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-recursive/Impls_1.scala b/test/files/run/macro-expand-recursive/Impls_1.scala index 6eff805989..26833ca0b9 100644 --- a/test/files/run/macro-expand-recursive/Impls_1.scala +++ b/test/files/run/macro-expand-recursive/Impls_1.scala @@ -2,14 +2,14 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) - Expr[Unit](body) + c.Expr[Unit](body) } def fooFoo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Select(Ident(newTermName("Macros")), newTermName("foo")) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala index 957d8331fc..d1843275d0 100644 --- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala @@ -1,10 +1,11 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag](c: Ctx) = { - import c.mirror._ + import c.universe._ val U = implicitly[c.TypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala index c25d12be60..cbc5460720 100644 --- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala @@ -1,10 +1,11 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.mirror._ + import c.universe._ val U = implicitly[c.TypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-optional/Impls_1.scala b/test/files/run/macro-expand-tparams-optional/Impls_1.scala index 37efb009c4..97363edd9a 100644 --- a/test/files/run/macro-expand-tparams-optional/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-optional/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U](c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("don't know U")))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala index c25d12be60..cbc5460720 100644 --- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala @@ -1,10 +1,11 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.mirror._ + import c.universe._ val U = implicitly[c.TypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala index 8af3ecc9ae..3d29fa467d 100644 --- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala @@ -1,11 +1,12 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T: c.TypeTag, U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.mirror._ + import c.universe._ val T = implicitly[c.TypeTag[T]] val U = implicitly[c.TypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala index 4da5a9b823..a834d809da 100644 --- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala @@ -1,12 +1,13 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ - Expr(Block(List( + import c.universe._ + c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala index 4d137a4aef..e0de1f3f83 100644 --- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala @@ -1,9 +1,10 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ - Expr(Block(List( + import c.universe._ + c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), @@ -15,4 +16,4 @@ class D[T] { class C[U] { def foo[V] = macro Impls.foo[T, U, V] } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala index 4da5a9b823..a834d809da 100644 --- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala @@ -1,12 +1,13 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ - Expr(Block(List( + import c.universe._ + c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala index d97f0af786..b83fa046e5 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala index 01fc9d4462..c0319fcd6c 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala @@ -3,8 +3,10 @@ object Macros { } object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(tpnme.WILDCARD_STAR)))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala index f9667d78b8..5f550064e1 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala @@ -2,12 +2,12 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val stripped_xs = xs map (_.tree) toList match { case List(Typed(stripped, Ident(wildstar))) if wildstar == tpnme.WILDCARD_STAR => List(stripped) case _ => ??? } val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), stripped_xs) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala index 8c609daa0e..8c75a7e0ea 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala @@ -6,8 +6,8 @@ object Impls { } def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala index d97f0af786..b83fa046e5 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala index 8c609daa0e..8c75a7e0ea 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala @@ -6,8 +6,8 @@ object Impls { } def foo(c: Ctx)(xs: c.Expr[Int]*) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList) - Expr[Unit](body) + c.Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala index cece1c09e4..8154ab0341 100644 --- a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala +++ b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala @@ -1,20 +1,21 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Impls { def foo_targs[T, U: c.TypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = { import c.{prefix => prefix} - import c.mirror._ + import c.universe._ val U = implicitly[c.TypeTag[U]] val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticTpe)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + U.tpe)))), Literal(Constant(()))) - Expr[Unit](body) + c.Expr[Unit](body) } } class Macros[T] { def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U] -} +} \ No newline at end of file diff --git a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala index 000e351f4d..367a45a2c3 100644 --- a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala +++ b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala @@ -2,11 +2,11 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = { - import unconventionalName.mirror._ + import unconventionalName.universe._ val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo...")))), Literal(Constant(()))) - Expr[Unit](body) + unconventionalName.Expr[Unit](body) } } diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala index 828ccf34e2..5a7d1a6b9a 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx): c.Expr[Int] = { - import c.mirror._ - Expr(Literal(Constant("42"))) + import c.universe._ + c.Expr(Literal(Constant("42"))) } } diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala index ecf48b9752..c6caa2b585 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } \ No newline at end of file diff --git a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala index f3a0476a35..04eef976c5 100644 --- a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala @@ -2,12 +2,12 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx) = { - import c.mirror._ + import c.universe._ val body = Ident("IDoNotExist") - Expr[Int](body) + c.Expr[Int](body) } } object Macros { def foo = macro Impls.foo -} +} \ No newline at end of file diff --git a/test/files/run/macro-invalidret-nontypeable/Test_2.scala b/test/files/run/macro-invalidret-nontypeable/Test_2.scala index ecf48b9752..c6caa2b585 100644 --- a/test/files/run/macro-invalidret-nontypeable/Test_2.scala +++ b/test/files/run/macro-invalidret-nontypeable/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Select(Ident("Macros"), newTermName("foo")) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } \ No newline at end of file diff --git a/test/files/run/macro-invalidusage-badret/Test_2.scala b/test/files/run/macro-invalidusage-badret/Test_2.scala index aeb3c26eaa..8322e8a4e0 100644 --- a/test/files/run/macro-invalidusage-badret/Test_2.scala +++ b/test/files/run/macro-invalidusage-badret/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Typed(Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))), Ident(newTypeName("String"))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } -} \ No newline at end of file +} diff --git a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala index 449b91d074..e5bdca008e 100644 --- a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val sum = Apply(Select(x.tree, newTermName("$plus")), List(y.tree)) val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) - Expr[Unit](body) + c.Expr[Unit](body) } } diff --git a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala index 293d906048..64020b2aa9 100644 --- a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala +++ b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala @@ -1,6 +1,8 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(40)))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala index 9fd658656e..ffeccce1e8 100644 --- a/test/files/run/macro-openmacros/Impls_Macros_1.scala +++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala @@ -5,7 +5,7 @@ object Macros { // we're macros, so we can reflect against our source path // so we don't need any partests to clean up after us! val c.CompilationUnit(file, _, _) = c.enclosingUnit - val dir = file.getParentFile + val dir = file.getCanonicalFile.getParentFile def normalizePaths(s: String) = { val base = (dir.getCanonicalPath + java.io.File.separator).replace('\\', '/') var regex = """\Q%s\E""" format base @@ -13,12 +13,12 @@ object Macros { if (isWin) regex = "(?i)" + regex s.replace('\\', '/').replaceAll(regex, "") } - - import c.mirror._ - val next = if (c.enclosingMacros.length < 3) Expr[Unit](Select(Ident(staticModule("Macros")), newTermName("foo"))) else c.literalUnit + + import c.universe._ + val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), newTermName("foo"))) else c.literalUnit c.reify { - println(c.literal(normalizePaths(c.enclosingMacros.toString)).eval) - next.eval + println(c.literal(normalizePaths(c.enclosingMacros.toString)).splice) + next.splice } } diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala index bd46e1f529..650257ae16 100644 --- a/test/files/run/macro-range/Common_1.scala +++ b/test/files/run/macro-range/Common_1.scala @@ -1,4 +1,3 @@ -import reflect.api.Modifier import reflect.makro.Context abstract class RangeDefault { @@ -12,7 +11,7 @@ abstract class RangeDefault { /** This class should go into reflect.macro once it is a bit more stable. */ abstract class Utils { val context: Context - import context.mirror._ + import context.universe._ class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { override def transform(tree: Tree): Tree = tree match { diff --git a/test/files/run/macro-range/Expansion_Impossible_2.scala b/test/files/run/macro-range/Expansion_Impossible_2.scala index 051afff99c..fecce6bc48 100644 --- a/test/files/run/macro-range/Expansion_Impossible_2.scala +++ b/test/files/run/macro-range/Expansion_Impossible_2.scala @@ -1,4 +1,3 @@ -import reflect.api.Modifier import reflect.makro.Context object Impls { @@ -7,14 +6,15 @@ object Impls { //println("macro-expand, _this = "+ _this) object utils extends Utils { val context: c.type = c } import utils._ - import c.mirror._ + import c.universe._ + import Flag._ - val initName = newTermName("") + val initName = nme.CONSTRUCTOR // Either: // scala"{ var i = $low; val h = $hi; while (i < h) { $f(i); i = i + 1 } } // or: // scala"($_this: RangeDefault).foreach($f)" - Expr(c.prefix.tree match { + c.Expr(c.prefix.tree match { case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" => val iname = newTermName("$i") val hname = newTermName("$h") @@ -28,7 +28,7 @@ object Impls { val generated = Block( List( - ValDef(Modifiers(Set(Modifier.mutable)), iname, TypeTree(), lo), + 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 diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala index f6caf89dca..b10f4121a6 100644 --- a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala @@ -2,9 +2,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } } diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala index 632708a125..67666a632b 100644 --- a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala @@ -1,5 +1,7 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - println(Expr(tree).eval) + println(cm.mkToolBox().runExpr(tree)) } diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala index dc7d42d23e..dd8fcd4d9e 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala @@ -2,8 +2,8 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) + c.Expr[Int](body) } -} +} \ No newline at end of file diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala index cf34f1685d..32a8958577 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala @@ -3,15 +3,18 @@ //} object Test extends App { - import scala.reflect.mirror._ + 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(newTermName("Impls")), newTermName("foo")) val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.asType), EmptyTree) - val macrodef = DefDef(Modifiers(Set(scala.reflect.api.Modifier.`macro`)), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) + val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(EmptyTypeName), EmptyTypeName), nme.CONSTRUCTOR), List()))) val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef))) val macroapp = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) val tree = Block(macrodef, module, macroapp) - val toolbox = mkToolBox(options = "-language:experimental.macros") + val toolbox = cm.mkToolBox(options = "-language:experimental.macros") println(toolbox.runExpr(tree)) } diff --git a/test/files/run/macro-reify-basic/Macros_1.scala b/test/files/run/macro-reify-basic/Macros_1.scala index b2243d131c..7a43ee58be 100644 --- a/test/files/run/macro-reify-basic/Macros_1.scala +++ b/test/files/run/macro-reify-basic/Macros_1.scala @@ -5,7 +5,7 @@ object Macros { object Impls { def foo(c: Ctx)(s: c.Expr[String]) = c.reify { - println("hello " + s.eval) + println("hello " + s.splice) } } } \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-eval.check b/test/files/run/macro-reify-eval-eval.check deleted file mode 100644 index f35d3e67b4..0000000000 --- a/test/files/run/macro-reify-eval-eval.check +++ /dev/null @@ -1 +0,0 @@ -hello world diff --git a/test/files/run/macro-reify-eval-eval.flags b/test/files/run/macro-reify-eval-eval.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-reify-eval-eval.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-eval/Macros_1.scala b/test/files/run/macro-reify-eval-eval/Macros_1.scala deleted file mode 100644 index 6b8ac94f0e..0000000000 --- a/test/files/run/macro-reify-eval-eval/Macros_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.makro.{Context => Ctx} -import scala.reflect.{mirror => mr} - -object Macros { - def foo = macro Impls.foo - - object Impls { - def foo(c: Ctx) = c.reify { - { c.reify(c.reify("hello world")) }.eval.eval - } - } -} \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-eval/Test_2.scala b/test/files/run/macro-reify-eval-eval/Test_2.scala deleted file mode 100644 index f697da6020..0000000000 --- a/test/files/run/macro-reify-eval-eval/Test_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - println(Macros.foo) -} \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-outside-reify.check b/test/files/run/macro-reify-eval-outside-reify.check deleted file mode 100644 index 2f562a182f..0000000000 --- a/test/files/run/macro-reify-eval-outside-reify.check +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/files/run/macro-reify-eval-outside-reify.flags b/test/files/run/macro-reify-eval-outside-reify.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-reify-eval-outside-reify.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros \ No newline at end of file diff --git a/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala deleted file mode 100644 index 086f9aeef2..0000000000 --- a/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.makro.{Context => Ctx} - -object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = { - val x1 = c.Expr[Int](c.resetAllAttrs(x.tree)) - c.literal(x1.eval) - } -} - -object Macros { - def foo(x: Int) = macro Impls.foo -} diff --git a/test/files/run/macro-reify-eval-outside-reify/Test_2.scala b/test/files/run/macro-reify-eval-outside-reify/Test_2.scala deleted file mode 100644 index 632708a125..0000000000 --- a/test/files/run/macro-reify-eval-outside-reify/Test_2.scala +++ /dev/null @@ -1,5 +0,0 @@ -object Test extends App { - import scala.reflect.mirror._ - val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - println(Expr(tree).eval) -} diff --git a/test/files/run/macro-reify-freevars.check b/test/files/run/macro-reify-freevars.check index 068742f0b6..2e925f9fa8 100644 --- a/test/files/run/macro-reify-freevars.check +++ b/test/files/run/macro-reify-freevars.check @@ -1,3 +1,3 @@ -reflective compilation has failed: - -Macro expansion contains free term variable code defined by map in Macros_1.scala:8:9. Have you forgotten to use eval when splicing this variable into a reifee? If you have troubles tracking free term variables, consider using -Xlog-free-terms +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/test/files/run/macro-reify-freevars/Macros_1.scala b/test/files/run/macro-reify-freevars/Macros_1.scala index 3cc559a0af..eafc7f9a82 100644 --- a/test/files/run/macro-reify-freevars/Macros_1.scala +++ b/test/files/run/macro-reify-freevars/Macros_1.scala @@ -1,13 +1,14 @@ package scala.collection.slick + object QueryableMacros{ def map[T:c.TypeTag, S:c.TypeTag] (c: scala.reflect.makro.Context) - (projection: c.mirror.Expr[T => S]) - : c.mirror.Expr[scala.collection.slick.Queryable[S]] = { - import c.mirror._ + (projection: c.Expr[T => S]) + : c.Expr[scala.collection.slick.Queryable[S]] = { + import c.universe._ val code = EmptyTree c.reify{ - Queryable.factory[S]( code.asInstanceOf[reflect.mirror.Tree] ) + Queryable.factory[S]( code.asInstanceOf[reflect.runtime.universe.Tree] ) } } } @@ -15,5 +16,5 @@ class Queryable[T]{ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S] } object Queryable{ - def factory[S]( projection:scala.reflect.mirror.Tree ) : Queryable[S] = null + def factory[S]( projection:reflect.runtime.universe.Tree ) : Queryable[S] = null } \ No newline at end of file diff --git a/test/files/run/macro-reify-freevars/Test_2.scala b/test/files/run/macro-reify-freevars/Test_2.scala index e7077f9c7f..603cf10d41 100644 --- a/test/files/run/macro-reify-freevars/Test_2.scala +++ b/test/files/run/macro-reify-freevars/Test_2.scala @@ -1,9 +1,11 @@ object Test extends App { - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox val q = New(AppliedTypeTree(Select(Select(Select(Ident("scala"), newTermName("collection")), newTermName("slick")), newTypeName("Queryable")), List(Ident("Int")))) val x = ValDef(NoMods, newTermName("x"), Ident("Int"), EmptyTree) val fn = Function(List(x), Apply(Select(Ident(newTermName("x")), newTermName("$plus")), List(Literal(Constant("5"))))) val tree = Apply(Select(q, newTermName("map")), List(fn)) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } \ No newline at end of file diff --git a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala index d2f8fab5ec..2bead07dd9 100644 --- a/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala +++ b/test/files/run/macro-reify-groundtypetag-notypeparams/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { println(implicitly[ConcreteTypeTag[Int]]) diff --git a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala index 6d7eab5f9a..245bbe98e1 100644 --- a/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala +++ b/test/files/run/macro-reify-groundtypetag-typeparams-tags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTag[T: ConcreteTypeTag] = { diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala index 1ce8f44671..f9a08df90d 100644 --- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala @@ -1,17 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.makro.Context case class Utils[C <: Context]( c:C ) { - import c.mirror._ + import c.universe._ import c.{Tree=>_} - object removeDoubleReify extends c.mirror.Transformer { + 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), _), reified::Nil ) - if termname.toString == "factory" => c.unreifyTree(reified) - case Apply(Select(_this, termname), reified::Nil ) - if termname.toString == "factory" => c.unreifyTree(reified) + 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 } } @@ -19,25 +21,25 @@ case class Utils[C <: Context]( c:C ) { } } object QueryableMacros{ - def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.mirror.Expr[_] ) = { - import c.mirror._ - val element_type = implicitly[c.TypeTag[S]].tpe - val foo = Expr[reflect.mirror.Expr[Queryable[S]]]( - c.reifyTree( c.reflectMirrorPrefix, c.typeCheck( + def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + val element_type = c.typeOf[S] + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) ).asInstanceOf[Tree] ))) - c.reify{ Queryable.factory[S]( foo.eval )} + c.reify{ Queryable.factory[S]( foo.splice )} } def map[T:c.TypeTag, S:c.TypeTag] (c: scala.reflect.makro.Context) - (projection: c.mirror.Expr[T => S]): c.mirror.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) + (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:scala.reflect.mirror.Expr[Queryable[S]] ) : Queryable[S] = null + def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null } \ No newline at end of file diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala index 1ce8f44671..f9a08df90d 100644 --- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala @@ -1,17 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.makro.Context case class Utils[C <: Context]( c:C ) { - import c.mirror._ + import c.universe._ import c.{Tree=>_} - object removeDoubleReify extends c.mirror.Transformer { + 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), _), reified::Nil ) - if termname.toString == "factory" => c.unreifyTree(reified) - case Apply(Select(_this, termname), reified::Nil ) - if termname.toString == "factory" => c.unreifyTree(reified) + 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 } } @@ -19,25 +21,25 @@ case class Utils[C <: Context]( c:C ) { } } object QueryableMacros{ - def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.mirror.Expr[_] ) = { - import c.mirror._ - val element_type = implicitly[c.TypeTag[S]].tpe - val foo = Expr[reflect.mirror.Expr[Queryable[S]]]( - c.reifyTree( c.reflectMirrorPrefix, c.typeCheck( + def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + import c.universe._ + val element_type = c.typeOf[S] + val foo = c.Expr[ru.Expr[Queryable[S]]]( + c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) ).asInstanceOf[Tree] ))) - c.reify{ Queryable.factory[S]( foo.eval )} + c.reify{ Queryable.factory[S]( foo.splice )} } def map[T:c.TypeTag, S:c.TypeTag] (c: scala.reflect.makro.Context) - (projection: c.mirror.Expr[T => S]): c.mirror.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) + (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:scala.reflect.mirror.Expr[Queryable[S]] ) : Queryable[S] = null + def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null } \ No newline at end of file diff --git a/test/files/run/macro-reify-splice-outside-reify.check b/test/files/run/macro-reify-splice-outside-reify.check new file mode 100644 index 0000000000..2f562a182f --- /dev/null +++ b/test/files/run/macro-reify-splice-outside-reify.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/macro-reify-splice-outside-reify.flags b/test/files/run/macro-reify-splice-outside-reify.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-reify-splice-outside-reify.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala new file mode 100644 index 0000000000..3ddfe6a737 --- /dev/null +++ b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala @@ -0,0 +1,24 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = { + val x1 = c.Expr[Int](c.resetAllAttrs(x.tree)) +// was: c.literal(x1.splice) + c.literal(eval(c)(x1)) + } + + private def eval[T](c: Ctx)(x: c.Expr[T]): T = { + import scala.reflect.runtime.{universe => ru} + val mirror = ru.runtimeMirror(c.libraryClassLoader) + import scala.tools.reflect.ToolBox + val toolBox = mirror.mkToolBox() + val importer = ru.mkImporter(c.universe).asInstanceOf[ru.Importer { val from: c.universe.type }] + val tree = c.resetAllAttrs(x.tree.duplicate) + val imported = importer.importTree(tree) + toolBox.runExpr(imported).asInstanceOf[T] + } +} + +object Macros { + def foo(x: Int) = macro Impls.foo +} diff --git a/test/files/run/macro-reify-splice-outside-reify/Test_2.scala b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala new file mode 100644 index 0000000000..5bca7db668 --- /dev/null +++ b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) + try println(cm.mkToolBox().runExpr(tree)) + catch { case ex: Throwable => println(ex.getMessage) } +} diff --git a/test/files/run/macro-reify-splice-splice.check b/test/files/run/macro-reify-splice-splice.check new file mode 100644 index 0000000000..f35d3e67b4 --- /dev/null +++ b/test/files/run/macro-reify-splice-splice.check @@ -0,0 +1 @@ +hello world diff --git a/test/files/run/macro-reify-splice-splice.flags b/test/files/run/macro-reify-splice-splice.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-reify-splice-splice.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/test/files/run/macro-reify-splice-splice/Macros_1.scala b/test/files/run/macro-reify-splice-splice/Macros_1.scala new file mode 100644 index 0000000000..030a0a217e --- /dev/null +++ b/test/files/run/macro-reify-splice-splice/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.makro.{Context => Ctx} +import scala.reflect.{mirror => mr} + +object Macros { + def foo = macro Impls.foo + + object Impls { + def foo(c: Ctx) = c.reify { + { c.reify(c.reify("hello world")) }.splice.splice + } + } +} \ No newline at end of file diff --git a/test/files/run/macro-reify-splice-splice/Test_2.scala b/test/files/run/macro-reify-splice-splice/Test_2.scala new file mode 100644 index 0000000000..f697da6020 --- /dev/null +++ b/test/files/run/macro-reify-splice-splice/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println(Macros.foo) +} \ No newline at end of file diff --git a/test/files/run/macro-reify-tagful-a/Macros_1.scala b/test/files/run/macro-reify-tagful-a/Macros_1.scala index 2ff12091a1..63f117220a 100644 --- a/test/files/run/macro-reify-tagful-a/Macros_1.scala +++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala @@ -1,3 +1,4 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.{Context => Ctx} object Macros { @@ -5,7 +6,7 @@ object Macros { object Impls { def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify { - List(s.eval) + List(s.splice) } } } \ No newline at end of file diff --git a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala index 45e39d7d1c..3796ae99cb 100644 --- a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala @@ -5,7 +5,7 @@ object Macros { object Impls { def foo[T](c: Ctx)(s: c.Expr[T]) = c.reify { - List[T](s.eval) + List[T](s.splice) } } } \ No newline at end of file diff --git a/test/files/run/macro-reify-tagless-a/Test_2.scala b/test/files/run/macro-reify-tagless-a/Test_2.scala index 94efbd0c37..7029e59ea1 100644 --- a/test/files/run/macro-reify-tagless-a/Test_2.scala +++ b/test/files/run/macro-reify-tagless-a/Test_2.scala @@ -2,11 +2,13 @@ object Test extends App { //val list: List[String] = Macros.foo("hello world") //println(list) - import scala.reflect.mirror._ + 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("Macros"), newTermName("foo")), List(Literal(Constant("hello world")))) val list = ValDef(NoMods, newTermName("list"), tpt, rhs) val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name)))) - try Expr(tree).eval + try cm.mkToolBox().runExpr(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-reify-typetag-notypeparams/Test.scala b/test/files/run/macro-reify-typetag-notypeparams/Test.scala index 041a44273d..be9feac4ca 100644 --- a/test/files/run/macro-reify-typetag-notypeparams/Test.scala +++ b/test/files/run/macro-reify-typetag-notypeparams/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { println(implicitly[TypeTag[Int]]) diff --git a/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala b/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala index a89499e7fe..6d849cde3f 100644 --- a/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala +++ b/test/files/run/macro-reify-typetag-typeparams-notags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooNoTypeTag[T] = { diff --git a/test/files/run/macro-reify-typetag-typeparams-tags.check b/test/files/run/macro-reify-typetag-typeparams-tags.check index 458593c449..5fd767d565 100644 --- a/test/files/run/macro-reify-typetag-typeparams-tags.check +++ b/test/files/run/macro-reify-typetag-typeparams-tags.check @@ -1,2 +1,2 @@ ConcreteTypeTag[Int] -*ConcreteTypeTag[List[Int]] +TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala b/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala index b32680a4b8..be0ce33e41 100644 --- a/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala +++ b/test/files/run/macro-reify-typetag-typeparams-tags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTag[T: TypeTag] = { diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag.check b/test/files/run/macro-reify-typetag-usegroundtypetag.check index 458593c449..5fd767d565 100644 --- a/test/files/run/macro-reify-typetag-usegroundtypetag.check +++ b/test/files/run/macro-reify-typetag-usegroundtypetag.check @@ -1,2 +1,2 @@ ConcreteTypeTag[Int] -*ConcreteTypeTag[List[Int]] +TypeTag[List[Int]] diff --git a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala index de235f51cc..6363c5d472 100644 --- a/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala +++ b/test/files/run/macro-reify-typetag-usegroundtypetag/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTag[T: ConcreteTypeTag] = { diff --git a/test/files/run/macro-reify-unreify.check b/test/files/run/macro-reify-unreify.check index a5334cc355..8f8d9d944d 100644 --- a/test/files/run/macro-reify-unreify.check +++ b/test/files/run/macro-reify-unreify.check @@ -1 +1 @@ -hello world = Expr[String("hello world")]("hello world") +hello world = Expr[java.lang.String("hello world")]("hello world") diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala index 1b0b9c6421..14777506d3 100644 --- a/test/files/run/macro-reify-unreify/Macros_1.scala +++ b/test/files/run/macro-reify-unreify/Macros_1.scala @@ -5,14 +5,14 @@ object Macros { object Impls { def foo(c: Ctx)(s: c.Expr[String]) = { - import c.mirror._ + import c.universe._ - val world = c.reifyTree(c.reflectMirrorPrefix, s.tree) - val greeting = c.reifyTree(c.reflectMirrorPrefix, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) - val typedGreeting = Expr[String](greeting) + val world = c.reifyTree(c.runtimeUniverse, EmptyTree, s.tree) + val greeting = c.reifyTree(c.runtimeUniverse, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) + val typedGreeting = c.Expr[String](greeting) c.reify { - println("hello " + s.eval + " = " + typedGreeting.eval) + println("hello " + s.splice + " = " + typedGreeting.splice) } } } diff --git a/test/files/run/macro-reify-value-outside-reify.check b/test/files/run/macro-reify-value-outside-reify.check deleted file mode 100644 index 2f562a182f..0000000000 --- a/test/files/run/macro-reify-value-outside-reify.check +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/files/run/macro-reify-value-outside-reify.flags b/test/files/run/macro-reify-value-outside-reify.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-reify-value-outside-reify.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros \ No newline at end of file diff --git a/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala deleted file mode 100644 index 109e19e44a..0000000000 --- a/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.makro.{Context => Ctx} - -object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = { - val x1 = c.Expr[Int](c.resetAllAttrs(x.tree)) - c.literal(x1.value) - } -} - -object Macros { - def foo(x: Int) = macro Impls.foo -} diff --git a/test/files/run/macro-reify-value-outside-reify/Test_2.scala b/test/files/run/macro-reify-value-outside-reify/Test_2.scala deleted file mode 100644 index 128cad4510..0000000000 --- a/test/files/run/macro-reify-value-outside-reify/Test_2.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test extends App { - import scala.reflect.mirror._ - val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) - try println(Expr(tree).eval) - catch { case ex: Throwable => println(ex.getMessage) } -} diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index 9e0f9aa1a2..dc65e5c55b 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -1,54 +1,54 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> - -scala> import language.experimental.macros -import language.experimental.macros - -scala> import scala.reflect.makro.{Context => Ctx} -import scala.reflect.makro.{Context=>Ctx} - -scala> - -scala> object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - Expr[Int](body) - } - - def bar(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - Expr[Int](body) - } - - def quux(c: Ctx)(x: c.Expr[Int]) = { - import c.mirror._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - Expr[Int](body) - } -} -defined module Impls - -scala> object Macros { - object Shmacros { - def 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 module 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> +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import language.experimental.macros +import language.experimental.macros + +scala> import scala.reflect.makro.{Context => Ctx} +import scala.reflect.makro.{Context=>Ctx} + +scala> + +scala> object Impls { + def foo(c: Ctx)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + c.Expr[Int](body) + } + + def bar(c: Ctx)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + c.Expr[Int](body) + } + + def quux(c: Ctx)(x: c.Expr[Int]) = { + import c.universe._ + val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + c.Expr[Int](body) + } +} +defined module 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 module 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> diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala index e8849b4b56..fba0aab116 100644 --- a/test/files/run/macro-repl-basic.scala +++ b/test/files/run/macro-repl-basic.scala @@ -7,21 +7,21 @@ object Test extends ReplTest { | |object Impls { | def foo(c: Ctx)(x: c.Expr[Int]) = { - | import c.mirror._ + | import c.universe._ | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) - | Expr[Int](body) + | c.Expr[Int](body) | } | | def bar(c: Ctx)(x: c.Expr[Int]) = { - | import c.mirror._ + | import c.universe._ | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) - | Expr[Int](body) + | c.Expr[Int](body) | } | | def quux(c: Ctx)(x: c.Expr[Int]) = { - | import c.mirror._ + | import c.universe._ | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) - | Expr[Int](body) + | c.Expr[Int](body) | } |} |object Macros { diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala index 8c7254c79a..56e28b506c 100644 --- a/test/files/run/macro-settings/Impls_Macros_1.scala +++ b/test/files/run/macro-settings/Impls_Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.makro.Context object Impls { def impl(c: Context) = c.reify { - println(c.literal(c.settings.toString).eval) + println(c.literal(c.settings.toString).splice) } } diff --git a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala index e8f6e1df85..994421808e 100644 --- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala @@ -2,16 +2,16 @@ import scala.reflect.makro.Context object Macros { def impl(c: Context) = { - import c.mirror._ + import c.universe._ - val inscope = c.inferImplicitValue(staticClass("SourceLocation").asType) - val outer = Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null))) + val inscope = c.inferImplicitValue(c.mirror.staticClass("SourceLocation").asType) + val outer = c.Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null))) val Apply(fun, args) = c.enclosingImplicits(0)._2 val fileName = fun.pos.fileInfo.getName val line = fun.pos.line val charOffset = fun.pos.point - c.reify { SourceLocation1(outer.eval, c.literal(fileName).eval, c.literal(line).eval, c.literal(charOffset).eval) } + c.reify { SourceLocation1(outer.splice, c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } } implicit def sourceLocation: SourceLocation1 = macro impl @@ -31,4 +31,4 @@ trait SourceLocation { val charOffset: Int } -case class SourceLocation1(val outer: SourceLocation, val fileName: String, val line: Int, val charOffset: Int) extends SourceLocation +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/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala index 39b29ad64c..c006ceb691 100644 --- a/test/files/run/macro-sip19/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19/Impls_Macros_1.scala @@ -2,12 +2,12 @@ import scala.reflect.makro.Context object Macros { def impl(c: Context) = { - import c.mirror._ + import c.universe._ val Apply(fun, args) = c.enclosingImplicits(0)._2 val fileName = fun.pos.fileInfo.getName val line = fun.pos.line val charOffset = fun.pos.point - c.reify { SourceLocation(c.literal(fileName).eval, c.literal(line).eval, c.literal(charOffset).eval) } + c.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } } implicit def sourceLocation: SourceLocation = macro impl @@ -22,4 +22,4 @@ case class SourceLocation( /** The character offset */ val charOffset: Int -) +) \ No newline at end of file diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala index 4f0f76aed6..8ed435d629 100644 --- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.makro.Context object Macros { def impl_with_implicits_enabled(c: Context) = { - import c.mirror._ + import c.universe._ val tree1 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false) @@ -12,7 +12,7 @@ object Macros { def foo_with_implicits_enabled = macro impl_with_implicits_enabled def impl_with_implicits_disabled(c: Context) = { - import c.mirror._ + import c.universe._ try { val tree2 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index 3e1057520b..da1a28bc24 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -1,5 +1,37 @@ { - val $mr: reflect.mirror.type = scala.reflect.`package`.mirror; - $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.ConcreteTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)), classOf[scala.Int])) + 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 >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe]; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree] + }; + private def applyImpl[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#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 >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.ConstantType.apply($u.Constant.apply(2)) + } + }; + new $typecreator2() + })) } -mr.reify[Int](2) +ru.reify[Int](2) diff --git a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala index 3de9367994..2c9bce92a5 100644 --- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.Context object Macros { def impl_with_macros_enabled(c: Context) = { - import c.mirror._ + import c.universe._ - val mr = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("package")), newTermName("mirror")) - val tree1 = Apply(Select(mr, newTermName("reify")), List(Literal(Constant(2)))) + val ru = Select(Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("package")), newTermName("universe")) + val tree1 = Apply(Select(ru, newTermName("reify")), List(Literal(Constant(2)))) val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) c.literal(ttree1.toString) } @@ -13,14 +13,14 @@ object Macros { def foo_with_macros_enabled = macro impl_with_macros_enabled def impl_with_macros_disabled(c: Context) = { - import c.mirror._ + import c.universe._ - val mrPkg = staticModule("scala.reflect.package") - val mrSym = selectTerm(mrPkg, "mirror") - val NullaryMethodType(mrTpe) = mrSym.typeSignature - val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror) + val rupkg = c.mirror.staticModule("scala.reflect.runtime.package") + val rusym = build.selectTerm(rupkg, "universe") + val NullaryMethodType(rutpe) = rusym.typeSignature + val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe) - val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) c.literal(ttree2.toString) } diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 02da6ad0c7..e440b2c0cb 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -1,5 +1,37 @@ { - val $mr: reflect.mirror.type = scala.reflect.`package`.mirror; - $mr.Expr.apply[Array[Int]]($mr.Apply.apply($mr.Select.apply($mr.Select.apply($mr.Ident($mr.staticModule("scala")), $mr.newTermName("Array")), $mr.newTermName("apply")), scala.collection.immutable.List.apply[$mr.Literal]($mr.Literal.apply($mr.Constant.apply(2)))))($mr.ConcreteTypeTag.apply[Array[Int]]($mr.TypeRef.apply($mr.thisModuleType("scala"), $mr.staticClass("scala.Array"), scala.collection.immutable.List.apply[$mr.Type]($mr.staticClass("scala.Int").asTypeConstructor)), ScalaRunTime.this.arrayClass(classOf[scala.Int]))) + 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 >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe]; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree] + }; + private def applyImpl[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticModule("scala")), $u.newTermName("Array")), $u.newTermName("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 >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.TypeRef.apply($u.ThisType.apply($m.staticModule("scala").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor)) + } + }; + new $typecreator2() + })) } -mr.reify[Array[Int]](scala.Array.apply(2)) +ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala index 1b840a6204..0aca9781f4 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala @@ -2,10 +2,10 @@ import scala.reflect.makro.Context object Macros { def impl_with_macros_enabled(c: Context) = { - import c.mirror._ + import c.universe._ - val mr = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("package")), newTermName("mirror")) - val tree1 = Apply(Select(mr, newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val ru = Select(Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("package")), newTermName("universe")) + val tree1 = Apply(Select(ru, newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) c.literal(ttree1.toString) } @@ -13,17 +13,17 @@ object Macros { def foo_with_macros_enabled = macro impl_with_macros_enabled def impl_with_macros_disabled(c: Context) = { - import c.mirror._ + import c.universe._ - val mrPkg = staticModule("scala.reflect.package") - val mrSym = selectTerm(mrPkg, "mirror") - val NullaryMethodType(mrTpe) = mrSym.typeSignature - val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror) + val rupkg = c.mirror.staticModule("scala.reflect.runtime.package") + val rusym = build.selectTerm(rupkg, "universe") + val NullaryMethodType(rutpe) = rusym.typeSignature + val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe) - val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) c.literal(ttree2.toString) } def foo_with_macros_disabled = macro impl_with_macros_disabled -} \ No newline at end of file +} diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala index c22ff96028..bd3cd3009a 100644 --- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala @@ -1,13 +1,14 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.Context object Macros { def cons_impl[A: c.TypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.reify { - println("A = " + c.literal(implicitly[c.TypeTag[A]].toString).eval) - x.eval :: xs.eval + println("A = " + c.literal(implicitly[c.TypeTag[A]].toString).splice) + x.splice :: xs.splice } def nil_impl[B: c.TypeTag](c: Context): c.Expr[List[B]] = c.reify { - println("B = " + c.literal(implicitly[c.TypeTag[B]].toString).eval) + println("B = " + c.literal(implicitly[c.TypeTag[B]].toString).splice) Nil } diff --git a/test/files/run/macro-undetparams-implicitval/Test.scala b/test/files/run/macro-undetparams-implicitval/Test.scala index 5278295451..72fd2f3d72 100644 --- a/test/files/run/macro-undetparams-implicitval/Test.scala +++ b/test/files/run/macro-undetparams-implicitval/Test.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { def foo[T: TypeTag] = println(implicitly[TypeTag[T]]) foo diff --git a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala index 9d65e8b0da..9b1dd8e017 100644 --- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala @@ -1,7 +1,8 @@ +import scala.reflect.runtime.universe._ import scala.reflect.makro.Context object Macros { - def impl[T: c.TypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.reify { println(c.literal(implicitly[c.TypeTag[T]].toString).eval) } + def impl[T: c.TypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.reify { println(c.literal(implicitly[c.TypeTag[T]].toString).splice) } def foo[T](foo: T) = macro impl[T] } \ No newline at end of file diff --git a/test/files/run/manifests-new.scala b/test/files/run/manifests-new.scala index 4485ce9124..f1596dee81 100644 --- a/test/files/run/manifests-new.scala +++ b/test/files/run/manifests-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { object Variances extends Enumeration { @@ -54,15 +56,15 @@ object Test } def assertAnyRef[T: TypeTag] = List( - typeTag[T].tpe <:< typeTag[Any].tpe, - typeTag[T].tpe <:< typeTag[AnyRef].tpe, - !(typeTag[T].tpe <:< typeTag[AnyVal].tpe) + typeOf[T] <:< typeOf[Any], + typeOf[T] <:< typeOf[AnyRef], + !(typeOf[T] <:< typeOf[AnyVal]) ) foreach (assert(_, "assertAnyRef")) def assertAnyVal[T: TypeTag] = List( - typeTag[T].tpe <:< typeTag[Any].tpe, - !(typeTag[T].tpe <:< typeTag[AnyRef].tpe), - typeTag[T].tpe <:< typeTag[AnyVal].tpe + typeOf[T] <:< typeOf[Any], + !(typeOf[T] <:< typeOf[AnyRef]), + typeOf[T] <:< typeOf[AnyVal] ) foreach (assert(_, "assertAnyVal")) def assertSameType[T: TypeTag, U: TypeTag] = assert(typeCompare[T, U] == SAME, "assertSameType") @@ -144,4 +146,4 @@ object Test } def main(args: Array[String]): Unit = runAllTests -} +} \ No newline at end of file diff --git a/test/files/run/newTags.check b/test/files/run/newTags.check new file mode 100644 index 0000000000..3ef7254f87 --- /dev/null +++ b/test/files/run/newTags.check @@ -0,0 +1,5 @@ +TypeRef(ThisType(class immutable),class List,List(TypeRef(ThisType(class scala),class Int,List()))) +List[Int] +TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List()))) +scala.collection.immutable.Map[java.lang.String,java.lang.String] +ConcreteTypeTag[TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List())))] diff --git a/test/files/run/newTags.scala b/test/files/run/newTags.scala new file mode 100644 index 0000000000..a758599515 --- /dev/null +++ b/test/files/run/newTags.scala @@ -0,0 +1,14 @@ +import scala.reflect.base.{Universe => BaseUniverse} +import scala.reflect.{basis => rb} +import scala.reflect.runtime.{universe => ru} + +object Test extends App { + println(rb.typeOf[List[Int]]) + println(ru.typeOf[List[Int]]) + def foo[T: rb.TypeTag] = { + println(rb.typeOf[T]) + println(ru.typeOf[T]) + println(implicitly[BaseUniverse#TypeTag[T]]) + } + foo[Map[String, String]] +} \ No newline at end of file diff --git a/test/files/run/primitive-sigs-2-new.scala b/test/files/run/primitive-sigs-2-new.scala index 7e13014cb2..ef87a11a61 100644 --- a/test/files/run/primitive-sigs-2-new.scala +++ b/test/files/run/primitive-sigs-2-new.scala @@ -1,3 +1,4 @@ +import scala.reflect.{ArrayTag, arrayTag} import java.{ lang => jl } trait T[A] { @@ -28,4 +29,4 @@ object Test { println(new C f) c3m.sorted foreach println } -} +} \ No newline at end of file diff --git a/test/files/run/reflect-overload.scala b/test/files/run/reflect-overload.scala index af82a1948d..ea3767903c 100644 --- a/test/files/run/reflect-overload.scala +++ b/test/files/run/reflect-overload.scala @@ -1,16 +1,19 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + object Test extends App { - import reflect.mirror._ val s = "hello world" - val sc = symbolOfInstance(s) + val m = cm.reflect(s) + val sc = m.reflectClass.symbol val st = sc.asType - val m = st member newTermName("indexOf") + val meth = (st member newTermName("indexOf")).asTermSymbol val IntType = definitions.IntClass.asType - val indexOf = m resolveOverloaded(actuals = List(IntType)) - assert(invoke(s, indexOf)('w') == 6) - assert((invoke(s, indexOf)('w') match { case x: Int => x }) == 6) + val indexOf = (meth resolveOverloaded(actuals = List(IntType))).asMethodSymbol + assert(m.reflectMethod(indexOf)('w') == 6) + assert((m.reflectMethod(indexOf)('w') match { case x: Int => x }) == 6) - val m2 = st member newTermName("substring") - val substring = m2 resolveOverloaded(actuals = List(IntType, IntType)) - assert(invoke(s, substring)(2, 6) == "llo ") + val meth2 = (st member newTermName("substring")).asTermSymbol + val substring = (meth2 resolveOverloaded(actuals = List(IntType, IntType))).asMethodSymbol + assert(m.reflectMethod(substring)(2, 6) == "llo ") } diff --git a/test/files/run/reflection-implClass-new.scala b/test/files/run/reflection-implClass-new.scala deleted file mode 100644 index 27374f2106..0000000000 --- a/test/files/run/reflection-implClass-new.scala +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Tries to load a symbol for the `Foo$class` using Scala reflection. - * Since trait implementation classes do not get pickling information - * symbol for them should be created using fallback mechanism - * that exposes Java reflection information dressed up in - * a Scala symbol. - */ -object Test extends App with Outer { - import scala.reflect.mirror - - assert(mirror.classToSymbol(classTag[Foo].erasure).typeSignature.declaration(mirror.newTermName("bar")).typeSignature == - mirror.classToSymbol(classTag[Bar].erasure).typeSignature.declaration(mirror.newTermName("foo")).typeSignature) - - val s1 = implClass(classTag[Foo].erasure) - assert(s1 != mirror.NoSymbol) - assert(s1.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature.declaration(mirror.newTermName("bar")) != mirror.NoSymbol) - val s2 = implClass(classTag[Bar].erasure) - assert(s2 != mirror.NoSymbol) - assert(s2.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature.declaration(mirror.newTermName("foo")) != mirror.NoSymbol) - def implClass(clazz: Class[_]) = { - val implClass = Class.forName(clazz.getName + "$class") - mirror.classToSymbol(implClass) - } -} - -trait Foo { - def bar = 1 -} - -trait Outer { - trait Bar { - def foo = 1 - } -} diff --git a/test/files/run/reflection-implClass-old.scala b/test/files/run/reflection-implClass-old.scala deleted file mode 100644 index 6583624d8b..0000000000 --- a/test/files/run/reflection-implClass-old.scala +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Tries to load a symbol for the `Foo$class` using Scala reflection. - * Since trait implementation classes do not get pickling information - * symbol for them should be created using fallback mechanism - * that exposes Java reflection information dressed up in - * a Scala symbol. - */ -object Test extends App with Outer { - import scala.reflect.mirror - - assert(mirror.classToSymbol(manifest[Foo].erasure).typeSignature.declaration(mirror.newTermName("bar")).typeSignature == - mirror.classToSymbol(manifest[Bar].erasure).typeSignature.declaration(mirror.newTermName("foo")).typeSignature) - - val s1 = implClass(manifest[Foo].erasure) - assert(s1 != mirror.NoSymbol) - assert(s1.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature.declaration(mirror.newTermName("bar")) != mirror.NoSymbol) - val s2 = implClass(manifest[Bar].erasure) - assert(s2 != mirror.NoSymbol) - assert(s2.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature.declaration(mirror.newTermName("foo")) != mirror.NoSymbol) - def implClass(clazz: Class[_]) = { - val implClass = Class.forName(clazz.getName + "$class") - mirror.classToSymbol(implClass) - } -} - -trait Foo { - def bar = 1 -} - -trait Outer { - trait Bar { - def foo = 1 - } -} diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala new file mode 100644 index 0000000000..91288562f4 --- /dev/null +++ b/test/files/run/reflection-implClass.scala @@ -0,0 +1,40 @@ +/** + * Tries to load a symbol for the `Foo$class` using Scala reflection. + * Since trait implementation classes do not get pickling information + * symbol for them should be created using fallback mechanism + * that exposes Java reflection information dressed up in + * a Scala symbol. + */ +object Test extends App with Outer { + import scala.reflect.{ClassTag, classTag} + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + + assert(cm.reflectClass(classTag[Foo].runtimeClass).symbol.typeSignature.declaration(newTermName("bar")).typeSignature == + cm.reflectClass(classTag[Bar].runtimeClass).symbol.typeSignature.declaration(newTermName("foo")).typeSignature) + + val s1 = implClass(classTag[Foo].runtimeClass) + assert(s1 != NoSymbol) + assert(s1.typeSignature != NoType) + assert(s1.companionSymbol.typeSignature != NoType) + assert(s1.companionSymbol.typeSignature.declaration(newTermName("bar")) != NoSymbol) + val s2 = implClass(classTag[Bar].runtimeClass) + assert(s2 != NoSymbol) + assert(s2.typeSignature != NoType) + assert(s2.companionSymbol.typeSignature != NoType) + assert(s2.companionSymbol.typeSignature.declaration(newTermName("foo")) != NoSymbol) + def implClass(clazz: Class[_]) = { + val implClass = Class.forName(clazz.getName + "$class") + cm.reflectClass(implClass).symbol + } +} + +trait Foo { + def bar = 1 +} + +trait Outer { + trait Bar { + def foo = 1 + } +} diff --git a/test/files/run/reflection-repl.check b/test/files/run/reflection-repl.check new file mode 100644 index 0000000000..e93fb6d6e7 --- /dev/null +++ b/test/files/run/reflection-repl.check @@ -0,0 +1,9 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> scala.reflect.runtime.universe.typeOf[List[Nothing]] +res0: reflect.runtime.universe.Type = List[Nothing] + +scala> diff --git a/test/files/run/reflection-repl.scala b/test/files/run/reflection-repl.scala new file mode 100644 index 0000000000..72b65a1a70 --- /dev/null +++ b/test/files/run/reflection-repl.scala @@ -0,0 +1,7 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |scala.reflect.runtime.universe.typeOf[List[Nothing]] + |""".stripMargin +} diff --git a/test/files/run/reflection-simple.scala b/test/files/run/reflection-simple.scala index fb3feec3cb..152d8c4505 100644 --- a/test/files/run/reflection-simple.scala +++ b/test/files/run/reflection-simple.scala @@ -5,7 +5,8 @@ object Test { def main(args: Array[String]) { System.out.println("Running") case class Foo(a: Int, b: Int, c: Int) - val props = reflect.mirror.classToType(classOf[Foo]).members.filter(_.isTerm).map(_.toString) + import scala.reflect.runtime.{currentMirror => cm} + val props = cm.reflectClass(classOf[Foo]).symbol.typeSignature.members.filter(_.isTerm).map(_.toString) props.toList.sorted foreach System.out.println } } diff --git a/test/files/run/reflinit.check b/test/files/run/reflinit.check new file mode 100644 index 0000000000..a9df3544ac --- /dev/null +++ b/test/files/run/reflinit.check @@ -0,0 +1 @@ +List[Int] diff --git a/test/files/run/reflinit.scala b/test/files/run/reflinit.scala new file mode 100644 index 0000000000..6d3ba3a4df --- /dev/null +++ b/test/files/run/reflinit.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + val tt2 = typeOf[List[Int]] + println(tt2) +} \ No newline at end of file diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index 680db12667..5a97983e54 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -1,21 +1,21 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> - -scala> import language.experimental.macros -import language.experimental.macros - -scala> import scala.reflect.mirror._ -import scala.reflect.mirror._ - -scala> - -scala> reify -:12: error: macros cannot be partially applied - reify - ^ - -scala> - -scala> +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +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: macros cannot be partially applied + reify + ^ + +scala> + +scala> diff --git a/test/files/run/reify-repl-fail-gracefully.scala b/test/files/run/reify-repl-fail-gracefully.scala index d7a06e8da8..ed6d6cb6c9 100644 --- a/test/files/run/reify-repl-fail-gracefully.scala +++ b/test/files/run/reify-repl-fail-gracefully.scala @@ -3,7 +3,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ |import language.experimental.macros - |import scala.reflect.mirror._ + |import scala.reflect.runtime.universe._ | |reify """.stripMargin diff --git a/test/files/run/reify_ann1a.check b/test/files/run/reify_ann1a.check index a3944ae1ee..9df18b2362 100644 --- a/test/files/run/reify_ann1a.check +++ b/test/files/run/reify_ann1a.check @@ -14,15 +14,15 @@ () } { - @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends Object { - @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _; - def (@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = { + @ann(immutable.this.List.apply[java.lang.String]("1a")) @ann(immutable.this.List.apply[java.lang.String]("1b")) class C[@ann(immutable.this.List.apply[java.lang.String]("2a")) @ann(immutable.this.List.apply[java.lang.String]("2b")) T] extends Object { + @ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) private[this] val x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a")) = _; + def (@ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a"))): C[T] = { C.super.(); () }; - @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = { - @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a"))); - val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a"))); + @ann(immutable.this.List.apply[java.lang.String]("5a")) @ann(immutable.this.List.apply[java.lang.String]("5b")) def f(x: Int @ann(immutable.this.List.apply[java.lang.String]("6b")) @ann(immutable.this.List.apply[java.lang.String]("6a"))): Int = { + @ann(immutable.this.List.apply[java.lang.String]("7a")) @ann(immutable.this.List.apply[java.lang.String]("7b")) val r: Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[java.lang.String]("8a"))): Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a"))); + val s: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")) = (4: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a"))); r.+(s) } }; diff --git a/test/files/run/reify_ann1a.scala b/test/files/run/reify_ann1a.scala index 6c062ca2c2..9f994fb2eb 100644 --- a/test/files/run/reify_ann1a.scala +++ b/test/files/run/reify_ann1a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 @@ -16,7 +19,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_ann1b.scala b/test/files/run/reify_ann1b.scala index 4faddef72c..3e0d3e0802 100644 --- a/test/files/run/reify_ann1b.scala +++ b/test/files/run/reify_ann1b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 @@ -16,7 +19,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_ann2a.check b/test/files/run/reify_ann2a.check index 5022c50ca8..bb30441f8c 100644 --- a/test/files/run/reify_ann2a.check +++ b/test/files/run/reify_ann2a.check @@ -22,21 +22,21 @@ } { class ann extends scala.annotation.Annotation with scala.annotation.StaticAnnotation { - private[this] val bar: List[String] = _; - def (bar: List[String]): ann = { + private[this] val bar: List[java.lang.String] = _; + def (bar: List[java.lang.String]): ann = { ann.super.(); () } }; - @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends Object { - @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _; - def (@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = { + @ann(immutable.this.List.apply[java.lang.String]("1a")) @ann(immutable.this.List.apply[java.lang.String]("1b")) class C[@ann(immutable.this.List.apply[java.lang.String]("2a")) @ann(immutable.this.List.apply[java.lang.String]("2b")) T] extends Object { + @ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) private[this] val x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a")) = _; + def (@ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a"))): C[T] = { C.super.(); () }; - @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = { - @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a"))); - val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a"))); + @ann(immutable.this.List.apply[java.lang.String]("5a")) @ann(immutable.this.List.apply[java.lang.String]("5b")) def f(x: Int @ann(immutable.this.List.apply[java.lang.String]("6b")) @ann(immutable.this.List.apply[java.lang.String]("6a"))): Int = { + @ann(immutable.this.List.apply[java.lang.String]("7a")) @ann(immutable.this.List.apply[java.lang.String]("7b")) val r: Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[java.lang.String]("8a"))): Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a"))); + val s: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")) = (4: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a"))); r.+(s) } }; diff --git a/test/files/run/reify_ann2a.scala b/test/files/run/reify_ann2a.scala index a1723c221d..63a17ee192 100644 --- a/test/files/run/reify_ann2a.scala +++ b/test/files/run/reify_ann2a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { // test 1: reify @@ -16,7 +19,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_ann3.scala b/test/files/run/reify_ann3.scala index d65e641619..dbb6a1b443 100644 --- a/test/files/run/reify_ann3.scala +++ b/test/files/run/reify_ann3.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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._ @@ -10,10 +13,10 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) // test 3: import and compile toolbox.runExpr(tree) -} +} \ No newline at end of file diff --git a/test/files/run/reify_ann4.scala b/test/files/run/reify_ann4.scala index 5655812689..b4845d1586 100644 --- a/test/files/run/reify_ann4.scala +++ b/test/files/run/reify_ann4.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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._ @@ -14,10 +17,10 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) // test 3: import and compile toolbox.runExpr(tree) -} +} \ No newline at end of file diff --git a/test/files/run/reify_ann5.scala b/test/files/run/reify_ann5.scala index aecc61de46..0ae8d317ce 100644 --- a/test/files/run/reify_ann5.scala +++ b/test/files/run/reify_ann5.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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._ @@ -11,10 +14,10 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) // test 3: import and compile toolbox.runExpr(tree) -} +} \ No newline at end of file diff --git a/test/files/run/reify_anonymous.scala b/test/files/run/reify_anonymous.scala index cd740f0190..d743014dfd 100644 --- a/test/files/run/reify_anonymous.scala +++ b/test/files/run/reify_anonymous.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { println(new {def x = 2; def y = x * x}.y) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_classfileann_a.scala b/test/files/run/reify_classfileann_a.scala index 9aec69b4a3..0abb7b8154 100644 --- a/test/files/run/reify_classfileann_a.scala +++ b/test/files/run/reify_classfileann_a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 @@ -10,7 +13,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_classfileann_b.scala b/test/files/run/reify_classfileann_b.scala index a37f20e72e..5ceb652a8b 100644 --- a/test/files/run/reify_classfileann_b.scala +++ b/test/files/run/reify_classfileann_b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 @@ -14,7 +17,7 @@ object Test extends App { println(tree.toString) // test 2: import and typecheck - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(tree) println(ttree.toString) diff --git a/test/files/run/reify_closure1.scala b/test/files/run/reify_closure1.scala index 3f5c8a8724..ce68975acc 100644 --- a/test/files/run/reify_closure1.scala +++ b/test/files/run/reify_closure1.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { def foo[T](ys: List[T]): Int => Int = { @@ -6,11 +9,11 @@ object Test extends App { x }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(List(1, 2, 3))(10)) println(foo(List(1, 2, 3, 4))(10)) -} +} \ No newline at end of file diff --git a/test/files/run/reify_closure2a.scala b/test/files/run/reify_closure2a.scala index f5669a0e2c..cb53e7ffa8 100644 --- a/test/files/run/reify_closure2a.scala +++ b/test/files/run/reify_closure2a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { def foo(y: Int): Int => Int = { @@ -6,11 +9,11 @@ object Test extends App { x + y }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +} \ No newline at end of file diff --git a/test/files/run/reify_closure3a.scala b/test/files/run/reify_closure3a.scala index 056a705d7d..cf8c161afa 100644 --- a/test/files/run/reify_closure3a.scala +++ b/test/files/run/reify_closure3a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { def foo(y: Int): Int => Int = { @@ -8,11 +11,11 @@ object Test extends App { x + y1 }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +} \ No newline at end of file diff --git a/test/files/run/reify_closure4a.scala b/test/files/run/reify_closure4a.scala index a63d20e561..1521295f16 100644 --- a/test/files/run/reify_closure4a.scala +++ b/test/files/run/reify_closure4a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { def foo(y: Int): Int => Int = { @@ -8,11 +11,11 @@ object Test extends App { x + y1 }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +} \ No newline at end of file diff --git a/test/files/run/reify_closure5a.scala b/test/files/run/reify_closure5a.scala index 2e8b413f4c..84c2c08727 100644 --- a/test/files/run/reify_closure5a.scala +++ b/test/files/run/reify_closure5a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { def foo[T: TypeTag](ys: List[T]): Int => Int = { @@ -6,7 +9,7 @@ object Test extends App { x + ys.length }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } @@ -15,4 +18,4 @@ object Test extends App { println(fun1(10)) var fun2 = foo(List(1, 2, 3, 4)) println(fun2(10)) -} +} \ No newline at end of file diff --git a/test/files/run/reify_closure6.scala b/test/files/run/reify_closure6.scala index 2cbd4ce819..d007e80899 100644 --- a/test/files/run/reify_closure6.scala +++ b/test/files/run/reify_closure6.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { var q = 0 @@ -13,7 +16,7 @@ object Test extends App { x + ys.length * z + q + y }} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) dyn.asInstanceOf[Int => Int] } diff --git a/test/files/run/reify_closure7.scala b/test/files/run/reify_closure7.scala index b9f87dbdeb..3d4956a724 100644 --- a/test/files/run/reify_closure7.scala +++ b/test/files/run/reify_closure7.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { var q = 0 @@ -15,7 +18,7 @@ object Test extends App { }} if (clo == null) { - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun.tree) clo = dyn.asInstanceOf[Int => Int] } @@ -27,4 +30,4 @@ object Test extends App { println("first invocation = " + fun1(10)) val fun2 = foo(List(1, 2, 3, 4)) println("second invocation = " + fun2(10)) -} +} \ No newline at end of file diff --git a/test/files/run/reify_closure8a.scala b/test/files/run/reify_closure8a.scala index 9de121b42f..8db3d38241 100644 --- a/test/files/run/reify_closure8a.scala +++ b/test/files/run/reify_closure8a.scala @@ -1,12 +1,15 @@ -import scala.reflect.mirror._ +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 App { class Foo(val y: Int) { def fun = reify{y} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(new Foo(10).fun.tree) val foo = dyn.asInstanceOf[Int] println(foo) -} +} \ No newline at end of file diff --git a/test/files/run/reify_closure8b.check b/test/files/run/reify_closure8b.check index e0ec7d2c8f..585e6d5740 100644 --- a/test/files/run/reify_closure8b.check +++ b/test/files/run/reify_closure8b.check @@ -1,3 +1,3 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective compilation has failed: +scala.tools.reflect.ToolBoxError: reflective compilation has failed: value y is not a member of Test.Foo diff --git a/test/files/run/reify_closure8b.scala b/test/files/run/reify_closure8b.scala index 431da3230e..9cdc0e997f 100644 --- a/test/files/run/reify_closure8b.scala +++ b/test/files/run/reify_closure8b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { // will fail because y is a private field @@ -8,11 +11,11 @@ object Test extends App { } try { - val dyn = mkToolBox().runExpr(new Foo(10).fun.tree) + val dyn = cm.mkToolBox().runExpr(new Foo(10).fun.tree) val foo = dyn.asInstanceOf[Int] println(foo) } catch { case ex: Throwable => println(ex) } -} +} \ No newline at end of file diff --git a/test/files/run/reify_closures10.scala b/test/files/run/reify_closures10.scala index 0ccce77a94..2d9b833851 100644 --- a/test/files/run/reify_closures10.scala +++ b/test/files/run/reify_closures10.scala @@ -1,10 +1,13 @@ -import scala.reflect.mirror._ +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 App { val x = 2 val y = 3 val code = reify{println(x + y); x + y} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(toolbox.runExpr(code.tree)) -} +} \ No newline at end of file diff --git a/test/files/run/reify_complex.scala b/test/files/run/reify_complex.scala index ecc25ffca5..4abec3900e 100644 --- a/test/files/run/reify_complex.scala +++ b/test/files/run/reify_complex.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -21,4 +22,4 @@ object Test extends App { val x = new Complex(2, 1); val y = new Complex(1, 3) println(x + y) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_copypaste1.check b/test/files/run/reify_copypaste1.check new file mode 100644 index 0000000000..49a25ea881 --- /dev/null +++ b/test/files/run/reify_copypaste1.check @@ -0,0 +1,2 @@ +List(1, 2) + diff --git a/test/files/run/reify_copypaste1.scala b/test/files/run/reify_copypaste1.scala new file mode 100644 index 0000000000..7eaa4fa7b5 --- /dev/null +++ b/test/files/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 App { + 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), newTermName("reflect")), newTermName("runtime")), newTermName("universe")), newTermName("reify")) + val reifee = Block(List(ValDef(Modifiers(LAZY), newTermName("x"), TypeTree(), Apply(Ident(ListModule), List(Literal(Constant(1)), Literal(Constant(2)))))), Ident(newTermName("x"))) + toolBox.runExpr(Apply(reify, List(reifee))) + val Block(List(tpeCopypaste), exprCopypaste @ ModuleDef(_, _, Template(_, _, (_ :: stats) :+ expr))) = toolBox.parseExpr(output.toString()) + output.reset() + toolBox.runExpr(Block(stats, expr)) + stdout.println(output.toString) +} \ No newline at end of file diff --git a/test/files/run/reify_copypaste2.check b/test/files/run/reify_copypaste2.check new file mode 100644 index 0000000000..9c34f5179b --- /dev/null +++ b/test/files/run/reify_copypaste2.check @@ -0,0 +1 @@ +scala.reflect.runtime.`package`.universe.reify(Test.this.x) diff --git a/test/files/run/reify_copypaste2.scala b/test/files/run/reify_copypaste2.scala new file mode 100644 index 0000000000..12d08cf244 --- /dev/null +++ b/test/files/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 App { + val x = 2 + val outer = reify{reify{x}} + println(outer.tree) +} \ No newline at end of file diff --git a/test/files/run/reify_csv.scala b/test/files/run/reify_csv.scala index 966521575c..c35624469c 100644 --- a/test/files/run/reify_csv.scala +++ b/test/files/run/reify_csv.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { val csv = """ diff --git a/test/files/run/reify_extendbuiltins.scala b/test/files/run/reify_extendbuiltins.scala index f95e9ab6ec..a2d546579d 100644 --- a/test/files/run/reify_extendbuiltins.scala +++ b/test/files/run/reify_extendbuiltins.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -11,4 +12,4 @@ object Test extends App { println("10! = " + (10!)) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_for1.scala b/test/files/run/reify_for1.scala index 9d1e32f7e5..e1f5347572 100644 --- a/test/files/run/reify_for1.scala +++ b/test/files/run/reify_for1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -6,4 +7,4 @@ object Test extends App { val sumOfSquares2 = (1 to 100).filter(_ % 3 == 0).map(Math.pow(_, 2)).sum assert(sumOfSquares1 == sumOfSquares2) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_fors.check b/test/files/run/reify_fors.check deleted file mode 100644 index eefddedc20..0000000000 --- a/test/files/run/reify_fors.check +++ /dev/null @@ -1,5 +0,0 @@ -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/test/files/run/reify_fors.flags b/test/files/run/reify_fors.flags deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/files/run/reify_fors.scala b/test/files/run/reify_fors.scala deleted file mode 100644 index 635fce049e..0000000000 --- a/test/files/run/reify_fors.scala +++ /dev/null @@ -1,100 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - 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/test/files/run/reify_fors_newpatmat.check b/test/files/run/reify_fors_newpatmat.check new file mode 100644 index 0000000000..eefddedc20 --- /dev/null +++ b/test/files/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/test/files/run/reify_fors_newpatmat.scala b/test/files/run/reify_fors_newpatmat.scala new file mode 100644 index 0000000000..6bee9538a8 --- /dev/null +++ b/test/files/run/reify_fors_newpatmat.scala @@ -0,0 +1,101 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + 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 +} \ No newline at end of file diff --git a/test/files/run/reify_fors_oldpatmat.check b/test/files/run/reify_fors_oldpatmat.check new file mode 100644 index 0000000000..eefddedc20 --- /dev/null +++ b/test/files/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/test/files/run/reify_fors_oldpatmat.flags b/test/files/run/reify_fors_oldpatmat.flags new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/reify_fors_oldpatmat.scala b/test/files/run/reify_fors_oldpatmat.scala new file mode 100644 index 0000000000..6bee9538a8 --- /dev/null +++ b/test/files/run/reify_fors_oldpatmat.scala @@ -0,0 +1,101 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + 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 +} \ No newline at end of file diff --git a/test/files/run/reify_generic.scala b/test/files/run/reify_generic.scala index 7033c4e237..7baffac6a3 100644 --- a/test/files/run/reify_generic.scala +++ b/test/files/run/reify_generic.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { val product = List(1, 2, 3).head * List[Any](4, 2, 0).head.asInstanceOf[Int] println(product) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_generic2.scala b/test/files/run/reify_generic2.scala index 8f9def318e..36ab61e077 100644 --- a/test/files/run/reify_generic2.scala +++ b/test/files/run/reify_generic2.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -6,4 +7,4 @@ object Test extends App { val product = List(new C, new C).length * List[C](new C, new C).length println(product) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_getter.scala b/test/files/run/reify_getter.scala index 8bae293e72..26767603a0 100644 --- a/test/files/run/reify_getter.scala +++ b/test/files/run/reify_getter.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -9,7 +12,7 @@ object Test extends App { new C().x } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala index 69198391d1..d203fe2001 100644 --- a/test/files/run/reify_implicits-new.scala +++ b/test/files/run/reify_implicits-new.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.{ArrayTag, arrayTag} +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -11,4 +13,4 @@ object Test extends App { val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_implicits-old.scala b/test/files/run/reify_implicits-old.scala index 60971c3cfb..8ff256d2d4 100644 --- a/test/files/run/reify_implicits-old.scala +++ b/test/files/run/reify_implicits-old.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -11,4 +12,4 @@ object Test extends App { val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_inheritance.scala b/test/files/run/reify_inheritance.scala index dd86c355a3..c732664438 100644 --- a/test/files/run/reify_inheritance.scala +++ b/test/files/run/reify_inheritance.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -13,4 +14,4 @@ object Test extends App { println(new D().y * new C().x) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_inner1.scala b/test/files/run/reify_inner1.scala index ea77ece6df..8da338ee4a 100644 --- a/test/files/run/reify_inner1.scala +++ b/test/files/run/reify_inner1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { val inner = new outer.D() println(inner.x) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_inner2.scala b/test/files/run/reify_inner2.scala index 67c403f7e5..f82eff8f03 100644 --- a/test/files/run/reify_inner2.scala +++ b/test/files/run/reify_inner2.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { val inner = outer.D println(inner.x) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_inner3.scala b/test/files/run/reify_inner3.scala index ad401d81da..72f8d9a38a 100644 --- a/test/files/run/reify_inner3.scala +++ b/test/files/run/reify_inner3.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { val inner = new outer.D println(inner.x) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_inner4.scala b/test/files/run/reify_inner4.scala index 140c8e9ed4..ecbbf149a4 100644 --- a/test/files/run/reify_inner4.scala +++ b/test/files/run/reify_inner4.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { val inner = outer.D println(inner.x) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_lazyevaluation.scala b/test/files/run/reify_lazyevaluation.scala index 1a0c858914..5b310d95f7 100644 --- a/test/files/run/reify_lazyevaluation.scala +++ b/test/files/run/reify_lazyevaluation.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/files/run/reify_maps.check b/test/files/run/reify_maps.check deleted file mode 100644 index 08cbbb1359..0000000000 --- a/test/files/run/reify_maps.check +++ /dev/null @@ -1,4 +0,0 @@ -red has code: 16711680 -Unknown color: green -Unknown color: blue -turquoise has code: 65535 diff --git a/test/files/run/reify_maps.flags b/test/files/run/reify_maps.flags deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/files/run/reify_maps.scala b/test/files/run/reify_maps.scala deleted file mode 100644 index 3fcc21892f..0000000000 --- a/test/files/run/reify_maps.scala +++ /dev/null @@ -1,19 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - 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/test/files/run/reify_maps_newpatmat.check b/test/files/run/reify_maps_newpatmat.check new file mode 100644 index 0000000000..08cbbb1359 --- /dev/null +++ b/test/files/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/test/files/run/reify_maps_newpatmat.scala b/test/files/run/reify_maps_newpatmat.scala new file mode 100644 index 0000000000..b538355b03 --- /dev/null +++ b/test/files/run/reify_maps_newpatmat.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + 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 +} \ No newline at end of file diff --git a/test/files/run/reify_maps_oldpatmat.check b/test/files/run/reify_maps_oldpatmat.check new file mode 100644 index 0000000000..08cbbb1359 --- /dev/null +++ b/test/files/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/test/files/run/reify_maps_oldpatmat.flags b/test/files/run/reify_maps_oldpatmat.flags new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/reify_maps_oldpatmat.scala b/test/files/run/reify_maps_oldpatmat.scala new file mode 100644 index 0000000000..b538355b03 --- /dev/null +++ b/test/files/run/reify_maps_oldpatmat.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + 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 +} \ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala b/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala index fe23bc8438..8ea92c511b 100644 --- a/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala +++ b/test/files/run/reify_metalevel_breach_+0_refers_to_1.scala @@ -1,13 +1,18 @@ -import scala.reflect.mirror._ +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 App { val code = reify{ val x = 2 val inner = reify{x} +// was: inner.splice inner.eval }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala index 5d98a38592..7ff4f84de0 100644 --- a/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_0_a.scala @@ -1,11 +1,16 @@ -import scala.reflect.mirror._ +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 App { val x = 2 val outer = reify{reify{x}} +// was: val code = reify{outer.splice.splice} val code = reify{outer.eval.eval} - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala index ca31d83acd..7f1f9d8478 100644 --- a/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_0_b.scala @@ -1,15 +1,21 @@ -import scala.reflect.mirror._ +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 App { val x = 2 val code = reify{ { val inner = reify{reify{x}} +// was: inner.splice inner.eval +// was: }.splice }.eval } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala b/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala index 56d85c6ba1..65e0931b6e 100644 --- a/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala +++ b/test/files/run/reify_metalevel_breach_-1_refers_to_1.scala @@ -1,13 +1,18 @@ -import scala.reflect.mirror._ +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 App { val code = reify{ val x = 2 val inner = reify{reify{x}} +// was: inner.splice.splice inner.eval.eval }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_nested_inner_refers_to_global.scala b/test/files/run/reify_nested_inner_refers_to_global.scala index 14899bcf99..f45c1daed9 100644 --- a/test/files/run/reify_nested_inner_refers_to_global.scala +++ b/test/files/run/reify_nested_inner_refers_to_global.scala @@ -1,14 +1,17 @@ -import scala.reflect.mirror._ +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 App { val code = { val x = 2 reify{ - reify{x}.eval + reify{x}.splice } } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_nested_inner_refers_to_local.scala b/test/files/run/reify_nested_inner_refers_to_local.scala index fd56585f72..4a3d8bb02b 100644 --- a/test/files/run/reify_nested_inner_refers_to_local.scala +++ b/test/files/run/reify_nested_inner_refers_to_local.scala @@ -1,12 +1,17 @@ -import scala.reflect.mirror._ +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 App { val code = reify{ val x = 2 +// was: reify{x}.eval reify{x}.eval }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_nested_outer_refers_to_global.scala b/test/files/run/reify_nested_outer_refers_to_global.scala index f34e4fe04b..b628975e59 100644 --- a/test/files/run/reify_nested_outer_refers_to_global.scala +++ b/test/files/run/reify_nested_outer_refers_to_global.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val code = { @@ -6,11 +9,11 @@ object Test extends App { val outer = reify{x} reify{ val x = 42 - outer.eval + outer.splice }; } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_nested_outer_refers_to_local.scala b/test/files/run/reify_nested_outer_refers_to_local.scala index e16c851d8d..80564fa9a2 100644 --- a/test/files/run/reify_nested_outer_refers_to_local.scala +++ b/test/files/run/reify_nested_outer_refers_to_local.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val outer = { @@ -7,10 +10,10 @@ object Test extends App { } val code = reify{ val x = 42 - outer.eval + outer.splice }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_01.scala b/test/files/run/reify_newimpl_01.scala index f7539a15b0..e4b46e428f 100644 --- a/test/files/run/reify_newimpl_01.scala +++ b/test/files/run/reify_newimpl_01.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_02.scala b/test/files/run/reify_newimpl_02.scala index 2c085efa04..fa7ee17acf 100644 --- a/test/files/run/reify_newimpl_02.scala +++ b/test/files/run/reify_newimpl_02.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_03.scala b/test/files/run/reify_newimpl_03.scala index 361cfc50bb..8d65425528 100644 --- a/test/files/run/reify_newimpl_03.scala +++ b/test/files/run/reify_newimpl_03.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_04.scala b/test/files/run/reify_newimpl_04.scala index d80a7c9ffd..21341ed102 100644 --- a/test/files/run/reify_newimpl_04.scala +++ b/test/files/run/reify_newimpl_04.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_05.scala b/test/files/run/reify_newimpl_05.scala index 85c1711bdb..635eba3827 100644 --- a/test/files/run/reify_newimpl_05.scala +++ b/test/files/run/reify_newimpl_05.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_06.scala b/test/files/run/reify_newimpl_06.scala index 257b54167a..0bf37da8c6 100644 --- a/test/files/run/reify_newimpl_06.scala +++ b/test/files/run/reify_newimpl_06.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C(val y: Int) { diff --git a/test/files/run/reify_newimpl_09.scala b/test/files/run/reify_newimpl_09.scala index 2c81945a2a..27fbd37b71 100644 --- a/test/files/run/reify_newimpl_09.scala +++ b/test/files/run/reify_newimpl_09.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_10.scala b/test/files/run/reify_newimpl_10.scala index 6e70b4d216..791e52943a 100644 --- a/test/files/run/reify_newimpl_10.scala +++ b/test/files/run/reify_newimpl_10.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_11.check b/test/files/run/reify_newimpl_11.check index e2a8206132..21bd28667e 100644 --- a/test/files/run/reify_newimpl_11.check +++ b/test/files/run/reify_newimpl_11.check @@ -1,2 +1,2 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_11.scala:4:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox has failed: +unresolved free type variables (namely: T defined by C in reify_newimpl_11.scala:6:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_11.scala b/test/files/run/reify_newimpl_11.scala index 4e91c7a457..e8ca664418 100644 --- a/test/files/run/reify_newimpl_11.scala +++ b/test/files/run/reify_newimpl_11.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C[T] { diff --git a/test/files/run/reify_newimpl_12.scala b/test/files/run/reify_newimpl_12.scala index 433168ce28..246d7b4d4c 100644 --- a/test/files/run/reify_newimpl_12.scala +++ b/test/files/run/reify_newimpl_12.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C[T: TypeTag] { diff --git a/test/files/run/reify_newimpl_13.check b/test/files/run/reify_newimpl_13.check index 7c47310cf2..e28732bd6a 100644 --- a/test/files/run/reify_newimpl_13.check +++ b/test/files/run/reify_newimpl_13.check @@ -1,2 +1,2 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_13.scala:5:13). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox has failed: +unresolved free type variables (namely: T defined by C in reify_newimpl_13.scala:7:13). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_13.scala b/test/files/run/reify_newimpl_13.scala index dd1980b74f..1b2b8cb529 100644 --- a/test/files/run/reify_newimpl_13.scala +++ b/test/files/run/reify_newimpl_13.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_14.scala b/test/files/run/reify_newimpl_14.scala index 3f52f19cfb..284e87acd3 100644 --- a/test/files/run/reify_newimpl_14.scala +++ b/test/files/run/reify_newimpl_14.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_15.scala b/test/files/run/reify_newimpl_15.scala index b707b2583d..cb66e8549e 100644 --- a/test/files/run/reify_newimpl_15.scala +++ b/test/files/run/reify_newimpl_15.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C { diff --git a/test/files/run/reify_newimpl_16.scala b/test/files/run/reify_newimpl_16.scala index 98fc15878c..a0cadf4d48 100644 --- a/test/files/run/reify_newimpl_16.scala +++ b/test/files/run/reify_newimpl_16.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_17.check b/test/files/run/reify_newimpl_17.check index 0fb9ddfc2d..e592e0e94e 100644 --- a/test/files/run/reify_newimpl_17.check +++ b/test/files/run/reify_newimpl_17.check @@ -1,2 +1,2 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: U defined by C in reify_newimpl_17.scala:4:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox has failed: +unresolved free type variables (namely: U defined by C in reify_newimpl_17.scala:6:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_17.scala b/test/files/run/reify_newimpl_17.scala index 331777fcfb..8fbcd52502 100644 --- a/test/files/run/reify_newimpl_17.scala +++ b/test/files/run/reify_newimpl_17.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C[U] { diff --git a/test/files/run/reify_newimpl_18.scala b/test/files/run/reify_newimpl_18.scala index 704e54928a..8456fd1b8f 100644 --- a/test/files/run/reify_newimpl_18.scala +++ b/test/files/run/reify_newimpl_18.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C[U: TypeTag] { diff --git a/test/files/run/reify_newimpl_19.check b/test/files/run/reify_newimpl_19.check index 32f9300f53..1d96992869 100644 --- a/test/files/run/reify_newimpl_19.check +++ b/test/files/run/reify_newimpl_19.check @@ -1,2 +1,2 @@ -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_19.scala:5:10). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox has failed: +unresolved free type variables (namely: T defined by C in reify_newimpl_19.scala:7:10). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_19.scala b/test/files/run/reify_newimpl_19.scala index 0ea8ae6992..ba2d39cfdb 100644 --- a/test/files/run/reify_newimpl_19.scala +++ b/test/files/run/reify_newimpl_19.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C { diff --git a/test/files/run/reify_newimpl_20.scala b/test/files/run/reify_newimpl_20.scala index 16895a449e..f8ddb53a22 100644 --- a/test/files/run/reify_newimpl_20.scala +++ b/test/files/run/reify_newimpl_20.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C { diff --git a/test/files/run/reify_newimpl_21.scala b/test/files/run/reify_newimpl_21.scala index 99f9ac9089..97261b21ed 100644 --- a/test/files/run/reify_newimpl_21.scala +++ b/test/files/run/reify_newimpl_21.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { trait C { diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index 51699cbc29..ebcf42f52f 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -3,8 +3,14 @@ Type :help for more information. scala> -scala> import scala.reflect.mirror._ -import scala.reflect.mirror._ +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 @@ -13,7 +19,7 @@ scala> { } println(code.eval) } -:13: free term: Ident(newTermName("x")) defined by res0 in :12:21 +:15: free term: Ident(newTermName("x")) defined by res0 in :14:21 val code = reify { ^ 2 diff --git a/test/files/run/reify_newimpl_22.scala b/test/files/run/reify_newimpl_22.scala index a211ad360c..8512620a16 100644 --- a/test/files/run/reify_newimpl_22.scala +++ b/test/files/run/reify_newimpl_22.scala @@ -3,7 +3,9 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xlog-free-terms" def code = """ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval { val x = 2 val code = reify { @@ -12,4 +14,4 @@ import scala.reflect.mirror._ println(code.eval) } """ -} +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index 33d15190fb..c8ed424c86 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -3,8 +3,14 @@ Type :help for more information. scala> -scala> import scala.reflect.mirror._ -import scala.reflect.mirror._ +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 { @@ -12,7 +18,7 @@ scala> def foo[T]{ } println(code.eval) } -:11: free type: Ident(newTypeName("T")) defined by foo in :10:16 +:13: free type: Ident(newTypeName("T")) defined by foo in :12:16 val code = reify { ^ foo: [T]=> Unit diff --git a/test/files/run/reify_newimpl_23.scala b/test/files/run/reify_newimpl_23.scala index 15da4e497e..d4c2a68ce6 100644 --- a/test/files/run/reify_newimpl_23.scala +++ b/test/files/run/reify_newimpl_23.scala @@ -3,7 +3,9 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xlog-free-types" def code = """ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval def foo[T]{ val code = reify { List[T]() @@ -11,4 +13,4 @@ def foo[T]{ println(code.eval) } """ -} +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_24.check b/test/files/run/reify_newimpl_24.check deleted file mode 100644 index 66b18c790e..0000000000 --- a/test/files/run/reify_newimpl_24.check +++ /dev/null @@ -1,24 +0,0 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> - -scala> import scala.reflect.mirror._ -import scala.reflect.mirror._ - -scala> { - val x = 2 - val code = reify { - val y = reify { x } - y.eval - } - println(code.eval) -} -:15: this splice cannot be resolved statically - y.eval - ^ -2 - -scala> - -scala> diff --git a/test/files/run/reify_newimpl_24.scala b/test/files/run/reify_newimpl_24.scala deleted file mode 100644 index 7b21eeeb10..0000000000 --- a/test/files/run/reify_newimpl_24.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.tools.partest.ReplTest - -object Test extends ReplTest { - override def extraSettings = "-Xlog-runtime-splices" - def code = """ -import scala.reflect.mirror._ -{ - val x = 2 - val code = reify { - val y = reify { x } - y.eval - } - println(code.eval) -} - """ -} diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index 37ff83c9ee..1ba001fb59 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -3,15 +3,13 @@ Type :help for more information. scala> -scala> import scala.reflect.mirror._ -import scala.reflect.mirror._ - scala> { + import scala.reflect.runtime.universe._ val x = "2" val tt = implicitly[TypeTag[x.type]] println(tt) } -:13: free term: Ident(newTermName("x")) defined by res0 in :12:21 +:11: free term: Ident(newTermName("x")) defined by res0 in :10:21 val tt = implicitly[TypeTag[x.type]] ^ ConcreteTypeTag[x.type] diff --git a/test/files/run/reify_newimpl_25.scala b/test/files/run/reify_newimpl_25.scala index 1f66f5e681..01cc04b59f 100644 --- a/test/files/run/reify_newimpl_25.scala +++ b/test/files/run/reify_newimpl_25.scala @@ -3,11 +3,11 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xlog-free-terms" def code = """ -import scala.reflect.mirror._ { + import scala.reflect.runtime.universe._ val x = "2" val tt = implicitly[TypeTag[x.type]] println(tt) } """ -} +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index d92b3bd817..1cedc43f74 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -3,14 +3,12 @@ Type :help for more information. scala> -scala> import scala.reflect.mirror._ -import scala.reflect.mirror._ - scala> def foo[T]{ + import scala.reflect.runtime.universe._ val tt = implicitly[TypeTag[List[T]]] println(tt) } -:11: free type: Ident(newTypeName("T")) defined by foo in :10:16 +:9: free type: Ident(newTypeName("T")) defined by foo in :7:16 val tt = implicitly[TypeTag[List[T]]] ^ foo: [T]=> Unit diff --git a/test/files/run/reify_newimpl_26.scala b/test/files/run/reify_newimpl_26.scala index f2dd1bfc4e..bb36c91d0e 100644 --- a/test/files/run/reify_newimpl_26.scala +++ b/test/files/run/reify_newimpl_26.scala @@ -3,11 +3,11 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-Xlog-free-types" def code = """ -import scala.reflect.mirror._ def foo[T]{ + import scala.reflect.runtime.universe._ val tt = implicitly[TypeTag[List[T]]] println(tt) } foo[Int] """ -} +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_27.scala b/test/files/run/reify_newimpl_27.scala index b3d6d5c865..db9ada36e4 100644 --- a/test/files/run/reify_newimpl_27.scala +++ b/test/files/run/reify_newimpl_27.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { object C { diff --git a/test/files/run/reify_newimpl_28.scala b/test/files/run/reify_newimpl_28.scala index f7874b8548..524a110704 100644 --- a/test/files/run/reify_newimpl_28.scala +++ b/test/files/run/reify_newimpl_28.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_29.scala b/test/files/run/reify_newimpl_29.scala index e32762f335..033c360b8c 100644 --- a/test/files/run/reify_newimpl_29.scala +++ b/test/files/run/reify_newimpl_29.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { class C { diff --git a/test/files/run/reify_newimpl_30.scala b/test/files/run/reify_newimpl_30.scala index e4ba3221e1..573d05a630 100644 --- a/test/files/run/reify_newimpl_30.scala +++ b/test/files/run/reify_newimpl_30.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_31.scala b/test/files/run/reify_newimpl_31.scala index 20a851e32e..2e20aa0f62 100644 --- a/test/files/run/reify_newimpl_31.scala +++ b/test/files/run/reify_newimpl_31.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { object C { diff --git a/test/files/run/reify_newimpl_32.scala b/test/files/run/reify_newimpl_32.scala index 788486ec00..095e59d919 100644 --- a/test/files/run/reify_newimpl_32.scala +++ b/test/files/run/reify_newimpl_32.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_33.scala b/test/files/run/reify_newimpl_33.scala index 84a8258256..98bb2e5102 100644 --- a/test/files/run/reify_newimpl_33.scala +++ b/test/files/run/reify_newimpl_33.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { object C { diff --git a/test/files/run/reify_newimpl_34.scala b/test/files/run/reify_newimpl_34.scala index 5935ab385c..a0a575ed7d 100644 --- a/test/files/run/reify_newimpl_34.scala +++ b/test/files/run/reify_newimpl_34.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check new file mode 100644 index 0000000000..f8306003b5 --- /dev/null +++ b/test/files/run/reify_newimpl_35.check @@ -0,0 +1,17 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +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]](immutable.this.Nil) + +scala> + +scala> diff --git a/test/files/run/reify_newimpl_35.scala b/test/files/run/reify_newimpl_35.scala new file mode 100644 index 0000000000..f2ebf5181b --- /dev/null +++ b/test/files/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/test/files/run/reify_newimpl_36.scala b/test/files/run/reify_newimpl_36.scala index c76efce27a..490e645cf7 100644 --- a/test/files/run/reify_newimpl_36.scala +++ b/test/files/run/reify_newimpl_36.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_37.scala b/test/files/run/reify_newimpl_37.scala index e83d35dbe1..7c4d4af3dd 100644 --- a/test/files/run/reify_newimpl_37.scala +++ b/test/files/run/reify_newimpl_37.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_38.scala b/test/files/run/reify_newimpl_38.scala index 70ef49ecf7..fd898b9ab2 100644 --- a/test/files/run/reify_newimpl_38.scala +++ b/test/files/run/reify_newimpl_38.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_39.scala b/test/files/run/reify_newimpl_39.scala index faa45d917d..885c738275 100644 --- a/test/files/run/reify_newimpl_39.scala +++ b/test/files/run/reify_newimpl_39.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_40.scala b/test/files/run/reify_newimpl_40.scala index a983a92324..018bf720f3 100644 --- a/test/files/run/reify_newimpl_40.scala +++ b/test/files/run/reify_newimpl_40.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_41.scala b/test/files/run/reify_newimpl_41.scala index 9aedccc98a..9bb79fb2b9 100644 --- a/test/files/run/reify_newimpl_41.scala +++ b/test/files/run/reify_newimpl_41.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_42.scala b/test/files/run/reify_newimpl_42.scala index 1e21bd59bc..bd7deadea6 100644 --- a/test/files/run/reify_newimpl_42.scala +++ b/test/files/run/reify_newimpl_42.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_43.scala b/test/files/run/reify_newimpl_43.scala index 962461db8b..88ea224322 100644 --- a/test/files/run/reify_newimpl_43.scala +++ b/test/files/run/reify_newimpl_43.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_44.scala b/test/files/run/reify_newimpl_44.scala index 962461db8b..88ea224322 100644 --- a/test/files/run/reify_newimpl_44.scala +++ b/test/files/run/reify_newimpl_44.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_45.scala b/test/files/run/reify_newimpl_45.scala index b2b52eaf5b..d2254d6dde 100644 --- a/test/files/run/reify_newimpl_45.scala +++ b/test/files/run/reify_newimpl_45.scala @@ -1,11 +1,14 @@ -import scala.reflect.mirror._ +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 App { 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 T = freeTypes(code.tree)(0) - mkToolBox().runExpr(code.tree, Map(T -> definitions.StringClass.asType)) + println(code.tree.freeTypes) + val T = code.tree.freeTypes(0) + cm.mkToolBox().runExpr(code.tree, Map(T -> definitions.StringClass.asType)) } new C[String] diff --git a/test/files/run/reify_newimpl_47.scala b/test/files/run/reify_newimpl_47.scala index bd1bd1fe65..8740132f6a 100644 --- a/test/files/run/reify_newimpl_47.scala +++ b/test/files/run/reify_newimpl_47.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val outer = { @@ -8,8 +10,8 @@ object Test extends App { val code = reify{ val x = 42 - outer.eval + outer.splice } println(code.eval) -} +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_48.scala b/test/files/run/reify_newimpl_48.scala index 1522509907..9899bc09a0 100644 --- a/test/files/run/reify_newimpl_48.scala +++ b/test/files/run/reify_newimpl_48.scala @@ -1,4 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval object Test extends App { val outer1 = { @@ -13,8 +15,8 @@ object Test extends App { val code = reify{ val x = 4 - x + outer1.eval + outer2.eval + x + outer1.splice + outer2.splice } println(code.eval) -} +} \ No newline at end of file diff --git a/test/files/run/reify_newimpl_49.scala b/test/files/run/reify_newimpl_49.scala index 68d968e28b..2222bd69d5 100644 --- a/test/files/run/reify_newimpl_49.scala +++ b/test/files/run/reify_newimpl_49.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_50.scala b/test/files/run/reify_newimpl_50.scala index b81d72a4eb..279cb161a0 100644 --- a/test/files/run/reify_newimpl_50.scala +++ b/test/files/run/reify_newimpl_50.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_51.scala b/test/files/run/reify_newimpl_51.scala index ccbae2e160..f823bf4033 100644 --- a/test/files/run/reify_newimpl_51.scala +++ b/test/files/run/reify_newimpl_51.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_newimpl_52.scala b/test/files/run/reify_newimpl_52.scala index 60b16d3618..f01199e830 100644 --- a/test/files/run/reify_newimpl_52.scala +++ b/test/files/run/reify_newimpl_52.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index dc092c1a85..1b1c6fdbb8 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -1,20 +1,20 @@ import java.io.{ ByteArrayOutputStream, PrintStream } -import scala.reflect.mirror._ +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 App { - val tree = tree_printf(reify("hello %s").tree, reify("world").tree) - - import scala.reflect.mirror._ - val toolbox = mkToolBox() - val output = new ByteArrayOutputStream() Console.setOut(new PrintStream(output)) - val evaluated = toolbox.runExpr(tree) + val toolbox = cm.mkToolBox() + val tree = tree_printf(reify("hello %s").tree, reify("world").tree) + val evaluated = toolbox.runExpr(tree) assert(output.toString() == "hello world", output.toString() +" == hello world") /* @@ -30,9 +30,9 @@ object Test extends App { ( Some( ValDef( - Modifiers() + NoMods , local - , TypeTree().setType(tpe) + , TypeTree(tpe) , value ) ) @@ -44,8 +44,8 @@ object Test extends App { 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, classToType(classOf[Int]) ) - case "%s" => createTempValDef( paramsStack.pop, classToType(classOf[String]) ) + case "%d" => createTempValDef( paramsStack.pop, IntTpe ) + case "%s" => createTempValDef( paramsStack.pop, StringTpe ) case "%%" => { (None:Option[Tree], Literal(Constant("%"))) } @@ -68,4 +68,4 @@ object Test extends App { ): Tree Block((evals ++ prints).toList, Literal(Constant(()))) } -} +} \ No newline at end of file diff --git a/test/files/run/reify_properties.scala b/test/files/run/reify_properties.scala index 5cacc262ac..01a9b12a92 100644 --- a/test/files/run/reify_properties.scala +++ b/test/files/run/reify_properties.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/files/run/reify_sort.scala b/test/files/run/reify_sort.scala index 0b373b358f..17e3976c09 100644 --- a/test/files/run/reify_sort.scala +++ b/test/files/run/reify_sort.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -47,4 +48,4 @@ object Test extends App { sort(ar) println(ar) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_sort1.scala b/test/files/run/reify_sort1.scala index 56125619e9..6fb3cc5895 100644 --- a/test/files/run/reify_sort1.scala +++ b/test/files/run/reify_sort1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -17,4 +18,4 @@ object Test extends App { println(xs) println(sort(xs)) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_this.scala b/test/files/run/reify_this.scala index 280d735ab6..ecbf394bba 100644 --- a/test/files/run/reify_this.scala +++ b/test/files/run/reify_this.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval trait Eval { def eval(tree: Expr[_]) = tree.eval @@ -16,4 +17,4 @@ object Test extends App with Eval { // select a value from module val x = 2 eval(reify{println(x)}) -} +} \ No newline at end of file diff --git a/test/files/run/reify_timeofday.scala b/test/files/run/reify_timeofday.scala index 481ab04df5..efeb81debf 100644 --- a/test/files/run/reify_timeofday.scala +++ b/test/files/run/reify_timeofday.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -38,4 +39,4 @@ object Test extends App { case e: Exception => println("Exception") } }.eval -} +} \ No newline at end of file diff --git a/test/files/run/reify_typerefs_1a.scala b/test/files/run/reify_typerefs_1a.scala index 15d8d17835..53033e210c 100644 --- a/test/files/run/reify_typerefs_1a.scala +++ b/test/files/run/reify_typerefs_1a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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" @@ -9,7 +12,7 @@ object Test extends App { List(new Expression, new Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_typerefs_1b.scala b/test/files/run/reify_typerefs_1b.scala index 06ce1e35ac..12604454ed 100644 --- a/test/files/run/reify_typerefs_1b.scala +++ b/test/files/run/reify_typerefs_1b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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" @@ -9,7 +12,7 @@ object Test extends App { List(Expression, Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_typerefs_2a.scala b/test/files/run/reify_typerefs_2a.scala index d03efea222..ffc3dfc942 100644 --- a/test/files/run/reify_typerefs_2a.scala +++ b/test/files/run/reify_typerefs_2a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 { @@ -11,7 +14,7 @@ object Test extends App { List(new foo.Expression, new foo.Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_typerefs_2b.scala b/test/files/run/reify_typerefs_2b.scala index 3d9f7d61b8..f5d1633d79 100644 --- a/test/files/run/reify_typerefs_2b.scala +++ b/test/files/run/reify_typerefs_2b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 { @@ -11,7 +14,7 @@ object Test extends App { List(foo.Expression, foo.Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_typerefs_3a.scala b/test/files/run/reify_typerefs_3a.scala index 4128073f60..67b2c2d8aa 100644 --- a/test/files/run/reify_typerefs_3a.scala +++ b/test/files/run/reify_typerefs_3a.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 { @@ -11,7 +14,7 @@ object Test extends App { List(new foo.Expression, new foo.Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_typerefs_3b.scala b/test/files/run/reify_typerefs_3b.scala index a7ede00c9c..41a0a667e2 100644 --- a/test/files/run/reify_typerefs_3b.scala +++ b/test/files/run/reify_typerefs_3b.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 { @@ -11,7 +14,7 @@ object Test extends App { List(foo.Expression, foo.Expression) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/reify_varargs.scala b/test/files/run/reify_varargs.scala index fe8f03b702..1cbc7c9473 100644 --- a/test/files/run/reify_varargs.scala +++ b/test/files/run/reify_varargs.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -7,4 +8,4 @@ object Test extends App { "Hoth", "the fifth of August", "a disturbance in the Force") println("Message="+msg) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/runtimeEval1.check b/test/files/run/runtimeEval1.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/runtimeEval1.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/runtimeEval1.scala b/test/files/run/runtimeEval1.scala new file mode 100644 index 0000000000..9497b52918 --- /dev/null +++ b/test/files/run/runtimeEval1.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val x = 2 + println(x) + }.eval +} \ No newline at end of file diff --git a/test/files/run/runtimeEval2.check b/test/files/run/runtimeEval2.check new file mode 100644 index 0000000000..78c6baefdd --- /dev/null +++ b/test/files/run/runtimeEval2.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/runtimeEval2.scala b/test/files/run/runtimeEval2.scala new file mode 100644 index 0000000000..513b820129 --- /dev/null +++ b/test/files/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 App { + val x = 2 + val outer = reify{reify{x}} + println(outer.eval.eval) +} \ No newline at end of file diff --git a/test/files/run/t0421-new.scala b/test/files/run/t0421-new.scala index 7de6b7f2c4..63c4ab5c73 100644 --- a/test/files/run/t0421-new.scala +++ b/test/files/run/t0421-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + // ticket #421 object Test extends App { @@ -27,4 +29,4 @@ object Test extends App { println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deep.mkString("[", ",", "]")) println(matmul(Array(Array(4)), Array(Array(6, 8))).deep.mkString("[", ",", "]")) -} +} \ No newline at end of file diff --git a/test/files/run/t0677-new.scala b/test/files/run/t0677-new.scala index bf7a3971dc..85332401b7 100644 --- a/test/files/run/t0677-new.scala +++ b/test/files/run/t0677-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + object Test extends App { class X[T: ArrayTag] { val a = Array.ofDim[T](3, 4) @@ -5,4 +7,4 @@ object Test extends App { val x = new X[String] x.a(1)(2) = "hello" assert(x.a(1)(2) == "hello") -} +} \ No newline at end of file diff --git a/test/files/run/t1195-new.check b/test/files/run/t1195-new.check index 554e3fd03d..4dd1661d1b 100644 --- a/test/files/run/t1195-new.check +++ b/test/files/run/t1195-new.check @@ -1,6 +1,6 @@ -ConcreteTypeTag[Bar.type], underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton -ConcreteTypeTag[Bar], underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int} -ConcreteTypeTag[Product with Serializable], underlying = Product with Serializable -ConcreteTypeTag[Bar.type], underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton -ConcreteTypeTag[Bar], underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int} -ConcreteTypeTag[Product with Serializable], underlying = Product with Serializable +Bar.type, underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton +Bar, underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int} +Product with Serializable, underlying = Product with Serializable +Bar.type, underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton +Bar, underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int} +Product with Serializable, underlying = Product with Serializable diff --git a/test/files/run/t1195-new.scala b/test/files/run/t1195-new.scala index 6f28a4a167..4edfb5073f 100644 --- a/test/files/run/t1195-new.scala +++ b/test/files/run/t1195-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { def f() = { case class Bar(x: Int); Bar } def g() = { case class Bar(x: Int); Bar(5) } @@ -7,7 +9,7 @@ object Test { val g1 = g() val h1 = h() - def m[T: TypeTag](x: T) = println(typeTag[T] + ", underlying = " + typeTag[T].sym.typeSignature) + def m[T: TypeTag](x: T) = println(typeOf[T] + ", underlying = " + typeOf[T].typeSymbol.typeSignature) def main(args: Array[String]): Unit = { m(f) @@ -23,4 +25,4 @@ class A1[T] { class B1[U] { def f = { case class D(x: Int) extends A1[String] ; new D(5) } } -} +} \ No newline at end of file diff --git a/test/files/run/t2236-new.scala b/test/files/run/t2236-new.scala index bbabe8e7d9..26d6945628 100644 --- a/test/files/run/t2236-new.scala +++ b/test/files/run/t2236-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + class T[A](implicit val m:TypeTag[A]) class Foo class Bar extends T[Foo] @@ -14,4 +16,4 @@ object EvidenceTest { implicit val e: E[T] = null new B[T]{} } -} +} \ No newline at end of file diff --git a/test/files/run/t2886.scala b/test/files/run/t2886.scala index e0835a0a44..b919f13770 100644 --- a/test/files/run/t2886.scala +++ b/test/files/run/t2886.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test { def test(name: String, address: String) = null @@ -6,4 +6,4 @@ object Test { val tree = reify((x:String) => test(address=x,name=x)).tree println(tree) } -} +} \ No newline at end of file diff --git a/test/files/run/t3507-new.check b/test/files/run/t3507-new.check index 6e4fa4170e..b02c40fc26 100644 --- a/test/files/run/t3507-new.check +++ b/test/files/run/t3507-new.check @@ -1 +1 @@ -ConcreteTypeTag[_1.b.c.type] +_1.b.c.type diff --git a/test/files/run/t3507-new.scala b/test/files/run/t3507-new.scala index c7a529e8b8..f045755b8f 100644 --- a/test/files/run/t3507-new.scala +++ b/test/files/run/t3507-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + class A { object b { object c @@ -9,7 +11,7 @@ object Test extends App { var a: A = new A // mutable val c /*: object _1.b.c forSome { val _1: A } */ = a.m // widening using existential - def mani[T: TypeTag](x: T) = println(typeTag[T]) + def mani[T: TypeTag](x: T) = println(typeOf[T]) mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier // --> _1 is not in scope here } \ No newline at end of file diff --git a/test/files/run/t4110-new.check b/test/files/run/t4110-new.check index 28f220e1fe..5cbfb27f3e 100644 --- a/test/files/run/t4110-new.check +++ b/test/files/run/t4110-new.check @@ -1,2 +1,2 @@ -ConcreteTypeTag[Test.A with Test.B] -ConcreteTypeTag[Test.A with Test.B] +Test.A with Test.B +Test.A with Test.B diff --git a/test/files/run/t4110-new.scala b/test/files/run/t4110-new.scala index 3285b82c61..24ecd66cce 100644 --- a/test/files/run/t4110-new.scala +++ b/test/files/run/t4110-new.scala @@ -1,5 +1,7 @@ +import scala.reflect.runtime.universe._ + object Test extends App { - def inferredType[T : TypeTag](v : T) = println(typeTag[T]) + def inferredType[T : TypeTag](v : T) = println(typeOf[T]) trait A trait B diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check index ac19a98315..0ba987f634 100644 --- a/test/files/run/t4216.check +++ b/test/files/run/t4216.check @@ -1,34 +1,37 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) -f: [A](a: A)(implicit evidence$1: ArrayTag[A])java.util.List[A] - -scala> f(".") -res0: java.util.List[String] = [.] - -scala> f(0) -res1: java.util.List[Int] = [0] - -scala> def i(a: Int) = java.util.Arrays.asList(Array(a): _*) -i: (a: Int)java.util.List[Int] - -scala> i(0) -res2: java.util.List[Int] = [0] - -scala> def o(a: Any) = java.util.Arrays.asList(Array(a): _*) -o: (a: Any)java.util.List[Any] - -scala> o(".") -res3: java.util.List[Any] = [.] - -scala> class V(val a: Int) extends AnyVal -defined class V - -scala> f(new V(0)) -res4: java.util.List[V] = [V@0] - -scala> o(new V(0)) -res5: java.util.List[Any] = [V@0] - -scala> +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import scala.reflect.ArrayTag +import scala.reflect.ArrayTag + +scala> def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) +f: [A](a: A)(implicit evidence$1: scala.reflect.ArrayTag[A])java.util.List[A] + +scala> f(".") +res0: java.util.List[String] = [.] + +scala> f(0) +res1: java.util.List[Int] = [0] + +scala> def i(a: Int) = java.util.Arrays.asList(Array(a): _*) +i: (a: Int)java.util.List[Int] + +scala> i(0) +res2: java.util.List[Int] = [0] + +scala> def o(a: Any) = java.util.Arrays.asList(Array(a): _*) +o: (a: Any)java.util.List[Any] + +scala> o(".") +res3: java.util.List[Any] = [.] + +scala> class V(val a: Int) extends AnyVal +defined class V + +scala> f(new V(0)) +res4: java.util.List[V] = [V@0] + +scala> o(new V(0)) +res5: java.util.List[Any] = [V@0] + +scala> diff --git a/test/files/run/t4216.scala b/test/files/run/t4216.scala index 4ada8f48aa..d9395cf538 100644 --- a/test/files/run/t4216.scala +++ b/test/files/run/t4216.scala @@ -4,6 +4,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ + |import scala.reflect.ArrayTag |def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) |f(".") |f(0) diff --git a/test/files/run/t5224.scala b/test/files/run/t5224.scala index cf65f16457..600a4200bd 100644 --- a/test/files/run/t5224.scala +++ b/test/files/run/t5224.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ class Foo(bar: String) extends annotation.ClassfileAnnotation diff --git a/test/files/run/t5225_1.scala b/test/files/run/t5225_1.scala index 5e1d3b1f17..917a239bdf 100644 --- a/test/files/run/t5225_1.scala +++ b/test/files/run/t5225_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { val tree = reify{@transient @volatile var x = 2}.tree diff --git a/test/files/run/t5225_2.scala b/test/files/run/t5225_2.scala index 4cab640fe8..d1b607499c 100644 --- a/test/files/run/t5225_2.scala +++ b/test/files/run/t5225_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { val tree = reify{def foo(@cloneable x: Int) = ""}.tree diff --git a/test/files/run/t5229_1.scala b/test/files/run/t5229_1.scala index 273079a89d..7e05b08348 100644 --- a/test/files/run/t5229_1.scala +++ b/test/files/run/t5229_1.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { object C }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5229_2.scala b/test/files/run/t5229_2.scala index 85bf78ba31..75d7204911 100644 --- a/test/files/run/t5229_2.scala +++ b/test/files/run/t5229_2.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -9,7 +12,7 @@ object Test extends App { println(C.x) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/t5230.scala b/test/files/run/t5230.scala index e0632f591c..5cd67766b4 100644 --- a/test/files/run/t5230.scala +++ b/test/files/run/t5230.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -9,7 +12,7 @@ object Test extends App { println(new C().x) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/t5256a.check b/test/files/run/t5256a.check index 304f4ddd79..518663b3da 100644 --- a/test/files/run/t5256a.check +++ b/test/files/run/t5256a.check @@ -1,2 +1,6 @@ -A -true +class A +A +Object { + def : + def foo: +} diff --git a/test/files/run/t5256a.scala b/test/files/run/t5256a.scala index 05a935c770..e3d22f8a93 100644 --- a/test/files/run/t5256a.scala +++ b/test/files/run/t5256a.scala @@ -1,9 +1,11 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} -class A +class A { def foo = ??? } object Test extends App { - val c = classToType(classOf[A]) + val c = cm.reflectClass(classOf[A]).symbol println(c) - println(c.typeSymbol == classToSymbol(classOf[A])) -} + println(c.fullName) + println(c.typeSignature) +} \ No newline at end of file diff --git a/test/files/run/t5256b.check b/test/files/run/t5256b.check index 64f4c01166..d6015f2743 100644 --- a/test/files/run/t5256b.check +++ b/test/files/run/t5256b.check @@ -1,2 +1,6 @@ +class A Test.A -true \ No newline at end of file +Object { + def : + def foo: +} diff --git a/test/files/run/t5256b.scala b/test/files/run/t5256b.scala index 5575211641..fedec6323d 100644 --- a/test/files/run/t5256b.scala +++ b/test/files/run/t5256b.scala @@ -1,8 +1,10 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} object Test extends App { - class A - val c = classToType(classOf[A]) + class A { def foo = ??? } + val c = cm.reflectClass(classOf[A]).symbol println(c) - println(c.typeSymbol == classToSymbol(classOf[A])) -} + println(c.fullName) + println(c.typeSignature) +} \ No newline at end of file diff --git a/test/files/run/t5256c.check b/test/files/run/t5256c.check new file mode 100644 index 0000000000..16bfc6c9d0 --- /dev/null +++ b/test/files/run/t5256c.check @@ -0,0 +1,6 @@ +class A$1 +Test.A$1 +java.lang.Object { + def foo(): Nothing + def (): A$1 +} diff --git a/test/files/run/t5256c.scala b/test/files/run/t5256c.scala new file mode 100644 index 0000000000..a8a3323443 --- /dev/null +++ b/test/files/run/t5256c.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + { + class A { def foo = ??? } + val c = cm.reflectClass(classOf[A]).symbol + println(c) + println(c.fullName) + println(c.typeSignature) + } +} \ No newline at end of file diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check index 7924c15c5c..e466e1e2e8 100644 --- a/test/files/run/t5256d.check +++ b/test/files/run/t5256d.check @@ -3,17 +3,29 @@ Type :help for more information. scala> -scala> import scala.reflect.mirror._ -import scala.reflect.mirror._ +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ -scala> class A +scala> import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.runtime.{currentMirror=>cm} + +scala> class A { def foo = ??? } defined class A -scala> val c = classToType(classOf[A]) -c: reflect.mirror.Type = A +scala> val c = cm.reflectClass(classOf[A]).symbol +c: reflect.runtime.universe.ClassSymbol = class A + +scala> println(c) +class A + +scala> println(c.fullName) +$line8.$read.$iw.$iw.$iw.$iw.A -scala> println(c.typeSymbol == classToSymbol(classOf[A])) -true +scala> println(c.typeSignature) +java.lang.Object { + def : + def foo: +} scala> diff --git a/test/files/run/t5256d.scala b/test/files/run/t5256d.scala index 86404a9b63..574013f444 100644 --- a/test/files/run/t5256d.scala +++ b/test/files/run/t5256d.scala @@ -2,9 +2,12 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ -import scala.reflect.mirror._ -class A -val c = classToType(classOf[A]) -println(c.typeSymbol == classToSymbol(classOf[A])) +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +class A { def foo = ??? } +val c = cm.reflectClass(classOf[A]).symbol +println(c) +println(c.fullName) +println(c.typeSignature) """ -} +} \ No newline at end of file diff --git a/test/files/run/t5256e.check b/test/files/run/t5256e.check index e50f917e14..20ea35c74d 100644 --- a/test/files/run/t5256e.check +++ b/test/files/run/t5256e.check @@ -1,2 +1,6 @@ -C.this.A -true \ No newline at end of file +class A +Test.C.A +Object { + def : + def foo: +} diff --git a/test/files/run/t5256e.scala b/test/files/run/t5256e.scala index 9ed422ca44..32031f919a 100644 --- a/test/files/run/t5256e.scala +++ b/test/files/run/t5256e.scala @@ -1,9 +1,10 @@ -import scala.reflect.mirror._ - -class C { class A } +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} object Test extends App { - val c = classToType(classOf[C#A]) + class C { class A { def foo = ??? } } + val c = cm.reflectClass(classOf[C#A]).symbol println(c) - println(c.typeSymbol == classToSymbol(classOf[C#A])) -} + println(c.fullName) + println(c.typeSignature) +} \ No newline at end of file diff --git a/test/files/run/t5256f.check b/test/files/run/t5256f.check index ad2f375d9a..7a58aa003d 100644 --- a/test/files/run/t5256f.check +++ b/test/files/run/t5256f.check @@ -1,4 +1,12 @@ -Test.A1 -true -Test.this.A2 -true +class A1 +Test.A1 +Object { + def : + def foo: +} +class A2 +Test.A2 +Object { + def : + def foo: +} diff --git a/test/files/run/t5256f.scala b/test/files/run/t5256f.scala index 45c80cbd63..072f927abc 100644 --- a/test/files/run/t5256f.scala +++ b/test/files/run/t5256f.scala @@ -1,19 +1,22 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} object Test extends App { - class A1 + class A1 { def foo = ??? } - val c1 = classToType(classOf[A1]) + val c1 = cm.reflectClass(classOf[A1]).symbol println(c1) - println(c1.typeSymbol == classToSymbol(classOf[A1])) + println(c1.fullName) + println(c1.typeSignature) new Test } class Test { - class A2 + class A2 { def foo = ??? } - val c2 = classToType(classOf[A2]) + val c2 = cm.reflectClass(classOf[A2]).symbol println(c2) - println(c2.typeSymbol == classToSymbol(classOf[A2])) + println(c2.fullName) + println(c2.typeSignature) } diff --git a/test/files/run/t5256g.check b/test/files/run/t5256g.check new file mode 100644 index 0000000000..5aac899694 --- /dev/null +++ b/test/files/run/t5256g.check @@ -0,0 +1,3 @@ +anonymous class $anon$1 +Test.$anon$1 +A with B{def (): A with B} diff --git a/test/files/run/t5256g.scala b/test/files/run/t5256g.scala new file mode 100644 index 0000000000..a4d81a28dc --- /dev/null +++ b/test/files/run/t5256g.scala @@ -0,0 +1,13 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +class A +trait B + +object Test extends App { + val mutant = new A with B + val c = cm.reflectClass(mutant.getClass).symbol + println(c) + println(c.fullName) + println(c.typeSignature) +} diff --git a/test/files/run/t5256h.check b/test/files/run/t5256h.check new file mode 100644 index 0000000000..2a6b292486 --- /dev/null +++ b/test/files/run/t5256h.check @@ -0,0 +1,7 @@ +anonymous class $anon$1 +Test.$anon$1 +java.lang.Object { + final private val x: Int + def x(): Int + def (): java.lang.Object{def x(): Int} +} diff --git a/test/files/run/t5256h.scala b/test/files/run/t5256h.scala new file mode 100644 index 0000000000..723d606a1e --- /dev/null +++ b/test/files/run/t5256h.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + val mutant = new { val x = 2 } + val c = cm.reflectClass(mutant.getClass).symbol + println(c) + println(c.fullName) + println(c.typeSignature) +} diff --git a/test/files/run/t5258a.scala b/test/files/run/t5258a.scala index 127829c724..1b98b5920a 100644 --- a/test/files/run/t5258a.scala +++ b/test/files/run/t5258a.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/files/run/t5266_1.scala b/test/files/run/t5266_1.scala index ebb432be71..ee7ea6d335 100644 --- a/test/files/run/t5266_1.scala +++ b/test/files/run/t5266_1.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -6,7 +9,7 @@ object Test extends App { println(x) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) } \ No newline at end of file diff --git a/test/files/run/t5266_2.scala b/test/files/run/t5266_2.scala index 27c91c35a8..ca16f656ee 100644 --- a/test/files/run/t5266_2.scala +++ b/test/files/run/t5266_2.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -7,7 +10,7 @@ object Test extends App { println(y) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val evaluated = toolbox.runExpr(code.tree) println("evaluated = " + evaluated) -} +} \ No newline at end of file diff --git a/test/files/run/t5269.scala b/test/files/run/t5269.scala index 9026090b29..dfdabdd6cc 100644 --- a/test/files/run/t5269.scala +++ b/test/files/run/t5269.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -12,4 +13,4 @@ object Test extends App { new X().println() }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5270.scala b/test/files/run/t5270.scala index 476b610148..afd45a0875 100644 --- a/test/files/run/t5270.scala +++ b/test/files/run/t5270.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -16,4 +17,4 @@ object Test extends App { new X().println() }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5271_1.scala b/test/files/run/t5271_1.scala index 20cafa6a08..9e2c7602b5 100644 --- a/test/files/run/t5271_1.scala +++ b/test/files/run/t5271_1.scala @@ -1,11 +1,15 @@ -import scala.reflect.mirror._ +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 App { val code = reify { case class C(foo: Int, bar: Int) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(code.tree) println(code.eval) -} +} \ No newline at end of file diff --git a/test/files/run/t5271_2.scala b/test/files/run/t5271_2.scala index af6491407c..430738f4fb 100644 --- a/test/files/run/t5271_2.scala +++ b/test/files/run/t5271_2.scala @@ -1,4 +1,8 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -7,7 +11,7 @@ object Test extends App { println(c.foo * c.bar) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(code.tree) println(code.eval) -} +} \ No newline at end of file diff --git a/test/files/run/t5271_3.scala b/test/files/run/t5271_3.scala index 646b10a8e5..f2ca2d496d 100644 --- a/test/files/run/t5271_3.scala +++ b/test/files/run/t5271_3.scala @@ -1,4 +1,8 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -8,7 +12,7 @@ object Test extends App { println(c.foo * c.bar == C.qwe) }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(code.tree) println(code.eval) -} +} \ No newline at end of file diff --git a/test/files/run/t5271_4.scala b/test/files/run/t5271_4.scala index e13a331d9c..f63e82bdbe 100644 --- a/test/files/run/t5271_4.scala +++ b/test/files/run/t5271_4.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { case object C }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5272_1.check b/test/files/run/t5272_1.check deleted file mode 100644 index 9f8d6f24e7..0000000000 --- a/test/files/run/t5272_1.check +++ /dev/null @@ -1 +0,0 @@ -okay \ No newline at end of file diff --git a/test/files/run/t5272_1.flags b/test/files/run/t5272_1.flags deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/files/run/t5272_1.scala b/test/files/run/t5272_1.scala deleted file mode 100644 index 46472babf3..0000000000 --- a/test/files/run/t5272_1.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - 2 match { - case 2 => println("okay") - case _ => println("not okay") - } - }.eval -} diff --git a/test/files/run/t5272_1_newpatmat.check b/test/files/run/t5272_1_newpatmat.check new file mode 100644 index 0000000000..9f8d6f24e7 --- /dev/null +++ b/test/files/run/t5272_1_newpatmat.check @@ -0,0 +1 @@ +okay \ No newline at end of file diff --git a/test/files/run/t5272_1_newpatmat.scala b/test/files/run/t5272_1_newpatmat.scala new file mode 100644 index 0000000000..e8bb013248 --- /dev/null +++ b/test/files/run/t5272_1_newpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + 2 match { + case 2 => println("okay") + case _ => println("not okay") + } + }.eval +} \ No newline at end of file diff --git a/test/files/run/t5272_1_oldpatmat.check b/test/files/run/t5272_1_oldpatmat.check new file mode 100644 index 0000000000..9f8d6f24e7 --- /dev/null +++ b/test/files/run/t5272_1_oldpatmat.check @@ -0,0 +1 @@ +okay \ No newline at end of file diff --git a/test/files/run/t5272_1_oldpatmat.flags b/test/files/run/t5272_1_oldpatmat.flags new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/t5272_1_oldpatmat.scala b/test/files/run/t5272_1_oldpatmat.scala new file mode 100644 index 0000000000..e8bb013248 --- /dev/null +++ b/test/files/run/t5272_1_oldpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + 2 match { + case 2 => println("okay") + case _ => println("not okay") + } + }.eval +} \ No newline at end of file diff --git a/test/files/run/t5272_2.check b/test/files/run/t5272_2.check deleted file mode 100644 index 549f3f3af8..0000000000 --- a/test/files/run/t5272_2.check +++ /dev/null @@ -1 +0,0 @@ -okay2 \ No newline at end of file diff --git a/test/files/run/t5272_2.flags b/test/files/run/t5272_2.flags deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/files/run/t5272_2.scala b/test/files/run/t5272_2.scala deleted file mode 100644 index f5bab44205..0000000000 --- a/test/files/run/t5272_2.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - 2 match { - case x => println("okay" + x) - } - }.eval -} diff --git a/test/files/run/t5272_2_newpatmat.check b/test/files/run/t5272_2_newpatmat.check new file mode 100644 index 0000000000..549f3f3af8 --- /dev/null +++ b/test/files/run/t5272_2_newpatmat.check @@ -0,0 +1 @@ +okay2 \ No newline at end of file diff --git a/test/files/run/t5272_2_newpatmat.scala b/test/files/run/t5272_2_newpatmat.scala new file mode 100644 index 0000000000..be79cde18f --- /dev/null +++ b/test/files/run/t5272_2_newpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + 2 match { + case x => println("okay" + x) + } + }.eval +} \ No newline at end of file diff --git a/test/files/run/t5272_2_oldpatmat.check b/test/files/run/t5272_2_oldpatmat.check new file mode 100644 index 0000000000..549f3f3af8 --- /dev/null +++ b/test/files/run/t5272_2_oldpatmat.check @@ -0,0 +1 @@ +okay2 \ No newline at end of file diff --git a/test/files/run/t5272_2_oldpatmat.flags b/test/files/run/t5272_2_oldpatmat.flags new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/t5272_2_oldpatmat.scala b/test/files/run/t5272_2_oldpatmat.scala new file mode 100644 index 0000000000..be79cde18f --- /dev/null +++ b/test/files/run/t5272_2_oldpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + 2 match { + case x => println("okay" + x) + } + }.eval +} \ No newline at end of file diff --git a/test/files/run/t5273_1.check b/test/files/run/t5273_1.check deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/files/run/t5273_1.check +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/files/run/t5273_1.flags b/test/files/run/t5273_1.flags deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/files/run/t5273_1.scala b/test/files/run/t5273_1.scala deleted file mode 100644 index 1b491923b2..0000000000 --- a/test/files/run/t5273_1.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - List(1, 2, 3) match { - case foo :: bar :: _ => println(foo * bar) - case _ => println("this is getting out of hand!") - } - }.eval -} diff --git a/test/files/run/t5273_1_newpatmat.check b/test/files/run/t5273_1_newpatmat.check new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/files/run/t5273_1_newpatmat.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/t5273_1_newpatmat.scala b/test/files/run/t5273_1_newpatmat.scala new file mode 100644 index 0000000000..756f52e10b --- /dev/null +++ b/test/files/run/t5273_1_newpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + List(1, 2, 3) match { + case foo :: bar :: _ => println(foo * bar) + case _ => println("this is getting out of hand!") + } + }.eval +} \ No newline at end of file diff --git a/test/files/run/t5273_1_oldpatmat.check b/test/files/run/t5273_1_oldpatmat.check new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/files/run/t5273_1_oldpatmat.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/t5273_1_oldpatmat.flags b/test/files/run/t5273_1_oldpatmat.flags new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/t5273_1_oldpatmat.scala b/test/files/run/t5273_1_oldpatmat.scala new file mode 100644 index 0000000000..756f52e10b --- /dev/null +++ b/test/files/run/t5273_1_oldpatmat.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + List(1, 2, 3) match { + case foo :: bar :: _ => println(foo * bar) + case _ => println("this is getting out of hand!") + } + }.eval +} \ No newline at end of file diff --git a/test/files/run/t5273_2a.check b/test/files/run/t5273_2a.check deleted file mode 100644 index d8263ee986..0000000000 --- a/test/files/run/t5273_2a.check +++ /dev/null @@ -1 +0,0 @@ -2 \ No newline at end of file diff --git a/test/files/run/t5273_2a.flags b/test/files/run/t5273_2a.flags deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/files/run/t5273_2a.scala b/test/files/run/t5273_2a.scala deleted file mode 100644 index 062ff79d11..0000000000 --- a/test/files/run/t5273_2a.scala +++ /dev/null @@ -1,8 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - val foo :: bar :: _ = List(1, 2, 3) - println(foo * bar) - }.eval -} diff --git a/test/files/run/t5273_2a_newpatmat.check b/test/files/run/t5273_2a_newpatmat.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/t5273_2a_newpatmat.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/t5273_2a_newpatmat.scala b/test/files/run/t5273_2a_newpatmat.scala new file mode 100644 index 0000000000..c0d15496aa --- /dev/null +++ b/test/files/run/t5273_2a_newpatmat.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val foo :: bar :: _ = List(1, 2, 3) + println(foo * bar) + }.eval +} \ No newline at end of file diff --git a/test/files/run/t5273_2a_oldpatmat.check b/test/files/run/t5273_2a_oldpatmat.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/t5273_2a_oldpatmat.check @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/test/files/run/t5273_2a_oldpatmat.flags b/test/files/run/t5273_2a_oldpatmat.flags new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/t5273_2a_oldpatmat.scala b/test/files/run/t5273_2a_oldpatmat.scala new file mode 100644 index 0000000000..c0d15496aa --- /dev/null +++ b/test/files/run/t5273_2a_oldpatmat.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + reify { + val foo :: bar :: _ = List(1, 2, 3) + println(foo * bar) + }.eval +} \ No newline at end of file diff --git a/test/files/run/t5273_2b.check b/test/files/run/t5273_2b.check deleted file mode 100644 index c551774ca5..0000000000 --- a/test/files/run/t5273_2b.check +++ /dev/null @@ -1 +0,0 @@ -name = American Dollar, shortname = USD, value = 2,8567 diff --git a/test/files/run/t5273_2b.flags b/test/files/run/t5273_2b.flags deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/files/run/t5273_2b.scala b/test/files/run/t5273_2b.scala deleted file mode 100644 index 82f1de89f7..0000000000 --- a/test/files/run/t5273_2b.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - 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/test/files/run/t5273_2b_newpatmat.check b/test/files/run/t5273_2b_newpatmat.check new file mode 100644 index 0000000000..c551774ca5 --- /dev/null +++ b/test/files/run/t5273_2b_newpatmat.check @@ -0,0 +1 @@ +name = American Dollar, shortname = USD, value = 2,8567 diff --git a/test/files/run/t5273_2b_newpatmat.scala b/test/files/run/t5273_2b_newpatmat.scala new file mode 100644 index 0000000000..31afd7e2ba --- /dev/null +++ b/test/files/run/t5273_2b_newpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + 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 +} \ No newline at end of file diff --git a/test/files/run/t5273_2b_oldpatmat.check b/test/files/run/t5273_2b_oldpatmat.check new file mode 100644 index 0000000000..c551774ca5 --- /dev/null +++ b/test/files/run/t5273_2b_oldpatmat.check @@ -0,0 +1 @@ +name = American Dollar, shortname = USD, value = 2,8567 diff --git a/test/files/run/t5273_2b_oldpatmat.flags b/test/files/run/t5273_2b_oldpatmat.flags new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/run/t5273_2b_oldpatmat.scala b/test/files/run/t5273_2b_oldpatmat.scala new file mode 100644 index 0000000000..31afd7e2ba --- /dev/null +++ b/test/files/run/t5273_2b_oldpatmat.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + 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 +} \ No newline at end of file diff --git a/test/files/run/t5274_1.scala b/test/files/run/t5274_1.scala index 7ef332aa05..c1b842fd7f 100644 --- a/test/files/run/t5274_1.scala +++ b/test/files/run/t5274_1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -10,4 +11,4 @@ object Test extends App { println("49! = " + f49) println("50!/49! = " + (f50 / f49)) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5274_2.scala b/test/files/run/t5274_2.scala index 0b373b358f..17e3976c09 100644 --- a/test/files/run/t5274_2.scala +++ b/test/files/run/t5274_2.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -47,4 +48,4 @@ object Test extends App { sort(ar) println(ar) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5275.scala b/test/files/run/t5275.scala index 534672be3c..5c84df499f 100644 --- a/test/files/run/t5275.scala +++ b/test/files/run/t5275.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { class C(val foo: Int) println(new C(2).foo) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5276_1a.scala b/test/files/run/t5276_1a.scala index a6e327c0e7..7f4b6ecb8d 100644 --- a/test/files/run/t5276_1a.scala +++ b/test/files/run/t5276_1a.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { lazy val x = 2 println(x) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5276_1b.scala b/test/files/run/t5276_1b.scala index 1bc3e246c9..56e7dc1bf0 100644 --- a/test/files/run/t5276_1b.scala +++ b/test/files/run/t5276_1b.scala @@ -1,8 +1,9 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { implicit lazy val x = 2 println(implicitly[Int]) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5276_2a.scala b/test/files/run/t5276_2a.scala index cdd87ddc9e..af9272c693 100644 --- a/test/files/run/t5276_2a.scala +++ b/test/files/run/t5276_2a.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -8,4 +9,4 @@ object Test extends App { println(new C().x) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5276_2b.scala b/test/files/run/t5276_2b.scala index 2fac951731..b211901abe 100644 --- a/test/files/run/t5276_2b.scala +++ b/test/files/run/t5276_2b.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -9,4 +10,4 @@ object Test extends App { println(new C().y) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5277_1.scala b/test/files/run/t5277_1.scala index f95e9ab6ec..a2d546579d 100644 --- a/test/files/run/t5277_1.scala +++ b/test/files/run/t5277_1.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -11,4 +12,4 @@ object Test extends App { println("10! = " + (10!)) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5277_2.scala b/test/files/run/t5277_2.scala index 5f1737f503..dd72452a7c 100644 --- a/test/files/run/t5277_2.scala +++ b/test/files/run/t5277_2.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { @@ -8,4 +9,4 @@ object Test extends App { println(p) println(p(1)) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5279.scala b/test/files/run/t5279.scala index aab5588877..815c883732 100644 --- a/test/files/run/t5279.scala +++ b/test/files/run/t5279.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { println(new Integer(10)) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5334_1.scala b/test/files/run/t5334_1.scala index 49dbea6b68..2b6418990a 100644 --- a/test/files/run/t5334_1.scala +++ b/test/files/run/t5334_1.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -7,6 +10,6 @@ object Test extends App { ret.asInstanceOf[Object] }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(toolbox.runExpr(code.tree)) -} +} \ No newline at end of file diff --git a/test/files/run/t5334_2.scala b/test/files/run/t5334_2.scala index c6a77158dd..815f78f951 100644 --- a/test/files/run/t5334_2.scala +++ b/test/files/run/t5334_2.scala @@ -1,4 +1,7 @@ -import scala.reflect.mirror._ +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 App { val code = reify { @@ -7,6 +10,6 @@ object Test extends App { ret.asInstanceOf[List[Any]] }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(toolbox.runExpr(code.tree)) -} +} \ No newline at end of file diff --git a/test/files/run/t5335.scala b/test/files/run/t5335.scala index a0fe6c5822..714846de21 100644 --- a/test/files/run/t5335.scala +++ b/test/files/run/t5335.scala @@ -1,7 +1,8 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { println(new {def x = 2}.x) }.eval -} +} \ No newline at end of file diff --git a/test/files/run/t5415.scala b/test/files/run/t5415.scala index c6552f69b3..c12e209bb7 100644 --- a/test/files/run/t5415.scala +++ b/test/files/run/t5415.scala @@ -2,9 +2,11 @@ object Test extends App{ case class Queryable2[T]() { def filter(predicate: T => Boolean) = ??? } trait CoffeesTable{ def sales : Int } val q = Queryable2[CoffeesTable]() - import scala.reflect.mirror._ + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{universe => ru} val code = reify{q.filter(_.sales > 5)} - - val toolbox = mkToolBox() + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val toolbox = cm.mkToolBox() val ttree = toolbox.typeCheck(code.tree) } diff --git a/test/files/run/t5419.scala b/test/files/run/t5419.scala index 5f11f5056c..686a79bafd 100644 --- a/test/files/run/t5419.scala +++ b/test/files/run/t5419.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ class Foo extends annotation.StaticAnnotation diff --git a/test/files/run/t5423.scala b/test/files/run/t5423.scala index ed1faf0429..9c73ed0bef 100644 --- a/test/files/run/t5423.scala +++ b/test/files/run/t5423.scala @@ -1,9 +1,11 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} final class table extends annotation.StaticAnnotation @table class A object Test extends App { - val s = classToSymbol(classOf[A]) - println(s.annotations) -} + val s = cm.reflectClass(classOf[A]).symbol + println(s.getAnnotations) +} \ No newline at end of file diff --git a/test/files/run/t5704.check b/test/files/run/t5704.check index 7b56bf2bfd..74c4610988 100644 --- a/test/files/run/t5704.check +++ b/test/files/run/t5704.check @@ -1 +1 @@ -String \ No newline at end of file +java.lang.String diff --git a/test/files/run/t5704.scala b/test/files/run/t5704.scala index 8fd721d4e7..ddcbcc27b3 100644 --- a/test/files/run/t5704.scala +++ b/test/files/run/t5704.scala @@ -1,10 +1,13 @@ -import scala.reflect.mirror._ +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 App { class MyQuerycollection{ def findUserByName( name:String ) = { val tree = reify{ "test" == name }.tree - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() toolbox.typeCheck(tree) match{ case Apply(Select(lhs,op),rhs::Nil) => println(rhs.tpe) @@ -13,4 +16,4 @@ object Test extends App { } val qc = new MyQuerycollection qc.findUserByName("some value") -} +} \ No newline at end of file diff --git a/test/files/run/t5713/Impls_Macros_1.scala b/test/files/run/t5713/Impls_Macros_1.scala index b499bc7e4e..d16299a0c8 100644 --- a/test/files/run/t5713/Impls_Macros_1.scala +++ b/test/files/run/t5713/Impls_Macros_1.scala @@ -19,9 +19,10 @@ private object LoggerMacros { log(c)(c.reify(Level.Error), message) private def log(c: LoggerContext)(level: c.Expr[Level.Value], message: c.Expr[String]): c.Expr[Unit] = - if (level.eval.id < 4) // TODO Remove hack! +// was: if (level.splice.id < 4) // TODO Remove hack! + if (c.eval(level).id < 4) // TODO Remove hack! c.reify(()) else { - c.reify(println(message.eval)) + c.reify(println(message.splice)) } } \ No newline at end of file diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala index 1da9a6bc16..c5b788550e 100644 --- a/test/files/run/toolbox_console_reporter.scala +++ b/test/files/run/toolbox_console_reporter.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { // todo. cannot test this unfortunately, because ConsoleFrontEnd grabs Console.out too early @@ -13,4 +13,4 @@ object Test extends App { // // Utils.foo //}) -} +} \ No newline at end of file diff --git a/test/files/run/toolbox_default_reporter_is_silent.scala b/test/files/run/toolbox_default_reporter_is_silent.scala index 6908c001a3..5f3269b6fa 100644 --- a/test/files/run/toolbox_default_reporter_is_silent.scala +++ b/test/files/run/toolbox_default_reporter_is_silent.scala @@ -1,7 +1,10 @@ -import scala.reflect.mirror._ +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 App { - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() toolbox.runExpr(reify{ object Utils { @deprecated("test", "2.10.0") @@ -10,4 +13,4 @@ object Test extends App { Utils.foo }.tree) -} +} \ No newline at end of file diff --git a/test/files/run/toolbox_silent_reporter.scala b/test/files/run/toolbox_silent_reporter.scala index 6f5687ba4f..915734e6ad 100644 --- a/test/files/run/toolbox_silent_reporter.scala +++ b/test/files/run/toolbox_silent_reporter.scala @@ -1,7 +1,10 @@ -import scala.reflect.mirror._ +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 App { - val toolbox = mkToolBox(options = "-deprecation") + val toolbox = cm.mkToolBox(options = "-deprecation") toolbox.runExpr(reify{ object Utils { @deprecated("test", "2.10.0") diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.check b/test/files/run/toolbox_typecheck_implicitsdisabled.check index 4bc64530ab..e2f2dbe4b9 100644 --- a/test/files/run/toolbox_typecheck_implicitsdisabled.check +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.check @@ -2,4 +2,4 @@ import scala.Predef._; scala.Predef.any2ArrowAssoc[Int](1).->[Int](2) } -scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective typecheck has failed: value -> is not a member of Int +scala.tools.reflect.ToolBoxError: reflective typecheck has failed: value -> is not a member of Int diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.scala b/test/files/run/toolbox_typecheck_implicitsdisabled.scala index 9d52e91f73..f11f0192f3 100644 --- a/test/files/run/toolbox_typecheck_implicitsdisabled.scala +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.scala @@ -1,7 +1,10 @@ -import scala.reflect.mirror._ +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 App { - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val tree1 = Block( Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1))), diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check index c4af175812..f4a67e3054 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -1,5 +1,37 @@ { - val $mr: mr.type = mr; - $mr.Expr.apply[Int(2)]($mr.Literal.apply($mr.Constant.apply(2)))($mr.ConcreteTypeTag.apply[Int(2)]($mr.ConstantType.apply($mr.Constant.apply(2)), classOf[scala.Int])) + val $u: ru.type = ru; + val $m: $u.Mirror = ru.rootMirror; + $u.Expr.apply[Int(2)]($m, { + final class $treecreator1 extends TreeCreator { + def (): $treecreator1 = { + $treecreator1.super.(); + () + }; + def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe]; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree] + }; + private def applyImpl[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#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.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.ConstantType.apply($u.Constant.apply(2)) + } + }; + new $typecreator2() + })) } -mr.reify[Int](2) +ru.reify[Int](2) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala index afbbce1736..bcbd637e02 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala @@ -1,17 +1,20 @@ -import scala.reflect.mirror._ +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 App { - val toolbox = mkToolBox() - val mrPkg = staticModule("scala.reflect.package") - val mrSym = selectTerm(mrPkg, "mirror") - val NullaryMethodType(mrTpe) = mrSym.typeSignature - val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror) + val toolbox = cm.mkToolBox() + val rupkg = cm.staticModule("scala.reflect.runtime.package") + val rusym = build.selectTerm(rupkg, "universe") + val NullaryMethodType(rutpe) = rusym.typeSignature + val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe) - val tree1 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) println(ttree1) - val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Literal(Constant(2)))) + val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) println(ttree2) -} +} \ No newline at end of file diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index 271139b031..2e1e2696ab 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -1,5 +1,37 @@ { - val $mr: mr.type = mr; - $mr.Expr.apply[Array[Int]]($mr.Apply.apply($mr.Select.apply($mr.Select.apply($mr.Ident($mr.staticModule("scala")), $mr.newTermName("Array")), $mr.newTermName("apply")), scala.collection.immutable.List.apply[$mr.Literal]($mr.Literal.apply($mr.Constant.apply(2)))))($mr.ConcreteTypeTag.apply[Array[Int]]($mr.TypeRef.apply($mr.thisModuleType("scala"), $mr.staticClass("scala.Array"), scala.collection.immutable.List.apply[$mr.Type]($mr.staticClass("scala.Int").asTypeConstructor)), ScalaRunTime.this.arrayClass(classOf[scala.Int]))) + val $u: ru.type = ru; + val $m: $u.Mirror = ru.rootMirror; + $u.Expr.apply[Array[Int]]($m, { + final class $treecreator1 extends TreeCreator { + def (): $treecreator1 = { + $treecreator1.super.(); + () + }; + def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe]; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree] + }; + private def applyImpl[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticModule("scala")), $u.newTermName("Array")), $u.newTermName("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.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.TypeRef.apply($u.ThisType.apply($m.staticModule("scala").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor)) + } + }; + new $typecreator2() + })) } -mr.reify[Array[Int]](scala.Array.apply(2)) +ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala index b4c76d0600..51493ffc1c 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala @@ -1,17 +1,20 @@ -import scala.reflect.mirror._ +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 App { - val toolbox = mkToolBox() - val mrPkg = staticModule("scala.reflect.package") - val mrSym = selectTerm(mrPkg, "mirror") - val NullaryMethodType(mrTpe) = mrSym.typeSignature - val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror) + val toolbox = cm.mkToolBox() + val rupkg = cm.staticModule("scala.reflect.runtime.package") + val rusym = build.selectTerm(rupkg, "universe") + val NullaryMethodType(rutpe) = rusym.typeSignature + val ru = build.newFreeTerm("ru", rutpe, scala.reflect.runtime.universe) - val tree1 = Apply(Select(Ident(mr), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) println(ttree1) - val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) println(ttree2) } diff --git a/test/files/run/typetags_core.check b/test/files/run/typetags_core.check index f124aa6a35..e5308bf9c7 100644 --- a/test/files/run/typetags_core.check +++ b/test/files/run/typetags_core.check @@ -1,32 +1,28 @@ -true -ConcreteTypeTag[Byte] -true -ConcreteTypeTag[Short] -true -ConcreteTypeTag[Char] -true -ConcreteTypeTag[Int] -true -ConcreteTypeTag[Long] -true -ConcreteTypeTag[Float] -true -ConcreteTypeTag[Double] -true -ConcreteTypeTag[Boolean] -true -ConcreteTypeTag[Unit] -true -ConcreteTypeTag[Any] -true -ConcreteTypeTag[Object] -true -ConcreteTypeTag[AnyVal] -true -ConcreteTypeTag[AnyRef] -true -ConcreteTypeTag[Null] -true -ConcreteTypeTag[Nothing] -true -ConcreteTypeTag[String] +true +ConcreteTypeTag[Byte] +true +ConcreteTypeTag[Short] +true +ConcreteTypeTag[Char] +true +ConcreteTypeTag[Int] +true +ConcreteTypeTag[Long] +true +ConcreteTypeTag[Float] +true +ConcreteTypeTag[Double] +true +ConcreteTypeTag[Boolean] +true +ConcreteTypeTag[Unit] +true +ConcreteTypeTag[Any] +true +ConcreteTypeTag[java.lang.Object] +true +ConcreteTypeTag[Null] +true +ConcreteTypeTag[Nothing] +true +ConcreteTypeTag[java.lang.String] diff --git a/test/files/run/typetags_core.scala b/test/files/run/typetags_core.scala index 7d6be16379..a870f77c5f 100644 --- a/test/files/run/typetags_core.scala +++ b/test/files/run/typetags_core.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test extends App { println(implicitly[TypeTag[Byte]] eq TypeTag.Byte) println(implicitly[TypeTag[Byte]]) @@ -21,10 +23,6 @@ object Test extends App { println(implicitly[TypeTag[Any]]) println(implicitly[TypeTag[Object]] eq TypeTag.Object) println(implicitly[TypeTag[Object]]) - println(implicitly[TypeTag[AnyVal]] eq TypeTag.AnyVal) - println(implicitly[TypeTag[AnyVal]]) - println(implicitly[TypeTag[AnyRef]] eq TypeTag.AnyRef) - println(implicitly[TypeTag[AnyRef]]) println(implicitly[TypeTag[Null]] eq TypeTag.Null) println(implicitly[TypeTag[Null]]) println(implicitly[TypeTag[Nothing]] eq TypeTag.Nothing) diff --git a/test/files/run/typetags_multi.check b/test/files/run/typetags_multi.check index 613106985c..f3ac592f5a 100644 --- a/test/files/run/typetags_multi.check +++ b/test/files/run/typetags_multi.check @@ -1,5 +1,5 @@ -ConcreteTypeTag[Int] -ConcreteTypeTag[Array[Int]] -ConcreteTypeTag[Array[Array[Int]]] -ConcreteTypeTag[Array[Array[Array[Int]]]] -ConcreteTypeTag[Array[Array[Array[Array[Int]]]]] +Int +Array[Int] +Array[Array[Int]] +Array[Array[Array[Int]]] +Array[Array[Array[Array[Int]]]] diff --git a/test/files/run/typetags_multi.scala b/test/files/run/typetags_multi.scala index 868edc2b2a..a989662160 100644 --- a/test/files/run/typetags_multi.scala +++ b/test/files/run/typetags_multi.scala @@ -1,7 +1,9 @@ +import scala.reflect.runtime.universe._ + object Test extends App { - println(typeTag[Int]) - println(typeTag[Array[Int]]) - println(typeTag[Array[Array[Int]]]) - println(typeTag[Array[Array[Array[Int]]]]) - println(typeTag[Array[Array[Array[Array[Int]]]]]) + println(typeOf[Int]) + println(typeOf[Array[Int]]) + println(typeOf[Array[Array[Int]]]) + println(typeOf[Array[Array[Array[Int]]]]) + println(typeOf[Array[Array[Array[Array[Int]]]]]) } \ No newline at end of file diff --git a/test/files/scalacheck/array-new.scala b/test/files/scalacheck/array-new.scala index 18d577ca6d..4a9c9d8504 100644 --- a/test/files/scalacheck/array-new.scala +++ b/test/files/scalacheck/array-new.scala @@ -1,3 +1,4 @@ +import scala.reflect.{ArrayTag, arrayTag} import org.scalacheck._ import Prop._ import Gen._ @@ -33,4 +34,4 @@ object Test extends Properties("Array") { val flattened = arr flatMap (x => x) flatMap (x => x) flattened.length == i1 * i2 * i3 } -} +} \ No newline at end of file diff --git a/test/files/specialized/spec-matrix-new.scala b/test/files/specialized/spec-matrix-new.scala index 65b46e8d48..1ccff6ed95 100644 --- a/test/files/specialized/spec-matrix-new.scala +++ b/test/files/specialized/spec-matrix-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ArrayTag, arrayTag} + /** Test matrix multiplication with specialization. */ @@ -77,4 +79,4 @@ object Test { } p } -} +} \ No newline at end of file diff --git a/test/files/speclib/instrumented.jar.desired.sha1 b/test/files/speclib/instrumented.jar.desired.sha1 index a7da67429e..4ce7bdc65a 100644 --- a/test/files/speclib/instrumented.jar.desired.sha1 +++ b/test/files/speclib/instrumented.jar.desired.sha1 @@ -1 +1 @@ -15f200d9f0f25f9fd871bad2ebb4ba5cfc671db4 ?instrumented.jar +72bdc6e8225f777d98b3990fcd907127eaa8d718 ?instrumented.jar diff --git a/test/instrumented/library/scala/runtime/ScalaRunTime.scala b/test/instrumented/library/scala/runtime/ScalaRunTime.scala index 63908fcc29..f0d452a9be 100644 --- a/test/instrumented/library/scala/runtime/ScalaRunTime.scala +++ b/test/instrumented/library/scala/runtime/ScalaRunTime.scala @@ -14,6 +14,7 @@ import scala.collection.{ Seq, IndexedSeq, TraversableView, AbstractIterator } import scala.collection.mutable.WrappedArray import scala.collection.immutable.{ StringLike, NumericRange, List, Stream, Nil, :: } import scala.collection.generic.{ Sorted } +import scala.reflect.{ ArrayTag, ClassTag, arrayTag, classTag } import scala.util.control.ControlThrowable import scala.xml.{ Node, MetaData } @@ -61,7 +62,7 @@ object ScalaRunTime { */ def arrayElementClass(schematic: Any): Class[_] = schematic match { case cls: Class[_] => cls.getComponentType - case tag: ClassTag[_] => tag.erasure + case tag: ClassTag[_] => tag.runtimeClass case tag: ArrayTag[_] => tag.newArray(0).getClass.getComponentType case _ => throw new UnsupportedOperationException("unsupported schematic %s (%s)".format(schematic, if (schematic == null) "null" else schematic.getClass)) } @@ -71,7 +72,7 @@ object ScalaRunTime { * rewrites expressions like 5.getClass to come here. */ def anyValClass[T <: AnyVal : ClassTag](value: T): Class[T] = - classTag[T].erasure.asInstanceOf[Class[T]] + classTag[T].runtimeClass.asInstanceOf[Class[T]] var arrayApplyCount = 0 @@ -142,16 +143,18 @@ object ScalaRunTime { case null => throw new NullPointerException } - /** Convert a numeric value array to an object array. + /** Convert an array to an object array. * Needed to deal with vararg arguments of primitive types that are passed * to a generic Java vararg parameter T ... */ - def toObjectArray(src: AnyRef): Array[Object] = { - val length = array_length(src) - val dest = new Array[Object](length) - for (i <- 0 until length) - array_update(dest, i, array_apply(src, i)) - dest + def toObjectArray(src: AnyRef): Array[Object] = src match { + case x: Array[AnyRef] => x + case _ => + val length = array_length(src) + val dest = new Array[Object](length) + for (i <- 0 until length) + array_update(dest, i, array_apply(src, i)) + dest } def toArray[T](xs: collection.Seq[T]) = { @@ -305,8 +308,12 @@ object ScalaRunTime { */ def stringOf(arg: Any): String = stringOf(arg, scala.Int.MaxValue) def stringOf(arg: Any, maxElements: Int): String = { - def isScalaClass(x: AnyRef) = - Option(x.getClass.getPackage) exists (_.getName startsWith "scala.") + def packageOf(x: AnyRef) = x.getClass.getPackage match { + case null => "" + case p => p.getName + } + def isScalaClass(x: AnyRef) = packageOf(x) startsWith "scala." + def isScalaCompilerClass(x: AnyRef) = packageOf(x) startsWith "scala.tools.nsc." // When doing our own iteration is dangerous def useOwnToString(x: Any) = x match { @@ -322,7 +329,8 @@ object ScalaRunTime { case _: TraversableView[_, _] => true // Don't want to a) traverse infinity or b) be overly helpful with peoples' custom // collections which may have useful toString methods - ticket #3710 - case x: Traversable[_] => !x.hasDefiniteSize || !isScalaClass(x) + // or c) print AbstractFiles which are somehow also Iterable[AbstractFile]s. + case x: Traversable[_] => !x.hasDefiniteSize || !isScalaClass(x) || isScalaCompilerClass(x) // Otherwise, nothing could possibly go wrong case _ => false } diff --git a/test/instrumented/srt.patch b/test/instrumented/srt.patch index 8d08550165..366763e7f9 100644 --- a/test/instrumented/srt.patch +++ b/test/instrumented/srt.patch @@ -1,26 +1,26 @@ 9a10,11 > /* INSTRUMENTED VERSION */ > -43c45,48 +44c46,49 < def isTuple(x: Any) = x != null && tupleNames(x.getClass.getName) --- > var arrayApplyCount = 0 > var arrayUpdateCount = 0 > > def isTuple(x: Any) = tupleNames(x.getClass.getName) -75c80,82 +76c81,83 < def array_apply(xs: AnyRef, idx: Int): Any = xs match { --- > def array_apply(xs: AnyRef, idx: Int): Any = { > arrayApplyCount += 1 > xs match { -87a95 +88a96 > } -90c98,100 +91c99,101 < def array_update(xs: AnyRef, idx: Int, value: Any): Unit = xs match { --- > def array_update(xs: AnyRef, idx: Int, value: Any): Unit = { > arrayUpdateCount += 1 > xs match { -101a112 +102a113 > } diff --git a/test/pending/neg/reify_packed.scala b/test/pending/neg/reify_packed.scala index 0240f2a4b5..2004e031d5 100644 --- a/test/pending/neg/reify_packed.scala +++ b/test/pending/neg/reify_packed.scala @@ -1,3 +1,8 @@ +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 App { reify { class C { override def toString() = "C" } @@ -5,6 +10,6 @@ object Test extends App { ret.asInstanceOf[List[_]] }; - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() println(toolbox.runExpr(code.tree)) -} +} \ No newline at end of file diff --git a/test/pending/pos/inference.scala b/test/pending/pos/inference.scala index 3672351fca..ee462b6bcc 100644 --- a/test/pending/pos/inference.scala +++ b/test/pending/pos/inference.scala @@ -1,14 +1,16 @@ +import scala.reflect.runtime.universe._ + // inference illuminator object Test { - class D1[T1 : TypeTag, T2 <: T1 : TypeTag](x: T1) { println(typeTag[(T1, T2)]) } - class D2[T1 : TypeTag, T2 >: T1 : TypeTag](x: T1) { println(typeTag[(T1, T2)]) } - class D3[+T1 : TypeTag, T2 <: T1 : TypeTag](x: T1) { println(typeTag[(T1, T2)]) } - class D4[-T1 : TypeTag, T2 >: T1 : TypeTag](x: T1) { println(typeTag[(T1, T2)]) } + class D1[T1 : TypeTag, T2 <: T1 : TypeTag](x: T1) { println(typeOf[(T1, T2)]) } + class D2[T1 : TypeTag, T2 >: T1 : TypeTag](x: T1) { println(typeOf[(T1, T2)]) } + class D3[+T1 : TypeTag, T2 <: T1 : TypeTag](x: T1) { println(typeOf[(T1, T2)]) } + class D4[-T1 : TypeTag, T2 >: T1 : TypeTag](x: T1) { println(typeOf[(T1, T2)]) } - class E1[T1 : TypeTag, T2 <: T1 : TypeTag](x: D1[T1, T2]) { println(typeTag[(T1, T2)]) } - class E2[T1 : TypeTag, T2 >: T1 : TypeTag](x: D2[T1, T2]) { println(typeTag[(T1, T2)]) } - class E3[+T1 : TypeTag, T2 <: T1 : TypeTag](x: D3[T1, T2]) { println(typeTag[(T1, T2)]) } - class E4[-T1 : TypeTag, T2 >: T1 : TypeTag](x: D4[T1, T2]) { println(typeTag[(T1, T2)]) } + class E1[T1 : TypeTag, T2 <: T1 : TypeTag](x: D1[T1, T2]) { println(typeOf[(T1, T2)]) } + class E2[T1 : TypeTag, T2 >: T1 : TypeTag](x: D2[T1, T2]) { println(typeOf[(T1, T2)]) } + class E3[+T1 : TypeTag, T2 <: T1 : TypeTag](x: D3[T1, T2]) { println(typeOf[(T1, T2)]) } + class E4[-T1 : TypeTag, T2 >: T1 : TypeTag](x: D4[T1, T2]) { println(typeOf[(T1, T2)]) } def main(args: Array[String]): Unit = { // WHY YOU NO LIKE NOTHING SO MUCH SCALAC? @@ -36,4 +38,4 @@ object Test { // new E3(d3) // ^ // two errors found -} +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-default/Impls_1.scala b/test/pending/run/macro-expand-default/Impls_1.scala index fefe8fc4e2..a539982b45 100644 --- a/test/pending/run/macro-expand-default/Impls_1.scala +++ b/test/pending/run/macro-expand-default/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala index c096a83c5e..1740f40daf 100644 --- a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala +++ b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.makro.Context object Impls { def foo[T: c.TypeTag](c: Context): c.Expr[List[T]] = c.reify { - println("openImplicits are: " + c.literal(c.openImplicits.toString).eval) - println("enclosingImplicits are: " + c.literal(c.enclosingImplicits.toString).eval) - println("typetag is: " + c.literal(c.tag[T].toString).eval) + println("openImplicits are: " + c.literal(c.openImplicits.toString).splice) + println("enclosingImplicits are: " + c.literal(c.enclosingImplicits.toString).splice) + println("typetag is: " + c.literal(c.tag[T].toString).splice) null } } \ No newline at end of file diff --git a/test/pending/run/macro-expand-implicit-macro-has-context-bound.check b/test/pending/run/macro-expand-implicit-macro-has-context-bound.check deleted file mode 100644 index ac4213d6e9..0000000000 --- a/test/pending/run/macro-expand-implicit-macro-has-context-bound.check +++ /dev/null @@ -1 +0,0 @@ -43 \ No newline at end of file diff --git a/test/pending/run/macro-expand-implicit-macro-has-context-bound.flags b/test/pending/run/macro-expand-implicit-macro-has-context-bound.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/pending/run/macro-expand-implicit-macro-has-context-bound.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros \ No newline at end of file diff --git a/test/pending/run/macro-expand-implicit-macro-has-context-bound/Impls_1.scala b/test/pending/run/macro-expand-implicit-macro-has-context-bound/Impls_1.scala deleted file mode 100644 index 5c50576281..0000000000 --- a/test/pending/run/macro-expand-implicit-macro-has-context-bound/Impls_1.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.reflect.makro.{Context => Ctx} - -object Impls { - def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = { - import c.mirror._ - val plusOne = Apply(Select(evidence.tree, newTermName("plus")), List(x.tree, Literal(Constant(1)))) - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusOne)) - Expr[Unit](body) - } -} diff --git a/test/pending/run/macro-expand-implicit-macro-has-context-bound/Macros_Test_2.scala b/test/pending/run/macro-expand-implicit-macro-has-context-bound/Macros_Test_2.scala deleted file mode 100644 index 7d16b773a6..0000000000 --- a/test/pending/run/macro-expand-implicit-macro-has-context-bound/Macros_Test_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test extends App { - def foo[U: Numeric](x: U) = macro Impls.foo[U] - foo(42) -} \ No newline at end of file diff --git a/test/pending/run/macro-expand-macro-has-context-bound.check b/test/pending/run/macro-expand-macro-has-context-bound.check new file mode 100644 index 0000000000..ac4213d6e9 --- /dev/null +++ b/test/pending/run/macro-expand-macro-has-context-bound.check @@ -0,0 +1 @@ +43 \ No newline at end of file diff --git a/test/pending/run/macro-expand-macro-has-context-bound.flags b/test/pending/run/macro-expand-macro-has-context-bound.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/pending/run/macro-expand-macro-has-context-bound.flags @@ -0,0 +1 @@ +-language:experimental.macros \ No newline at end of file diff --git a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala new file mode 100644 index 0000000000..3cee65ce72 --- /dev/null +++ b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.makro.{Context => Ctx} + +object Impls { + def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = { + import c.universe._ + val plusOne = Apply(Select(evidence.tree, newTermName("plus")), List(x.tree, Literal(Constant(1)))) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusOne)) + Expr[Unit](body) + } +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-macro-has-context-bound/Macros_Test_2.scala b/test/pending/run/macro-expand-macro-has-context-bound/Macros_Test_2.scala new file mode 100644 index 0000000000..7d16b773a6 --- /dev/null +++ b/test/pending/run/macro-expand-macro-has-context-bound/Macros_Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + def foo[U: Numeric](x: U) = macro Impls.foo[U] + foo(42) +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-named/Impls_1.scala b/test/pending/run/macro-expand-named/Impls_1.scala index fefe8fc4e2..a539982b45 100644 --- a/test/pending/run/macro-expand-named/Impls_1.scala +++ b/test/pending/run/macro-expand-named/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = { - import c.mirror._ + import c.universe._ val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) Expr[Unit](body) } -} +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala index bc880fdf77..d7df919552 100644 --- a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala +++ b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala @@ -2,11 +2,11 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ + import c.universe._ Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(()))) } -} +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Macros_Test_2.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Macros_Test_2.scala index 5c863804d0..d4fc52fca0 100644 --- a/test/pending/run/macro-expand-tparams-prefix-e1/Macros_Test_2.scala +++ b/test/pending/run/macro-expand-tparams-prefix-e1/Macros_Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { class D[T: TypeTag] { diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala index bc880fdf77..d7df919552 100644 --- a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala +++ b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala @@ -2,11 +2,11 @@ import scala.reflect.makro.{Context => Ctx} object Impls { def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { - import c.mirror._ + import c.universe._ Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(()))) } -} +} \ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Macros_Test_2.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Macros_Test_2.scala index bc8e7ac75c..9417cf663e 100644 --- a/test/pending/run/macro-expand-tparams-prefix-f1/Macros_Test_2.scala +++ b/test/pending/run/macro-expand-tparams-prefix-f1/Macros_Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { class D[T] { diff --git a/test/pending/run/macro-reify-array/Macros_1.scala b/test/pending/run/macro-reify-array/Macros_1.scala index af42321484..c1bd4187a6 100644 --- a/test/pending/run/macro-reify-array/Macros_1.scala +++ b/test/pending/run/macro-reify-array/Macros_1.scala @@ -5,7 +5,7 @@ object Macros { object Impls { def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify { - Array(s.eval) + Array(s.splice) } } } \ No newline at end of file diff --git a/test/pending/run/macro-reify-eval-vs-value.flags b/test/pending/run/macro-reify-eval-vs-value.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/pending/run/macro-reify-eval-vs-value.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros \ No newline at end of file diff --git a/test/pending/run/macro-reify-eval-vs-value/Macros_1.scala b/test/pending/run/macro-reify-eval-vs-value/Macros_1.scala deleted file mode 100644 index 98dd93b0f8..0000000000 --- a/test/pending/run/macro-reify-eval-vs-value/Macros_1.scala +++ /dev/null @@ -1,25 +0,0 @@ -import scala.reflect.makro.{Context => Ctx} - -object Macros { - def fooEval(s: String) = macro Impls.fooEval - def fooValue(s: String) = macro Impls.fooValue - - object Impls { - def fooEval(c: Ctx)(s: c.Expr[String]) = c.reify { - println("hello " + s.eval) - println("hello " + s.eval) - } - - def fooValue(c: Ctx)(s: c.Expr[String]) = c.reify { - { - println("hello " + s.value) - def sayHello = println(s.value) - sayHello - } - println("hello " + s.eval); - { - println("hello " + s.eval) - } - } - } -} \ No newline at end of file diff --git a/test/pending/run/macro-reify-eval-vs-value/Test_2.scala b/test/pending/run/macro-reify-eval-vs-value/Test_2.scala deleted file mode 100644 index 8e62e6e0e7..0000000000 --- a/test/pending/run/macro-reify-eval-vs-value/Test_2.scala +++ /dev/null @@ -1,5 +0,0 @@ -object Test extends App { - Macros.fooEval({ println("in ur logz"); "world"}) - println("======================") - Macros.fooValue({ println("i can has cheezburger?"); "world"}) -} \ No newline at end of file diff --git a/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala b/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala index ef70a66f1a..6c1461af8d 100644 --- a/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala +++ b/test/pending/run/macro-reify-groundtypetag-hktypeparams-tags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTagHK[C[_]: ConcreteTypeTag, T: ConcreteTypeTag] = { diff --git a/test/pending/run/macro-reify-tagful-b/Macros_1.scala b/test/pending/run/macro-reify-tagful-b/Macros_1.scala index 38b839330b..04cf46d3a5 100644 --- a/test/pending/run/macro-reify-tagful-b/Macros_1.scala +++ b/test/pending/run/macro-reify-tagful-b/Macros_1.scala @@ -5,7 +5,7 @@ object Macros { object Impls { def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify { - List(s.eval) + List(s.splice) } } } \ No newline at end of file diff --git a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala index fac7ba5b98..04366353eb 100644 --- a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala +++ b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala @@ -5,7 +5,7 @@ object Macros { object Impls { def foo[T](c: Ctx)(s: c.Expr[T]) = c.reify { - List(s.eval) + List(s.splice) } } } \ No newline at end of file diff --git a/test/pending/run/macro-reify-tagless-b/Test_2.scala b/test/pending/run/macro-reify-tagless-b/Test_2.scala index 419ee42101..4649963d05 100644 --- a/test/pending/run/macro-reify-tagless-b/Test_2.scala +++ b/test/pending/run/macro-reify-tagless-b/Test_2.scala @@ -2,10 +2,12 @@ object Test extends App { //val list: List[String] = Macros.foo("hello world") //println(list) - import scala.reflect.mirror._ + 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("Macros"), newTermName("foo")), List(Literal(Constant("hello world")))) val list = ValDef(NoMods, newTermName("list"), tpt, rhs) val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name)))) - println(tree.eval) + println(cm.mkToolBox().runExpr(tree)) } diff --git a/test/pending/run/macro-reify-typetag-hktypeparams-notags/Test.scala b/test/pending/run/macro-reify-typetag-hktypeparams-notags/Test.scala index 9a370189a7..c7b1cedcd2 100644 --- a/test/pending/run/macro-reify-typetag-hktypeparams-notags/Test.scala +++ b/test/pending/run/macro-reify-typetag-hktypeparams-notags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooNoTypeTagHK[C[_], T] = { diff --git a/test/pending/run/macro-reify-typetag-hktypeparams-tags/Test.scala b/test/pending/run/macro-reify-typetag-hktypeparams-tags/Test.scala index 0358da9b0d..3252423375 100644 --- a/test/pending/run/macro-reify-typetag-hktypeparams-tags/Test.scala +++ b/test/pending/run/macro-reify-typetag-hktypeparams-tags/Test.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def fooTypeTagHK[C[_]: TypeTag, T: TypeTag] = { diff --git a/test/pending/run/reify_addressbook.scala b/test/pending/run/reify_addressbook.scala index 7cb6dc08fd..d53a0f7bc0 100644 --- a/test/pending/run/reify_addressbook.scala +++ b/test/pending/run/reify_addressbook.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/pending/run/reify_brainf_ck.scala b/test/pending/run/reify_brainf_ck.scala index e4bcb257bd..2af3bca1c7 100644 --- a/test/pending/run/reify_brainf_ck.scala +++ b/test/pending/run/reify_brainf_ck.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/pending/run/reify_callccinterpreter.scala b/test/pending/run/reify_callccinterpreter.scala index 0e23f75dcc..d9f7736769 100644 --- a/test/pending/run/reify_callccinterpreter.scala +++ b/test/pending/run/reify_callccinterpreter.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/pending/run/reify_closure2b.scala b/test/pending/run/reify_closure2b.scala index f9ed16d309..565bb03b2f 100644 --- a/test/pending/run/reify_closure2b.scala +++ b/test/pending/run/reify_closure2b.scala @@ -1,16 +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 App { def foo(y: Int): Int => Int = { class Foo(y: Int) { - val fun = reflect.mirror.reify{(x: Int) => { + val fun = reify{(x: Int) => { x + y }} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +} \ No newline at end of file diff --git a/test/pending/run/reify_closure3b.scala b/test/pending/run/reify_closure3b.scala index 8ef0a60c66..0d806b148b 100644 --- a/test/pending/run/reify_closure3b.scala +++ b/test/pending/run/reify_closure3b.scala @@ -1,18 +1,23 @@ +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 App { def foo(y: Int): Int => Int = { class Foo(y: Int) { def y1 = y - val fun = reflect.mirror.reify{(x: Int) => { + val fun = reify{(x: Int) => { x + y1 }} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +} \ No newline at end of file diff --git a/test/pending/run/reify_closure4b.scala b/test/pending/run/reify_closure4b.scala index 9eeb01b459..1a349de072 100644 --- a/test/pending/run/reify_closure4b.scala +++ b/test/pending/run/reify_closure4b.scala @@ -1,18 +1,23 @@ +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 App { def foo(y: Int): Int => Int = { class Foo(y: Int) { val y1 = y - val fun = reflect.mirror.reify{(x: Int) => { + val fun = reify{(x: Int) => { x + y1 }} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(1)(10)) println(foo(2)(10)) -} +} \ No newline at end of file diff --git a/test/pending/run/reify_closure5b.scala b/test/pending/run/reify_closure5b.scala index 51f1ec318d..3e5e1bd328 100644 --- a/test/pending/run/reify_closure5b.scala +++ b/test/pending/run/reify_closure5b.scala @@ -1,16 +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 App { def foo[T](ys: List[T]): Int => Int = { class Foo[T](ys: List[T]) { - val fun = reflect.mirror.reify{(x: Int) => { + val fun = reify{(x: Int) => { x + ys.length }} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(new Foo(ys).fun.tree) dyn.asInstanceOf[Int => Int] } println(foo(List(1, 2, 3))(10)) println(foo(List(1, 2, 3, 4))(10)) -} +} \ No newline at end of file diff --git a/test/pending/run/reify_closure9a.scala b/test/pending/run/reify_closure9a.scala index 1fc18cfa13..dddfa3f6c2 100644 --- a/test/pending/run/reify_closure9a.scala +++ b/test/pending/run/reify_closure9a.scala @@ -1,14 +1,18 @@ -import scala.reflect.mirror._ +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 App { def foo(y: Int) = { class Foo(val y: Int) { def fun = reify{y} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int] } println(foo(10)) -} +} \ No newline at end of file diff --git a/test/pending/run/reify_closure9b.scala b/test/pending/run/reify_closure9b.scala index 32b05d00ee..df9db9b806 100644 --- a/test/pending/run/reify_closure9b.scala +++ b/test/pending/run/reify_closure9b.scala @@ -1,14 +1,18 @@ -import scala.reflect.mirror._ +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 App { def foo(y: Int) = { class Foo(y: Int) { def fun = reify{y} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(new Foo(y).fun.tree) dyn.asInstanceOf[Int] } println(foo(10)) -} +} \ No newline at end of file diff --git a/test/pending/run/reify_closures11.scala b/test/pending/run/reify_closures11.scala index ceb224c6d6..4c21033cbc 100644 --- a/test/pending/run/reify_closures11.scala +++ b/test/pending/run/reify_closures11.scala @@ -1,12 +1,16 @@ -import scala.reflect.mirror._ +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 App { def fun() = { def z() = 2 reify{z} } - val toolbox = mkToolBox() + val toolbox = cm.mkToolBox() val dyn = toolbox.runExpr(fun().tree) val foo = dyn.asInstanceOf[Int] println(foo) -} +} \ No newline at end of file diff --git a/test/pending/run/reify_gadts.scala b/test/pending/run/reify_gadts.scala index 652a7d99d8..582c0802f7 100644 --- a/test/pending/run/reify_gadts.scala +++ b/test/pending/run/reify_gadts.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/pending/run/reify_newimpl_07.scala b/test/pending/run/reify_newimpl_07.scala index 13ca6bda8b..b6886b8bb7 100644 --- a/test/pending/run/reify_newimpl_07.scala +++ b/test/pending/run/reify_newimpl_07.scala @@ -1,10 +1,11 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { { class C(val y: Int) { val code = reify { - reify{y}.eval + reify{y}.splice } } diff --git a/test/pending/run/reify_newimpl_08.scala b/test/pending/run/reify_newimpl_08.scala index e2faa3c9af..6caa33f30d 100644 --- a/test/pending/run/reify_newimpl_08.scala +++ b/test/pending/run/reify_newimpl_08.scala @@ -1,14 +1,15 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { val code = reify { class C(val y: Int) { val code = reify { - reify{y}.eval + reify{y}.splice } } - new C(2).code.eval + new C(2).code.splice } println(code.eval) diff --git a/test/pending/run/reify_newimpl_35.scala b/test/pending/run/reify_newimpl_35.scala deleted file mode 100644 index 5e1d163e9e..0000000000 --- a/test/pending/run/reify_newimpl_35.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.tools.partest.ReplTest - -object Test extends ReplTest { - override def extraSettings = "-Xlog-free-types" - def code = """ -import scala.reflect.mirror._ -def foo[T: TypeTag] = reify{List[T]()} -println(foo) - """ -} diff --git a/test/pending/run/reify_newimpl_46.scala b/test/pending/run/reify_newimpl_46.scala index 840d695e83..239c53953b 100644 --- a/test/pending/run/reify_newimpl_46.scala +++ b/test/pending/run/reify_newimpl_46.scala @@ -1,11 +1,14 @@ -import scala.reflect.mirror._ +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 App { class C[T[_] >: Null] { - val code = reify{val x: T[String] = null; println("ima worx"); x} - println(freeTypes(code)) - val T = freeTypes(code)(0) - mkToolBox().runExpr(code, Map(T -> definitions.ListClass.asType)) + val code = reify{val x: T[String] = null; println("ima worx"); x}.tree + println(code.freeTypes) + val T = code.freeTypes(0) + cm.mkToolBox().runExpr(code, Map(T -> definitions.ListClass.asType)) } new C[List] diff --git a/test/pending/run/reify_newimpl_53.scala b/test/pending/run/reify_newimpl_53.scala index 26645dea6a..a73a0b94cb 100644 --- a/test/pending/run/reify_newimpl_53.scala +++ b/test/pending/run/reify_newimpl_53.scala @@ -1,14 +1,17 @@ -import scala.reflect.mirror._ +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 App { class C[T >: Null] { val code = reify{ val tt = implicitly[TypeTag[T]] println("mah typetag is: %s".format(tt)) - } - println(freeTypes(code)) - val T = freeTypes(code)(0) - mkToolBox().runExpr(code, Map(T -> definitions.StringClass.asType)) + }.tree + println(code.freeTypes) + val T = code.freeTypes(0) + cm.mkToolBox().runExpr(code, Map(T -> definitions.StringClass.asType)) } new C[String] diff --git a/test/pending/run/reify_simpleinterpreter.scala b/test/pending/run/reify_simpleinterpreter.scala index 2193edeea7..6cf87ea7c5 100644 --- a/test/pending/run/reify_simpleinterpreter.scala +++ b/test/pending/run/reify_simpleinterpreter.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { reify { diff --git a/test/pending/run/t5256c.check b/test/pending/run/t5256c.check deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/pending/run/t5256c.scala b/test/pending/run/t5256c.scala deleted file mode 100644 index 8ebb51a009..0000000000 --- a/test/pending/run/t5256c.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - { - class A - val c = classToType(classOf[A]) - println(c) - println(c.typeSymbol == classToSymbol(classOf[A])) - } -} diff --git a/test/pending/run/t5256g.check b/test/pending/run/t5256g.check deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/pending/run/t5256g.scala b/test/pending/run/t5256g.scala deleted file mode 100644 index 6158a9281d..0000000000 --- a/test/pending/run/t5256g.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.reflect.mirror._ - -class A -trait B - -object Test extends App { - val mutant = new A with B - val c = classToType(mutant.getClass) - println(c) - println(c.typeSymbol == classToSymbol(mutant.getClass)) -} diff --git a/test/pending/run/t5256h.check b/test/pending/run/t5256h.check deleted file mode 100644 index 4f9b8faf71..0000000000 --- a/test/pending/run/t5256h.check +++ /dev/null @@ -1,8 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - val mutant = new { val x = 2 } - val c = classToType(mutant.getClass) - println(c) - println(c.typeSymbol == classToSymbol(mutant.getClass)) -} diff --git a/test/pending/run/t5256h.scala b/test/pending/run/t5256h.scala deleted file mode 100644 index 4f9b8faf71..0000000000 --- a/test/pending/run/t5256h.scala +++ /dev/null @@ -1,8 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - val mutant = new { val x = 2 } - val c = classToType(mutant.getClass) - println(c) - println(c.typeSymbol == classToSymbol(mutant.getClass)) -} diff --git a/test/pending/run/t5258b.scala b/test/pending/run/t5258b.scala index 82555cde96..a280513d59 100644 --- a/test/pending/run/t5258b.scala +++ b/test/pending/run/t5258b.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/pending/run/t5258c.scala b/test/pending/run/t5258c.scala index a0a1647486..4a656690ba 100644 --- a/test/pending/run/t5258c.scala +++ b/test/pending/run/t5258c.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/pending/run/t5418.scala b/test/pending/run/t5418.scala index 9b0a954e47..e3cb20cf82 100644 --- a/test/pending/run/t5418.scala +++ b/test/pending/run/t5418.scala @@ -1,4 +1,5 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval object Test extends App { reify { diff --git a/test/pending/run/t5427a.scala b/test/pending/run/t5427a.scala index 27b28da0ac..f7cd05158d 100644 --- a/test/pending/run/t5427a.scala +++ b/test/pending/run/t5427a.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Foo { val bar = 2 } diff --git a/test/pending/run/t5427b.scala b/test/pending/run/t5427b.scala index 7a92b6ebbe..e80bd12369 100644 --- a/test/pending/run/t5427b.scala +++ b/test/pending/run/t5427b.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ class Foo { val bar = 2 } diff --git a/test/pending/run/t5427c.scala b/test/pending/run/t5427c.scala index ab41d8b8cd..7095158e85 100644 --- a/test/pending/run/t5427c.scala +++ b/test/pending/run/t5427c.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ class Foo(bar: Int) diff --git a/test/pending/run/t5427d.scala b/test/pending/run/t5427d.scala index fd4c62e876..f0cc07d27e 100644 --- a/test/pending/run/t5427d.scala +++ b/test/pending/run/t5427d.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ class Foo(val bar: Int) diff --git a/test/pending/shootout/meteor.scala b/test/pending/shootout/meteor.scala index 154695533b..6dbd3cf459 100644 --- a/test/pending/shootout/meteor.scala +++ b/test/pending/shootout/meteor.scala @@ -1,3 +1,5 @@ +import scala.reflect.{ClassTag, classTag} + /* The Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy @@ -493,4 +495,3 @@ final class PieceCell extends Cell { - -- cgit v1.2.3