summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/Course-2002-01.check3
-rw-r--r--test/files/run/Course-2002-02.scala8
-rw-r--r--test/files/run/Course-2002-05.scala18
-rw-r--r--test/files/run/Course-2002-06.scala2
-rw-r--r--test/files/run/Course-2002-07.scala162
-rw-r--r--test/files/run/Course-2002-08.scala32
-rw-r--r--test/files/run/Course-2002-09.scala50
-rw-r--r--test/files/run/Course-2002-13.scala20
-rw-r--r--test/files/run/Meter.check3
-rw-r--r--test/files/run/MeterCaseClass.check3
-rw-r--r--test/files/run/OrderingTest.scala8
-rw-r--r--test/files/run/Predef.readLine.scala3
-rw-r--r--test/files/run/ReplacementMatching.scala10
-rw-r--r--test/files/run/ReverseSeqView.scala4
-rw-r--r--test/files/run/SymbolsTest.scala3
-rw-r--r--test/files/run/UnrolledBuffer.scala44
-rw-r--r--test/files/run/WeakHashSetTest.scala14
-rw-r--r--test/files/run/absoverride.scala10
-rw-r--r--test/files/run/abstypetags_serialize.scala3
-rw-r--r--test/files/run/all-overridden.check1
-rw-r--r--test/files/run/all-overridden.scala11
-rw-r--r--test/files/run/analyzerPlugins.check47
-rw-r--r--test/files/run/analyzerPlugins.scala12
-rw-r--r--test/files/run/annotatedRetyping.scala4
-rw-r--r--test/files/run/applydynamic_sip.flags1
-rw-r--r--test/files/run/array-addition.check4
-rw-r--r--test/files/run/array-addition.scala11
-rw-r--r--test/files/run/array-charSeq.scala1
-rw-r--r--test/files/run/array-existential-bound.scala6
-rw-r--r--test/files/run/arrayclone-old.scala24
-rw-r--r--test/files/run/arraycopy.scala2
-rw-r--r--test/files/run/arrays.check6
-rw-r--r--test/files/run/arrays.scala2
-rw-r--r--test/files/run/arrayview.scala2
-rw-r--r--test/files/run/bigDecimalCache.scala4
-rw-r--r--test/files/run/bigDecimalTest.check2
-rw-r--r--test/files/run/bigDecimalTest.scala2
-rw-r--r--test/files/run/bitsets.check5
-rw-r--r--test/files/run/bitsets.scala60
-rw-r--r--test/files/run/blame_eye_triple_eee-double.check9
-rw-r--r--test/files/run/blame_eye_triple_eee-double.flags1
-rw-r--r--test/files/run/blame_eye_triple_eee-double.scala61
-rw-r--r--test/files/run/blame_eye_triple_eee-float.check9
-rw-r--r--test/files/run/blame_eye_triple_eee-float.flags1
-rw-r--r--test/files/run/blame_eye_triple_eee-float.scala61
-rw-r--r--test/files/run/boolexprs.scala2
-rw-r--r--test/files/run/bridges.scala2
-rw-r--r--test/files/run/bugs.scala6
-rw-r--r--test/files/run/case-class-23.check2
-rw-r--r--test/files/run/case-class-23.scala33
-rw-r--r--test/files/run/caseClassEquality.scala12
-rw-r--r--test/files/run/caseclasses.scala2
-rw-r--r--test/files/run/castsingleton.scala2
-rw-r--r--test/files/run/checked.scala6
-rw-r--r--test/files/run/classfile-format-51.scala22
-rw-r--r--test/files/run/classfile-format-52.scala12
-rw-r--r--test/files/run/classmanifests_new_alias.scala4
-rw-r--r--test/files/run/classmanifests_new_core.scala3
-rw-r--r--test/files/run/classof.check2
-rw-r--r--test/files/run/classof.scala6
-rw-r--r--test/files/run/collection-conversions.scala8
-rw-r--r--test/files/run/collection-stacks.check15
-rw-r--r--test/files/run/collection-stacks.scala38
-rw-r--r--test/files/run/collections-toSelf.scala2
-rw-r--r--test/files/run/collections.scala7
-rw-r--r--test/files/run/colltest.check1
-rw-r--r--test/files/run/colltest1.scala14
-rw-r--r--test/files/run/comparable-comparator.scala11
-rw-r--r--test/files/run/compiler-asSeenFrom.check94
-rw-r--r--test/files/run/compiler-asSeenFrom.scala55
-rw-r--r--test/files/run/concat-two-strings.scala2
-rw-r--r--test/files/run/concurrent-map-conversions.scala14
-rw-r--r--test/files/run/concurrent-stream.scala45
-rw-r--r--test/files/run/constant-optimization.check5
-rw-r--r--test/files/run/constant-optimization.flags1
-rw-r--r--test/files/run/constant-optimization.scala61
-rw-r--r--test/files/run/constant-type.check12
-rw-r--r--test/files/run/constant-type.scala8
-rw-r--r--test/files/run/constrained-types.check33
-rw-r--r--test/files/run/constrained-types.scala10
-rw-r--r--test/files/run/contrib674.check3
-rw-r--r--test/files/run/contrib674.scala4
-rw-r--r--test/files/run/ctor-order.scala2
-rw-r--r--test/files/run/ctries-new/concmap.scala62
-rw-r--r--test/files/run/ctries-new/iterator.scala114
-rw-r--r--test/files/run/ctries-new/lnode.scala18
-rw-r--r--test/files/run/ctries-new/main.scala7
-rw-r--r--test/files/run/ctries-new/snapshot.scala88
-rw-r--r--test/files/run/ctries-old/concmap.scala63
-rw-r--r--test/files/run/ctries-old/iterator.scala101
-rw-r--r--test/files/run/ctries-old/lnode.scala19
-rw-r--r--test/files/run/ctries-old/main.scala8
-rw-r--r--test/files/run/ctries-old/snapshot.scala89
-rw-r--r--test/files/run/dead-code-elimination.scala10
-rw-r--r--test/files/run/deeps.check87
-rw-r--r--test/files/run/deeps.scala114
-rw-r--r--test/files/run/delambdafy-dependent-on-param-subst-2.scala20
-rw-r--r--test/files/run/delambdafy-dependent-on-param-subst.flags1
-rw-r--r--test/files/run/delambdafy-dependent-on-param-subst.scala20
-rw-r--r--test/files/run/delambdafy-nested-by-name.check2
-rw-r--r--test/files/run/delambdafy-nested-by-name.scala11
-rw-r--r--test/files/run/delambdafy-two-lambdas.check2
-rw-r--r--test/files/run/delambdafy-two-lambdas.scala12
-rw-r--r--test/files/run/delambdafy_t6028.check57
-rw-r--r--test/files/run/delambdafy_t6028.scala21
-rw-r--r--test/files/run/delambdafy_t6555.check15
-rw-r--r--test/files/run/delambdafy_t6555.scala15
-rw-r--r--test/files/run/delambdafy_uncurry_byname_inline.check21
-rw-r--r--test/files/run/delambdafy_uncurry_byname_inline.scala20
-rw-r--r--test/files/run/delambdafy_uncurry_byname_method.check15
-rw-r--r--test/files/run/delambdafy_uncurry_byname_method.scala20
-rw-r--r--test/files/run/delambdafy_uncurry_inline.check23
-rw-r--r--test/files/run/delambdafy_uncurry_inline.scala20
-rw-r--r--test/files/run/delambdafy_uncurry_method.check17
-rw-r--r--test/files/run/delambdafy_uncurry_method.scala20
-rw-r--r--test/files/run/delay-bad.check7
-rw-r--r--test/files/run/delay-good.check6
-rw-r--r--test/files/run/deprecate-early-type-defs.check3
-rw-r--r--test/files/run/deprecate-early-type-defs.flags1
-rw-r--r--test/files/run/deprecate-early-type-defs.scala1
-rw-r--r--test/files/run/distinct.scala4
-rw-r--r--test/files/run/duration-coarsest.scala28
-rw-r--r--test/files/run/dynamic-applyDynamic.check4
-rw-r--r--test/files/run/dynamic-applyDynamicNamed.check8
-rw-r--r--test/files/run/dynamic-selectDynamic.check4
-rw-r--r--test/files/run/dynamic-updateDynamic.check4
-rw-r--r--test/files/run/elidable-noflags.scala2
-rw-r--r--test/files/run/emptypf.scala4
-rw-r--r--test/files/run/enrich-gentraversable.scala21
-rw-r--r--test/files/run/enums.scala14
-rw-r--r--test/files/run/equality.scala10
-rw-r--r--test/files/run/eta-expand-star2.check1
-rw-r--r--test/files/run/exceptions-2.check3
-rw-r--r--test/files/run/exceptions-2.scala60
-rw-r--r--test/files/run/exceptions-nest.scala30
-rw-r--r--test/files/run/exceptions.scala6
-rw-r--r--test/files/run/existential-rangepos.check13
-rw-r--r--test/files/run/existential-rangepos.scala13
-rw-r--r--test/files/run/existentials-in-compiler.check44
-rw-r--r--test/files/run/existentials-in-compiler.scala10
-rw-r--r--test/files/run/existentials.scala7
-rw-r--r--test/files/run/existentials3-new.check12
-rw-r--r--test/files/run/existentials3-new.scala6
-rw-r--r--test/files/run/existentials3-old.scala2
-rw-r--r--test/files/run/exoticnames.scala8
-rw-r--r--test/files/run/fail-non-value-types.scala10
-rw-r--r--test/files/run/finally.scala30
-rw-r--r--test/files/run/flat-flat-flat.scala2
-rw-r--r--test/files/run/fors.check18
-rw-r--r--test/files/run/fors.scala13
-rw-r--r--test/files/run/forvaleq.scala30
-rw-r--r--test/files/run/freetypes_false_alarm2.scala3
-rw-r--r--test/files/run/gadts.scala4
-rw-r--r--test/files/run/genericValueClass.scala13
-rw-r--r--test/files/run/getClassTest-old.scala3
-rw-r--r--test/files/run/global-showdef.scala15
-rw-r--r--test/files/run/groupby.scala6
-rw-r--r--test/files/run/hashCodeBoxesRunTime.scala12
-rw-r--r--test/files/run/hashhash.scala2
-rw-r--r--test/files/run/hashset.check26
-rw-r--r--test/files/run/hashset.scala48
-rw-r--r--test/files/run/hashsetremove.check6
-rw-r--r--test/files/run/hashsetremove.scala13
-rw-r--r--test/files/run/idempotency-case-classes.check2
-rw-r--r--test/files/run/idempotency-case-classes.scala4
-rw-r--r--test/files/run/idempotency-extractors.scala4
-rw-r--r--test/files/run/idempotency-labels.scala4
-rw-r--r--test/files/run/idempotency-lazy-vals.scala4
-rw-r--r--test/files/run/idempotency-partial-functions.check2
-rw-r--r--test/files/run/idempotency-this.check2
-rw-r--r--test/files/run/idempotency-this.scala4
-rw-r--r--test/files/run/impconvtimes.scala2
-rw-r--r--test/files/run/implicits.scala2
-rw-r--r--test/files/run/indexedSeq.scala11
-rw-r--r--test/files/run/inferred-type-constructors.check56
-rw-r--r--test/files/run/inferred-type-constructors.scala125
-rw-r--r--test/files/run/infix.scala1
-rw-r--r--test/files/run/inline-ex-handlers.check168
-rw-r--r--test/files/run/inline-ex-handlers.scala6
-rw-r--r--test/files/run/inliner-infer.scala5
-rw-r--r--test/files/run/inner-obj-auto.scala570
-rw-r--r--test/files/run/interop_classtags_are_classmanifests.scala5
-rw-r--r--test/files/run/interop_manifests_are_classtags.scala3
-rw-r--r--test/files/run/interop_typetags_are_manifests.flags1
-rw-r--r--test/files/run/interop_typetags_are_manifests.scala1
-rw-r--r--test/files/run/interpolationArgs.check4
-rw-r--r--test/files/run/interpolationArgs.flags1
-rw-r--r--test/files/run/interpolationArgs.scala4
-rw-r--r--test/files/run/interpolationMultiline1.flags1
-rw-r--r--test/files/run/interpolationMultiline2.flags1
-rw-r--r--test/files/run/interpolationMultiline2.scala17
-rw-r--r--test/files/run/intmap.check0
-rw-r--r--test/files/run/io-position.checkbin126 -> 0 bytes
-rw-r--r--test/files/run/io-position.scala13
-rw-r--r--test/files/run/iq.check4
-rw-r--r--test/files/run/iq.scala39
-rw-r--r--test/files/run/is-valid-num.scala33
-rw-r--r--test/files/run/issue192.scala34
-rw-r--r--test/files/run/iterator-concat.check4
-rw-r--r--test/files/run/iterator-concat.scala15
-rw-r--r--test/files/run/iterator-from.scala71
-rw-r--r--test/files/run/iterator-iterate-lazy.scala2
-rw-r--r--test/files/run/iterator3444.scala12
-rw-r--r--test/files/run/iterators.scala8
-rw-r--r--test/files/run/java-erasure.scala2
-rw-r--r--test/files/run/json.check21
-rw-r--r--test/files/run/json.scala283
-rw-r--r--test/files/run/jtptest.check7
-rw-r--r--test/files/run/jtptest.scala17
-rw-r--r--test/files/run/kind-repl-command.check28
-rw-r--r--test/files/run/kind-repl-command.scala12
-rw-r--r--test/files/run/kmpSliceSearch.scala8
-rw-r--r--test/files/run/large_class.check3
-rw-r--r--test/files/run/large_class.scala27
-rw-r--r--test/files/run/lazy-exprs.check8
-rw-r--r--test/files/run/lazy-exprs.scala16
-rw-r--r--test/files/run/lazy-locals.check6
-rw-r--r--test/files/run/lazy-locals.scala14
-rw-r--r--test/files/run/lazy-override-run.scala4
-rw-r--r--test/files/run/lazy-traits.scala74
-rw-r--r--test/files/run/lift-and-unlift.scala10
-rwxr-xr-xtest/files/run/list_map.scala26
-rw-r--r--test/files/run/lists-run.scala12
-rw-r--r--test/files/run/literals.check19
-rw-r--r--test/files/run/literals.scala23
-rw-r--r--test/files/run/longmap.scala8
-rw-r--r--test/files/run/lub-visibility.check5
-rw-r--r--test/files/run/macro-abort-fresh.check8
-rw-r--r--test/files/run/macro-abort-fresh/Macros_1.scala4
-rw-r--r--test/files/run/macro-abort-fresh/Test_2.scala2
-rw-r--r--test/files/run/macro-auto-duplicate/Macros_1.scala2
-rw-r--r--test/files/run/macro-basic-ma-md-mi/Impls_1.scala14
-rw-r--r--test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala14
-rw-r--r--test/files/run/macro-basic-mamd-mi/Impls_1.scala14
-rw-r--r--test/files/run/macro-blackbox-materialization.check3
-rw-r--r--test/files/run/macro-blackbox-materialization/Macros_1.scala16
-rw-r--r--test/files/run/macro-blackbox-materialization/Test_2.scala5
-rw-r--r--test/files/run/macro-bodyexpandstoimpl/Impls_1.scala14
-rw-r--r--test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala4
-rw-r--r--test/files/run/macro-bundle-context-alias.check4
-rw-r--r--test/files/run/macro-bundle-context-alias/Macros_1.scala38
-rw-r--r--test/files/run/macro-bundle-context-alias/Test_2.scala6
-rw-r--r--test/files/run/macro-bundle-context-refinement.check2
-rw-r--r--test/files/run/macro-bundle-context-refinement/Macros_1.scala19
-rw-r--r--test/files/run/macro-bundle-context-refinement/Test_2.scala4
-rw-r--r--test/files/run/macro-bundle-repl.check24
-rw-r--r--test/files/run/macro-bundle-repl.scala13
-rw-r--r--test/files/run/macro-bundle-static.check6
-rw-r--r--test/files/run/macro-bundle-static/Impls_Macros_1.scala30
-rw-r--r--test/files/run/macro-bundle-static/Test_2.scala8
-rw-r--r--test/files/run/macro-bundle-toplevel.check6
-rw-r--r--test/files/run/macro-bundle-toplevel.flags (renamed from test/files/run/macro-declared-in-annotation.flags)0
-rw-r--r--test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala25
-rw-r--r--test/files/run/macro-bundle-toplevel/Test_2.scala8
-rw-r--r--test/files/run/macro-bundle-whitebox-decl.check6
-rw-r--r--test/files/run/macro-bundle-whitebox-decl/Impls_Macros_1.scala26
-rw-r--r--test/files/run/macro-bundle-whitebox-decl/Test_2.scala8
-rw-r--r--test/files/run/macro-bundle-whitebox-use-raw.check5
-rw-r--r--test/files/run/macro-bundle-whitebox-use-raw/Macros_1.scala108
-rw-r--r--test/files/run/macro-bundle-whitebox-use-raw/Test_2.scala19
-rw-r--r--test/files/run/macro-bundle-whitebox-use-refined.check5
-rw-r--r--test/files/run/macro-bundle-whitebox-use-refined/Macros_1.scala108
-rw-r--r--test/files/run/macro-bundle-whitebox-use-refined/Test_2.scala19
-rw-r--r--test/files/run/macro-declared-in-anonymous/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala4
-rw-r--r--test/files/run/macro-declared-in-block/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-class-class/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-class-object/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-class/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-default-param/Macros_Test_2.scala7
-rw-r--r--test/files/run/macro-declared-in-method/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-object-class/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-object-object/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-object/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-package-object/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-refinement/Impls_1.scala11
-rw-r--r--test/files/run/macro-declared-in-refinement/Macros_Test_2.scala6
-rw-r--r--test/files/run/macro-declared-in-trait/Impls_1.scala11
-rw-r--r--test/files/run/macro-def-infer-return-type-a.check1
-rw-r--r--test/files/run/macro-def-infer-return-type-a/Impls_1.scala5
-rw-r--r--test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala4
-rw-r--r--test/files/run/macro-def-infer-return-type-b.check6
-rw-r--r--test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala10
-rw-r--r--test/files/run/macro-def-infer-return-type-b/Test_2.scala8
-rw-r--r--test/files/run/macro-def-infer-return-type-c.check1
-rw-r--r--test/files/run/macro-def-infer-return-type-c/Impls_1.scala5
-rw-r--r--test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala4
-rw-r--r--test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala21
-rw-r--r--test/files/run/macro-def-path-dependent-b.check1
-rw-r--r--test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala20
-rw-r--r--test/files/run/macro-def-path-dependent-c.check1
-rw-r--r--test/files/run/macro-def-path-dependent-d1.check1
-rw-r--r--test/files/run/macro-def-path-dependent-d2.check1
-rw-r--r--test/files/run/macro-def-path-dependent-d2/Macros_2.scala7
-rw-r--r--test/files/run/macro-def-path-dependent.check (renamed from test/files/run/macro-declared-in-annotation.check)0
-rw-r--r--test/files/run/macro-def-path-dependent.flags (renamed from test/files/run/macro-declared-in-anonymous.flags)0
-rw-r--r--test/files/run/macro-def-path-dependent/Dummy.scala (renamed from test/files/run/macro-def-path-dependent-a/Test_2.scala)0
-rw-r--r--test/files/run/macro-def-path-dependent/Test_1.scala25
-rw-r--r--test/files/run/macro-def-path-dependent/Test_2.scala (renamed from test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala)6
-rw-r--r--test/files/run/macro-def-path-dependent/Test_3.scala22
-rw-r--r--test/files/run/macro-def-path-dependent/Test_4.scala (renamed from test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala)6
-rw-r--r--test/files/run/macro-def-path-dependent/Test_5.scala (renamed from test/files/run/macro-def-path-dependent-d2/Impls_1.scala)4
-rw-r--r--test/files/run/macro-def-path-dependent/Test_6.scala9
-rw-r--r--test/files/run/macro-default-params.check1
-rw-r--r--test/files/run/macro-default-params/Macros_1.scala27
-rw-r--r--test/files/run/macro-default-params/Test_2.scala (renamed from test/files/run/macro-def-path-dependent-d1/Test_2.scala)4
-rw-r--r--test/files/run/macro-divergence-spurious/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-duplicate.check3
-rw-r--r--test/files/run/macro-duplicate/Impls_Macros_1.scala10
-rw-r--r--test/files/run/macro-enclosingowner-detectvar.check16
-rw-r--r--test/files/run/macro-enclosingowner-detectvar/Macros_1.scala14
-rw-r--r--test/files/run/macro-enclosingowner-detectvar/Test_2.scala23
-rw-r--r--test/files/run/macro-enclosingowner-sbt.check16
-rw-r--r--test/files/run/macro-enclosingowner-sbt/Macros_1.scala14
-rw-r--r--test/files/run/macro-enclosingowner-sbt/Test_2.scala23
-rw-r--r--test/files/run/macro-enclosures.check34
-rw-r--r--test/files/run/macro-enclosures.flags (renamed from test/files/run/macro-declared-in-block.flags)0
-rw-r--r--test/files/run/macro-enclosures/Impls_Macros_1.scala23
-rw-r--r--test/files/run/macro-enclosures/Test_2.scala11
-rw-r--r--test/files/run/macro-expand-implicit-argument/Macros_1.scala8
-rw-r--r--test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala3
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-view.flags1
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala5
-rw-r--r--test/files/run/macro-expand-multiple-arglists/Impls_1.scala8
-rw-r--r--test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-nullary-generic.check10
-rw-r--r--test/files/run/macro-expand-nullary-generic/Impls_1.scala14
-rw-r--r--test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala8
-rw-r--r--test/files/run/macro-expand-nullary-nongeneric.check10
-rw-r--r--test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala15
-rw-r--r--test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala8
-rw-r--r--test/files/run/macro-expand-overload/Impls_1.scala14
-rw-r--r--test/files/run/macro-expand-overload/Macros_Test_2.scala12
-rw-r--r--test/files/run/macro-expand-override/Impls_1.scala14
-rw-r--r--test/files/run/macro-expand-override/Macros_Test_2.scala14
-rw-r--r--test/files/run/macro-expand-recursive/Impls_1.scala10
-rw-r--r--test/files/run/macro-expand-recursive/Macros_Test_2.scala4
-rw-r--r--test/files/run/macro-expand-tparams-bounds-a.check0
-rw-r--r--test/files/run/macro-expand-tparams-bounds-a.flags1
-rw-r--r--test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala5
-rw-r--r--test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala8
-rw-r--r--test/files/run/macro-expand-tparams-bounds-b.check0
-rw-r--r--test/files/run/macro-expand-tparams-bounds-b.flags1
-rw-r--r--test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala7
-rw-r--r--test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala10
-rw-r--r--test/files/run/macro-expand-tparams-bounds.check2
-rw-r--r--test/files/run/macro-expand-tparams-bounds.flags (renamed from test/files/run/macro-declared-in-class-class.flags)0
-rw-r--r--test/files/run/macro-expand-tparams-bounds/Impls_1.scala12
-rw-r--r--test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala12
-rw-r--r--test/files/run/macro-expand-tparams-explicit/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-tparams-implicit/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-tparams-only-in-impl.flags1
-rw-r--r--test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala5
-rw-r--r--test/files/run/macro-expand-tparams-optional.flags1
-rw-r--r--test/files/run/macro-expand-tparams-optional/Impls_1.scala9
-rw-r--r--test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-a.check4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-a.flags1
-rw-r--r--test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala11
-rw-r--r--test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala10
-rw-r--r--test/files/run/macro-expand-tparams-prefix-b.check2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-b.flags1
-rw-r--r--test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala12
-rw-r--r--test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala10
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c1.check3
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c1.flags1
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala13
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala11
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c2.check3
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c2.flags1
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala19
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala5
-rw-r--r--test/files/run/macro-expand-tparams-prefix-d1.check3
-rw-r--r--test/files/run/macro-expand-tparams-prefix-d1.flags1
-rw-r--r--test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala13
-rw-r--r--test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala11
-rw-r--r--test/files/run/macro-expand-tparams-prefix.check20
-rw-r--r--test/files/run/macro-expand-tparams-prefix.flags (renamed from test/files/run/macro-declared-in-class-object.flags)0
-rw-r--r--test/files/run/macro-expand-tparams-prefix/Impls_1.scala39
-rw-r--r--test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala57
-rw-r--r--test/files/run/macro-expand-unapply-a.check2
-rw-r--r--test/files/run/macro-expand-unapply-a.flags (renamed from test/files/run/macro-declared-in-class.flags)0
-rw-r--r--test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala15
-rw-r--r--test/files/run/macro-expand-unapply-a/Test_2.scala6
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check2
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala4
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala8
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-impl-default-params/Impls_Macros_1.scala17
-rw-r--r--test/files/run/macro-impl-relaxed.check4
-rw-r--r--test/files/run/macro-impl-relaxed/Macros_1.scala14
-rw-r--r--test/files/run/macro-impl-relaxed/Test_2.scala6
-rw-r--r--test/files/run/macro-impl-rename-context/Impls_Macros_1.scala9
-rw-r--r--test/files/run/macro-impl-tparam-only-in-impl.check (renamed from test/files/run/macro-reify-splice-splice.check)0
-rw-r--r--test/files/run/macro-impl-tparam-only-in-impl.flags (renamed from test/files/run/macro-declared-in-default-param.flags)0
-rw-r--r--test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala5
-rw-r--r--test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala (renamed from test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-impl-tparam-typetag-is-optional.check (renamed from test/files/run/macro-expand-tparams-optional.check)0
-rw-r--r--test/files/run/macro-impl-tparam-typetag-is-optional.flags (renamed from test/files/run/macro-declared-in-implicit-class.flags)0
-rw-r--r--test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala9
-rw-r--r--test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala4
-rw-r--r--test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check2
-rw-r--r--test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala2
-rw-r--r--test/files/run/macro-invalidret-nontypeable.check2
-rw-r--r--test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-invalidret-nontypeable/Test_2.scala2
-rw-r--r--test/files/run/macro-invalidusage-badret.check4
-rw-r--r--test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-invalidusage-badret/Test_2.scala2
-rw-r--r--test/files/run/macro-invalidusage-partialapplication-with-tparams.check4
-rw-r--r--test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala2
-rw-r--r--test/files/run/macro-invalidusage-partialapplication.check4
-rw-r--r--test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-invalidusage-partialapplication/Test_2.scala2
-rw-r--r--test/files/run/macro-openmacros.flags3
-rw-r--r--test/files/run/macro-openmacros/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-parse-position-malformed.check1
-rw-r--r--test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala18
-rw-r--r--test/files/run/macro-parse-position-malformed/Test_2.scala (renamed from test/files/run/macro-reify-splice-splice/Test_2.scala)2
-rw-r--r--test/files/run/macro-parse-position.check5
-rw-r--r--test/files/run/macro-parse-position.flags1
-rw-r--r--test/files/run/macro-parse-position/Impls_Macros_1.scala12
-rw-r--r--test/files/run/macro-parse-position/Test_2.scala3
-rw-r--r--test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-quasiquotes.check4
-rw-r--r--test/files/run/macro-quasiquotes/Macros_1.scala15
-rw-r--r--test/files/run/macro-quasiquotes/Test_2.scala5
-rw-r--r--test/files/run/macro-range/Common_1.scala7
-rw-r--r--test/files/run/macro-range/Expansion_Impossible_2.scala14
-rw-r--r--test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala2
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi.check2
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala6
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala12
-rw-r--r--test/files/run/macro-reify-basic/Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-chained1/Impls_Macros_1.scala (renamed from test/files/run/macro-reify-nested-a/Impls_Macros_1.scala)11
-rw-r--r--test/files/run/macro-reify-chained1/Test_2.scala9
-rw-r--r--test/files/run/macro-reify-chained2/Impls_Macros_1.scala (renamed from test/files/run/macro-reify-nested-b/Impls_Macros_1.scala)11
-rw-r--r--test/files/run/macro-reify-chained2/Test_2.scala9
-rw-r--r--test/files/run/macro-reify-freevars.check2
-rw-r--r--test/files/run/macro-reify-freevars/Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-freevars/Test_2.scala8
-rw-r--r--test/files/run/macro-reify-nested-a.check0
-rw-r--r--test/files/run/macro-reify-nested-a.flags1
-rw-r--r--test/files/run/macro-reify-nested-a1/Impls_Macros_1.scala47
-rw-r--r--test/files/run/macro-reify-nested-a1/Test_2.scala (renamed from test/files/run/macro-reify-nested-a/Test_2.scala)5
-rw-r--r--test/files/run/macro-reify-nested-a2/Impls_Macros_1.scala47
-rw-r--r--test/files/run/macro-reify-nested-a2/Test_2.scala9
-rw-r--r--test/files/run/macro-reify-nested-b.check0
-rw-r--r--test/files/run/macro-reify-nested-b.flags1
-rw-r--r--test/files/run/macro-reify-nested-b1/Impls_Macros_1.scala47
-rw-r--r--test/files/run/macro-reify-nested-b1/Test_2.scala (renamed from test/files/run/macro-reify-nested-b/Test_2.scala)5
-rw-r--r--test/files/run/macro-reify-nested-b2/Impls_Macros_1.scala47
-rw-r--r--test/files/run/macro-reify-nested-b2/Test_2.scala9
-rw-r--r--test/files/run/macro-reify-ref-to-packageless/Impls_1.scala4
-rw-r--r--test/files/run/macro-reify-ref-to-packageless/Test_2.scala2
-rw-r--r--test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala10
-rw-r--r--test/files/run/macro-reify-splice-outside-reify/Test_2.scala2
-rw-r--r--test/files/run/macro-reify-splice-splice.flags1
-rw-r--r--test/files/run/macro-reify-splice-splice/Macros_1.scala11
-rw-r--r--test/files/run/macro-reify-staticXXX/Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-tagful-a/Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-tagless-a.check2
-rw-r--r--test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-tagless-a/Test_2.scala6
-rw-r--r--test/files/run/macro-reify-type/Macros_1.scala11
-rw-r--r--test/files/run/macro-reify-type/Test_2.scala18
-rw-r--r--test/files/run/macro-reify-unreify/Macros_1.scala10
-rw-r--r--test/files/run/macro-repl-basic.check22
-rw-r--r--test/files/run/macro-repl-basic.scala14
-rw-r--r--test/files/run/macro-repl-dontexpand.check14
-rw-r--r--test/files/run/macro-repl-dontexpand.scala6
-rw-r--r--test/files/run/macro-settings/Impls_Macros_1.scala9
-rw-r--r--test/files/run/macro-sip19-revised/Impls_Macros_1.scala7
-rw-r--r--test/files/run/macro-sip19/Impls_Macros_1.scala7
-rw-r--r--test/files/run/macro-subpatterns.check3
-rw-r--r--test/files/run/macro-subpatterns/Macro_1.scala17
-rw-r--r--test/files/run/macro-subpatterns/Test_2.scala5
-rw-r--r--test/files/run/macro-system-properties.check20
-rw-r--r--test/files/run/macro-system-properties.scala6
-rw-r--r--test/files/run/macro-term-declared-in-annotation.check (renamed from test/files/run/macro-def-path-dependent-a.check)0
-rw-r--r--test/files/run/macro-term-declared-in-annotation.flags (renamed from test/files/run/macro-declared-in-method.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-annotation/Impls_1.scala (renamed from test/files/run/macro-declared-in-annotation/Impls_1.scala)6
-rw-r--r--test/files/run/macro-term-declared-in-annotation/Macros_2.scala (renamed from test/files/run/macro-declared-in-annotation/Macros_2.scala)0
-rw-r--r--test/files/run/macro-term-declared-in-annotation/Test_3.scala (renamed from test/files/run/macro-declared-in-annotation/Test_3.scala)0
-rw-r--r--test/files/run/macro-term-declared-in-anonymous.check (renamed from test/files/run/macro-declared-in-anonymous.check)0
-rw-r--r--test/files/run/macro-term-declared-in-anonymous.flags (renamed from test/files/run/macro-declared-in-object-class.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-anonymous/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala6
-rw-r--r--test/files/run/macro-term-declared-in-block.check (renamed from test/files/run/macro-declared-in-block.check)0
-rw-r--r--test/files/run/macro-term-declared-in-block.flags (renamed from test/files/run/macro-declared-in-object-object.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-block/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-block/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-block/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-class-class.check (renamed from test/files/run/macro-declared-in-class-class.check)0
-rw-r--r--test/files/run/macro-term-declared-in-class-class.flags (renamed from test/files/run/macro-declared-in-object.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-class-class/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-class-class/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-class-object.check (renamed from test/files/run/macro-declared-in-class-object.check)0
-rw-r--r--test/files/run/macro-term-declared-in-class-object.flags (renamed from test/files/run/macro-declared-in-package-object.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-class-object/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-class-object/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-class.check (renamed from test/files/run/macro-declared-in-class.check)0
-rw-r--r--test/files/run/macro-term-declared-in-class.flags (renamed from test/files/run/macro-declared-in-refinement.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-class/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-class/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-class/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-default-param.check (renamed from test/files/run/macro-declared-in-default-param.check)0
-rw-r--r--test/files/run/macro-term-declared-in-default-param.flags (renamed from test/files/run/macro-declared-in-trait.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-default-param/Impls_1.scala (renamed from test/files/run/macro-declared-in-default-param/Impls_1.scala)6
-rw-r--r--test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala7
-rw-r--r--test/files/run/macro-term-declared-in-implicit-class.check (renamed from test/files/run/macro-declared-in-implicit-class.check)0
-rw-r--r--test/files/run/macro-term-declared-in-implicit-class.flags (renamed from test/files/run/macro-def-infer-return-type-a.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala (renamed from test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala)8
-rw-r--r--test/files/run/macro-term-declared-in-implicit-class/Test_2.scala (renamed from test/files/run/macro-declared-in-implicit-class/Test_2.scala)0
-rw-r--r--test/files/run/macro-term-declared-in-method.check (renamed from test/files/run/macro-declared-in-method.check)0
-rw-r--r--test/files/run/macro-term-declared-in-method.flags (renamed from test/files/run/macro-def-infer-return-type-b.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-method/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-method/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-method/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-object-class.check (renamed from test/files/run/macro-declared-in-object-class.check)0
-rw-r--r--test/files/run/macro-term-declared-in-object-class.flags (renamed from test/files/run/macro-def-infer-return-type-c.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-object-class/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-object-class/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-object-object.check (renamed from test/files/run/macro-declared-in-object-object.check)0
-rw-r--r--test/files/run/macro-term-declared-in-object-object.flags (renamed from test/files/run/macro-def-path-dependent-a.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-object-object/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-object-object/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-object.check (renamed from test/files/run/macro-declared-in-object.check)0
-rw-r--r--test/files/run/macro-term-declared-in-object.flags (renamed from test/files/run/macro-def-path-dependent-b.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-object/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-object/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-object/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-package-object.check (renamed from test/files/run/macro-declared-in-package-object.check)0
-rw-r--r--test/files/run/macro-term-declared-in-package-object.flags (renamed from test/files/run/macro-def-path-dependent-c.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-package-object/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-package-object/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-term-declared-in-refinement.check (renamed from test/files/run/macro-declared-in-refinement.check)0
-rw-r--r--test/files/run/macro-term-declared-in-refinement.flags (renamed from test/files/run/macro-def-path-dependent-d1.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-refinement/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala8
-rw-r--r--test/files/run/macro-term-declared-in-trait.check (renamed from test/files/run/macro-declared-in-trait.check)2
-rw-r--r--test/files/run/macro-term-declared-in-trait.flags (renamed from test/files/run/macro-def-path-dependent-d2.flags)0
-rw-r--r--test/files/run/macro-term-declared-in-trait/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala (renamed from test/files/run/macro-declared-in-trait/Macros_Test_2.scala)2
-rw-r--r--test/files/run/macro-typecheck-implicitsdisabled.check2
-rw-r--r--test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala16
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled.check10
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala25
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2.check12
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala25
-rw-r--r--test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala20
-rw-r--r--test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala7
-rw-r--r--test/files/run/macro-vampire-false-warning/Macros_1.scala32
-rw-r--r--test/files/run/macro-whitebox-dynamic-materialization.check (renamed from test/files/run/t7733.check)1
-rw-r--r--test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala25
-rw-r--r--test/files/run/macro-whitebox-dynamic-materialization/Test_2.scala4
-rw-r--r--test/files/run/macro-whitebox-extractor.check1
-rw-r--r--test/files/run/macro-whitebox-extractor/Macros_1.scala21
-rw-r--r--test/files/run/macro-whitebox-extractor/Test_2.scala5
-rw-r--r--test/files/run/macro-whitebox-fundep-materialization.check1
-rw-r--r--test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala39
-rw-r--r--test/files/run/macro-whitebox-fundep-materialization/Test_2.scala12
-rw-r--r--test/files/run/macro-whitebox-structural.check (renamed from test/files/run/t6955.check)0
-rw-r--r--test/files/run/macro-whitebox-structural/Impls_Macros_1.scala16
-rw-r--r--test/files/run/macro-whitebox-structural/Test_2.scala5
-rw-r--r--test/files/run/macroPlugins-macroArgs.check2
-rw-r--r--test/files/run/macroPlugins-macroArgs/Macros_2.scala11
-rw-r--r--test/files/run/macroPlugins-macroArgs/Plugin_1.scala21
-rw-r--r--test/files/run/macroPlugins-macroArgs/Test_3.flags1
-rw-r--r--test/files/run/macroPlugins-macroArgs/Test_3.scala4
-rw-r--r--test/files/run/macroPlugins-macroArgs/scalac-plugin.xml4
-rw-r--r--test/files/run/macroPlugins-macroExpand.check2
-rw-r--r--test/files/run/macroPlugins-macroExpand.flags1
-rw-r--r--test/files/run/macroPlugins-macroExpand/Macros_2.scala18
-rw-r--r--test/files/run/macroPlugins-macroExpand/Plugin_1.scala27
-rw-r--r--test/files/run/macroPlugins-macroExpand/Test_3.flags1
-rw-r--r--test/files/run/macroPlugins-macroExpand/Test_3.scala4
-rw-r--r--test/files/run/macroPlugins-macroExpand/scalac-plugin.xml4
-rw-r--r--test/files/run/macroPlugins-macroRuntime.check2
-rw-r--r--test/files/run/macroPlugins-macroRuntime/Macros_2.scala11
-rw-r--r--test/files/run/macroPlugins-macroRuntime/Plugin_1.scala20
-rw-r--r--test/files/run/macroPlugins-macroRuntime/Test_3.flags1
-rw-r--r--test/files/run/macroPlugins-macroRuntime/Test_3.scala4
-rw-r--r--test/files/run/macroPlugins-macroRuntime/scalac-plugin.xml4
-rw-r--r--test/files/run/macroPlugins-namerHooks.check45
-rw-r--r--test/files/run/macroPlugins-namerHooks.scala39
-rw-r--r--test/files/run/macroPlugins-typedMacroBody.check2
-rw-r--r--test/files/run/macroPlugins-typedMacroBody.flags1
-rw-r--r--test/files/run/macroPlugins-typedMacroBody/Macros_2.flags1
-rw-r--r--test/files/run/macroPlugins-typedMacroBody/Macros_2.scala18
-rw-r--r--test/files/run/macroPlugins-typedMacroBody/Plugin_1.scala21
-rw-r--r--test/files/run/macroPlugins-typedMacroBody/Test_3.scala4
-rw-r--r--test/files/run/macroPlugins-typedMacroBody/scalac-plugin.xml4
-rw-r--r--test/files/run/manifests-new.scala5
-rw-r--r--test/files/run/manifests-old.scala5
-rw-r--r--test/files/run/mapConserve.scala11
-rw-r--r--test/files/run/mapValues.scala2
-rw-r--r--test/files/run/map_java_conversions.scala26
-rw-r--r--test/files/run/map_test.scala2
-rw-r--r--test/files/run/matchbytes.scala2
-rw-r--r--test/files/run/matchintasany.scala2
-rw-r--r--test/files/run/matchnull.scala2
-rw-r--r--test/files/run/matchonseq.scala10
-rw-r--r--test/files/run/memberpos.check11
-rw-r--r--test/files/run/memberpos.scala39
-rw-r--r--test/files/run/mirror_symbolof_x.check13
-rw-r--r--test/files/run/mirror_symbolof_x.scala43
-rw-r--r--test/files/run/misc.check24
-rw-r--r--test/files/run/misc.scala2
-rw-r--r--test/files/run/missingparams.scala4
-rw-r--r--test/files/run/mixin-signatures.check59
-rw-r--r--test/files/run/mixin-signatures.scala105
-rw-r--r--test/files/run/mutable-treeset.scala145
-rw-r--r--test/files/run/name-based-patmat.check12
-rw-r--r--test/files/run/name-based-patmat.scala105
-rw-r--r--test/files/run/names-defaults.check4
-rw-r--r--test/files/run/names-defaults.scala3
-rw-r--r--test/files/run/no-pickle-skolems.check1
-rw-r--r--test/files/run/no-pickle-skolems/Source_1.scala5
-rw-r--r--test/files/run/no-pickle-skolems/Test_2.scala39
-rw-r--r--test/files/run/nodebuffer-array.check3
-rw-r--r--test/files/run/nodebuffer-array.scala15
-rw-r--r--test/files/run/null-and-intersect.scala6
-rw-r--r--test/files/run/null-hash.scala2
-rw-r--r--test/files/run/number-parsing.scala4
-rw-r--r--test/files/run/numbereq.scala45
-rw-r--r--test/files/run/option-fold.scala13
-rw-r--r--test/files/run/origins.flags2
-rw-r--r--test/files/run/origins.scala2
-rw-r--r--test/files/run/packrat1.check7
-rw-r--r--test/files/run/packrat1.scala47
-rw-r--r--test/files/run/packrat2.check7
-rw-r--r--test/files/run/packrat2.scala57
-rw-r--r--test/files/run/packrat3.check7
-rw-r--r--test/files/run/packrat3.scala51
-rw-r--r--test/files/run/parmap-ops.scala12
-rw-r--r--test/files/run/parserFilter.check9
-rw-r--r--test/files/run/parserFilter.scala15
-rw-r--r--test/files/run/parserForFilter.check1
-rw-r--r--test/files/run/parserForFilter.scala12
-rw-r--r--test/files/run/parserJavaIdent.check26
-rw-r--r--test/files/run/parserJavaIdent.scala26
-rw-r--r--test/files/run/parserNoSuccessMessage.check20
-rw-r--r--test/files/run/parserNoSuccessMessage.scala19
-rw-r--r--test/files/run/partialfun.scala2
-rw-r--r--test/files/run/patch-boundary.scala4
-rw-r--r--test/files/run/patmat-behavior-2.check24
-rw-r--r--test/files/run/patmat-behavior-2.scala50
-rw-r--r--test/files/run/patmat-behavior.check90
-rw-r--r--test/files/run/patmat-behavior.scala95
-rw-r--r--test/files/run/patmat-bind-typed.check1
-rw-r--r--test/files/run/patmat-bind-typed.scala8
-rw-r--r--test/files/run/patmat-exprs.scala10
-rw-r--r--test/files/run/patmat-finally.scala2
-rw-r--r--test/files/run/patmat-mix-case-extractor.check8
-rw-r--r--test/files/run/patmat-mix-case-extractor.scala110
-rw-r--r--test/files/run/patmat-seqs.scala10
-rw-r--r--test/files/run/patmat_unapp_abstype-new.check6
-rw-r--r--test/files/run/patmat_unapp_abstype-new.scala4
-rw-r--r--test/files/run/patmat_unapp_abstype-old.check4
-rw-r--r--test/files/run/patmat_unapp_abstype-old.flags1
-rw-r--r--test/files/run/patmat_unapp_abstype-old.scala83
-rw-r--r--test/files/run/patmatnew.check15
-rw-r--r--test/files/run/patmatnew.scala37
-rw-r--r--test/files/run/pc-conversions.scala38
-rw-r--r--test/files/run/pf-catch.scala10
-rw-r--r--test/files/run/position-val-def.check30
-rw-r--r--test/files/run/position-val-def.scala26
-rw-r--r--test/files/run/preinits.check6
-rw-r--r--test/files/run/primitive-sigs-2-new.flags1
-rw-r--r--test/files/run/primitive-sigs-2-new.scala4
-rw-r--r--test/files/run/primitive-sigs-2-old.flags1
-rw-r--r--test/files/run/primitive-sigs-2-old.scala4
-rw-r--r--test/files/run/priorityQueue.scala66
-rw-r--r--test/files/run/private-inline.check12
-rw-r--r--test/files/run/private-inline.flags2
-rw-r--r--test/files/run/private-inline.scala18
-rw-r--r--test/files/run/private-override.check1
-rw-r--r--test/files/run/programmatic-main.check58
-rw-r--r--test/files/run/programmatic-main.scala4
-rw-r--r--test/files/run/proxy.scala6
-rw-r--r--test/files/run/range-unit.scala8
-rw-r--r--test/files/run/range.check0
-rw-r--r--test/files/run/range.scala35
-rw-r--r--test/files/run/records.scala9
-rw-r--r--test/files/run/reflect-priv-ctor.check1
-rw-r--r--test/files/run/reflect-priv-ctor.scala22
-rw-r--r--test/files/run/reflection-allmirrors-tostring.check18
-rw-r--r--test/files/run/reflection-allmirrors-tostring.scala27
-rw-r--r--test/files/run/reflection-companion.check6
-rw-r--r--test/files/run/reflection-companion.scala16
-rw-r--r--test/files/run/reflection-companiontype.check12
-rw-r--r--test/files/run/reflection-companiontype.scala22
-rw-r--r--test/files/run/reflection-constructormirror-inner-badpath.scala4
-rw-r--r--test/files/run/reflection-constructormirror-inner-good.scala4
-rw-r--r--test/files/run/reflection-constructormirror-nested-badpath.scala4
-rw-r--r--test/files/run/reflection-constructormirror-nested-good.scala4
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-badpath.scala4
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-good.scala4
-rw-r--r--test/files/run/reflection-enclosed-basic.scala4
-rw-r--r--test/files/run/reflection-enclosed-inner-basic.scala10
-rw-r--r--test/files/run/reflection-enclosed-inner-inner-basic.scala10
-rw-r--r--test/files/run/reflection-enclosed-inner-nested-basic.scala10
-rw-r--r--test/files/run/reflection-enclosed-nested-basic.scala10
-rw-r--r--test/files/run/reflection-enclosed-nested-inner-basic.scala10
-rw-r--r--test/files/run/reflection-enclosed-nested-nested-basic.scala10
-rw-r--r--test/files/run/reflection-equality.check10
-rw-r--r--test/files/run/reflection-equality.scala6
-rw-r--r--test/files/run/reflection-fancy-java-classes.check12
-rw-r--r--test/files/run/reflection-fancy-java-classes/Foo_1.java5
-rw-r--r--test/files/run/reflection-fancy-java-classes/Test_2.scala20
-rw-r--r--test/files/run/reflection-fieldmirror-accessorsareokay.scala4
-rw-r--r--test/files/run/reflection-fieldmirror-ctorparam.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-getsetval.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-getsetvar.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-privatethis.scala2
-rw-r--r--test/files/run/reflection-fieldsymbol-navigation.scala2
-rw-r--r--test/files/run/reflection-idtc.check6
-rw-r--r--test/files/run/reflection-idtc.scala16
-rw-r--r--test/files/run/reflection-implClass.scala16
-rw-r--r--test/files/run/reflection-implicit.scala10
-rw-r--r--test/files/run/reflection-java-annotations.check3
-rw-r--r--test/files/run/reflection-java-annotations/Test_2.scala4
-rw-r--r--test/files/run/reflection-java-crtp/Main_2.scala2
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.check17
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.scala26
-rw-r--r--test/files/run/reflection-magicsymbols-repl.check6
-rw-r--r--test/files/run/reflection-magicsymbols-repl.scala4
-rw-r--r--test/files/run/reflection-magicsymbols-vanilla.scala6
-rw-r--r--test/files/run/reflection-mem-typecheck.scala2
-rw-r--r--test/files/run/reflection-methodsymbol-params.scala16
-rw-r--r--test/files/run/reflection-methodsymbol-returntype.scala16
-rw-r--r--test/files/run/reflection-methodsymbol-typeparams.scala16
-rw-r--r--test/files/run/reflection-names.scala8
-rw-r--r--test/files/run/reflection-repl-classes.check6
-rw-r--r--test/files/run/reflection-repl-classes.scala2
-rw-r--r--test/files/run/reflection-repl-elementary.check2
-rw-r--r--test/files/run/reflection-sanitychecks.scala16
-rw-r--r--test/files/run/reflection-scala-annotations.check7
-rw-r--r--test/files/run/reflection-scala-annotations.scala16
-rw-r--r--test/files/run/reflection-sorted-decls.scala2
-rw-r--r--test/files/run/reflection-sorted-members.check1
-rw-r--r--test/files/run/reflection-sorted-members.scala2
-rw-r--r--test/files/run/reflection-sync-potpourri.scala32
-rw-r--r--test/files/run/reflection-sync-subtypes.check (renamed from test/files/run/dead-code-elimination.check)0
-rw-r--r--test/files/run/reflection-sync-subtypes.scala20
-rw-r--r--test/files/run/reflection-tags.check1
-rw-r--r--test/files/run/reflection-tags.scala21
-rw-r--r--test/files/run/reflection-valueclasses-derived.scala6
-rw-r--r--test/files/run/reflection-valueclasses-magic.scala10
-rw-r--r--test/files/run/reflection-valueclasses-standard.scala4
-rw-r--r--test/files/run/reify-aliases.check2
-rw-r--r--test/files/run/reify-each-node-type.check35
-rw-r--r--test/files/run/reify-each-node-type.scala110
-rw-r--r--test/files/run/reify-repl-fail-gracefully.check6
-rw-r--r--test/files/run/reify_ann1a.check2
-rw-r--r--test/files/run/reify_ann1a.scala2
-rw-r--r--test/files/run/reify_ann1b.check7
-rw-r--r--test/files/run/reify_ann1b.scala2
-rw-r--r--test/files/run/reify_ann2a.check2
-rw-r--r--test/files/run/reify_ann2a.scala2
-rw-r--r--test/files/run/reify_ann3.check4
-rw-r--r--test/files/run/reify_ann3.scala2
-rw-r--r--test/files/run/reify_ann4.scala2
-rw-r--r--test/files/run/reify_ann5.scala2
-rw-r--r--test/files/run/reify_classfileann_a.check5
-rw-r--r--test/files/run/reify_classfileann_a.scala2
-rw-r--r--test/files/run/reify_classfileann_b.check5
-rw-r--r--test/files/run/reify_classfileann_b.scala2
-rw-r--r--test/files/run/reify_closure8b.check2
-rw-r--r--test/files/run/reify_copypaste1.scala6
-rw-r--r--test/files/run/reify_extendbuiltins.scala4
-rw-r--r--test/files/run/reify_for1.check0
-rw-r--r--test/files/run/reify_fors_oldpatmat.flags0
-rw-r--r--test/files/run/reify_implicits-new.check1
-rw-r--r--test/files/run/reify_implicits-new.scala18
-rw-r--r--test/files/run/reify_implicits-old.check1
-rw-r--r--test/files/run/reify_implicits-old.scala17
-rw-r--r--test/files/run/reify_lazyevaluation.scala2
-rw-r--r--test/files/run/reify_lazyunit.check3
-rw-r--r--test/files/run/reify_maps_oldpatmat.flags0
-rw-r--r--test/files/run/reify_newimpl_11.check6
-rw-r--r--test/files/run/reify_newimpl_13.check6
-rw-r--r--test/files/run/reify_newimpl_19.check6
-rw-r--r--test/files/run/reify_newimpl_22.check6
-rw-r--r--test/files/run/reify_newimpl_23.check6
-rw-r--r--test/files/run/reify_newimpl_25.check6
-rw-r--r--test/files/run/reify_newimpl_26.check6
-rw-r--r--test/files/run/reify_newimpl_30.check6
-rw-r--r--test/files/run/reify_newimpl_35.check4
-rw-r--r--test/files/run/reify_newimpl_45.scala6
-rw-r--r--test/files/run/reify_printf.check1
-rw-r--r--test/files/run/reify_printf.scala16
-rw-r--r--test/files/run/reify_renamed_term_t5841.check (renamed from test/files/run/reify_renamed_term_si5841.check)0
-rw-r--r--test/files/run/reify_renamed_term_t5841.scala (renamed from test/files/run/reify_renamed_term_si5841.scala)0
-rw-r--r--test/files/run/reify_this.scala6
-rw-r--r--test/files/run/repl-assign.check4
-rw-r--r--test/files/run/repl-backticks.scala6
-rw-r--r--test/files/run/repl-bare-expr.check8
-rw-r--r--test/files/run/repl-colon-type.check28
-rw-r--r--test/files/run/repl-empty-package.check7
-rw-r--r--test/files/run/repl-empty-package/s_1.scala3
-rw-r--r--test/files/run/repl-empty-package/s_2.scala5
-rw-r--r--test/files/run/repl-javap-app.check38
-rw-r--r--test/files/run/repl-javap-app.scala10
-rw-r--r--test/files/run/repl-javap-def.scala17
-rw-r--r--test/files/run/repl-javap-fun.scala16
-rw-r--r--test/files/run/repl-javap-mem.scala19
-rw-r--r--test/files/run/repl-javap-memfun.scala18
-rw-r--r--test/files/run/repl-javap-more-fun.scala17
-rw-r--r--test/files/run/repl-javap-outdir-funs/foo_1.scala6
-rw-r--r--test/files/run/repl-javap-outdir-funs/run-repl_7.scala17
-rw-r--r--test/files/run/repl-javap-outdir/foo_1.scala6
-rw-r--r--test/files/run/repl-javap-outdir/run-repl_7.scala12
-rw-r--r--test/files/run/repl-javap.scala13
-rw-r--r--test/files/run/repl-out-dir.check49
-rw-r--r--test/files/run/repl-out-dir.scala13
-rw-r--r--test/files/run/repl-paste-2.check3
-rw-r--r--test/files/run/repl-paste-3.check4
-rw-r--r--test/files/run/repl-paste-4.pastie4
-rw-r--r--test/files/run/repl-paste-4.scala20
-rw-r--r--test/files/run/repl-paste-raw.pastie8
-rw-r--r--test/files/run/repl-paste-raw.scala20
-rw-r--r--test/files/run/repl-paste.check3
-rw-r--r--test/files/run/repl-power.check14
-rw-r--r--test/files/run/repl-power.scala2
-rw-r--r--test/files/run/repl-reset.check10
-rw-r--r--test/files/run/repl-save.check3
-rw-r--r--test/files/run/repl-save.scala25
-rw-r--r--test/files/run/repl-term-macros.check40
-rw-r--r--test/files/run/repl-term-macros.scala20
-rw-r--r--test/files/run/repl-transcript.check3
-rw-r--r--test/files/run/repl-trim-stack-trace.scala45
-rw-r--r--test/files/run/repl-type-verbose.check6
-rw-r--r--test/files/run/resetattrs-this.scala8
-rw-r--r--test/files/run/richs.check1
-rw-r--r--test/files/run/richs.scala4
-rw-r--r--test/files/run/run-bug4840.scala8
-rw-r--r--test/files/run/runtime-richChar.scala10
-rw-r--r--test/files/run/runtime.check6
-rw-r--r--test/files/run/runtime.scala4
-rw-r--r--test/files/run/sammy_java8.flags (renamed from test/files/run/interpolation.flags)0
-rw-r--r--test/files/run/sammy_java8.scala34
-rw-r--r--test/files/run/scan.scala8
-rw-r--r--test/files/run/search.check6
-rw-r--r--test/files/run/search.scala14
-rw-r--r--test/files/run/seqlike-kmp.scala6
-rw-r--r--test/files/run/sequenceComparisons.scala42
-rw-r--r--test/files/run/serialize-stream.scala4
-rw-r--r--test/files/run/settings-parse.check566
-rw-r--r--test/files/run/settings-parse.scala29
-rw-r--r--test/files/run/shortClass.check10
-rw-r--r--test/files/run/shortClass.scala24
-rw-r--r--test/files/run/showdecl.check34
-rw-r--r--test/files/run/showdecl/Macros_1.scala30
-rw-r--r--test/files/run/showdecl/Test_2.scala32
-rw-r--r--test/files/run/showraw_aliases.check4
-rw-r--r--test/files/run/showraw_aliases.scala2
-rw-r--r--test/files/run/showraw_mods.check2
-rw-r--r--test/files/run/showraw_tree.check4
-rw-r--r--test/files/run/showraw_tree_ids.check4
-rw-r--r--test/files/run/showraw_tree_kinds.check4
-rw-r--r--test/files/run/showraw_tree_types_ids.check16
-rw-r--r--test/files/run/showraw_tree_types_ids.scala4
-rw-r--r--test/files/run/showraw_tree_types_typed.check16
-rw-r--r--test/files/run/showraw_tree_types_typed.scala4
-rw-r--r--test/files/run/showraw_tree_types_untyped.check4
-rw-r--r--test/files/run/showraw_tree_ultimate.check24
-rw-r--r--test/files/run/showraw_tree_ultimate.scala4
-rw-r--r--test/files/run/slice-strings.scala6
-rw-r--r--test/files/run/slices.scala3
-rw-r--r--test/files/run/sm-interpolator.scala6
-rw-r--r--test/files/run/spec-nlreturn.scala5
-rw-r--r--test/files/run/static-module-method.check1
-rw-r--r--test/files/run/static-module-method.scala14
-rw-r--r--test/files/run/streamWithFilter.scala2
-rw-r--r--test/files/run/stream_flatmap_odds.scala2
-rw-r--r--test/files/run/stream_length.check4
-rw-r--r--test/files/run/stream_length.scala6
-rw-r--r--test/files/run/streams.scala2
-rw-r--r--test/files/run/string-extractor.check9
-rw-r--r--test/files/run/string-extractor.scala60
-rw-r--r--test/files/run/stringbuilder-drop.scala4
-rw-r--r--test/files/run/stringbuilder.scala21
-rw-r--r--test/files/run/stringinterpolation_macro-run.check5
-rw-r--r--test/files/run/stringinterpolation_macro-run.scala18
-rw-r--r--test/files/run/structural.scala59
-rw-r--r--test/files/run/synchronized.check1
-rw-r--r--test/files/run/synchronized.flags2
-rw-r--r--test/files/run/sysprops.scala10
-rw-r--r--test/files/run/t0017.scala2
-rw-r--r--test/files/run/t0091.check1
-rw-r--r--test/files/run/t0091.scala15
-rw-r--r--test/files/run/t0325.scala10
-rw-r--r--test/files/run/t0421-old.scala12
-rw-r--r--test/files/run/t0432.scala3
-rw-r--r--test/files/run/t0486.check8
-rw-r--r--test/files/run/t0486.scala24
-rw-r--r--test/files/run/t0508.scala2
-rw-r--r--test/files/run/t0528.scala2
-rw-r--r--test/files/run/t0631.scala2
-rwxr-xr-xtest/files/run/t0663.check1
-rw-r--r--test/files/run/t0663.scala6
-rw-r--r--test/files/run/t0668.check0
-rw-r--r--test/files/run/t0677-old.scala5
-rw-r--r--test/files/run/t0700.check2
-rw-r--r--test/files/run/t0700.scala24
-rw-r--r--test/files/run/t0807.scala2
-rw-r--r--test/files/run/t0883.scala12
-rw-r--r--test/files/run/t1005.scala11
-rw-r--r--test/files/run/t1042.scala2
-rw-r--r--test/files/run/t107.check1
-rw-r--r--test/files/run/t107.scala8
-rw-r--r--test/files/run/t1079.check1
-rw-r--r--test/files/run/t1079.scala3
-rw-r--r--test/files/run/t1100.check4
-rw-r--r--test/files/run/t1100.scala17
-rw-r--r--test/files/run/t1110.scala6
-rw-r--r--test/files/run/t1141.scala6
-rw-r--r--test/files/run/t1167.flags1
-rw-r--r--test/files/run/t1167.scala6
-rw-r--r--test/files/run/t1195-new.scala6
-rw-r--r--test/files/run/t1195-old.scala3
-rw-r--r--test/files/run/t1220.scala2
-rw-r--r--test/files/run/t1300.scala4
-rw-r--r--test/files/run/t1309.scala2
-rw-r--r--test/files/run/t1323.scala4
-rw-r--r--test/files/run/t1333.scala4
-rw-r--r--test/files/run/t1368.check3
-rw-r--r--test/files/run/t1423.scala2
-rw-r--r--test/files/run/t1427.check3
-rw-r--r--test/files/run/t1427.scala5
-rw-r--r--test/files/run/t1430/Bar_1.java4
-rw-r--r--test/files/run/t1430/Test_2.scala2
-rw-r--r--test/files/run/t1500.scala8
-rw-r--r--test/files/run/t1501.scala8
-rw-r--r--test/files/run/t1503.check1
-rw-r--r--test/files/run/t1503.scala20
-rw-r--r--test/files/run/t1503_future.flags1
-rw-r--r--test/files/run/t1503_future.scala17
-rw-r--r--test/files/run/t1505.scala13
-rw-r--r--test/files/run/t153.scala2
-rw-r--r--test/files/run/t1537.scala6
-rw-r--r--test/files/run/t1591.scala6
-rwxr-xr-xtest/files/run/t1620.check6
-rw-r--r--test/files/run/t1620.scala16
-rw-r--r--test/files/run/t1718.scala4
-rw-r--r--test/files/run/t1766.scala15
-rw-r--r--test/files/run/t1773.scala12
-rw-r--r--test/files/run/t1829.check0
-rw-r--r--test/files/run/t1829.scala2
-rw-r--r--test/files/run/t1909.check3
-rw-r--r--test/files/run/t1909.scala12
-rw-r--r--test/files/run/t1909b.scala9
-rw-r--r--test/files/run/t1909c.scala9
-rw-r--r--test/files/run/t1987.scala8
-rw-r--r--test/files/run/t2029.scala4
-rw-r--r--test/files/run/t2074_2.scala2
-rw-r--r--test/files/run/t2087-and-2400.scala6
-rw-r--r--test/files/run/t2106.check6
-rw-r--r--test/files/run/t2106.flags2
-rw-r--r--test/files/run/t2106.scala2
-rwxr-xr-xtest/files/run/t2124.check1
-rw-r--r--test/files/run/t2124.scala25
-rwxr-xr-xtest/files/run/t2125.check1
-rw-r--r--test/files/run/t2125.scala25
-rw-r--r--test/files/run/t2212.check1
-rw-r--r--test/files/run/t2251.check1
-rw-r--r--test/files/run/t2251.flags1
-rw-r--r--test/files/run/t2251.scala19
-rw-r--r--test/files/run/t2251b.check11
-rw-r--r--test/files/run/t2251b.flags1
-rw-r--r--test/files/run/t2251b.scala48
-rw-r--r--test/files/run/t2276.check8
-rw-r--r--test/files/run/t2276.scala24
-rw-r--r--test/files/run/t2296c/Action.java2
-rw-r--r--test/files/run/t2308a.scala6
-rw-r--r--test/files/run/t2318.check2
-rw-r--r--test/files/run/t2318.scala41
-rw-r--r--test/files/run/t2333.scala4
-rw-r--r--test/files/run/t2337.scala2
-rw-r--r--test/files/run/t2354.scala17
-rw-r--r--test/files/run/t2417.scala20
-rw-r--r--test/files/run/t2464/Annotated.java5
-rw-r--r--test/files/run/t2464/Connect.java20
-rw-r--r--test/files/run/t2464/Test.scala35
-rw-r--r--test/files/run/t2512.scala4
-rw-r--r--test/files/run/t2514.scala10
-rw-r--r--test/files/run/t2526.scala16
-rw-r--r--test/files/run/t2552.scala14
-rw-r--r--test/files/run/t2577.check1
-rw-r--r--test/files/run/t2577.scala17
-rw-r--r--test/files/run/t2594_tcpoly.check0
-rw-r--r--test/files/run/t2594_tcpoly.scala5
-rw-r--r--test/files/run/t261.check2
-rw-r--r--test/files/run/t261.scala11
-rw-r--r--test/files/run/t2636.scala17
-rw-r--r--test/files/run/t266.scala4
-rw-r--r--test/files/run/t2721.check2
-rw-r--r--test/files/run/t2721.scala12
-rw-r--r--test/files/run/t2755.scala6
-rw-r--r--test/files/run/t2800.scala8
-rw-r--r--test/files/run/t2818.scala4
-rw-r--r--test/files/run/t2849.scala6
-rw-r--r--test/files/run/t2867.scala6
-rw-r--r--test/files/run/t2873.check2
-rw-r--r--test/files/run/t2873.scala7
-rw-r--r--test/files/run/t2886.check4
-rw-r--r--test/files/run/t2958.scala4
-rwxr-xr-xtest/files/run/t3026.scala2
-rw-r--r--test/files/run/t3038.scala14
-rw-r--r--test/files/run/t3038c/A_1.scala4
-rw-r--r--test/files/run/t3038d.scala16
-rw-r--r--test/files/run/t3050.scala6
-rw-r--r--test/files/run/t3112.scala2
-rw-r--r--test/files/run/t3150.scala2
-rw-r--r--test/files/run/t3158.scala2
-rw-r--r--test/files/run/t3175.scala29
-rw-r--r--test/files/run/t3199b.check1
-rw-r--r--test/files/run/t3199b.scala11
-rw-r--r--test/files/run/t3232.scala8
-rw-r--r--test/files/run/t3235-minimal.check12
-rw-r--r--test/files/run/t3235-minimal.flags1
-rw-r--r--test/files/run/t3235-minimal.scala8
-rw-r--r--test/files/run/t3242.scala3
-rw-r--r--test/files/run/t3269.scala2
-rw-r--r--test/files/run/t3273.scala2
-rw-r--r--test/files/run/t3326.scala28
-rw-r--r--test/files/run/t3346a.check1
-rw-r--r--test/files/run/t3346a.scala11
-rw-r--r--test/files/run/t3346d.scala21
-rw-r--r--test/files/run/t3346e.check12
-rw-r--r--test/files/run/t3346e.scala81
-rw-r--r--test/files/run/t3346f.check2
-rw-r--r--test/files/run/t3346f.scala15
-rw-r--r--test/files/run/t3346g.check1
-rw-r--r--test/files/run/t3346g.scala9
-rw-r--r--test/files/run/t3346h.check1
-rw-r--r--test/files/run/t3346h.scala9
-rw-r--r--test/files/run/t3346j.check1
-rw-r--r--test/files/run/t3346j.scala11
-rw-r--r--test/files/run/t3361.check1
-rw-r--r--test/files/run/t3361.scala6
-rw-r--r--test/files/run/t3376.check2
-rw-r--r--test/files/run/t3395.scala6
-rw-r--r--test/files/run/t3397.scala2
-rw-r--r--test/files/run/t3425.check4
-rw-r--r--test/files/run/t3425.scala41
-rw-r--r--test/files/run/t3425b.check152
-rw-r--r--test/files/run/t3425b/Base_1.scala89
-rw-r--r--test/files/run/t3425b/Generated_2.scala886
-rw-r--r--test/files/run/t3452.check1
-rw-r--r--test/files/run/t3452.scala21
-rw-r--r--test/files/run/t3452a.check1
-rw-r--r--test/files/run/t3452a/J_2.java5
-rw-r--r--test/files/run/t3452a/S_1.scala24
-rw-r--r--test/files/run/t3452a/S_3.scala5
-rw-r--r--test/files/run/t3452b-bcode.check2
-rw-r--r--test/files/run/t3452b-bcode.flags1
-rw-r--r--test/files/run/t3452b-bcode/J_2.java6
-rw-r--r--test/files/run/t3452b-bcode/S_1.scala17
-rw-r--r--test/files/run/t3452b-bcode/S_3.scala5
-rw-r--r--test/files/run/t3452b.check2
-rw-r--r--test/files/run/t3452b/J_2.java6
-rw-r--r--test/files/run/t3452b/S_1.scala17
-rw-r--r--test/files/run/t3452b/S_3.scala5
-rw-r--r--test/files/run/t3452c.check8
-rw-r--r--test/files/run/t3452c.scala113
-rw-r--r--test/files/run/t3452d/A.scala7
-rw-r--r--test/files/run/t3452d/Test.java12
-rw-r--r--test/files/run/t3452e/A.scala4
-rw-r--r--test/files/run/t3452e/B.java2
-rw-r--r--test/files/run/t3452e/Test.scala (renamed from test/files/run/macro-def-path-dependent-d2/Test_3.scala)4
-rw-r--r--test/files/run/t3452f.scala19
-rw-r--r--test/files/run/t3452g/A.scala9
-rw-r--r--test/files/run/t3452g/Test.java14
-rw-r--r--test/files/run/t3452h.scala8
-rw-r--r--test/files/run/t3488.check6
-rw-r--r--test/files/run/t3488.scala2
-rw-r--r--test/files/run/t3493.scala4
-rw-r--r--test/files/run/t3496.scala4
-rw-r--r--test/files/run/t3502.scala6
-rw-r--r--test/files/run/t3507-new.scala4
-rw-r--r--test/files/run/t3509.scala4
-rw-r--r--test/files/run/t3511.scala18
-rw-r--r--test/files/run/t3516.scala2
-rw-r--r--test/files/run/t3518.scala2
-rw-r--r--test/files/run/t3529.scala1
-rw-r--r--test/files/run/t3530.scala6
-rw-r--r--test/files/run/t3540.scala2
-rw-r--r--test/files/run/t3563.scala6
-rw-r--r--test/files/run/t3569.scala13
-rw-r--r--test/files/run/t3575.scala2
-rw-r--r--test/files/run/t3580.scala6
-rw-r--r--test/files/run/t3603.scala8
-rw-r--r--test/files/run/t3613.scala6
-rw-r--r--test/files/run/t3619.scala2
-rw-r--r--test/files/run/t363.scala2
-rw-r--r--test/files/run/t3647.scala4
-rw-r--r--test/files/run/t3651.scala2
-rw-r--r--test/files/run/t3667.check3
-rw-r--r--test/files/run/t3667.scala35
-rw-r--r--test/files/run/t3702.scala2
-rw-r--r--test/files/run/t3705.scala17
-rw-r--r--test/files/run/t3714.scala2
-rw-r--r--test/files/run/t3719.scala4
-rw-r--r--test/files/run/t3758-old.scala4
-rw-r--r--test/files/run/t3822.scala8
-rw-r--r--test/files/run/t3829.scala10
-rw-r--r--test/files/run/t3832.scala17
-rw-r--r--test/files/run/t3835.scala2
-rw-r--r--test/files/run/t3855.scala6
-rw-r--r--test/files/run/t3877.scala16
-rw-r--r--test/files/run/t3886.scala11
-rw-r--r--test/files/run/t3887.scala2
-rw-r--r--test/files/run/t3888.check1
-rw-r--r--test/files/run/t3888.scala11
-rw-r--r--test/files/run/t3897.check8
-rw-r--r--test/files/run/t3897.flags1
-rw-r--r--test/files/run/t3897/J_2.java27
-rw-r--r--test/files/run/t3897/a_1.scala8
-rw-r--r--test/files/run/t3897/a_2.scala23
-rw-r--r--test/files/run/t3932.scala4
-rw-r--r--test/files/run/t3935.scala2
-rw-r--r--test/files/run/t3964.scala9
-rw-r--r--test/files/run/t3970.check1
-rw-r--r--test/files/run/t3970.scala4
-rw-r--r--test/files/run/t3980.scala2
-rw-r--r--test/files/run/t3984.scala2
-rw-r--r--test/files/run/t3996.check1
-rw-r--r--test/files/run/t4013.scala4
-rw-r--r--test/files/run/t4013b.scala2
-rw-r--r--test/files/run/t4023.check21
-rw-r--r--test/files/run/t4023.scala34
-rw-r--r--test/files/run/t4024.scala4
-rw-r--r--test/files/run/t4025.check2
-rw-r--r--test/files/run/t4027.scala6
-rw-r--r--test/files/run/t4047.check12
-rw-r--r--test/files/run/t4047.scala2
-rw-r--r--test/files/run/t4054.scala2
-rw-r--r--test/files/run/t4062.scala2
-rw-r--r--test/files/run/t4072.scala6
-rw-r--r--test/files/run/t408.scala2
-rw-r--r--test/files/run/t4080.check1
-rw-r--r--test/files/run/t4080.scala5
-rw-r--r--test/files/run/t4119/J.java2
-rw-r--r--test/files/run/t4119/S.scala2
-rw-r--r--test/files/run/t4122.scala2
-rw-r--r--test/files/run/t4138.check2
-rw-r--r--test/files/run/t4138.scala6
-rw-r--r--test/files/run/t4146.scala7
-rw-r--r--test/files/run/t4148.scala8
-rw-r--r--test/files/run/t4171.scala3
-rw-r--r--test/files/run/t4172.check6
-rw-r--r--test/files/run/t4238/J_1.java4
-rw-r--r--test/files/run/t4285.check4
-rw-r--r--test/files/run/t4287inferredMethodTypes.check30
-rw-r--r--test/files/run/t4287inferredMethodTypes.scala25
-rw-r--r--test/files/run/t4288.scala4
-rw-r--r--test/files/run/t4294.scala7
-rw-r--r--test/files/run/t4317/S_3.scala2
-rw-r--r--test/files/run/t4332.check25
-rw-r--r--test/files/run/t4332.scala44
-rw-r--r--test/files/run/t4332b.scala35
-rw-r--r--test/files/run/t4351.check1
-rw-r--r--test/files/run/t4351.scala21
-rw-r--r--test/files/run/t4387.scala12
-rw-r--r--test/files/run/t4396.check1
-rw-r--r--test/files/run/t4396.scala2
-rw-r--r--test/files/run/t4398.scala2
-rw-r--r--test/files/run/t4415.scala2
-rw-r--r--test/files/run/t4426.scala6
-rw-r--r--test/files/run/t4461.check3
-rw-r--r--test/files/run/t4461.scala2
-rw-r--r--test/files/run/t4535.scala10
-rw-r--r--test/files/run/t4536.scala4
-rw-r--r--test/files/run/t4537.check1
-rw-r--r--test/files/run/t4537/a.scala5
-rw-r--r--test/files/run/t4537/b.scala5
-rw-r--r--test/files/run/t4537/c.scala8
-rw-r--r--test/files/run/t4537/d.scala6
-rw-r--r--test/files/run/t4542.check4
-rw-r--r--test/files/run/t4560.scala3
-rw-r--r--test/files/run/t4570.scala4
-rw-r--r--test/files/run/t4574.check2
-rw-r--r--test/files/run/t4577.scala38
-rw-r--r--test/files/run/t4594-repl-settings.scala26
-rw-r--r--test/files/run/t4608.scala4
-rw-r--r--test/files/run/t4617.scala2
-rw-r--r--test/files/run/t4656.scala2
-rw-r--r--test/files/run/t4660.scala2
-rw-r--r--test/files/run/t4671.check6
-rw-r--r--test/files/run/t4671.scala2
-rw-r--r--test/files/run/t4680.check7
-rw-r--r--test/files/run/t4680.scala4
-rw-r--r--test/files/run/t4697.scala2
-rw-r--r--test/files/run/t4729/S_2.scala3
-rw-r--r--test/files/run/t4742.flags1
-rw-r--r--test/files/run/t4742.scala7
-rw-r--r--test/files/run/t4750.check (renamed from test/files/run/si4750.check)0
-rw-r--r--test/files/run/t4750.scala (renamed from test/files/run/si4750.scala)0
-rw-r--r--test/files/run/t4752.scala4
-rw-r--r--test/files/run/t4753.scala2
-rw-r--r--test/files/run/t4761.scala2
-rw-r--r--test/files/run/t4766.scala4
-rw-r--r--test/files/run/t4777.scala4
-rw-r--r--test/files/run/t4794.scala3
-rw-r--r--test/files/run/t4809.scala8
-rw-r--r--test/files/run/t4813.check1
-rw-r--r--test/files/run/t4835.scala2
-rw-r--r--test/files/run/t4841-isolate-plugins.check2
-rw-r--r--test/files/run/t4841-isolate-plugins/ploogin.scala30
-rw-r--r--test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala39
-rw-r--r--test/files/run/t4841-no-plugin.check1
-rw-r--r--test/files/run/t4841-no-plugin.scala17
-rw-r--r--test/files/run/t4859.check8
-rw-r--r--test/files/run/t4859.scala29
-rw-r--r--test/files/run/t4871.scala2
-rw-r--r--test/files/run/t4894.scala8
-rw-r--r--test/files/run/t4895.scala6
-rw-r--r--test/files/run/t4929.check1
-rw-r--r--test/files/run/t4929.scala42
-rw-r--r--test/files/run/t4935.flags2
-rw-r--r--test/files/run/t4954.scala10
-rw-r--r--test/files/run/t498.scala3
-rw-r--r--test/files/run/t4996.check4
-rw-r--r--test/files/run/t4996.scala47
-rw-r--r--test/files/run/t5018.scala14
-rw-r--r--test/files/run/t5045.check (renamed from test/files/run/si5045.check)0
-rw-r--r--test/files/run/t5045.scala (renamed from test/files/run/si5045.scala)3
-rw-r--r--test/files/run/t5052.scala6
-rw-r--r--test/files/run/t5053.scala9
-rw-r--r--test/files/run/t5064.check6
-rw-r--r--test/files/run/t5072.check4
-rw-r--r--test/files/run/t5080.scala4
-rw-r--r--test/files/run/t5115.scala14
-rw-r--r--test/files/run/t5125b.scala2
-rw-r--r--test/files/run/t5134.scala8
-rw-r--r--test/files/run/t5224.check5
-rw-r--r--test/files/run/t5225_2.check2
-rw-r--r--test/files/run/t5225_2.scala2
-rw-r--r--test/files/run/t5229_1.check0
-rw-r--r--test/files/run/t5256a.scala2
-rw-r--r--test/files/run/t5256b.scala2
-rw-r--r--test/files/run/t5256c.scala2
-rw-r--r--test/files/run/t5256d.check6
-rw-r--r--test/files/run/t5256d.scala2
-rw-r--r--test/files/run/t5256e.scala2
-rw-r--r--test/files/run/t5256f.scala4
-rw-r--r--test/files/run/t5256g.check6
-rw-r--r--test/files/run/t5256g.scala2
-rw-r--r--test/files/run/t5256h.check4
-rw-r--r--test/files/run/t5256h.scala3
-rw-r--r--test/files/run/t5262.scala8
-rw-r--r--test/files/run/t5271_4.check0
-rw-r--r--test/files/run/t5272_1_oldpatmat.flags0
-rw-r--r--test/files/run/t5272_2_oldpatmat.flags0
-rw-r--r--test/files/run/t5273_1_oldpatmat.flags0
-rw-r--r--test/files/run/t5273_2a_oldpatmat.flags0
-rw-r--r--test/files/run/t5273_2b_oldpatmat.flags0
-rw-r--r--test/files/run/t5277_1.scala3
-rw-r--r--test/files/run/t5284b.check3
-rw-r--r--test/files/run/t5284b.scala2
-rw-r--r--test/files/run/t5284c.check3
-rw-r--r--test/files/run/t5284c.scala2
-rw-r--r--test/files/run/t5293-map.scala88
-rw-r--r--test/files/run/t5293.scala83
-rw-r--r--test/files/run/t5300.scala2
-rw-r--r--test/files/run/t5313.scala14
-rw-r--r--test/files/run/t5356.scala2
-rw-r--r--test/files/run/t5375.check2
-rw-r--r--test/files/run/t5375.scala23
-rw-r--r--test/files/run/t5380.check9
-rw-r--r--test/files/run/t5380.scala2
-rw-r--r--test/files/run/t5415.check0
-rw-r--r--test/files/run/t5415.scala2
-rw-r--r--test/files/run/t5418.scala8
-rw-r--r--test/files/run/t5418b.check2
-rw-r--r--test/files/run/t5418b.scala2
-rw-r--r--test/files/run/t5428.check3
-rw-r--r--test/files/run/t5428.scala14
-rw-r--r--test/files/run/t5488-fn.scala2
-rw-r--r--test/files/run/t5488.scala6
-rw-r--r--test/files/run/t5500b.scala4
-rw-r--r--test/files/run/t5514.check19
-rw-r--r--test/files/run/t5514.scala35
-rw-r--r--test/files/run/t5527.check99
-rw-r--r--test/files/run/t5527.scala107
-rw-r--r--test/files/run/t5535.check4
-rw-r--r--test/files/run/t5537.check4
-rw-r--r--test/files/run/t5545.check0
-rw-r--r--test/files/run/t5565.scala12
-rw-r--r--test/files/run/t5568.flags1
-rw-r--r--test/files/run/t5577.scala8
-rw-r--r--test/files/run/t5583.check4
-rw-r--r--test/files/run/t5590.scala10
-rw-r--r--test/files/run/t5603.check8
-rw-r--r--test/files/run/t5603.scala5
-rw-r--r--test/files/run/t5610.scala2
-rw-r--r--test/files/run/t5610a.check1
-rw-r--r--test/files/run/t5610a.scala19
-rw-r--r--test/files/run/t5629.scala4
-rw-r--r--test/files/run/t5629b.check2
-rw-r--r--test/files/run/t5629b.scala23
-rw-r--r--test/files/run/t5655.check6
-rw-r--r--test/files/run/t5656.scala4
-rw-r--r--test/files/run/t5676.scala4
-rwxr-xr-xtest/files/run/t5699.scala2
-rw-r--r--test/files/run/t5704.scala2
-rw-r--r--test/files/run/t5713/Impls_Macros_1.scala2
-rwxr-xr-xtest/files/run/t5717.scala21
-rw-r--r--test/files/run/t5753_1/Impls_Macros_1.scala2
-rw-r--r--test/files/run/t5753_1/Test_2.scala2
-rw-r--r--test/files/run/t5753_2/Impls_Macros_1.scala4
-rw-r--r--test/files/run/t5753_2/Test_2.scala2
-rw-r--r--test/files/run/t576.check1
-rw-r--r--test/files/run/t576.scala2
-rw-r--r--test/files/run/t5789.check6
-rw-r--r--test/files/run/t5804.scala14
-rw-r--r--test/files/run/t5816.scala2
-rw-r--r--test/files/run/t5843.check9
-rw-r--r--test/files/run/t5843.scala15
-rw-r--r--test/files/run/t5857.scala20
-rw-r--r--test/files/run/t5867.scala6
-rw-r--r--test/files/run/t5879.check8
-rw-r--r--test/files/run/t5879.scala35
-rw-r--r--test/files/run/t5880.scala8
-rw-r--r--test/files/run/t5881.scala3
-rw-r--r--test/files/run/t5894.scala7
-rw-r--r--test/files/run/t5903a.check1
-rw-r--r--test/files/run/t5903a.flags1
-rw-r--r--test/files/run/t5903a/Macros_1.scala28
-rw-r--r--test/files/run/t5903a/Test_2.scala6
-rw-r--r--test/files/run/t5903b.check1
-rw-r--r--test/files/run/t5903b.flags1
-rw-r--r--test/files/run/t5903b/Macros_1.scala25
-rw-r--r--test/files/run/t5903b/Test_2.scala6
-rw-r--r--test/files/run/t5903c.check (renamed from test/files/run/t6956.check)0
-rw-r--r--test/files/run/t5903c.flags1
-rw-r--r--test/files/run/t5903c/Macros_1.scala23
-rw-r--r--test/files/run/t5903c/Test_2.scala6
-rw-r--r--test/files/run/t5903d.check1
-rw-r--r--test/files/run/t5903d.flags1
-rw-r--r--test/files/run/t5903d/Macros_1.scala25
-rw-r--r--test/files/run/t5903d/Test_2.scala6
-rw-r--r--test/files/run/t5905-features.flags1
-rw-r--r--test/files/run/t5905-features.scala29
-rw-r--r--test/files/run/t5905b-features.check1
-rw-r--r--test/files/run/t5905b-features.scala15
-rw-r--r--test/files/run/t5912.scala5
-rw-r--r--test/files/run/t5923a/Macros_1.scala45
-rw-r--r--test/files/run/t5923c.scala4
-rw-r--r--test/files/run/t5923d/Macros_1.scala9
-rw-r--r--test/files/run/t5923d/Test_2.scala7
-rw-r--r--test/files/run/t5937.scala4
-rw-r--r--test/files/run/t5940.scala8
-rw-r--r--test/files/run/t5942.check0
-rw-r--r--test/files/run/t5942.scala2
-rw-r--r--test/files/run/t5943a1.scala2
-rw-r--r--test/files/run/t5971.scala4
-rw-r--r--test/files/run/t5986.scala10
-rw-r--r--test/files/run/t6011c.check3
-rw-r--r--test/files/run/t6023.scala2
-rw-r--r--test/files/run/t6028.check40
-rw-r--r--test/files/run/t6028.scala2
-rw-r--r--test/files/run/t603.scala4
-rw-r--r--test/files/run/t6052.scala4
-rw-r--r--test/files/run/t6064.scala9
-rw-r--r--test/files/run/t6070.scala4
-rw-r--r--test/files/run/t6086-repl.check2
-rw-r--r--test/files/run/t6102.check33
-rw-r--r--test/files/run/t6102.flags2
-rw-r--r--test/files/run/t6111.check1
-rw-r--r--test/files/run/t6111.scala2
-rw-r--r--test/files/run/t6113.scala4
-rw-r--r--test/files/run/t6146b.check6
-rw-r--r--test/files/run/t6150.scala8
-rw-r--r--test/files/run/t6168/Context.java34
-rw-r--r--test/files/run/t6168/JavaTest.java8
-rw-r--r--test/files/run/t6168/SomeClass.java14
-rw-r--r--test/files/run/t6168/SomeClass2.java12
-rw-r--r--test/files/run/t6168/main.scala15
-rw-r--r--test/files/run/t6168b/Context.java34
-rw-r--r--test/files/run/t6168b/JavaTest.java6
-rw-r--r--test/files/run/t6168b/SomeClass.java11
-rw-r--r--test/files/run/t6168b/main.scala8
-rw-r--r--test/files/run/t6178.scala2
-rw-r--r--test/files/run/t6181.scala2
-rw-r--r--test/files/run/t6187.check12
-rw-r--r--test/files/run/t6187.scala4
-rw-r--r--test/files/run/t6196.scala68
-rw-r--r--test/files/run/t6197.check0
-rw-r--r--test/files/run/t6198.check0
-rw-r--r--test/files/run/t6199-mirror.scala2
-rw-r--r--test/files/run/t6199-toolbox.scala2
-rw-r--r--test/files/run/t6200.scala68
-rw-r--r--test/files/run/t6221.check1
-rw-r--r--test/files/run/t6221/Macros_1.scala23
-rw-r--r--test/files/run/t6221/Test_2.scala10
-rw-r--r--test/files/run/t6223.check2
-rw-r--r--test/files/run/t6240-universe-code-gen.scala82
-rw-r--r--test/files/run/t6240a.check1
-rw-r--r--test/files/run/t6240a/StepOne.java41
-rw-r--r--test/files/run/t6240a/StepTwo.scala7
-rw-r--r--test/files/run/t6240a/Test.scala15
-rw-r--r--test/files/run/t6240b.check1
-rw-r--r--test/files/run/t6240b/StepOne.java41
-rw-r--r--test/files/run/t6240b/StepThree.scala4
-rw-r--r--test/files/run/t6240b/StepTwo.scala10
-rw-r--r--test/files/run/t6240b/Test.scala15
-rw-r--r--test/files/run/t6246.scala3
-rw-r--r--test/files/run/t6253a.scala64
-rw-r--r--test/files/run/t6253b.scala62
-rw-r--r--test/files/run/t6253c.scala63
-rw-r--r--test/files/run/t6259.scala6
-rw-r--r--test/files/run/t6260-delambdafy.check4
-rw-r--r--test/files/run/t6260-delambdafy.flags1
-rw-r--r--test/files/run/t6260-delambdafy.scala12
-rw-r--r--test/files/run/t6260b.scala13
-rw-r--r--test/files/run/t6260c.check5
-rw-r--r--test/files/run/t6260c.scala17
-rw-r--r--test/files/run/t6261.scala7
-rw-r--r--test/files/run/t6273.check6
-rw-r--r--test/files/run/t6288.check14
-rw-r--r--test/files/run/t6288b-jump-position.check6
-rw-r--r--test/files/run/t6288b-jump-position.scala9
-rw-r--r--test/files/run/t6292.check1
-rw-r--r--test/files/run/t6308.check16
-rw-r--r--test/files/run/t6308.scala45
-rw-r--r--test/files/run/t6309.check1
-rw-r--r--test/files/run/t6309.scala16
-rw-r--r--test/files/run/t6320.check4
-rw-r--r--test/files/run/t6323b.scala2
-rw-r--r--test/files/run/t6327.flags1
-rw-r--r--test/files/run/t6329_repl.check30
-rw-r--r--test/files/run/t6329_repl.scala13
-rw-r--r--test/files/run/t6329_repl_bug.check10
-rw-r--r--test/files/run/t6329_repl_bug.scala (renamed from test/files/run/t6329_repl_bug.pending)0
-rw-r--r--test/files/run/t6329_vanilla.check8
-rw-r--r--test/files/run/t6329_vanilla.scala15
-rw-r--r--test/files/run/t6329_vanilla_bug.check3
-rw-r--r--test/files/run/t6329_vanilla_bug.scala (renamed from test/files/run/t6329_vanilla_bug.pending)0
-rw-r--r--test/files/run/t6331.scala7
-rw-r--r--test/files/run/t6331b.scala11
-rw-r--r--test/files/run/t6355.check2
-rw-r--r--test/files/run/t6355.scala17
-rw-r--r--test/files/run/t6379.check14
-rw-r--r--test/files/run/t6379/Macros_1.scala26
-rw-r--r--test/files/run/t6379/Test_2.scala22
-rw-r--r--test/files/run/t6381.check19
-rw-r--r--test/files/run/t6381.scala15
-rw-r--r--test/files/run/t6385.scala13
-rw-r--r--test/files/run/t6392b.check2
-rw-r--r--test/files/run/t6392b.scala2
-rw-r--r--test/files/run/t6394a/Macros_1.scala4
-rw-r--r--test/files/run/t6394b/Macros_1.scala4
-rw-r--r--test/files/run/t6406-regextract.check4
-rw-r--r--test/files/run/t6406-regextract.scala30
-rw-r--r--test/files/run/t6411a.check96
-rw-r--r--test/files/run/t6411a.scala81
-rw-r--r--test/files/run/t6411b.check1
-rw-r--r--test/files/run/t6411b.scala12
-rw-r--r--test/files/run/t6439.check29
-rw-r--r--test/files/run/t6439.scala12
-rw-r--r--test/files/run/t6440.check8
-rw-r--r--test/files/run/t6440b.check8
-rw-r--r--test/files/run/t6443.scala2
-rw-r--r--test/files/run/t6448.check32
-rw-r--r--test/files/run/t6448.scala61
-rw-r--r--test/files/run/t6467.scala20
-rw-r--r--test/files/run/t6481.check1
-rw-r--r--test/files/run/t6488.check1
-rw-r--r--test/files/run/t6488.scala57
-rw-r--r--test/files/run/t6507.check24
-rw-r--r--test/files/run/t6507.scala14
-rw-r--r--test/files/run/t6548.check2
-rw-r--r--test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java17
-rw-r--r--test/files/run/t6548/Test_2.scala12
-rw-r--r--test/files/run/t6549.check4
-rw-r--r--test/files/run/t6554.check1
-rw-r--r--test/files/run/t6554.scala11
-rw-r--r--test/files/run/t6555.check4
-rw-r--r--test/files/run/t6555.scala2
-rw-r--r--test/files/run/t657.scala2
-rw-r--r--test/files/run/t6572/bar_1.scala19
-rw-r--r--test/files/run/t6572/foo_2.scala17
-rw-r--r--test/files/run/t6574b.check1
-rw-r--r--test/files/run/t6574b.scala7
-rw-r--r--test/files/run/t6591_1.check2
-rw-r--r--test/files/run/t6591_2.check2
-rw-r--r--test/files/run/t6591_3.check2
-rw-r--r--test/files/run/t6591_5.check2
-rw-r--r--test/files/run/t6591_6.check2
-rw-r--r--test/files/run/t6591_7.scala7
-rw-r--r--test/files/run/t6608.check1
-rw-r--r--test/files/run/t6608.scala16
-rw-r--r--test/files/run/t6611.scala18
-rw-r--r--test/files/run/t6632.check2
-rw-r--r--test/files/run/t6632.scala31
-rw-r--r--test/files/run/t6646.check2
-rw-r--r--test/files/run/t6646.scala6
-rw-r--r--test/files/run/t6662/Macro_1.scala2
-rw-r--r--test/files/run/t6662/Test_2.scala2
-rw-r--r--test/files/run/t6663.flags1
-rw-r--r--test/files/run/t6669.scala2
-rw-r--r--test/files/run/t6690.check1
-rw-r--r--test/files/run/t6690.scala2
-rw-r--r--test/files/run/t6719.check1
-rw-r--r--test/files/run/t6719.scala8
-rw-r--r--test/files/run/t6731.flags1
-rw-r--r--test/files/run/t6731.scala2
-rw-r--r--test/files/run/t6732.check4
-rw-r--r--test/files/run/t6732.scala12
-rw-r--r--test/files/run/t6733.check27
-rw-r--r--test/files/run/t6733.scala35
-rw-r--r--test/files/run/t6745-2.scala22
-rw-r--r--test/files/run/t6814.check7
-rw-r--r--test/files/run/t6814/Macros_1.scala24
-rw-r--r--test/files/run/t6814/Test_2.scala (renamed from test/files/run/macro-def-path-dependent-b/Test_2.scala)2
-rw-r--r--test/files/run/t6860.check4
-rw-r--r--test/files/run/t6860.scala20
-rw-r--r--test/files/run/t6863.check13
-rw-r--r--test/files/run/t6863.scala24
-rw-r--r--test/files/run/t6908.scala6
-rw-r--r--test/files/run/t6935.check1
-rw-r--r--test/files/run/t6935.scala18
-rw-r--r--test/files/run/t6937.check6
-rw-r--r--test/files/run/t6955.scala16
-rw-r--r--test/files/run/t6956.scala13
-rw-r--r--test/files/run/t6969.scala4
-rw-r--r--test/files/run/t6988.check2
-rw-r--r--test/files/run/t6988.scala9
-rw-r--r--test/files/run/t6989/Test_2.scala8
-rw-r--r--test/files/run/t6992.check4
-rw-r--r--test/files/run/t6992/Macros_1.scala75
-rw-r--r--test/files/run/t6992/Test_2.scala14
-rw-r--r--test/files/run/t7008-scala-defined.flags1
-rw-r--r--test/files/run/t7008-scala-defined/Impls_Macros_2.scala7
-rw-r--r--test/files/run/t7008-scala-defined/Test_3.scala2
-rw-r--r--test/files/run/t7008/Impls_Macros_2.scala7
-rw-r--r--test/files/run/t7008/Test_3.scala2
-rw-r--r--test/files/run/t7015.check11
-rw-r--r--test/files/run/t7015.scala49
-rw-r--r--test/files/run/t7044.check14
-rw-r--r--test/files/run/t7044/Macros_1.scala26
-rw-r--r--test/files/run/t7044/Test_2.scala19
-rw-r--r--test/files/run/t7045.check2
-rw-r--r--test/files/run/t7045.scala12
-rw-r--r--test/files/run/t7046.scala2
-rw-r--r--test/files/run/t7047.check3
-rw-r--r--test/files/run/t7047/Impls_Macros_1.scala4
-rw-r--r--test/files/run/t7064-old-style-supercalls.scala48
-rw-r--r--test/files/run/t7074.check9
-rw-r--r--test/files/run/t7074.scala15
-rw-r--r--test/files/run/t7088.check2
-rw-r--r--test/files/run/t7088.scala13
-rw-r--r--test/files/run/t7096.scala52
-rw-r--r--test/files/run/t7120.check1
-rw-r--r--test/files/run/t7120/Base_1.scala10
-rw-r--r--test/files/run/t7120/Derived_2.scala9
-rw-r--r--test/files/run/t7120/Run_3.scala3
-rw-r--r--test/files/run/t7120b.check2
-rw-r--r--test/files/run/t7120b.scala30
-rw-r--r--test/files/run/t7151.check6
-rw-r--r--test/files/run/t7151.scala24
-rw-r--r--test/files/run/t7157.check1
-rw-r--r--test/files/run/t7157/Impls_Macros_1.scala15
-rw-r--r--test/files/run/t7157/Test_2.scala5
-rw-r--r--test/files/run/t7171.check3
-rw-r--r--test/files/run/t7171.flags1
-rw-r--r--test/files/run/t7171.scala2
-rw-r--r--test/files/run/t7181.check23
-rw-r--r--test/files/run/t7181.scala78
-rw-r--r--test/files/run/t7185.check10
-rw-r--r--test/files/run/t7185.scala2
-rw-r--r--test/files/run/t7198.check2
-rw-r--r--test/files/run/t7198.scala9
-rw-r--r--test/files/run/t7214.scala2
-rw-r--r--test/files/run/t7223.check1
-rw-r--r--test/files/run/t7223.scala11
-rw-r--r--test/files/run/t7231.check2
-rw-r--r--test/files/run/t7231.scala11
-rw-r--r--test/files/run/t7240.check0
-rw-r--r--test/files/run/t7240/Macros_1.scala10
-rw-r--r--test/files/run/t7240/Test_2.scala4
-rw-r--r--test/files/run/t7265.scala27
-rw-r--r--test/files/run/t7271.check10
-rw-r--r--test/files/run/t7271.scala6
-rw-r--r--test/files/run/t7290.check6
-rw-r--r--test/files/run/t7291.check (renamed from test/files/run/t7291b.check)0
-rw-r--r--test/files/run/t7291.scala (renamed from test/files/run/t7291a.scala)3
-rw-r--r--test/files/run/t7291a.check1
-rw-r--r--test/files/run/t7291a.flags0
-rw-r--r--test/files/run/t7291b.flags1
-rw-r--r--test/files/run/t7291b.scala19
-rw-r--r--test/files/run/t7300.check2
-rw-r--r--test/files/run/t7300.scala11
-rw-r--r--test/files/run/t7319.check13
-rw-r--r--test/files/run/t7319.scala1
-rw-r--r--test/files/run/t7326.scala64
-rw-r--r--test/files/run/t7328.check4
-rw-r--r--test/files/run/t7328.scala18
-rw-r--r--test/files/run/t7331b.check2
-rw-r--r--test/files/run/t7331c.check2
-rw-r--r--test/files/run/t7336.scala2
-rw-r--r--test/files/run/t7337.check1
-rw-r--r--test/files/run/t7337.scala19
-rw-r--r--test/files/run/t7341.check0
-rwxr-xr-xtest/files/run/t7341.scala2
-rw-r--r--test/files/run/t7374.check3
-rw-r--r--test/files/run/t7374/Some.scala3
-rw-r--r--test/files/run/t7374/Test.java7
-rw-r--r--test/files/run/t7375b/Macros_1.scala4
-rw-r--r--test/files/run/t7398.scala2
-rw-r--r--test/files/run/t7406.check1
-rw-r--r--test/files/run/t7406.scala14
-rw-r--r--test/files/run/t7407.check1
-rw-r--r--test/files/run/t7407.flags1
-rw-r--r--test/files/run/t7407.scala11
-rw-r--r--test/files/run/t7407b.check2
-rw-r--r--test/files/run/t7407b.flags1
-rw-r--r--test/files/run/t7407b.scala20
-rw-r--r--test/files/run/t7436.scala9
-rw-r--r--test/files/run/t7439.check1
-rw-r--r--test/files/run/t7439/Test_2.scala2
-rw-r--r--test/files/run/t744.scala2
-rw-r--r--test/files/run/t7445.scala6
-rw-r--r--test/files/run/t7455/Test.scala2
-rw-r--r--test/files/run/t7475b.check2
-rw-r--r--test/files/run/t7475b.scala11
-rw-r--r--test/files/run/t7482a.check10
-rw-r--r--test/files/run/t7482a.scala8
-rw-r--r--test/files/run/t7507.scala4
-rw-r--r--test/files/run/t7510.check0
-rw-r--r--test/files/run/t7533.check30
-rw-r--r--test/files/run/t7533.scala38
-rw-r--r--test/files/run/t7556/Test_2.scala2
-rw-r--r--test/files/run/t7569.check6
-rw-r--r--test/files/run/t7570a.check1
-rw-r--r--test/files/run/t7570a.scala (renamed from test/files/run/t7733/Test_2.scala)6
-rw-r--r--test/files/run/t7570b.check1
-rw-r--r--test/files/run/t7570b.scala18
-rw-r--r--test/files/run/t7570c.check2
-rw-r--r--test/files/run/t7570c.scala13
-rw-r--r--test/files/run/t7582-private-within.check12
-rw-r--r--test/files/run/t7582-private-within/JavaPackagePrivate.java8
-rw-r--r--test/files/run/t7582-private-within/Test.scala22
-rw-r--r--test/files/run/t7582.check2
-rw-r--r--test/files/run/t7582.flags1
-rw-r--r--test/files/run/t7582/InlineHolder.scala16
-rw-r--r--test/files/run/t7582/PackageProtectedJava.java6
-rw-r--r--test/files/run/t7582b.check2
-rw-r--r--test/files/run/t7582b.flags1
-rw-r--r--test/files/run/t7582b/InlineHolder.scala16
-rw-r--r--test/files/run/t7582b/PackageProtectedJava.java6
-rw-r--r--test/files/run/t7584.check6
-rw-r--r--test/files/run/t7584.flags1
-rw-r--r--test/files/run/t7584.scala14
-rw-r--r--test/files/run/t7584b.scala14
-rw-r--r--test/files/run/t7617a/Macros_1.scala2
-rw-r--r--test/files/run/t7617b/Macros_1.scala2
-rw-r--r--test/files/run/t7617b/Test_2.scala2
-rw-r--r--test/files/run/t7634.check8
-rw-r--r--test/files/run/t7634.scala22
-rw-r--r--test/files/run/t7657/Macros_1.scala2
-rw-r--r--test/files/run/t7700.check2
-rw-r--r--test/files/run/t7700.scala17
-rw-r--r--test/files/run/t7711-script-args.check2
-rw-r--r--test/files/run/t7711-script-args.scala7
-rw-r--r--test/files/run/t7711-script-args.script12
-rw-r--r--test/files/run/t7715.check3
-rw-r--r--test/files/run/t7715.scala24
-rw-r--r--test/files/run/t7733/Separate_1.scala5
-rw-r--r--test/files/run/t7747-repl.check286
-rw-r--r--test/files/run/t7747-repl.scala69
-rw-r--r--test/files/run/t7763.scala20
-rw-r--r--test/files/run/t7775.scala4
-rw-r--r--test/files/run/t7777.check7
-rw-r--r--test/files/run/t7777/Macros_1.scala17
-rw-r--r--test/files/run/t7777/Test_2.scala6
-rw-r--r--test/files/run/t7791-script-linenums.check1
-rw-r--r--test/files/run/t7791-script-linenums.scala16
-rw-r--r--test/files/run/t7791-script-linenums.script8
-rw-r--r--test/files/run/t7801.check11
-rw-r--r--test/files/run/t7801.scala12
-rw-r--r--test/files/run/t7805-repl-i.check11
-rw-r--r--test/files/run/t7805-repl-i.scala42
-rw-r--r--test/files/run/t7805-repl-i.script1
-rw-r--r--test/files/run/t7817-tree-gen.check104
-rw-r--r--test/files/run/t7817-tree-gen.flags1
-rw-r--r--test/files/run/t7817-tree-gen.scala65
-rw-r--r--test/files/run/t7817.scala31
-rw-r--r--test/files/run/t7843-jsr223-service.check2
-rw-r--r--test/files/run/t7843-jsr223-service.scala8
-rw-r--r--test/files/run/t7852.flags1
-rw-r--r--test/files/run/t7852.scala39
-rw-r--r--test/files/run/t7859/A_1.scala11
-rw-r--r--test/files/run/t7859/B_2.scala47
-rw-r--r--test/files/run/t7868.scala13
-rw-r--r--test/files/run/t7868b.check6
-rw-r--r--test/files/run/t7868b.scala11
-rw-r--r--test/files/run/t7871.check1
-rw-r--r--test/files/run/t7871/Macros_1.scala27
-rw-r--r--test/files/run/t7871/Test_2.scala6
-rw-r--r--test/files/run/t7876.scala26
-rw-r--r--test/files/run/t7880.scala7
-rw-r--r--test/files/run/t7899-regression.check1
-rw-r--r--test/files/run/t7899-regression.flags1
-rw-r--r--test/files/run/t7899-regression.scala24
-rw-r--r--test/files/run/t7899.scala5
-rw-r--r--test/files/run/t7932.check3
-rw-r--r--test/files/run/t7932.scala11
-rw-r--r--test/files/run/t7933.check2
-rw-r--r--test/files/run/t7933.scala11
-rw-r--r--test/files/run/t7974.check104
-rw-r--r--test/files/run/t7974.flags1
-rw-r--r--test/files/run/t7974/Symbols.scala6
-rw-r--r--test/files/run/t7974/Test.scala20
-rw-r--r--test/files/run/t7985.scala3
-rw-r--r--test/files/run/t7985b.scala5
-rw-r--r--test/files/run/t7992.scala20
-rw-r--r--test/files/run/t7992b.scala18
-rw-r--r--test/files/run/t8002.scala19
-rw-r--r--test/files/run/t8015-ffc.scala7
-rw-r--r--test/files/run/t8017.flags1
-rw-r--r--test/files/run/t8017/value-class-lambda.scala40
-rw-r--r--test/files/run/t8017/value-class.scala3
-rw-r--r--test/files/run/t8046.check2
-rw-r--r--test/files/run/t8046/Test.scala18
-rw-r--r--test/files/run/t8046/t8046c.scala13
-rw-r--r--test/files/run/t8047.check7
-rw-r--r--test/files/run/t8047.scala31
-rw-r--r--test/files/run/t8048a.check1
-rw-r--r--test/files/run/t8048a/Macros_1.scala11
-rw-r--r--test/files/run/t8048a/Test_2.scala4
-rw-r--r--test/files/run/t8048b.check3
-rw-r--r--test/files/run/t8048b/Macros_1.scala37
-rw-r--r--test/files/run/t8048b/Test_2.scala5
-rw-r--r--test/files/run/t8091.check1
-rw-r--r--test/files/run/t8091.scala4
-rw-r--r--test/files/run/t8100.check1
-rw-r--r--test/files/run/t8100.scala8
-rw-r--r--test/files/run/t8104.check2
-rw-r--r--test/files/run/t8104/Macros_1.scala11
-rw-r--r--test/files/run/t8104/Test_2.scala19
-rw-r--r--test/files/run/t8114.scala15
-rw-r--r--test/files/run/t8133/A_1.scala5
-rw-r--r--test/files/run/t8133/B_2.scala15
-rw-r--r--test/files/run/t8133b/A_1.scala4
-rw-r--r--test/files/run/t8133b/B_2.scala9
-rw-r--r--test/files/run/t8153.check (renamed from test/files/run/t7064-old-style-supercalls.check)0
-rw-r--r--test/files/run/t8153.scala14
-rw-r--r--test/files/run/t8177f.scala20
-rw-r--r--test/files/run/t8188.scala25
-rw-r--r--test/files/run/t8190.check91
-rw-r--r--test/files/run/t8190.scala210
-rw-r--r--test/files/run/t8192.check32
-rw-r--r--test/files/run/t8192/Macros_1.scala45
-rw-r--r--test/files/run/t8192/Test_2.scala40
-rw-r--r--test/files/run/t8196.check4
-rw-r--r--test/files/run/t8197.scala16
-rw-r--r--test/files/run/t8197b.scala8
-rw-r--r--test/files/run/t8199.scala105
-rw-r--r--test/files/run/t8233-bcode.flags1
-rw-r--r--test/files/run/t8233-bcode.scala31
-rw-r--r--test/files/run/t8233.scala31
-rw-r--r--test/files/run/t8245.scala14
-rw-r--r--test/files/run/t8266-octal-interp.check30
-rw-r--r--test/files/run/t8266-octal-interp.flags1
-rw-r--r--test/files/run/t8266-octal-interp.scala16
-rw-r--r--test/files/run/t8280.check9
-rw-r--r--test/files/run/t8280.scala82
-rw-r--r--test/files/run/t8321.check1
-rw-r--r--test/files/run/t8321/Macros_1.scala11
-rw-r--r--test/files/run/t8321/Test_2.scala3
-rw-r--r--test/files/run/t8346.check6
-rw-r--r--test/files/run/t8346.scala34
-rw-r--r--test/files/run/t8395.scala9
-rw-r--r--test/files/run/t8425.check1
-rw-r--r--test/files/run/t8425/Macros_1.scala12
-rw-r--r--test/files/run/t8425/Test_2.scala (renamed from test/files/run/macro-def-path-dependent-c/Test_2.scala)2
-rw-r--r--test/files/run/t8428.scala12
-rw-r--r--test/files/run/t8437.check2
-rw-r--r--test/files/run/t8437/Macros_1.scala18
-rw-r--r--test/files/run/t8437/Test_2.scala4
-rw-r--r--test/files/run/t8549.check1
-rw-r--r--test/files/run/t8549.scala186
-rw-r--r--test/files/run/t8549b.scala16
-rw-r--r--test/files/run/t8570.flags1
-rw-r--r--test/files/run/t8570.scala10
-rw-r--r--test/files/run/t8570a.check1
-rw-r--r--test/files/run/t8570a.flags1
-rw-r--r--test/files/run/t8570a.scala14
-rw-r--r--test/files/run/t8574.scala27
-rw-r--r--test/files/run/t8601-closure-elim.flags1
-rw-r--r--test/files/run/t8601-closure-elim.scala26
-rw-r--r--test/files/run/t8601.flags1
-rw-r--r--test/files/run/t8601.scala15
-rw-r--r--test/files/run/t8601b.flags1
-rw-r--r--test/files/run/t8601b.scala14
-rw-r--r--test/files/run/t8601c.flags1
-rw-r--r--test/files/run/t8601c.scala12
-rw-r--r--test/files/run/t8601d.flags1
-rw-r--r--test/files/run/t8601d.scala8
-rw-r--r--test/files/run/t8601e.flags1
-rw-r--r--test/files/run/t8601e/StaticInit.classbin0 -> 417 bytes
-rw-r--r--test/files/run/t8601e/StaticInit.java8
-rw-r--r--test/files/run/t8601e/Test.scala12
-rw-r--r--test/files/run/t8607.scala36
-rw-r--r--test/files/run/t8637.check (renamed from test/files/run/exoticnames.check)0
-rw-r--r--test/files/run/t8637.scala9
-rw-r--r--test/files/run/t874.scala4
-rw-r--r--test/files/run/t920.scala2
-rw-r--r--test/files/run/tailcalls.check55
-rw-r--r--test/files/run/tailcalls.scala35
-rw-r--r--test/files/run/takeAndDrop.scala4
-rw-r--r--test/files/run/tcpoly_monads.scala11
-rw-r--r--test/files/run/tcpoly_overriding.scala3
-rw-r--r--test/files/run/tcpoly_parseridioms.check20
-rw-r--r--test/files/run/tcpoly_parseridioms.scala53
-rw-r--r--test/files/run/test-cpp.scala24
-rw-r--r--test/files/run/toolbox_console_reporter.scala13
-rw-r--r--test/files/run/toolbox_current_run_compiles.scala4
-rw-r--r--test/files/run/toolbox_parse_package.check8
-rw-r--r--test/files/run/toolbox_parse_package.scala9
-rw-r--r--test/files/run/toolbox_rangepos.check1
-rw-r--r--test/files/run/toolbox_rangepos.scala8
-rw-r--r--test/files/run/toolbox_typecheck_implicitsdisabled.check2
-rw-r--r--test/files/run/toolbox_typecheck_implicitsdisabled.scala12
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled.check8
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled.scala17
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled2.check10
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled2.scala17
-rw-r--r--test/files/run/tpeCache-tyconCache.check19
-rw-r--r--test/files/run/tpeCache-tyconCache.scala10
-rw-r--r--test/files/run/trait-renaming/A_1.scala2
-rw-r--r--test/files/run/transform.scala4
-rw-r--r--test/files/run/transpose.scala4
-rw-r--r--test/files/run/triemap-hash.scala20
-rw-r--r--test/files/run/triple-quoted-expr.scala8
-rw-r--r--test/files/run/try-2.check3
-rw-r--r--test/files/run/try-2.scala24
-rw-r--r--test/files/run/try-catch-unify.scala2
-rw-r--r--test/files/run/try.check3
-rw-r--r--test/files/run/try.scala18
-rw-r--r--test/files/run/tuple-match.scala4
-rw-r--r--test/files/run/tuple-zipped.scala18
-rw-r--r--test/files/run/tuples.scala1
-rw-r--r--test/files/run/type-currying.scala7
-rw-r--r--test/files/run/typealias_overriding.scala8
-rw-r--r--test/files/run/typecheck/Macros_1.scala11
-rw-r--r--test/files/run/typecheck/Test_2.scala7
-rw-r--r--test/files/run/typed-annotated/Macros_1.scala6
-rw-r--r--test/files/run/typetags_symbolof_x.check6
-rw-r--r--test/files/run/typetags_symbolof_x.scala15
-rw-r--r--test/files/run/typetags_without_scala_reflect_manifest_lookup.check0
-rw-r--r--test/files/run/unapply.check3
-rw-r--r--test/files/run/unapply.scala6
-rw-r--r--test/files/run/unittest_collection.check1
-rw-r--r--test/files/run/unittest_collection.scala6
-rw-r--r--test/files/run/unittest_io.scala40
-rw-r--r--test/files/run/unittest_iterator.scala12
-rw-r--r--test/files/run/unreachable.scala128
-rw-r--r--test/files/run/value-class-extractor-2.check8
-rw-r--r--test/files/run/value-class-extractor-2.scala108
-rw-r--r--test/files/run/value-class-extractor-seq.check3
-rw-r--r--test/files/run/value-class-extractor-seq.scala59
-rw-r--r--test/files/run/value-class-extractor.check9
-rw-r--r--test/files/run/value-class-extractor.scala91
-rw-r--r--test/files/run/value-class-partial-func-depmet.scala24
-rw-r--r--test/files/run/valueclasses-classmanifest-basic.scala3
-rw-r--r--test/files/run/valueclasses-classmanifest-existential.scala3
-rw-r--r--test/files/run/valueclasses-classmanifest-generic.scala3
-rw-r--r--test/files/run/var-arity-class-symbol.scala19
-rw-r--r--test/files/run/vector1.scala26
-rw-r--r--test/files/run/verify-ctor.scala2
-rw-r--r--test/files/run/view-headoption.scala4
-rw-r--r--test/files/run/view-iterator-stream.scala11
-rwxr-xr-xtest/files/run/viewtest.scala4
-rw-r--r--test/files/run/virtpatmat_alts.check6
-rw-r--r--test/files/run/virtpatmat_alts.flags1
-rw-r--r--test/files/run/virtpatmat_alts.scala5
-rw-r--r--test/files/run/virtpatmat_apply.scala2
-rw-r--r--test/files/run/virtpatmat_casting.scala7
-rw-r--r--test/files/run/virtpatmat_literal.scala24
-rw-r--r--test/files/run/virtpatmat_nested_lists.check5
-rw-r--r--test/files/run/virtpatmat_nested_lists.flags1
-rw-r--r--test/files/run/virtpatmat_nested_lists.scala3
-rw-r--r--test/files/run/virtpatmat_opt_sharing.check3
-rw-r--r--test/files/run/virtpatmat_opt_sharing.flags1
-rw-r--r--test/files/run/virtpatmat_opt_sharing.scala5
-rw-r--r--test/files/run/virtpatmat_staging.flags1
-rw-r--r--test/files/run/virtpatmat_staging.scala7
-rw-r--r--test/files/run/virtpatmat_stringinterp.scala5
-rw-r--r--test/files/run/virtpatmat_switch.scala10
-rw-r--r--test/files/run/virtpatmat_try.scala8
-rw-r--r--test/files/run/virtpatmat_typed.check3
-rw-r--r--test/files/run/virtpatmat_typed.scala8
-rw-r--r--test/files/run/virtpatmat_unapply.scala14
-rw-r--r--test/files/run/withIndex.scala2
-rw-r--r--test/files/run/xml-attribute.check12
-rw-r--r--test/files/run/xml-attribute.scala37
-rw-r--r--test/files/run/xml-loop-bug.scala8
1918 files changed, 19709 insertions, 5965 deletions
diff --git a/test/files/run/Course-2002-01.check b/test/files/run/Course-2002-01.check
index 17b30bf3c2..16b491d6e2 100644
--- a/test/files/run/Course-2002-01.check
+++ b/test/files/run/Course-2002-01.check
@@ -1,3 +1,6 @@
+Course-2002-01.scala:41: warning: method loop in object M0 does nothing other than call itself recursively
+ def loop: Int = loop;
+ ^
232
667
11
diff --git a/test/files/run/Course-2002-02.scala b/test/files/run/Course-2002-02.scala
index 56d7298aaf..b8650108ed 100644
--- a/test/files/run/Course-2002-02.scala
+++ b/test/files/run/Course-2002-02.scala
@@ -100,7 +100,7 @@ object M4 {
def sumInts = sum(x => x)
def sumCubes = sum(x => x * x * x)
- def sumReciprocals = sum(1.0/_)
+ def sumReciprocals = sum(1.0/_)
def sumPi = { n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n) }
Console.println(sumInts(1,4))
@@ -194,7 +194,7 @@ object M8 {
//############################################################################
object M9 {
- def accumulate[t](combiner: (t, t) => t, nullValue: t, f: Int => t,
+ def accumulate[t](combiner: (t, t) => t, nullValue: t, f: Int => t,
next: Int => Int)(a: Int, b: Int): t =
if (a > b) nullValue
else combiner(f(a), accumulate(combiner, nullValue, f, next)(next(a), b))
@@ -328,9 +328,9 @@ object MD {
iter(a, zero)
}
- def plus (x:Double,y:Double) = x+y;
+ def plus (x:Double,y:Double) = x+y;
val sum: (Int => Double) => (Int, Int) => Double = reduce(plus , 0);
- def times(x:Double,y:Double) = x*y;
+ def times(x:Double,y:Double) = x*y;
val product: (Int => Double) => (Int, Int) => Double = reduce(times, 1);
def factorial(n: Int) = product(x => x)(1 , n)
diff --git a/test/files/run/Course-2002-05.scala b/test/files/run/Course-2002-05.scala
index 9457fae147..80317bc757 100644
--- a/test/files/run/Course-2002-05.scala
+++ b/test/files/run/Course-2002-05.scala
@@ -3,15 +3,15 @@
//############################################################################
object M0 {
- def partition[a](xs: List[a], pred: a => Boolean): Pair[List[a], List[a]] = {
+ def partition[a](xs: List[a], pred: a => Boolean): Tuple2[List[a], List[a]] = {
if (xs.isEmpty)
- Pair(List(),List())
+ (List(),List())
else {
val tailPartition = partition(xs.tail, pred);
if (pred(xs.head))
- Pair(xs.head :: tailPartition._1, tailPartition._2)
+ (xs.head :: tailPartition._1, tailPartition._2)
else
- Pair(tailPartition._1, xs.head :: tailPartition._2)
+ (tailPartition._1, xs.head :: tailPartition._2)
}
}
@@ -49,9 +49,9 @@ object M0 {
//############################################################################
object M1 {
- def partition[a](xs: List[a], pred: a => Boolean): Pair[List[a], List[a]] = {
- xs.foldRight[Pair[List[a], List[a]]](Pair(List(), List())) {
- (x, p) => if (pred (x)) Pair(x :: p._1, p._2) else Pair(p._1, x :: p._2)
+ def partition[a](xs: List[a], pred: a => Boolean): Tuple2[List[a], List[a]] = {
+ xs.foldRight[Tuple2[List[a], List[a]]]((List(), List())) {
+ (x, p) => if (pred (x)) (x :: p._1, p._2) else (p._1, x :: p._2)
}
}
@@ -129,14 +129,14 @@ object M3 {
else {
def isSafe(column: Int, placement: Placement): Boolean =
placement forall {
- pos => (pos._2 != column &&
+ pos => (pos._2 != column &&
abs(pos._2 - column) != row - pos._1)
}
def adjoinRow(placement: Placement): List[Placement] =
range(1, n)
.filter (column => isSafe(column, placement))
- .map (column => Pair(row, column) :: placement);
+ .map (column => (row, column) :: placement);
placeQueens(row - 1) flatMap adjoinRow
}
diff --git a/test/files/run/Course-2002-06.scala b/test/files/run/Course-2002-06.scala
index e4fb86a966..908a934041 100644
--- a/test/files/run/Course-2002-06.scala
+++ b/test/files/run/Course-2002-06.scala
@@ -55,7 +55,7 @@ abstract class Graphics(_width: Double, _height: Double) {
}
/** Draw a list of segments on the picture.*/
- def drawSegments(frm: Frame)(segments: List[Pair[Vector, Vector]]): Unit =
+ def drawSegments(frm: Frame)(segments: List[Tuple2[Vector, Vector]]): Unit =
if (segments.isEmpty) ()
else {
drawSegment(frm)(segments.head._1, segments.head._2);
diff --git a/test/files/run/Course-2002-07.scala b/test/files/run/Course-2002-07.scala
index 7848ae3e8e..2d9457653f 100644
--- a/test/files/run/Course-2002-07.scala
+++ b/test/files/run/Course-2002-07.scala
@@ -16,13 +16,13 @@ object M0 {
def isNumber: Boolean = true;
def isSum: Boolean = false;
def numValue: Int = n;
- def leftOp: Expr = error("Number.leftOp");
- def rightOp: Expr = error("Number.rightOp");
+ def leftOp: Expr = sys.error("Number.leftOp");
+ def rightOp: Expr = sys.error("Number.rightOp");
}
class Sum(e1: Expr, e2: Expr) extends Expr {
def isNumber: Boolean = false;
def isSum: Boolean = true;
- def numValue: Int = error("Sum.numValue");
+ def numValue: Int = sys.error("Sum.numValue");
def leftOp: Expr = e1;
def rightOp: Expr = e2;
}
@@ -30,7 +30,7 @@ object M0 {
class Prod(e1: Expr, e2: Expr) extends Expr {
def isNumber: Boolean = false;
def isSum: Boolean = false;
- def numValue: Int = error("Prod.numValue");
+ def numValue: Int = sys.error("Prod.numValue");
def leftOp: Expr = e1;
def rightOp: Expr = e2;
}
@@ -38,15 +38,15 @@ object M0 {
class Var(x: String) extends Expr {
def isNumber: Boolean = false;
def isSum: Boolean = false;
- def numValue: Int = error("Var.numValue");
- def leftOp: Expr = error("Var.leftOp");
- def rightOp: Expr = error("Var.rightOp");
+ def numValue: Int = sys.error("Var.numValue");
+ def leftOp: Expr = sys.error("Var.leftOp");
+ def rightOp: Expr = sys.error("Var.rightOp");
}
def eval(e: Expr): Int = {
if (e.isNumber) e.numValue
else if (e.isSum) eval(e.leftOp) + eval(e.rightOp)
- else error("unknown expression")
+ else sys.error("unknown expression")
}
def test = {
@@ -181,10 +181,10 @@ object M4 {
object M5 {
- def zipFun[a,b](xs:List[a], ys:List[b]):List[Pair[a,b]] = Pair(xs,ys) match {
- case Pair(List(), _) => List()
- case Pair(_, List()) => List()
- case Pair(x :: xs1, y :: ys1) => Pair(x, y) :: zipFun(xs1, ys1)
+ def zipFun[a,b](xs:List[a], ys:List[b]):List[Tuple2[a,b]] = (xs,ys) match {
+ case (List(), _) => List()
+ case (_, List()) => List()
+ case (x :: xs1, y :: ys1) => (x, y) :: zipFun(xs1, ys1)
}
def test_zipFun[a,b](xs: List[a], ys: List[b]) = {
@@ -216,9 +216,9 @@ object M5 {
object M6 {
- def zipFun[a,b](xs:List[a], ys:List[b]):List[Pair[a,b]] = (Pair(xs,ys): @unchecked) match {
- // !!! case Pair(List(), _), Pair(_, List()) => List()
- case Pair(x :: xs1, y :: ys1) => Pair(x, y) :: zipFun(xs1, ys1)
+ def zipFun[a,b](xs:List[a], ys:List[b]):List[Tuple2[a,b]] = ((xs,ys): @unchecked) match {
+ // !!! case (List(), _), (_, List()) => List()
+ case (x :: xs1, y :: ys1) => (x, y) :: zipFun(xs1, ys1)
}
def test_zipFun[a,b](xs: List[a], ys: List[b]) = {
@@ -374,9 +374,9 @@ object M9 {
object MA {
- def lookup[k,v](xs: List[Pair[k,v]], k: k): v = xs match {
- case List() => error("no value for " + k)
- case Pair(k1,v1) :: xs1 => if (k1 == k) v1 else lookup(xs1, k)
+ def lookup[k,v](xs: List[Tuple2[k,v]], k: k): v = xs match {
+ case List() => sys.error("no value for " + k)
+ case (k1,v1) :: xs1 => if (k1 == k) v1 else lookup(xs1, k)
}
trait Expr {
@@ -410,7 +410,7 @@ object MA {
def eval(e: Expr): Int = e match {
case Number(n) => n
- case Var(_) => error("cannot evaluate variable")
+ case Var(_) => sys.error("cannot evaluate variable")
case Sum(e1, e2) => eval(e1) + eval(e2)
case Prod(e1, e2) => eval(e1) * eval(e2)
}
@@ -437,8 +437,8 @@ object MA {
val g1 = g0 derive x;
Console.println("g (x) = " + g0);
Console.println("g'(x) = " + g1);
- Console.println("g (3) = " + evalvars(List(Pair("x",3)))(g0));
- Console.println("g'(3) = " + evalvars(List(Pair("x",3)))(g1));
+ Console.println("g (3) = " + evalvars(List(("x",3)))(g0));
+ Console.println("g'(3) = " + evalvars(List(("x",3)))(g1));
Console.println;
}
@@ -453,26 +453,26 @@ object Utils {
if (y == 1) x else if (y % 2 == 0) power0(x*x,y/2) else x*power0(x, y-1);
def power(x: Int, y: Int): Int = (x,y) match {
- case Pair(0,0) => error("power(0,0)")
- case Pair(0,_) => 0
- case Pair(1,_) => 1
- case Pair(_,0) => 1
- case Pair(_,1) => x
- case Pair(_,2) => x*x
- case Pair(_,_) => if (y < 0) 1/power0(x,y) else power0(x,y)
+ case (0,0) => sys.error("power(0,0)")
+ case (0,_) => 0
+ case (1,_) => 1
+ case (_,0) => 1
+ case (_,1) => x
+ case (_,2) => x*x
+ case (_,_) => if (y < 0) 1/power0(x,y) else power0(x,y)
}
def lookup(entries: List[(String,Int)], key: String): Int = entries match {
- case List() => error("no value for " + key)
- case Pair(k,v) :: _ if (k == key) => v
+ case List() => sys.error("no value for " + key)
+ case (k,v) :: _ if (k == key) => v
case _ :: rest => lookup(rest, key)
}
def compare(xs: List[String], ys: List[String]): Int = (xs, ys) match {
- case Pair(List(), List()) => 0
- case Pair(List(), _ ) => -1
- case Pair(_ , List()) => +1
- case Pair(x::xs , y::ys ) => {
+ case (List(), List()) => 0
+ case (List(), _ ) => -1
+ case (_ , List()) => +1
+ case (x::xs , y::ys ) => {
val diff = x.compareTo(y);
if (diff != 0) diff else compare(xs,ys)
}
@@ -508,18 +508,18 @@ object MB {
private def +< (that: Expr): Boolean = (this +<? that) < 0;
private def +<= (that: Expr): Boolean = (this +<? that) <= 0;
- private def +<? (that: Expr): Int = Pair(this,that) match {
- case Pair(Add(_,_), _ ) => 0
- case Pair(_ , Add(_,_)) => 0
- case Pair(_ , _ ) => compare(this.vars,that.vars)
+ private def +<? (that: Expr): Int = (this,that) match {
+ case (Add(_,_), _ ) => 0
+ case (_ , Add(_,_)) => 0
+ case (_ , _ ) => compare(this.vars,that.vars)
}
- def + (that: Expr): Expr = if (that +<= this) Pair(this,that) match {
- case Pair(_ , Lit(0) ) => this
- case Pair(Lit(l) , Lit(r) ) => Lit(l + r)
- case Pair(_ , Add(rl,rr)) => (this + rl) + rr
- case Pair(Add(ll,lr), _ ) if (lr +<= that) => ll + (that + lr)
- case Pair(_ , _ ) => {
+ def + (that: Expr): Expr = if (that +<= this) (this,that) match {
+ case (_ , Lit(0) ) => this
+ case (Lit(l) , Lit(r) ) => Lit(l + r)
+ case (_ , Add(rl,rr)) => (this + rl) + rr
+ case (Add(ll,lr), _ ) if (lr +<= that) => ll + (that + lr)
+ case (_ , _ ) => {
val l = this.term;
val r = that.term;
if (l equ r) Lit(this.count + that.count) * r else Add(this, that)
@@ -528,41 +528,41 @@ object MB {
private def *< (that: Expr): Boolean = (this *<? that) < 0;
private def *<= (that: Expr): Boolean = (this *<? that) <= 0;
- private def *<? (that: Expr): Int = Pair(this,that) match {
- case Pair(Mul(_,_), _ ) => 0
- case Pair(_ , Mul(_,_)) => 0
- case Pair(Add(_,_), Add(_,_)) => 0
- case Pair(Add(_,_), _ ) => -1
- case Pair(_ , Add(_,_)) => +1
- case Pair(Lit(_) , Lit(_) ) => 0
- case Pair(Lit(_) , _ ) => -1
- case Pair(_ , Lit(_) ) => +1
- case Pair(Var(l) , Var(r) ) => l.compareTo(r)
- case Pair(Var(_) , Pow(r,_)) => if (this *<= r) -1 else +1
- case Pair(Pow(l,_), Var(_) ) => if (l *< that) -1 else +1
- case Pair(Pow(l,_), Pow(r,_)) => l *<? r
+ private def *<? (that: Expr): Int = (this,that) match {
+ case (Mul(_,_), _ ) => 0
+ case (_ , Mul(_,_)) => 0
+ case (Add(_,_), Add(_,_)) => 0
+ case (Add(_,_), _ ) => -1
+ case (_ , Add(_,_)) => +1
+ case (Lit(_) , Lit(_) ) => 0
+ case (Lit(_) , _ ) => -1
+ case (_ , Lit(_) ) => +1
+ case (Var(l) , Var(r) ) => l.compareTo(r)
+ case (Var(_) , Pow(r,_)) => if (this *<= r) -1 else +1
+ case (Pow(l,_), Var(_) ) => if (l *< that) -1 else +1
+ case (Pow(l,_), Pow(r,_)) => l *<? r
}
- def * (that: Expr): Expr = if (this *<= that) Pair(this,that) match {
- case Pair(Lit(0) , _ ) => this
- case Pair(Lit(1) , _ ) => that
- case Pair(Mul(ll,lr), r ) => ll * (lr * r)
- case Pair(Add(ll,lr), r ) => ll * r + lr * r
- case Pair(Lit(l) , Lit(r) ) => Lit(l * r)
- case Pair(Var(_) , Var(_) ) if (this equ that) => Pow(this,2)
- case Pair(Var(_) , Pow(r,n) ) if (this equ r) => Pow(this,n + 1)
- case Pair(Pow(ll,lr), Pow(rl,rr)) if (ll equ rl) => Pow(ll,lr + rr)
- case Pair(l , Mul(rl,rr)) if (rl *<= l) => (rl * l) * rr
- case Pair(_ , _ ) => Mul(this,that)
+ def * (that: Expr): Expr = if (this *<= that) (this,that) match {
+ case (Lit(0) , _ ) => this
+ case (Lit(1) , _ ) => that
+ case (Mul(ll,lr), r ) => ll * (lr * r)
+ case (Add(ll,lr), r ) => ll * r + lr * r
+ case (Lit(l) , Lit(r) ) => Lit(l * r)
+ case (Var(_) , Var(_) ) if (this equ that) => Pow(this,2)
+ case (Var(_) , Pow(r,n) ) if (this equ r) => Pow(this,n + 1)
+ case (Pow(ll,lr), Pow(rl,rr)) if (ll equ rl) => Pow(ll,lr + rr)
+ case (l , Mul(rl,rr)) if (rl *<= l) => (rl * l) * rr
+ case (_ , _ ) => Mul(this,that)
} else that * this;
def ^ (that: Int): Expr = (this,that) match {
- case Pair(_ ,1) => this
- case Pair(Lit(i) ,n) => Lit(power(i,n))
- case Pair(Var(_) ,n) => Pow(this,n)
- case Pair(Add(_,_),n) => this * (this ^ (n - 1))
- case Pair(Mul(l,r),n) => (l ^ n) * (r ^ n)
- case Pair(Pow(e,m),n) => Pow(e,m + n)
+ case (_ ,1) => this
+ case (Lit(i) ,n) => Lit(power(i,n))
+ case (Var(_) ,n) => Pow(this,n)
+ case (Add(_,_),n) => this * (this ^ (n - 1))
+ case (Mul(l,r),n) => (l ^ n) * (r ^ n)
+ case (Pow(e,m),n) => Pow(e,m + n)
}
def derive(v: Var): Expr = this match {
@@ -581,12 +581,12 @@ object MB {
case Pow(l, r) => power(l.evaluate(vars), r)
}
- def equ(that: Expr): Boolean = Pair(this,that) match {
- case Pair(Lit(l) ,Lit(r)) => l == r
- case Pair(Var(l) ,Var(r)) => l == r
- case Pair(Add(ll,lr),Add(rl,rr)) => (ll equ rl) && (lr equ rr)
- case Pair(Mul(ll,lr),Mul(rl,rr)) => (ll equ rl) && (lr equ rr)
- case Pair(Pow(ll,lr),Pow(rl,rr)) => (ll equ rl) && (lr == rr)
+ def equ(that: Expr): Boolean = (this,that) match {
+ case (Lit(l) ,Lit(r)) => l == r
+ case (Var(l) ,Var(r)) => l == r
+ case (Add(ll,lr),Add(rl,rr)) => (ll equ rl) && (lr equ rr)
+ case (Mul(ll,lr),Mul(rl,rr)) => (ll equ rl) && (lr equ rr)
+ case (Pow(ll,lr),Pow(rl,rr)) => (ll equ rl) && (lr == rr)
case _ => false
}
@@ -667,7 +667,7 @@ object MB {
Console.println;
def check(n: String, f: Expr, x: Int, e: Int) {
- val a: Int = f.evaluate(List(Pair("x",x)));
+ val a: Int = f.evaluate(List(("x",x)));
val s: String = if (a == e) "ok" else "KO(" + e + ")";
Console.println(n + "(" + x + ") = " + a + " " + s);
}
diff --git a/test/files/run/Course-2002-08.scala b/test/files/run/Course-2002-08.scala
index 85a83e0146..5e21edaba3 100644
--- a/test/files/run/Course-2002-08.scala
+++ b/test/files/run/Course-2002-08.scala
@@ -33,7 +33,7 @@ object M1 {
if (0 < amount && amount <= balance) {
balance = balance - amount;
balance
- } else error("insufficient funds");
+ } else sys.error("insufficient funds");
}
def test0 = {
@@ -163,7 +163,7 @@ object M5 {
}
abstract class Simulation() {
- private type Agenda = List[Pair[Int, Action]];
+ private type Agenda = List[Tuple2[Int, Action]];
private var agenda: Agenda = List();
private var curtime = 0;
def currentTime: Int = curtime;
@@ -171,17 +171,17 @@ object M5 {
def afterDelay(delay: Int)(action: Action): Unit = {
def insert(ag: Agenda, time: Int): Agenda = ag match {
case List() =>
- List(Pair(time, action))
- case Pair(t, act) :: ag1 =>
- if (time < t) Pair(time, action) :: ag
- else Pair(t, act) :: insert(ag1, time)
+ List((time, action))
+ case (t, act) :: ag1 =>
+ if (time < t) (time, action) :: ag
+ else (t, act) :: insert(ag1, time)
}
agenda = insert(agenda, curtime + delay)
}
private def next: Unit = agenda match {
case List() => ()
- case Pair(time, action) :: ag1 => {
+ case (time, action) :: ag1 => {
agenda = ag1;
curtime = time;
action();
@@ -413,7 +413,7 @@ object M5 {
class Simulator() {
type Action = () => Unit;
- type Agenda = List[Pair[Int, Action]];
+ type Agenda = List[Tuple2[Int, Action]];
private var agenda: Agenda = List();
private var curtime = 0;
@@ -421,17 +421,17 @@ class Simulator() {
def afterDelay(delay: Int)(action: Action) = {
def insert(ag: Agenda, time: Int): Agenda = ag match {
case List() =>
- List(Pair(time, action))
- case Pair(t, act) :: ag1 =>
- if (time < t) Pair(time, action) :: ag
- else Pair(t, act) :: insert(ag1, time)
+ List((time, action))
+ case (t, act) :: ag1 =>
+ if (time < t) (time, action) :: ag
+ else (t, act) :: insert(ag1, time)
}
agenda = insert(agenda, curtime + delay)
}
def next: Unit = agenda match {
case List() => ()
- case Pair(time, action) :: rest => {
+ case (time, action) :: rest => {
agenda = rest;
curtime = time;
action();
@@ -520,7 +520,7 @@ abstract class CircuitSimulator() extends BasicCircuitSimulator() {
val w1 = new Wire();
val w2 = new Wire();
val w3 = new Wire();
-
+
andGate(in, ctrl(1), w3);
andGate(in, ctrl(1), w2);
andGate(in, ctrlN(1), w1);
@@ -567,8 +567,8 @@ class Main() extends CircuitSimulator() {
demux(in, ctrl.reverse, out.reverse);
probe("in", in);
- for (Pair(x,c) <- range(0,n) zip ctrl) { probe("ctrl" + x, c) }
- for (Pair(x,o) <- range(0,outNum) zip out) { probe("out" + x, o) }
+ for ((x,c) <- range(0,n) zip ctrl) { probe("ctrl" + x, c) }
+ for ((x,o) <- range(0,outNum) zip out) { probe("out" + x, o) }
in.setSignal(true);
run;
diff --git a/test/files/run/Course-2002-09.scala b/test/files/run/Course-2002-09.scala
index 384a91efd8..704f2ec0aa 100644
--- a/test/files/run/Course-2002-09.scala
+++ b/test/files/run/Course-2002-09.scala
@@ -8,16 +8,16 @@ trait Constraint {
}
object NoConstraint extends Constraint {
- def newValue: Unit = error("NoConstraint.newValue");
- def dropValue: Unit = error("NoConstraint.dropValue");
+ def newValue: Unit = sys.error("NoConstraint.newValue");
+ def dropValue: Unit = sys.error("NoConstraint.dropValue");
}
class Adder(a1: Quantity,a2: Quantity,sum: Quantity) extends Constraint {
- def newValue = Triple(a1.getValue, a2.getValue, sum.getValue) match {
- case Triple(Some(x1), Some(x2), _ ) => sum.setValue(x1 + x2, this)
- case Triple(Some(x1), _ , Some(r)) => a2.setValue(r - x1, this)
- case Triple(_ , Some(x2), Some(r)) => a1.setValue(r - x2, this)
- case _ =>
+ def newValue = (a1.getValue, a2.getValue, sum.getValue) match {
+ case (Some(x1), Some(x2), _ ) => sum.setValue(x1 + x2, this)
+ case (Some(x1), _ , Some(r)) => a2.setValue(r - x1, this)
+ case (_ , Some(x2), Some(r)) => a1.setValue(r - x2, this)
+ case _ =>
}
def dropValue: Unit = {
a1.forgetValue(this); a2.forgetValue(this); sum.forgetValue(this);
@@ -29,13 +29,13 @@ class Adder(a1: Quantity,a2: Quantity,sum: Quantity) extends Constraint {
class Multiplier(m1: Quantity, m2: Quantity, prod: Quantity)
extends Constraint {
- def newValue = Triple(m1.getValue, m2.getValue, prod.getValue) match {
- case Triple(Some(0d), _ , _ ) => prod.setValue(0, this);
- case Triple(_ , Some(0d), _ ) => prod.setValue(0, this);
- case Triple(Some(x1), Some(x2), _ ) => prod.setValue(x1 * x2, this)
- case Triple(Some(x1), _ , Some(r)) => m2.setValue(r / x1, this)
- case Triple(_, Some(x2), Some(r)) => m1.setValue(r / x2, this)
- case _ =>
+ def newValue = (m1.getValue, m2.getValue, prod.getValue) match {
+ case (Some(0d), _ , _ ) => prod.setValue(0, this);
+ case (_ , Some(0d), _ ) => prod.setValue(0, this);
+ case (Some(x1), Some(x2), _ ) => prod.setValue(x1 * x2, this)
+ case (Some(x1), _ , Some(r)) => m2.setValue(r / x1, this)
+ case (_, Some(x2), Some(r)) => m1.setValue(r / x2, this)
+ case _ =>
}
def dropValue: Unit = {
m1.forgetValue(this); m2.forgetValue(this); prod.forgetValue(this);
@@ -46,11 +46,11 @@ class Multiplier(m1: Quantity, m2: Quantity, prod: Quantity)
}
class Squarer(square: Quantity, root: Quantity) extends Constraint {
- def newValue: Unit = Pair(square.getValue, root.getValue) match {
- case Pair(Some(x), _ )if (x < 0) => error("Square of negative number")
- case Pair(Some(x), _ ) => root.setValue(Math.sqrt(x), this)
- case Pair(_ , Some(x)) => square.setValue(x*x, this)
- case _ =>
+ def newValue: Unit = (square.getValue, root.getValue) match {
+ case (Some(x), _ )if (x < 0) => sys.error("Square of negative number")
+ case (Some(x), _ ) => root.setValue(Math.sqrt(x), this)
+ case (_ , Some(x)) => square.setValue(x*x, this)
+ case _ =>
}
def dropValue: Unit = {
square.forgetValue(this); root.forgetValue(this);
@@ -60,9 +60,9 @@ class Squarer(square: Quantity, root: Quantity) extends Constraint {
}
class Eq(a: Quantity, b: Quantity) extends Constraint {
- def newValue = (Pair(a.getValue, b.getValue): @unchecked) match {
- case Pair(Some(x), _ ) => b.setValue(x, this);
- case Pair(_ , Some(y)) => a.setValue(y, this);
+ def newValue = ((a.getValue, b.getValue): @unchecked) match {
+ case (Some(x), _ ) => b.setValue(x, this);
+ case (_ , Some(y)) => a.setValue(y, this);
}
def dropValue {
a.forgetValue(this); b.forgetValue(this);
@@ -72,8 +72,8 @@ class Eq(a: Quantity, b: Quantity) extends Constraint {
}
class Constant(q: Quantity, v: Double) extends Constraint {
- def newValue: Unit = error("Constant.newValue");
- def dropValue: Unit = error("Constant.dropValue");
+ def newValue: Unit = sys.error("Constant.newValue");
+ def dropValue: Unit = sys.error("Constant.dropValue");
q connect this;
q.setValue(v, this);
}
@@ -100,7 +100,7 @@ class Quantity() {
def setValue(v: Double, setter: Constraint) = value match {
case Some(v1) =>
- if (v != v1) error("Error! contradiction: " + v + " and " + v1);
+ if (v != v1) sys.error("Error! contradiction: " + v + " and " + v1);
case None =>
informant = setter; value = Some(v);
for (c <- constraints; if !(c == informant)) {
diff --git a/test/files/run/Course-2002-13.scala b/test/files/run/Course-2002-13.scala
index c266af8c32..a596a33873 100644
--- a/test/files/run/Course-2002-13.scala
+++ b/test/files/run/Course-2002-13.scala
@@ -42,7 +42,7 @@ object Terms {
}
case class Binding(name: String, term: Term) {
- term match { case Var(n) if (name == n) => error("bad binding") case _ => () }
+ term match { case Var(n) if (name == n) => sys.error("bad binding") case _ => () }
override def toString() = name + " = " + term;
}
@@ -74,18 +74,18 @@ object Terms {
val NoTerm = Con("<none>", List());
- def unify1(x: Term, y: Term, s: Subst): Option[Subst] = Pair(x, y) match {
- case Pair(Var(a), Var(b)) if (a == b) =>
+ def unify1(x: Term, y: Term, s: Subst): Option[Subst] = (x, y) match {
+ case (Var(a), Var(b)) if (a == b) =>
Some(s)
- case Pair(Var(a), _) => lookup(s, a) match {
+ case (Var(a), _) => lookup(s, a) match {
case Some(x1) => unify(x1, y, s)
case None => if (y.tyvars contains a) None else Some(Binding(a, y) :: s)
}
- case Pair(_, Var(b)) => lookup(s, b) match {
+ case (_, Var(b)) => lookup(s, b) match {
case Some(y1) => unify(x, y1, s)
case None => if (x.tyvars contains b) None else Some(Binding(b, x) :: s)
}
- case Pair(Con(a, xs), Con(b, ys)) if (a == b) =>
+ case (Con(a, xs), Con(b, ys)) if (a == b) =>
unify(xs, ys, s)
case _ => None
}
@@ -96,9 +96,9 @@ object Terms {
ss
}
- def unify(xs: List[Term], ys: List[Term], s: Subst): Option[Subst] = Pair(xs, ys) match {
- case Pair(List(), List()) => Some(s)
- case Pair(x :: xs1, y :: ys1) =>
+ def unify(xs: List[Term], ys: List[Term], s: Subst): Option[Subst] = (xs, ys) match {
+ case (List(), List()) => Some(s)
+ case (x :: xs1, y :: ys1) =>
unify(x, y, s) match {
case Some(s1) => unify(xs1, ys1, s1)
case None => None
@@ -168,7 +168,7 @@ class Parser(s: String) {
var token: String = it.next;
- def syntaxError(msg: String): Unit = error(msg + ", but " + token + " found");
+ def syntaxError(msg: String): Unit = sys.error(msg + ", but " + token + " found");
def rep[a](p: => a): List[a] = {
val t = p;
diff --git a/test/files/run/Meter.check b/test/files/run/Meter.check
index b7e2eac125..c79c51a294 100644
--- a/test/files/run/Meter.check
+++ b/test/files/run/Meter.check
@@ -1,3 +1,6 @@
+Meter.scala:72: warning: a.Meter and Int are unrelated: they will never compare equal
+ println("x == 1: "+(x == 1))
+ ^
2.0
4.0m
false
diff --git a/test/files/run/MeterCaseClass.check b/test/files/run/MeterCaseClass.check
index 2528753657..2782704f9f 100644
--- a/test/files/run/MeterCaseClass.check
+++ b/test/files/run/MeterCaseClass.check
@@ -1,3 +1,6 @@
+MeterCaseClass.scala:69: warning: comparing values of types a.Meter and Int using `==' will always yield false
+ println("x == 1: "+(x == 1))
+ ^
2.0
Meter(4.0)
false
diff --git a/test/files/run/OrderingTest.scala b/test/files/run/OrderingTest.scala
index 53448fbbce..8af18aaba5 100644
--- a/test/files/run/OrderingTest.scala
+++ b/test/files/run/OrderingTest.scala
@@ -6,7 +6,7 @@ object Test extends App {
assert((cmp == 0) == (cmp2 == 0))
assert((cmp > 0) == (cmp2 < 0))
assert((cmp < 0) == (cmp2 > 0))
- }
+ }
def testAll[T](t1 : T, t2 : T)(implicit ord : Ordering[T]) = {
assert(ord.compare(t1, t2) < 0)
@@ -16,8 +16,8 @@ object Test extends App {
}
assert(Ordering[String].compare("australopithecus", "brontausaurus") < 0)
- // assert(Ordering[Unit].compare((), ()) == 0)
-
+ // assert(Ordering[Unit].compare((), ()) == 0)
+
testAll("bar", "foo");
testAll[Byte](0, 1);
testAll(false, true)
@@ -28,7 +28,7 @@ object Test extends App {
testAll[Iterable[Int]](List(1, 2), List(2));
testAll((1, "bar"), (1, "foo"))
testAll((1, "foo"), (2, "bar"))
-
+
// sortBy
val words = "The quick brown fox jumped over the lazy dog".split(' ')
val result = words.sortBy(x => (x.length, x.head))
diff --git a/test/files/run/Predef.readLine.scala b/test/files/run/Predef.readLine.scala
index 9f07936638..ce8565864a 100644
--- a/test/files/run/Predef.readLine.scala
+++ b/test/files/run/Predef.readLine.scala
@@ -1,4 +1,5 @@
import java.io.StringReader
+import scala.io.StdIn.readLine
object Test extends App {
Console.withIn(new StringReader("")) {
@@ -7,4 +8,4 @@ object Test extends App {
readLine("%s prompt\n", "fancy")
readLine("%s %s prompt\n", "immensely", "fancy")
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/ReplacementMatching.scala b/test/files/run/ReplacementMatching.scala
index faa46419dc..05040d98a3 100644
--- a/test/files/run/ReplacementMatching.scala
+++ b/test/files/run/ReplacementMatching.scala
@@ -7,12 +7,12 @@ import util.matching._
object Test {
-
+
def main(args: Array[String]) {
replacementMatching
groupsMatching
}
-
+
def replacementMatching {
val regex = """\$\{(.+?)\}""".r
val replaced = regex.replaceAllIn("Replacing: ${main}. And another method: ${foo}.",
@@ -21,7 +21,7 @@ object Test {
identifier
})
assert(replaced == "Replacing: main. And another method: foo.")
-
+
val regex3 = """\$\{(.+?)\}""".r
val replaced3 = regex3.replaceSomeIn("Replacing: ${main}. And another: ${foo}.", (m: util.matching.Regex.Match) => {
val id = m.group(1)
@@ -29,7 +29,7 @@ object Test {
})
assert(replaced3 == "Replacing: main. And another: ${foo}.")
}
-
+
def groupsMatching {
val Date = """(\d+)/(\d+)/(\d+)""".r
for (Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millenium. 31/12/2000 doesn't.") {
@@ -43,5 +43,5 @@ object Test {
assert(c == "2001" || c == "2000")
}
}
-
+
}
diff --git a/test/files/run/ReverseSeqView.scala b/test/files/run/ReverseSeqView.scala
index 517f1cc24c..2004791bff 100644
--- a/test/files/run/ReverseSeqView.scala
+++ b/test/files/run/ReverseSeqView.scala
@@ -5,14 +5,14 @@
object Test extends App {
-
+
val lstv = List(1, 2, 3).view
val lstvr = lstv.reverse
assert(lstvr.iterator.toList == List(3, 2, 1))
assert(lstvr.reverse == List(1, 2, 3))
assert(lstvr.reverseIterator.toList == List(1, 2, 3))
assert(lstvr.reverseMap(_ + 1) == List(2, 3, 4))
-
+
}
diff --git a/test/files/run/SymbolsTest.scala b/test/files/run/SymbolsTest.scala
index 53caa5e62f..d5948ea168 100644
--- a/test/files/run/SymbolsTest.scala
+++ b/test/files/run/SymbolsTest.scala
@@ -1,6 +1,5 @@
-
-
+import scala.language.reflectiveCalls
class Slazz {
val s1 = 'myFirstSymbol
diff --git a/test/files/run/UnrolledBuffer.scala b/test/files/run/UnrolledBuffer.scala
index fe08e812ac..62a1f7d083 100644
--- a/test/files/run/UnrolledBuffer.scala
+++ b/test/files/run/UnrolledBuffer.scala
@@ -7,12 +7,12 @@ import collection.mutable.UnrolledBuffer
object Test {
-
+
def main(args: Array[String]) {
val u1 = new UnrolledBuffer[Int]
assert(u1.isEmpty)
assert(u1.size == 0)
-
+
u1 += 1
u1 += 2
u1 += 3
@@ -20,11 +20,11 @@ object Test {
assert(u1.toList == List(1, 2, 3))
assert(u1.nonEmpty)
assert(u1.size == 3)
-
+
u1.clear
assert(u1.isEmpty)
assert(u1.size == 0)
-
+
u1 += 1
u1 += 2
u1 += 3
@@ -33,56 +33,56 @@ object Test {
assert(u1.size == 2)
assert(u1 == UnrolledBuffer(1, 3))
assert(u1.toList == List(1, 3))
-
+
u1 concat UnrolledBuffer(5, 7, 9)
assert(u1 == UnrolledBuffer(1, 3, 5, 7, 9))
-
+
val u2 = u1 map { x => (x - 1) / 2 }
assert(u2 == UnrolledBuffer(0, 1, 2, 3, 4))
-
+
u1.clear
u2.clear
assert(u1.size == 0)
assert(u2.size == 0)
-
+
for (i <- 0 until 500) u1 += i
for (i <- 500 until 1000) u2 += i
assert(u1.size == 500)
assert(u2.size == 500)
assert(u1.iterator.toList == (0 until 500).toList)
assert((for (elem <- u1) yield elem) sameElements (0 until 500))
-
+
u1 concat u2
assert(u1.size == 1000)
assert(u2.size == 0)
assertCorrect(u1)
-
+
u1 concat UnrolledBuffer()
assertCorrect(u1)
-
+
val u3 = u1 map { x => x }
var i = 0
for (elem <- u1) {
assert(elem == u3(i))
i += 1
}
-
+
u1.remove(999)
assert(u1.size == 999)
assertCorrect(u1)
-
+
u1.remove(500)
assert(u1.size == 998)
assertCorrect(u1)
-
+
u1.remove(5)
assert(u1.size == 997)
assertCorrect(u1)
-
+
u1.remove(0)
assert(u1.size == 996)
assertCorrect(u1)
-
+
u1.insert(0, 0)
assert(u1.size == 997)
assertCorrect(u1)
@@ -90,15 +90,15 @@ object Test {
u1.insert(5, 5)
assert(u1.size == 998)
assertCorrect(u1)
-
+
u1.insert(500, 500)
assert(u1.size == 999)
assertCorrect(u1)
-
+
u1.insert(999, 999)
assert(u1.size == 1000)
assertCorrect(u1)
-
+
for (i <- -100 until 0) {
i +=: u1
assertCorrect(u1)
@@ -106,7 +106,7 @@ object Test {
assert(u1.size == 1100)
assertCorrect(u1)
}
-
+
def assertCorrect(u1: UnrolledBuffer[Int]) {
val sz = u1.size
val store = new Array[Int](sz)
@@ -117,9 +117,9 @@ object Test {
for (i <- 0 until sz) assert(u1(i) == (sz - i))
for (i <- 0 until sz) u1(i) = store(i)
for (i <- 0 until sz) assert(store(i) == u1(i))
-
+
assert((u1 map { x => x }) == u1)
assert(u1.iterator.toSeq.size == u1.size)
}
-
+
}
diff --git a/test/files/run/WeakHashSetTest.scala b/test/files/run/WeakHashSetTest.scala
index 3c8f380150..8072aa9b84 100644
--- a/test/files/run/WeakHashSetTest.scala
+++ b/test/files/run/WeakHashSetTest.scala
@@ -33,7 +33,7 @@ package scala.reflect.internal.util {
def checkEmpty {
val hs = new WeakHashSet[String]()
assert(hs.size == 0)
- hs.diagnostics.fullyValidate
+ hs.diagnostics.fullyValidate
}
// make sure += works
@@ -85,7 +85,7 @@ package scala.reflect.internal.util {
val hs = new WeakHashSet[Collider]()
val elements = (0 until size).toList map {x => Collider("a" + x)}
elements foreach (hs += _)
- // don't throw the following into a retained collection so gc
+ // don't throw the following into a retained collection so gc
// can remove them
for (i <- 0 until size) {
hs += Collider("b" + i)
@@ -150,9 +150,9 @@ package scala.reflect.internal.util {
hs.clear()
assert(hs.size == 0)
elements foreach {i => assert(!(hs contains i))}
- hs.diagnostics.fullyValidate
+ hs.diagnostics.fullyValidate
}
-
+
// check that the iterator covers all the contents
def checkIterator {
val hs = new WeakHashSet[String]()
@@ -161,14 +161,14 @@ package scala.reflect.internal.util {
assert(elements.iterator.toList.sorted == elements.sorted)
hs.diagnostics.fullyValidate
}
-
+
// check that the iterator covers all the contents even when there is a collision
def checkIteratorCollisions {
val hs = new WeakHashSet[Collider]
val elements = (0 until 20).toList map {x => Collider("a" + x)}
elements foreach (hs += _)
- assert(elements.iterator.toList.sorted == elements.sorted)
+ assert(elements.iterator.toList.sorted == elements.sorted)
hs.diagnostics.fullyValidate
}
}
-}
+}
diff --git a/test/files/run/absoverride.scala b/test/files/run/absoverride.scala
index 8c6de09d2a..a3c03df0d7 100644
--- a/test/files/run/absoverride.scala
+++ b/test/files/run/absoverride.scala
@@ -26,16 +26,16 @@ trait SyncIterator extends AbsIterator {
}
}
trait LoggedIterator extends AbsIterator {
- abstract override def next: T = {
- val x = super.next; println("log: " + x); x
+ abstract override def next: T = {
+ val x = super.next; println("log: " + x); x
}
}
-class Iter2(s: String) extends StringIterator(s)
- with SyncIterator with LoggedIterator;
+class Iter2(s: String) extends StringIterator(s)
+ with SyncIterator with LoggedIterator;
object Test {
def main(args: Array[String]) {
class Iter extends StringIterator(args(0)) with RichIterator with SyncIterator with LoggedIterator
val iter = new Iter
- iter foreach Console.println
+ iter foreach Console.println
}
}
diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala
index 93fb5dcd06..6ec97105fe 100644
--- a/test/files/run/abstypetags_serialize.scala
+++ b/test/files/run/abstypetags_serialize.scala
@@ -1,3 +1,4 @@
+import scala.language.higherKinds
import java.io._
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
@@ -30,4 +31,4 @@ object Test extends App {
}
qwe
-} \ No newline at end of file
+}
diff --git a/test/files/run/all-overridden.check b/test/files/run/all-overridden.check
new file mode 100644
index 0000000000..1b620b1176
--- /dev/null
+++ b/test/files/run/all-overridden.check
@@ -0,0 +1 @@
+method g
diff --git a/test/files/run/all-overridden.scala b/test/files/run/all-overridden.scala
new file mode 100644
index 0000000000..ff51fa19bf
--- /dev/null
+++ b/test/files/run/all-overridden.scala
@@ -0,0 +1,11 @@
+import scala.reflect.runtime.universe._
+
+object Test {
+ trait Foo { def f: Int = 5 ; def g: Int }
+ trait Bar extends Foo { def f: Int ; def g: Int = 5 }
+
+ def main(args: Array[String]): Unit = {
+ // We should see g, but not f or $init$.
+ typeOf[Bar].decls.toList.flatMap(_.overrides) foreach println
+ }
+}
diff --git a/test/files/run/analyzerPlugins.check b/test/files/run/analyzerPlugins.check
index 7d8d181306..9803465ddc 100644
--- a/test/files/run/analyzerPlugins.check
+++ b/test/files/run/analyzerPlugins.check
@@ -7,7 +7,7 @@ annotationsConform(Int @testAnn, Int) [2]
annotationsConform(Int(1) @testAnn, Int) [1]
annotationsConform(Int(1), Int @testAnn) [1]
annotationsConform(Nothing, Int @testAnn) [2]
-annotationsConform(String @testAnn, String) [1]
+annotationsConform(String @testAnn, String) [2]
canAdaptAnnotations(Trees$Ident, String) [1]
canAdaptAnnotations(Trees$Select, ?) [1]
canAdaptAnnotations(Trees$Select, Boolean @testAnn) [1]
@@ -22,24 +22,24 @@ pluginsPt(?, Trees$Annotated) [7]
pluginsPt(?, Trees$Apply) [8]
pluginsPt(?, Trees$ApplyImplicitView) [2]
pluginsPt(?, Trees$Assign) [7]
-pluginsPt(?, Trees$Block) [7]
+pluginsPt(?, Trees$Block) [4]
pluginsPt(?, Trees$ClassDef) [2]
pluginsPt(?, Trees$DefDef) [14]
-pluginsPt(?, Trees$Ident) [49]
+pluginsPt(?, Trees$Ident) [50]
pluginsPt(?, Trees$If) [2]
-pluginsPt(?, Trees$Literal) [20]
+pluginsPt(?, Trees$Literal) [16]
pluginsPt(?, Trees$New) [5]
pluginsPt(?, Trees$PackageDef) [1]
pluginsPt(?, Trees$Return) [1]
-pluginsPt(?, Trees$Select) [51]
+pluginsPt(?, Trees$Select) [47]
pluginsPt(?, Trees$Super) [2]
pluginsPt(?, Trees$This) [20]
pluginsPt(?, Trees$TypeApply) [3]
pluginsPt(?, Trees$TypeBoundsTree) [2]
pluginsPt(?, Trees$TypeDef) [1]
-pluginsPt(?, Trees$TypeTree) [37]
+pluginsPt(?, Trees$TypeTree) [38]
pluginsPt(?, Trees$Typed) [1]
-pluginsPt(?, Trees$ValDef) [23]
+pluginsPt(?, Trees$ValDef) [21]
pluginsPt(Any, Trees$Literal) [2]
pluginsPt(Any, Trees$Typed) [1]
pluginsPt(Array[Any], Trees$ArrayValue) [1]
@@ -53,7 +53,7 @@ pluginsPt(Int @testAnn, Trees$Literal) [1]
pluginsPt(Int, Trees$Apply) [1]
pluginsPt(Int, Trees$Ident) [2]
pluginsPt(Int, Trees$If) [1]
-pluginsPt(Int, Trees$Literal) [6]
+pluginsPt(Int, Trees$Literal) [5]
pluginsPt(Int, Trees$Select) [3]
pluginsPt(List, Trees$Apply) [1]
pluginsPt(List[Any], Trees$Select) [1]
@@ -65,7 +65,7 @@ pluginsPt(String, Trees$Literal) [1]
pluginsPt(String, Trees$Select) [1]
pluginsPt(String, Trees$Typed) [1]
pluginsPt(Unit, Trees$Assign) [1]
-pluginsPt(scala.annotation.Annotation, Trees$Apply) [5]
+pluginsPt(testAnn, Trees$Apply) [5]
pluginsTypeSig(<none>, Trees$Template) [2]
pluginsTypeSig(class A, Trees$ClassDef) [1]
pluginsTypeSig(class testAnn, Trees$ClassDef) [1]
@@ -82,8 +82,8 @@ pluginsTypeSig(value lub1, Trees$ValDef) [2]
pluginsTypeSig(value lub2, Trees$ValDef) [2]
pluginsTypeSig(value param, Trees$ValDef) [2]
pluginsTypeSig(value str, Trees$ValDef) [1]
-pluginsTypeSig(value x, Trees$ValDef) [5]
-pluginsTypeSig(value y, Trees$ValDef) [5]
+pluginsTypeSig(value x, Trees$ValDef) [4]
+pluginsTypeSig(value y, Trees$ValDef) [4]
pluginsTypeSig(variable count, Trees$ValDef) [3]
pluginsTypeSigAccessor(value annotField) [1]
pluginsTypeSigAccessor(value inferField) [1]
@@ -110,8 +110,7 @@ pluginsTyped(<notype>, Trees$ClassDef) [2]
pluginsTyped(<notype>, Trees$DefDef) [14]
pluginsTyped(<notype>, Trees$PackageDef) [1]
pluginsTyped(<notype>, Trees$TypeDef) [1]
-pluginsTyped(<notype>, Trees$ValDef) [23]
-pluginsTyped(<root>, Trees$Ident) [1]
+pluginsTyped(<notype>, Trees$ValDef) [21]
pluginsTyped(=> Boolean @testAnn, Trees$Select) [1]
pluginsTyped(=> Double, Trees$Select) [4]
pluginsTyped(=> Int, Trees$Select) [5]
@@ -124,7 +123,7 @@ pluginsTyped(A, Trees$TypeTree) [4]
pluginsTyped(A.super.type, Trees$Super) [1]
pluginsTyped(A.this.type, Trees$This) [11]
pluginsTyped(Any, Trees$TypeTree) [1]
-pluginsTyped(AnyRef, Trees$Select) [2]
+pluginsTyped(AnyRef, Trees$Select) [4]
pluginsTyped(Array[Any], Trees$ArrayValue) [1]
pluginsTyped(Boolean @testAnn, Trees$Select) [1]
pluginsTyped(Boolean @testAnn, Trees$TypeTree) [4]
@@ -137,12 +136,12 @@ pluginsTyped(Int @testAnn, Trees$TypeTree) [2]
pluginsTyped(Int @testAnn, Trees$Typed) [2]
pluginsTyped(Int(0), Trees$Literal) [3]
pluginsTyped(Int(1) @testAnn, Trees$Typed) [1]
-pluginsTyped(Int(1), Trees$Literal) [9]
+pluginsTyped(Int(1), Trees$Literal) [8]
pluginsTyped(Int(2), Trees$Literal) [1]
pluginsTyped(Int, Trees$Apply) [1]
pluginsTyped(Int, Trees$Ident) [2]
pluginsTyped(Int, Trees$If) [2]
-pluginsTyped(Int, Trees$Select) [17]
+pluginsTyped(Int, Trees$Select) [15]
pluginsTyped(Int, Trees$TypeTree) [13]
pluginsTyped(List, Trees$Apply) [1]
pluginsTyped(List, Trees$Select) [1]
@@ -150,7 +149,6 @@ pluginsTyped(List[Any], Trees$Apply) [1]
pluginsTyped(List[Any], Trees$Select) [1]
pluginsTyped(List[Any], Trees$TypeTree) [3]
pluginsTyped(Nothing, Trees$Return) [1]
-pluginsTyped(Nothing, Trees$Select) [2]
pluginsTyped(Object, Trees$Apply) [1]
pluginsTyped(String @testAnn, Trees$Ident) [1]
pluginsTyped(String @testAnn, Trees$Select) [1]
@@ -160,31 +158,30 @@ pluginsTyped(String("huhu"), Trees$Literal) [1]
pluginsTyped(String("str") @testAnn, Trees$Typed) [1]
pluginsTyped(String("str"), Trees$Literal) [1]
pluginsTyped(String("str"), Trees$Typed) [1]
-pluginsTyped(String("two"), Trees$Literal) [3]
+pluginsTyped(String("two"), Trees$Literal) [2]
pluginsTyped(String, Trees$Apply) [2]
pluginsTyped(String, Trees$Block) [2]
pluginsTyped(String, Trees$Ident) [1]
pluginsTyped(String, Trees$Select) [9]
-pluginsTyped(String, Trees$TypeTree) [8]
+pluginsTyped(String, Trees$TypeTree) [7]
pluginsTyped(Unit, Trees$Apply) [2]
pluginsTyped(Unit, Trees$Assign) [8]
-pluginsTyped(Unit, Trees$Block) [7]
+pluginsTyped(Unit, Trees$Block) [4]
pluginsTyped(Unit, Trees$If) [1]
-pluginsTyped(Unit, Trees$Literal) [8]
+pluginsTyped(Unit, Trees$Literal) [5]
pluginsTyped(Unit, Trees$TypeTree) [1]
pluginsTyped([A](xs: A*)List[A], Trees$Select) [1]
pluginsTyped([T <: Int]=> Int, Trees$Select) [1]
-pluginsTyped([T0 >: ? <: ?]()T0, Trees$Select) [1]
+pluginsTyped([T0]()T0, Trees$Select) [1]
pluginsTyped([T](xs: Array[T])scala.collection.mutable.WrappedArray[T], Trees$Select) [1]
-pluginsTyped(annotation.type, Trees$Select) [2]
+pluginsTyped(annotation.type, Trees$Select) [4]
pluginsTyped(math.type, Trees$Select) [9]
pluginsTyped(scala.annotation.Annotation, Trees$Apply) [1]
pluginsTyped(scala.annotation.TypeConstraint, Trees$Select) [4]
+pluginsTyped(scala.annotation.TypeConstraint, Trees$TypeTree) [2]
pluginsTyped(scala.collection.immutable.List.type, Trees$Select) [2]
pluginsTyped(scala.collection.immutable.StringOps, Trees$ApplyImplicitView) [2]
pluginsTyped(scala.collection.mutable.WrappedArray[Any], Trees$Apply) [1]
-pluginsTyped(scala.type, Trees$Ident) [1]
-pluginsTyped(scala.type, Trees$Select) [1]
pluginsTyped(str.type, Trees$Ident) [3]
pluginsTyped(testAnn, Trees$Apply) [5]
pluginsTyped(testAnn, Trees$Ident) [5]
diff --git a/test/files/run/analyzerPlugins.scala b/test/files/run/analyzerPlugins.scala
index daef83fa30..4b297ff220 100644
--- a/test/files/run/analyzerPlugins.scala
+++ b/test/files/run/analyzerPlugins.scala
@@ -8,7 +8,9 @@ object Test extends DirectTest {
def code = """
class testAnn extends annotation.TypeConstraint
- class A(param: Double) extends { val x: Int = 1; val y = "two"; type T = A } with AnyRef {
+ class A(param: Double) extends { val x: Int = 1; val y = "two" } with AnyRef {
+ type T = A
+
val inferField = ("str": @testAnn)
val annotField: Boolean @testAnn = false
@@ -77,12 +79,12 @@ object Test extends DirectTest {
object analyzerPlugin extends AnalyzerPlugin {
def treeClass(t: Tree) = t.getClass.toString.split('.').last
- override def pluginsPt(pt: Type, typer: Typer, tree: Tree, mode: Int): Type = {
+ override def pluginsPt(pt: Type, typer: Typer, tree: Tree, mode: Mode): Type = {
output += s"pluginsPt($pt, ${treeClass(tree)})"
pt
}
-
- override def pluginsTyped(tpe: Type, typer: Typer, tree: Tree, mode: Int, pt: Type): Type = {
+
+ override def pluginsTyped(tpe: Type, typer: Typer, tree: Tree, mode: Mode, pt: Type): Type = {
output += s"pluginsTyped($tpe, ${treeClass(tree)})"
tpe
}
@@ -98,7 +100,7 @@ object Test extends DirectTest {
}
- override def canAdaptAnnotations(tree: Tree, typer: Typer, mode: Int, pt: Type): Boolean = {
+ override def canAdaptAnnotations(tree: Tree, typer: Typer, mode: Mode, pt: Type): Boolean = {
output += s"canAdaptAnnotations(${treeClass(tree)}, $pt)"
false
}
diff --git a/test/files/run/annotatedRetyping.scala b/test/files/run/annotatedRetyping.scala
index cf1b0f27b5..9b9ebd5a1e 100644
--- a/test/files/run/annotatedRetyping.scala
+++ b/test/files/run/annotatedRetyping.scala
@@ -40,7 +40,7 @@ object Test extends DirectTest {
defTree match {
case impl: Template =>
templates += typer.context.owner -> (impl, typer)
-
+
case dd: DefDef if dd.symbol.isPrimaryConstructor && templates.contains(dd.symbol.owner) =>
val (impl, templTyper) = templates(dd.symbol.owner)
for (stat <- impl.body.filterNot(_.isDef)) {
@@ -50,7 +50,7 @@ object Test extends DirectTest {
tpr.typed(stat)
}
- case _ =>
+ case _ =>
}
tpe
}
diff --git a/test/files/run/applydynamic_sip.flags b/test/files/run/applydynamic_sip.flags
index 1141f97507..ba6d37305e 100644
--- a/test/files/run/applydynamic_sip.flags
+++ b/test/files/run/applydynamic_sip.flags
@@ -1 +1,2 @@
+-Yrangepos:false
-language:dynamics
diff --git a/test/files/run/array-addition.check b/test/files/run/array-addition.check
new file mode 100644
index 0000000000..7bfbd9c711
--- /dev/null
+++ b/test/files/run/array-addition.check
@@ -0,0 +1,4 @@
+Array(1, 2, 3, 4)
+Array(1, 2, 3, 4)
+Array(1)
+Array(1)
diff --git a/test/files/run/array-addition.scala b/test/files/run/array-addition.scala
new file mode 100644
index 0000000000..8def48e85c
--- /dev/null
+++ b/test/files/run/array-addition.scala
@@ -0,0 +1,11 @@
+object Test {
+ def prettyPrintArray(x: Array[_]) = println("Array(" + x.mkString(", ") + ")")
+
+ def main(args: Array[String]): Unit = {
+ prettyPrintArray(Array(1,2,3) :+ 4)
+ prettyPrintArray(1 +: Array(2,3,4))
+ prettyPrintArray(Array() :+ 1)
+ prettyPrintArray(1 +: Array())
+ }
+}
+
diff --git a/test/files/run/array-charSeq.scala b/test/files/run/array-charSeq.scala
index f7d0586f03..53796bb9d5 100644
--- a/test/files/run/array-charSeq.scala
+++ b/test/files/run/array-charSeq.scala
@@ -6,6 +6,7 @@ object Test {
def check(chars: CharSequence) {
println("\n[check '" + chars + "'] len = " + chars.length)
chars match {
+ case x: Predef.ArrayCharSequence => assert(x.__arrayOfChars eq arr, ((x.__arrayOfChars, arr)))
case x: runtime.ArrayCharSequence => assert(x.xs eq arr, ((x.xs, arr)))
case x => assert(false, x)
}
diff --git a/test/files/run/array-existential-bound.scala b/test/files/run/array-existential-bound.scala
index bc442d39f7..cc105d8fcd 100644
--- a/test/files/run/array-existential-bound.scala
+++ b/test/files/run/array-existential-bound.scala
@@ -7,11 +7,11 @@ object Test extends Fooz[Array[Int]] {
val f2 = new Fooz[Array[Int]] { }
val f3 = new Fooz[Array[Any]] { }
val f4 = new Fooz[Array[_]] { }
-
+
def main(args: Array[String]): Unit = {
println(f1.f0(Array[String]("a", "b")))
- println(f2.f0(1 to 1000 toArray))
+ println(f2.f0((1 to 1000).toArray))
println(f3.f0((1 to 1000).toArray[Any]))
- println(f4.f0('a' to 'z' toArray))
+ println(f4.f0(('a' to 'z').toArray))
}
}
diff --git a/test/files/run/arrayclone-old.scala b/test/files/run/arrayclone-old.scala
index c9f7556b47..fbca38b42e 100644
--- a/test/files/run/arrayclone-old.scala
+++ b/test/files/run/arrayclone-old.scala
@@ -16,7 +16,7 @@ object BooleanArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = false;
- assert(it(0) == true)
+ assert(it(0) == true)
}
object ByteArrayClone{
@@ -24,7 +24,7 @@ object ByteArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = 0;
- assert(it(0) == 1)
+ assert(it(0) == 1)
}
object ShortArrayClone{
@@ -32,7 +32,7 @@ object ShortArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = 0;
- assert(it(0) == 1)
+ assert(it(0) == 1)
}
object CharArrayClone{
@@ -40,7 +40,7 @@ object CharArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = 0;
- assert(it(0) == 1)
+ assert(it(0) == 1)
}
object IntArrayClone{
@@ -48,7 +48,7 @@ object IntArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = 0;
- assert(it(0) == 1)
+ assert(it(0) == 1)
}
object LongArrayClone{
@@ -56,7 +56,7 @@ object LongArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = 0;
- assert(it(0) == 1)
+ assert(it(0) == 1)
}
object FloatArrayClone{
@@ -64,7 +64,7 @@ object FloatArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = 0;
- assert(it(0) == 1)
+ assert(it(0) == 1)
}
object DoubleArrayClone{
@@ -72,7 +72,7 @@ object DoubleArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = 0;
- assert(it(0) == 1)
+ assert(it(0) == 1)
}
object ObjectArrayClone{
@@ -80,7 +80,7 @@ object ObjectArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = "0";
- assert(it(0) == "1")
+ assert(it(0) == "1")
}
object PolymorphicArrayClone{
@@ -88,14 +88,14 @@ object PolymorphicArrayClone{
val cloned = it.clone();
assert(cloned.sameElements(it));
cloned(0) = zero;
- assert(it(0) == one)
- }
+ assert(it(0) == one)
+ }
testIt(Array("one", "two"), "one", "two");
class Mangler[T: Manifest](ts : T*){
// this will always be a BoxedAnyArray even after we've unboxed its contents.
- val it = ts.toArray[T];
+ val it = ts.toArray[T];
}
val mangled = new Mangler[Int](0, 1);
diff --git a/test/files/run/arraycopy.scala b/test/files/run/arraycopy.scala
index 82c34c23e7..bb06200dc7 100644
--- a/test/files/run/arraycopy.scala
+++ b/test/files/run/arraycopy.scala
@@ -5,7 +5,7 @@ object Test {
val a = new Array[Int](10)
val b = new Array[Any](10)
for (i <- 0 until 10) b(i) = i
-
+
Array.copy(b, 3, a, 3, 7)
assert(a.toSeq == List(0, 0, 0, 3, 4, 5, 6, 7, 8, 9))
}
diff --git a/test/files/run/arrays.check b/test/files/run/arrays.check
index b1f7fae1d1..c9a3a87268 100644
--- a/test/files/run/arrays.check
+++ b/test/files/run/arrays.check
@@ -1 +1,7 @@
+arrays.scala:248: warning: comparing values of types Unit and Unit using `==' will always yield true
+ check(xs(0) == u0, xs(0), u0);
+ ^
+arrays.scala:249: warning: comparing values of types Unit and Unit using `==' will always yield true
+ check(xs(1) == u1, xs(1), u1);
+ ^
checks: 2302
diff --git a/test/files/run/arrays.scala b/test/files/run/arrays.scala
index ecebc78a6f..c8bf80ea60 100644
--- a/test/files/run/arrays.scala
+++ b/test/files/run/arrays.scala
@@ -107,7 +107,7 @@ object Test {
val s1 = if (test1) "ok" else "KO";
val s2 = actual.toString();
val s3 = expected.toString();
- error(s0 + " - " + s1 + ": " + s2 + " != " + s3);
+ sys.error(s0 + " - " + s1 + ": " + s2 + " != " + s3);
}
checks += 1
}
diff --git a/test/files/run/arrayview.scala b/test/files/run/arrayview.scala
index 42ced5e9ac..97e840f5e9 100644
--- a/test/files/run/arrayview.scala
+++ b/test/files/run/arrayview.scala
@@ -1,6 +1,6 @@
object Test {
def f = (1 to 100).toArray.view
-
+
def main(args: Array[String]): Unit = {
val xs = (f filter (_ < 50)).reverse.filter(_ % 2 == 0).map(_ / 2).flatMap(x => Array(1, x))
assert(xs.size == 48)
diff --git a/test/files/run/bigDecimalCache.scala b/test/files/run/bigDecimalCache.scala
index e8ebefee78..c0c709a50f 100644
--- a/test/files/run/bigDecimalCache.scala
+++ b/test/files/run/bigDecimalCache.scala
@@ -1,9 +1,9 @@
-object Test {
+object Test {
def main(args: Array[String]): Unit = {
val bd5a = BigDecimal(5)
val mc = java.math.MathContext.DECIMAL32
val bd5b = BigDecimal(5,mc)
-
+
assert(bd5b.mc == mc)
}
}
diff --git a/test/files/run/bigDecimalTest.check b/test/files/run/bigDecimalTest.check
index 6d11c23fcd..36db6aaafe 100644
--- a/test/files/run/bigDecimalTest.check
+++ b/test/files/run/bigDecimalTest.check
@@ -3,4 +3,4 @@
0
0
0
-14
+15
diff --git a/test/files/run/bigDecimalTest.scala b/test/files/run/bigDecimalTest.scala
index 07b524c017..480305d7d4 100644
--- a/test/files/run/bigDecimalTest.scala
+++ b/test/files/run/bigDecimalTest.scala
@@ -28,7 +28,7 @@ object Test {
// SI-4547: implicit conversion
assert(5 + BigDecimal(3) == BigDecimal(8))
-
+
// meaningless sanity check
List[BigDecimal](a, b, c, d, e, f) map (_.scale) foreach println
}
diff --git a/test/files/run/bitsets.check b/test/files/run/bitsets.check
index 3f01d2a400..41c2ccdcb8 100644
--- a/test/files/run/bitsets.check
+++ b/test/files/run/bitsets.check
@@ -37,6 +37,11 @@ m2_r1 = true
m2_r2 = true
m2_r3 = true
+b1:BitSet(5, 6, 7)
+b2:BitSet(5)
+b3:BitSet(5, 7)
+b4:BitSet(7)
+b0:BitSet(5, 6, 7)
is0 = BitSet()
is1 = BitSet()
is2 = BitSet(2)
diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala
index 27395683b4..5d49220749 100644
--- a/test/files/run/bitsets.scala
+++ b/test/files/run/bitsets.scala
@@ -4,6 +4,8 @@
//############################################################################
+import scala.language.postfixOps
+
object TestMutable {
import scala.collection.mutable.BitSet
@@ -37,6 +39,19 @@ object TestMutable {
Console.println("mi1 = " + ms1.toImmutable)
Console.println("mi2 = " + ms2.toImmutable)
Console.println
+
+ val N = 257
+ val gen = 3
+ val bs = BitSet((1 until N): _*)
+ (1 until N).foldLeft(gen) {
+ case (acc, i) =>
+ assert(bs.size == N-i, s"Bad size for $bs, expected ${N-i} actual ${bs.size}")
+ assert(!bs.isEmpty, s"Unexpected isEmpty for $bs")
+ bs -= acc
+ acc*gen % N
+ }
+ assert(bs.size == 0, s"Expected size == 0 for $bs")
+ assert(bs.isEmpty, s"Expected isEmpty for $bs")
}
object TestMutable2 {
@@ -81,12 +96,51 @@ object TestMutable2 {
println
}
+object TestMutable3 {
+ import scala.collection.mutable.BitSet
+
+ val b0 = BitSet(5, 6)
+ val b1 = BitSet(7)
+ val b2 = BitSet(1, 5)
+ val b3 = BitSet(6, 7)
+ val b4 = BitSet(6, 7)
+
+ b1 |= b0
+ println(s"b1:$b1")
+ b2 &= b0
+ println(s"b2:$b2")
+ b3 ^= b0
+ println(s"b3:$b3")
+ b4 &~= b0
+ println(s"b4:$b4")
+ b0 ^= b0 |= b1
+ println(s"b0:$b0")
+}
+
+/***
+The memory requirements here are way beyond
+what a test should exercise.
+
+object TestMutable4 {
+ import scala.collection.mutable.BitSet
+
+ val bMax = BitSet(Int.MaxValue)
+ println(s"bMax:$bMax")
+ bMax.foreach(println)
+
+ val bLarge = BitSet(2000000001)
+ println(s"bLarge:$bLarge")
+
+ println(bMax == bLarge)
+}
+***/
+
object TestImmutable {
import scala.collection.immutable.BitSet
val is0 = BitSet()
- val is1 = BitSet.fromArray(Array())
- val is2 = BitSet.fromArray(Array(4))
+ val is1 = BitSet.fromBitMask(Array())
+ val is2 = BitSet.fromBitMask(Array(4))
val is3 = BitSet.empty
Console.println("is0 = " + is0)
@@ -155,6 +209,8 @@ object TestImmutable2 {
object Test extends App {
TestMutable
TestMutable2
+ TestMutable3
+ // TestMutable4
TestImmutable
TestImmutable2
}
diff --git a/test/files/run/blame_eye_triple_eee-double.check b/test/files/run/blame_eye_triple_eee-double.check
new file mode 100644
index 0000000000..5e46d91a8f
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-double.check
@@ -0,0 +1,9 @@
+if (NaN == NaN) is good
+if (x == x) is good
+if (x == NaN) is good
+if (NaN != NaN) is good
+if (x != x) is good
+if (NaN != x) is good
+x matching was good
+NaN matching was good
+loop with NaN was goood
diff --git a/test/files/run/blame_eye_triple_eee-double.flags b/test/files/run/blame_eye_triple_eee-double.flags
new file mode 100644
index 0000000000..c9b68d70dc
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-double.flags
@@ -0,0 +1 @@
+-optimise
diff --git a/test/files/run/blame_eye_triple_eee-double.scala b/test/files/run/blame_eye_triple_eee-double.scala
new file mode 100644
index 0000000000..1640aead40
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-double.scala
@@ -0,0 +1,61 @@
+object Test extends App {
+ import Double.NaN
+
+ // NaN must not equal NaN no matter what optimizations are applied
+ // All the following will seem redundant, but to an optimizer
+ // they can appear different
+
+ val x = NaN
+
+ if (NaN == NaN)
+ println("if (NaN == NaN) is broken")
+ else
+ println("if (NaN == NaN) is good")
+
+ if (x == x)
+ println("if (x == x) is broken")
+ else
+ println("if (x == x) is good")
+
+ if (x == NaN)
+ println("if (x == NaN) is broken")
+ else
+ println("if (x == NaN) is good")
+
+ if (NaN != NaN)
+ println("if (NaN != NaN) is good")
+ else
+ println("if (NaN != NaN) broken")
+
+ if (x != x)
+ println("if (x != x) is good")
+ else
+ println("if (x != x) broken")
+
+ if (NaN != x)
+ println("if (NaN != x) is good")
+ else
+ println("if (NaN != x) is broken")
+
+ x match {
+ case 0.0d => println("x matched 0!")
+ case NaN => println("x matched NaN!")
+ case _ => println("x matching was good")
+ }
+
+ NaN match {
+ case 0.0d => println("NaN matched 0!")
+ case NaN => println("NaN matched NaN!")
+ case _ => println("NaN matching was good")
+ }
+
+ var z = 0.0d
+ var i = 0
+ while (i < 10) {
+ if (i % 2 == 0) z = NaN
+ else z = NaN
+ i += 1
+ }
+ if (z.isNaN && i == 10) println("loop with NaN was goood")
+ else println("loop with NaN was broken")
+}
diff --git a/test/files/run/blame_eye_triple_eee-float.check b/test/files/run/blame_eye_triple_eee-float.check
new file mode 100644
index 0000000000..5e46d91a8f
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-float.check
@@ -0,0 +1,9 @@
+if (NaN == NaN) is good
+if (x == x) is good
+if (x == NaN) is good
+if (NaN != NaN) is good
+if (x != x) is good
+if (NaN != x) is good
+x matching was good
+NaN matching was good
+loop with NaN was goood
diff --git a/test/files/run/blame_eye_triple_eee-float.flags b/test/files/run/blame_eye_triple_eee-float.flags
new file mode 100644
index 0000000000..c9b68d70dc
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-float.flags
@@ -0,0 +1 @@
+-optimise
diff --git a/test/files/run/blame_eye_triple_eee-float.scala b/test/files/run/blame_eye_triple_eee-float.scala
new file mode 100644
index 0000000000..4deb9f3d60
--- /dev/null
+++ b/test/files/run/blame_eye_triple_eee-float.scala
@@ -0,0 +1,61 @@
+object Test extends App {
+ import Float.NaN
+
+ // NaN must not equal NaN no matter what optimizations are applied
+ // All the following will seem redundant, but to an optimizer
+ // they can appear different
+
+ val x = NaN
+
+ if (NaN == NaN)
+ println("if (NaN == NaN) is broken")
+ else
+ println("if (NaN == NaN) is good")
+
+ if (x == x)
+ println("if (x == x) is broken")
+ else
+ println("if (x == x) is good")
+
+ if (x == NaN)
+ println("if (x == NaN) is broken")
+ else
+ println("if (x == NaN) is good")
+
+ if (NaN != NaN)
+ println("if (NaN != NaN) is good")
+ else
+ println("if (NaN != NaN) broken")
+
+ if (x != x)
+ println("if (x != x) is good")
+ else
+ println("if (x != x) broken")
+
+ if (NaN != x)
+ println("if (NaN != x) is good")
+ else
+ println("if (NaN != x) is broken")
+
+ x match {
+ case 0.0f => println("x matched 0!")
+ case NaN => println("x matched NaN!")
+ case _ => println("x matching was good")
+ }
+
+ NaN match {
+ case 0.0f => println("NaN matched 0!")
+ case NaN => println("NaN matched NaN!")
+ case _ => println("NaN matching was good")
+ }
+
+ var z = 0.0f
+ var i = 0
+ while (i < 10) {
+ if (i % 2 == 0) z = NaN
+ else z = NaN
+ i += 1
+ }
+ if (z.isNaN && i == 10) println("loop with NaN was goood")
+ else println("loop with NaN was broken")
+}
diff --git a/test/files/run/boolexprs.scala b/test/files/run/boolexprs.scala
index 4f1c4b161a..b9b4faea9c 100644
--- a/test/files/run/boolexprs.scala
+++ b/test/files/run/boolexprs.scala
@@ -10,7 +10,7 @@ class Counter {
object Test1 {
var flag = false;
- def flip: Boolean = { val tmp = flag; flag = !flag; tmp }
+ def flip: Boolean = { val tmp = flag; flag = !flag; tmp }
def run: Int = {
val c = new Counter;
c.incrThen(flip || flip);
diff --git a/test/files/run/bridges.scala b/test/files/run/bridges.scala
index fda86eabc6..eb036bd781 100644
--- a/test/files/run/bridges.scala
+++ b/test/files/run/bridges.scala
@@ -3588,7 +3588,7 @@ object Test {
errors = errors + 1;
}
} catch {
- case exception => {
+ case exception: Throwable => {
Console.print(name + " raised exception " + exception);
Console.println;
errors = errors + 1;
diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala
index ca598603bb..02849b5817 100644
--- a/test/files/run/bugs.scala
+++ b/test/files/run/bugs.scala
@@ -46,7 +46,7 @@ object Bug135Test {
def test(args: Array[String]) {
val myMap:TreeMap[Int, String] = new TreeMap
- val map1 = myMap + Pair(42, "The answer")
+ val map1 = myMap + ((42, "The answer"))
println(map1.get(42))
}
@@ -304,7 +304,7 @@ object Bug250Test {
// Bug 257
object Bug257Test {
- def sayhello(): Unit = { Console.println("I should come 1st and 2nd"); };
+ def sayhello(): Unit = { Console.println("I should come 1st and 2nd"); };
def sayhi(): Unit = { Console.println("I should come last"); };
def f1(x: Unit): Unit = ();
@@ -444,7 +444,7 @@ object Test {
try {
test;
} catch {
- case exception =>
+ case exception: Throwable =>
Console.print("Exception in thread \"" + Thread.currentThread + "\" " + exception);
Console.println;
errors += 1
diff --git a/test/files/run/case-class-23.check b/test/files/run/case-class-23.check
new file mode 100644
index 0000000000..888ed2c9eb
--- /dev/null
+++ b/test/files/run/case-class-23.check
@@ -0,0 +1,2 @@
+23
+(1,23)
diff --git a/test/files/run/case-class-23.scala b/test/files/run/case-class-23.scala
new file mode 100644
index 0000000000..92b719574a
--- /dev/null
+++ b/test/files/run/case-class-23.scala
@@ -0,0 +1,33 @@
+case class TwentyThree(
+ _1: Int,
+ _2: Int,
+ _3: Int,
+ _4: Int,
+ _5: Int,
+ _6: Int,
+ _7: Int,
+ _8: Int,
+ _9: Int,
+ _10: Int,
+ _11: Int,
+ _12: Int,
+ _13: Int,
+ _14: Int,
+ _15: Int,
+ _16: Int,
+ _17: Int,
+ _18: Int,
+ _19: Int,
+ _20: Int,
+ _21: Int,
+ _22: Int,
+ _23: Int
+)
+
+object Test extends App {
+ val x = new TwentyThree(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)
+ println(x._23)
+ assert(x.copy(_1 = 1) == x)
+ val TwentyThree(a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, b) = x
+ println((a, b))
+}
diff --git a/test/files/run/caseClassEquality.scala b/test/files/run/caseClassEquality.scala
index 4940d80951..c11d7ad0d1 100644
--- a/test/files/run/caseClassEquality.scala
+++ b/test/files/run/caseClassEquality.scala
@@ -11,25 +11,25 @@ object Test {
case _ => false
}
}
-
+
case class CS1(xs: Any*)
class CS2(xs: Seq[_]*) extends CS1(xs: _*)
class CS3(xs: IndexedSeq[Int]*) extends CS2(xs: _*)
-
+
case class H1(x: Int, y: Double)
class H2(x: Double, y: Int) extends H1(y, x)
-
+
def main(args: Array[String]): Unit = {
assert(C1(5) == new C2(5))
assert(new C2(5) == C1(5))
assert(C1(5).hashCode == new C2(5).hashCode)
assert(new C2(5).hashCode == C1(5).hashCode)
-
+
assert(C1(5) != new C3(5))
assert(new C3(5) != C1(5))
-
+
assert(CS1(List(1d,2d), Seq[Float](3f, 4f)) == new CS3(IndexedSeq(1,2), IndexedSeq(3, 4)))
-
+
assert(H1(5, 10d) == new H2(10d, 5))
assert(H1(5, 10d).hashCode == new H2(10d, 5).hashCode)
}
diff --git a/test/files/run/caseclasses.scala b/test/files/run/caseclasses.scala
index 5aafea59e3..668c984f3d 100644
--- a/test/files/run/caseclasses.scala
+++ b/test/files/run/caseclasses.scala
@@ -1,6 +1,6 @@
case class Foo(x: Int)(y: Int)
-case class Bar
+case class Bar()
abstract class Base
abstract case class Abs(x: Int) extends Base
diff --git a/test/files/run/castsingleton.scala b/test/files/run/castsingleton.scala
index 47bd613079..339f5e00cf 100644
--- a/test/files/run/castsingleton.scala
+++ b/test/files/run/castsingleton.scala
@@ -8,4 +8,4 @@ object Test extends App {
}
empty(L())
-}
+}
diff --git a/test/files/run/checked.scala b/test/files/run/checked.scala
index 06bc0c05e5..e4db9c0916 100644
--- a/test/files/run/checked.scala
+++ b/test/files/run/checked.scala
@@ -23,9 +23,9 @@ trait T {
// Should not throw
class D extends B with T {
val sum = x + y + z + b1 + b2 + t1 + t2
- override def toString =
+ override def toString =
"sum = " + sum
-
+
}
abstract class NeedsXEarly {
@@ -91,7 +91,7 @@ class TestInterference extends {
object Test extends App {
-
+
def shouldThrow(t: => Unit) = try {
t
println("[FAIL]: No UFE thrown")
diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala
index 378caa7936..24b1ee8397 100644
--- a/test/files/run/classfile-format-51.scala
+++ b/test/files/run/classfile-format-51.scala
@@ -32,7 +32,7 @@ object Test extends DirectTest {
val constructor = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null)
constructor.visitCode()
constructor.visitVarInsn(ALOAD, 0)
- constructor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V")
+ constructor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false)
constructor.visitInsn(RETURN)
constructor.visitMaxs(1, 1)
constructor.visitEnd()
@@ -47,19 +47,19 @@ object Test extends DirectTest {
val bootstrap = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, bootstrapMethodName, bootStrapMethodType, null, null)
bootstrap.visitCode()
// val lookup = MethodHandles.lookup();
- bootstrap.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodHandles", "lookup", "()Ljava/lang/invoke/MethodHandles$Lookup;")
+ bootstrap.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodHandles", "lookup", "()Ljava/lang/invoke/MethodHandles$Lookup;", false)
bootstrap.visitVarInsn(ASTORE, 3) // lookup
// val clazz = lookup.lookupClass();
bootstrap.visitVarInsn(ALOAD, 3) // lookup
- bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandles$Lookup", "lookupClass", "()Ljava/lang/Class;")
+ bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandles$Lookup", "lookupClass", "()Ljava/lang/Class;", false)
bootstrap.visitVarInsn(ASTORE, 4) // clazz
// val methodType = MethodType.fromMethodDescriptorString("()Ljava/lang/String, clazz.getClassLoader()")
bootstrap.visitLdcInsn("()Ljava/lang/String;")
bootstrap.visitVarInsn(ALOAD, 4) // CLAZZ
- bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getClassLoader", "()Ljava/lang/ClassLoader;")
- bootstrap.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodType", "fromMethodDescriptorString", "(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/invoke/MethodType;")
+ bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getClassLoader", "()Ljava/lang/ClassLoader;", false)
+ bootstrap.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodType", "fromMethodDescriptorString", "(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/invoke/MethodType;", false)
bootstrap.visitVarInsn(ASTORE, 5) // methodType
// val methodHandle = lookup.findStatic(thisClass, "target", methodType)
@@ -67,14 +67,14 @@ object Test extends DirectTest {
bootstrap.visitVarInsn(ALOAD, 4) // clazz
bootstrap.visitLdcInsn("target")
bootstrap.visitVarInsn(ALOAD, 5) // methodType
- bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandles$Lookup", "findStatic", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/MethodHandle;")
+ bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandles$Lookup", "findStatic", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/MethodHandle;", false)
bootstrap.visitVarInsn(ASTORE, 6) // methodHandle
// new ConstantCallSite(methodHandle)
bootstrap.visitTypeInsn(NEW, "java/lang/invoke/ConstantCallSite")
bootstrap.visitInsn(DUP)
bootstrap.visitVarInsn(ALOAD, 6) // methodHandle
- bootstrap.visitMethodInsn(INVOKESPECIAL, "java/lang/invoke/ConstantCallSite", "<init>", "(Ljava/lang/invoke/MethodHandle;)V")
+ bootstrap.visitMethodInsn(INVOKESPECIAL, "java/lang/invoke/ConstantCallSite", "<init>", "(Ljava/lang/invoke/MethodHandle;)V", false)
bootstrap.visitInsn(ARETURN)
bootstrap.visitMaxs(4,7)
bootstrap.visitEnd()
@@ -91,14 +91,14 @@ object Test extends DirectTest {
val bytes = cw.toByteArray()
val fos = new FileOutputStream(new File(s"${testOutput.path}/$invokerClassName.class"))
- try
+ try
fos write bytes
finally
fos.close()
}
- def code =
+ def code =
"""
object Driver {
val invoker = new DynamicInvoker()
@@ -112,14 +112,14 @@ object Driver {
System.setErr(System.out)
try {
// this test is only valid under JDK 1.7+
- testUnderJavaAtLeast("1.7") {
+ testUnderJavaAtLeast("1.7") {
generateClass()
compile()
()
} otherwise {
()
}
- }
+ }
finally
System.setErr(prevErr)
}
diff --git a/test/files/run/classfile-format-52.scala b/test/files/run/classfile-format-52.scala
index 7afa09ae0b..e12c84124c 100644
--- a/test/files/run/classfile-format-52.scala
+++ b/test/files/run/classfile-format-52.scala
@@ -7,7 +7,7 @@ import asm.{AnnotationVisitor, ClassWriter, FieldVisitor, Handle, MethodVisitor,
import Opcodes._
// This test ensures that we can read JDK 8 (classfile format 52) files, including those
-// with default methods. To do that it first uses ASM to generate an interface called
+// with default methods. To do that it first uses ASM to generate an interface called
// HasDefaultMethod. Then it runs a normal compile on Scala source that extends that
// interface. Any failure will be dumped to std out.
//
@@ -40,14 +40,14 @@ object Test extends DirectTest {
val bytes = cw.toByteArray()
val fos = new FileOutputStream(new File(s"${testOutput.path}/$interfaceName.class"))
- try
+ try
fos write bytes
finally
fos.close()
}
- def code =
+ def code =
"""
class Driver extends HasDefaultMethod {
println(publicMethod())
@@ -65,12 +65,12 @@ class Driver extends HasDefaultMethod {
generateInterface()
compile()
Class.forName("Driver").newInstance()
- ()
+ ()
} otherwise {
println("hello from publicMethod")
- println("hello from staticMethod")
+ println("hello from staticMethod")
}
- }
+ }
finally
System.setErr(prevErr)
}
diff --git a/test/files/run/classmanifests_new_alias.scala b/test/files/run/classmanifests_new_alias.scala
index 12bd93bab6..777bd5dd6d 100644
--- a/test/files/run/classmanifests_new_alias.scala
+++ b/test/files/run/classmanifests_new_alias.scala
@@ -1,5 +1,7 @@
+
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
type CM[T] = ClassManifest[T]
println(implicitly[CM[Int]])
println(implicitly[CM[Int]] eq Manifest.Int)
-} \ No newline at end of file
+}
diff --git a/test/files/run/classmanifests_new_core.scala b/test/files/run/classmanifests_new_core.scala
index 63dbfab25c..0a9c58e8e1 100644
--- a/test/files/run/classmanifests_new_core.scala
+++ b/test/files/run/classmanifests_new_core.scala
@@ -1,4 +1,5 @@
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
println(classManifest[Int])
println(classManifest[Int] eq Manifest.Int)
-} \ No newline at end of file
+}
diff --git a/test/files/run/classof.check b/test/files/run/classof.check
index 0d650b87c0..83e292352d 100644
--- a/test/files/run/classof.check
+++ b/test/files/run/classof.check
@@ -17,6 +17,6 @@ class [Lscala.runtime.BoxedUnit;
class [I
class [D
class [Lscala.collection.immutable.List;
-Functions:
+Functions:
interface scala.Function2
interface scala.Function1
diff --git a/test/files/run/classof.scala b/test/files/run/classof.scala
index 10c07d2e51..257829e976 100644
--- a/test/files/run/classof.scala
+++ b/test/files/run/classof.scala
@@ -13,19 +13,19 @@ object Test {
println(classOf[Long])
println(classOf[Float])
println(classOf[Double])
-
+
println("Class types")
println(classOf[SomeClass])
println(classOf[List[Array[Float]]])
println(classOf[(String, Map[Int, String])])
println("Arrays:")
- println(classOf[Array[Unit]])
+ println(classOf[Array[Unit]])
println(classOf[Array[Int]])
println(classOf[Array[Double]])
println(classOf[Array[List[String]]])
- println("Functions: ")
+ println("Functions:")
println(classOf[(Int, Int) => Unit])
println(classOf[Int => Boolean])
}
diff --git a/test/files/run/collection-conversions.scala b/test/files/run/collection-conversions.scala
index d842742230..cd05f68e26 100644
--- a/test/files/run/collection-conversions.scala
+++ b/test/files/run/collection-conversions.scala
@@ -8,11 +8,11 @@ object Test {
def printResult[A,B](msg: String, obj: A, expected: B)(implicit tag: ClassTag[A], tag2: ClassTag[B]) = {
print(" :" + msg +": ")
- val isArray = obj match {
- case x: Array[Int] => true
+ val isArray = obj match {
+ case x: Array[Int] => true
case _ => false
}
- val expectedEquals =
+ val expectedEquals =
if(isArray) obj.asInstanceOf[Array[Int]].toSeq == expected.asInstanceOf[Array[Int]].toSeq
else obj == expected
val tagEquals = tag == tag2
@@ -49,7 +49,7 @@ object Test {
printResult("[Copy] ParVector", col.to[ParVector], testParVector)
printResult("[Copy] ParArray ", col.to[ParArray], testParArray)
}
-
+
def main(args: Array[String]): Unit = {
testConversion("iterator", (1 to 3).iterator)
testConversion("Vector", Vector(1,2,3))
diff --git a/test/files/run/collection-stacks.check b/test/files/run/collection-stacks.check
new file mode 100644
index 0000000000..895bde374d
--- /dev/null
+++ b/test/files/run/collection-stacks.check
@@ -0,0 +1,15 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+3-2-1: true
+3-2-1: true
+apply
+3: true
+3: true
+1: true
+1: true
+top
+3: true
+3: true
+pop
+2-1: true
+3: true
+2-1: true
diff --git a/test/files/run/collection-stacks.scala b/test/files/run/collection-stacks.scala
new file mode 100644
index 0000000000..be9fbbf1ae
--- /dev/null
+++ b/test/files/run/collection-stacks.scala
@@ -0,0 +1,38 @@
+import scala.collection.{ immutable, mutable }
+
+object Test extends App {
+ def mutableStack[T](xs: T*): mutable.Stack[T] = {
+ val s = new mutable.Stack[T]
+ s.pushAll(xs)
+ s
+ }
+
+ def immutableStack[T](xs: T*): immutable.Stack[T] = {
+ immutable.Stack.empty[T] pushAll xs
+ }
+
+ def check[T](expected: T, got: T) {
+ println(got + ": " + (expected == got))
+ }
+
+ // check #957
+ check("3-2-1", immutableStack(1, 2, 3).iterator.mkString("-"))
+ check("3-2-1", mutableStack(1, 2, 3).iterator.mkString("-"))
+
+ println("apply")
+ check(3, immutableStack(1, 2, 3).apply(0))
+ check(3, mutableStack(1, 2, 3).apply(0))
+ check(1, immutableStack(1, 2, 3).apply(2))
+ check(1, mutableStack(1, 2, 3).apply(2))
+
+ println("top")
+ check(3, immutableStack(1, 2, 3).top)
+ check(3, mutableStack(1, 2, 3).top)
+
+ println("pop")
+ check("2-1", immutableStack(1, 2, 3).pop.mkString("-"))
+ check(3, mutableStack(1, 2, 3).pop())
+ check("2-1", { val s = mutableStack(1, 2, 3); s.pop(); s.toList.mkString("-") })
+}
+
+// vim: set ts=2 sw=2 et:
diff --git a/test/files/run/collections-toSelf.scala b/test/files/run/collections-toSelf.scala
index 2adbc22af7..02f1dd6a95 100644
--- a/test/files/run/collections-toSelf.scala
+++ b/test/files/run/collections-toSelf.scala
@@ -2,7 +2,7 @@ object Test {
val map = Map(1 -> 2)
val set = Set(1, 2)
val seq = collection.immutable.Seq(1, 2)
-
+
def main(args: Array[String]): Unit = {
assert(map.toMap eq map)
assert(set.toSet eq set)
diff --git a/test/files/run/collections.scala b/test/files/run/collections.scala
index 69c40fae80..2b19ff4e75 100644
--- a/test/files/run/collections.scala
+++ b/test/files/run/collections.scala
@@ -1,5 +1,6 @@
-import collection._
+import scala.collection._
import scala.compat.Platform.currentTime
+import scala.language.postfixOps
object Test extends App {
@@ -61,7 +62,7 @@ object Test extends App {
}
time {
var x = 0
- for (i <- 0 to 10000)
+ for (i <- 0 to 10000)
s get i match {
case Some(i) => x += i
case None =>
@@ -96,7 +97,7 @@ object Test extends App {
}
time {
var x = 0
- for (i <- 0 to 10000)
+ for (i <- 0 to 10000)
s get i match {
case Some(i) => x += i
case None =>
diff --git a/test/files/run/colltest.check b/test/files/run/colltest.check
index e5bb013ed7..1e850bb582 100644
--- a/test/files/run/colltest.check
+++ b/test/files/run/colltest.check
@@ -1,3 +1,4 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
true
false
true
diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala
index 54adeb7cda..8dce69afc9 100644
--- a/test/files/run/colltest1.scala
+++ b/test/files/run/colltest1.scala
@@ -1,4 +1,8 @@
-import collection._
+/*
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
+import scala.collection._
+import scala.language.postfixOps
object Test extends App {
@@ -61,7 +65,7 @@ object Test extends App {
assert(ten.toStream == ten)
assert(ten.toString endsWith "(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)")
assert(ten.mkString("[", "; ", "]") endsWith "[1; 2; 3; 4; 5; 6; 7; 8; 9; 10]")
- }
+ }
def orderedIterableTest(empty: Iterable[Int]) {
orderedTraversableTest(empty)
@@ -84,7 +88,7 @@ object Test extends App {
assert(ten(0) == 1 && ten(9) == 10)
assert((ten lengthCompare 10) == 0 && (ten lengthCompare 1) > 0 && (ten lengthCompare 11) < 0)
assert((ten isDefinedAt 0) && (ten isDefinedAt 9))
- assert(!(ten isDefinedAt -1));
+ assert(!(ten isDefinedAt -1));
assert(!(ten isDefinedAt 10))
val tenten = ten zip ten
assert((tenten map (_._1)) == ten)
@@ -174,8 +178,8 @@ object Test extends App {
m ++= ('J' to 'Z') map (x => (x.toString -> x.toString))
println(m.toList.sorted)
assert(!m.isEmpty)
- assert(m.keySet forall (k => (m get k) == Some(k)))
- assert(m.keySet forall (k => (m apply k) == k))
+ assert(m.keySet forall (k => (m get k) == Some(k)))
+ assert(m.keySet forall (k => (m apply k) == k))
assert(m.keySet forall (m contains))
assert(m.getOrElse("7", "@") == "@")
assert(m.keySet.size == 26)
diff --git a/test/files/run/comparable-comparator.scala b/test/files/run/comparable-comparator.scala
index ac943c63bb..f059cc52f3 100644
--- a/test/files/run/comparable-comparator.scala
+++ b/test/files/run/comparable-comparator.scala
@@ -1,7 +1,7 @@
object Test {
import java.util.Comparator
-
+
class C1(val s: String) extends Comparable[C1] {
def compareTo(other: C1) = s compareTo other.s
override def toString = s
@@ -10,18 +10,19 @@ object Test {
def compareTo(other: C2) = s compareTo other.s
override def toString = s
}
-
+
implicit val cmp: Comparator[C2] = new Comparator[C2] {
def compare(p1: C2, p2: C2) = p2.s compareTo p1.s
}
- val strs = "zip foo bar baz aggle bing bong" split ' ' toList
+ val words = "zip foo bar baz aggle bing bong" split ' '
+ val strs = words.toList
val c1s = strs map (x => new C1(x))
val c2s = strs map (x => new C2(x))
-
+
val sorted1 = c1s.sorted map (_.s)
val sorted2 = c2s.sorted map (_.s)
-
+
def main(args: Array[String]): Unit = {
assert(sorted1 == sorted2.reverse)
}
diff --git a/test/files/run/compiler-asSeenFrom.check b/test/files/run/compiler-asSeenFrom.check
index 47d40b0331..7305504115 100644
--- a/test/files/run/compiler-asSeenFrom.check
+++ b/test/files/run/compiler-asSeenFrom.check
@@ -1,6 +1,54 @@
class C {
type seen from prefix is
---- ---------------- --
+ C.this.I[Int] C[List[T3]] C[List[T3]]#I[Int]
+ C.this.I[Int] C[T1] C[T1]#I[Int]
+ C.this.I[Int] D[A1] D[A1]#I[Int]
+ C.this.I[Int] D[T3] D[T3]#I[Int]
+ C.this.I[List[Int]] C[List[T3]] C[List[T3]]#I[List[Int]]
+ C.this.I[List[Int]] C[T1] C[T1]#I[List[Int]]
+ C.this.I[List[Int]] D[A1] D[A1]#I[List[Int]]
+ C.this.I[List[Int]] D[T3] D[T3]#I[List[Int]]
+ C.this.I[T1] C[List[T3]] C[List[T3]]#I[List[T3]]
+ C.this.I[T1] C[T1] C[T1]#I[T1]
+ C.this.I[T1] D[A1] D[A1]#I[A1]
+ C.this.I[T1] D[T3] D[T3]#I[T3]
+ C.this.I[T2] C[List[T3]] C[List[T3]]#I[T2]
+ C.this.I[T2] C[T1] C[T1]#I[T2]
+ C.this.I[T2] D[A1] D[A1]#I[T2]
+ C.this.I[T2] D[T3] D[T3]#I[T2]
+ C.this.I[T3] C[List[T3]] C[List[T3]]#I[T3]
+ C.this.I[T3] C[T1] C[T1]#I[T3]
+ C.this.I[T3] D[A1] D[A1]#I[T3]
+ C.this.I[T3] D[T3] D[T3]#I[T3]
+ C.this.I[T4] C[List[T3]] C[List[T3]]#I[T4]
+ C.this.I[T4] C[T1] C[T1]#I[T4]
+ C.this.I[T4] D[A1] D[A1]#I[T4]
+ C.this.I[T4] D[T3] D[T3]#I[T4]
+ C.this.J[Int] C[List[T3]] C[List[T3]]#J[Int]
+ C.this.J[Int] C[T1] C[T1]#J[Int]
+ C.this.J[Int] D[A1] D[A1]#J[Int]
+ C.this.J[Int] D[T3] D[T3]#J[Int]
+ C.this.J[List[Int]] C[List[T3]] C[List[T3]]#J[List[Int]]
+ C.this.J[List[Int]] C[T1] C[T1]#J[List[Int]]
+ C.this.J[List[Int]] D[A1] D[A1]#J[List[Int]]
+ C.this.J[List[Int]] D[T3] D[T3]#J[List[Int]]
+ C.this.J[T1] C[List[T3]] C[List[T3]]#J[List[T3]]
+ C.this.J[T1] C[T1] C[T1]#J[T1]
+ C.this.J[T1] D[A1] D[A1]#J[A1]
+ C.this.J[T1] D[T3] D[T3]#J[T3]
+ C.this.J[T2] C[List[T3]] C[List[T3]]#J[T2]
+ C.this.J[T2] C[T1] C[T1]#J[T2]
+ C.this.J[T2] D[A1] D[A1]#J[T2]
+ C.this.J[T2] D[T3] D[T3]#J[T2]
+ C.this.J[T3] C[List[T3]] C[List[T3]]#J[T3]
+ C.this.J[T3] C[T1] C[T1]#J[T3]
+ C.this.J[T3] D[A1] D[A1]#J[T3]
+ C.this.J[T3] D[T3] D[T3]#J[T3]
+ C.this.J[T4] C[List[T3]] C[List[T3]]#J[T4]
+ C.this.J[T4] C[T1] C[T1]#J[T4]
+ C.this.J[T4] D[A1] D[A1]#J[T4]
+ C.this.J[T4] D[T3] D[T3]#J[T4]
C[List[T3]]#I[T1] D[A1] C[List[T3]]#I[A1]
C[List[T3]]#I[T1] D[T3] C[List[T3]]#I[T3]
C[List[T3]]#J[T1] D[A1] C[List[T3]]#J[A1]
@@ -49,6 +97,8 @@ class C {
class D {
type seen from prefix is
---- ---------------- --
+ C.this.I[T3] D[A1] C.this.I[A1]
+ C.this.J[T3] D[A1] C.this.J[A1]
C[List[T3]]#I[Int] D[A1] C[List[A1]]#I[Int]
C[List[T3]]#I[List[Int]] D[A1] C[List[A1]]#I[List[Int]]
C[List[T3]]#I[T1] D[A1] C[List[A1]]#I[T1]
@@ -73,6 +123,42 @@ class D {
class I {
type seen from prefix is
---- ---------------- --
+ C.this.I[Int] D.this.J[T4] D.this.cD.I[Int]
+ C.this.I[Int] Z.dZ.J[A2] Z.dZ.cD.I[Int]
+ C.this.I[Int] Z.dZ.J[P] Z.dZ.cD.I[Int]
+ C.this.I[List[Int]] D.this.J[T4] D.this.cD.I[List[Int]]
+ C.this.I[List[Int]] Z.dZ.J[A2] Z.dZ.cD.I[List[Int]]
+ C.this.I[List[Int]] Z.dZ.J[P] Z.dZ.cD.I[List[Int]]
+ C.this.I[T1] D.this.J[T4] D.this.cD.I[List[T3]]
+ C.this.I[T1] Z.dZ.J[A2] Z.dZ.cD.I[List[A1]]
+ C.this.I[T1] Z.dZ.J[P] Z.dZ.cD.I[List[A1]]
+ C.this.I[T2] D.this.J[T4] D.this.cD.I[T4]
+ C.this.I[T2] Z.dZ.J[A2] Z.dZ.cD.I[A2]
+ C.this.I[T2] Z.dZ.J[P] Z.dZ.cD.I[P]
+ C.this.I[T3] D.this.J[T4] D.this.cD.I[T3]
+ C.this.I[T3] Z.dZ.J[A2] Z.dZ.cD.I[T3]
+ C.this.I[T3] Z.dZ.J[P] Z.dZ.cD.I[T3]
+ C.this.I[T4] D.this.J[T4] D.this.cD.I[T4]
+ C.this.I[T4] Z.dZ.J[A2] Z.dZ.cD.I[T4]
+ C.this.I[T4] Z.dZ.J[P] Z.dZ.cD.I[T4]
+ C.this.J[Int] D.this.J[T4] D.this.cD.J[Int]
+ C.this.J[Int] Z.dZ.J[A2] Z.dZ.cD.J[Int]
+ C.this.J[Int] Z.dZ.J[P] Z.dZ.cD.J[Int]
+ C.this.J[List[Int]] D.this.J[T4] D.this.cD.J[List[Int]]
+ C.this.J[List[Int]] Z.dZ.J[A2] Z.dZ.cD.J[List[Int]]
+ C.this.J[List[Int]] Z.dZ.J[P] Z.dZ.cD.J[List[Int]]
+ C.this.J[T1] D.this.J[T4] D.this.cD.J[List[T3]]
+ C.this.J[T1] Z.dZ.J[A2] Z.dZ.cD.J[List[A1]]
+ C.this.J[T1] Z.dZ.J[P] Z.dZ.cD.J[List[A1]]
+ C.this.J[T2] D.this.J[T4] D.this.cD.J[T4]
+ C.this.J[T2] Z.dZ.J[A2] Z.dZ.cD.J[A2]
+ C.this.J[T2] Z.dZ.J[P] Z.dZ.cD.J[P]
+ C.this.J[T3] D.this.J[T4] D.this.cD.J[T3]
+ C.this.J[T3] Z.dZ.J[A2] Z.dZ.cD.J[T3]
+ C.this.J[T3] Z.dZ.J[P] Z.dZ.cD.J[T3]
+ C.this.J[T4] D.this.J[T4] D.this.cD.J[T4]
+ C.this.J[T4] Z.dZ.J[A2] Z.dZ.cD.J[T4]
+ C.this.J[T4] Z.dZ.J[P] Z.dZ.cD.J[T4]
C[List[T3]]#I[T1] D.this.J[T4] C[List[T3]]#I[List[T3]]
C[List[T3]]#I[T1] Z.dZ.J[A2] C[List[T3]]#I[List[A1]]
C[List[T3]]#I[T1] Z.dZ.J[P] C[List[T3]]#I[List[A1]]
@@ -137,6 +223,14 @@ class I {
class J {
type seen from prefix is
---- ---------------- --
+ C.this.I[T3] Z.dZ.J[A2] C.this.I[A1]
+ C.this.I[T3] Z.dZ.J[P] C.this.I[A1]
+ C.this.I[T4] Z.dZ.J[A2] C.this.I[A2]
+ C.this.I[T4] Z.dZ.J[P] C.this.I[P]
+ C.this.J[T3] Z.dZ.J[A2] C.this.J[A1]
+ C.this.J[T3] Z.dZ.J[P] C.this.J[A1]
+ C.this.J[T4] Z.dZ.J[A2] C.this.J[A2]
+ C.this.J[T4] Z.dZ.J[P] C.this.J[P]
C[List[T3]]#I[Int] Z.dZ.J[A2] C[List[A1]]#I[Int]
C[List[T3]]#I[Int] Z.dZ.J[P] C[List[A1]]#I[Int]
C[List[T3]]#I[List[Int]] Z.dZ.J[A2] C[List[A1]]#I[List[Int]]
diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala
index 19feb45101..ea96c6fba7 100644
--- a/test/files/run/compiler-asSeenFrom.scala
+++ b/test/files/run/compiler-asSeenFrom.scala
@@ -1,6 +1,56 @@
+/*
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
import scala.tools.nsc._
-import scala.tools.partest.CompilerTest
+import scala.tools.partest.DirectTest
import scala.collection.{ mutable, immutable, generic }
+import scala.language.{postfixOps, implicitConversions}
+import scala.reflect.runtime.{universe => ru}
+
+// necessary to avoid bincompat with scala-partest compiled against the old compiler
+abstract class CompilerTest extends DirectTest {
+ def check(source: String, unit: global.CompilationUnit): Unit
+
+ lazy val global: Global = newCompiler()
+ lazy val units: List[global.CompilationUnit] = compilationUnits(global)(sources: _ *)
+ import global._
+ import definitions.{ compilerTypeFromTag }
+
+ override def extraSettings = "-feature -usejavacp -d " + testOutput.path
+
+ def show() = (sources, units).zipped foreach check
+
+ // Override at least one of these...
+ def code = ""
+ def sources: List[String] = List(code)
+
+ // Utility functions
+ class MkType(sym: Symbol) {
+ def apply[M](implicit t: ru.TypeTag[M]): Type =
+ if (sym eq NoSymbol) NoType
+ else appliedType(sym, compilerTypeFromTag(t))
+ }
+ implicit def mkMkType(sym: Symbol) = new MkType(sym)
+
+ def allMembers(root: Symbol): List[Symbol] = {
+ def loop(seen: Set[Symbol], roots: List[Symbol]): List[Symbol] = {
+ val latest = roots flatMap (_.info.members) filterNot (seen contains _)
+ if (latest.isEmpty) seen.toList.sortWith(_ isLess _)
+ else loop(seen ++ latest, latest)
+ }
+ loop(Set(), List(root))
+ }
+
+ class SymsInPackage(pkgName: String) {
+ def pkg = rootMirror.getPackage(TermName(pkgName))
+ def classes = allMembers(pkg) filter (_.isClass)
+ def modules = allMembers(pkg) filter (_.isModule)
+ def symbols = classes ++ terms filterNot (_ eq NoSymbol)
+ def terms = allMembers(pkg) filter (s => s.isTerm && !s.isConstructor)
+ def tparams = classes flatMap (_.info.typeParams)
+ def tpes = symbols map (_.tpe) distinct
+ }
+}
/** It's too messy but it's better than not having it.
*/
@@ -107,7 +157,7 @@ package ll {
def check(source: String, unit: global.CompilationUnit) = {
import syms._
- afterTyper {
+ exitingTyper {
val typeArgs = List[Type](IntClass.tpe, ListClass[Int]) ++ tparams.map(_.tpe)
permute(typeArgs) foreach println
}
@@ -117,6 +167,5 @@ package ll {
println(sigs.mkString(x + " { // after " + ph + "\n ", "\n ", "\n}\n"))
}
}
- true
}
}
diff --git a/test/files/run/concat-two-strings.scala b/test/files/run/concat-two-strings.scala
index ad796fe0ee..c8881aa146 100644
--- a/test/files/run/concat-two-strings.scala
+++ b/test/files/run/concat-two-strings.scala
@@ -8,7 +8,7 @@ object Test {
def f4(x: List[Int]) = "" + x
def f5(x: Any) = "" + x
def f6(x: AnyVal) = "" + x
-
+
def main(args: Array[String]): Unit = {
List(f1("a"), f2(5), f3(null), f3(Array('a')), f4(List(1)), f5(null), f6(55d)) mkString ""
}
diff --git a/test/files/run/concurrent-map-conversions.scala b/test/files/run/concurrent-map-conversions.scala
index 0350b69642..d23d5bbbe4 100644
--- a/test/files/run/concurrent-map-conversions.scala
+++ b/test/files/run/concurrent-map-conversions.scala
@@ -4,33 +4,33 @@
object Test {
-
+
def main(args: Array[String]) {
testConversions()
testConverters()
}
-
+
def needPackageConcurrentMap(map: collection.concurrent.Map[Int, Int]) {
}
def needJavaConcurrent(map: java.util.concurrent.ConcurrentMap[Int, Int]) {
}
-
+
def testConversions() {
import collection.JavaConversions._
val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int]
val ctrie = new collection.concurrent.TrieMap[Int, Int]
-
+
needPackageConcurrentMap(skiplist)
needJavaConcurrent(ctrie)
}
-
+
def testConverters() {
import collection.JavaConverters._
val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int]
val ctrie = new collection.concurrent.TrieMap[Int, Int]
-
+
needPackageConcurrentMap(skiplist.asScala)
needJavaConcurrent(ctrie.asJava)
}
-
+
}
diff --git a/test/files/run/concurrent-stream.scala b/test/files/run/concurrent-stream.scala
index 42c695964e..9d5ba0428e 100644
--- a/test/files/run/concurrent-stream.scala
+++ b/test/files/run/concurrent-stream.scala
@@ -1,32 +1,33 @@
// test concurrent calls to Stream.tail
+@deprecated("Suppress warnings", since="2.11")
object Test {
-def slowRange(from: Int, until: Int, cons: (Int, => Stream[Int]) => Stream[Int]): Stream[Int] = {
- var current = from
- def next: Stream[Int] = {
- Thread.sleep(100)
- if (current >= until) Stream.empty
- else {
- val stream = cons(current, next)
- current += 1
- stream
+ def slowRange(from: Int, until: Int, cons: (Int, => Stream[Int]) => Stream[Int]): Stream[Int] = {
+ var current = from
+ def next: Stream[Int] = {
+ Thread.sleep(100)
+ if (current >= until) Stream.empty
+ else {
+ val stream = cons(current, next)
+ current += 1
+ stream
+ }
}
+ next
}
- next
-}
-def testCons(cons: (Int, => Stream[Int]) => Stream[Int]): Unit = {
- import scala.actors.Actor._
+ def testCons(cons: (Int, => Stream[Int]) => Stream[Int]): Unit = {
+ import scala.actors.Actor._
- val stream = slowRange(0, 10, cons)
- val main = self
- actor { main ! stream.toList }
- actor { main ! stream.toList }
- val eval0 = receive { case list: List[Int] => list }
- val eval1 = receive { case list: List[Int] => list }
- println("Evaluation 0: " + eval0)
- println("Evaluation 1: " + eval1)
-}
+ val stream = slowRange(0, 10, cons)
+ val main = self
+ actor { main ! stream.toList }
+ actor { main ! stream.toList }
+ val eval0 = receive { case list: List[Int @unchecked] => list }
+ val eval1 = receive { case list: List[Int @unchecked] => list }
+ println("Evaluation 0: " + eval0)
+ println("Evaluation 1: " + eval1)
+ }
def main(args: Array[String]) {
println("Testing standard cons.")
diff --git a/test/files/run/constant-optimization.check b/test/files/run/constant-optimization.check
new file mode 100644
index 0000000000..957ffc5a87
--- /dev/null
+++ b/test/files/run/constant-optimization.check
@@ -0,0 +1,5 @@
+testBothReachable: good
+testOneReachable: good
+testAllReachable: good
+testOneUnreachable: good
+testDefaultUnreachable: good
diff --git a/test/files/run/constant-optimization.flags b/test/files/run/constant-optimization.flags
new file mode 100644
index 0000000000..c9b68d70dc
--- /dev/null
+++ b/test/files/run/constant-optimization.flags
@@ -0,0 +1 @@
+-optimise
diff --git a/test/files/run/constant-optimization.scala b/test/files/run/constant-optimization.scala
new file mode 100644
index 0000000000..5d13272f3b
--- /dev/null
+++ b/test/files/run/constant-optimization.scala
@@ -0,0 +1,61 @@
+object Test extends App {
+ def testBothReachable() {
+ val i = util.Random.nextInt
+ val x = if (i % 2 == 0) null else "good"
+ val y = if (x == null) "good" else x + ""
+ println(s"testBothReachable: $y")
+ }
+
+ def testOneReachable() {
+ val i = 1
+ val x = if (i != 1) null else "good"
+ val y = if (x == null) "good" else x + ""
+ println(s"testOneReachable: $y")
+ }
+
+ def testAllReachable() {
+ val i = util.Random.nextInt
+ val y = (i % 2) match {
+ case 0 => "good"
+ case 1 => "good"
+ case _ => "good"
+ }
+ println(s"testAllReachable: $y")
+ }
+
+ def testOneUnreachable() {
+ val i = util.Random.nextInt
+ val x = if (i % 2 == 0) {
+ 1
+ } else {
+ 2
+ }
+ val y = x match {
+ case 0 => "good"
+ case 1 => "good"
+ case _ => "good"
+ }
+ println(s"testOneUnreachable: $y")
+ }
+
+ def testDefaultUnreachable() {
+ val i = util.Random.nextInt
+ val x = if (i % 2 == 0) {
+ 1
+ } else {
+ 2
+ }
+ val y = x match {
+ case 1 => "good"
+ case 2 => "good"
+ case _ => "good"
+ }
+ println(s"testDefaultUnreachable: $y")
+ }
+
+ testBothReachable()
+ testOneReachable()
+ testAllReachable()
+ testOneUnreachable()
+ testDefaultUnreachable()
+}
diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check
index dfd8be5297..77bdf618e6 100644
--- a/test/files/run/constant-type.check
+++ b/test/files/run/constant-type.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> :power
** Power User mode enabled - BEEP WHIR GYVE **
** :phase has been set to 'typer'. **
@@ -13,18 +11,16 @@ scala> :power
scala> val s = transformedType(StringClass.toType).asInstanceOf[Type]
s: $r.intp.global.Type = String
-scala> { println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) }
+scala> { println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) }
Class[String](classOf[java.lang.String])
-scala> { afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) }
+scala> { exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) }
Class(classOf[java.lang.String])
-scala> { ConstantType(Constant(s)); println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); }
+scala> { ConstantType(Constant(s)); println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); }
Class[String](classOf[java.lang.String])
-scala> { ConstantType(Constant(s)); afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); }
+scala> { ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); }
Class(classOf[java.lang.String])
scala>
-
-scala>
diff --git a/test/files/run/constant-type.scala b/test/files/run/constant-type.scala
index 84539e2895..373746af4a 100644
--- a/test/files/run/constant-type.scala
+++ b/test/files/run/constant-type.scala
@@ -9,9 +9,9 @@ object Test extends ReplTest {
def code = """
:power
val s = transformedType(StringClass.toType).asInstanceOf[Type]
-{ println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) }
-{ afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) }
-{ ConstantType(Constant(s)); println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); }
-{ ConstantType(Constant(s)); afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); }
+{ println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) }
+{ exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) }
+{ ConstantType(Constant(s)); println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); }
+{ ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); }
"""
}
diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check
index 85c4f41872..9a106785a1 100644
--- a/test/files/run/constrained-types.check
+++ b/test/files/run/constrained-types.check
@@ -1,10 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
-scala>
-
scala> class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint
defined class Annot
@@ -14,7 +10,7 @@ scala> class A {
val x = "hello"
val y: Int @Annot(x) = 10
override def toString = "an A"
-}
+}
defined class A
scala>
@@ -22,7 +18,7 @@ scala>
scala> val a = new A
a: A = an A
-scala> val y = a.y // should rewrite "this.x" to "a.x"
+scala> val y = a.y // should rewrite "this.x" to "a.x"
y: Int @Annot(a.x) = 10
scala> var a2 = new A
@@ -37,7 +33,7 @@ scala> object Stuff {
val x = "hello"
val y : Int @Annot(x) = 10
}
-defined module Stuff
+defined object Stuff
scala>
@@ -127,7 +123,7 @@ defined class rep
scala>
scala> object A { val x = "hello" : String @ rep }
-defined module A
+defined object A
warning: previously defined class A is not a companion to object A.
Companions must be defined together; you may wish to use :paste mode for this.
@@ -142,17 +138,14 @@ scala> val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
<console>:8: error: not found: value e
val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
^
-
-scala>
-
-scala> class Where(condition: Boolean) extends annotation.Annotation
-defined class Where
-
-scala>
-
-scala> val x : Int @Where(self > 0 && self < 100) = 3
-x: Int @Where(self.>(0).&&(self.<(100))) = 3
-
-scala>
+<console>:8: error: not found: value f
+ val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
+ ^
+<console>:8: error: not found: value g
+ val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
+ ^
+<console>:8: error: not found: value h
+ val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
+ ^
scala>
diff --git a/test/files/run/constrained-types.scala b/test/files/run/constrained-types.scala
index 38ae076c06..7ec8f93d38 100644
--- a/test/files/run/constrained-types.scala
+++ b/test/files/run/constrained-types.scala
@@ -15,10 +15,10 @@ class A {
val x = "hello"
val y: Int @Annot(x) = 10
override def toString = "an A"
-}
+}
val a = new A
-val y = a.y // should rewrite "this.x" to "a.x"
+val y = a.y // should rewrite "this.x" to "a.x"
var a2 = new A
val y2 = a2.y // should drop the annotation
@@ -72,16 +72,10 @@ object A { val x = "hello" : String @ rep }
val y = a.x // should drop the annotation
val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
-
-class Where(condition: Boolean) extends annotation.Annotation
-
-val x : Int @Where(self > 0 && self < 100) = 3
-
"""
override def transformSettings(s: Settings): Settings = {
s.Xexperimental.value = true
- s.selfInAnnots.value = true
s.deprecation.value = true
// when running that compiler, give it a scala-library to the classpath
s.classpath.value = sys.props("java.class.path")
diff --git a/test/files/run/contrib674.check b/test/files/run/contrib674.check
new file mode 100644
index 0000000000..78325c1810
--- /dev/null
+++ b/test/files/run/contrib674.check
@@ -0,0 +1,3 @@
+contrib674.scala:15: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 1
+ ^
diff --git a/test/files/run/contrib674.scala b/test/files/run/contrib674.scala
index f6b46d13c6..45c9871fc4 100644
--- a/test/files/run/contrib674.scala
+++ b/test/files/run/contrib674.scala
@@ -5,11 +5,11 @@ object Test extends App {
try {
1
} catch {
- case e =>
+ case e: Throwable =>
} finally {
try {
} catch {
- case e =>
+ case e: Throwable =>
}
}
1
diff --git a/test/files/run/ctor-order.scala b/test/files/run/ctor-order.scala
index a223ff77e8..5f5871691a 100644
--- a/test/files/run/ctor-order.scala
+++ b/test/files/run/ctor-order.scala
@@ -8,7 +8,7 @@ class Outer {
class X extends {
/* The constructor of X should set this.$outer to the outer instance
- * *before* calling the super constructors. This is tested by
+ * *before* calling the super constructors. This is tested by
* mixin M1, which tries to access global from the enclosing class.
*/
val outer = Outer.this
diff --git a/test/files/run/ctries-new/concmap.scala b/test/files/run/ctries-new/concmap.scala
index 3ec0256afb..76916564a7 100644
--- a/test/files/run/ctries-new/concmap.scala
+++ b/test/files/run/ctries-new/concmap.scala
@@ -5,17 +5,17 @@ import collection.concurrent.TrieMap
object ConcurrentMapSpec extends Spec {
-
+
val initsz = 500
val secondsz = 750
-
+
def test() {
"support put" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) assert(ct.put(new Wrap(i), i) == None)
for (i <- 0 until initsz) assert(ct.put(new Wrap(i), -i) == Some(i))
}
-
+
"support put if absent" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
@@ -24,7 +24,7 @@ object ConcurrentMapSpec extends Spec {
for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), -i) == None)
for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), i) == Some(-i))
}
-
+
"support remove if mapped to a specific value" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
@@ -32,7 +32,7 @@ object ConcurrentMapSpec extends Spec {
for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == true)
for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == false)
}
-
+
"support replace if mapped to a specific value" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
@@ -41,7 +41,7 @@ object ConcurrentMapSpec extends Spec {
for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i, -i - 2) == false)
for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i, 0) == false)
}
-
+
"support replace if present" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
@@ -49,17 +49,17 @@ object ConcurrentMapSpec extends Spec {
for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i) == Some(-i))
for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i) == None)
}
-
+
def assertEqual(a: Any, b: Any) = {
if (a != b) println(a, b)
assert(a == b)
}
-
+
"support replace if mapped to a specific value, using several threads" in {
val ct = new TrieMap[Wrap, Int]
val sz = 55000
for (i <- 0 until sz) ct.update(new Wrap(i), i)
-
+
class Updater(index: Int, offs: Int) extends Thread {
override def run() {
var repeats = 0
@@ -74,24 +74,24 @@ object ConcurrentMapSpec extends Spec {
//println("Thread %d repeats: %d".format(index, repeats))
}
}
-
+
val threads = for (i <- 0 until 16) yield new Updater(i, sz / 32 * i)
threads.foreach(_.start())
threads.foreach(_.join())
-
+
for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), i)
-
+
val threads2 = for (i <- 0 until 15) yield new Updater(i, sz / 32 * i)
threads2.foreach(_.start())
threads2.foreach(_.join())
-
+
for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), -i)
}
-
+
"support put if absent, several threads" in {
val ct = new TrieMap[Wrap, Int]
val sz = 110000
-
+
class Updater(offs: Int) extends Thread {
override def run() {
for (i <- 0 until sz) {
@@ -101,19 +101,19 @@ object ConcurrentMapSpec extends Spec {
}
}
}
-
+
val threads = for (i <- 0 until 16) yield new Updater(sz / 32 * i)
threads.foreach(_.start())
threads.foreach(_.join())
-
+
for (i <- 0 until sz) assert(ct(new Wrap(i)) == i)
}
-
+
"support remove if mapped to a specific value, several threads" in {
val ct = new TrieMap[Wrap, Int]
val sz = 55000
for (i <- 0 until sz) ct.update(new Wrap(i), i)
-
+
class Remover(offs: Int) extends Thread {
override def run() {
for (i <- 0 until sz) {
@@ -123,19 +123,19 @@ object ConcurrentMapSpec extends Spec {
}
}
}
-
+
val threads = for (i <- 0 until 16) yield new Remover(sz / 32 * i)
threads.foreach(_.start())
threads.foreach(_.join())
-
+
for (i <- 0 until sz) assert(ct.get(new Wrap(i)) == None)
}
-
+
"have all or none of the elements depending on the oddity" in {
val ct = new TrieMap[Wrap, Int]
val sz = 65000
for (i <- 0 until sz) ct(new Wrap(i)) = i
-
+
class Modifier(index: Int, offs: Int) extends Thread {
override def run() {
for (j <- 0 until sz) {
@@ -151,38 +151,38 @@ object ConcurrentMapSpec extends Spec {
}
}
}
-
+
def modify(n: Int) = {
val threads = for (i <- 0 until n) yield new Modifier(i, sz / n * i)
threads.foreach(_.start())
threads.foreach(_.join())
}
-
+
modify(16)
for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), Some(i))
modify(15)
for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), None)
}
-
+
"compute size correctly" in {
val ct = new TrieMap[Wrap, Int]
val sz = 36450
for (i <- 0 until sz) ct(new Wrap(i)) = i
-
+
assertEqual(ct.size, sz)
assertEqual(ct.size, sz)
}
-
+
"compute size correctly in parallel" in {
val ct = new TrieMap[Wrap, Int]
val sz = 36450
for (i <- 0 until sz) ct(new Wrap(i)) = i
val pct = ct.par
-
+
assertEqual(pct.size, sz)
assertEqual(pct.size, sz)
}
-
+
}
-
+
}
diff --git a/test/files/run/ctries-new/iterator.scala b/test/files/run/ctries-new/iterator.scala
index b953a40e00..bb1175e61b 100644
--- a/test/files/run/ctries-new/iterator.scala
+++ b/test/files/run/ctries-new/iterator.scala
@@ -1,144 +1,134 @@
-
-
-
-
import collection._
import collection.concurrent.TrieMap
-
-
object IteratorSpec extends Spec {
-
+
def test() {
"work for an empty trie" in {
val ct = new TrieMap
val it = ct.iterator
-
+
it.hasNext shouldEqual (false)
evaluating { it.next() }.shouldProduce [NoSuchElementException]
}
-
+
def nonEmptyIteratorCheck(sz: Int) {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
-
+
val it = ct.iterator
val tracker = mutable.Map[Wrap, Int]()
for (i <- 0 until sz) {
assert(it.hasNext == true)
tracker += it.next
}
-
+
it.hasNext shouldEqual (false)
evaluating { it.next() }.shouldProduce [NoSuchElementException]
tracker.size shouldEqual (sz)
tracker shouldEqual (ct)
}
-
+
"work for a 1 element trie" in {
nonEmptyIteratorCheck(1)
}
-
+
"work for a 2 element trie" in {
nonEmptyIteratorCheck(2)
}
-
+
"work for a 3 element trie" in {
nonEmptyIteratorCheck(3)
}
-
+
"work for a 5 element trie" in {
nonEmptyIteratorCheck(5)
}
-
+
"work for a 10 element trie" in {
nonEmptyIteratorCheck(10)
}
-
+
"work for a 20 element trie" in {
nonEmptyIteratorCheck(20)
}
-
+
"work for a 50 element trie" in {
nonEmptyIteratorCheck(50)
}
-
+
"work for a 100 element trie" in {
nonEmptyIteratorCheck(100)
}
-
+
"work for a 1k element trie" in {
nonEmptyIteratorCheck(1000)
}
-
+
"work for a 5k element trie" in {
nonEmptyIteratorCheck(5000)
}
-
+
"work for a 75k element trie" in {
nonEmptyIteratorCheck(75000)
}
-
+
"work for a 250k element trie" in {
nonEmptyIteratorCheck(500000)
}
-
+
def nonEmptyCollideCheck(sz: Int) {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until sz) ct.put(new DumbHash(i), i)
-
+
val it = ct.iterator
val tracker = mutable.Map[DumbHash, Int]()
for (i <- 0 until sz) {
assert(it.hasNext == true)
tracker += it.next
}
-
+
it.hasNext shouldEqual (false)
evaluating { it.next() }.shouldProduce [NoSuchElementException]
tracker.size shouldEqual (sz)
tracker shouldEqual (ct)
}
-
+
"work for colliding hashcodes, 2 element trie" in {
nonEmptyCollideCheck(2)
}
-
+
"work for colliding hashcodes, 3 element trie" in {
nonEmptyCollideCheck(3)
}
-
+
"work for colliding hashcodes, 5 element trie" in {
nonEmptyCollideCheck(5)
}
-
+
"work for colliding hashcodes, 10 element trie" in {
nonEmptyCollideCheck(10)
}
-
+
"work for colliding hashcodes, 100 element trie" in {
nonEmptyCollideCheck(100)
}
-
+
"work for colliding hashcodes, 500 element trie" in {
nonEmptyCollideCheck(500)
}
-
+
"work for colliding hashcodes, 5k element trie" in {
nonEmptyCollideCheck(5000)
}
-
+
def assertEqual(a: Map[Wrap, Int], b: Map[Wrap, Int]) {
if (a != b) {
println(a.size + " vs " + b.size)
- // println(a)
- // println(b)
- // println(a.toSeq.sortBy((x: (Wrap, Int)) => x._1.i))
- // println(b.toSeq.sortBy((x: (Wrap, Int)) => x._1.i))
}
assert(a == b)
}
-
+
"be consistent when taken with concurrent modifications" in {
val sz = 25000
val W = 15
@@ -146,40 +136,40 @@ object IteratorSpec extends Spec {
val checks = 5
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
-
+
class Modifier extends Thread {
override def run() {
for (i <- 0 until sz) ct.putIfAbsent(new Wrap(i), i) match {
case Some(_) => ct.remove(new Wrap(i))
- case None =>
+ case None =>
}
}
}
-
+
def consistentIteration(ct: TrieMap[Wrap, Int], checks: Int) {
class Iter extends Thread {
override def run() {
val snap = ct.readOnlySnapshot()
val initial = mutable.Map[Wrap, Int]()
for (kv <- snap) initial += kv
-
+
for (i <- 0 until checks) {
assertEqual(snap.iterator.toMap, initial)
}
}
}
-
+
val iter = new Iter
iter.start()
iter.join()
}
-
+
val threads = for (_ <- 0 until W) yield new Modifier
threads.foreach(_.start())
for (_ <- 0 until S) consistentIteration(ct, checks)
threads.foreach(_.join())
}
-
+
"be consistent with a concurrent removal with a well defined order" in {
val sz = 150000
val sgroupsize = 10
@@ -187,17 +177,16 @@ object IteratorSpec extends Spec {
val removerslowdown = 50
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
-
+
class Remover extends Thread {
override def run() {
for (i <- 0 until sz) {
assert(ct.remove(new Wrap(i)) == Some(i))
for (i <- 0 until removerslowdown) ct.get(new Wrap(i)) // slow down, mate
}
- //println("done removing")
}
}
-
+
def consistentIteration(it: Iterator[(Wrap, Int)]) = {
class Iter extends Thread {
override def run() {
@@ -210,7 +199,7 @@ object IteratorSpec extends Spec {
}
new Iter
}
-
+
val remover = new Remover
remover.start()
for (_ <- 0 until sgroupnum) {
@@ -218,27 +207,25 @@ object IteratorSpec extends Spec {
iters.foreach(_.start())
iters.foreach(_.join())
}
- //println("done with iterators")
remover.join()
}
-
+
"be consistent with a concurrent insertion with a well defined order" in {
val sz = 150000
val sgroupsize = 10
val sgroupnum = 10
val inserterslowdown = 50
val ct = new TrieMap[Wrap, Int]
-
+
class Inserter extends Thread {
override def run() {
for (i <- 0 until sz) {
assert(ct.put(new Wrap(i), i) == None)
for (i <- 0 until inserterslowdown) ct.get(new Wrap(i)) // slow down, mate
}
- //println("done inserting")
}
}
-
+
def consistentIteration(it: Iterator[(Wrap, Int)]) = {
class Iter extends Thread {
override def run() {
@@ -251,7 +238,7 @@ object IteratorSpec extends Spec {
}
new Iter
}
-
+
val inserter = new Inserter
inserter.start()
for (_ <- 0 until sgroupnum) {
@@ -259,31 +246,30 @@ object IteratorSpec extends Spec {
iters.foreach(_.start())
iters.foreach(_.join())
}
- //println("done with iterators")
inserter.join()
}
-
+
"work on a yet unevaluated snapshot" in {
val sz = 50000
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.update(new Wrap(i), i)
-
+
val snap = ct.snapshot()
val it = snap.iterator
-
+
while (it.hasNext) it.next()
}
-
+
"be duplicated" in {
val sz = 50
val ct = collection.parallel.mutable.ParTrieMap((0 until sz) zip (0 until sz): _*)
val it = ct.splitter
for (_ <- 0 until (sz / 2)) it.next()
val dupit = it.dup
-
+
it.toList shouldEqual dupit.toList
}
-
+
}
-
+
}
diff --git a/test/files/run/ctries-new/lnode.scala b/test/files/run/ctries-new/lnode.scala
index 92a31088e5..4cc97050e5 100644
--- a/test/files/run/ctries-new/lnode.scala
+++ b/test/files/run/ctries-new/lnode.scala
@@ -5,23 +5,23 @@ import collection.concurrent.TrieMap
object LNodeSpec extends Spec {
-
+
val initsz = 1500
val secondsz = 1750
-
+
def test() {
"accept elements with the same hash codes" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
}
-
+
"lookup elements with the same hash codes" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == Some(i))
for (i <- initsz until secondsz) assert(ct.get(new DumbHash(i)) == None)
}
-
+
"remove elements with the same hash codes" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
@@ -31,7 +31,7 @@ object LNodeSpec extends Spec {
}
for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == None)
}
-
+
"put elements with the same hash codes if absent" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.put(new DumbHash(i), i)
@@ -40,7 +40,7 @@ object LNodeSpec extends Spec {
for (i <- initsz until secondsz) assert(ct.putIfAbsent(new DumbHash(i), i) == None)
for (i <- initsz until secondsz) assert(ct.lookup(new DumbHash(i)) == i)
}
-
+
"replace elements with the same hash codes" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None)
@@ -49,13 +49,13 @@ object LNodeSpec extends Spec {
for (i <- 0 until initsz) assert(ct.lookup(new DumbHash(i)) == -i)
for (i <- 0 until initsz) assert(ct.replace(new DumbHash(i), -i, i) == true)
}
-
+
"remove elements with the same hash codes if mapped to a specific value" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None)
for (i <- 0 until initsz) assert(ct.remove(new DumbHash(i), i) == true)
}
-
+
}
-
+
}
diff --git a/test/files/run/ctries-new/main.scala b/test/files/run/ctries-new/main.scala
index d7fe087e4d..34f3ec2ccf 100644
--- a/test/files/run/ctries-new/main.scala
+++ b/test/files/run/ctries-new/main.scala
@@ -21,6 +21,9 @@ object Test {
trait Spec {
+ implicit def implicitously = scala.language.implicitConversions
+ implicit def reflectively = scala.language.reflectiveCalls
+
implicit def str2ops(s: String) = new {
def in[U](body: =>U) {
// just execute body
@@ -37,11 +40,11 @@ trait Spec {
var produced = false
try body
catch {
- case e => if (e.getClass == implicitly[ClassTag[T]].runtimeClass) produced = true
+ case e: Throwable => 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-new/snapshot.scala b/test/files/run/ctries-new/snapshot.scala
index 5fe77d445b..57155d49c6 100644
--- a/test/files/run/ctries-new/snapshot.scala
+++ b/test/files/run/ctries-new/snapshot.scala
@@ -8,22 +8,22 @@ import collection.concurrent.TrieMap
object SnapshotSpec extends Spec {
-
+
def test() {
"support snapshots" in {
val ctn = new TrieMap
ctn.snapshot()
ctn.readOnlySnapshot()
-
+
val ct = new TrieMap[Int, Int]
for (i <- 0 until 100) ct.put(i, i)
ct.snapshot()
ct.readOnlySnapshot()
}
-
+
"empty 2 quiescent snapshots in isolation" in {
val sz = 4000
-
+
class Worker(trie: TrieMap[Wrap, Int]) extends Thread {
override def run() {
for (i <- 0 until sz) {
@@ -34,46 +34,46 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
val snapt = ct.snapshot()
-
+
val original = new Worker(ct)
val snapshot = new Worker(snapt)
original.start()
snapshot.start()
original.join()
snapshot.join()
-
+
for (i <- 0 until sz) {
assert(ct.get(new Wrap(i)) == None)
assert(snapt.get(new Wrap(i)) == None)
}
}
-
+
def consistentReadOnly(name: String, readonly: Map[Wrap, Int], sz: Int, N: Int) {
@volatile var e: Exception = null
-
+
// reads possible entries once and stores them
// then reads all these N more times to check if the
// state stayed the same
class Reader(trie: Map[Wrap, Int]) extends Thread {
setName("Reader " + name)
-
+
override def run() =
try check()
catch {
case ex: Exception => e = ex
}
-
+
def check() {
val initial = mutable.Map[Wrap, Int]()
for (i <- 0 until sz) trie.get(new Wrap(i)) match {
case Some(i) => initial.put(new Wrap(i), i)
case None => // do nothing
}
-
+
for (k <- 0 until N) {
for (i <- 0 until sz) {
val tres = trie.get(new Wrap(i))
@@ -84,21 +84,21 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
val reader = new Reader(readonly)
reader.start()
reader.join()
-
+
if (e ne null) {
e.printStackTrace()
throw e
}
}
-
+
// traverses the trie `rep` times and modifies each entry
class Modifier(trie: TrieMap[Wrap, Int], index: Int, rep: Int, sz: Int) extends Thread {
setName("Modifier %d".format(index))
-
+
override def run() {
for (k <- 0 until rep) {
for (i <- 0 until sz) trie.putIfAbsent(new Wrap(i), i) match {
@@ -108,85 +108,85 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
// removes all the elements from the trie
class Remover(trie: TrieMap[Wrap, Int], index: Int, totremovers: Int, sz: Int) extends Thread {
setName("Remover %d".format(index))
-
+
override def run() {
for (i <- 0 until sz) trie.remove(new Wrap((i + sz / totremovers * index) % sz))
}
}
-
+
"have a consistent quiescent read-only snapshot" in {
val sz = 10000
val N = 100
val W = 10
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val readonly = ct.readOnlySnapshot()
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
-
+
threads.foreach(_.start())
consistentReadOnly("qm", readonly, sz, N)
threads.foreach(_.join())
}
-
+
// now, we check non-quiescent snapshots, as these permit situations
// where a thread is caught in the middle of the update when a snapshot is taken
-
+
"have a consistent non-quiescent read-only snapshot, concurrent with removes only" in {
val sz = 1250
val W = 100
val S = 5000
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Remover(ct, i, W, sz)
-
+
threads.foreach(_.start())
for (i <- 0 until S) consistentReadOnly("non-qr", ct.readOnlySnapshot(), sz, 5)
threads.foreach(_.join())
}
-
+
"have a consistent non-quiescent read-only snapshot, concurrent with modifications" in {
val sz = 1000
val N = 7000
val W = 10
val S = 7000
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
-
+
threads.foreach(_.start())
for (i <- 0 until S) consistentReadOnly("non-qm", ct.readOnlySnapshot(), sz, 5)
threads.foreach(_.join())
}
-
+
def consistentNonReadOnly(name: String, trie: TrieMap[Wrap, Int], sz: Int, N: Int) {
@volatile var e: Exception = null
-
+
// reads possible entries once and stores them
// then reads all these N more times to check if the
// state stayed the same
class Worker extends Thread {
setName("Worker " + name)
-
+
override def run() =
try check()
catch {
case ex: Exception => e = ex
}
-
+
def check() {
val initial = mutable.Map[Wrap, Int]()
for (i <- 0 until sz) trie.get(new Wrap(i)) match {
case Some(i) => initial.put(new Wrap(i), i)
case None => // do nothing
}
-
+
for (k <- 0 until N) {
// modify
for ((key, value) <- initial) {
@@ -194,7 +194,7 @@ object SnapshotSpec extends Spec {
val newv = -oldv
trie.replace(key, oldv, newv)
}
-
+
// check
for (i <- 0 until sz) if (initial.contains(new Wrap(i))) {
val expected = if (k % 2 == 0) -i else i
@@ -206,27 +206,27 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
val worker = new Worker
worker.start()
worker.join()
-
+
if (e ne null) {
e.printStackTrace()
throw e
}
}
-
+
"have a consistent non-quiescent snapshot, concurrent with modifications" in {
val sz = 9000
val N = 1000
val W = 10
val S = 400
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
-
+
threads.foreach(_.start())
for (i <- 0 until S) {
consistentReadOnly("non-qm", ct.snapshot(), sz, 5)
@@ -234,7 +234,7 @@ object SnapshotSpec extends Spec {
}
threads.foreach(_.join())
}
-
+
"work when many concurrent snapshots are taken, concurrent with modifications" in {
val sz = 12000
val W = 10
@@ -243,7 +243,7 @@ object SnapshotSpec extends Spec {
val snaptimes = 600
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
-
+
class Snapshooter extends Thread {
setName("Snapshooter")
override def run() {
@@ -254,14 +254,14 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
val mods = for (i <- 0 until W) yield new Modifier(ct, i, modifytimes, sz)
val shooters = for (i <- 0 until S) yield new Snapshooter
val threads = mods ++ shooters
threads.foreach(_.start())
threads.foreach(_.join())
}
-
+
}
-
+
}
diff --git a/test/files/run/ctries-old/concmap.scala b/test/files/run/ctries-old/concmap.scala
index 3ec0256afb..affc6fe294 100644
--- a/test/files/run/ctries-old/concmap.scala
+++ b/test/files/run/ctries-old/concmap.scala
@@ -2,20 +2,21 @@
import collection.concurrent.TrieMap
+import Test.Spec
object ConcurrentMapSpec extends Spec {
-
+
val initsz = 500
val secondsz = 750
-
+
def test() {
"support put" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) assert(ct.put(new Wrap(i), i) == None)
for (i <- 0 until initsz) assert(ct.put(new Wrap(i), -i) == Some(i))
}
-
+
"support put if absent" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
@@ -24,7 +25,7 @@ object ConcurrentMapSpec extends Spec {
for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), -i) == None)
for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), i) == Some(-i))
}
-
+
"support remove if mapped to a specific value" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
@@ -32,7 +33,7 @@ object ConcurrentMapSpec extends Spec {
for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == true)
for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == false)
}
-
+
"support replace if mapped to a specific value" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
@@ -41,7 +42,7 @@ object ConcurrentMapSpec extends Spec {
for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i, -i - 2) == false)
for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i, 0) == false)
}
-
+
"support replace if present" in {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
@@ -49,17 +50,17 @@ object ConcurrentMapSpec extends Spec {
for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i) == Some(-i))
for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i) == None)
}
-
+
def assertEqual(a: Any, b: Any) = {
if (a != b) println(a, b)
assert(a == b)
}
-
+
"support replace if mapped to a specific value, using several threads" in {
val ct = new TrieMap[Wrap, Int]
val sz = 55000
for (i <- 0 until sz) ct.update(new Wrap(i), i)
-
+
class Updater(index: Int, offs: Int) extends Thread {
override def run() {
var repeats = 0
@@ -74,24 +75,24 @@ object ConcurrentMapSpec extends Spec {
//println("Thread %d repeats: %d".format(index, repeats))
}
}
-
+
val threads = for (i <- 0 until 16) yield new Updater(i, sz / 32 * i)
threads.foreach(_.start())
threads.foreach(_.join())
-
+
for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), i)
-
+
val threads2 = for (i <- 0 until 15) yield new Updater(i, sz / 32 * i)
threads2.foreach(_.start())
threads2.foreach(_.join())
-
+
for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), -i)
}
-
+
"support put if absent, several threads" in {
val ct = new TrieMap[Wrap, Int]
val sz = 110000
-
+
class Updater(offs: Int) extends Thread {
override def run() {
for (i <- 0 until sz) {
@@ -101,19 +102,19 @@ object ConcurrentMapSpec extends Spec {
}
}
}
-
+
val threads = for (i <- 0 until 16) yield new Updater(sz / 32 * i)
threads.foreach(_.start())
threads.foreach(_.join())
-
+
for (i <- 0 until sz) assert(ct(new Wrap(i)) == i)
}
-
+
"support remove if mapped to a specific value, several threads" in {
val ct = new TrieMap[Wrap, Int]
val sz = 55000
for (i <- 0 until sz) ct.update(new Wrap(i), i)
-
+
class Remover(offs: Int) extends Thread {
override def run() {
for (i <- 0 until sz) {
@@ -123,19 +124,19 @@ object ConcurrentMapSpec extends Spec {
}
}
}
-
+
val threads = for (i <- 0 until 16) yield new Remover(sz / 32 * i)
threads.foreach(_.start())
threads.foreach(_.join())
-
+
for (i <- 0 until sz) assert(ct.get(new Wrap(i)) == None)
}
-
+
"have all or none of the elements depending on the oddity" in {
val ct = new TrieMap[Wrap, Int]
val sz = 65000
for (i <- 0 until sz) ct(new Wrap(i)) = i
-
+
class Modifier(index: Int, offs: Int) extends Thread {
override def run() {
for (j <- 0 until sz) {
@@ -151,38 +152,38 @@ object ConcurrentMapSpec extends Spec {
}
}
}
-
+
def modify(n: Int) = {
val threads = for (i <- 0 until n) yield new Modifier(i, sz / n * i)
threads.foreach(_.start())
threads.foreach(_.join())
}
-
+
modify(16)
for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), Some(i))
modify(15)
for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), None)
}
-
+
"compute size correctly" in {
val ct = new TrieMap[Wrap, Int]
val sz = 36450
for (i <- 0 until sz) ct(new Wrap(i)) = i
-
+
assertEqual(ct.size, sz)
assertEqual(ct.size, sz)
}
-
+
"compute size correctly in parallel" in {
val ct = new TrieMap[Wrap, Int]
val sz = 36450
for (i <- 0 until sz) ct(new Wrap(i)) = i
val pct = ct.par
-
+
assertEqual(pct.size, sz)
assertEqual(pct.size, sz)
}
-
+
}
-
+
}
diff --git a/test/files/run/ctries-old/iterator.scala b/test/files/run/ctries-old/iterator.scala
index b953a40e00..127f6c9f06 100644
--- a/test/files/run/ctries-old/iterator.scala
+++ b/test/files/run/ctries-old/iterator.scala
@@ -5,129 +5,130 @@
import collection._
import collection.concurrent.TrieMap
+import Test.Spec
object IteratorSpec extends Spec {
-
+
def test() {
"work for an empty trie" in {
val ct = new TrieMap
val it = ct.iterator
-
+
it.hasNext shouldEqual (false)
evaluating { it.next() }.shouldProduce [NoSuchElementException]
}
-
+
def nonEmptyIteratorCheck(sz: Int) {
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
-
+
val it = ct.iterator
val tracker = mutable.Map[Wrap, Int]()
for (i <- 0 until sz) {
assert(it.hasNext == true)
tracker += it.next
}
-
+
it.hasNext shouldEqual (false)
evaluating { it.next() }.shouldProduce [NoSuchElementException]
tracker.size shouldEqual (sz)
tracker shouldEqual (ct)
}
-
+
"work for a 1 element trie" in {
nonEmptyIteratorCheck(1)
}
-
+
"work for a 2 element trie" in {
nonEmptyIteratorCheck(2)
}
-
+
"work for a 3 element trie" in {
nonEmptyIteratorCheck(3)
}
-
+
"work for a 5 element trie" in {
nonEmptyIteratorCheck(5)
}
-
+
"work for a 10 element trie" in {
nonEmptyIteratorCheck(10)
}
-
+
"work for a 20 element trie" in {
nonEmptyIteratorCheck(20)
}
-
+
"work for a 50 element trie" in {
nonEmptyIteratorCheck(50)
}
-
+
"work for a 100 element trie" in {
nonEmptyIteratorCheck(100)
}
-
+
"work for a 1k element trie" in {
nonEmptyIteratorCheck(1000)
}
-
+
"work for a 5k element trie" in {
nonEmptyIteratorCheck(5000)
}
-
+
"work for a 75k element trie" in {
nonEmptyIteratorCheck(75000)
}
-
+
"work for a 250k element trie" in {
nonEmptyIteratorCheck(500000)
}
-
+
def nonEmptyCollideCheck(sz: Int) {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until sz) ct.put(new DumbHash(i), i)
-
+
val it = ct.iterator
val tracker = mutable.Map[DumbHash, Int]()
for (i <- 0 until sz) {
assert(it.hasNext == true)
tracker += it.next
}
-
+
it.hasNext shouldEqual (false)
evaluating { it.next() }.shouldProduce [NoSuchElementException]
tracker.size shouldEqual (sz)
tracker shouldEqual (ct)
}
-
+
"work for colliding hashcodes, 2 element trie" in {
nonEmptyCollideCheck(2)
}
-
+
"work for colliding hashcodes, 3 element trie" in {
nonEmptyCollideCheck(3)
}
-
+
"work for colliding hashcodes, 5 element trie" in {
nonEmptyCollideCheck(5)
}
-
+
"work for colliding hashcodes, 10 element trie" in {
nonEmptyCollideCheck(10)
}
-
+
"work for colliding hashcodes, 100 element trie" in {
nonEmptyCollideCheck(100)
}
-
+
"work for colliding hashcodes, 500 element trie" in {
nonEmptyCollideCheck(500)
}
-
+
"work for colliding hashcodes, 5k element trie" in {
nonEmptyCollideCheck(5000)
}
-
+
def assertEqual(a: Map[Wrap, Int], b: Map[Wrap, Int]) {
if (a != b) {
println(a.size + " vs " + b.size)
@@ -138,7 +139,7 @@ object IteratorSpec extends Spec {
}
assert(a == b)
}
-
+
"be consistent when taken with concurrent modifications" in {
val sz = 25000
val W = 15
@@ -146,40 +147,40 @@ object IteratorSpec extends Spec {
val checks = 5
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
-
+
class Modifier extends Thread {
override def run() {
for (i <- 0 until sz) ct.putIfAbsent(new Wrap(i), i) match {
case Some(_) => ct.remove(new Wrap(i))
- case None =>
+ case None =>
}
}
}
-
+
def consistentIteration(ct: TrieMap[Wrap, Int], checks: Int) {
class Iter extends Thread {
override def run() {
val snap = ct.readOnlySnapshot()
val initial = mutable.Map[Wrap, Int]()
for (kv <- snap) initial += kv
-
+
for (i <- 0 until checks) {
assertEqual(snap.iterator.toMap, initial)
}
}
}
-
+
val iter = new Iter
iter.start()
iter.join()
}
-
+
val threads = for (_ <- 0 until W) yield new Modifier
threads.foreach(_.start())
for (_ <- 0 until S) consistentIteration(ct, checks)
threads.foreach(_.join())
}
-
+
"be consistent with a concurrent removal with a well defined order" in {
val sz = 150000
val sgroupsize = 10
@@ -187,7 +188,7 @@ object IteratorSpec extends Spec {
val removerslowdown = 50
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
-
+
class Remover extends Thread {
override def run() {
for (i <- 0 until sz) {
@@ -197,7 +198,7 @@ object IteratorSpec extends Spec {
//println("done removing")
}
}
-
+
def consistentIteration(it: Iterator[(Wrap, Int)]) = {
class Iter extends Thread {
override def run() {
@@ -210,7 +211,7 @@ object IteratorSpec extends Spec {
}
new Iter
}
-
+
val remover = new Remover
remover.start()
for (_ <- 0 until sgroupnum) {
@@ -221,14 +222,14 @@ object IteratorSpec extends Spec {
//println("done with iterators")
remover.join()
}
-
+
"be consistent with a concurrent insertion with a well defined order" in {
val sz = 150000
val sgroupsize = 10
val sgroupnum = 10
val inserterslowdown = 50
val ct = new TrieMap[Wrap, Int]
-
+
class Inserter extends Thread {
override def run() {
for (i <- 0 until sz) {
@@ -238,7 +239,7 @@ object IteratorSpec extends Spec {
//println("done inserting")
}
}
-
+
def consistentIteration(it: Iterator[(Wrap, Int)]) = {
class Iter extends Thread {
override def run() {
@@ -251,7 +252,7 @@ object IteratorSpec extends Spec {
}
new Iter
}
-
+
val inserter = new Inserter
inserter.start()
for (_ <- 0 until sgroupnum) {
@@ -262,28 +263,28 @@ object IteratorSpec extends Spec {
//println("done with iterators")
inserter.join()
}
-
+
"work on a yet unevaluated snapshot" in {
val sz = 50000
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.update(new Wrap(i), i)
-
+
val snap = ct.snapshot()
val it = snap.iterator
-
+
while (it.hasNext) it.next()
}
-
+
"be duplicated" in {
val sz = 50
val ct = collection.parallel.mutable.ParTrieMap((0 until sz) zip (0 until sz): _*)
val it = ct.splitter
for (_ <- 0 until (sz / 2)) it.next()
val dupit = it.dup
-
+
it.toList shouldEqual dupit.toList
}
-
+
}
-
+
}
diff --git a/test/files/run/ctries-old/lnode.scala b/test/files/run/ctries-old/lnode.scala
index 92a31088e5..f9eb9ce877 100644
--- a/test/files/run/ctries-old/lnode.scala
+++ b/test/files/run/ctries-old/lnode.scala
@@ -3,25 +3,26 @@
import collection.concurrent.TrieMap
+import Test.Spec
object LNodeSpec extends Spec {
-
+
val initsz = 1500
val secondsz = 1750
-
+
def test() {
"accept elements with the same hash codes" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
}
-
+
"lookup elements with the same hash codes" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == Some(i))
for (i <- initsz until secondsz) assert(ct.get(new DumbHash(i)) == None)
}
-
+
"remove elements with the same hash codes" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
@@ -31,7 +32,7 @@ object LNodeSpec extends Spec {
}
for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == None)
}
-
+
"put elements with the same hash codes if absent" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.put(new DumbHash(i), i)
@@ -40,7 +41,7 @@ object LNodeSpec extends Spec {
for (i <- initsz until secondsz) assert(ct.putIfAbsent(new DumbHash(i), i) == None)
for (i <- initsz until secondsz) assert(ct.lookup(new DumbHash(i)) == i)
}
-
+
"replace elements with the same hash codes" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None)
@@ -49,13 +50,13 @@ object LNodeSpec extends Spec {
for (i <- 0 until initsz) assert(ct.lookup(new DumbHash(i)) == -i)
for (i <- 0 until initsz) assert(ct.replace(new DumbHash(i), -i, i) == true)
}
-
+
"remove elements with the same hash codes if mapped to a specific value" in {
val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None)
for (i <- 0 until initsz) assert(ct.remove(new DumbHash(i), i) == true)
}
-
+
}
-
+
}
diff --git a/test/files/run/ctries-old/main.scala b/test/files/run/ctries-old/main.scala
index 78ba7f0db1..77161fed2f 100644
--- a/test/files/run/ctries-old/main.scala
+++ b/test/files/run/ctries-old/main.scala
@@ -5,6 +5,7 @@
+@deprecated("Suppress warnings", since="2.11")
object Test {
def main(args: Array[String]) {
@@ -14,11 +15,13 @@ object Test {
SnapshotSpec.test()
}
-}
trait Spec {
+ implicit def implicitously = scala.language.implicitConversions
+ implicit def reflectively = scala.language.reflectiveCalls
+
implicit def str2ops(s: String) = new {
def in[U](body: =>U) {
// just execute body
@@ -35,7 +38,7 @@ trait Spec {
var produced = false
try body
catch {
- case e => if (e.getClass == implicitly[ClassManifest[T]].erasure) produced = true
+ case e: Throwable => if (e.getClass == implicitly[ClassManifest[T]].runtimeClass) produced = true
} finally {
assert(produced, "Did not produce exception of type: " + implicitly[ClassManifest[T]])
}
@@ -43,3 +46,4 @@ trait Spec {
}
}
+}
diff --git a/test/files/run/ctries-old/snapshot.scala b/test/files/run/ctries-old/snapshot.scala
index 5fe77d445b..dfc2034e56 100644
--- a/test/files/run/ctries-old/snapshot.scala
+++ b/test/files/run/ctries-old/snapshot.scala
@@ -5,25 +5,26 @@
import collection._
import collection.concurrent.TrieMap
+import Test.Spec
object SnapshotSpec extends Spec {
-
+
def test() {
"support snapshots" in {
val ctn = new TrieMap
ctn.snapshot()
ctn.readOnlySnapshot()
-
+
val ct = new TrieMap[Int, Int]
for (i <- 0 until 100) ct.put(i, i)
ct.snapshot()
ct.readOnlySnapshot()
}
-
+
"empty 2 quiescent snapshots in isolation" in {
val sz = 4000
-
+
class Worker(trie: TrieMap[Wrap, Int]) extends Thread {
override def run() {
for (i <- 0 until sz) {
@@ -34,46 +35,46 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
val snapt = ct.snapshot()
-
+
val original = new Worker(ct)
val snapshot = new Worker(snapt)
original.start()
snapshot.start()
original.join()
snapshot.join()
-
+
for (i <- 0 until sz) {
assert(ct.get(new Wrap(i)) == None)
assert(snapt.get(new Wrap(i)) == None)
}
}
-
+
def consistentReadOnly(name: String, readonly: Map[Wrap, Int], sz: Int, N: Int) {
@volatile var e: Exception = null
-
+
// reads possible entries once and stores them
// then reads all these N more times to check if the
// state stayed the same
class Reader(trie: Map[Wrap, Int]) extends Thread {
setName("Reader " + name)
-
+
override def run() =
try check()
catch {
case ex: Exception => e = ex
}
-
+
def check() {
val initial = mutable.Map[Wrap, Int]()
for (i <- 0 until sz) trie.get(new Wrap(i)) match {
case Some(i) => initial.put(new Wrap(i), i)
case None => // do nothing
}
-
+
for (k <- 0 until N) {
for (i <- 0 until sz) {
val tres = trie.get(new Wrap(i))
@@ -84,21 +85,21 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
val reader = new Reader(readonly)
reader.start()
reader.join()
-
+
if (e ne null) {
e.printStackTrace()
throw e
}
}
-
+
// traverses the trie `rep` times and modifies each entry
class Modifier(trie: TrieMap[Wrap, Int], index: Int, rep: Int, sz: Int) extends Thread {
setName("Modifier %d".format(index))
-
+
override def run() {
for (k <- 0 until rep) {
for (i <- 0 until sz) trie.putIfAbsent(new Wrap(i), i) match {
@@ -108,85 +109,85 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
// removes all the elements from the trie
class Remover(trie: TrieMap[Wrap, Int], index: Int, totremovers: Int, sz: Int) extends Thread {
setName("Remover %d".format(index))
-
+
override def run() {
for (i <- 0 until sz) trie.remove(new Wrap((i + sz / totremovers * index) % sz))
}
}
-
+
"have a consistent quiescent read-only snapshot" in {
val sz = 10000
val N = 100
val W = 10
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val readonly = ct.readOnlySnapshot()
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
-
+
threads.foreach(_.start())
consistentReadOnly("qm", readonly, sz, N)
threads.foreach(_.join())
}
-
+
// now, we check non-quiescent snapshots, as these permit situations
// where a thread is caught in the middle of the update when a snapshot is taken
-
+
"have a consistent non-quiescent read-only snapshot, concurrent with removes only" in {
val sz = 1250
val W = 100
val S = 5000
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Remover(ct, i, W, sz)
-
+
threads.foreach(_.start())
for (i <- 0 until S) consistentReadOnly("non-qr", ct.readOnlySnapshot(), sz, 5)
threads.foreach(_.join())
}
-
+
"have a consistent non-quiescent read-only snapshot, concurrent with modifications" in {
val sz = 1000
val N = 7000
val W = 10
val S = 7000
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
-
+
threads.foreach(_.start())
for (i <- 0 until S) consistentReadOnly("non-qm", ct.readOnlySnapshot(), sz, 5)
threads.foreach(_.join())
}
-
+
def consistentNonReadOnly(name: String, trie: TrieMap[Wrap, Int], sz: Int, N: Int) {
@volatile var e: Exception = null
-
+
// reads possible entries once and stores them
// then reads all these N more times to check if the
// state stayed the same
class Worker extends Thread {
setName("Worker " + name)
-
+
override def run() =
try check()
catch {
case ex: Exception => e = ex
}
-
+
def check() {
val initial = mutable.Map[Wrap, Int]()
for (i <- 0 until sz) trie.get(new Wrap(i)) match {
case Some(i) => initial.put(new Wrap(i), i)
case None => // do nothing
}
-
+
for (k <- 0 until N) {
// modify
for ((key, value) <- initial) {
@@ -194,7 +195,7 @@ object SnapshotSpec extends Spec {
val newv = -oldv
trie.replace(key, oldv, newv)
}
-
+
// check
for (i <- 0 until sz) if (initial.contains(new Wrap(i))) {
val expected = if (k % 2 == 0) -i else i
@@ -206,27 +207,27 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
val worker = new Worker
worker.start()
worker.join()
-
+
if (e ne null) {
e.printStackTrace()
throw e
}
}
-
+
"have a consistent non-quiescent snapshot, concurrent with modifications" in {
val sz = 9000
val N = 1000
val W = 10
val S = 400
-
+
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
-
+
threads.foreach(_.start())
for (i <- 0 until S) {
consistentReadOnly("non-qm", ct.snapshot(), sz, 5)
@@ -234,7 +235,7 @@ object SnapshotSpec extends Spec {
}
threads.foreach(_.join())
}
-
+
"work when many concurrent snapshots are taken, concurrent with modifications" in {
val sz = 12000
val W = 10
@@ -243,7 +244,7 @@ object SnapshotSpec extends Spec {
val snaptimes = 600
val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
-
+
class Snapshooter extends Thread {
setName("Snapshooter")
override def run() {
@@ -254,14 +255,14 @@ object SnapshotSpec extends Spec {
}
}
}
-
+
val mods = for (i <- 0 until W) yield new Modifier(ct, i, modifytimes, sz)
val shooters = for (i <- 0 until S) yield new Snapshooter
val threads = mods ++ shooters
threads.foreach(_.start())
threads.foreach(_.join())
}
-
+
}
-
+
}
diff --git a/test/files/run/dead-code-elimination.scala b/test/files/run/dead-code-elimination.scala
index 1af17c936b..fd3f2a996a 100644
--- a/test/files/run/dead-code-elimination.scala
+++ b/test/files/run/dead-code-elimination.scala
@@ -1,9 +1,9 @@
-// This testcase is a snippet that did not compile correctly under
-// pre-release 2.10.x. The relevant discussion around it can be
+// This testcase is a snippet that did not compile correctly under
+// pre-release 2.10.x. The relevant discussion around it can be
// found at:
// https://groups.google.com/forum/?fromgroups#!topic/scala-internals/qcyTjk8euUI[1-25]
-//
+//
// The reason it did not compile is related to the fact that ICode
// ops did not correctly define the stack entries they consumed and
// the dead code elimination phase was unable to correctly reconstruct
@@ -12,7 +12,7 @@
// Originally, this did not compile, but I included it in the run
// tests because this was ASM-dependand and did not happen for GenJVM.
//
-// Thus, we run the code and force the loading of class B -- if the
+// Thus, we run the code and force the loading of class B -- if the
// bytecode is incorrect, it will fail the test.
final class A {
@@ -27,7 +27,7 @@ final class A {
object Test {
def main(args: Array[String]): Unit = {
- // force the loading of B
+ // force the loading of B
(new A).f
}
}
diff --git a/test/files/run/deeps.check b/test/files/run/deeps.check
new file mode 100644
index 0000000000..a68e474f62
--- /dev/null
+++ b/test/files/run/deeps.check
@@ -0,0 +1,87 @@
+testEquals1
+false
+false
+true
+
+testEquals2
+false
+false
+true
+
+testEquals3
+x=Array(1)
+y=Array(1)
+false
+false
+true
+
+x=Array(Array(1), Array(1))
+y=Array(Array(1), Array(1))
+false
+false
+true
+
+x=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1)))
+y=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1)))
+false
+false
+true
+
+testEquals4
+false
+false
+true
+false
+false
+true
+Array(true, false)
+Array(true, false)
+[true;false]
+true;false
+
+Array(Array(true, false), Array(true, false))
+Array(Array(true, false), Array(true, false))
+[Array(true, false);Array(true, false)]
+Array(true, false);Array(true, false)
+
+Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false)))
+Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false)))
+[Array(Array(true, false), Array(true, false));Array(Array(true, false), Array(true, false))]
+Array(Array(true, false), Array(true, false));Array(Array(true, false), Array(true, false))
+
+Array(1.0, 0.0)
+Array(1.0, 0.0)
+[1.0;0.0]
+1.0;0.0
+
+Array(Array(1.0, 0.0), Array(1.0, 0.0))
+Array(Array(1.0, 0.0), Array(1.0, 0.0))
+[Array(1.0, 0.0);Array(1.0, 0.0)]
+Array(1.0, 0.0);Array(1.0, 0.0)
+
+Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0)))
+Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0)))
+[Array(Array(1.0, 0.0), Array(1.0, 0.0));Array(Array(1.0, 0.0), Array(1.0, 0.0))]
+Array(Array(1.0, 0.0), Array(1.0, 0.0));Array(Array(1.0, 0.0), Array(1.0, 0.0))
+
+Array(a, b)
+Array(a, b)
+[a;b]
+a;b
+
+Array(Array(a, b), Array(a, b))
+Array(Array(a, b), Array(a, b))
+[Array(a, b);Array(a, b)]
+Array(a, b);Array(a, b)
+
+Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b)))
+Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b)))
+[Array(Array(a, b), Array(a, b));Array(Array(a, b), Array(a, b))]
+Array(Array(a, b), Array(a, b));Array(Array(a, b), Array(a, b))
+
+[Array(true, false); Array(false)]
+[Array(1, 2); Array(3)]
+[Array(1, 2); Array(3)]
+
+Array(boo, and, foo)
+Array(a)
diff --git a/test/files/run/deeps.scala b/test/files/run/deeps.scala
new file mode 100644
index 0000000000..6049cc6024
--- /dev/null
+++ b/test/files/run/deeps.scala
@@ -0,0 +1,114 @@
+//############################################################################
+// deepEquals / deep.toString
+//############################################################################
+
+//############################################################################
+// need to revisit array equqality
+object Test {
+
+ def testEquals1 {
+ println(Array(1) == Array(1))
+ println(Array(1) equals Array(1))
+ println(Array(1).deep == Array(1).deep)
+ println
+ }
+
+ def testEquals2 {
+ println(Array(Array(1), Array(2)) == Array(Array(1), Array(2)))
+ println(Array(Array(1), Array(2)) equals Array(Array(1), Array(2)))
+ println(Array(Array(1), Array(2)).deep equals Array(Array(1), Array(2)).deep)
+ println
+ }
+
+ def testEquals3 {
+ val a1 = Array(1)
+ val b1 = Array(1)
+ val a2 = Array(a1, b1)
+ val b2 = Array(a1, b1)
+ val a3 = Array(a2, b2)
+ val b3 = Array(a2, b2)
+ def test[T](x: Array[T], y: Array[T]) {
+ println("x=" + x.deep.toString)
+ println("y=" + y.deep.toString)
+ println(x == y)
+ println(x equals y)
+ println(x.deep == y.deep)
+ println
+ }
+ test(a1, b1)
+ test(a2, b2)
+ test(a3, b3)
+ }
+
+ def testEquals4 {
+ println("boo:and:foo".split(':') == "boo:and:foo".split(':'))
+ println("boo:and:foo".split(':') equals "boo:and:foo".split(':'))
+ println("boo:and:foo".split(':').deep == "boo:and:foo".split(':').deep)
+
+ val xs = new java.util.ArrayList[String](); xs.add("a")
+ val ys = new java.util.ArrayList[String](); ys.add("a")
+ println(xs.toArray == ys.toArray)
+ println(xs.toArray equals ys.toArray)
+ println(xs.toArray.deep == ys.toArray.deep)
+ }
+
+ def testToString1 {
+ def sweep(s: String) = (
+ s.replaceAll("D@[0-9a-fA-F]+", "D@0000000")
+ .replaceAll("Z@[0-9a-fA-F]+", "Z@0000000")
+ .replaceAll(";@[0-9a-fA-F]+", ";@0000000")
+ )
+ def test[T](a: Array[T]) {
+ println(sweep(a.deep.toString))
+ println(a.deep.toString)
+ println(a.deep.mkString("[", ";", "]"))
+ println(a.deep.mkString(";"))
+ println
+ }
+
+ val ba1 = Array(true, false)
+ val ba2 = Array(ba1, ba1)
+ val ba3 = Array(ba2, ba2)
+ test(ba1)
+ test(ba2)
+ test(ba3)
+
+ val da1 = Array(1.0d, 0.0d)
+ val da2 = Array(da1, da1)
+ val da3 = Array(da2, da2)
+ test(da1)
+ test(da2)
+ test(da3)
+
+ val sa1 = Array("a", "b")
+ val sa2 = Array(sa1, sa1)
+ val sa3 = Array(sa2, sa2)
+ test(sa1)
+ test(sa2)
+ test(sa3)
+ }
+
+ def testToString2 {
+ println(Array(Array(true, false), Array(false)).deep.mkString("[", "; ", "]"))
+ println(Array(Array('1', '2'), Array('3')).deep.mkString("[", "; ", "]"))
+ println(Array(Array(1, 2), Array(3)).deep.mkString("[", "; ", "]"))
+ println
+ }
+
+ def testToString3 {
+ println("boo:and:foo".split(':').deep.toString)
+
+ val xs = new java.util.ArrayList[String](); xs.add("a")
+ println(xs.toArray.deep.toString)
+ }
+
+ def main(args: Array[String]): Unit = {
+ println("testEquals1") ; testEquals1
+ println("testEquals2") ; testEquals2
+ println("testEquals3") ; testEquals3
+ println("testEquals4") ; testEquals4
+ testToString1
+ testToString2
+ testToString3
+ }
+}
diff --git a/test/files/run/delambdafy-dependent-on-param-subst-2.scala b/test/files/run/delambdafy-dependent-on-param-subst-2.scala
new file mode 100644
index 0000000000..7b6fc597e8
--- /dev/null
+++ b/test/files/run/delambdafy-dependent-on-param-subst-2.scala
@@ -0,0 +1,20 @@
+trait M[-X] {
+ def m(x: X): Boolean
+}
+
+class C
+class A { class C }
+
+object Test {
+ def main(args: Array[String]) {
+ val a = new A
+
+ // class O extends M[a.C] { def m(x: a.C) = true }
+ // (new O: M[Null]).m(null) // Okay
+
+ ((a: A) => {
+ class N extends M[a.C] { def m(x: a.C) = true }
+ new N: M[Null]
+ }).apply(a).m(null) // NPE, missing bridge
+ }
+}
diff --git a/test/files/run/delambdafy-dependent-on-param-subst.flags b/test/files/run/delambdafy-dependent-on-param-subst.flags
new file mode 100644
index 0000000000..2b27e19830
--- /dev/null
+++ b/test/files/run/delambdafy-dependent-on-param-subst.flags
@@ -0,0 +1 @@
+-Ydelambdafy:method \ No newline at end of file
diff --git a/test/files/run/delambdafy-dependent-on-param-subst.scala b/test/files/run/delambdafy-dependent-on-param-subst.scala
new file mode 100644
index 0000000000..7b6fc597e8
--- /dev/null
+++ b/test/files/run/delambdafy-dependent-on-param-subst.scala
@@ -0,0 +1,20 @@
+trait M[-X] {
+ def m(x: X): Boolean
+}
+
+class C
+class A { class C }
+
+object Test {
+ def main(args: Array[String]) {
+ val a = new A
+
+ // class O extends M[a.C] { def m(x: a.C) = true }
+ // (new O: M[Null]).m(null) // Okay
+
+ ((a: A) => {
+ class N extends M[a.C] { def m(x: a.C) = true }
+ new N: M[Null]
+ }).apply(a).m(null) // NPE, missing bridge
+ }
+}
diff --git a/test/files/run/delambdafy-nested-by-name.check b/test/files/run/delambdafy-nested-by-name.check
new file mode 100644
index 0000000000..94954abda4
--- /dev/null
+++ b/test/files/run/delambdafy-nested-by-name.check
@@ -0,0 +1,2 @@
+hello
+world
diff --git a/test/files/run/delambdafy-nested-by-name.scala b/test/files/run/delambdafy-nested-by-name.scala
new file mode 100644
index 0000000000..4498b3308d
--- /dev/null
+++ b/test/files/run/delambdafy-nested-by-name.scala
@@ -0,0 +1,11 @@
+// during development of delayed delambdafication I created a bug where calling a by-name method with a by-name argument that
+// itself contained a by-name argument would cause a class cast exception. That bug wasn't found in the existing test suite
+// so this test covers that case
+object Test {
+ def meth1(arg1: => String) = arg1
+ def meth2(arg2: => String) = meth1({println("hello"); arg2})
+
+ def main(args: Array[String]) {
+ println(meth2("world"))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/delambdafy-two-lambdas.check b/test/files/run/delambdafy-two-lambdas.check
new file mode 100644
index 0000000000..ed9ea404dd
--- /dev/null
+++ b/test/files/run/delambdafy-two-lambdas.check
@@ -0,0 +1,2 @@
+13
+24
diff --git a/test/files/run/delambdafy-two-lambdas.scala b/test/files/run/delambdafy-two-lambdas.scala
new file mode 100644
index 0000000000..decede74a4
--- /dev/null
+++ b/test/files/run/delambdafy-two-lambdas.scala
@@ -0,0 +1,12 @@
+/*
+ * Tests if two lambdas defined in the same class do not lead to
+ * name clashes.
+ */
+object Test {
+ def takeLambda(f: Int => Int ): Int = f(12)
+
+ def main(args: Array[String]): Unit = {
+ println(takeLambda(x => x+1))
+ println(takeLambda(x => x*2))
+ }
+}
diff --git a/test/files/run/delambdafy_t6028.check b/test/files/run/delambdafy_t6028.check
new file mode 100644
index 0000000000..92cfbaefb6
--- /dev/null
+++ b/test/files/run/delambdafy_t6028.check
@@ -0,0 +1,57 @@
+[[syntax trees at end of lambdalift]] // newSource1.scala
+package <empty> {
+ class T extends Object {
+ <paramaccessor> private[this] val classParam: Int = _;
+ def <init>(classParam: Int): T = {
+ T.super.<init>();
+ ()
+ };
+ private[this] val field: Int = 0;
+ <stable> <accessor> def field(): Int = T.this.field;
+ def foo(methodParam: Int): Function0 = {
+ val methodLocal: Int = 0;
+ {
+ (() => T.this.$anonfun$1(methodParam, methodLocal)).$asInstanceOf[Function0]()
+ }
+ };
+ def bar(barParam: Int): Object = {
+ @volatile var MethodLocalObject$module: runtime.VolatileObjectRef = scala.runtime.VolatileObjectRef.zero();
+ T.this.MethodLocalObject$1(barParam, MethodLocalObject$module)
+ };
+ def tryy(tryyParam: Int): Function0 = {
+ var tryyLocal: runtime.IntRef = scala.runtime.IntRef.create(0);
+ {
+ (() => T.this.$anonfun$2(tryyParam, tryyLocal)).$asInstanceOf[Function0]()
+ }
+ };
+ final <artifact> private[this] def $anonfun$1(methodParam$1: Int, methodLocal$1: Int): Int = T.this.classParam.+(T.this.field()).+(methodParam$1).+(methodLocal$1);
+ abstract trait MethodLocalTrait$1 extends Object {
+ <synthetic> <stable> <artifact> def $outer(): T
+ };
+ object MethodLocalObject$2 extends Object with T#MethodLocalTrait$1 {
+ def <init>($outer: T, barParam$1: Int): T#MethodLocalObject$2.type = {
+ MethodLocalObject$2.super.<init>();
+ MethodLocalObject$2.this.$asInstanceOf[T#MethodLocalTrait$1$class]()./*MethodLocalTrait$1$class*/$init$(barParam$1);
+ ()
+ };
+ <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _;
+ <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer;
+ <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer
+ };
+ final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = {
+ MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1);
+ MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]()
+ };
+ abstract trait MethodLocalTrait$1$class extends Object with T#MethodLocalTrait$1 {
+ def /*MethodLocalTrait$1$class*/$init$(barParam$1: Int): Unit = {
+ ()
+ };
+ scala.this.Predef.print(scala.Int.box(barParam$1))
+ };
+ final <artifact> private[this] def $anonfun$2(tryyParam$1: Int, tryyLocal$1: runtime.IntRef): Unit = try {
+ tryyLocal$1.elem = tryyParam$1
+ } finally ()
+ }
+}
+
+warning: there were 1 feature warning(s); re-run with -feature for details
diff --git a/test/files/run/delambdafy_t6028.scala b/test/files/run/delambdafy_t6028.scala
new file mode 100644
index 0000000000..0b7ef48c3d
--- /dev/null
+++ b/test/files/run/delambdafy_t6028.scala
@@ -0,0 +1,21 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Ydelambdafy:method -Xprint:lambdalift -d " + testOutput.path
+
+ override def code = """class T(classParam: Int) {
+ | val field: Int = 0
+ | def foo(methodParam: Int) = {val methodLocal = 0 ; () => classParam + field + methodParam + methodLocal }
+ | def bar(barParam: Int) = { trait MethodLocalTrait { print(barParam) }; object MethodLocalObject extends MethodLocalTrait; MethodLocalObject }
+ | def tryy(tryyParam: Int) = { var tryyLocal = 0; () => try { tryyLocal = tryyParam } finally () }
+ |}
+ |""".stripMargin.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/delambdafy_t6555.check b/test/files/run/delambdafy_t6555.check
new file mode 100644
index 0000000000..6b174c0d2a
--- /dev/null
+++ b/test/files/run/delambdafy_t6555.check
@@ -0,0 +1,15 @@
+[[syntax trees at end of specialize]] // newSource1.scala
+package <empty> {
+ class Foo extends Object {
+ def <init>(): Foo = {
+ Foo.super.<init>();
+ ()
+ };
+ private[this] val f: Int => Int = {
+ final <artifact> def $anonfun(param: Int): Int = param;
+ ((param: Int) => $anonfun(param))
+ };
+ <stable> <accessor> def f(): Int => Int = Foo.this.f
+ }
+}
+
diff --git a/test/files/run/delambdafy_t6555.scala b/test/files/run/delambdafy_t6555.scala
new file mode 100644
index 0000000000..a1dcfe790c
--- /dev/null
+++ b/test/files/run/delambdafy_t6555.scala
@@ -0,0 +1,15 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Xprint:specialize -Ydelambdafy:method -d " + testOutput.path
+
+ override def code = "class Foo { val f = (param: Int) => param } "
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/delambdafy_uncurry_byname_inline.check b/test/files/run/delambdafy_uncurry_byname_inline.check
new file mode 100644
index 0000000000..0dc69b379a
--- /dev/null
+++ b/test/files/run/delambdafy_uncurry_byname_inline.check
@@ -0,0 +1,21 @@
+[[syntax trees at end of uncurry]] // newSource1.scala
+package <empty> {
+ class Foo extends Object {
+ def <init>(): Foo = {
+ Foo.super.<init>();
+ ()
+ };
+ def bar(x: () => Int): Int = x.apply();
+ def foo(): Int = Foo.this.bar({
+ @SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction0[Int] with Serializable {
+ def <init>(): <$anon: () => Int> = {
+ $anonfun.super.<init>();
+ ()
+ };
+ final def apply(): Int = 1
+ };
+ (new <$anon: () => Int>(): () => Int)
+ })
+ }
+}
+
diff --git a/test/files/run/delambdafy_uncurry_byname_inline.scala b/test/files/run/delambdafy_uncurry_byname_inline.scala
new file mode 100644
index 0000000000..8f480fa804
--- /dev/null
+++ b/test/files/run/delambdafy_uncurry_byname_inline.scala
@@ -0,0 +1,20 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Xprint:uncurry -Ydelambdafy:inline -d " + testOutput.path
+
+ override def code = """class Foo {
+ | def bar(x: => Int) = x
+ |
+ | def foo = bar(1)
+ |}
+ |""".stripMargin.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/delambdafy_uncurry_byname_method.check b/test/files/run/delambdafy_uncurry_byname_method.check
new file mode 100644
index 0000000000..cd3edc7d6f
--- /dev/null
+++ b/test/files/run/delambdafy_uncurry_byname_method.check
@@ -0,0 +1,15 @@
+[[syntax trees at end of uncurry]] // newSource1.scala
+package <empty> {
+ class Foo extends Object {
+ def <init>(): Foo = {
+ Foo.super.<init>();
+ ()
+ };
+ def bar(x: () => Int): Int = x.apply();
+ def foo(): Int = Foo.this.bar({
+ final <artifact> def $anonfun(): Int = 1;
+ (() => $anonfun())
+ })
+ }
+}
+
diff --git a/test/files/run/delambdafy_uncurry_byname_method.scala b/test/files/run/delambdafy_uncurry_byname_method.scala
new file mode 100644
index 0000000000..1adeec8433
--- /dev/null
+++ b/test/files/run/delambdafy_uncurry_byname_method.scala
@@ -0,0 +1,20 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Xprint:uncurry -Ydelambdafy:method -Ystop-after:uncurry -d " + testOutput.path
+
+ override def code = """class Foo {
+ | def bar(x: => Int) = x
+ |
+ | def foo = bar(1)
+ |}
+ |""".stripMargin.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/delambdafy_uncurry_inline.check b/test/files/run/delambdafy_uncurry_inline.check
new file mode 100644
index 0000000000..e2b024b462
--- /dev/null
+++ b/test/files/run/delambdafy_uncurry_inline.check
@@ -0,0 +1,23 @@
+[[syntax trees at end of uncurry]] // newSource1.scala
+package <empty> {
+ class Foo extends Object {
+ def <init>(): Foo = {
+ Foo.super.<init>();
+ ()
+ };
+ def bar(): Unit = {
+ val f: Int => Int = {
+ @SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction1[Int,Int] with Serializable {
+ def <init>(): <$anon: Int => Int> = {
+ $anonfun.super.<init>();
+ ()
+ };
+ final def apply(x: Int): Int = x.+(1)
+ };
+ (new <$anon: Int => Int>(): Int => Int)
+ };
+ ()
+ }
+ }
+}
+
diff --git a/test/files/run/delambdafy_uncurry_inline.scala b/test/files/run/delambdafy_uncurry_inline.scala
new file mode 100644
index 0000000000..b42b65f5bb
--- /dev/null
+++ b/test/files/run/delambdafy_uncurry_inline.scala
@@ -0,0 +1,20 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Xprint:uncurry -Ydelambdafy:inline -d " + testOutput.path
+
+ override def code = """class Foo {
+ | def bar = {
+ | val f = {x: Int => x + 1}
+ | }
+ |}
+ |""".stripMargin.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/delambdafy_uncurry_method.check b/test/files/run/delambdafy_uncurry_method.check
new file mode 100644
index 0000000000..5ee3d174b3
--- /dev/null
+++ b/test/files/run/delambdafy_uncurry_method.check
@@ -0,0 +1,17 @@
+[[syntax trees at end of uncurry]] // newSource1.scala
+package <empty> {
+ class Foo extends Object {
+ def <init>(): Foo = {
+ Foo.super.<init>();
+ ()
+ };
+ def bar(): Unit = {
+ val f: Int => Int = {
+ final <artifact> def $anonfun(x: Int): Int = x.+(1);
+ ((x: Int) => $anonfun(x))
+ };
+ ()
+ }
+ }
+}
+
diff --git a/test/files/run/delambdafy_uncurry_method.scala b/test/files/run/delambdafy_uncurry_method.scala
new file mode 100644
index 0000000000..a988fb2ee7
--- /dev/null
+++ b/test/files/run/delambdafy_uncurry_method.scala
@@ -0,0 +1,20 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Xprint:uncurry -Ydelambdafy:method -Ystop-after:uncurry -d " + testOutput.path
+
+ override def code = """class Foo {
+ | def bar = {
+ | val f = {x: Int => x + 1}
+ | }
+ |}
+ |""".stripMargin.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/delay-bad.check b/test/files/run/delay-bad.check
index 9d9c828a03..5d8c5fa1d4 100644
--- a/test/files/run/delay-bad.check
+++ b/test/files/run/delay-bad.check
@@ -1,3 +1,10 @@
+delay-bad.scala:53: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ f(new C { 5 })
+ ^
+delay-bad.scala:73: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ f(new { val x = 5 } with E() { 5 })
+ ^
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
// new C { }
diff --git a/test/files/run/delay-good.check b/test/files/run/delay-good.check
index 8eb04c7cff..b4f6b04af7 100644
--- a/test/files/run/delay-good.check
+++ b/test/files/run/delay-good.check
@@ -1,3 +1,9 @@
+delay-good.scala:53: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ f(new C { 5 })
+ ^
+delay-good.scala:73: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ f(new { val x = 5 } with E() { 5 })
+ ^
// new C { }
diff --git a/test/files/run/deprecate-early-type-defs.check b/test/files/run/deprecate-early-type-defs.check
new file mode 100644
index 0000000000..1ee01df13e
--- /dev/null
+++ b/test/files/run/deprecate-early-type-defs.check
@@ -0,0 +1,3 @@
+deprecate-early-type-defs.scala:1: warning: early type members are deprecated. Move them to the regular body: the semantics are the same.
+object Test extends { type T = Int } with App
+ ^
diff --git a/test/files/run/deprecate-early-type-defs.flags b/test/files/run/deprecate-early-type-defs.flags
new file mode 100644
index 0000000000..c36e713ab8
--- /dev/null
+++ b/test/files/run/deprecate-early-type-defs.flags
@@ -0,0 +1 @@
+-deprecation \ No newline at end of file
diff --git a/test/files/run/deprecate-early-type-defs.scala b/test/files/run/deprecate-early-type-defs.scala
new file mode 100644
index 0000000000..99e42166f2
--- /dev/null
+++ b/test/files/run/deprecate-early-type-defs.scala
@@ -0,0 +1 @@
+object Test extends { type T = Int } with App \ No newline at end of file
diff --git a/test/files/run/distinct.scala b/test/files/run/distinct.scala
index 09e5a0734a..0b8971e8a9 100644
--- a/test/files/run/distinct.scala
+++ b/test/files/run/distinct.scala
@@ -3,9 +3,9 @@
*/
object Test {
val alphabet = 'a' to 'z' mkString ""
- val alphaList = 'a' to 'z' toList
+ val alphaList = ('a' to 'z').toList
def shuffled = util.Random.shuffle(alphaList)
-
+
def main(args: Array[String]): Unit = {
val longList = alphaList ++ (1 to 9 flatMap (_ => shuffled))
val result = longList.distinct mkString ""
diff --git a/test/files/run/duration-coarsest.scala b/test/files/run/duration-coarsest.scala
new file mode 100644
index 0000000000..51cb79287a
--- /dev/null
+++ b/test/files/run/duration-coarsest.scala
@@ -0,0 +1,28 @@
+import scala.concurrent.duration._
+import scala.language.postfixOps
+
+object Test extends App {
+ List(
+ (60 minutes, 1 hour),
+ (2000 millis, 2 seconds),
+ (2000 micros, 2 millis),
+ (2000 nanos, 2 micros),
+ (2000000 nanos, 2 millis),
+ (48 hours, 2 days),
+ (5 seconds, 5 seconds),
+ (1 second, 1 second)
+ ) foreach {
+ case (x, expected) =>
+ val actual = x.toCoarsest
+ assert(actual.unit == expected.unit, s"$actual, $expected")
+ assert(actual.length == expected.length, s"$actual, $expected")
+ }
+
+ List(
+ 45 minutes,
+ 500 millis,
+ 1500 millis,
+ 23 hours,
+ 40 days
+ ) foreach (x => assert(x == x.toCoarsest, x))
+} \ No newline at end of file
diff --git a/test/files/run/dynamic-applyDynamic.check b/test/files/run/dynamic-applyDynamic.check
index 89a0d55282..ae6996f8fc 100644
--- a/test/files/run/dynamic-applyDynamic.check
+++ b/test/files/run/dynamic-applyDynamic.check
@@ -1,8 +1,8 @@
[[syntax trees at end of typer]] // newSource1.scala
[0:67]package [0:0]<empty> {
[0:67]object X extends [9:67][67]scala.AnyRef {
- [9]def <init>(): [9]X.type = [9]{
- [9][9][9]X.super.<init>();
+ [67]def <init>(): [9]X.type = [67]{
+ [67][67][67]X.super.<init>();
[9]()
};
[17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D();
diff --git a/test/files/run/dynamic-applyDynamicNamed.check b/test/files/run/dynamic-applyDynamicNamed.check
index 17fa496646..c4e050ba17 100644
--- a/test/files/run/dynamic-applyDynamicNamed.check
+++ b/test/files/run/dynamic-applyDynamicNamed.check
@@ -1,14 +1,14 @@
[[syntax trees at end of typer]] // newSource1.scala
[0:97]package [0:0]<empty> {
[0:97]object X extends [9:97][97]scala.AnyRef {
- [9]def <init>(): [9]X.type = [9]{
- [9][9][9]X.super.<init>();
+ [97]def <init>(): [9]X.type = [97]{
+ [97][97][97]X.super.<init>();
[9]()
};
[17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D();
[21]<stable> <accessor> def d: [21]D = [21][21]X.this.d;
- [37:70][37:38][37:38][37]X.this.d.applyDynamicNamed(<39:43>"meth")([44:55][44][44][44]scala.this.Tuple2.apply[[44]String, [44]Int]([44:50]"value1", [53:55]10), [57:69][57][57][57]scala.this.Tuple2.apply[[57]String, [57]Int]([57:63]"value2", [66:69]100));
- [77:91]<77:78><77:78>[77]X.this.d.applyDynamicNamed(<77:78>"apply")([79:90][79][79][79]scala.this.Tuple2.apply[[79]String, [79]Int]([79:85]"value1", [88:90]10))
+ [37:70][37:38][37:38][37]X.this.d.applyDynamicNamed(<39:43>"meth")([44:55][44][44]scala.Tuple2.apply[[44]String, [44]Int]([44:50]"value1", [53:55]10), [57:69][57][57]scala.Tuple2.apply[[57]String, [57]Int]([57:63]"value2", [66:69]100));
+ [77:91]<77:78><77:78>[77]X.this.d.applyDynamicNamed(<77:78>"apply")([79:90][79][79]scala.Tuple2.apply[[79]String, [79]Int]([79:85]"value1", [88:90]10))
}
}
diff --git a/test/files/run/dynamic-selectDynamic.check b/test/files/run/dynamic-selectDynamic.check
index 7f95ed3d19..9635ca4e6f 100644
--- a/test/files/run/dynamic-selectDynamic.check
+++ b/test/files/run/dynamic-selectDynamic.check
@@ -1,8 +1,8 @@
[[syntax trees at end of typer]] // newSource1.scala
[0:50]package [0:0]<empty> {
[0:50]object X extends [9:50][50]scala.AnyRef {
- [9]def <init>(): [9]X.type = [9]{
- [9][9][9]X.super.<init>();
+ [50]def <init>(): [9]X.type = [50]{
+ [50][50][50]X.super.<init>();
[9]()
};
[17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D();
diff --git a/test/files/run/dynamic-updateDynamic.check b/test/files/run/dynamic-updateDynamic.check
index 3e21b7dfdc..154fea34cb 100644
--- a/test/files/run/dynamic-updateDynamic.check
+++ b/test/files/run/dynamic-updateDynamic.check
@@ -1,8 +1,8 @@
[[syntax trees at end of typer]] // newSource1.scala
[0:69]package [0:0]<empty> {
[0:69]object X extends [9:69][69]scala.AnyRef {
- [9]def <init>(): [9]X.type = [9]{
- [9][9][9]X.super.<init>();
+ [69]def <init>(): [9]X.type = [69]{
+ [69][69][69]X.super.<init>();
[9]()
};
[17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D();
diff --git a/test/files/run/elidable-noflags.scala b/test/files/run/elidable-noflags.scala
index 5192e34096..1b9c5118bb 100644
--- a/test/files/run/elidable-noflags.scala
+++ b/test/files/run/elidable-noflags.scala
@@ -9,7 +9,7 @@ object Test {
@elidable(100000) def f5() = println("Good for me, I was not elided.")
@elidable(OFF) def f6() = println("Good for me, I was not elided.")
@elidable(ALL) def f7() = println("ESPECIALLY good for me, I was not elided.")
-
+
def main(args: Array[String]): Unit = {
f1()
f2()
diff --git a/test/files/run/emptypf.scala b/test/files/run/emptypf.scala
index 8aa0906a1b..eb3e3e6380 100644
--- a/test/files/run/emptypf.scala
+++ b/test/files/run/emptypf.scala
@@ -5,10 +5,10 @@ object Test {
case s => s.length
}
}
-
+
def main(args: Array[String]): Unit = {
println(f("abc"))
- println(f("def"))
+ println(f("def"))
println(PartialFunction.empty[String, Int] isDefinedAt "abc")
}
}
diff --git a/test/files/run/enrich-gentraversable.scala b/test/files/run/enrich-gentraversable.scala
index 52eded55fd..36412e650e 100644
--- a/test/files/run/enrich-gentraversable.scala
+++ b/test/files/run/enrich-gentraversable.scala
@@ -1,3 +1,6 @@
+import scala.language.implicitConversions
+import scala.language.postfixOps
+
object Test extends App {
import scala.collection.{GenTraversableOnce,GenTraversableLike}
import scala.collection.generic._
@@ -10,22 +13,22 @@ object Test extends App {
}
implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableLike[Repr]): FilterMapImpl[fr.A,Repr] =
new FilterMapImpl[fr.A, Repr](fr.conversion(r))
-
+
val l = List(1, 2, 3, 4, 5)
val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None)
typed[List[Int]](fml)
println(fml)
-
+
val a = Array(1, 2, 3, 4, 5)
val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None)
typed[Array[Int]](fma)
println(fma.deep)
-
+
val s = "Hello World"
val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None)
typed[String](fms1)
println(fms1)
-
+
val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None)
typed[IndexedSeq[Int]](fms2)
println(fms2)
@@ -35,28 +38,28 @@ object Test extends App {
final def filterMap[B, That](f: A => Option[B])(implicit cbf: CanBuildFrom[Repr, B, That]): That = {
val b = cbf()
for(e <- r.seq) f(e) foreach (b +=)
-
+
b.result
}
}
implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableOnce[Repr]): FilterMapImpl[fr.A,Repr] =
new FilterMapImpl[fr.A, Repr](fr.conversion(r))
-
+
val l = List(1, 2, 3, 4, 5)
val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None)
typed[List[Int]](fml)
println(fml)
-
+
val a = Array(1, 2, 3, 4, 5)
val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None)
typed[Array[Int]](fma)
println(fma.deep)
-
+
val s = "Hello World"
val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None)
typed[String](fms1)
println(fms1)
-
+
val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None)
typed[IndexedSeq[Int]](fms2)
println(fms2)
diff --git a/test/files/run/enums.scala b/test/files/run/enums.scala
index 9cdeed2691..3aad7ec320 100644
--- a/test/files/run/enums.scala
+++ b/test/files/run/enums.scala
@@ -36,8 +36,11 @@ object Test2 {
object Test3 {
- object Direction extends Enumeration("North", "South", "East", "West") {
- val North, South, East, West = Value;
+ object Direction extends Enumeration {
+ val North = Value("North")
+ val South = Value("South")
+ val East = Value("East")
+ val West = Value("West")
}
def run: Int = {
@@ -48,8 +51,11 @@ object Test3 {
object Test4 {
- object Direction extends Enumeration("North", "South", "East", "West") {
- val North, South, East, West = Value;
+ object Direction extends Enumeration {
+ val North = Value("North")
+ val South = Value("South")
+ val East = Value("East")
+ val West = Value("West")
}
def run: Int = {
diff --git a/test/files/run/equality.scala b/test/files/run/equality.scala
index 68055fd012..ff59898821 100644
--- a/test/files/run/equality.scala
+++ b/test/files/run/equality.scala
@@ -2,7 +2,7 @@
object Test
{
import scala.runtime.ScalaRunTime.hash
-
+
def makeFromInt(x: Int) = List(
x.toByte, x.toShort, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x), BigDecimal(x)
) ::: (
@@ -11,26 +11,26 @@ object Test
def makeFromDouble(x: Double) = List(
x.toShort, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x.toInt), BigDecimal(x)
)
-
+
def main(args: Array[String]): Unit = {
var xs = makeFromInt(5)
for (x <- xs ; y <- xs) {
assert(x == y, x + " == " + y)
assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y))
}
-
+
xs = makeFromInt(-5)
for (x <- xs ; y <- xs) {
assert(x == y, x + " == " + y)
assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y))
}
-
+
xs = makeFromDouble(500.0)
for (x <- xs ; y <- xs) {
assert(x == y, x + " == " + y)
assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y))
}
-
+
// negatives
val bigLong = new java.util.concurrent.atomic.AtomicLong(Long.MaxValue)
assert(-1 != bigLong && bigLong != -1) // bigLong.intValue() == -1
diff --git a/test/files/run/eta-expand-star2.check b/test/files/run/eta-expand-star2.check
index ce01362503..cbf4781255 100644
--- a/test/files/run/eta-expand-star2.check
+++ b/test/files/run/eta-expand-star2.check
@@ -1 +1,2 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
hello
diff --git a/test/files/run/exceptions-2.check b/test/files/run/exceptions-2.check
index 9a3044cd4f..4f8244800a 100644
--- a/test/files/run/exceptions-2.check
+++ b/test/files/run/exceptions-2.check
@@ -1,3 +1,6 @@
+exceptions-2.scala:267: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ try { 1 } catch { case e: java.io.IOException => () }
+ ^
nested1:
Innermost finally
Outermost finally
diff --git a/test/files/run/exceptions-2.scala b/test/files/run/exceptions-2.scala
index d0312a49b2..8d755c3809 100644
--- a/test/files/run/exceptions-2.scala
+++ b/test/files/run/exceptions-2.scala
@@ -42,14 +42,14 @@ object NoExcep {
def method4 = try {
Console.println("..");
} catch {
- case _ => error("..");
+ case _: Throwable => sys.error("..");
}
}
object Test {
def nested1: Unit = try {
try {
- error("nnnnoooo");
+ sys.error("nnnnoooo");
} finally {
Console.println("Innermost finally");
}
@@ -59,7 +59,7 @@ object Test {
def nested2 = try {
try {
- error("nnnnoooo");
+ sys.error("nnnnoooo");
} finally {
Console.println("Innermost finally");
}
@@ -68,7 +68,7 @@ object Test {
Console.println("Outermost finally");
}
- def mixed =
+ def mixed =
try {
if (10 > 0)
throw Leaf(10);
@@ -107,7 +107,7 @@ object Test {
case Leaf(a) => Console.println(a);
}
} catch {
- case npe: NullPointerException =>
+ case npe: NullPointerException =>
Console.println("Caught an NPE");
}
@@ -134,74 +134,74 @@ object Test {
()
} finally {
try {
- error("a");
+ sys.error("a");
} catch {
- case _ => Console.println("Silently ignore exception in finally");
+ case _: Throwable => Console.println("Silently ignore exception in finally");
}
}
}
- def valInFinally: Unit =
- try {
+ def valInFinally: Unit =
+ try {
} finally {
val fin = "Abc";
Console.println(fin);
- };
+ }
- def tryAndValInFinally: Unit =
+ def tryAndValInFinally: Unit =
try {
} finally {
val fin = "Abc";
try {
Console.println(fin);
- } catch { case _ => () }
- };
+ } catch { case _: Throwable => () }
+ }
- def returnInBody: Unit = try {
+ def returnInBody: Unit = try {
try {
Console.println("Normal execution...");
- return
+ return
Console.println("non reachable code");
} finally {
Console.println("inner finally");
}
- } finally {
+ } finally {
Console.println("Outer finally");
}
- def returnInBodySynch: Unit = try {
+ def returnInBodySynch: Unit = try {
synchronized {
try {
Console.println("Synchronized normal execution...");
- return
+ return
Console.println("non reachable code");
} finally {
Console.println("inner finally");
}
}
- } finally {
+ } finally {
Console.println("Outer finally");
}
- def returnInBodyAndInFinally: Unit = try {
+ def returnInBodyAndInFinally: Unit = try {
try {
Console.println("Normal execution...");
- return
+ return
Console.println("non reachable code");
} finally {
Console.println("inner finally");
return
}
- } finally {
+ } finally {
Console.println("Outer finally");
return
}
- def returnInBodyAndInFinally2: Unit = try {
+ def returnInBodyAndInFinally2: Unit = try {
try {
Console.println("Normal execution...");
- return
+ return
Console.println("non reachable code");
} finally {
try {
@@ -211,7 +211,7 @@ object Test {
Console.println("finally inside finally");
}
}
- } finally {
+ } finally {
Console.println("Outer finally");
return
}
@@ -249,11 +249,11 @@ object Test {
def execute(f: => Unit) = try {
f;
} catch {
- case _ => ();
+ case _: Throwable => ()
}
- def returnWithFinallyClean: Int = try {
+ def returnWithFinallyClean: Int = try {
try {
Console.println("Normal execution...");
return 10
@@ -262,7 +262,7 @@ object Test {
} finally {
Console.println("inner finally");
}
- } finally {
+ } finally {
Console.println("Outer finally");
try { 1 } catch { case e: java.io.IOException => () }
}
@@ -294,7 +294,7 @@ object Test {
Console.println("mixed: ");
execute(mixed);
-
+
Console.println("withValue1:");
execute(withValue1);
@@ -322,7 +322,7 @@ object Test {
Console.println("NoExcep.method3:");
execute(NoExcep.method3);
-
+
Console.println("NoExcep.method4:");
execute(NoExcep.method4);
diff --git a/test/files/run/exceptions-nest.scala b/test/files/run/exceptions-nest.scala
index 841e6b1c67..432d600d13 100644
--- a/test/files/run/exceptions-nest.scala
+++ b/test/files/run/exceptions-nest.scala
@@ -5,9 +5,9 @@ object Test extends App {
println(test3)
println(test4)
println(test5)
- try { println(test6) } catch { case _ => println("OK") }
+ try { println(test6) } catch { case _: Throwable => println("OK") }
println(test7)
- try { println(test8) } catch { case _ => println("OK") }
+ try { println(test8) } catch { case _: Throwable => println("OK") }
println(test9)
println(test10)
println(test11)
@@ -19,7 +19,7 @@ object Test extends App {
x = 2
} catch {
case _: NullPointerException => x = 3
- case _ => x = 4
+ case _: Throwable => x = 4
}
x
}
@@ -31,12 +31,12 @@ object Test extends App {
try {
x = 21
} catch {
- case _ => x = 22
+ case _: Throwable => x = 22
}
x = 23
} catch {
case _: NullPointerException => x = 3
- case _ => x = 4
+ case _: Throwable => x = 4
}
x
}
@@ -44,10 +44,10 @@ object Test extends App {
def test3 = {
var x = 1
try {
- try{x = 2} catch { case _ => x = 4 }
+ try{x = 2} catch { case _: Throwable => x = 4 }
} catch {
case _: NullPointerException => x = 3
- case _ => x = 4
+ case _: Throwable => x = 4
}
x
}
@@ -58,7 +58,7 @@ object Test extends App {
x = 2
} catch {
case _: NullPointerException => x = 3
- case _ => x = 4
+ case _: Throwable => x = 4
}
try {
x = 5
@@ -73,8 +73,8 @@ object Test extends App {
try {
x = 2
} catch {
- case _: NullPointerException => try { x = 3 } catch { case f => throw f }
- case _ => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43
+ case _: NullPointerException => try { x = 3 } catch { case f: Throwable => throw f }
+ case _: Throwable => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43
}
x
}
@@ -87,7 +87,7 @@ object Test extends App {
} catch {
case e: NullPointerException =>
throw e
- case _ =>
+ case _: Throwable =>
x = 3
return 1000
} finally {
@@ -105,7 +105,7 @@ object Test extends App {
try {
x = 4
} catch {
- case _ => x = 5
+ case _: Throwable => x = 5
}
}
x
@@ -116,7 +116,7 @@ object Test extends App {
try {
throw new NullPointerException
} catch {
- case e => throw e
+ case e: Throwable => throw e
}
x
}
@@ -124,7 +124,7 @@ object Test extends App {
def test9 = {
try { "" match {
case s: String => 10
- }} catch { case _ => 20 }
+ }} catch { case _: Throwable => 20 }
}
var x10 = 1
@@ -135,7 +135,7 @@ object Test extends App {
def test11 {
try { () }
- catch { case e => () }
+ catch { case e: Throwable => () }
}
class E1 extends Exception
diff --git a/test/files/run/exceptions.scala b/test/files/run/exceptions.scala
index fc3566f85e..f0fe76946b 100644
--- a/test/files/run/exceptions.scala
+++ b/test/files/run/exceptions.scala
@@ -6,8 +6,8 @@
abstract class IntMap[A] {
def lookup(key: Int): A = this match {
- case Empty() => error("KO")
- case _ => error("ok")
+ case Empty() => sys.error("KO")
+ case _ => sys.error("ok")
}
}
@@ -32,7 +32,7 @@ object exceptions {
val value = try {
map.lookup(key)
} catch {
- case e => e.getMessage()
+ case e: Throwable => e.getMessage()
}
check("lookup(" + key + ")", value, "KO");
}
diff --git a/test/files/run/existential-rangepos.check b/test/files/run/existential-rangepos.check
new file mode 100644
index 0000000000..1212b60bae
--- /dev/null
+++ b/test/files/run/existential-rangepos.check
@@ -0,0 +1,13 @@
+[[syntax trees at end of patmat]] // newSource1.scala
+[0:76]package [0:0]<empty> {
+ [0:76]abstract class A[[17:18]T[17:18]] extends [20:76][76]scala.AnyRef {
+ [76]def <init>(): [20]A[T] = [76]{
+ [76][76][76]A.super.<init>();
+ [20]()
+ };
+ [24:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null;
+ [28]<stable> <accessor> def foo: [28]Set[_ <: T] = [28][28]A.this.foo;
+ [54:74]<stable> <accessor> def bar: [58]Set[_ <: T]
+ }
+}
+
diff --git a/test/files/run/existential-rangepos.scala b/test/files/run/existential-rangepos.scala
new file mode 100644
index 0000000000..7d2b0810d3
--- /dev/null
+++ b/test/files/run/existential-rangepos.scala
@@ -0,0 +1,13 @@
+import scala.tools.partest._
+
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp -Yrangepos -Xprint:patmat -Xprint-pos -d " + testOutput.path
+
+ override def code = """
+abstract class A[T] {
+ val foo: Set[_ <: T] = null
+ val bar: Set[_ <: T]
+}""".trim
+
+ override def show(): Unit = Console.withErr(System.out)(compile())
+}
diff --git a/test/files/run/existentials-in-compiler.check b/test/files/run/existentials-in-compiler.check
index 0d7a9298b4..b0d852865d 100644
--- a/test/files/run/existentials-in-compiler.check
+++ b/test/files/run/existentials-in-compiler.check
@@ -8,22 +8,22 @@ abstract trait BippyLike[A <: AnyRef, B <: List[A], This <: extest.BippyLike[A,B
extest.BippyLike[A,B,This] forSome { A <: AnyRef; B <: List[A]; This <: extest.BippyLike[A,B,This] with extest.Bippy[A,B] }
abstract trait Contra[-A >: AnyRef, -B] extends AnyRef
- extest.Contra[_ >: AnyRef, _]
+ extest.Contra[AnyRef, _]
abstract trait ContraLike[-A >: AnyRef, -B >: List[A]] extends AnyRef
extest.ContraLike[A,B] forSome { -A >: AnyRef; -B >: List[A] }
abstract trait Cov01[+A <: AnyRef, +B] extends AnyRef
- extest.Cov01[_ <: AnyRef, _]
+ extest.Cov01[AnyRef,Any]
abstract trait Cov02[+A <: AnyRef, B] extends AnyRef
- extest.Cov02[_ <: AnyRef, _]
+ extest.Cov02[AnyRef, _]
abstract trait Cov03[+A <: AnyRef, -B] extends AnyRef
- extest.Cov03[_ <: AnyRef, _]
+ extest.Cov03[AnyRef, _]
abstract trait Cov04[A <: AnyRef, +B] extends AnyRef
- extest.Cov04[_ <: AnyRef, _]
+ extest.Cov04[_ <: AnyRef, Any]
abstract trait Cov05[A <: AnyRef, B] extends AnyRef
extest.Cov05[_ <: AnyRef, _]
@@ -32,7 +32,7 @@ abstract trait Cov06[A <: AnyRef, -B] extends AnyRef
extest.Cov06[_ <: AnyRef, _]
abstract trait Cov07[-A <: AnyRef, +B] extends AnyRef
- extest.Cov07[_ <: AnyRef, _]
+ extest.Cov07[_ <: AnyRef, Any]
abstract trait Cov08[-A <: AnyRef, B] extends AnyRef
extest.Cov08[_ <: AnyRef, _]
@@ -41,16 +41,16 @@ abstract trait Cov09[-A <: AnyRef, -B] extends AnyRef
extest.Cov09[_ <: AnyRef, _]
abstract trait Cov11[+A <: AnyRef, +B <: List[_]] extends AnyRef
- extest.Cov11[_ <: AnyRef, _ <: List[_]]
+ extest.Cov11[AnyRef,List[_]]
abstract trait Cov12[+A <: AnyRef, B <: List[_]] extends AnyRef
- extest.Cov12[_ <: AnyRef, _ <: List[_]]
+ extest.Cov12[AnyRef, _ <: List[_]]
abstract trait Cov13[+A <: AnyRef, -B <: List[_]] extends AnyRef
- extest.Cov13[_ <: AnyRef, _ <: List[_]]
+ extest.Cov13[AnyRef, _ <: List[_]]
abstract trait Cov14[A <: AnyRef, +B <: List[_]] extends AnyRef
- extest.Cov14[_ <: AnyRef, _ <: List[_]]
+ extest.Cov14[_ <: AnyRef, List[_]]
abstract trait Cov15[A <: AnyRef, B <: List[_]] extends AnyRef
extest.Cov15[_ <: AnyRef, _ <: List[_]]
@@ -59,7 +59,7 @@ abstract trait Cov16[A <: AnyRef, -B <: List[_]] extends AnyRef
extest.Cov16[_ <: AnyRef, _ <: List[_]]
abstract trait Cov17[-A <: AnyRef, +B <: List[_]] extends AnyRef
- extest.Cov17[_ <: AnyRef, _ <: List[_]]
+ extest.Cov17[_ <: AnyRef, List[_]]
abstract trait Cov18[-A <: AnyRef, B <: List[_]] extends AnyRef
extest.Cov18[_ <: AnyRef, _ <: List[_]]
@@ -68,16 +68,16 @@ abstract trait Cov19[-A <: AnyRef, -B <: List[_]] extends AnyRef
extest.Cov19[_ <: AnyRef, _ <: List[_]]
abstract trait Cov21[+A, +B] extends AnyRef
- extest.Cov21[_, _]
+ extest.Cov21[Any,Any]
abstract trait Cov22[+A, B] extends AnyRef
- extest.Cov22[_, _]
+ extest.Cov22[Any, _]
abstract trait Cov23[+A, -B] extends AnyRef
- extest.Cov23[_, _]
+ extest.Cov23[Any, _]
abstract trait Cov24[A, +B] extends AnyRef
- extest.Cov24[_, _]
+ extest.Cov24[_, Any]
abstract trait Cov25[A, B] extends AnyRef
extest.Cov25[_, _]
@@ -86,7 +86,7 @@ abstract trait Cov26[A, -B] extends AnyRef
extest.Cov26[_, _]
abstract trait Cov27[-A, +B] extends AnyRef
- extest.Cov27[_, _]
+ extest.Cov27[_, Any]
abstract trait Cov28[-A, B] extends AnyRef
extest.Cov28[_, _]
@@ -122,16 +122,16 @@ abstract trait Cov39[-A, -B, C <: Tuple2[_, _]] extends AnyRef
extest.Cov39[_, _, _ <: Tuple2[_, _]]
abstract trait Cov41[+A >: Null, +B] extends AnyRef
- extest.Cov41[_ >: Null, _]
+ extest.Cov41[Any,Any]
abstract trait Cov42[+A >: Null, B] extends AnyRef
- extest.Cov42[_ >: Null, _]
+ extest.Cov42[Any, _]
abstract trait Cov43[+A >: Null, -B] extends AnyRef
- extest.Cov43[_ >: Null, _]
+ extest.Cov43[Any, _]
abstract trait Cov44[A >: Null, +B] extends AnyRef
- extest.Cov44[_ >: Null, _]
+ extest.Cov44[_ >: Null, Any]
abstract trait Cov45[A >: Null, B] extends AnyRef
extest.Cov45[_ >: Null, _]
@@ -140,7 +140,7 @@ abstract trait Cov46[A >: Null, -B] extends AnyRef
extest.Cov46[_ >: Null, _]
abstract trait Cov47[-A >: Null, +B] extends AnyRef
- extest.Cov47[_ >: Null, _]
+ extest.Cov47[_ >: Null, Any]
abstract trait Cov48[-A >: Null, B] extends AnyRef
extest.Cov48[_ >: Null, _]
@@ -149,7 +149,7 @@ abstract trait Cov49[-A >: Null, -B] extends AnyRef
extest.Cov49[_ >: Null, _]
abstract trait Covariant[+A <: AnyRef, +B] extends AnyRef
- extest.Covariant[_ <: AnyRef, _]
+ extest.Covariant[AnyRef,Any]
abstract trait CovariantLike[+A <: AnyRef, +B <: List[A], +This <: extest.CovariantLike[A,B,This] with extest.Covariant[A,B]] extends AnyRef
extest.CovariantLike[A,B,This] forSome { +A <: AnyRef; +B <: List[A]; +This <: extest.CovariantLike[A,B,This] with extest.Covariant[A,B] }
diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala
index c69d1217fd..d019d56b42 100644
--- a/test/files/run/existentials-in-compiler.scala
+++ b/test/files/run/existentials-in-compiler.scala
@@ -1,3 +1,6 @@
+/*
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
import scala.tools.nsc._
import scala.tools.partest.CompilerTest
import scala.collection.{ mutable, immutable, generic }
@@ -71,14 +74,13 @@ package extest {
}
"""
- def check(source: String, unit: global.CompilationUnit) = {
- getRequiredPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz =>
- afterTyper {
+ override def check(source: String, unit: global.CompilationUnit) {
+ getPackage(TermName("extest")).moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz =>
+ exitingTyper {
clazz.info
println(clazz.defString)
println(" " + classExistentialType(clazz) + "\n")
}
}
- true
}
}
diff --git a/test/files/run/existentials.scala b/test/files/run/existentials.scala
index 3977d47417..bdd6fb93ee 100644
--- a/test/files/run/existentials.scala
+++ b/test/files/run/existentials.scala
@@ -1,8 +1,11 @@
+import scala.language.existentials
+import scala.language.reflectiveCalls
+
class Foo {
class Line {
case class Cell[T](var x: T)
def f[T](x: Any): Cell[t1] forSome { type t1 } = x match { case y: Cell[t] => y }
-
+
var x: Cell[T] forSome { type T } = new Cell(1)
println({ x = new Cell("abc"); x })
}
@@ -12,7 +15,7 @@ class FooW {
class Line {
case class Cell[T](var x: T)
def f[T](x: Any): Cell[ _ ] = x match { case y: Cell[t] => y }
-
+
var x: Cell[_] = new Cell(1)
println({ x = new Cell("abc"); x })
}
diff --git a/test/files/run/existentials3-new.check b/test/files/run/existentials3-new.check
index 8f7dd701ac..7f02866a29 100644
--- a/test/files/run/existentials3-new.check
+++ b/test/files/run/existentials3-new.check
@@ -1,8 +1,8 @@
Bar.type, t=TypeRef, s=type Bar.type
Bar, t=TypeRef, s=type Bar
-Test.ToS, t=RefinedType, s=f3
-Test.ToS, t=RefinedType, s=f4
-Test.ToS, t=RefinedType, s=f5
+Test.ToS, t=RefinedType, s=<refinement of Test.ToS>
+Test.ToS, t=RefinedType, s=<refinement of Test.ToS>
+Test.ToS, t=RefinedType, s=<refinement of Test.ToS>
() => Test.ToS, t=TypeRef, s=trait Function0
() => Test.ToS, t=TypeRef, s=trait Function0
$anon, t=TypeRef, s=type $anon
@@ -12,9 +12,9 @@ List[Seq[Int]], t=TypeRef, s=class List
List[Seq[U forSome { type U <: Int }]], t=TypeRef, s=class List
Bar.type, t=TypeRef, s=type Bar.type
Bar, t=TypeRef, s=type Bar
-Test.ToS, t=RefinedType, s=g3
-Test.ToS, t=RefinedType, s=g4
-Test.ToS, t=RefinedType, s=g5
+Test.ToS, t=RefinedType, s=<refinement of Test.ToS>
+Test.ToS, t=RefinedType, s=<refinement of Test.ToS>
+Test.ToS, t=RefinedType, s=<refinement of Test.ToS>
() => Test.ToS, t=TypeRef, s=trait Function0
() => Test.ToS, t=TypeRef, s=trait Function0
$anon, t=TypeRef, s=type $anon
diff --git a/test/files/run/existentials3-new.scala b/test/files/run/existentials3-new.scala
index 110c8eff7a..5dfd7fb394 100644
--- a/test/files/run/existentials3-new.scala
+++ b/test/files/run/existentials3-new.scala
@@ -1,4 +1,6 @@
+import scala.language.existentials
import scala.reflect.runtime.universe._
+import internal._
object Test {
trait ToS { final override def toString = getClass.getName }
@@ -34,7 +36,7 @@ object Test {
val g12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() }
def printTpe(t: Type) = {
- val s = if (t.typeSymbol.isFreeType) t.typeSymbol.typeSignature.toString else t.typeSymbol.toString
+ val s = if (isFreeType(t.typeSymbol)) t.typeSymbol.info.toString else t.typeSymbol.toString
println("%s, t=%s, s=%s".format(t, t.asInstanceOf[Product].productPrefix, s))
}
def m[T: TypeTag](x: T) = printTpe(typeOf[T])
@@ -77,4 +79,4 @@ object Misc {
}
def g1 = o1.f1 _
def g2 = o1.f2 _
-} \ No newline at end of file
+}
diff --git a/test/files/run/existentials3-old.scala b/test/files/run/existentials3-old.scala
index 944160ff12..c021c0e71e 100644
--- a/test/files/run/existentials3-old.scala
+++ b/test/files/run/existentials3-old.scala
@@ -1,3 +1,5 @@
+import scala.language.existentials
+
object Test {
trait ToS { final override def toString = getClass.getName }
diff --git a/test/files/run/exoticnames.scala b/test/files/run/exoticnames.scala
index fa0e5e6ec5..98f9a88776 100644
--- a/test/files/run/exoticnames.scala
+++ b/test/files/run/exoticnames.scala
@@ -1,7 +1,7 @@
// this is a run-test because the compiler should emit bytecode that'll pass the JVM's verifier
object Test extends App {
- def `(` = error("bla")
- def `.` = error("bla")
- def `)` = error("bla")
- def `,` = error("bla")
+ def `(` = sys.error("bla")
+ def `.` = sys.error("bla")
+ def `)` = sys.error("bla")
+ def `,` = sys.error("bla")
}
diff --git a/test/files/run/fail-non-value-types.scala b/test/files/run/fail-non-value-types.scala
index 51198a5f31..d9a69e17c2 100644
--- a/test/files/run/fail-non-value-types.scala
+++ b/test/files/run/fail-non-value-types.scala
@@ -18,8 +18,8 @@ object Test {
def tcon[T: TypeTag](args: Type*) = appliedType(typeOf[T].typeConstructor, args.toList)
def cil = typeOf[CompletelyIndependentList[Int]]
- def map = cil.member("map": TermName).asMethod
- def distinct = cil.member("distinct": TermName).asMethod
+ def map = cil.member(TermName("map")).asMethod
+ def distinct = cil.member(TermName("distinct")).asMethod
def main(args: Array[String]): Unit = {
// Need the assert in there to fail.
@@ -32,9 +32,9 @@ object Test {
// [B <: <?>, That <: <?>](f: <?>)(implicit cbf: <?>)That
//
- println(map.typeSignature)
- println(map.typeSignatureIn(cil))
- println(distinct.typeSignature)
+ println(map.info)
+ println(map.infoIn(cil))
+ println(distinct.info)
if (failed) sys.exit(1)
}
}
diff --git a/test/files/run/finally.scala b/test/files/run/finally.scala
index 635123cc4d..2c01edaaef 100644
--- a/test/files/run/finally.scala
+++ b/test/files/run/finally.scala
@@ -7,17 +7,17 @@ object Test extends App {
try {
bar
} catch {
- case e => println(e)
+ case e: Throwable => println(e)
}
}
-
+
// test that finally is not covered by any exception handlers.
def bar {
try {
println("hi")
}
catch {
- case e => println("SHOULD NOT GET HERE")
+ case e: Throwable => println("SHOULD NOT GET HERE")
}
finally {
println("In Finally")
@@ -26,33 +26,33 @@ object Test extends App {
}
// return in catch (finally is executed)
- def retCatch {
+ def retCatch {
try {
throw new Exception
} catch {
- case e =>
+ case e: Throwable =>
println(e);
return
} finally println("in finally")
}
// throw in catch (finally is executed, exception propagated)
- def throwCatch {
+ def throwCatch {
try {
throw new Exception
} catch {
- case e =>
+ case e: Throwable =>
println(e);
throw e
} finally println("in finally")
}
// return inside body (finally is executed)
- def retBody {
+ def retBody {
try {
return
} catch {
- case e =>
+ case e: Throwable =>
println(e);
throw e
} finally println("in finally")
@@ -63,7 +63,7 @@ object Test extends App {
try {
throw new Exception
} catch {
- case e =>
+ case e: Throwable =>
println(e);
} finally println("in finally")
}
@@ -75,7 +75,7 @@ object Test extends App {
finally {
println("in finally 1")
return
- }
+ }
} finally println("in finally 2")
}
@@ -89,17 +89,17 @@ object Test extends App {
throw new Exception
}
} catch {
- case e => println(e)
+ case e: Throwable => println(e)
}
}
// nested finallies with return value
- def nestedFinalies: Int =
+ def nestedFinalies: Int =
try {
try {
return 10
} finally {
- try { () } catch { case _ => () }
+ try { () } catch { case _: Throwable => () }
println("in finally 1")
}
} finally {
@@ -111,7 +111,7 @@ object Test extends App {
try {
m
} catch {
- case e => println("COUGHT: " + e)
+ case e: Throwable => println("COUGHT: " + e)
}
println("-" * 40)
}
diff --git a/test/files/run/flat-flat-flat.scala b/test/files/run/flat-flat-flat.scala
index d57696b3a3..80868b9c5e 100644
--- a/test/files/run/flat-flat-flat.scala
+++ b/test/files/run/flat-flat-flat.scala
@@ -2,7 +2,7 @@ object Test {
def f1 = List(Iterator(Some(1), None, Some(2)), Iterator(Some(3), None))
def f2 = Iterator(List(Some(1), None, Some(2)), List(Some(3), None), Nil)
def f3 = List(Some(Iterator(1)), None, Some(Iterator(2, 3)))
-
+
def main(args: Array[String]): Unit = {
assert(f1.flatten.flatten.toList == List(1, 2, 3))
assert(f2.flatten.flatten.toList == List(1, 2, 3))
diff --git a/test/files/run/fors.check b/test/files/run/fors.check
index 08ecc8ed5f..b459f00b49 100644
--- a/test/files/run/fors.check
+++ b/test/files/run/fors.check
@@ -13,15 +13,6 @@ a b c
b c
b c
-
-<head><title>Scala</title></head>
-
-
-<body>1 2 3</body>
-
-
-<head><title>Scala</title></head>
-
testNew
3
1 2 3
@@ -35,12 +26,3 @@ testNew
0 2 4 6 8
0 2 4 6 8
a b c
-
-
-<head><title>Scala</title></head>
-
-
-<body>1 2 3</body>
-
-
-<head><title>Scala</title></head>
diff --git a/test/files/run/fors.scala b/test/files/run/fors.scala
index 54afdc710b..c778df3e24 100644
--- a/test/files/run/fors.scala
+++ b/test/files/run/fors.scala
@@ -12,12 +12,6 @@ object Test extends App {
val ar = "abc".toCharArray
- val xml =
- <html>
- <head><title>Scala</title></head>
- <body>{xs}</body>
- </html>;
-
/////////////////// old syntax ///////////////////
def testOld {
@@ -48,10 +42,6 @@ object Test extends App {
for {x <- ar
if x.toInt > 97} print(x + " "); println
- // sequences
- for (x <- xml.child) println(x)
- for (x <- xml.child;
- if x.label == "head") println(x)
}
/////////////////// new syntax ///////////////////
@@ -85,9 +75,6 @@ object Test extends App {
// arrays
for (x <- ar) print(x + " "); println
- // sequences
- for (x <- xml.child) println(x)
- for (x <- xml.child if x.label == "head") println(x)
}
////////////////////////////////////////////////////
diff --git a/test/files/run/forvaleq.scala b/test/files/run/forvaleq.scala
index 2a958802b6..8c1824a769 100644
--- a/test/files/run/forvaleq.scala
+++ b/test/files/run/forvaleq.scala
@@ -2,7 +2,7 @@
import scala.collection.immutable.Queue
import scala.{List=>L}
-
+
object Test {
// redefine some symbols to make it extra hard
class List
@@ -16,11 +16,11 @@ object Test {
case _ if (x<10) => x
case _ => firstDigit(x / 10)
}
-
-
+
+
{
- // a basic test case
-
+ // a basic test case
+
val input = L.range(0,20)
val oddFirstTimesTwo =
for {x <- input
@@ -32,7 +32,7 @@ object Test {
{
// a test case with patterns
-
+
val input = L.range(0, 20)
val oddFirstTimesTwo =
for {x <- input
@@ -43,10 +43,10 @@ object Test {
yield a + b
println(oddFirstTimesTwo)
}
-
+
{
// make sure it works on non-Ls
-
+
// val input: Queue = Queue.Empty[int].incl(L.range(0,20))
val input = L.range(0, 20).iterator
val oddFirstTimesTwo =
@@ -54,36 +54,36 @@ object Test {
xf = firstDigit(x)
if xf % 2 == 1}
yield x*2
- println(oddFirstTimesTwo.toList)
+ println(oddFirstTimesTwo.toList)
}
-
+
{
// yield the computed value
-
+
val input = L.range(0,20)
val oddFirstTimesTwo =
for {x <- input
xf = firstDigit(x)
if xf % 2 == 1}
yield xf*2
- println(oddFirstTimesTwo)
+ println(oddFirstTimesTwo)
}
{
// make sure the function is only called once
var count: Int = 0
-
+
def fdct(x: Int) = {
count += 1
firstDigit(x)
}
-
+
val input = L.range(0,20)
for {x <- input
xf = fdct(x)
if xf % 2 == 1}
yield xf
-
+
println("called " + count + " times")
}
diff --git a/test/files/run/freetypes_false_alarm2.scala b/test/files/run/freetypes_false_alarm2.scala
index 3499f13fba..a517f7396b 100644
--- a/test/files/run/freetypes_false_alarm2.scala
+++ b/test/files/run/freetypes_false_alarm2.scala
@@ -1,8 +1,9 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.tools.reflect.Eval
+import internal._
object Test extends App {
val tpe = typeOf[ru.Type]
- println(tpe.typeSymbol.isFreeType)
+ println(isFreeType(tpe.typeSymbol))
} \ No newline at end of file
diff --git a/test/files/run/gadts.scala b/test/files/run/gadts.scala
index 4ab3ef681a..57c7fc8af0 100644
--- a/test/files/run/gadts.scala
+++ b/test/files/run/gadts.scala
@@ -2,8 +2,8 @@ abstract class Term[T]
case class Lit(x: Int) extends Term[Int]
case class Succ(t: Term[Int]) extends Term[Int]
case class IsZero(t: Term[Int]) extends Term[Boolean]
-case class If[T](c: Term[Boolean],
- t1: Term[T],
+case class If[T](c: Term[Boolean],
+ t1: Term[T],
t2: Term[T]) extends Term[T]
object Test extends App {
diff --git a/test/files/run/genericValueClass.scala b/test/files/run/genericValueClass.scala
index 68162bb685..9398390a80 100644
--- a/test/files/run/genericValueClass.scala
+++ b/test/files/run/genericValueClass.scala
@@ -1,11 +1,14 @@
-final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal {
- @inline def -> [B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y)
- def →[B](y: B): Tuple2[A, B] = ->(y)
-}
+
+import scala.language.implicitConversions
object Test extends App {
+ class ArrowAssocClass[A](val __leftOfArrow: A) extends AnyVal {
+ @inline def -> [B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y)
+ def →[B](y: B): Tuple2[A, B] = ->(y)
+ }
+
{
- @inline implicit def any2ArrowAssoc[A](x: A): ArrowAssoc[A] = new ArrowAssoc(x)
+ @inline implicit def ArrowAssoc[A](x: A): ArrowAssocClass[A] = new ArrowAssocClass(x)
val x = 1 -> "abc"
println(x)
}
diff --git a/test/files/run/getClassTest-old.scala b/test/files/run/getClassTest-old.scala
index 951cc8d931..cd1b6b07f6 100644
--- a/test/files/run/getClassTest-old.scala
+++ b/test/files/run/getClassTest-old.scala
@@ -50,9 +50,10 @@ class MoreAnyRefs {
def f4 = (new A { def bippy() = 5 }).getClass()
}
+@deprecated("Suppress warnings", since="2.11")
object Test {
def returnTypes[T: Manifest] = (
- manifest[T].erasure.getMethods.toList
+ manifest[T].runtimeClass.getMethods.toList
filter (_.getName startsWith "f")
sortBy (_.getName)
map (m => m.getName + ": " + m.getGenericReturnType.toString)
diff --git a/test/files/run/global-showdef.scala b/test/files/run/global-showdef.scala
index 71ba7b8bb3..1d4891fd1f 100644
--- a/test/files/run/global-showdef.scala
+++ b/test/files/run/global-showdef.scala
@@ -1,6 +1,7 @@
import scala.tools.nsc._
-import io.{ AbstractFile }
-import util.{ SourceFile, BatchSourceFile, stringFromStream }
+import scala.reflect.io.AbstractFile
+import scala.tools.nsc.util.stringFromStream
+import scala.reflect.internal.util.{ SourceFile, BatchSourceFile }
import scala.tools.nsc.reporters.ConsoleReporter
object Test {
@@ -39,8 +40,8 @@ object Bippy {
new Global(settings)
}
-
- def slurp(body: => Unit): String = stringFromStream { stream =>
+
+ def slurp(body: => Unit): String = stringFromStream { stream =>
Console.withOut(stream) {
Console.withErr(stream) {
body
@@ -53,15 +54,15 @@ object Bippy {
val run = new compiler.Run()
run.compileSources(List(src))
}
- output split "\\n" toList
+ output.lines.toList
}
def showClass(name: String) = lines("-Yshow:typer", "-Xshow-class", name)
def showObject(name: String) = lines("-Yshow:typer", "-Xshow-object", name)
-
+
def show(xs: List[String]) = {
xs filter (x => (x contains "def showdefTestMember") || (x startsWith "<<-- ")) foreach println
}
-
+
def main(args: Array[String]) {
show(List("Bippy", "Bippy#BippyType", "Bippy.BippyType", "Bippy#Boppity", "Bippy#Boppity#Boo") flatMap showClass)
show(List("Bippy", "Bippy#Boppity#Boo") flatMap showObject)
diff --git a/test/files/run/groupby.scala b/test/files/run/groupby.scala
index fe08f52812..a751e65e80 100644
--- a/test/files/run/groupby.scala
+++ b/test/files/run/groupby.scala
@@ -3,8 +3,8 @@
// Fixes #3422
object Test {
-
- def main(args: Array[String]) {
+
+ def main(args: Array[String]) {
val arr = Array.range(0,10)
val map = arr groupBy (_%2)
val v1 = map(0)
@@ -14,5 +14,5 @@ object Test {
// hash map by default.
assert(v1 eq v2)
}
-
+
}
diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeBoxesRunTime.scala
index 081a73376e..ba1a30f5fb 100644
--- a/test/files/run/hashCodeBoxesRunTime.scala
+++ b/test/files/run/hashCodeBoxesRunTime.scala
@@ -4,16 +4,16 @@ object Test
{
import java.{ lang => jl }
import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject }
-
+
def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs)
-
+
def mkNumbers(x: Int): List[Number] =
List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble)
-
+
def testLDF(x: Long) = allSame(List[Number](x, x.toDouble, x.toFloat) map hashFromNumber)
-
+
def main(args: Array[String]): Unit = {
- List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n =>
+ List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n =>
val hashes = mkNumbers(n) map hashFromNumber
allSame(hashes)
if (n >= 0) {
@@ -21,7 +21,7 @@ object Test
assert(charCode == hashes.head)
}
}
-
+
testLDF(Short.MaxValue.toLong)
testLDF(Short.MinValue.toLong)
}
diff --git a/test/files/run/hashhash.scala b/test/files/run/hashhash.scala
index f9fc067398..3b9d1479cf 100644
--- a/test/files/run/hashhash.scala
+++ b/test/files/run/hashhash.scala
@@ -1,7 +1,7 @@
object Test {
def confirmSame(x: Any) = assert(x.## == x.hashCode, "%s.## != %s.hashCode".format(x, x))
def confirmDifferent(x: Any) = assert(x.## != x.hashCode, "%s.## == %s.hashCode (but should not)".format(x, x))
-
+
def main(args: Array[String]): Unit = {
/** Just a little sanity check, not to be confused with a unit test. */
List(5, 5.5f, "abc", new AnyRef, ()) foreach confirmSame
diff --git a/test/files/run/hashset.check b/test/files/run/hashset.check
new file mode 100644
index 0000000000..9542a1ff48
--- /dev/null
+++ b/test/files/run/hashset.check
@@ -0,0 +1,26 @@
+*** HashSet primitives
+0 true,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true
+20 false,21 false,22 false,23 false,24 false,25 false,26 false,27 false,28 false,29 false,30 false,31 false,32 false,33 false,34 false,35 false,36 false,37 false,38 false,39 false
+0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
+
+*** HashSet Strings with null
+null true
+0 true,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true
+20 false,21 false,22 false,23 false,24 false,25 false,26 false,27 false,28 false,29 false,30 false,31 false,32 false,33 false,34 false,35 false,36 false,37 false,38 false,39 false
+0,1,10,11,12,13,14,15,16,17,18,19,2,3,4,5,6,7,8,9,null
+null false
+0 false,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true
+
+*** ParHashSet primitives
+0 true,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true
+20 false,21 false,22 false,23 false,24 false,25 false,26 false,27 false,28 false,29 false,30 false,31 false,32 false,33 false,34 false,35 false,36 false,37 false,38 false,39 false
+0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
+
+*** ParHashSet Strings with null
+null true
+0 true,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true
+20 false,21 false,22 false,23 false,24 false,25 false,26 false,27 false,28 false,29 false,30 false,31 false,32 false,33 false,34 false,35 false,36 false,37 false,38 false,39 false
+0,1,10,11,12,13,14,15,16,17,18,19,2,3,4,5,6,7,8,9,null
+null false
+0 false,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true
+
diff --git a/test/files/run/hashset.scala b/test/files/run/hashset.scala
new file mode 100644
index 0000000000..a4d49c142e
--- /dev/null
+++ b/test/files/run/hashset.scala
@@ -0,0 +1,48 @@
+import scala.collection.generic.{Growable, Shrinkable}
+import scala.collection.GenSet
+import scala.collection.mutable.FlatHashTable
+import scala.collection.mutable.HashSet
+import scala.collection.parallel.mutable.ParHashSet
+
+object Test extends App {
+ test(new Creator{
+ def create[A] = new HashSet[A]
+ def hashSetType = "HashSet"
+ })
+
+ test(new Creator{
+ def create[A] = new ParHashSet[A]
+ def hashSetType = "ParHashSet"
+ })
+
+
+ def test(creator : Creator) {
+ println("*** " + creator.hashSetType + " primitives")
+ val h1 = creator.create[Int]
+ for (i <- 0 until 20) h1 += i
+ println((for (i <- 0 until 20) yield i + " " + (h1 contains i)).toList.sorted mkString(","))
+ println((for (i <- 20 until 40) yield i + " " + (h1 contains i)).toList.sorted mkString(","))
+ println(h1.toList.sorted mkString ",")
+ println
+
+ println("*** " + creator.hashSetType + " Strings with null")
+ val h2 = creator.create[String]
+ h2 += null
+ for (i <- 0 until 20) h2 += "" + i
+ println("null " + (h2 contains null))
+ println((for (i <- 0 until 20) yield i + " " + (h2 contains ("" + i))).toList.sorted mkString(","))
+ println((for (i <- 20 until 40) yield i + " " + (h2 contains ("" + i))).toList.sorted mkString(","))
+ println((h2.toList map {x => "" + x}).sorted mkString ",")
+
+ h2 -= null
+ h2 -= "" + 0
+ println("null " + (h2 contains null))
+ println((for (i <- 0 until 20) yield i + " " + (h2 contains ("" + i))).toList.sorted mkString(","))
+ println
+ }
+
+ trait Creator {
+ def create[A] : GenSet[A] with Cloneable with FlatHashTable[A] with Growable[A] with Shrinkable[A]
+ def hashSetType : String
+ }
+} \ No newline at end of file
diff --git a/test/files/run/hashsetremove.check b/test/files/run/hashsetremove.check
new file mode 100644
index 0000000000..8de9826895
--- /dev/null
+++ b/test/files/run/hashsetremove.check
@@ -0,0 +1,6 @@
+remove 0 should be false, was false
+contains 1 should be true, was true
+remove 1 should be true, was true
+contains 1 should be false, was false
+remove 1 should be false, was false
+contains 1 should be false, was false
diff --git a/test/files/run/hashsetremove.scala b/test/files/run/hashsetremove.scala
new file mode 100644
index 0000000000..7b82a9909b
--- /dev/null
+++ b/test/files/run/hashsetremove.scala
@@ -0,0 +1,13 @@
+import scala.collection.mutable.HashSet
+
+
+object Test extends App {
+ val h = new HashSet[Int]
+ h += 1
+ println(s"remove 0 should be false, was ${h remove 0}")
+ println(s"contains 1 should be true, was ${h contains 1}")
+ println(s"remove 1 should be true, was ${h remove 1}")
+ println(s"contains 1 should be false, was ${h contains 1}")
+ println(s"remove 1 should be false, was ${h remove 1}")
+ println(s"contains 1 should be false, was ${h contains 1}")
+ } \ No newline at end of file
diff --git a/test/files/run/idempotency-case-classes.check b/test/files/run/idempotency-case-classes.check
index e0453883ff..5a8d0ad9d3 100644
--- a/test/files/run/idempotency-case-classes.check
+++ b/test/files/run/idempotency-case-classes.check
@@ -47,7 +47,7 @@ C(2,3)
case <synthetic> def unapply(x$0: C): Option[(Int, Int)] = if (x$0.==(null))
scala.this.None
else
- Some.apply[(Int, Int)](Tuple2.apply[Int, Int](x$0.x, x$0.y));
+ Some.apply[(Int, Int)](scala.Tuple2.apply[Int, Int](x$0.x, x$0.y));
<synthetic> private def readResolve(): Object = C
};
Predef.println(C.apply(2, 3))
diff --git a/test/files/run/idempotency-case-classes.scala b/test/files/run/idempotency-case-classes.scala
index 4da8393cb6..4ad132174d 100644
--- a/test/files/run/idempotency-case-classes.scala
+++ b/test/files/run/idempotency-case-classes.scala
@@ -10,9 +10,9 @@ object Test extends App {
}
println(casee.eval)
val tb = cm.mkToolBox()
- val tcasee = tb.typeCheck(casee.tree)
+ val tcasee = tb.typecheck(casee.tree)
println(tcasee)
- val rtcasee = tb.resetAllAttrs(tcasee)
+ val rtcasee = tb.untypecheck(tcasee)
try {
println(tb.eval(rtcasee))
} catch {
diff --git a/test/files/run/idempotency-extractors.scala b/test/files/run/idempotency-extractors.scala
index fe033295f5..8c0a0b1106 100644
--- a/test/files/run/idempotency-extractors.scala
+++ b/test/files/run/idempotency-extractors.scala
@@ -10,9 +10,9 @@ object Test extends App {
}
println(extractor.eval)
val tb = cm.mkToolBox()
- val textractor = tb.typeCheck(extractor.tree)
+ val textractor = tb.typecheck(extractor.tree)
println(textractor)
- val rtextractor = tb.resetAllAttrs(textractor)
+ val rtextractor = tb.untypecheck(textractor)
try {
println(tb.eval(rtextractor))
} catch {
diff --git a/test/files/run/idempotency-labels.scala b/test/files/run/idempotency-labels.scala
index 82d009751a..084c93d3c6 100644
--- a/test/files/run/idempotency-labels.scala
+++ b/test/files/run/idempotency-labels.scala
@@ -11,9 +11,9 @@ object Test extends App {
}
println(label.eval)
val tb = cm.mkToolBox()
- val tlabel = tb.typeCheck(label.tree)
+ val tlabel = tb.typecheck(label.tree)
println(tlabel)
- val rtlabel = tb.resetAllAttrs(tlabel)
+ val rtlabel = tb.untypecheck(tlabel)
try {
println(tb.eval(rtlabel))
} catch {
diff --git a/test/files/run/idempotency-lazy-vals.scala b/test/files/run/idempotency-lazy-vals.scala
index 3531f9ff4b..9d677caeca 100644
--- a/test/files/run/idempotency-lazy-vals.scala
+++ b/test/files/run/idempotency-lazy-vals.scala
@@ -15,9 +15,9 @@ object Test extends App {
}
println(lazee.eval)
val tb = cm.mkToolBox()
- val tlazee = tb.typeCheck(lazee.tree)
+ val tlazee = tb.typecheck(lazee.tree)
println(tlazee)
- val rtlazee = tb.resetAllAttrs(tlazee)
+ val rtlazee = tb.untypecheck(tlazee)
try {
println(tb.eval(rtlazee))
} catch {
diff --git a/test/files/run/idempotency-partial-functions.check b/test/files/run/idempotency-partial-functions.check
deleted file mode 100644
index 5c8a411655..0000000000
--- a/test/files/run/idempotency-partial-functions.check
+++ /dev/null
@@ -1,2 +0,0 @@
-error!!
-error!
diff --git a/test/files/run/idempotency-this.check b/test/files/run/idempotency-this.check
index 8faf703d97..88b8288adf 100644
--- a/test/files/run/idempotency-this.check
+++ b/test/files/run/idempotency-this.check
@@ -1,4 +1,4 @@
List()
List.apply[String]("")
-Apply(TypeApply(Select(Ident(scala.collection.immutable.List), newTermName("apply")), List(TypeTree().setOriginal(Select(Ident(scala.Predef), newTypeName("String"))))), List(Literal(Constant(""))))
+Apply(TypeApply(Select(Ident(scala.collection.immutable.List), TermName("apply")), List(TypeTree().setOriginal(Select(Ident(scala.Predef), TypeName("String"))))), List(Literal(Constant(""))))
List()
diff --git a/test/files/run/idempotency-this.scala b/test/files/run/idempotency-this.scala
index 5cd4226326..26917ab743 100644
--- a/test/files/run/idempotency-this.scala
+++ b/test/files/run/idempotency-this.scala
@@ -9,10 +9,10 @@ object Test extends App {
}
println(thiss.eval)
val tb = cm.mkToolBox()
- val tthiss = tb.typeCheck(thiss.tree)
+ val tthiss = tb.typecheck(thiss.tree)
println(tthiss)
println(showRaw(tthiss))
- val rtthiss = tb.resetAllAttrs(tthiss)
+ val rtthiss = tb.untypecheck(tthiss)
try {
println(tb.eval(rtthiss))
} catch {
diff --git a/test/files/run/impconvtimes.scala b/test/files/run/impconvtimes.scala
index 8c5ab61779..477a16a890 100644
--- a/test/files/run/impconvtimes.scala
+++ b/test/files/run/impconvtimes.scala
@@ -1,3 +1,5 @@
+import scala.language.implicitConversions
+
object Test {
abstract class Unit
object NoUnit extends Unit
diff --git a/test/files/run/implicits.scala b/test/files/run/implicits.scala
index a30f60f6d0..5681a9d484 100644
--- a/test/files/run/implicits.scala
+++ b/test/files/run/implicits.scala
@@ -1,3 +1,5 @@
+import scala.language.implicitConversions
+
object A {
object B {
implicit def int2string(x: Int) = "["+x.toString+"]"
diff --git a/test/files/run/indexedSeq.scala b/test/files/run/indexedSeq.scala
index 9744f47f63..b1a2b1bc60 100644
--- a/test/files/run/indexedSeq.scala
+++ b/test/files/run/indexedSeq.scala
@@ -1,10 +1,11 @@
object Test {
- import scala.collection.{ mutable, immutable, generic }
-
+ import scala.collection.immutable
+
def checkIdentity[A](xs: immutable.IndexedSeq[A]) = assert(xs.toIndexedSeq eq xs)
-
+
def main(args: Array[String]): Unit = {
- checkIdentity(immutable.Vector(1 to 10: _*))
- checkIdentity(1 to 10 toIndexedSeq)
+ def r = 1 to 10
+ checkIdentity(immutable.Vector(r: _*))
+ checkIdentity(r.toIndexedSeq)
}
}
diff --git a/test/files/run/inferred-type-constructors.check b/test/files/run/inferred-type-constructors.check
new file mode 100644
index 0000000000..5992ef02ad
--- /dev/null
+++ b/test/files/run/inferred-type-constructors.check
@@ -0,0 +1,56 @@
+warning: there were 2 feature warning(s); re-run with -feature for details
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Seq[Int]
+ p.m.Set[Int]
+ p.m.Seq[Int]
+ private[m] p.m.ASet[Int]
+ p.i.Seq[Int]
+ private[i] p.i.ASet[Int]
+ private[i] p.i.ASeq[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ p.m.Set[Int]
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ private[p] p.ASet[Int]
+ private[p] p.AIterable[Int]
+ p.Iterable[Int]
+ p.i.Seq[Int]
+ private[p] p.AIterable[Int]
+ List[Nothing]
+ scala.collection.immutable.Vector[Nothing]
+ scala.collection.immutable.Iterable[(Int, Int)]
+ scala.collection.immutable.Set[Int]
+ Seq[Int]
+ Array[Int]
+ scala.collection.AbstractSet[Int]
+ Comparable[java.lang.String]
+ scala.collection.immutable.LinearSeq[Int]
+ Iterable[Int]
diff --git a/test/files/run/inferred-type-constructors.scala b/test/files/run/inferred-type-constructors.scala
new file mode 100644
index 0000000000..79a8653f68
--- /dev/null
+++ b/test/files/run/inferred-type-constructors.scala
@@ -0,0 +1,125 @@
+package p {
+ trait TCon[+CC[X]] {
+ def fPublic: CC[Int] = ???
+ private[p] def fPackagePrivate: CC[Int] = ???
+ protected[p] def fPackageProtected: CC[Int] = ???
+ }
+ trait Iterable[+A] extends TCon[Iterable]
+ trait Set[A] extends Iterable[A] with TCon[Set]
+ trait Seq[+A] extends Iterable[A] with TCon[Seq]
+
+ private[p] abstract class AIterable[+A] extends Iterable[A]
+ private[p] abstract class ASeq[+A] extends AIterable[A] with Seq[A]
+ private[p] abstract class ASet[A] extends AIterable[A] with Set[A]
+
+ package m {
+ private[m] abstract class ASeq[A] extends p.ASeq[A] with Seq[A]
+ private[m] abstract class ASet[A] extends p.ASet[A] with Set[A]
+ trait Set[A] extends p.Set[A] with TCon[Set]
+ trait Seq[A] extends p.Seq[A] with TCon[Seq]
+ trait BitSet extends ASet[Int]
+ trait IntSeq extends ASeq[Int]
+ }
+
+ package i {
+ private[i] abstract class ASeq[+A] extends p.ASeq[A] with Seq[A]
+ private[i] abstract class ASet[A] extends p.ASet[A] with Set[A]
+ trait Set[A] extends p.Set[A] with TCon[Set]
+ trait Seq[+A] extends p.Seq[A] with TCon[Seq]
+ trait BitSet extends ASet[Int]
+ trait IntSeq extends ASeq[Int]
+ }
+}
+
+object Test {
+ import scala.reflect.runtime.universe._
+ // Complicated by the absence of usable type constructor type tags.
+ def extract[A, CC[X]](xs: CC[A]): CC[A] = xs
+ def whatis[T: TypeTag](x: T): Unit = {
+ val tpe = typeOf[T]
+ val access = tpe.typeSymbol.asInstanceOf[scala.reflect.internal.HasFlags].accessString.replaceAllLiterally("package ", "")
+ println(f"$access%15s $tpe")
+ }
+
+ trait IntIterable extends p.Iterable[Int]
+ trait IntSet extends p.Set[Int]
+ trait IntSeq extends p.Seq[Int]
+
+ trait MutableIntSet extends p.m.Set[Int]
+ trait MutableIntSeq extends p.m.Seq[Int]
+
+ trait ImmutableIntSet extends p.i.Set[Int]
+ trait ImmutableIntSeq extends p.i.Seq[Int]
+
+ def f1: IntIterable = null
+ def f2: IntSet = null
+ def f3: IntSeq = null
+
+ def g1: MutableIntSet = null
+ def g2: MutableIntSeq = null
+ def g3: p.m.BitSet = null
+
+ def h1: ImmutableIntSeq = null
+ def h2: p.i.BitSet = null
+ def h3: p.i.IntSeq = null
+
+ def main(args: Array[String]): Unit = {
+ whatis(extract(f1))
+ whatis(extract(f2))
+ whatis(extract(f3))
+ whatis(extract(g1))
+ whatis(extract(g2))
+ whatis(extract(g3))
+ whatis(extract(h1))
+ whatis(extract(h2))
+ whatis(extract(h3))
+
+ whatis(extract(if (true) f1 else f2))
+ whatis(extract(if (true) f1 else f3))
+ whatis(extract(if (true) f1 else g1))
+ whatis(extract(if (true) f1 else g2))
+ whatis(extract(if (true) f1 else g3))
+ whatis(extract(if (true) f1 else h1))
+ whatis(extract(if (true) f1 else h2))
+ whatis(extract(if (true) f1 else h3))
+ whatis(extract(if (true) f2 else f3))
+ whatis(extract(if (true) f2 else g1))
+ whatis(extract(if (true) f2 else g2))
+ whatis(extract(if (true) f2 else g3))
+ whatis(extract(if (true) f2 else h1))
+ whatis(extract(if (true) f2 else h2))
+ whatis(extract(if (true) f2 else h3))
+ whatis(extract(if (true) f3 else g1))
+ whatis(extract(if (true) f3 else g2))
+ whatis(extract(if (true) f3 else g3))
+ whatis(extract(if (true) f3 else h1))
+ whatis(extract(if (true) f3 else h2))
+ whatis(extract(if (true) f3 else h3))
+ whatis(extract(if (true) g1 else g2))
+ whatis(extract(if (true) g1 else g3))
+ whatis(extract(if (true) g1 else h1))
+ whatis(extract(if (true) g1 else h2))
+ whatis(extract(if (true) g1 else h3))
+ whatis(extract(if (true) g2 else g3))
+ whatis(extract(if (true) g2 else h1))
+ whatis(extract(if (true) g2 else h2))
+ whatis(extract(if (true) g2 else h3))
+ whatis(extract(if (true) g3 else h1))
+ whatis(extract(if (true) g3 else h2))
+ whatis(extract(if (true) g3 else h3))
+ whatis(extract(if (true) h1 else h2))
+ whatis(extract(if (true) h1 else h3))
+ whatis(extract(if (true) h2 else h3))
+
+ whatis(extract(Nil))
+ whatis(extract(Vector()))
+ whatis(extract(Map[Int,Int]()))
+ whatis(extract(Set[Int]()))
+ whatis(extract(Seq[Int]()))
+ whatis(extract(Array[Int]()))
+ whatis(extract(scala.collection.immutable.BitSet(1)))
+ whatis(extract("abc"))
+ whatis(extract(if (true) Stream(1) else List(1)))
+ whatis(extract(if (true) Seq(1) else Set(1)))
+ }
+}
diff --git a/test/files/run/infix.scala b/test/files/run/infix.scala
index 700e4347ac..a867d03ce8 100644
--- a/test/files/run/infix.scala
+++ b/test/files/run/infix.scala
@@ -9,4 +9,3 @@ object Test extends App {
case null op (0, 0) op (1, 1) op (2, 2) => Console.println("OK")
}
}
-
diff --git a/test/files/run/inline-ex-handlers.check b/test/files/run/inline-ex-handlers.check
index 50a9d87557..7c885d2cc9 100644
--- a/test/files/run/inline-ex-handlers.check
+++ b/test/files/run/inline-ex-handlers.check
@@ -21,8 +21,8 @@
92 RETURN(REF(class Object))
@@ -246,3 +245,3 @@
startBlock: 1
-- blocks: [1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18]
-+ blocks: [1,2,3,4,5,6,8,10,11,12,13,14,15,16,17,18]
+- blocks: [1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18]
++ blocks: [1,2,3,4,5,6,8,11,12,13,14,15,16,17,18]
@@ -257,5 +256,2 @@
92 SCOPE_ENTER value x1
@@ -72,8 +72,8 @@
106 CALL_METHOD scala.Predef.println (dynamic)
@@ -518,3 +517,3 @@
startBlock: 1
-- blocks: [1,2,3,4,6,7,8,9,10]
-+ blocks: [1,2,3,4,6,7,8,9,10,11,12,13]
+- blocks: [1,2,3,4,6,7,9,10]
++ blocks: [1,3,4,6,7,9,10,11,12,13]
@@ -547,4 +546,9 @@
306 CALL_METHOD MyException.<init> (static-instance)
@@ -104,8 +104,12 @@
+ ? JUMP 13
+
3:
-@@ -575,2 +586,14 @@
+@@ -573,5 +584,14 @@
+ 310 CALL_METHOD scala.Predef.println (dynamic)
+- 310 JUMP 2
++ 300 RETURN(UNIT)
+- 2:
+ 13:
+ 310 LOAD_MODULE object Predef
+ 310 CALL_PRIMITIVE(StartConcat)
@@ -116,44 +120,42 @@
+ 310 CALL_PRIMITIVE(StringConcat(REF(class String)))
+ 310 CALL_PRIMITIVE(EndConcat)
+ 310 CALL_METHOD scala.Predef.println (dynamic)
-+ 310 JUMP 2
-+
- 2:
-@@ -583,6 +606,6 @@
+ 300 RETURN(UNIT)
+@@ -583,6 +603,6 @@
with finalizer: null
-- catch (Throwable) in ArrayBuffer(7, 8, 9, 10) starting at: 6
-+ catch (Throwable) in ArrayBuffer(7, 8, 9, 10, 11) starting at: 6
+- catch (Throwable) in ArrayBuffer(7, 9, 10) starting at: 6
++ catch (Throwable) in ArrayBuffer(7, 9, 10, 11) starting at: 6
consisting of blocks: List(6)
with finalizer: null
-- catch (Throwable) in ArrayBuffer(4, 6, 7, 8, 9, 10) starting at: 3
-+ catch (Throwable) in ArrayBuffer(4, 6, 7, 8, 9, 10, 11, 12) starting at: 3
+- catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10) starting at: 3
++ catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10, 11, 12) starting at: 3
consisting of blocks: List(3)
-@@ -618,3 +641,3 @@
+@@ -618,3 +638,3 @@
startBlock: 1
-- blocks: [1,2,3,4,5,6,7,9,10]
-+ blocks: [1,2,3,4,5,6,7,9,10,11,12]
+- blocks: [1,3,4,5,6,8,9]
++ blocks: [1,3,4,5,6,8,9,10,11]
-@@ -642,4 +665,10 @@
+@@ -642,4 +662,10 @@
78 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance)
- 78 THROW(IllegalArgumentException)
+ ? STORE_LOCAL(value e)
-+ ? JUMP 11
++ ? JUMP 10
-+ 11:
++ 10:
+ 81 LOAD_LOCAL(value e)
+ ? STORE_LOCAL(variable exc1)
-+ ? JUMP 12
++ ? JUMP 11
+
- 9:
-@@ -671,3 +700,4 @@
+ 8:
+@@ -668,3 +694,4 @@
81 LOAD_LOCAL(value e)
- 81 THROW(Exception)
+ ? STORE_LOCAL(variable exc1)
-+ ? JUMP 12
++ ? JUMP 11
-@@ -688,2 +718,15 @@
+@@ -685,2 +712,15 @@
-+ 12:
++ 11:
+ 83 LOAD_MODULE object Predef
+ 83 CONSTANT("finally")
+ 83 CALL_METHOD scala.Predef.println (dynamic)
@@ -167,33 +169,33 @@
+ 84 THROW(Throwable)
+
}
-@@ -693,3 +736,3 @@
+@@ -690,3 +730,3 @@
with finalizer: null
-- catch (<none>) in ArrayBuffer(4, 6, 7, 9) starting at: 3
-+ catch (<none>) in ArrayBuffer(4, 6, 7, 9, 11) starting at: 3
+- catch (<none>) in ArrayBuffer(4, 5, 6, 8) starting at: 3
++ catch (<none>) in ArrayBuffer(4, 5, 6, 8, 10) starting at: 3
consisting of blocks: List(3)
-@@ -717,5 +760,5 @@
+@@ -714,5 +754,5 @@
def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
- locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value message, value x, value ex6, value x4, value x5, value message, value x
+ locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value x, value ex6, value x4, value x5, value x
startBlock: 1
-- blocks: [1,2,3,4,5,6,9,11,14,15,16,19,21,22,24,25]
-+ blocks: [1,2,3,4,5,6,9,11,14,15,16,19,21,22,24,25,26,27,28]
+- blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24]
++ blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24,25,26,27]
-@@ -743,4 +786,11 @@
+@@ -740,4 +780,11 @@
172 CALL_METHOD MyException.<init> (static-instance)
- 172 THROW(MyException)
+ ? STORE_LOCAL(value ex6)
-+ ? JUMP 26
++ ? JUMP 25
-+ 26:
++ 25:
+ 170 LOAD_LOCAL(value ex6)
+ 170 STORE_LOCAL(value x4)
+ 170 SCOPE_ENTER value x4
-+ 170 JUMP 15
++ 170 JUMP 14
+
- 24:
-@@ -786,8 +836,5 @@
+ 23:
+@@ -780,8 +827,5 @@
175 SCOPE_ENTER value x5
- 175 LOAD_LOCAL(value x5)
- 175 CALL_METHOD MyException.message (dynamic)
@@ -204,7 +206,7 @@
+ ? LOAD_LOCAL(value x5)
+ 176 CALL_METHOD MyException.message (dynamic)
176 CALL_METHOD scala.Predef.println (dynamic)
-@@ -795,5 +842,7 @@
+@@ -789,5 +833,7 @@
177 DUP(REF(class MyException))
- 177 LOAD_LOCAL(value message)
+ ? LOAD_LOCAL(value x5)
@@ -212,24 +214,24 @@
177 CALL_METHOD MyException.<init> (static-instance)
- 177 THROW(MyException)
+ ? STORE_LOCAL(value ex6)
-+ ? JUMP 27
++ ? JUMP 26
-@@ -801,3 +850,4 @@
+@@ -795,3 +841,4 @@
170 LOAD_LOCAL(value ex6)
- 170 THROW(Throwable)
+ ? STORE_LOCAL(value ex6)
-+ ? JUMP 27
++ ? JUMP 26
-@@ -811,2 +861,8 @@
+@@ -805,2 +852,8 @@
-+ 27:
++ 26:
+ 169 LOAD_LOCAL(value ex6)
+ 169 STORE_LOCAL(value x4)
+ 169 SCOPE_ENTER value x4
+ 169 JUMP 5
+
5:
-@@ -821,8 +877,5 @@
+@@ -815,8 +868,5 @@
180 SCOPE_ENTER value x5
- 180 LOAD_LOCAL(value x5)
- 180 CALL_METHOD MyException.message (dynamic)
@@ -240,7 +242,7 @@
+ ? LOAD_LOCAL(value x5)
+ 181 CALL_METHOD MyException.message (dynamic)
181 CALL_METHOD scala.Predef.println (dynamic)
-@@ -830,5 +883,7 @@
+@@ -824,5 +874,7 @@
182 DUP(REF(class MyException))
- 182 LOAD_LOCAL(value message)
+ ? LOAD_LOCAL(value x5)
@@ -248,17 +250,17 @@
182 CALL_METHOD MyException.<init> (static-instance)
- 182 THROW(MyException)
+ ? STORE_LOCAL(variable exc2)
-+ ? JUMP 28
++ ? JUMP 27
-@@ -836,3 +891,4 @@
+@@ -830,3 +882,4 @@
169 LOAD_LOCAL(value ex6)
- 169 THROW(Throwable)
+ ? STORE_LOCAL(variable exc2)
-+ ? JUMP 28
++ ? JUMP 27
-@@ -853,2 +909,15 @@
+@@ -847,2 +900,15 @@
-+ 28:
++ 27:
+ 184 LOAD_MODULE object Predef
+ 184 CONSTANT("finally")
+ 184 CALL_METHOD scala.Predef.println (dynamic)
@@ -272,16 +274,16 @@
+ 185 THROW(Throwable)
+
}
-@@ -858,6 +927,6 @@
+@@ -852,6 +918,6 @@
with finalizer: null
-- catch (Throwable) in ArrayBuffer(14, 15, 16, 19, 21, 22, 24) starting at: 4
-+ catch (Throwable) in ArrayBuffer(14, 15, 16, 19, 21, 22, 24, 26) starting at: 4
- consisting of blocks: List(9, 6, 5, 4)
+- catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23) starting at: 4
++ catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23, 25) starting at: 4
+ consisting of blocks: List(9, 8, 6, 5, 4)
with finalizer: null
-- catch (<none>) in ArrayBuffer(4, 5, 6, 9, 14, 15, 16, 19, 21, 22, 24) starting at: 3
-+ catch (<none>) in ArrayBuffer(4, 5, 6, 9, 14, 15, 16, 19, 21, 22, 24, 26, 27) starting at: 3
+- catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23) starting at: 3
++ catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23, 25, 26) starting at: 3
consisting of blocks: List(3)
-@@ -885,5 +954,5 @@
+@@ -879,5 +945,5 @@
def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
- locals: value args, variable result, value e, value ex6, value x4, value x5, value message, value x
+ locals: value args, variable result, value e, value ex6, value x4, value x5, value x
@@ -289,7 +291,7 @@
- blocks: [1,2,3,6,7,8,11,13,14,16]
+ blocks: [1,2,3,6,7,8,11,13,14,16,17]
-@@ -911,4 +980,11 @@
+@@ -905,4 +971,11 @@
124 CALL_METHOD MyException.<init> (static-instance)
- 124 THROW(MyException)
+ ? STORE_LOCAL(value ex6)
@@ -302,7 +304,7 @@
+ 122 JUMP 7
+
16:
-@@ -936,8 +1012,5 @@
+@@ -930,8 +1003,5 @@
127 SCOPE_ENTER value x5
- 127 LOAD_LOCAL(value x5)
- 127 CALL_METHOD MyException.message (dynamic)
@@ -313,12 +315,12 @@
+ ? LOAD_LOCAL(value x5)
+ 127 CALL_METHOD MyException.message (dynamic)
127 CALL_METHOD scala.Predef.println (dynamic)
-@@ -970,3 +1043,3 @@
+@@ -964,3 +1034,3 @@
with finalizer: null
- catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16) starting at: 3
+ catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16, 17) starting at: 3
consisting of blocks: List(3)
-@@ -994,5 +1067,5 @@
+@@ -988,5 +1058,5 @@
def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
- locals: value args, variable result, value ex6, value x4, value x5, value message, value x, value e
+ locals: value args, variable result, value ex6, value x4, value x5, value x, value e
@@ -326,7 +328,7 @@
- blocks: [1,2,3,4,5,8,12,13,14,16]
+ blocks: [1,2,3,5,8,12,13,14,16,17]
-@@ -1020,4 +1093,13 @@
+@@ -1014,4 +1084,13 @@
148 CALL_METHOD MyException.<init> (static-instance)
- 148 THROW(MyException)
+ ? STORE_LOCAL(value ex6)
@@ -341,13 +343,13 @@
+ 154 CZJUMP (BOOL)NE ? 5 : 8
+
16:
-@@ -1041,5 +1123,2 @@
+@@ -1035,5 +1114,2 @@
145 SCOPE_ENTER value x4
- 145 JUMP 4
-
- 4:
154 LOAD_LOCAL(value x4)
-@@ -1053,8 +1132,5 @@
+@@ -1047,8 +1123,5 @@
154 SCOPE_ENTER value x5
- 154 LOAD_LOCAL(value x5)
- 154 CALL_METHOD MyException.message (dynamic)
@@ -358,12 +360,12 @@
+ ? LOAD_LOCAL(value x5)
+ 154 CALL_METHOD MyException.message (dynamic)
154 CALL_METHOD scala.Predef.println (dynamic)
-@@ -1275,3 +1351,3 @@
+@@ -1269,3 +1342,3 @@
startBlock: 1
- blocks: [1,2,3,4,5,7]
+ blocks: [1,2,3,4,5,7,8]
-@@ -1299,4 +1375,11 @@
+@@ -1293,4 +1366,11 @@
38 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance)
- 38 THROW(IllegalArgumentException)
+ ? STORE_LOCAL(value e)
@@ -376,7 +378,7 @@
+ 42 JUMP 2
+
7:
-@@ -1346,5 +1429,5 @@
+@@ -1340,5 +1420,5 @@
def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
- locals: value args, variable result, value ex6, value x4, value x5, value message, value x
+ locals: value args, variable result, value ex6, value x4, value x5, value x
@@ -384,13 +386,13 @@
- blocks: [1,2,3,4,5,8,10,11,13,14,16]
+ blocks: [1,2,3,5,8,10,11,13,14,16,17]
-@@ -1372,3 +1455,4 @@
+@@ -1366,3 +1446,4 @@
203 CALL_METHOD MyException.<init> (static-instance)
- 203 THROW(MyException)
+ ? STORE_LOCAL(value ex6)
+ ? JUMP 17
-@@ -1392,4 +1476,13 @@
+@@ -1386,4 +1467,13 @@
209 CALL_METHOD MyException.<init> (static-instance)
- 209 THROW(MyException)
+ ? STORE_LOCAL(value ex6)
@@ -405,13 +407,13 @@
+ 212 CZJUMP (BOOL)NE ? 5 : 8
+
16:
-@@ -1405,5 +1498,2 @@
+@@ -1399,5 +1489,2 @@
200 SCOPE_ENTER value x4
- 200 JUMP 4
-
- 4:
212 LOAD_LOCAL(value x4)
-@@ -1417,8 +1507,5 @@
+@@ -1411,8 +1498,5 @@
212 SCOPE_ENTER value x5
- 212 LOAD_LOCAL(value x5)
- 212 CALL_METHOD MyException.message (dynamic)
@@ -422,12 +424,12 @@
+ ? LOAD_LOCAL(value x5)
+ 213 CALL_METHOD MyException.message (dynamic)
213 CALL_METHOD scala.Predef.println (dynamic)
-@@ -1466,3 +1553,3 @@
+@@ -1460,3 +1544,3 @@
startBlock: 1
- blocks: [1,2,3,4,5,7]
+ blocks: [1,2,3,4,5,7,8]
-@@ -1490,4 +1577,11 @@
+@@ -1484,4 +1568,11 @@
58 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance)
- 58 THROW(IllegalArgumentException)
+ ? STORE_LOCAL(value e)
@@ -440,12 +442,12 @@
+ 62 JUMP 2
+
7:
-@@ -1539,3 +1633,3 @@
+@@ -1533,3 +1624,3 @@
startBlock: 1
-- blocks: [1,2,3,4]
-+ blocks: [1,2,3,4,5]
+- blocks: [1,3,4]
++ blocks: [1,3,4,5]
-@@ -1559,4 +1653,9 @@
+@@ -1553,4 +1644,9 @@
229 CALL_METHOD MyException.<init> (static-instance)
- 229 THROW(MyException)
+ ? JUMP 5
@@ -456,20 +458,20 @@
+ 228 THROW(Throwable)
+
3:
-@@ -1565,3 +1664,3 @@
+@@ -1559,3 +1655,3 @@
228 MONITOR_EXIT
- ? THROW(Throwable)
+ 228 THROW(Throwable)
-@@ -1593,5 +1692,5 @@
+@@ -1587,5 +1683,5 @@
def main(args: Array[String] (ARRAY[REF(class String)])): Unit {
- locals: value args, variable result, variable monitor2, variable monitorResult1
+ locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1
startBlock: 1
-- blocks: [1,2,3,4]
-+ blocks: [1,2,3,4,5]
+- blocks: [1,3,4]
++ blocks: [1,3,4,5]
-@@ -1618,4 +1717,12 @@
+@@ -1612,4 +1708,12 @@
245 CALL_METHOD MyException.<init> (static-instance)
- 245 THROW(MyException)
+ ? STORE_LOCAL(value exception$1)
@@ -483,7 +485,7 @@
+ 244 THROW(Throwable)
+
3:
-@@ -1624,3 +1731,3 @@
+@@ -1618,3 +1722,3 @@
244 MONITOR_EXIT
- ? THROW(Throwable)
+ 244 THROW(Throwable)
diff --git a/test/files/run/inline-ex-handlers.scala b/test/files/run/inline-ex-handlers.scala
index a96b938e13..964594d258 100644
--- a/test/files/run/inline-ex-handlers.scala
+++ b/test/files/run/inline-ex-handlers.scala
@@ -1,7 +1,7 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
-object Test extends IcodeTest {
- override def printIcodeAfterPhase = "inlineExceptionHandlers"
+object Test extends IcodeComparison {
+ override def printIcodeAfterPhase = "inlinehandlers"
}
import scala.util.Random._
diff --git a/test/files/run/inliner-infer.scala b/test/files/run/inliner-infer.scala
index ea83966c52..e41d6ae5c7 100644
--- a/test/files/run/inliner-infer.scala
+++ b/test/files/run/inliner-infer.scala
@@ -7,8 +7,8 @@ object Test extends App {
@annotation.tailrec
def walk(xs: MyList): Unit = {
- if (xs.isEmpty)
- println("empty")
+ if (xs.isEmpty)
+ println("empty")
else {
println("non-empty")
walk(MyNil)
@@ -26,4 +26,3 @@ object MyNil extends MyList {
override def isEmpty = true
}
-
diff --git a/test/files/run/inner-obj-auto.scala b/test/files/run/inner-obj-auto.scala
index aa2e29326f..00ea5119cc 100644
--- a/test/files/run/inner-obj-auto.scala
+++ b/test/files/run/inner-obj-auto.scala
@@ -3,15 +3,15 @@
/* ================================================================================
Automatically generated on 2011-05-11. Do Not Edit (unless you have to).
(2-level nesting)
- ================================================================================ */
+ ================================================================================ */
class Class2_1 {
-
+
class Class1_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -25,22 +25,22 @@ class Class2_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class1_2).run }
}
object Object3_1 {
-
+
class Class1_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -54,22 +54,22 @@ object Object3_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class1_2).run } // trigger
}
trait Trait4_1 {
-
+
class Class1_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -83,22 +83,22 @@ trait Trait4_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class1_2).run }
}
class Class6_1 {
-
+
object Object5_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -112,22 +112,22 @@ class Class6_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object5_2.run }
}
object Object7_1 {
-
+
object Object5_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -141,22 +141,22 @@ object Object7_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object5_2.run } // trigger
}
trait Trait8_1 {
-
+
object Object5_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -170,22 +170,22 @@ trait Trait8_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object5_2.run }
}
class Class10_1 {
-
+
trait Trait9_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -199,22 +199,22 @@ class Class10_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait9_2 {}).run }
}
object Object11_1 {
-
+
trait Trait9_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -228,22 +228,22 @@ object Object11_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait9_2 {}).run } // trigger
}
trait Trait12_1 {
-
+
trait Trait9_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -257,22 +257,22 @@ trait Trait12_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait9_2 {}).run }
}
class Class14_1 {
-
+
def method13_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -286,22 +286,22 @@ class Class14_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method13_2 }
}
object Object15_1 {
-
+
def method13_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -315,22 +315,22 @@ object Object15_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method13_2 } // trigger
}
trait Trait16_1 {
-
+
def method13_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -344,22 +344,22 @@ trait Trait16_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method13_2 }
}
class Class18_1 {
-
+
private def method17_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -373,22 +373,22 @@ class Class18_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method17_2 }
}
object Object19_1 {
-
+
private def method17_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -402,22 +402,22 @@ object Object19_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method17_2 } // trigger
}
trait Trait20_1 {
-
+
private def method17_2 {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -431,22 +431,22 @@ trait Trait20_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method17_2 }
}
class Class22_1 {
-
+
val fun21_2 = () => {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -460,22 +460,22 @@ class Class22_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { fun21_2() }
}
object Object23_1 {
-
+
val fun21_2 = () => {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -489,22 +489,22 @@ object Object23_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { fun21_2() } // trigger
}
trait Trait24_1 {
-
+
val fun21_2 = () => {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -518,23 +518,23 @@ trait Trait24_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { fun21_2() }
}
class Class26_1 {
-
+
class Class25_2 {
- { // in primary constructor
+ { // in primary constructor
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -548,24 +548,24 @@ class Class26_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Class25_2) }
}
object Object27_1 {
-
+
class Class25_2 {
- { // in primary constructor
+ { // in primary constructor
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -579,24 +579,24 @@ object Object27_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Class25_2) } // trigger
}
trait Trait28_1 {
-
+
class Class25_2 {
- { // in primary constructor
+ { // in primary constructor
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -610,24 +610,24 @@ trait Trait28_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Class25_2) }
}
class Class30_1 {
-
+
trait Trait29_2 {
- { // in primary constructor
+ { // in primary constructor
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -641,24 +641,24 @@ class Class30_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Trait29_2 {}) }
}
object Object31_1 {
-
+
trait Trait29_2 {
- { // in primary constructor
+ { // in primary constructor
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -672,24 +672,24 @@ object Object31_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Trait29_2 {}) } // trigger
}
trait Trait32_1 {
-
+
trait Trait29_2 {
- { // in primary constructor
+ { // in primary constructor
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -703,23 +703,23 @@ trait Trait32_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Trait29_2 {}) }
}
class Class34_1 {
-
+
lazy val lzvalue33_2 = {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -733,22 +733,22 @@ class Class34_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { lzvalue33_2 }
}
object Object35_1 {
-
+
lazy val lzvalue33_2 = {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -762,22 +762,22 @@ object Object35_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { lzvalue33_2 } // trigger
}
trait Trait36_1 {
-
+
lazy val lzvalue33_2 = {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -791,22 +791,22 @@ trait Trait36_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { lzvalue33_2 }
}
class Class38_1 {
-
+
val value37_2 = {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -820,22 +820,22 @@ class Class38_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { value37_2 }
}
object Object39_1 {
-
+
val value37_2 = {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -849,22 +849,22 @@ object Object39_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { value37_2 } // trigger
}
trait Trait40_1 {
-
+
val value37_2 = {
var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
Obj // one
@@ -878,22 +878,22 @@ trait Trait40_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { value37_2 }
}
class Class42_1 {
-
+
class Class41_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -907,22 +907,22 @@ class Class42_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class41_2).run }
}
object Object43_1 {
-
+
class Class41_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -936,22 +936,22 @@ object Object43_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class41_2).run } // trigger
}
trait Trait44_1 {
-
+
class Class41_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -965,22 +965,22 @@ trait Trait44_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class41_2).run }
}
class Class46_1 {
-
+
object Object45_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -994,22 +994,22 @@ class Class46_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object45_2.run }
}
object Object47_1 {
-
+
object Object45_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -1023,22 +1023,22 @@ object Object47_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object45_2.run } // trigger
}
trait Trait48_1 {
-
+
object Object45_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -1052,22 +1052,22 @@ trait Trait48_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object45_2.run }
}
class Class50_1 {
-
+
trait Trait49_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -1081,22 +1081,22 @@ class Class50_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait49_2 {}).run }
}
object Object51_1 {
-
+
trait Trait49_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -1110,22 +1110,22 @@ object Object51_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait49_2 {}).run } // trigger
}
trait Trait52_1 {
-
+
trait Trait49_2 {
var ObjCounter = 0
-
+
private object Obj { ObjCounter += 1}
Obj // one
@@ -1139,22 +1139,22 @@ trait Trait52_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("failed "); e.printStackTrace()
+ case e: Throwable => print("failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait49_2 {}).run }
}
class Class54_1 {
-
+
class Class53_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1172,22 +1172,22 @@ class Class54_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class53_2).run }
}
object Object55_1 {
-
+
class Class53_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1205,22 +1205,22 @@ object Object55_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class53_2).run } // trigger
}
trait Trait56_1 {
-
+
class Class53_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1238,22 +1238,22 @@ trait Trait56_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Class53_2).run }
}
class Class58_1 {
-
+
object Object57_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1271,22 +1271,22 @@ class Class58_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object57_2.run }
}
object Object59_1 {
-
+
object Object57_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1304,22 +1304,22 @@ object Object59_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object57_2.run } // trigger
}
trait Trait60_1 {
-
+
object Object57_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1337,22 +1337,22 @@ trait Trait60_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest } // trigger
}
-
+
def run { Object57_2.run }
}
class Class62_1 {
-
+
trait Trait61_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1370,22 +1370,22 @@ class Class62_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait61_2 {}).run }
}
object Object63_1 {
-
+
trait Trait61_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1403,22 +1403,22 @@ object Object63_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait61_2 {}).run } // trigger
}
trait Trait64_1 {
-
+
trait Trait61_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1436,22 +1436,22 @@ trait Trait64_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
def run { runTest }
}
-
+
def run { (new Trait61_2 {}).run }
}
class Class66_1 {
-
+
def method65_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1469,22 +1469,22 @@ class Class66_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method65_2 }
}
object Object67_1 {
-
+
def method65_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1502,22 +1502,22 @@ object Object67_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method65_2 } // trigger
}
trait Trait68_1 {
-
+
def method65_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1535,22 +1535,22 @@ trait Trait68_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method65_2 }
}
class Class70_1 {
-
+
private def method69_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1568,22 +1568,22 @@ class Class70_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method69_2 }
}
object Object71_1 {
-
+
private def method69_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1601,22 +1601,22 @@ object Object71_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method69_2 } // trigger
}
trait Trait72_1 {
-
+
private def method69_2 {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1634,22 +1634,22 @@ trait Trait72_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { method69_2 }
}
class Class74_1 {
-
+
val fun73_2 = () => {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1667,22 +1667,22 @@ class Class74_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { fun73_2() }
}
object Object75_1 {
-
+
val fun73_2 = () => {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1700,22 +1700,22 @@ object Object75_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { fun73_2() } // trigger
}
trait Trait76_1 {
-
+
val fun73_2 = () => {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1733,23 +1733,23 @@ trait Trait76_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { fun73_2() }
}
class Class78_1 {
-
+
class Class77_2 {
- { // in primary constructor
+ { // in primary constructor
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1767,24 +1767,24 @@ class Class78_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Class77_2) }
}
object Object79_1 {
-
+
class Class77_2 {
- { // in primary constructor
+ { // in primary constructor
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1802,24 +1802,24 @@ object Object79_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Class77_2) } // trigger
}
trait Trait80_1 {
-
+
class Class77_2 {
- { // in primary constructor
+ { // in primary constructor
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1837,24 +1837,24 @@ trait Trait80_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Class77_2) }
}
class Class82_1 {
-
+
trait Trait81_2 {
- { // in primary constructor
+ { // in primary constructor
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1872,24 +1872,24 @@ class Class82_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Trait81_2 {}) }
}
object Object83_1 {
-
+
trait Trait81_2 {
- { // in primary constructor
+ { // in primary constructor
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1907,24 +1907,24 @@ object Object83_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Trait81_2 {}) } // trigger
}
trait Trait84_1 {
-
+
trait Trait81_2 {
- { // in primary constructor
+ { // in primary constructor
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1942,23 +1942,23 @@ trait Trait84_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
- }
+ }
}
-
+
def run { (new Trait81_2 {}) }
}
class Class90_1 {
-
+
val value89_2 = {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -1976,22 +1976,22 @@ class Class90_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { value89_2 }
}
trait Trait92_1 {
-
+
val value89_2 = {
@volatile var ObjCounter = 0
-
+
object Obj { ObjCounter += 1}
def multiThreadedAccess() {
@@ -2009,13 +2009,13 @@ trait Trait92_1 {
assert(ObjCounter == 1, "multiple instances: " + ObjCounter)
println("ok")
} catch {
- case e => print("multi-threaded failed "); e.printStackTrace()
+ case e: Throwable => print("multi-threaded failed "); e.printStackTrace()
}
}
runTest // trigger
}
-
+
def run { value89_2 }
}
diff --git a/test/files/run/interop_classtags_are_classmanifests.scala b/test/files/run/interop_classtags_are_classmanifests.scala
index 91b9d89c6e..62d85c3ce3 100644
--- a/test/files/run/interop_classtags_are_classmanifests.scala
+++ b/test/files/run/interop_classtags_are_classmanifests.scala
@@ -1,5 +1,6 @@
-import scala.reflect.{ClassTag, classTag}
+import scala.reflect.ClassTag
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
def classTagIsClassManifest[T: ClassTag] = {
println(classManifest[T])
@@ -8,4 +9,4 @@ object Test extends App {
classTagIsClassManifest[Int]
classTagIsClassManifest[String]
classTagIsClassManifest[Array[Int]]
-} \ No newline at end of file
+}
diff --git a/test/files/run/interop_manifests_are_classtags.scala b/test/files/run/interop_manifests_are_classtags.scala
index 03479e527a..705038ece7 100644
--- a/test/files/run/interop_manifests_are_classtags.scala
+++ b/test/files/run/interop_manifests_are_classtags.scala
@@ -1,5 +1,6 @@
import scala.reflect.{ClassTag, classTag}
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
def classManifestIsClassTag[T: ClassManifest] = {
println(classTag[T])
@@ -20,4 +21,4 @@ object Test extends App {
manifestIsClassTag[Int]
manifestIsClassTag[String]
manifestIsClassTag[Array[Int]]
-} \ No newline at end of file
+}
diff --git a/test/files/run/interop_typetags_are_manifests.flags b/test/files/run/interop_typetags_are_manifests.flags
new file mode 100644
index 0000000000..ea7fc37e1a
--- /dev/null
+++ b/test/files/run/interop_typetags_are_manifests.flags
@@ -0,0 +1 @@
+-Yrangepos:false
diff --git a/test/files/run/interop_typetags_are_manifests.scala b/test/files/run/interop_typetags_are_manifests.scala
index 1aca7f52cc..6dc5437819 100644
--- a/test/files/run/interop_typetags_are_manifests.scala
+++ b/test/files/run/interop_typetags_are_manifests.scala
@@ -1,5 +1,6 @@
import scala.reflect.runtime.universe._
import scala.reflect.ClassTag
+import internal._
object Test extends App {
def typeTagIsManifest[T: TypeTag : ClassTag] = {
diff --git a/test/files/run/interpolationArgs.check b/test/files/run/interpolationArgs.check
index 155991e618..983214cbee 100644
--- a/test/files/run/interpolationArgs.check
+++ b/test/files/run/interpolationArgs.check
@@ -1,2 +1,2 @@
-java.lang.IllegalArgumentException: wrong number of arguments for interpolated string
-java.lang.IllegalArgumentException: wrong number of arguments for interpolated string
+java.lang.IllegalArgumentException: wrong number of arguments (1) for interpolated string with 3 parts
+java.lang.IllegalArgumentException: wrong number of arguments (1) for interpolated string with 1 parts
diff --git a/test/files/run/interpolationArgs.flags b/test/files/run/interpolationArgs.flags
deleted file mode 100644
index e1b37447c9..0000000000
--- a/test/files/run/interpolationArgs.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xexperimental \ No newline at end of file
diff --git a/test/files/run/interpolationArgs.scala b/test/files/run/interpolationArgs.scala
index eb13767907..ffb254b63f 100644
--- a/test/files/run/interpolationArgs.scala
+++ b/test/files/run/interpolationArgs.scala
@@ -1,5 +1,5 @@
object Test extends App {
- try { scala.StringContext("p1", "p2", "p3").s("e1") } catch { case ex => println(ex) }
- try { scala.StringContext("p1").s("e1") } catch { case ex => println(ex) }
+ try { scala.StringContext("p1", "p2", "p3").s("e1") } catch { case ex: Throwable => println(ex) }
+ try { scala.StringContext("p1").s("e1") } catch { case ex: Throwable => println(ex) }
}
diff --git a/test/files/run/interpolationMultiline1.flags b/test/files/run/interpolationMultiline1.flags
deleted file mode 100644
index 48fd867160..0000000000
--- a/test/files/run/interpolationMultiline1.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xexperimental
diff --git a/test/files/run/interpolationMultiline2.flags b/test/files/run/interpolationMultiline2.flags
deleted file mode 100644
index e1b37447c9..0000000000
--- a/test/files/run/interpolationMultiline2.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xexperimental \ No newline at end of file
diff --git a/test/files/run/interpolationMultiline2.scala b/test/files/run/interpolationMultiline2.scala
index f6a682c3ce..2de4c4b22e 100644
--- a/test/files/run/interpolationMultiline2.scala
+++ b/test/files/run/interpolationMultiline2.scala
@@ -2,14 +2,15 @@ object Test extends App {
def test1(n: Int) = {
val old = "old"
- try { println(s"""Bob is ${s"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) }
- try { println(s"""Bob is ${f"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) }
- try { println(f"""Bob is ${s"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) }
- try { println(f"""Bob is ${f"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) }
- try { println(f"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) }
- try { println(f"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) }
- try { println(s"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) }
- try { println(s"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) }
+ val catcher: PartialFunction[Throwable, Unit] = { case e => println(e) }
+ try { println(s"""Bob is ${s"$n"} years ${s"$old"}!""") } catch catcher
+ try { println(s"""Bob is ${f"$n"} years ${s"$old"}!""") } catch catcher
+ try { println(f"""Bob is ${s"$n"} years ${s"$old"}!""") } catch catcher
+ try { println(f"""Bob is ${f"$n"} years ${s"$old"}!""") } catch catcher
+ try { println(f"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch catcher
+ try { println(f"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch catcher
+ try { println(s"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch catcher
+ try { println(s"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch catcher
}
test1(1)
diff --git a/test/files/run/intmap.check b/test/files/run/intmap.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/intmap.check
+++ /dev/null
diff --git a/test/files/run/io-position.check b/test/files/run/io-position.check
deleted file mode 100644
index 09f743d750..0000000000
--- a/test/files/run/io-position.check
+++ /dev/null
Binary files differ
diff --git a/test/files/run/io-position.scala b/test/files/run/io-position.scala
deleted file mode 100644
index 1093704fa4..0000000000
--- a/test/files/run/io-position.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-object Test {
- Console.setErr(Console.out)
-
- def main(args: Array[String]): Unit = {
- try {
- xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<foo>"), false).document()
- } catch {
- case e:Exception => println(e.getMessage)
- }
- }
-
-}
-
diff --git a/test/files/run/iq.check b/test/files/run/iq.check
index 81114ea181..311bf83ed4 100644
--- a/test/files/run/iq.check
+++ b/test/files/run/iq.check
@@ -1,4 +1,8 @@
Empty
+q2: Queue(42, 0)
+qa: Queue(42, 0)
+qb: Queue(42, 0)
+qc: Queue(42, 0)
Head: 42
q5: Queue(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
q5[5]: 5
diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala
index e5f9e4705a..1eb1d40e37 100644
--- a/test/files/run/iq.scala
+++ b/test/files/run/iq.scala
@@ -9,25 +9,36 @@ object iq {
/* Create an empty queue. */
val q: Queue[Int] = Queue.empty
- /* Test isEmpty.
- * Expected: Empty
+ /* Test isEmpty.
+ * Expected: Empty
*/
if (q.isEmpty) {
Console.println("Empty")
}
- /* Test infix enqueing. */
- //val q2 = q + 42 + 0 // deprecated
+ /* Test enqueing. */
val q2 = q.enqueue(42).enqueue(0)
+ val qa = q :+ 42 :+ 0
+ assert(q2 == qa)
+
+ val qb = 42 +: 0 +: q
+ assert(q2 == qb)
+ val qc = 42 +: q :+ 0
+ assert(q2 == qc)
- /* Test is empty and dequeue.
+ Console.println("q2: " + q2)
+ Console.println("qa: " + qa)
+ Console.println("qb: " + qb)
+ Console.println("qc: " + qc)
+
+ /* Test is empty and dequeue.
* Expected: Head: 42
*/
val q4 =
if (q2.isEmpty) {
Console.println("Empty")
q2
- }
+ }
else {
val (head, q3) = q2.dequeue
Console.println("Head: " + head)
@@ -36,8 +47,8 @@ object iq {
/* Test sequence enqueing. */
val q5: Queue[Any] = q4.enqueue(List(1,2,3,4,5,6,7,8,9))
- /* Test toString.
- * Expected: Head: q5: Queue(0,1,2,3,4,5,6,7,8,9)
+ /* Test toString.
+ * Expected: q5: Queue(0,1,2,3,4,5,6,7,8,9)
*/
Console.println("q5: " + q5)
/* Test apply
@@ -59,7 +70,7 @@ object iq {
//val q8 = q7 + 10 + 11 //deprecated
val q8 = q7.enqueue(10).enqueue(11)
/* Test dequeu
- * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11)
+ * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11)
*/
Console.println("q8: " + q8)
val q9 = Queue(2,3,4,5,6,7,8,9,10,11)
@@ -70,14 +81,14 @@ object iq {
Console.println("q8 == q9: " + (q8 == q9))
/* Testing elements
- * Expected: Elements: 1 2 3 4 5 6 7 8 9
+ * Expected: Elements: 1 2 3 4 5 6 7 8 9
*/
- Console.print("Elements: ");
+ Console.print("Elements: ");
q6.iterator.foreach(e => Console.print(" "+ e + " "))
- Console.println;
+ Console.println;
/* Testing mkString
- * Expected: String: <1-2-3-4-5-6-7-8-9>
+ * Expected: String: <1-2-3-4-5-6-7-8-9>
*/
Console.println("String: " + q6.mkString("<","-",">"))
@@ -89,7 +100,7 @@ object iq {
/* Testing front
* Expected: Front: 1
*/
- Console.println("Front: " + q6.front);
+ Console.println("Front: " + q6.front);
}
}
diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala
index 402eff99d6..65e8ceeca6 100644
--- a/test/files/run/is-valid-num.scala
+++ b/test/files/run/is-valid-num.scala
@@ -1,3 +1,6 @@
+/*
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
object Test {
def x = BigInt("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
def y = BigDecimal("" + (Short.MaxValue + 1) + ".0")
@@ -16,25 +19,27 @@ object Test {
assert(!x.isValidChar, x)
assert(!x.isValidShort, x)
assert(!x.isValidByte, x)
-// assert(y.isWhole, y)
+ assert(y.isWhole, y)
assert(!y.isValidShort, y)
assert(y.isValidChar, y)
assert(y.isValidInt, y)
- assert(y.isValidFloat, y)
- assert(y.isValidDouble, y)
+ assert(y.isDecimalFloat, y)
+ assert(y.isDecimalDouble, y)
assert(y.isValidLong, y)
assert(!y.isValidByte, y)
-// assert(!y1.isWhole)
+ assert(!y1.isWhole)
assert(!y1.isValidLong, y1)
- assert(!y1.isValidFloat, y1)
- assert(!y1.isValidDouble, y1)
+ assert(y1.isDecimalFloat, y1)
+ assert(y1.isDecimalDouble, y1)
+ assert(!y1.isExactFloat, y1)
+ assert(!y1.isExactDouble, y1)
assert(!y1.isValidInt, y1)
assert(!y1.isValidChar, y1)
assert(!y1.isValidShort, y1)
assert(!y1.isValidByte, y1)
assert(!y2.isValidLong, y2)
- assert(y2.isValidFloat, y2)
- assert(y2.isValidDouble, y2)
+ assert(y2.isExactFloat, y2)
+ assert(y2.isExactDouble, y2)
assert(!l1.isValidInt && (l1 - 1).isValidInt, l1)
assert(!l2.isValidInt && (l2 + 1).isValidInt, l2)
@@ -124,7 +129,7 @@ object Test {
checkBigInt2(biExp2(128) - biExp2(128 - pf))
checkBigInt2(biExp2(128) - biExp2(128 - pf - 1))
checkBigInt2(biExp2(128))
-
+
checkBigInt2(biExp2(1023))
checkBigInt2(biExp2(1024) - biExp2(1024 - pd))
checkBigInt2(biExp2(1024) - biExp2(1024 - pd - 1))
@@ -167,8 +172,8 @@ object Test {
if (!d.isInfinity) {
val bd = BigDecimal(new java.math.BigDecimal(d))
// assert(!bd.isWhole, bd)
- assert(bd.isValidDouble, bd)
- assert(bd.isValidFloat == isFloat, bd)
+ assert(bd.isExactDouble, bd)
+ assert(bd.isExactFloat == isFloat, bd)
assert(!bd.isValidLong, bd)
assert(!bd.isValidInt, bd)
assert(!bd.isValidChar, bd)
@@ -207,9 +212,9 @@ object Test {
val isFloat = !bi.toFloat.isInfinity && bd.compare(BigDecimal(new java.math.BigDecimal(bi.toFloat))) == 0
val isDouble = !bi.toDouble.isInfinity && bd.compare(BigDecimal(new java.math.BigDecimal(bi.toDouble))) == 0
-// assert(bd.isWhole, bd)
- assert(bd.isValidDouble == isDouble, bd)
- assert(bd.isValidFloat == isFloat, bd)
+ assert(bd.isWhole, bd)
+ assert(bd.isBinaryDouble == isDouble, bd)
+ assert(bd.isBinaryFloat == isFloat, bd)
assert(bd.isValidLong == isLong, bd)
assert(bd.isValidInt == isInt, bd)
assert(bd.isValidChar == isChar, bd)
diff --git a/test/files/run/issue192.scala b/test/files/run/issue192.scala
index d8db8b5816..8e6d13e5e1 100644
--- a/test/files/run/issue192.scala
+++ b/test/files/run/issue192.scala
@@ -1,16 +1,18 @@
+import scala.language.reflectiveCalls
+
object Test extends App {
-
+
def f1(p: Any{def unary_+ : Int}) = +p
def f2(p: Any{def unary_- : Int}) = -p
def f3(p: Any{def unary_~ : Int}) = ~p
def f4(p: Any{def unary_! : Boolean}) = !p
-
+
def f5(p: Any{def +(q: Int): Int}) = p + 7
def f6(p: Any{def -(q: Int): Int}) = p - 7
def f7(p: Any{def *(q: Int): Int}) = p * 7
def f8(p: Any{def /(q: Int): Int}) = p / 7
def f9(p: Any{def %(q: Int): Int}) = p % 7
-
+
def f10(p: Any{def |(q: Int): Int}) = p | 7
def f11(p: Any{def |(q: Boolean): Boolean}) = p | true
def f12(p: Any{def ^(q: Int): Int}) = p ^ 7
@@ -19,11 +21,11 @@ object Test extends App {
def f15(p: Any{def &(q: Boolean): Boolean}) = p & true
def f16(p: Any{def ||(q: Boolean): Boolean}) = p || true
def f17(p: Any{def &&(q: Boolean): Boolean}) = p && true
-
+
def f18(p: Any{def <<(q: Int): Int}) = p << 7
def f19(p: Any{def >>(q: Int): Int}) = p >> 7
def f20(p: Any{def >>>(q: Int): Int}) = p >>> 7
-
+
def f21(p: Any{def toByte: Byte}) = p.toByte
def f22(p: Any{def toShort: Short}) = p.toShort
def f23(p: Any{def toChar: Char}) = p.toChar
@@ -31,28 +33,28 @@ object Test extends App {
def f25(p: Any{def toLong: Long}) = p.toLong
def f26(p: Any{def toFloat: Float}) = p.toFloat
def f27(p: Any{def toDouble: Double}) = p.toDouble
-
+
def f28(p: Any{def ==(q: Int): Boolean}) = p == 7
def f29(p: Any{def !=(q: Int): Boolean}) = p != 7
def f30(p: Any{def ==(q: Boolean): Boolean}) = p == true
def f31(p: Any{def !=(q: Boolean): Boolean}) = p != true
-
+
def f32(p: Any{def <(q: Int): Boolean}) = p < 7
def f33(p: Any{def <=(q: Int): Boolean}) = p <= 7
def f34(p: Any{def >=(q: Int): Boolean}) = p >= 7
def f35(p: Any{def >(q: Int): Boolean}) = p > 7
-
+
print("f1 = "); println(f1(1) == +1)
print("f2 = "); println(f2(1) == -1)
print("f3 = "); println(f3(1) == ~1)
print("f4 = "); println(f4(true) == !true)
-
+
print("f5 = "); println(f5(4) == (4 + 7))
print("f6 = "); println(f6(4) == (4 - 7))
print("f7 = "); println(f7(4) == (4 * 7))
print("f8 = "); println(f8(4) == (4 / 7))
print("f9 = "); println(f9(4) == (4 % 7))
-
+
print("f10 = "); println(f10(4) == (4 | 7))
print("f11 = "); println(f11(false) == (false | true))
print("f12 = "); println(f12(4) == (4 ^ 7))
@@ -61,11 +63,11 @@ object Test extends App {
print("f15 = "); println(f15(false) == (false & true))
print("f16 = "); println(f16(false) == (false || true))
print("f17 = "); println(f17(false) == (false && true))
-
+
print("f18 = "); println(f18(4) == (4 << 7))
print("f19 = "); println(f19(-4) == (-4 >> 7))
print("f20 = "); println(f20(-4) == (-4 >>> 7))
-
+
print("f21 = "); println(f21(4.2) == (4.2.toByte))
print("f22 = "); println(f22(4.2) == (4.2.toShort))
print("f23 = "); println(f23(4.2) == (4.2.toChar))
@@ -73,17 +75,17 @@ object Test extends App {
print("f25 = "); println(f25(4.2) == (4.2.toLong))
print("f26 = "); println(f26(4.2) == (4.2.toFloat))
print("f27 = "); println(f27(4.2) == (4.2.toDouble))
-
+
print("f28 = "); println(f28(4) == (4 == 7))
print("f29 = "); println(f29(4) == (4 != 7))
print("f30 = "); println(f30(false) == (false == true))
print("f31 = "); println(f31(false) == (false != true))
-
+
print("f32 = "); println(f32(4) == (4 < 7))
print("f33 = "); println(f33(4) == (4 <= 7))
print("f34 = "); println(f34(4) == (4 >= 7))
print("f35 = "); println(f35(4) == (4 > 7))
-
+
println("ok")
-
+
}
diff --git a/test/files/run/iterator-concat.check b/test/files/run/iterator-concat.check
new file mode 100644
index 0000000000..23835b07ae
--- /dev/null
+++ b/test/files/run/iterator-concat.check
@@ -0,0 +1,4 @@
+100
+1000
+10000
+100000
diff --git a/test/files/run/iterator-concat.scala b/test/files/run/iterator-concat.scala
new file mode 100644
index 0000000000..f11363410f
--- /dev/null
+++ b/test/files/run/iterator-concat.scala
@@ -0,0 +1,15 @@
+object Test {
+ // Create `size` Function0s, each of which evaluates to an Iterator
+ // which produces 1. Then fold them over ++ to get a single iterator,
+ // which should sum to "size".
+ def mk(size: Int): Iterator[Int] = {
+ val closures = (1 to size).toList.map(x => (() => Iterator(1)))
+ closures.foldLeft(Iterator.empty: Iterator[Int])((res, f) => res ++ f())
+ }
+ def main(args: Array[String]): Unit = {
+ println(mk(100).sum)
+ println(mk(1000).sum)
+ println(mk(10000).sum)
+ println(mk(100000).sum)
+ }
+}
diff --git a/test/files/run/iterator-from.scala b/test/files/run/iterator-from.scala
new file mode 100644
index 0000000000..269e859657
--- /dev/null
+++ b/test/files/run/iterator-from.scala
@@ -0,0 +1,71 @@
+/* This file tests iteratorFrom, keysIteratorFrom, and valueIteratorFrom on various sorted sets and maps
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
+
+import scala.util.{Random => R}
+import scala.collection._
+import scala.math.Ordered
+
+object Test extends App {
+ val maxLength = 25
+ val maxKey = 50
+ val maxValue = 50
+
+ def testSet[A <% Ordered[A]](set: SortedSet[A], list: List[A]) {
+ val distinctSorted = list.distinct.sorted
+ assertEquals("Set size wasn't the same as list sze", set.size, distinctSorted.size)
+
+ for(key <- distinctSorted) {
+ val clazz = set.getClass
+ val iteratorFrom = (set iteratorFrom key).toList
+ check(clazz, list, s"set iteratorFrom $key", s"(set from $key).iterator", iteratorFrom, (set from key).iterator.toList)
+ check(clazz, list, s"set.iteratorFrom $key", s"distinctSorted dropWhile (_ < $key)", iteratorFrom, distinctSorted dropWhile (_ < key))
+ check(clazz, list, s"set iteratorFrom $key", s"set keysIterator from $key", iteratorFrom, (set keysIteratorFrom key).toList)
+ }
+ }
+
+ def testMap[A <% Ordered[A], B](map: SortedMap[A, B], list: List[(A, B)]) {
+ val distinctSorted = distinctByKey(list).sortBy(_._1)
+ assertEquals("Map size wasn't the same as list sze", map.size, distinctSorted.size)
+
+ for(keyValue <- distinctSorted) {
+ val key = keyValue._1
+ val clazz = map.getClass
+ val iteratorFrom = (map iteratorFrom key).toList
+ check(clazz, list, s"map iteratorFrom $key", s"(map from $key).iterator", iteratorFrom, (map from key).iterator.toList)
+ check(clazz, list, s"map iteratorFrom $key", s"distinctSorted dropWhile (_._1 < $key)", iteratorFrom, distinctSorted dropWhile (_._1 < key))
+ check(clazz, list, s"map iteratorFrom $key map (_._1)", s"map keysIteratorFrom $key", iteratorFrom map (_._1), (map keysIteratorFrom key).toList)
+ check(clazz, list, s"map iteratorFrom $key map (_._2)", s"map valuesIteratorFrom $key", iteratorFrom map (_._2), (map valuesIteratorFrom key).toList)
+ }
+ }
+
+ def check[A](clazz: Class[_], list: List[_], m1: String, m2: String, l1: List[A], l2: List[A]) {
+ assertEquals(s"$clazz: `$m1` didn't match `$m2` on list $list", l1, l2)
+ }
+
+ def assertEquals[A](msg: String, x: A, y: A) {
+ assert(x == y, s"$msg\n1: $x\n2: $y")
+ }
+
+ def distinctByKey[A,B](list: List[(A, B)]) : List[(A,B)] = list.groupBy(_._1).map(_._2.last).toList
+
+ object Weekday extends Enumeration {
+ type Weekday = Value
+ val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
+ }
+
+ 0 until maxLength foreach {length =>
+ val keyValues = (0 until length map {_ => (R nextInt maxKey, R nextInt maxValue)}).toList
+ val keys = keyValues map (_._2)
+ testSet(immutable.BitSet(keys:_*), keys)
+ testSet(immutable.TreeSet(keys:_*), keys)
+ testSet(mutable.TreeSet(keys:_*), keys)
+ val days = keys map {n => Weekday(n % Weekday.values.size)}
+ testSet(Weekday.ValueSet(days:_*), days)
+
+ val treeMap = immutable.TreeMap(keyValues:_*)
+ testMap(treeMap, keyValues)
+ testMap(treeMap.filterKeys(_ % 2 == 0), keyValues filter (_._1 % 2 == 0))
+ testMap(treeMap mapValues (_ + 1), keyValues map {case (k,v) => (k, v + 1)})
+ }
+}
diff --git a/test/files/run/iterator-iterate-lazy.scala b/test/files/run/iterator-iterate-lazy.scala
index 73886f192b..92b170062e 100644
--- a/test/files/run/iterator-iterate-lazy.scala
+++ b/test/files/run/iterator-iterate-lazy.scala
@@ -1,5 +1,5 @@
object Test {
def main(args: Array[String]): Unit = {
- Iterator.iterate(1 to 5 toList)(_.tail).takeWhile(_.nonEmpty).map(_.head).toList
+ Iterator.iterate((1 to 5).toList)(_.tail).takeWhile(_.nonEmpty).map(_.head).toList
}
}
diff --git a/test/files/run/iterator3444.scala b/test/files/run/iterator3444.scala
index 2d0643bd56..1d0713addc 100644
--- a/test/files/run/iterator3444.scala
+++ b/test/files/run/iterator3444.scala
@@ -2,22 +2,22 @@
// ticked #3444
object Test {
-
+
def main(args: Array[String]) {
val it = (1 to 12).toSeq.iterator
-
+
assert(it.next == 1)
assert(it.take(2).toList == List(2, 3))
-
+
val jt = (4 to 12).toSeq.iterator
assert(jt.next == 4)
assert(jt.drop(5).toList == List(10, 11, 12))
-
+
val kt = (1 until 10).toSeq.iterator
assert(kt.drop(50).toList == Nil)
-
+
val mt = (1 until 5).toSeq.iterator
assert(mt.take(50).toList == List(1, 2, 3, 4))
}
-
+
}
diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala
index b85291cd72..57e05d3472 100644
--- a/test/files/run/iterators.scala
+++ b/test/files/run/iterators.scala
@@ -4,6 +4,8 @@
//############################################################################
+import scala.language.postfixOps
+
object Test {
def check_from: Int = {
@@ -82,16 +84,16 @@ object Test {
var xs4 = a.slice(0, 4).iterator.toList;
xs0.length + xs1.length + xs2.length + xs3.length + xs4.length
}
-
+
def check_toSeq: String =
List(1, 2, 3, 4, 5).iterator.toSeq.mkString("x")
-
+
def check_indexOf: String = {
val i = List(1, 2, 3, 4, 5).indexOf(4)
val j = List(1, 2, 3, 4, 5).indexOf(16)
"" + i + "x" + j
}
-
+
def check_findIndexOf: String = {
val i = List(1, 2, 3, 4, 5).indexWhere { x: Int => x >= 4 }
val j = List(1, 2, 3, 4, 5).indexWhere { x: Int => x >= 16 }
diff --git a/test/files/run/java-erasure.scala b/test/files/run/java-erasure.scala
index 0441ad705b..c9f9b0ad51 100644
--- a/test/files/run/java-erasure.scala
+++ b/test/files/run/java-erasure.scala
@@ -3,7 +3,7 @@ object Test {
list add "a"
list add "c"
list add "b"
-
+
def main(args: Array[String]): Unit = {
println(java.util.Collections.max(list))
}
diff --git a/test/files/run/json.check b/test/files/run/json.check
deleted file mode 100644
index d4d2b41658..0000000000
--- a/test/files/run/json.check
+++ /dev/null
@@ -1,21 +0,0 @@
-Passed compare: {"name" : "value"}
-Passed compare: {"name" : "va1ue"}
-Passed compare: {"name" : {"name1" : "va1ue1", "name2" : "va1ue2"}}
-Passed parse : {"name" : "\""}
-Passed compare: Map(function -> add_symbol)
-Passed compare: [{"a" : "team"}, {"b" : 52.0}]
-Passed compare: Map()
-Passed compare: List()
-Passed compare: [4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0]
-Passed parse : {"age" : 0.0}
-Passed compare: {"name" : "va1ue"}
-Passed compare: {"name" : {"name1" : "va1ue1", "name2" : "va1ue2"}}
-Passed compare: [4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0]
-Passed compare: {"\u006e\u0061\u006d\u0065" : "\u0076\u0061\u006c"}
-
-Passed compare: Map(firstName -> John, lastName -> Smith, address -> Map(streetAddress -> 21 2nd Street, city -> New York, state -> NY, postalCode -> 10021.0), phoneNumbers -> List(212 732-1234, 646 123-4567))
-
-Passed parse : {"addresses" : [{"format" : "us", "type" : "work", "value" : "1234 Main StnSpringfield, TX 78080-1216"}, {"format" : "us", "type" : "home", "value" : "5678 Main StnSpringfield, TX 78080-1316"}], "emailaddrs" : [{"type" : "work", "value" : "kelly@seankelly.biz"}, {"pref" : 1.0, "type" : "home", "value" : "kelly@seankelly.tv"}], "fullname" : "Sean Kelly", "org" : "SK Consulting", "telephones" : [{"pref" : 1.0, "type" : "work", "value" : "+1 214 555 1212"}, {"type" : "fax", "value" : "+1 214 555 1213"}, {"type" : "mobile", "value" : "+1 214 555 1214"}], "urls" : [{"type" : "work", "value" : "http:\/\/seankelly.biz\/"}, {"type" : "home", "value" : "http:\/\/seankelly.tv\/"}]}
-
-Passed parse : {"web-app" : {"servlet" : [{"init-param" : {"cachePackageTagsRefresh" : 60.0, "cachePackageTagsStore" : 200.0, "cachePackageTagsTrack" : 200.0, "cachePagesDirtyRead" : 10.0, "cachePagesRefresh" : 10.0, "cachePagesStore" : 100.0, "cachePagesTrack" : 200.0, "cacheTemplatesRefresh" : 15.0, "cacheTemplatesStore" : 50.0, "cacheTemplatesTrack" : 100.0, "configGlossary:adminEmail" : "ksm@pobox.com", "configGlossary:installationAt" : "Philadelphia, PA", "configGlossary:poweredBy" : "Cofax", "configGlossary:poweredByIcon" : "\/images\/cofax.gif", "configGlossary:staticPath" : "\/content\/static", "dataStoreClass" : "org.cofax.SqlDataStore", "dataStoreConnUsageLimit" : 100.0, "dataStoreDriver" : "com.microsoft.jdbc.sqlserver.SQLServerDriver", "dataStoreInitConns" : 10.0, "dataStoreLogFile" : "\/usr\/local\/tomcat\/logs\/datastore.log", "dataStoreLogLevel" : "debug", "dataStoreMaxConns" : 100.0, "dataStoreName" : "cofax", "dataStorePassword" : "dataStoreTestQuery", "dataStoreTestQuery" : "SET NOCOUNT ON;select test='test';", "dataStoreUrl" : "jdbc:microsoft:sqlserver:\/\/LOCALHOST:1433;DatabaseName=goon", "dataStoreUser" : "sa", "defaultFileTemplate" : "articleTemplate.htm", "defaultListTemplate" : "listTemplate.htm", "jspFileTemplate" : "articleTemplate.jsp", "jspListTemplate" : "listTemplate.jsp", "maxUrlLength" : 500.0, "redirectionClass" : "org.cofax.SqlRedirection", "searchEngineFileTemplate" : "forSearchEngines.htm", "searchEngineListTemplate" : "forSearchEnginesList.htm", "searchEngineRobotsDb" : "WEB-INF\/robots.db", "templateLoaderClass" : "org.cofax.FilesTemplateLoader", "templateOverridePath" : "", "templatePath" : "templates", "templateProcessorClass" : "org.cofax.WysiwygTemplate", "useDataStore" : true, "useJSP" : false}, "servlet-class" : "org.cofax.cds.CDSServlet", "servlet-name" : "cofaxCDS"}, {"init-param" : {"mailHost" : "mail1", "mailHostOverride" : "mail2"}, "servlet-class" : "org.cofax.cds.EmailServlet", "servlet-name" : "cofaxEmail"}, {"servlet-class" : "org.cofax.cds.AdminServlet", "servlet-name" : "cofaxAdmin"}, {"servlet-class" : "org.cofax.cds.FileServlet", "servlet-name" : "fileServlet"}, {"init-param" : {"adminGroupID" : 4.0, "betaServer" : true, "dataLog" : 1.0, "dataLogLocation" : "\/usr\/local\/tomcat\/logs\/dataLog.log", "dataLogMaxSize" : "", "fileTransferFolder" : "\/usr\/local\/tomcat\/webapps\/content\/fileTransferFolder", "log" : 1.0, "logLocation" : "\/usr\/local\/tomcat\/logs\/CofaxTools.log", "logMaxSize" : "", "lookInContext" : 1.0, "removePageCache" : "\/content\/admin\/remove?cache=pages&id=", "removeTemplateCache" : "\/content\/admin\/remove?cache=templates&id=", "templatePath" : "toolstemplates\/"}, "servlet-class" : "org.cofax.cms.CofaxToolsServlet", "servlet-name" : "cofaxTools"}], "servlet-mapping" : {"cofaxAdmin" : "\/admin\/*", "cofaxCDS" : "\/", "cofaxEmail" : "\/cofaxutil\/aemail\/*", "cofaxTools" : "\/tools\/*", "fileServlet" : "\/static\/*"}, "taglib" : {"taglib-location" : "\/WEB-INF\/tlds\/cofax.tld", "taglib-uri" : "cofax.tld"}}}
-
diff --git a/test/files/run/json.scala b/test/files/run/json.scala
deleted file mode 100644
index a81f12564c..0000000000
--- a/test/files/run/json.scala
+++ /dev/null
@@ -1,283 +0,0 @@
-import scala.util.parsing.json._
-import scala.collection.immutable.TreeMap
-
-object Test extends App {
- /* This method converts parsed JSON back into real JSON notation with objects in
- * sorted-key order. Not required by the spec, but it allows us to do a stable
- * toString comparison. */
- def jsonToString(in : Any) : String = in match {
- case l : List[_] => "[" + l.map(jsonToString).mkString(", ") + "]"
- case m : Map[String,_] => "{" + m.iterator.toList
- .sortWith({ (x,y) => x._1 < y._1 })
- .map({ case (k,v) => "\"" + k + "\": " + jsonToString(v) })
- .mkString(", ") + "}"
- case s : String => "\"" + s + "\""
- case x => x.toString
- }
-
- /*
- * This method takes input JSON values and sorts keys on objects.
- */
- def sortJSON(in : Any) : Any = in match {
- case l : List[_] => l.map(sortJSON)
- case m : Map[String,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*)
- // For the object versions, sort their contents, ugly casts and all...
- case JSONObject(data) => JSONObject(sortJSON(data).asInstanceOf[Map[String,Any]])
- case JSONArray(data) => JSONArray(sortJSON(data).asInstanceOf[List[Any]])
- case x => x
- }
-
- // For this one, just parsing should be considered a pass
- def printJSON(given : String) {
- JSON parseRaw given match {
- case None => println("Parse failed for \"%s\"".format(given))
- case Some(parsed) => println("Passed parse : " + sortJSON(parsed))
- }
- }
-
- // For this usage, do a raw parse (to JSONObject/JSONArray)
- def printJSON(given : String, expected : JSONType) {
- printJSON(given, JSON.parseRaw, expected)
- }
-
- // For this usage, do a raw parse (to JSONType and subclasses)
- def printJSONFull(given : String, expected : Any) {
- printJSON(given, JSON.parseFull, expected)
- }
-
- // For this usage, do configurable parsing so that you can do raw if desired
- def printJSON[T](given : String, parser : String => T, expected : Any) {
- parser(given) match {
- case None => println("Parse failed for \"%s\"".format(given))
- case Some(parsed) => if (parsed == expected) {
- println("Passed compare: " + parsed)
- } else {
- val eStr = sortJSON(expected).toString
- val pStr = sortJSON(parsed).toString
- stringDiff(eStr,pStr)
- }
- }
- }
-
- def stringDiff (expected : String, actual : String) {
- if (expected != actual) {
- // Figure out where the Strings differ and generate a marker
- val mismatchPosition = expected.toList.zip(actual.toList).indexWhere({case (x,y) => x != y}) match {
- case -1 => Math.min(expected.length, actual.length)
- case x => x
- }
- val reason = (" " * mismatchPosition) + "^"
- println("Expected: %s\nGot : %s \n %s".format(expected, actual, reason))
-
- } else {
- println("Passed compare: " + actual)
- }
- }
-
-
- // The library should differentiate between lower case "l" and number "1" (ticket #136)
- printJSON("{\"name\" : \"value\"}", JSONObject(Map("name" -> "value")))
- printJSON("{\"name\" : \"va1ue\"}", JSONObject(Map("name" -> "va1ue")))
- printJSON("{\"name\" : { \"name1\" : \"va1ue1\", \"name2\" : \"va1ue2\" } }",
- JSONObject(Map("name" -> JSONObject(Map("name1" -> "va1ue1", "name2" -> "va1ue2")))))
-
- // Unicode escapes should be handled properly
- printJSON("{\"name\" : \"\\u0022\"}")
-
- // The library should return a map for JSON objects (ticket #873)
- printJSONFull("{\"function\" : \"add_symbol\"}", Map("function" -> "add_symbol"))
-
- // The library should recurse into arrays to find objects (ticket #2207)
- printJSON("[{\"a\" : \"team\"},{\"b\" : 52}]", JSONArray(List(JSONObject(Map("a" -> "team")), JSONObject(Map("b" -> 52.0)))))
-
- // The library should differentiate between empty maps and lists (ticket #3284)
- printJSONFull("{}", Map())
- printJSONFull("[]", List())
-
- // Lists should be returned in the same order as specified
- printJSON("[4,1,3,2,6,5,8,7]", JSONArray(List[Double](4,1,3,2,6,5,8,7)))
-
- // Additional tests
- printJSON("{\"age\": 0}")
-
- // The library should do a proper toString representation using default and custom renderers (ticket #3605)
- stringDiff("{\"name\" : \"va1ue\"}", JSONObject(Map("name" -> "va1ue")).toString)
- stringDiff("{\"name\" : {\"name1\" : \"va1ue1\", \"name2\" : \"va1ue2\"}}",
- JSONObject(Map("name" -> JSONObject(TreeMap("name1" -> "va1ue1", "name2" -> "va1ue2")))).toString)
-
- stringDiff("[4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0]", JSONArray(List[Double](4,1,3,2,6,5,8,7)).toString)
-
- // A test method that escapes all characters in strings
- def escapeEverything (in : Any) : String = in match {
- case s : String => "\"" + s.map(c => "\\u%04x".format(c : Int)).mkString + "\""
- case jo : JSONObject => jo.toString(escapeEverything)
- case ja : JSONArray => ja.toString(escapeEverything)
- case other => other.toString
- }
-
- stringDiff("{\"\\u006e\\u0061\\u006d\\u0065\" : \"\\u0076\\u0061\\u006c\"}", JSONObject(Map("name" -> "val")).toString(escapeEverything))
-
- println
-
- // from http://en.wikipedia.org/wiki/JSON
- val sample1 = """
-{
- "firstName": "John",
- "lastName": "Smith",
- "address": {
- "streetAddress": "21 2nd Street",
- "city": "New York",
- "state": "NY",
- "postalCode": 10021
- },
- "phoneNumbers": [
- "212 732-1234",
- "646 123-4567"
- ]
-}"""
-
- // Should be equivalent to:
- val sample1Obj = Map(
- "firstName" -> "John",
- "lastName" -> "Smith",
- "address" -> Map(
- "streetAddress" -> "21 2nd Street",
- "city" -> "New York",
- "state" -> "NY",
- "postalCode" -> 10021
- ),
- "phoneNumbers"-> List(
- "212 732-1234",
- "646 123-4567"
- )
- )
-
-
- printJSONFull(sample1, sample1Obj)
- println
-
- // from http://www.developer.com/lang/jscript/article.php/3596836
- val sample2 = """
-{
- "fullname": "Sean Kelly",
- "org": "SK Consulting",
- "emailaddrs": [
- {"type": "work", "value": "kelly@seankelly.biz"},
- {"type": "home", "pref": 1, "value": "kelly@seankelly.tv"}
- ],
- "telephones": [
- {"type": "work", "pref": 1, "value": "+1 214 555 1212"},
- {"type": "fax", "value": "+1 214 555 1213"},
- {"type": "mobile", "value": "+1 214 555 1214"}
- ],
- "addresses": [
- {"type": "work", "format": "us",
- "value": "1234 Main StnSpringfield, TX 78080-1216"},
- {"type": "home", "format": "us",
- "value": "5678 Main StnSpringfield, TX 78080-1316"}
- ],
- "urls": [
- {"type": "work", "value": "http://seankelly.biz/"},
- {"type": "home", "value": "http://seankelly.tv/"}
- ]
-}"""
-
- printJSON(sample2)
- println
-
- // from http://json.org/example.html
- val sample3 = """
-{"web-app": {
- "servlet": [
- {
- "servlet-name": "cofaxCDS",
- "servlet-class": "org.cofax.cds.CDSServlet",
- "init-param": {
- "configGlossary:installationAt": "Philadelphia, PA",
- "configGlossary:adminEmail": "ksm@pobox.com",
- "configGlossary:poweredBy": "Cofax",
- "configGlossary:poweredByIcon": "/images/cofax.gif",
- "configGlossary:staticPath": "/content/static",
- "templateProcessorClass": "org.cofax.WysiwygTemplate",
- "templateLoaderClass": "org.cofax.FilesTemplateLoader",
- "templatePath": "templates",
- "templateOverridePath": "",
- "defaultListTemplate": "listTemplate.htm",
- "defaultFileTemplate": "articleTemplate.htm",
- "useJSP": false,
- "jspListTemplate": "listTemplate.jsp",
- "jspFileTemplate": "articleTemplate.jsp",
- "cachePackageTagsTrack": 200,
- "cachePackageTagsStore": 200,
- "cachePackageTagsRefresh": 60,
- "cacheTemplatesTrack": 100,
- "cacheTemplatesStore": 50,
- "cacheTemplatesRefresh": 15,
- "cachePagesTrack": 200,
- "cachePagesStore": 100,
- "cachePagesRefresh": 10,
- "cachePagesDirtyRead": 10,
- "searchEngineListTemplate": "forSearchEnginesList.htm",
- "searchEngineFileTemplate": "forSearchEngines.htm",
- "searchEngineRobotsDb": "WEB-INF/robots.db",
- "useDataStore": true,
- "dataStoreClass": "org.cofax.SqlDataStore",
- "redirectionClass": "org.cofax.SqlRedirection",
- "dataStoreName": "cofax",
- "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver",
- "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon",
- "dataStoreUser": "sa",
- "dataStorePassword": "dataStoreTestQuery",
- "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';",
- "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log",
- "dataStoreInitConns": 10,
- "dataStoreMaxConns": 100,
- "dataStoreConnUsageLimit": 100,
- "dataStoreLogLevel": "debug",
- "maxUrlLength": 500}},
- {
- "servlet-name": "cofaxEmail",
- "servlet-class": "org.cofax.cds.EmailServlet",
- "init-param": {
- "mailHost": "mail1",
- "mailHostOverride": "mail2"}},
- {
- "servlet-name": "cofaxAdmin",
- "servlet-class": "org.cofax.cds.AdminServlet"},
-
- {
- "servlet-name": "fileServlet",
- "servlet-class": "org.cofax.cds.FileServlet"},
- {
- "servlet-name": "cofaxTools",
- "servlet-class": "org.cofax.cms.CofaxToolsServlet",
- "init-param": {
- "templatePath": "toolstemplates/",
- "log": 1,
- "logLocation": "/usr/local/tomcat/logs/CofaxTools.log",
- "logMaxSize": "",
- "dataLog": 1,
- "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log",
- "dataLogMaxSize": "",
- "removePageCache": "/content/admin/remove?cache=pages&id=",
- "removeTemplateCache": "/content/admin/remove?cache=templates&id=",
- "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder",
- "lookInContext": 1,
- "adminGroupID": 4,
- "betaServer": true}}],
- "servlet-mapping": {
- "cofaxCDS": "/",
- "cofaxEmail": "/cofaxutil/aemail/*",
- "cofaxAdmin": "/admin/*",
- "fileServlet": "/static/*",
- "cofaxTools": "/tools/*"},
-
- "taglib": {
- "taglib-uri": "cofax.tld",
- "taglib-location": "/WEB-INF/tlds/cofax.tld"}
- }
-}"""
-
- printJSON(sample3)
- println
-}
diff --git a/test/files/run/jtptest.check b/test/files/run/jtptest.check
deleted file mode 100644
index 95dbd28437..0000000000
--- a/test/files/run/jtptest.check
+++ /dev/null
@@ -1,7 +0,0 @@
-[1.4] parsed: 1.1
-[1.3] parsed: 1.
-[1.3] parsed: .1
-[1.1] failure: string matching regex `(\d+(\.\d*)?|\d*\.\d+)' expected but `!' found
-
-!1
-^
diff --git a/test/files/run/jtptest.scala b/test/files/run/jtptest.scala
deleted file mode 100644
index 4d0eef9153..0000000000
--- a/test/files/run/jtptest.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-
-import scala.util.parsing.combinator.JavaTokenParsers
-import scala.util.parsing.input.CharArrayReader
-
-object TestJavaTokenParsers extends JavaTokenParsers {
-}
-
-object Test {
- import TestJavaTokenParsers._
-
- def main(args : Array[String]) {
- println(decimalNumber(new CharArrayReader("1.1".toCharArray)))
- println(decimalNumber(new CharArrayReader("1.".toCharArray)))
- println(decimalNumber(new CharArrayReader(".1".toCharArray)))
- println(decimalNumber(new CharArrayReader("!1".toCharArray)))
- }
-}
diff --git a/test/files/run/kind-repl-command.check b/test/files/run/kind-repl-command.check
new file mode 100644
index 0000000000..1c292572e6
--- /dev/null
+++ b/test/files/run/kind-repl-command.check
@@ -0,0 +1,28 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> :kind scala.Option
+scala.Option's kind is F[+A]
+
+scala> :k (Int, Int) => Int
+scala.Function2's kind is F[-A1,-A2,+A3]
+
+scala> :k -v Either
+scala.util.Either's kind is F[+A1,+A2]
+* -(+)-> * -(+)-> *
+This is a type constructor: a 1st-order-kinded type.
+
+scala> :k -v scala.collection.generic.ImmutableSortedMapFactory
+scala.collection.generic.ImmutableSortedMapFactory's kind is X[CC[A,B] <: scala.collection.immutable.SortedMap[A,B] with scala.collection.SortedMapLike[A,B,CC[A,B]]]
+(* -> * -> *(scala.collection.immutable.SortedMap[A,B] with scala.collection.SortedMapLike[A,B,CC[A,B]])) -> *
+This is a type constructor that takes type constructor(s): a higher-kinded type.
+
+scala> :k new { def empty = false }
+AnyRef{def empty: Boolean}'s kind is A
+
+scala> :k Nonexisting
+<console>:8: error: not found: value Nonexisting
+ Nonexisting
+ ^
+
+scala>
diff --git a/test/files/run/kind-repl-command.scala b/test/files/run/kind-repl-command.scala
new file mode 100644
index 0000000000..df1fafb667
--- /dev/null
+++ b/test/files/run/kind-repl-command.scala
@@ -0,0 +1,12 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+ |:kind scala.Option
+ |:k (Int, Int) => Int
+ |:k -v Either
+ |:k -v scala.collection.generic.ImmutableSortedMapFactory
+ |:k new { def empty = false }
+ |:k Nonexisting
+ """.stripMargin
+}
diff --git a/test/files/run/kmpSliceSearch.scala b/test/files/run/kmpSliceSearch.scala
index 0f7e052d5f..e72f78bfed 100644
--- a/test/files/run/kmpSliceSearch.scala
+++ b/test/files/run/kmpSliceSearch.scala
@@ -12,7 +12,7 @@ object Test {
}
def main(args: Array[String]) {
val rng = new scala.util.Random(java.lang.Integer.parseInt("kmp",36))
-
+
// Make sure we agree with naive implementation
for (h <- Array(2,5,1000)) {
for (i <- 0 to 100) {
@@ -38,7 +38,7 @@ object Test {
}
}
}
-
+
// Check performance^Wcorrectness of common small test cases
val haystacks = List[Seq[Int]](
Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
@@ -52,8 +52,8 @@ object Test {
List(1,1,1,1,1,2),
5 to 9
)
- (haystacks zip needles) foreach {
- case (hay, nee) =>
+ (haystacks zip needles) foreach {
+ case (hay, nee) =>
println(hay.indexOfSlice(nee,2) + " " + hay.lastIndexOfSlice(nee,13))
}
}
diff --git a/test/files/run/large_class.check b/test/files/run/large_class.check
new file mode 100644
index 0000000000..0585c267ac
--- /dev/null
+++ b/test/files/run/large_class.check
@@ -0,0 +1,3 @@
+newSource1.scala:1: error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Class file too large!
+class BigEnoughToFail {
+ ^
diff --git a/test/files/run/large_class.scala b/test/files/run/large_class.scala
new file mode 100644
index 0000000000..aa486ef8f7
--- /dev/null
+++ b/test/files/run/large_class.scala
@@ -0,0 +1,27 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+// a cold run of partest takes about 15s for this test on my laptop
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp -d " + testOutput.path
+
+ def s(n: Int) = "\""+n+"\""
+
+ override def code
+ = s"""
+ |class BigEnoughToFail {
+ | def m(a: String, b: String, c: String, d: String, e: String, f: String) = null
+ | ${(1 to 5500) map (n => "def f"+n+" = m("+ s(n+10000)+","+
+ s(n+20000)+","+
+ s(n+30000)+","+
+ s(n+40000)+","+
+ s(n+50000)+","+
+ s(n+60000)+")") mkString ";"}
+ |}""".stripMargin.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/lazy-exprs.check b/test/files/run/lazy-exprs.check
index e77d204251..2efb8ceb4a 100644
--- a/test/files/run/lazy-exprs.check
+++ b/test/files/run/lazy-exprs.check
@@ -1,3 +1,11 @@
+lazy-exprs.scala:38: warning: match may not be exhaustive.
+It would fail on the following input: Some((x: String forSome x not in Z1))
+ t match {
+ ^
+lazy-exprs.scala:62: warning: match may not be exhaustive.
+It would fail on the following input: Some((x: String forSome x not in LazyField))
+ t match {
+ ^
forced <z1>
lazy val in scrutinee: ok
forced <z1>
diff --git a/test/files/run/lazy-exprs.scala b/test/files/run/lazy-exprs.scala
index fc724bd10b..204c4b564b 100644
--- a/test/files/run/lazy-exprs.scala
+++ b/test/files/run/lazy-exprs.scala
@@ -2,7 +2,7 @@ object TestExpressions {
def patmatchScrut {
lazy val z1: Option[String] = { println("forced <z1>"); Some("lazy z1") }
-
+
val res = z1 match {
case Some(msg) => msg
case None => "failed"
@@ -17,10 +17,10 @@ object TestExpressions {
def patmatchCase {
val t: Option[String] = Some("test")
val res = t match {
- case Some(msg) =>
+ case Some(msg) =>
lazy val z1 = { println("forced <z1>"); "lazy z1" }
z1
-
+
case None => "failed"
}
print("lazy val in case: ")
@@ -36,9 +36,9 @@ object TestExpressions {
print("lazy val in case: ")
val t: Option[String] = Some("lazy Z1")
t match {
- case Some(Z1) =>
+ case Some(Z1) =>
println("ok")
-
+
case None =>
println("failed")
}
@@ -60,13 +60,13 @@ object TestExpressions {
print("lazy val in pattern: ")
val t: Option[String] = Some("LazyField")
t match {
- case Some(LazyField) =>
+ case Some(LazyField) =>
println("ok")
-
+
case None =>
println("failed")
}
- }
+ }
lazy val (x, y) = ({print("x"); "x"}, {print("y"); "y"})
def testPatLazyVal {
diff --git a/test/files/run/lazy-locals.check b/test/files/run/lazy-locals.check
index d1cc754f2c..9e88a55d18 100644
--- a/test/files/run/lazy-locals.check
+++ b/test/files/run/lazy-locals.check
@@ -1,3 +1,9 @@
+lazy-locals.scala:153: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ {
+ ^
+lazy-locals.scala:159: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ {
+ ^
forced lazy val q
q = 10
forced lazy val t
diff --git a/test/files/run/lazy-locals.scala b/test/files/run/lazy-locals.scala
index aca15d0357..b28b28e35d 100644
--- a/test/files/run/lazy-locals.scala
+++ b/test/files/run/lazy-locals.scala
@@ -59,7 +59,7 @@ object Test extends App {
val sum3 = t00 + t01 + t02 + t03 + t04 + t05 + t06 + t07 + t08 +
t09 + t10 + t11 + t12 + t13 + t14 + t15 + t16 + t17 +
t18 + t19 + t20 + t21 + t22 + t23 + t24 + t25 + t26 +
- t27 + t28 + t29 + t30 + t31
+ t27 + t28 + t29 + t30 + t31
@@ -120,7 +120,7 @@ object Test extends App {
t
}
- /** test recursive method with lazy vals and a all vals forced */
+ /** test recursive method with lazy vals and all vals forced */
def testLazyRecMany(n: Int): Int = {
lazy val t = { println("forced lazy val t at n = " + n); 42 }
if (n > 0) {
@@ -175,18 +175,18 @@ object Test extends App {
// see #1589
object NestedLazyVals {
- lazy val x = {
+ lazy val x = {
lazy val y = { println("forcing y"); 42; }
println("forcing x")
- y
+ y
}
-
+
val x1 = 5 + { lazy val y = 10 ; y }
-
+
println(x)
println(x1)
}
-
+
trait TNestedLazyVals {
lazy val x = { lazy val y = 42; y }
}
diff --git a/test/files/run/lazy-override-run.scala b/test/files/run/lazy-override-run.scala
index d197408775..6016c3c8be 100644
--- a/test/files/run/lazy-override-run.scala
+++ b/test/files/run/lazy-override-run.scala
@@ -20,7 +20,7 @@ object Test extends App {
val b = new B
print("b.x=")
- println(b.x)
+ println(b.x)
print("b.z=")
- println(b.z)
+ println(b.z)
}
diff --git a/test/files/run/lazy-traits.scala b/test/files/run/lazy-traits.scala
index f04c0b8b1f..38207672db 100644
--- a/test/files/run/lazy-traits.scala
+++ b/test/files/run/lazy-traits.scala
@@ -1,5 +1,5 @@
trait A {
- lazy val z1 = {
+ lazy val z1 = {
println("<forced z1>")
"lazy z1"
}
@@ -7,7 +7,7 @@ trait A {
/** Simple class which mixes in one lazy val. */
class Cls extends AnyRef with A {
- override def toString =
+ override def toString =
"z1 = " + z1
}
@@ -18,7 +18,7 @@ class Cls2 extends AnyRef with A {
"lazy z2"
}
- override def toString =
+ override def toString =
"z1 = " + z1 + " z2 = " + z2
}
@@ -34,7 +34,7 @@ class ClsB extends Object with B {
println("<forced zc1>")
"lazy zc1"
}
- override def toString =
+ override def toString =
"z1 = " + z1 + " zb1 = " + zb1 + " zc1 = " + zc1
}
@@ -73,39 +73,39 @@ class OverflownLazyFields extends Object with A {
lazy val zc30 = { println("<forced zc30>"); "lazy zc30" }
lazy val zc31 = { println("<forced zc31>"); "lazy zc31" }
- override def toString =
- "\nzc00 = " + zc00 +
- "\nzc01 = " + zc01 +
- "\nzc02 = " + zc02 +
- "\nzc03 = " + zc03 +
- "\nzc04 = " + zc04 +
- "\nzc05 = " + zc05 +
- "\nzc06 = " + zc06 +
- "\nzc07 = " + zc07 +
- "\nzc08 = " + zc08 +
- "\nzc09 = " + zc09 +
- "\nzc10 = " + zc10 +
- "\nzc11 = " + zc11 +
- "\nzc12 = " + zc12 +
- "\nzc13 = " + zc13 +
- "\nzc14 = " + zc14 +
- "\nzc15 = " + zc15 +
- "\nzc16 = " + zc16 +
- "\nzc17 = " + zc17 +
- "\nzc18 = " + zc18 +
- "\nzc19 = " + zc19 +
- "\nzc20 = " + zc20 +
- "\nzc21 = " + zc21 +
- "\nzc22 = " + zc22 +
- "\nzc23 = " + zc23 +
- "\nzc24 = " + zc24 +
- "\nzc25 = " + zc25 +
- "\nzc26 = " + zc26 +
- "\nzc27 = " + zc27 +
- "\nzc28 = " + zc28 +
- "\nzc29 = " + zc29 +
- "\nzc30 = " + zc30 +
- "\nzc31 = " + zc31 +
+ override def toString =
+ "\nzc00 = " + zc00 +
+ "\nzc01 = " + zc01 +
+ "\nzc02 = " + zc02 +
+ "\nzc03 = " + zc03 +
+ "\nzc04 = " + zc04 +
+ "\nzc05 = " + zc05 +
+ "\nzc06 = " + zc06 +
+ "\nzc07 = " + zc07 +
+ "\nzc08 = " + zc08 +
+ "\nzc09 = " + zc09 +
+ "\nzc10 = " + zc10 +
+ "\nzc11 = " + zc11 +
+ "\nzc12 = " + zc12 +
+ "\nzc13 = " + zc13 +
+ "\nzc14 = " + zc14 +
+ "\nzc15 = " + zc15 +
+ "\nzc16 = " + zc16 +
+ "\nzc17 = " + zc17 +
+ "\nzc18 = " + zc18 +
+ "\nzc19 = " + zc19 +
+ "\nzc20 = " + zc20 +
+ "\nzc21 = " + zc21 +
+ "\nzc22 = " + zc22 +
+ "\nzc23 = " + zc23 +
+ "\nzc24 = " + zc24 +
+ "\nzc25 = " + zc25 +
+ "\nzc26 = " + zc26 +
+ "\nzc27 = " + zc27 +
+ "\nzc28 = " + zc28 +
+ "\nzc29 = " + zc29 +
+ "\nzc30 = " + zc30 +
+ "\nzc31 = " + zc31 +
"\nz1 = " + z1
}
diff --git a/test/files/run/lift-and-unlift.scala b/test/files/run/lift-and-unlift.scala
index a4a5d9502e..9cd85666e8 100644
--- a/test/files/run/lift-and-unlift.scala
+++ b/test/files/run/lift-and-unlift.scala
@@ -5,21 +5,21 @@ object Test {
val evens2: PartialFunction[Int, Int] = {
case x if x % 2 == 0 => x
}
-
+
def main(args: Array[String]): Unit = {
val f1 = evens1 _
val f2 = evens2.lift
-
+
assert(1 to 10 forall (x => f1(x) == f2(x)))
-
+
val f3 = unlift(f1)
val f4 = unlift(f2)
-
+
assert(1 to 10 forall { x =>
if (!f3.isDefinedAt(x)) !f4.isDefinedAt(x)
else f3(x) == f4(x)
})
-
+
assert(f1 eq f3.lift)
assert(f4 eq unlift(f2))
assert(f4 eq evens2)
diff --git a/test/files/run/list_map.scala b/test/files/run/list_map.scala
new file mode 100755
index 0000000000..fba3aae228
--- /dev/null
+++ b/test/files/run/list_map.scala
@@ -0,0 +1,26 @@
+import collection.immutable.ListMap
+
+object Test {
+ def testImmutableMinus() {
+ val empty = ListMap.empty[Int, Int]
+
+ val m0 = ListMap(1 -> 1, 2 -> 2)
+ val m1 = m0 - 3
+ assert (m1 eq m0)
+ val m2 = m0 - 1
+ assert (m2.size == 1)
+ val m3 = m2 - 2
+ assert (m3 eq empty)
+
+ val m4 = ListMap(1 -> 1, 2 -> 2, 3 -> 3)
+ val m5 = m4 - 1
+ assert (m5 == ListMap(2 -> 2, 3 -> 3))
+ assert (m5.toList == (2, 2)::(3, 3)::Nil)
+
+ assert ((empty - 1) eq empty)
+ }
+
+ def main(args: Array[String]) {
+ testImmutableMinus()
+ }
+}
diff --git a/test/files/run/lists-run.scala b/test/files/run/lists-run.scala
index ccfe5bc260..05767b9005 100644
--- a/test/files/run/lists-run.scala
+++ b/test/files/run/lists-run.scala
@@ -2,9 +2,11 @@
*
* @author Stephane Micheloud
*/
+import scala.language.postfixOps
+
object Test {
def main(args: Array[String]) {
- Test_multiset.run() // multiset operations: union, intersect, diff
+ Test_multiset.run() // multiset operations: union, intersect, diff
Test1.run() //count, exists, filter, ..
Test2.run() //#468
Test3.run() //#1691
@@ -54,7 +56,7 @@ object Test_multiset {
assert(List(3, 2) == (vs diff xs), "vs_diff_xs")
assert(isSubListOf(xs filterNot (vs contains), xs diff vs), "xs_subset_vs")
- // tests adapted from Thomas Jung
+ // tests adapted from Thomas Jung
assert({
def sort(zs: List[Int]) = zs sortWith ( _ > _ )
sort(xs intersect ys) == sort(ys intersect xs)
@@ -62,7 +64,7 @@ object Test_multiset {
assert({
def cardinality[A](zs: List[A], e: A): Int = zs count (e == _)
val intersection = xs intersect ys
- xs forall (e => cardinality(intersection, e) == (cardinality(xs, e)
+ xs forall (e => cardinality(intersection, e) == (cardinality(xs, e)
min cardinality(ys, e)))
}, "obey min cardinality")
assert({
@@ -133,7 +135,7 @@ object Test2 {
def run() {
val xs1 = List(1, 2, 3)
val xs2 = List(0)
-
+
val ys1 = xs1 ::: List(4)
assert(List(1, 2, 3, 4) == ys1, "check_:::")
@@ -153,7 +155,7 @@ object Test3 {
List.range(1, 10, 0)
} catch {
case e: IllegalArgumentException => ()
- case _ => throw new Error("List.range(1, 10, 0)")
+ case _: Throwable => throw new Error("List.range(1, 10, 0)")
}
assert(List.range(10, 0, -2) == List(10, 8, 6, 4, 2))
}
diff --git a/test/files/run/literals.check b/test/files/run/literals.check
index f53c879dea..ed7c6ca5b3 100644
--- a/test/files/run/literals.check
+++ b/test/files/run/literals.check
@@ -1,3 +1,4 @@
+warning: there were 5 deprecation warning(s); re-run with -deprecation for details
test '\u0024' == '$' was successful
test '\u005f' == '_' was successful
test 65.asInstanceOf[Char] == 'A' was successful
@@ -6,28 +7,19 @@ test "\0x61\0x62".trim() == "x61\0x62" was successful
test (65 : Byte) == 'A' was successful
-test 01 == 1 was successful
-test 010 == 8 was successful
test 0X01 == 1 was successful
test 0x01 == 1 was successful
test 0x10 == 16 was successful
test 0xa == 10 was successful
test 0x0a == 10 was successful
-test +01 == 1 was successful
-test +010 == 8 was successful
test +0x01 == 1 was successful
test +0x10 == 16 was successful
test +0xa == 10 was successful
test +0x0a == 10 was successful
-test -01 == -1 was successful
-test -010 == -8 was successful
test -0x01 == -1 was successful
test -0x10 == -16 was successful
test -0xa == -10 was successful
test -0x0a == -10 was successful
-test 017777777777 == 2147483647 was successful
-test 020000000000 == -2147483648 was successful
-test 037777777777 == -1 was successful
test 0x7fffffff == 2147483647 was successful
test 0x80000000 == -2147483648 was successful
test 0xffffffff == -1 was successful
@@ -35,17 +27,14 @@ test 0xffffffff == -1 was successful
test 1l == 1L was successful
test 1L == 1l was successful
test 1.asInstanceOf[Long] == 1l was successful
-test 0777777777777777777777L == 9223372036854775807L was successful
-test 01000000000000000000000L == -9223372036854775808L was successful
-test 01777777777777777777777L == -1L was successful
test 0x7fffffffffffffffL == 9223372036854775807L was successful
test 0x8000000000000000L == -9223372036854775808L was successful
test 0xffffffffffffffffL == -1L was successful
test 1e1f == 10.0f was successful
-test 2.f == 2.0f was successful
test .3f == 0.3f was successful
test 0f == 0.0f was successful
+test 01.23f == 1.23f was successful
test 3.14f == 3.14f was successful
test 6.022e23f == 6.022e23f was successful
test 09f == 9.0f was successful
@@ -53,11 +42,11 @@ test 1.asInstanceOf[Float] == 1.0 was successful
test 1l.asInstanceOf[Float] == 1.0 was successful
test 1e1 == 10.0 was successful
-test 2. == 2.0 was successful
-test 2.d == 2.0 was successful
test .3 == 0.3 was successful
test 0.0 == 0.0 was successful
test 0d == 0.0 was successful
+test 01.23 == 1.23 was successful
+test 01.23d == 1.23d was successful
test 3.14 == 3.14 was successful
test 1e-9d == 1.0e-9 was successful
test 1e137 == 1.0e137 was successful
diff --git a/test/files/run/literals.scala b/test/files/run/literals.scala
index 32bc29fda8..5f23e6b492 100644
--- a/test/files/run/literals.scala
+++ b/test/files/run/literals.scala
@@ -47,32 +47,22 @@ object Test {
println
// int
- check_success("01 == 1", 01, 1)
- check_success("010 == 8", 010, 8)
check_success("0X01 == 1", 0X01, 1)
check_success("0x01 == 1", 0x01, 1)
check_success("0x10 == 16", 0x10, 16)
check_success("0xa == 10", 0xa, 10)
check_success("0x0a == 10", 0x0a, 10)
- check_success("+01 == 1", +01, 1)
- check_success("+010 == 8", +010, 8)
check_success("+0x01 == 1", +0x01, 1)
check_success("+0x10 == 16", +0x10, 16)
check_success("+0xa == 10", +0xa, 10)
check_success("+0x0a == 10", +0x0a, 10)
- check_success("-01 == -1", -01, -1)
- check_success("-010 == -8", -010, -8)
check_success("-0x01 == -1", -0x01, -1)
check_success("-0x10 == -16", -0x10, -16)
check_success("-0xa == -10", -0xa, -10)
check_success("-0x0a == -10", -0x0a, -10)
- check_success("017777777777 == 2147483647", 017777777777, 2147483647)
- check_success("020000000000 == -2147483648", 020000000000, -2147483648)
- check_success("037777777777 == -1", 037777777777, -1)
-
check_success("0x7fffffff == 2147483647", 0x7fffffff, 2147483647)
check_success("0x80000000 == -2147483648", 0x80000000, -2147483648)
check_success("0xffffffff == -1", 0xffffffff, -1)
@@ -84,13 +74,6 @@ object Test {
check_success("1L == 1l", 1L, 1l)
check_success("1.asInstanceOf[Long] == 1l", 1.asInstanceOf[Long], 1l)
- check_success("0777777777777777777777L == 9223372036854775807L",
- 0777777777777777777777L, 9223372036854775807L)
- check_success("01000000000000000000000L == -9223372036854775808L",
- 01000000000000000000000L, -9223372036854775808L)
- check_success("01777777777777777777777L == -1L",
- 01777777777777777777777L, -1L)
-
check_success("0x7fffffffffffffffL == 9223372036854775807L",
0x7fffffffffffffffL, 9223372036854775807L)
check_success("0x8000000000000000L == -9223372036854775808L",
@@ -105,9 +88,9 @@ object Test {
// float
check_success("1e1f == 10.0f", 1e1f, 10.0f)
- check_success("2.f == 2.0f", 2.f, 2.0f)
check_success(".3f == 0.3f", .3f, 0.3f)
check_success("0f == 0.0f", 0f, 0.0f)
+ check_success("01.23f == 1.23f", 01.23f, 1.23f)
check_success("3.14f == 3.14f", 3.14f, 3.14f)
check_success("6.022e23f == 6.022e23f", 6.022e23f, 6.022e23f)
check_success("09f == 9.0f", 09f, 9.0f)
@@ -118,11 +101,11 @@ object Test {
// double
check_success("1e1 == 10.0", 1e1, 10.0)
- check_success("2. == 2.0", 2., 2.0)
- check_success("2.d == 2.0", 2.d, 2.0)
check_success(".3 == 0.3", .3, 0.3)
check_success("0.0 == 0.0", 0.0, 0.0)
check_success("0d == 0.0", 0d, 0.0)
+ check_success("01.23 == 1.23", 01.23, 1.23)
+ check_success("01.23d == 1.23d", 01.23d, 1.23d)
check_success("3.14 == 3.14", 3.14, 3.14)
check_success("1e-9d == 1.0e-9", 1e-9d, 1.0e-9)
check_success("1e137 == 1.0e137", 1e137, 1.0e137)
diff --git a/test/files/run/longmap.scala b/test/files/run/longmap.scala
new file mode 100644
index 0000000000..1f18eebd31
--- /dev/null
+++ b/test/files/run/longmap.scala
@@ -0,0 +1,8 @@
+object Test extends App{
+ import scala.collection.immutable.LongMap;
+
+ val it = LongMap(8L -> 2, 11L -> 3, 1L -> 2, 7L -> 13);
+
+ assert(it.firstKey == 1L);
+ assert(it.lastKey == 11L);
+}
diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check
index 3461d1bf6b..f76579412e 100644
--- a/test/files/run/lub-visibility.check
+++ b/test/files/run/lub-visibility.check
@@ -1,14 +1,11 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> // should infer List[scala.collection.immutable.Seq[Nothing]]
scala> // but reverted that for SI-5534.
scala> val x = List(List(), Vector())
-x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq{def dropRight(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def takeRight(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def drop(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def take(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]}]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.Ab...
-scala>
+x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing] with java.io.Serializable] = List(List(), Vector())
scala>
diff --git a/test/files/run/macro-abort-fresh.check b/test/files/run/macro-abort-fresh.check
index 75ad5e79f8..5064b96eef 100644
--- a/test/files/run/macro-abort-fresh.check
+++ b/test/files/run/macro-abort-fresh.check
@@ -1,6 +1,6 @@
-$1$
-qwe1
-qwe2
-reflective compilation has failed:
+fresh$macro$1
+qwe$macro$2
+qwe$macro$3
+reflective compilation has failed:
blargh
diff --git a/test/files/run/macro-abort-fresh/Macros_1.scala b/test/files/run/macro-abort-fresh/Macros_1.scala
index af1e292588..2b03512efb 100644
--- a/test/files/run/macro-abort-fresh/Macros_1.scala
+++ b/test/files/run/macro-abort-fresh/Macros_1.scala
@@ -1,11 +1,11 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Impls {
def impl(c: Context) = {
import c.universe._
println(c.fresh())
println(c.fresh("qwe"))
- println(c.fresh(newTypeName("qwe")))
+ println(c.fresh(TypeName("qwe")))
c.abort(NoPosition, "blargh")
}
}
diff --git a/test/files/run/macro-abort-fresh/Test_2.scala b/test/files/run/macro-abort-fresh/Test_2.scala
index 0b9986e9f6..61f0bdfadc 100644
--- a/test/files/run/macro-abort-fresh/Test_2.scala
+++ b/test/files/run/macro-abort-fresh/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val tree = Select(Ident(TermName("Macros")), TermName("foo"))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-auto-duplicate/Macros_1.scala b/test/files/run/macro-auto-duplicate/Macros_1.scala
index e3df05ba50..2c910e6af7 100644
--- a/test/files/run/macro-auto-duplicate/Macros_1.scala
+++ b/test/files/run/macro-auto-duplicate/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
object Macros {
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 646634c972..fc75b99ef2 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
@@ -1,21 +1,21 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
- def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
- def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala
index aa1e52e4aa..73a5a971a4 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
@@ -1,21 +1,21 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
- def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
- def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
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 061aa2d4a3..0be915c119 100644
--- a/test/files/run/macro-basic-mamd-mi/Impls_1.scala
+++ b/test/files/run/macro-basic-mamd-mi/Impls_1.scala
@@ -1,19 +1,19 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
}
- def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
}
- def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-blackbox-materialization.check b/test/files/run/macro-blackbox-materialization.check
new file mode 100644
index 0000000000..7165b734ac
--- /dev/null
+++ b/test/files/run/macro-blackbox-materialization.check
@@ -0,0 +1,3 @@
+C(Int)
+C(String)
+C(Nothing)
diff --git a/test/files/run/macro-blackbox-materialization/Macros_1.scala b/test/files/run/macro-blackbox-materialization/Macros_1.scala
new file mode 100644
index 0000000000..ea8d1bed14
--- /dev/null
+++ b/test/files/run/macro-blackbox-materialization/Macros_1.scala
@@ -0,0 +1,16 @@
+// For the full version of the test, take a look at run/t5923a
+
+import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+case class C[T](t: String)
+object C {
+ implicit def foo[T]: C[T] = macro Macros.impl[T]
+}
+
+object Macros {
+ def impl[T: c.WeakTypeTag](c: Context) = {
+ import c.universe._
+ reify(C[T](c.literal(weakTypeOf[T].toString).splice))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-blackbox-materialization/Test_2.scala b/test/files/run/macro-blackbox-materialization/Test_2.scala
new file mode 100644
index 0000000000..001ff9aea8
--- /dev/null
+++ b/test/files/run/macro-blackbox-materialization/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ println(implicitly[C[Int]])
+ println(implicitly[C[String]])
+ println(implicitly[C[Nothing]])
+} \ 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 0ca0be5a48..d46af4952d 100644
--- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala
+++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala
@@ -1,12 +1,16 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.{Context => BlackboxContext}
+import scala.reflect.macros.whitebox.{Context => WhiteboxContext}
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = x
+ def foo(c: BlackboxContext)(x: c.Expr[Int]) = x
- def refToFoo(dummy: Int) = macro refToFoo_impl
- def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = {
+ def refToFoo(dummy: Int): Int = macro refToFoo_impl
+ def refToFoo_impl(c: WhiteboxContext)(dummy: c.Expr[Int]) = {
import c.universe._
- val body = Select(Ident(newTermName("Impls")), newTermName("foo"))
+ val body = Select(Ident(TermName("Impls")), TermName("foo"))
+ val global = c.universe.asInstanceOf[scala.tools.nsc.Global]
+ global.analyzer.markMacroImplRef(body.asInstanceOf[global.Tree])
c.Expr[Int](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala
index b589d4be03..486e1de090 100644
--- a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala
+++ b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.language.experimental.macros
object Macros {
- def foo(x: Int) = macro Impls.refToFoo(42)
+ def foo(x: Int): Int = macro Impls.refToFoo(42)
}
object Test extends App {
diff --git a/test/files/run/macro-bundle-context-alias.check b/test/files/run/macro-bundle-context-alias.check
new file mode 100644
index 0000000000..55e4dfcf92
--- /dev/null
+++ b/test/files/run/macro-bundle-context-alias.check
@@ -0,0 +1,4 @@
+C
+C
+C
+C
diff --git a/test/files/run/macro-bundle-context-alias/Macros_1.scala b/test/files/run/macro-bundle-context-alias/Macros_1.scala
new file mode 100644
index 0000000000..354c5e0d92
--- /dev/null
+++ b/test/files/run/macro-bundle-context-alias/Macros_1.scala
@@ -0,0 +1,38 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.{Context => BlackboxContext}
+import scala.reflect.macros.whitebox.{Context => WhiteboxContext}
+
+object Module {
+ type BBC = BlackboxContext
+ type RBBC = BBC { type PrefixType = C }
+ type WBC = WhiteboxContext
+ type RWBC = WBC { type PrefixType = C }
+
+ class BlackboxBundle(val c: BBC) {
+ import c.universe._
+ def impl = q"${c.prefix}"
+ }
+
+ class RefinedBlackboxBundle(val c: RBBC) {
+ import c.universe._
+ def impl = reify(c.prefix.splice)
+ }
+
+ class WhiteboxBundle(val c: WBC) {
+ import c.universe._
+ def impl = q"${c.prefix}"
+ }
+
+ class RefinedWhiteboxBundle(val c: RWBC) {
+ import c.universe._
+ def impl = reify(c.prefix.splice)
+ }
+}
+
+class C {
+ def blackbox: C = macro Module.BlackboxBundle.impl
+ def refinedBlackbox: C = macro Module.RefinedBlackboxBundle.impl
+ def whitebox: C = macro Module.WhiteboxBundle.impl
+ def refinedWhitebox: C = macro Module.RefinedWhiteboxBundle.impl
+ override def toString = "C"
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-context-alias/Test_2.scala b/test/files/run/macro-bundle-context-alias/Test_2.scala
new file mode 100644
index 0000000000..de499cc111
--- /dev/null
+++ b/test/files/run/macro-bundle-context-alias/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ println(new C().blackbox)
+ println(new C().refinedBlackbox)
+ println(new C().whitebox)
+ println(new C().refinedWhitebox)
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-context-refinement.check b/test/files/run/macro-bundle-context-refinement.check
new file mode 100644
index 0000000000..10f9ebb617
--- /dev/null
+++ b/test/files/run/macro-bundle-context-refinement.check
@@ -0,0 +1,2 @@
+C
+C
diff --git a/test/files/run/macro-bundle-context-refinement/Macros_1.scala b/test/files/run/macro-bundle-context-refinement/Macros_1.scala
new file mode 100644
index 0000000000..d3a5d179c6
--- /dev/null
+++ b/test/files/run/macro-bundle-context-refinement/Macros_1.scala
@@ -0,0 +1,19 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.{Context => BlackboxContext}
+import scala.reflect.macros.whitebox.{Context => WhiteboxContext}
+
+class BlackboxBundle(val c: BlackboxContext { type PrefixType = C }) {
+ import c.universe._
+ def impl = reify(c.prefix.splice)
+}
+
+class WhiteboxBundle(val c: WhiteboxContext { type PrefixType = C }) {
+ import c.universe._
+ def impl = reify(c.prefix.splice)
+}
+
+class C {
+ def blackbox: C = macro BlackboxBundle.impl
+ def whitebox: C = macro WhiteboxBundle.impl
+ override def toString = "C"
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-context-refinement/Test_2.scala b/test/files/run/macro-bundle-context-refinement/Test_2.scala
new file mode 100644
index 0000000000..43d641adeb
--- /dev/null
+++ b/test/files/run/macro-bundle-context-refinement/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ println(new C().blackbox)
+ println(new C().whitebox)
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check
new file mode 100644
index 0000000000..4a0b421606
--- /dev/null
+++ b/test/files/run/macro-bundle-repl.check
@@ -0,0 +1,24 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> import scala.language.experimental.macros
+import scala.language.experimental.macros
+
+scala> import scala.reflect.macros.blackbox.Context
+import scala.reflect.macros.blackbox.Context
+
+scala> class Bar(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl
+defined class Bar
+defined term macro bar: Unit
+
+scala> bar
+
+scala> class Foo(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
+defined class Foo
+
+scala> def foo: Unit = macro Foo.impl
+defined term macro foo: Unit
+
+scala> foo
+
+scala>
diff --git a/test/files/run/macro-bundle-repl.scala b/test/files/run/macro-bundle-repl.scala
new file mode 100644
index 0000000000..8084418454
--- /dev/null
+++ b/test/files/run/macro-bundle-repl.scala
@@ -0,0 +1,13 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+class Bar(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl
+bar
+class Foo(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
+def foo: Unit = macro Foo.impl
+foo
+ """
+}
diff --git a/test/files/run/macro-bundle-static.check b/test/files/run/macro-bundle-static.check
new file mode 100644
index 0000000000..37c8eaf27a
--- /dev/null
+++ b/test/files/run/macro-bundle-static.check
@@ -0,0 +1,6 @@
+()
+Int
+()
+true
+IntInt
+true
diff --git a/test/files/run/macro-bundle-static/Impls_Macros_1.scala b/test/files/run/macro-bundle-static/Impls_Macros_1.scala
new file mode 100644
index 0000000000..0142e5d945
--- /dev/null
+++ b/test/files/run/macro-bundle-static/Impls_Macros_1.scala
@@ -0,0 +1,30 @@
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+
+object Enclosing {
+ class Impl(val c: Context) {
+ def mono = { import c.universe._; c.Expr[Unit](q"()") }
+ def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") }
+ def weird = macro mono
+ }
+}
+
+object Macros {
+ def mono = macro Enclosing.Impl.mono
+ def poly[T] = macro Enclosing.Impl.poly[T]
+}
+
+package pkg {
+ object Enclosing {
+ class Impl(val c: Context) {
+ def mono = { import c.universe._; c.Expr[Boolean](q"true") }
+ def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + c.weakTypeOf[T].toString}") }
+ def weird = macro mono
+ }
+ }
+
+ object Macros {
+ def mono = macro Enclosing.Impl.mono
+ def poly[T] = macro Enclosing.Impl.poly[T]
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-static/Test_2.scala b/test/files/run/macro-bundle-static/Test_2.scala
new file mode 100644
index 0000000000..e35260cdce
--- /dev/null
+++ b/test/files/run/macro-bundle-static/Test_2.scala
@@ -0,0 +1,8 @@
+object Test extends App {
+ println(Macros.mono)
+ println(Macros.poly[Int])
+ println(new Enclosing.Impl(???).weird)
+ println(pkg.Macros.mono)
+ println(pkg.Macros.poly[Int])
+ println(new pkg.Enclosing.Impl(???).weird)
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-toplevel.check b/test/files/run/macro-bundle-toplevel.check
new file mode 100644
index 0000000000..37c8eaf27a
--- /dev/null
+++ b/test/files/run/macro-bundle-toplevel.check
@@ -0,0 +1,6 @@
+()
+Int
+()
+true
+IntInt
+true
diff --git a/test/files/run/macro-declared-in-annotation.flags b/test/files/run/macro-bundle-toplevel.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-annotation.flags
+++ b/test/files/run/macro-bundle-toplevel.flags
diff --git a/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
new file mode 100644
index 0000000000..6fd7be3b25
--- /dev/null
+++ b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.blackbox.Context
+
+class Impl(val c: Context) {
+ def mono = { import c.universe._; c.Expr[Unit](q"()") }
+ def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") }
+ def weird = macro mono
+}
+
+object Macros {
+ def mono = macro Impl.mono
+ def poly[T] = macro Impl.poly[T]
+}
+
+package pkg {
+ class Impl(val c: Context) {
+ def mono = { import c.universe._; c.Expr[Boolean](q"true") }
+ def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + c.weakTypeOf[T].toString}") }
+ def weird = macro mono
+ }
+
+ object Macros {
+ def mono = macro Impl.mono
+ def poly[T] = macro Impl.poly[T]
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-toplevel/Test_2.scala b/test/files/run/macro-bundle-toplevel/Test_2.scala
new file mode 100644
index 0000000000..195fb49262
--- /dev/null
+++ b/test/files/run/macro-bundle-toplevel/Test_2.scala
@@ -0,0 +1,8 @@
+object Test extends App {
+ println(Macros.mono)
+ println(Macros.poly[Int])
+ println(new Impl(???).weird)
+ println(pkg.Macros.mono)
+ println(pkg.Macros.poly[Int])
+ println(new pkg.Impl(???).weird)
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-whitebox-decl.check b/test/files/run/macro-bundle-whitebox-decl.check
new file mode 100644
index 0000000000..37c8eaf27a
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-decl.check
@@ -0,0 +1,6 @@
+()
+Int
+()
+true
+IntInt
+true
diff --git a/test/files/run/macro-bundle-whitebox-decl/Impls_Macros_1.scala b/test/files/run/macro-bundle-whitebox-decl/Impls_Macros_1.scala
new file mode 100644
index 0000000000..5e1b11895d
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-decl/Impls_Macros_1.scala
@@ -0,0 +1,26 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+class Impl(val c: Context) {
+ def mono = { import c.universe._; c.Expr[Unit](q"()") }
+ def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") }
+ def weird = macro mono
+}
+
+object Macros {
+ def mono = macro Impl.mono
+ def poly[T] = macro Impl.poly[T]
+}
+
+package pkg {
+ class Impl(val c: Context) {
+ def mono = { import c.universe._; c.Expr[Boolean](q"true") }
+ def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + c.weakTypeOf[T].toString}") }
+ def weird = macro mono
+ }
+
+ object Macros {
+ def mono = macro Impl.mono
+ def poly[T] = macro Impl.poly[T]
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-whitebox-decl/Test_2.scala b/test/files/run/macro-bundle-whitebox-decl/Test_2.scala
new file mode 100644
index 0000000000..195fb49262
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-decl/Test_2.scala
@@ -0,0 +1,8 @@
+object Test extends App {
+ println(Macros.mono)
+ println(Macros.poly[Int])
+ println(new Impl(???).weird)
+ println(pkg.Macros.mono)
+ println(pkg.Macros.poly[Int])
+ println(new pkg.Impl(???).weird)
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-whitebox-use-raw.check b/test/files/run/macro-bundle-whitebox-use-raw.check
new file mode 100644
index 0000000000..5679c5faba
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-use-raw.check
@@ -0,0 +1,5 @@
+2
+(23,foo,true)
+null
+C2
+42
diff --git a/test/files/run/macro-bundle-whitebox-use-raw/Macros_1.scala b/test/files/run/macro-bundle-whitebox-use-raw/Macros_1.scala
new file mode 100644
index 0000000000..de1863418e
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-use-raw/Macros_1.scala
@@ -0,0 +1,108 @@
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+// whitebox use case #1: return type refinement
+
+class ReturnTypeRefinementBundle(val c: Context) {
+ import c.universe._
+ def impl = {
+ q"""
+ trait Foo {
+ def x = 2
+ }
+ new Foo {}
+ """
+ }
+}
+
+object ReturnTypeRefinement {
+ def foo: Any = macro ReturnTypeRefinementBundle.impl
+}
+
+// whitebox use case #2: fundep materialization
+
+trait FundepMaterialization[T, U] {
+ def to(t : T) : U
+ // def from(u : U) : T
+}
+
+class FundepMaterializationBundle(val c: Context) {
+ import c.universe._
+ import definitions._
+ import Flag._
+
+ def impl[T: c.WeakTypeTag, U: c.WeakTypeTag]: c.Expr[FundepMaterialization[T, U]] = {
+ val sym = c.weakTypeOf[T].typeSymbol
+ if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class")
+ val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+
+ def mkTpt() = {
+ val core = Ident(TupleClass(fields.length) orElse UnitClass)
+ if (fields.length == 0) core
+ else AppliedTypeTree(core, fields map (f => TypeTree(f.info)))
+ }
+
+ def mkFrom() = {
+ if (fields.length == 0) Literal(Constant(Unit))
+ else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim))))
+ }
+
+ val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template(
+ List(AppliedTypeTree(Ident(newTypeName("FundepMaterialization")), List(Ident(sym), mkTpt()))),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))),
+ DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom()))))
+ c.Expr[FundepMaterialization[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List())))
+ }
+}
+
+object FundepMaterialization {
+ implicit def materializeIso[T, U]: FundepMaterialization[T, U] = macro FundepMaterializationBundle.impl[T, U]
+}
+
+// whitebox use case #3: dynamic materialization
+
+trait DynamicMaterialization[T]
+
+class C1(val x: Int)
+class C2(val x: String)
+
+trait LowPriority {
+ implicit def lessSpecific[T]: DynamicMaterialization[T] = null
+}
+
+object DynamicMaterialization extends LowPriority {
+ implicit def moreSpecific[T]: DynamicMaterialization[T] = macro DynamicMaterializationBundle.impl[T]
+}
+
+class DynamicMaterializationBundle(val c: Context) {
+ import c.universe._
+ def impl[T: c.WeakTypeTag] = {
+ val tpe = weakTypeOf[T]
+ if (tpe.members.exists(_.info =:= typeOf[Int]))
+ c.abort(c.enclosingPosition, "I don't like classes that contain integers")
+ q"new DynamicMaterialization[$tpe]{ override def toString = ${tpe.toString} }"
+ }
+}
+
+// whitebox use case #4: extractor macros
+
+object ExtractorMacro {
+ def unapply(x: Int): Any = macro ExtractorBundle.unapplyImpl
+}
+
+class ExtractorBundle(val c: Context) {
+ import c.universe._
+ def unapplyImpl(x: Tree) = {
+ q"""
+ new {
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/macro-bundle-whitebox-use-raw/Test_2.scala b/test/files/run/macro-bundle-whitebox-use-raw/Test_2.scala
new file mode 100644
index 0000000000..3a81700251
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-use-raw/Test_2.scala
@@ -0,0 +1,19 @@
+object Test extends App {
+ println(ReturnTypeRefinement.foo.x)
+
+ case class Foo(i: Int, s: String, b: Boolean)
+ def foo[C, L](c: C)(implicit iso: FundepMaterialization[C, L]): L = iso.to(c)
+ locally {
+ val equiv = foo(Foo(23, "foo", true))
+ def typed[T](t: => T) {}
+ typed[(Int, String, Boolean)](equiv)
+ println(equiv)
+ }
+
+ println(implicitly[DynamicMaterialization[C1]])
+ println(implicitly[DynamicMaterialization[C2]])
+
+ 42 match {
+ case ExtractorMacro(x) => println(x)
+ }
+}
diff --git a/test/files/run/macro-bundle-whitebox-use-refined.check b/test/files/run/macro-bundle-whitebox-use-refined.check
new file mode 100644
index 0000000000..5679c5faba
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-use-refined.check
@@ -0,0 +1,5 @@
+2
+(23,foo,true)
+null
+C2
+42
diff --git a/test/files/run/macro-bundle-whitebox-use-refined/Macros_1.scala b/test/files/run/macro-bundle-whitebox-use-refined/Macros_1.scala
new file mode 100644
index 0000000000..de1863418e
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-use-refined/Macros_1.scala
@@ -0,0 +1,108 @@
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+// whitebox use case #1: return type refinement
+
+class ReturnTypeRefinementBundle(val c: Context) {
+ import c.universe._
+ def impl = {
+ q"""
+ trait Foo {
+ def x = 2
+ }
+ new Foo {}
+ """
+ }
+}
+
+object ReturnTypeRefinement {
+ def foo: Any = macro ReturnTypeRefinementBundle.impl
+}
+
+// whitebox use case #2: fundep materialization
+
+trait FundepMaterialization[T, U] {
+ def to(t : T) : U
+ // def from(u : U) : T
+}
+
+class FundepMaterializationBundle(val c: Context) {
+ import c.universe._
+ import definitions._
+ import Flag._
+
+ def impl[T: c.WeakTypeTag, U: c.WeakTypeTag]: c.Expr[FundepMaterialization[T, U]] = {
+ val sym = c.weakTypeOf[T].typeSymbol
+ if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class")
+ val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+
+ def mkTpt() = {
+ val core = Ident(TupleClass(fields.length) orElse UnitClass)
+ if (fields.length == 0) core
+ else AppliedTypeTree(core, fields map (f => TypeTree(f.info)))
+ }
+
+ def mkFrom() = {
+ if (fields.length == 0) Literal(Constant(Unit))
+ else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim))))
+ }
+
+ val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template(
+ List(AppliedTypeTree(Ident(newTypeName("FundepMaterialization")), List(Ident(sym), mkTpt()))),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))),
+ DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom()))))
+ c.Expr[FundepMaterialization[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List())))
+ }
+}
+
+object FundepMaterialization {
+ implicit def materializeIso[T, U]: FundepMaterialization[T, U] = macro FundepMaterializationBundle.impl[T, U]
+}
+
+// whitebox use case #3: dynamic materialization
+
+trait DynamicMaterialization[T]
+
+class C1(val x: Int)
+class C2(val x: String)
+
+trait LowPriority {
+ implicit def lessSpecific[T]: DynamicMaterialization[T] = null
+}
+
+object DynamicMaterialization extends LowPriority {
+ implicit def moreSpecific[T]: DynamicMaterialization[T] = macro DynamicMaterializationBundle.impl[T]
+}
+
+class DynamicMaterializationBundle(val c: Context) {
+ import c.universe._
+ def impl[T: c.WeakTypeTag] = {
+ val tpe = weakTypeOf[T]
+ if (tpe.members.exists(_.info =:= typeOf[Int]))
+ c.abort(c.enclosingPosition, "I don't like classes that contain integers")
+ q"new DynamicMaterialization[$tpe]{ override def toString = ${tpe.toString} }"
+ }
+}
+
+// whitebox use case #4: extractor macros
+
+object ExtractorMacro {
+ def unapply(x: Int): Any = macro ExtractorBundle.unapplyImpl
+}
+
+class ExtractorBundle(val c: Context) {
+ import c.universe._
+ def unapplyImpl(x: Tree) = {
+ q"""
+ new {
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/macro-bundle-whitebox-use-refined/Test_2.scala b/test/files/run/macro-bundle-whitebox-use-refined/Test_2.scala
new file mode 100644
index 0000000000..3a81700251
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox-use-refined/Test_2.scala
@@ -0,0 +1,19 @@
+object Test extends App {
+ println(ReturnTypeRefinement.foo.x)
+
+ case class Foo(i: Int, s: String, b: Boolean)
+ def foo[C, L](c: C)(implicit iso: FundepMaterialization[C, L]): L = iso.to(c)
+ locally {
+ val equiv = foo(Foo(23, "foo", true))
+ def typed[T](t: => T) {}
+ typed[(Int, String, Boolean)](equiv)
+ println(equiv)
+ }
+
+ println(implicitly[DynamicMaterialization[C1]])
+ println(implicitly[DynamicMaterialization[C2]])
+
+ 42 match {
+ case ExtractorMacro(x) => println(x)
+ }
+}
diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-declared-in-anonymous/Impls_1.scala
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-anonymous/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- c.Expr[Unit](body)
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala b/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala
deleted file mode 100644
index 8bd8c172c9..0000000000
--- a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-object Test extends App {
- val macros = new { def foo = macro Impls.foo }
- macros.foo
-} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-declared-in-block/Impls_1.scala
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-block/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- 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
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-class-class/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- 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
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-class-object/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- 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
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-class/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- c.Expr[Unit](body)
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala b/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala
deleted file mode 100644
index 356029e63e..0000000000
--- a/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-object Test extends App {
- def foo(bar: String = { def foo = macro Impls.foo; foo }) = println(bar)
-
- foo()
- foo("it works")
- foo()
-} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-declared-in-method/Impls_1.scala
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-method/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- 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
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-object-class/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- 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
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-object-object/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- 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
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-object/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- 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
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-package-object/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- 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
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-refinement/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- c.Expr[Unit](body)
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala b/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala
deleted file mode 100644
index f746c2da57..0000000000
--- a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-class Base
-
-object Test extends App {
- val macros = new Base { def foo = macro Impls.foo }
- macros.foo
-} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-declared-in-trait/Impls_1.scala
deleted file mode 100644
index 6f06f6d3f0..0000000000
--- a/test/files/run/macro-declared-in-trait/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx) = {
- import c.{prefix => prefix}
- 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")))))
- c.Expr[Unit](body)
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-def-infer-return-type-a.check b/test/files/run/macro-def-infer-return-type-a.check
deleted file mode 100644
index f70d7bba4a..0000000000
--- a/test/files/run/macro-def-infer-return-type-a.check
+++ /dev/null
@@ -1 +0,0 @@
-42 \ No newline at end of file
diff --git a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala b/test/files/run/macro-def-infer-return-type-a/Impls_1.scala
deleted file mode 100644
index 52c9f9c3e9..0000000000
--- a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = x
-}
diff --git a/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala
deleted file mode 100644
index 60fe9dc1c2..0000000000
--- a/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-object Test extends App {
- def foo(x: Int) = macro Impls.foo
- println(foo(42))
-} \ No newline at end of file
diff --git a/test/files/run/macro-def-infer-return-type-b.check b/test/files/run/macro-def-infer-return-type-b.check
deleted file mode 100644
index ae2dc7a06f..0000000000
--- a/test/files/run/macro-def-infer-return-type-b.check
+++ /dev/null
@@ -1,6 +0,0 @@
-reflective compilation has failed:
-
-exception during macro expansion:
-java.lang.Error: an implementation is missing
- at Impls$.foo(Impls_Macros_1.scala:5)
-
diff --git a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala b/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala
deleted file mode 100644
index 8a0f18c01b..0000000000
--- a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[T](c: Ctx)(x: c.Expr[T]) =
- throw new Error("an implementation is missing")
-}
-
-object Macros {
- def foo[T](x: T) = macro Impls.foo[T]
-} \ No newline at end of file
diff --git a/test/files/run/macro-def-infer-return-type-b/Test_2.scala b/test/files/run/macro-def-infer-return-type-b/Test_2.scala
deleted file mode 100644
index ea0fd4bbff..0000000000
--- a/test/files/run/macro-def-infer-return-type-b/Test_2.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-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(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42))))
- try cm.mkToolBox().eval(tree)
- catch { case ex: Throwable => println(ex.getMessage) }
-}
diff --git a/test/files/run/macro-def-infer-return-type-c.check b/test/files/run/macro-def-infer-return-type-c.check
deleted file mode 100644
index f70d7bba4a..0000000000
--- a/test/files/run/macro-def-infer-return-type-c.check
+++ /dev/null
@@ -1 +0,0 @@
-42 \ No newline at end of file
diff --git a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala b/test/files/run/macro-def-infer-return-type-c/Impls_1.scala
deleted file mode 100644
index 78db67eebf..0000000000
--- a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[T](c: Ctx)(x: c.Expr[T]): c.Expr[T] = x
-}
diff --git a/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala
deleted file mode 100644
index 967d16f6de..0000000000
--- a/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-object Test extends App {
- def foo[T](x: T) = macro Impls.foo[T]
- println(foo(42))
-} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala
deleted file mode 100644
index 3a91e41ff9..0000000000
--- a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-trait Exprs {
- self: Universe =>
-
- class Expr[T]
-}
-
-trait Reifiers {
- self: Universe =>
-
- type Expr[T]
-
- def reify[T](expr: T) = macro Impls.reify[T]
-}
-
-trait Universe extends Exprs with Reifiers
-
-object Impls {
- def reify[T](cc: Ctx{ type PrefixType = Reifiers })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
-}
diff --git a/test/files/run/macro-def-path-dependent-b.check b/test/files/run/macro-def-path-dependent-b.check
deleted file mode 100644
index 7658ad2c24..0000000000
--- a/test/files/run/macro-def-path-dependent-b.check
+++ /dev/null
@@ -1 +0,0 @@
-it works
diff --git a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala
deleted file mode 100644
index cf9f9ebd0e..0000000000
--- a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-trait Exprs {
- self: Universe =>
-
- class Expr[T]
-}
-
-trait Reifiers {
- self: Universe =>
-
-}
-
-trait Universe extends Exprs with Reifiers {
- def reify[T](expr: T) = macro Impls.reify[T]
-}
-
-object Impls {
- def reify[T](cc: Ctx{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
-}
diff --git a/test/files/run/macro-def-path-dependent-c.check b/test/files/run/macro-def-path-dependent-c.check
deleted file mode 100644
index 7658ad2c24..0000000000
--- a/test/files/run/macro-def-path-dependent-c.check
+++ /dev/null
@@ -1 +0,0 @@
-it works
diff --git a/test/files/run/macro-def-path-dependent-d1.check b/test/files/run/macro-def-path-dependent-d1.check
deleted file mode 100644
index 7658ad2c24..0000000000
--- a/test/files/run/macro-def-path-dependent-d1.check
+++ /dev/null
@@ -1 +0,0 @@
-it works
diff --git a/test/files/run/macro-def-path-dependent-d2.check b/test/files/run/macro-def-path-dependent-d2.check
deleted file mode 100644
index 7658ad2c24..0000000000
--- a/test/files/run/macro-def-path-dependent-d2.check
+++ /dev/null
@@ -1 +0,0 @@
-it works
diff --git a/test/files/run/macro-def-path-dependent-d2/Macros_2.scala b/test/files/run/macro-def-path-dependent-d2/Macros_2.scala
deleted file mode 100644
index 65ce4d8bd2..0000000000
--- a/test/files/run/macro-def-path-dependent-d2/Macros_2.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-import scala.reflect.runtime.universe._
-import scala.reflect.macros.Context
-import scala.reflect.api.Universe
-
-object Macros {
- def materializeTypeTag[T](u: Universe)(e: T) = macro Impls.materializeTypeTag_impl[T]
-} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-annotation.check b/test/files/run/macro-def-path-dependent.check
index 7658ad2c24..7658ad2c24 100644
--- a/test/files/run/macro-declared-in-annotation.check
+++ b/test/files/run/macro-def-path-dependent.check
diff --git a/test/files/run/macro-declared-in-anonymous.flags b/test/files/run/macro-def-path-dependent.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-anonymous.flags
+++ b/test/files/run/macro-def-path-dependent.flags
diff --git a/test/files/run/macro-def-path-dependent-a/Test_2.scala b/test/files/run/macro-def-path-dependent/Dummy.scala
index 7dffc5107d..7dffc5107d 100644
--- a/test/files/run/macro-def-path-dependent-a/Test_2.scala
+++ b/test/files/run/macro-def-path-dependent/Dummy.scala
diff --git a/test/files/run/macro-def-path-dependent/Test_1.scala b/test/files/run/macro-def-path-dependent/Test_1.scala
new file mode 100644
index 0000000000..4161a64303
--- /dev/null
+++ b/test/files/run/macro-def-path-dependent/Test_1.scala
@@ -0,0 +1,25 @@
+// NOTE: blocked by SI-8049
+
+// package test1
+//
+// import scala.reflect.macros.blackbox.Context
+//
+// trait Exprs {
+// self: Universe =>
+//
+// class Expr[T]
+// }
+//
+// trait Reifiers {
+// self: Universe =>
+//
+// type Expr[T]
+//
+// def reify[T](expr: T): Expr[T] = macro Impls.reify[T]
+// }
+//
+// trait Universe extends Exprs with Reifiers
+//
+// object Impls {
+// def reify[T](cc: Context{ type PrefixType = Reifiers })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
+// }
diff --git a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_2.scala
index 6cb374d9ba..75a03b54e7 100644
--- a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala
+++ b/test/files/run/macro-def-path-dependent/Test_2.scala
@@ -1,4 +1,6 @@
-import scala.reflect.macros.{Context => Ctx}
+package test2
+
+import scala.reflect.macros.blackbox.Context
trait Exprs {
self: Universe =>
@@ -16,5 +18,5 @@ trait Universe extends Exprs with Reifiers {
}
object Impls {
- def reify[T](cc: Ctx{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
+ def reify[T](cc: Context{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
}
diff --git a/test/files/run/macro-def-path-dependent/Test_3.scala b/test/files/run/macro-def-path-dependent/Test_3.scala
new file mode 100644
index 0000000000..1a5da8200b
--- /dev/null
+++ b/test/files/run/macro-def-path-dependent/Test_3.scala
@@ -0,0 +1,22 @@
+package test3
+
+import scala.reflect.macros.blackbox.Context
+
+trait Exprs {
+ self: Universe =>
+
+ class Expr[T]
+}
+
+trait Reifiers {
+ self: Universe =>
+
+}
+
+trait Universe extends Exprs with Reifiers {
+ def reify[T](expr: T): Expr[T] = macro Impls.reify[T]
+}
+
+object Impls {
+ def reify[T](cc: Context{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
+}
diff --git a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_4.scala
index 69d9708b2a..67cb88ee6f 100644
--- a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala
+++ b/test/files/run/macro-def-path-dependent/Test_4.scala
@@ -1,9 +1,11 @@
+package test4
+
import scala.reflect.runtime.universe._
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import scala.reflect.api.Universe
object Test {
- def materializeTypeTag[T](u: Universe)(e: T) = macro materializeTypeTag_impl[T]
+ def materializeTypeTag[T](u: Universe)(e: T): u.TypeTag[T] = macro materializeTypeTag_impl[T]
def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala b/test/files/run/macro-def-path-dependent/Test_5.scala
index 7fa9c3579e..b518ce864c 100644
--- a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala
+++ b/test/files/run/macro-def-path-dependent/Test_5.scala
@@ -1,5 +1,7 @@
+package test56
+
import scala.reflect.runtime.universe._
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import scala.reflect.api.Universe
object Impls {
diff --git a/test/files/run/macro-def-path-dependent/Test_6.scala b/test/files/run/macro-def-path-dependent/Test_6.scala
new file mode 100644
index 0000000000..a8b50ce7d2
--- /dev/null
+++ b/test/files/run/macro-def-path-dependent/Test_6.scala
@@ -0,0 +1,9 @@
+package test56
+
+import scala.reflect.runtime.universe._
+import scala.reflect.macros.blackbox.Context
+import scala.reflect.api.Universe
+
+object Macros {
+ def materializeTypeTag[T](u: Universe)(e: T): u.TypeTag[T] = macro Impls.materializeTypeTag_impl[T]
+} \ No newline at end of file
diff --git a/test/files/run/macro-default-params.check b/test/files/run/macro-default-params.check
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/test/files/run/macro-default-params.check
@@ -0,0 +1 @@
+0
diff --git a/test/files/run/macro-default-params/Macros_1.scala b/test/files/run/macro-default-params/Macros_1.scala
new file mode 100644
index 0000000000..74588a1cf4
--- /dev/null
+++ b/test/files/run/macro-default-params/Macros_1.scala
@@ -0,0 +1,27 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+object Macros {
+ def id[A]: A = null.asInstanceOf[A]
+
+ def foo: Any = macro impl
+ def impl(c: Context): c.Tree = {
+ import c.universe._
+ import Flag._
+
+ lazy val tpe = TypeTree(typeOf[Int])
+
+ /* If we used this line instead, it would work! */
+ // lazy val tpe = tq"Int"
+
+ lazy val param: ValDef = {
+ val p1 = q"val a: ${tpe.duplicate} = Macros.id[${tpe.duplicate}]"
+ ValDef(Modifiers(DEFAULTPARAM), p1.name, p1.tpt, p1.rhs)
+ }
+
+ q"""
+ class C { def f($param) = a }
+ println(new C().f())
+ """
+ }
+}
diff --git a/test/files/run/macro-def-path-dependent-d1/Test_2.scala b/test/files/run/macro-default-params/Test_2.scala
index 7dffc5107d..5d19639cdd 100644
--- a/test/files/run/macro-def-path-dependent-d1/Test_2.scala
+++ b/test/files/run/macro-default-params/Test_2.scala
@@ -1,3 +1,3 @@
object Test extends App {
- println("it works")
-} \ No newline at end of file
+ Macros.foo
+}
diff --git a/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
index bc4a9fded7..7ac8fccc3a 100644
--- a/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
+++ b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
trait Complex[T]
@@ -10,12 +10,12 @@ object Complex {
def impl[T: c.WeakTypeTag](c: Context): c.Expr[Complex[T]] = {
import c.universe._
val tpe = weakTypeOf[T]
- for (f <- tpe.declarations.collect{case f: TermSymbol if f.isParamAccessor && !f.isMethod => f}) {
- val trecur = appliedType(typeOf[Complex[_]], List(f.typeSignature))
+ for (f <- tpe.decls.collect{case f: TermSymbol if f.isParamAccessor && !f.isMethod => f}) {
+ val trecur = appliedType(typeOf[Complex[_]], List(f.info))
val recur = c.inferImplicitValue(trecur, silent = true)
if (recur == EmptyTree) c.abort(c.enclosingPosition, s"couldn't synthesize $trecur")
}
- c.literalNull
+ c.Expr[Null](Literal(Constant(null)))
}
implicit object ComplexString extends Complex[String]
diff --git a/test/files/run/macro-duplicate.check b/test/files/run/macro-duplicate.check
index e69de29bb2..58781b719a 100644
--- a/test/files/run/macro-duplicate.check
+++ b/test/files/run/macro-duplicate.check
@@ -0,0 +1,3 @@
+Test_2.scala:5: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ Macros.foo
+ ^
diff --git a/test/files/run/macro-duplicate/Impls_Macros_1.scala b/test/files/run/macro-duplicate/Impls_Macros_1.scala
index de81923330..84fb2c5b61 100644
--- a/test/files/run/macro-duplicate/Impls_Macros_1.scala
+++ b/test/files/run/macro-duplicate/Impls_Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl(c: Context) = {
@@ -10,11 +10,11 @@ object Macros {
case Template(_, _, ctor :: defs) =>
val defs1 = defs collect {
case ddef @ DefDef(mods, name, tparams, vparamss, tpt, body) =>
- val future = Select(Select(Select(Ident(newTermName("scala")), newTermName("concurrent")), newTermName("package")), newTermName("future"))
- val Future = Select(Select(Ident(newTermName("scala")), newTermName("concurrent")), newTypeName("Future"))
+ val future = Select(Select(Ident(TermName("scala")), TermName("concurrent")), TermName("Future"))
+ val Future = Select(Select(Ident(TermName("scala")), TermName("concurrent")), TypeName("Future"))
val tpt1 = if (tpt.isEmpty) tpt else AppliedTypeTree(Future, List(tpt))
val body1 = Apply(future, List(body))
- val name1 = newTermName("async" + name.toString.capitalize)
+ val name1 = TermName("async" + name.toString.capitalize)
DefDef(mods, name1, tparams, vparamss, tpt1, body1)
}
Template(Nil, emptyValDef, ctor +: defs ::: defs1)
@@ -26,4 +26,4 @@ object Macros {
}
def foo = macro impl
-} \ No newline at end of file
+}
diff --git a/test/files/run/macro-enclosingowner-detectvar.check b/test/files/run/macro-enclosingowner-detectvar.check
new file mode 100644
index 0000000000..c8f86ec735
--- /dev/null
+++ b/test/files/run/macro-enclosingowner-detectvar.check
@@ -0,0 +1,16 @@
+(true,false,false,false)
+(true,false,false,false)
+(true,false,false,false)
+(true,false,false,false)
+(false,true,false,false)
+(false,true,false,false)
+(false,true,false,false)
+(false,true,false,false)
+(false,false,true,false)
+(false,false,true,false)
+(false,false,true,false)
+(false,false,true,false)
+(false,false,false,true)
+(false,false,false,true)
+(false,false,false,true)
+(false,false,false,true)
diff --git a/test/files/run/macro-enclosingowner-detectvar/Macros_1.scala b/test/files/run/macro-enclosingowner-detectvar/Macros_1.scala
new file mode 100644
index 0000000000..26ed64d8c3
--- /dev/null
+++ b/test/files/run/macro-enclosingowner-detectvar/Macros_1.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ def detectFlags(sym: TermSymbol): String = {
+ (sym.isVal, sym.isVar, !sym.isVal && !sym.isVar && !sym.isLazy, sym.isLazy).toString
+ }
+ q"println(${detectFlags(c.internal.enclosingOwner.asTerm)}); 42"
+ }
+
+ def foo: Int = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-enclosingowner-detectvar/Test_2.scala b/test/files/run/macro-enclosingowner-detectvar/Test_2.scala
new file mode 100644
index 0000000000..58521d9429
--- /dev/null
+++ b/test/files/run/macro-enclosingowner-detectvar/Test_2.scala
@@ -0,0 +1,23 @@
+object Test extends App {
+ val a1 = Macros.foo
+ val a2 = Predef.identity(Predef.identity(Macros.foo))
+ val a3: Int = Macros.foo
+ val a4: Int = Predef.identity(Predef.identity(Macros.foo))
+
+ var b1 = Macros.foo
+ var b2 = Predef.identity(Predef.identity(Macros.foo))
+ var b3: Int = Macros.foo
+ var b4: Int = Predef.identity(Predef.identity(Macros.foo))
+
+ def c1 = Macros.foo
+ def c2 = Predef.identity(Predef.identity(Macros.foo))
+ def c3: Int = Macros.foo
+ def c4: Int = Predef.identity(Predef.identity(Macros.foo))
+ c1; c2; c3; c4;
+
+ lazy val d1 = Macros.foo
+ lazy val d2 = Predef.identity(Predef.identity(Macros.foo))
+ lazy val d3: Int = Macros.foo
+ lazy val d4: Int = Predef.identity(Predef.identity(Macros.foo))
+ d1; d2; d3; d4
+} \ No newline at end of file
diff --git a/test/files/run/macro-enclosingowner-sbt.check b/test/files/run/macro-enclosingowner-sbt.check
new file mode 100644
index 0000000000..3c95698e9a
--- /dev/null
+++ b/test/files/run/macro-enclosingowner-sbt.check
@@ -0,0 +1,16 @@
+a1
+a2
+a3
+a4
+b1
+b2
+b3
+b4
+c1
+c2
+c3
+c4
+d1
+d2
+d3
+d4
diff --git a/test/files/run/macro-enclosingowner-sbt/Macros_1.scala b/test/files/run/macro-enclosingowner-sbt/Macros_1.scala
new file mode 100644
index 0000000000..a98a984861
--- /dev/null
+++ b/test/files/run/macro-enclosingowner-sbt/Macros_1.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ def enclosingName(sym: Symbol): String = {
+ sym.name.toString.stripSuffix(termNames.LOCAL_SUFFIX_STRING)
+ }
+ q"println(${enclosingName(c.internal.enclosingOwner).toString}); 42"
+ }
+
+ def foo: Int = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-enclosingowner-sbt/Test_2.scala b/test/files/run/macro-enclosingowner-sbt/Test_2.scala
new file mode 100644
index 0000000000..58521d9429
--- /dev/null
+++ b/test/files/run/macro-enclosingowner-sbt/Test_2.scala
@@ -0,0 +1,23 @@
+object Test extends App {
+ val a1 = Macros.foo
+ val a2 = Predef.identity(Predef.identity(Macros.foo))
+ val a3: Int = Macros.foo
+ val a4: Int = Predef.identity(Predef.identity(Macros.foo))
+
+ var b1 = Macros.foo
+ var b2 = Predef.identity(Predef.identity(Macros.foo))
+ var b3: Int = Macros.foo
+ var b4: Int = Predef.identity(Predef.identity(Macros.foo))
+
+ def c1 = Macros.foo
+ def c2 = Predef.identity(Predef.identity(Macros.foo))
+ def c3: Int = Macros.foo
+ def c4: Int = Predef.identity(Predef.identity(Macros.foo))
+ c1; c2; c3; c4;
+
+ lazy val d1 = Macros.foo
+ lazy val d2 = Predef.identity(Predef.identity(Macros.foo))
+ lazy val d3: Int = Macros.foo
+ lazy val d4: Int = Predef.identity(Predef.identity(Macros.foo))
+ d1; d2; d3; d4
+} \ No newline at end of file
diff --git a/test/files/run/macro-enclosures.check b/test/files/run/macro-enclosures.check
new file mode 100644
index 0000000000..b6fe7a4a91
--- /dev/null
+++ b/test/files/run/macro-enclosures.check
@@ -0,0 +1,34 @@
+enclosingPackage = package test {
+ object Test extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ def test = Macros.foo
+ }
+}
+enclosingClass = object Test extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ def test = Macros.foo
+}
+enclosingImpl = object Test extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ def test = Macros.foo
+}
+enclosingTemplate = scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ def test = Macros.foo
+}
+enclosingMethod = def test = Macros.foo
+enclosingDef = def test = Macros.foo
+enclosingOwner = method test
+enclosingOwnerChain = List(method test, object Test, package test, package <root>)
diff --git a/test/files/run/macro-declared-in-block.flags b/test/files/run/macro-enclosures.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-block.flags
+++ b/test/files/run/macro-enclosures.flags
diff --git a/test/files/run/macro-enclosures/Impls_Macros_1.scala b/test/files/run/macro-enclosures/Impls_Macros_1.scala
new file mode 100644
index 0000000000..564cdfa68f
--- /dev/null
+++ b/test/files/run/macro-enclosures/Impls_Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ def chain(sym: Symbol): List[Symbol] = sym.owner match {
+ case NoSymbol => sym :: Nil
+ case owner => sym :: chain(owner)
+ }
+ q"""
+ println("enclosingPackage = " + ${c.enclosingPackage.toString})
+ println("enclosingClass = " + ${c.enclosingClass.toString})
+ println("enclosingImpl = " + ${c.enclosingImpl.toString})
+ println("enclosingTemplate = " + ${c.enclosingTemplate.toString})
+ println("enclosingMethod = " + ${c.enclosingMethod.toString})
+ println("enclosingDef = " + ${c.enclosingDef.toString})
+ println("enclosingOwner = " + ${c.internal.enclosingOwner.toString})
+ println("enclosingOwnerChain = " + ${chain(c.internal.enclosingOwner).toString})
+ """
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-enclosures/Test_2.scala b/test/files/run/macro-enclosures/Test_2.scala
new file mode 100644
index 0000000000..779fe5211e
--- /dev/null
+++ b/test/files/run/macro-enclosures/Test_2.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ test.Test.test
+}
+
+package test {
+ object Test {
+ def test = {
+ Macros.foo
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-argument/Macros_1.scala b/test/files/run/macro-expand-implicit-argument/Macros_1.scala
index d9fd5b8cb0..465f313ef2 100644
--- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala
+++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala
@@ -5,7 +5,7 @@ import scala.{specialized => spec}
import language.experimental.macros
import scala.reflect.ClassTag
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def alloc[@spec A:ClassTag](src:Array[A], s1:Int, len:Int) = {
@@ -41,14 +41,14 @@ object Macros {
def const(x:Int) = Literal(Constant(x))
val n = as.length
- val arr = newTermName("arr")
+ val arr = TermName("arr")
- val create = Apply(Select(ct.tree, newTermName("newArray")), List(const(n)))
+ val create = Apply(Select(ct.tree, TermName("newArray")), List(const(n)))
val arrtpe = TypeTree(implicitly[c.WeakTypeTag[Array[A]]].tpe)
val valdef = ValDef(Modifiers(), arr, arrtpe, create)
val updates = (0 until n).map {
- i => Apply(Select(Ident(arr), newTermName("update")), List(const(i), as(i).tree))
+ i => Apply(Select(Ident(arr), TermName("update")), List(const(i), as(i).tree))
}
val exprs = (Seq(valdef) ++ updates ++ Seq(Ident(arr))).toList
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 082e6b2efe..18c97956e4 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
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(x.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(x.tree))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala
index ffb04dc80b..fec914632f 100644
--- a/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Test extends App {
implicit val x = 42
- def foo(implicit x: Int) = macro Impls.foo
+ def foo(implicit x: Int): Unit = macro Impls.foo
foo
} \ 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 cceb038f05..aeceee5a5b 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
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = {
+ def foo(c: Context)(x: c.Expr[String]): c.Expr[Option[Int]] = {
import c.universe._
- val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt"))))
+ val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt"))))
c.Expr[Option[Int]](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala
index 81ebd63c5f..22047eeb36 100644
--- a/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala
@@ -1,4 +1,5 @@
object Macros {
+ import scala.language.implicitConversions
implicit def foo(x: String): Option[Int] = macro Impls.foo
}
@@ -7,4 +8,4 @@ object Test extends App {
println("2": Option[Int])
val s: Int = "2" getOrElse 0
println(s)
-} \ No newline at end of file
+}
diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala
index fa717b2327..fd267d32c4 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
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.universe._
val body = Literal(Constant(2))
c.Expr[Int](body)
diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala
index b91b1016c9..2f21785bae 100644
--- a/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Test extends App {
- implicit def foo = macro Impls.foo
+ implicit def foo: Int = macro Impls.foo
def bar(implicit x: Int) = println(x)
bar
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-macro-is-view.flags b/test/files/run/macro-expand-implicit-macro-is-view.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-implicit-macro-is-view.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ 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 cceb038f05..aeceee5a5b 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
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = {
+ def foo(c: Context)(x: c.Expr[String]): c.Expr[Option[Int]] = {
import c.universe._
- val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt"))))
+ val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt"))))
c.Expr[Option[Int]](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala
index 0ff1fb80ca..0d99f32d7e 100644
--- a/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala
@@ -1,4 +1,7 @@
+
object Macros {
+ import scala.language.experimental.macros
+ import scala.language.implicitConversions
implicit def foo(x: String): Option[Int] = macro Impls.foo
}
@@ -6,4 +9,4 @@ object Test extends App {
import Macros._
def bar[T <% Option[Int]](x: T) = println(x)
println("2")
-} \ No newline at end of file
+}
diff --git a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
index 11e07932c3..9278633c11 100644
--- a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
+++ b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = {
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))
+ val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala b/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala
index fa4504b0ea..54b959983b 100644
--- a/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala
@@ -1,4 +1,4 @@
object Test extends App {
- def foo(x: Int)(y: Int) = macro Impls.foo
+ def foo(x: Int)(y: Int): Unit = macro Impls.foo
foo(40)(2)
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-nullary-generic.check b/test/files/run/macro-expand-nullary-generic.check
index 42976f4baf..0470d239dc 100644
--- a/test/files/run/macro-expand-nullary-generic.check
+++ b/test/files/run/macro-expand-nullary-generic.check
@@ -1,6 +1,6 @@
-it works WeakTypeTag[Int]
-it works WeakTypeTag[Int]
-it works WeakTypeTag[Int]
-it works WeakTypeTag[Int]
-it works WeakTypeTag[Int]
+fooNullary[Int]
+fooEmpty[Int]
+fooEmpty[Int]
+barNullary[Int]
+barEmpty[Int]
kkthxbai
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 1180c83a40..9362d6c17a 100644
--- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala
+++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala
@@ -1,15 +1,15 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl[T: c.WeakTypeTag](c: Ctx) = {
+ def impl[T: c.WeakTypeTag](c: Context)(meth: String) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]]))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(s"$meth[${c.weakTypeOf[T]}]"))))
c.Expr[Unit](body)
}
- def fooNullary[T: c.WeakTypeTag](c: Ctx) = impl[T](c)
- def fooEmpty[T: c.WeakTypeTag](c: Ctx)() = impl[T](c)
- def barNullary[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c)
- def barEmpty[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c)
+ def fooNullary[T: c.WeakTypeTag](c: Context) = impl[T](c)("fooNullary")
+ def fooEmpty[T: c.WeakTypeTag](c: Context)() = impl[T](c)("fooEmpty")
+ def barNullary[T: c.WeakTypeTag](c: Context)(x: c.Expr[Int]) = impl[T](c)("barNullary")
+ def barEmpty[T: c.WeakTypeTag](c: Context)(x: c.Expr[Int])() = impl[T](c)("barEmpty")
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala b/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala
index 2d5cf53c3c..edd9051754 100644
--- a/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala
@@ -1,8 +1,8 @@
object Macros {
- def foo1[T] = macro Impls.fooNullary[T]
- def foo2[T]() = macro Impls.fooEmpty[T]
- def bar1[T](x: Int) = macro Impls.barNullary[T]
- def bar2[T](x: Int)() = macro Impls.barEmpty[T]
+ def foo1[T]: Unit = macro Impls.fooNullary[T]
+ def foo2[T](): Unit = macro Impls.fooEmpty[T]
+ def bar1[T](x: Int): Unit = macro Impls.barNullary[T]
+ def bar2[T](x: Int)(): Unit = macro Impls.barEmpty[T]
}
object Test extends App {
diff --git a/test/files/run/macro-expand-nullary-nongeneric.check b/test/files/run/macro-expand-nullary-nongeneric.check
index 9ab5f3a2bc..cb7e766394 100644
--- a/test/files/run/macro-expand-nullary-nongeneric.check
+++ b/test/files/run/macro-expand-nullary-nongeneric.check
@@ -1,6 +1,6 @@
-it works
-it works
-it works
-it works
-it works
+fooNullary
+fooEmpty
+fooEmpty
+barNullary
+barEmpty
kkthxbai
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 c6bd1cdbf1..c8c3d255c4 100644
--- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala
+++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala
@@ -1,14 +1,15 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.runtime.universe._
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: Ctx) = {
+ def impl(c: Context)(meth: String) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(meth))))
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)
+ def fooNullary(c: Context) = impl(c)("fooNullary")
+ def fooEmpty(c: Context)() = impl(c)("fooEmpty")
+ def barNullary(c: Context)(x: c.Expr[Int]) = impl(c)("barNullary")
+ def barEmpty(c: Context)(x: c.Expr[Int])() = impl(c)("barEmpty")
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala b/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala
index 1f6d717956..51915dfb27 100644
--- a/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala
@@ -1,8 +1,8 @@
object Macros {
- def foo1 = macro Impls.fooNullary
- def foo2() = macro Impls.fooEmpty
- def bar1(x: Int) = macro Impls.barNullary
- def bar2(x: Int)() = macro Impls.barEmpty
+ def foo1: Unit = macro Impls.fooNullary
+ def foo2(): Unit = macro Impls.fooEmpty
+ def bar1(x: Int): Unit = macro Impls.barNullary
+ def bar2(x: Int)(): Unit = macro Impls.barEmpty
}
object Test extends App {
diff --git a/test/files/run/macro-expand-overload/Impls_1.scala b/test/files/run/macro-expand-overload/Impls_1.scala
index f7c240d9ca..ef9d01d4ed 100644
--- a/test/files/run/macro-expand-overload/Impls_1.scala
+++ b/test/files/run/macro-expand-overload/Impls_1.scala
@@ -1,15 +1,15 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: Ctx)(tag: String, x: c.Expr[_]) = {
+ def impl(c: Context)(tag: String, x: c.Expr[_]) = {
import c.{prefix => prefix}
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
c.Expr[Unit](body)
}
- def fooObjectString(c: 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)
+ def fooObjectString(c: Context)(x: c.Expr[_]) = impl(c)("fooObjectString", x)
+ def fooObjectInt(c: Context)(x: c.Expr[_]) = impl(c)("fooObjectInt", x)
+ def fooClassString(c: Context)(x: c.Expr[_]) = impl(c)("fooClassString", x)
+ def fooClassInt(c: Context)(x: c.Expr[_]) = impl(c)("fooClassInt", x)
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-overload/Macros_Test_2.scala b/test/files/run/macro-expand-overload/Macros_Test_2.scala
index 7f61f85184..87cff2ecbd 100644
--- a/test/files/run/macro-expand-overload/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-overload/Macros_Test_2.scala
@@ -1,13 +1,13 @@
object Macros {
- def foo(x: String) = macro Impls.fooObjectString
- def foo(x: Int) = macro Impls.fooObjectInt
- def foo(x: Boolean) = println("fooObjectBoolean")
+ def foo(x: String): Unit = macro Impls.fooObjectString
+ def foo(x: Int): Unit = macro Impls.fooObjectInt
+ def foo(x: Boolean): Unit = println("fooObjectBoolean")
}
class Macros {
- def foo(x: String) = macro Impls.fooClassString
- def foo(x: Int) = macro Impls.fooClassInt
- def foo(x: Boolean) = println("fooClassBoolean")
+ def foo(x: String): Unit = macro Impls.fooClassString
+ def foo(x: Int): Unit = macro Impls.fooClassInt
+ def foo(x: Boolean): Unit = println("fooClassBoolean")
}
object Test extends App {
diff --git a/test/files/run/macro-expand-override/Impls_1.scala b/test/files/run/macro-expand-override/Impls_1.scala
index ec93dd4111..e6ce18f172 100644
--- a/test/files/run/macro-expand-override/Impls_1.scala
+++ b/test/files/run/macro-expand-override/Impls_1.scala
@@ -1,15 +1,15 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: Ctx)(tag: String, x: c.Expr[_]) = {
+ def impl(c: Context)(tag: String, x: c.Expr[_]) = {
import c.{prefix => prefix}
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
c.Expr[Unit](body)
}
- def fooBString(c: 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)
+ def fooBString(c: Context)(x: c.Expr[_]) = impl(c)("fooBString", x)
+ def fooBInt(c: Context)(x: c.Expr[_]) = impl(c)("fooBInt", x)
+ def fooDInt(c: Context)(x: c.Expr[_]) = impl(c)("fooDInt", x)
+ def fooZString(c: Context)(x: c.Expr[_]) = impl(c)("fooZString", x)
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-override/Macros_Test_2.scala b/test/files/run/macro-expand-override/Macros_Test_2.scala
index f162773c95..160831c54e 100644
--- a/test/files/run/macro-expand-override/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-override/Macros_Test_2.scala
@@ -1,17 +1,17 @@
class B {
- def foo(x: String) = macro Impls.fooBString
- def foo(x: Int) = macro Impls.fooBInt
- def foo(x: Boolean) = println("fooBBoolean")
+ def foo(x: String): Unit = macro Impls.fooBString
+ def foo(x: Int): Unit = macro Impls.fooBInt
+ def foo(x: Boolean): Unit = println("fooBBoolean")
}
class D extends B {
- //override def foo(x: String) = println("fooDString") => method cannot override a macro
- override def foo(x: Int) = macro Impls.fooDInt
+ //override def foo(x: String): Unit = println("fooDString") => method cannot override a macro
+ override def foo(x: Int): Unit = macro Impls.fooDInt
}
class Z extends D {
- override def foo(x: String) = macro Impls.fooZString
- override def foo(x: Boolean) = println("fooZBoolean")
+ override def foo(x: String): Unit = macro Impls.fooZString
+ override def foo(x: Boolean): Unit = println("fooZBoolean")
}
object Test extends App {
diff --git a/test/files/run/macro-expand-recursive/Impls_1.scala b/test/files/run/macro-expand-recursive/Impls_1.scala
index 61db5c4a9b..3def2d2fbe 100644
--- a/test/files/run/macro-expand-recursive/Impls_1.scala
+++ b/test/files/run/macro-expand-recursive/Impls_1.scala
@@ -1,15 +1,15 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
c.Expr[Unit](body)
}
- def fooFoo(c: Ctx) = {
+ def fooFoo(c: Context) = {
import c.universe._
- val body = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val body = Select(Ident(TermName("Macros")), TermName("foo"))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-recursive/Macros_Test_2.scala b/test/files/run/macro-expand-recursive/Macros_Test_2.scala
index 6ff691bdb1..5332fdacee 100644
--- a/test/files/run/macro-expand-recursive/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-recursive/Macros_Test_2.scala
@@ -1,6 +1,6 @@
object Macros {
- def foo = macro Impls.foo
- def fooFoo = macro Impls.fooFoo
+ def foo: Unit = macro Impls.foo
+ def fooFoo: Unit = macro Impls.fooFoo
}
object Test extends App {
diff --git a/test/files/run/macro-expand-tparams-bounds-a.check b/test/files/run/macro-expand-tparams-bounds-a.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/macro-expand-tparams-bounds-a.check
+++ /dev/null
diff --git a/test/files/run/macro-expand-tparams-bounds-a.flags b/test/files/run/macro-expand-tparams-bounds-a.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-bounds-a.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala
deleted file mode 100644
index 9b8dafaa97..0000000000
--- a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[U <: String](c: Ctx): c.Expr[Unit] = c.literalUnit
-}
diff --git a/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala
deleted file mode 100644
index b498e6f65b..0000000000
--- a/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-object Macros {
- def foo[U <: String] = macro Impls.foo[U]
-}
-
-object Test extends App {
- import Macros._
- foo[String]
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-bounds-b.check b/test/files/run/macro-expand-tparams-bounds-b.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/macro-expand-tparams-bounds-b.check
+++ /dev/null
diff --git a/test/files/run/macro-expand-tparams-bounds-b.flags b/test/files/run/macro-expand-tparams-bounds-b.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-bounds-b.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala
deleted file mode 100644
index c11c89151c..0000000000
--- a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-class C
-
-object Impls {
- def foo[U <: C](c: Ctx): c.Expr[Unit] = c.literalUnit
-}
diff --git a/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala
deleted file mode 100644
index 1a261e9f73..0000000000
--- a/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-class D extends C
-
-object Macros {
- def foo[T <: D] = macro Impls.foo[T]
-}
-
-object Test extends App {
- import Macros._
- foo[D]
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-bounds.check b/test/files/run/macro-expand-tparams-bounds.check
new file mode 100644
index 0000000000..317e9677c3
--- /dev/null
+++ b/test/files/run/macro-expand-tparams-bounds.check
@@ -0,0 +1,2 @@
+hello
+hello
diff --git a/test/files/run/macro-declared-in-class-class.flags b/test/files/run/macro-expand-tparams-bounds.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-class-class.flags
+++ b/test/files/run/macro-expand-tparams-bounds.flags
diff --git a/test/files/run/macro-expand-tparams-bounds/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala
new file mode 100644
index 0000000000..95aaa1c3d7
--- /dev/null
+++ b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala
@@ -0,0 +1,12 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls1 {
+ def foo[U <: String](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello")""") }
+}
+
+class C
+class D extends C
+
+object Impls2 {
+ def foo[U <: C](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello")""") }
+}
diff --git a/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala
new file mode 100644
index 0000000000..6cb2b53465
--- /dev/null
+++ b/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala
@@ -0,0 +1,12 @@
+object Macros1 {
+ def foo[U <: String]: Unit = macro Impls1.foo[U]
+}
+
+object Macros2 {
+ def foo[T <: D]: Unit = macro Impls2.foo[T]
+}
+
+object Test extends App {
+ Macros1.foo[String]
+ Macros2.foo[D]
+}
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 72b420d92f..c33ac6d1b7 100644
--- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[U: c.WeakTypeTag](c: Ctx) = {
+ def foo[U: c.WeakTypeTag](c: Context) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala
index e72c27881a..2cf7b19d2a 100644
--- a/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala
@@ -1,4 +1,4 @@
object Test extends App {
- def foo[U] = macro Impls.foo[U]
+ def foo[U]: Unit = macro Impls.foo[U]
foo[Int]
} \ 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 33770516df..32cee0d5fb 100644
--- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
+ def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala
index f8c573f509..1192931931 100644
--- a/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Test extends App {
- def foo[U](x: U) = macro Impls.foo[U]
+ def foo[U](x: U): Unit = macro Impls.foo[U]
foo(42)
foo("42")
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-only-in-impl.flags b/test/files/run/macro-expand-tparams-only-in-impl.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-only-in-impl.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala b/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala
deleted file mode 100644
index 9b8dafaa97..0000000000
--- a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[U <: String](c: Ctx): c.Expr[Unit] = c.literalUnit
-}
diff --git a/test/files/run/macro-expand-tparams-optional.flags b/test/files/run/macro-expand-tparams-optional.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-optional.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ 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
deleted file mode 100644
index 3b829e2e09..0000000000
--- a/test/files/run/macro-expand-tparams-optional/Impls_1.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[U](c: Ctx) = {
- import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("don't know U"))))
- c.Expr[Unit](body)
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala
deleted file mode 100644
index e72c27881a..0000000000
--- a/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-object Test extends App {
- def foo[U] = macro Impls.foo[U]
- foo[Int]
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check
deleted file mode 100644
index ca44a4f652..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-a.check
+++ /dev/null
@@ -1,4 +0,0 @@
-WeakTypeTag[Int]
-WeakTypeTag[Int]
-WeakTypeTag[String]
-WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-a.flags b/test/files/run/macro-expand-tparams-prefix-a.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-a.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ 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
deleted file mode 100644
index 33770516df..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
- import c.universe._
- val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
- c.Expr[Unit](body)
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala
deleted file mode 100644
index 81ccb7ff42..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-object Test extends App {
- class C[T] {
- def foo[U](x: U) = macro Impls.foo[U]
- }
-
- new C[Int]().foo(42)
- new C[Boolean]().foo(42)
- new C[Int]().foo("42")
- new C[String]().foo(true)
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check
deleted file mode 100644
index 2ff2ce435d..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-b.check
+++ /dev/null
@@ -1,2 +0,0 @@
-WeakTypeTag[Boolean] WeakTypeTag[Int]
-WeakTypeTag[Boolean] WeakTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-prefix-b.flags b/test/files/run/macro-expand-tparams-prefix-b.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-b.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ 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
deleted file mode 100644
index 9378e67712..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
- import c.universe._
- val T = implicitly[c.WeakTypeTag[T]]
- val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString))))
- c.Expr[Unit](body)
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala
deleted file mode 100644
index a4a0acfe8b..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-object Test extends App {
- class C[T] {
- def foo[U](x: U) = macro Impls.foo[T, U]
- }
-
- object D extends C[Boolean]
-
- D.foo(42)
- D.foo("42")
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check
deleted file mode 100644
index 0f24f74db1..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-c1.check
+++ /dev/null
@@ -1,3 +0,0 @@
-WeakTypeTag[Int]
-WeakTypeTag[String]
-WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c1.flags b/test/files/run/macro-expand-tparams-prefix-c1.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-c1.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ 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
deleted file mode 100644
index afdd7d4f7a..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
- 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.WeakTypeTag[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-c1/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala
deleted file mode 100644
index 4fa0c8cb33..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-class D[T] {
- class C[U] {
- def foo[V] = macro Impls.foo[T, U, V]
- }
-}
-
-object Test extends App {
- val outer1 = new D[Int]
- val outer2 = new outer1.C[String]
- outer2.foo[Boolean]
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check
deleted file mode 100644
index 0f24f74db1..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-c2.check
+++ /dev/null
@@ -1,3 +0,0 @@
-WeakTypeTag[Int]
-WeakTypeTag[String]
-WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c2.flags b/test/files/run/macro-expand-tparams-prefix-c2.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-c2.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ 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
deleted file mode 100644
index 3c2838208a..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
- 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.WeakTypeTag[U]].toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
- Literal(Constant(()))))
- }
-}
-
-class D[T] {
- class C[U] {
- def foo[V] = macro Impls.foo[T, U, V]
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala b/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala
deleted file mode 100644
index e729d4a536..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-object Test extends App {
- val outer1 = new D[Int]
- val outer2 = new outer1.C[String]
- outer2.foo[Boolean]
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check
deleted file mode 100644
index 7832503256..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-d1.check
+++ /dev/null
@@ -1,3 +0,0 @@
-WeakTypeTag[T]
-WeakTypeTag[U]
-WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-d1.flags b/test/files/run/macro-expand-tparams-prefix-d1.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-d1.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ 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
deleted file mode 100644
index afdd7d4f7a..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
-
-object Impls {
- def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
- 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.WeakTypeTag[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-d1/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala
deleted file mode 100644
index 8222a6d1e8..0000000000
--- a/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-object Test extends App {
- class D[T] {
- class C[U] {
- def foo[V] = macro Impls.foo[T, U, V]
- foo[Boolean]
- }
- }
-
- val outer1 = new D[Int]
- new outer1.C[String]
-} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix.check b/test/files/run/macro-expand-tparams-prefix.check
new file mode 100644
index 0000000000..7397958066
--- /dev/null
+++ b/test/files/run/macro-expand-tparams-prefix.check
@@ -0,0 +1,20 @@
+===Macros1===
+WeakTypeTag[Int]
+WeakTypeTag[Int]
+WeakTypeTag[String]
+WeakTypeTag[Boolean]
+===Macros2===
+WeakTypeTag[Boolean] WeakTypeTag[Int]
+WeakTypeTag[Boolean] WeakTypeTag[String]
+===Macros3===
+WeakTypeTag[Int]
+WeakTypeTag[String]
+WeakTypeTag[Boolean]
+===Macros4===
+WeakTypeTag[Int]
+WeakTypeTag[String]
+WeakTypeTag[Boolean]
+===Macros5===
+WeakTypeTag[T]
+WeakTypeTag[U]
+WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-declared-in-class-object.flags b/test/files/run/macro-expand-tparams-prefix.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-class-object.flags
+++ b/test/files/run/macro-expand-tparams-prefix.flags
diff --git a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
new file mode 100644
index 0000000000..289f07162b
--- /dev/null
+++ b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
@@ -0,0 +1,39 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.macros.blackbox.Context
+
+object Impls1 {
+ def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = {
+ import c.universe._
+ val U = implicitly[c.WeakTypeTag[U]]
+ c.Expr[Unit](q"println(${U.toString})")
+ }
+}
+
+object Impls2 {
+ def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = {
+ import c.universe._
+ val T = implicitly[c.WeakTypeTag[T]]
+ val U = implicitly[c.WeakTypeTag[U]]
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString))))
+ c.Expr[Unit](q"""println(${T.toString} + " " + ${U.toString})""")
+ }
+}
+
+object Impls345 {
+ def foo[T, U: c.WeakTypeTag, V](c: Context)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ import c.universe._
+ c.Expr(q"""
+ println(${T.toString})
+ println(${implicitly[c.WeakTypeTag[U]].toString})
+ println(${V.toString})
+ """)
+ }
+}
+
+object Macros4 {
+ class D[T] {
+ class C[U] {
+ def foo[V] = macro Impls345.foo[T, U, V]
+ }
+ }
+}
diff --git a/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala
new file mode 100644
index 0000000000..c8f68b4aff
--- /dev/null
+++ b/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala
@@ -0,0 +1,57 @@
+object Macros1 {
+ class C[T] {
+ def foo[U](x: U): Unit = macro Impls1.foo[U]
+ }
+}
+
+object Macros2 {
+ class C[T] {
+ def foo[U](x: U): Unit = macro Impls2.foo[T, U]
+ }
+}
+
+object Macros3 {
+ class D[T] {
+ class C[U] {
+ def foo[V]: Unit = macro Impls345.foo[T, U, V]
+ }
+ }
+}
+
+// object Macros4 is declared in Impls_1.scala
+
+object Macros5 {
+ class D[T] {
+ class C[U] {
+ def foo[V]: Unit = macro Impls345.foo[T, U, V]
+ foo[Boolean]
+ }
+ }
+}
+
+object Test extends App {
+ println("===Macros1===")
+ new Macros1.C[Int]().foo(42)
+ new Macros1.C[Boolean]().foo(42)
+ new Macros1.C[Int]().foo("42")
+ new Macros1.C[String]().foo(true)
+
+ println("===Macros2===")
+ object D2 extends Macros2.C[Boolean]
+ D2.foo(42)
+ D2.foo("42")
+
+ println("===Macros3===")
+ val outer31 = new Macros3.D[Int]
+ val outer32 = new outer31.C[String]
+ outer32.foo[Boolean]
+
+ println("===Macros4===")
+ val outer41 = new Macros4.D[Int]
+ val outer42 = new outer41.C[String]
+ outer42.foo[Boolean]
+
+ println("===Macros5===")
+ val outer1 = new Macros5.D[Int]
+ new outer1.C[String]
+} \ No newline at end of file
diff --git a/test/files/run/macro-expand-unapply-a.check b/test/files/run/macro-expand-unapply-a.check
new file mode 100644
index 0000000000..7c2976e51e
--- /dev/null
+++ b/test/files/run/macro-expand-unapply-a.check
@@ -0,0 +1,2 @@
+(1,2)
+(1,2,3)
diff --git a/test/files/run/macro-declared-in-class.flags b/test/files/run/macro-expand-unapply-a.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-class.flags
+++ b/test/files/run/macro-expand-unapply-a.flags
diff --git a/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala b/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala
new file mode 100644
index 0000000000..64f16c6a89
--- /dev/null
+++ b/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala
@@ -0,0 +1,15 @@
+import scala.reflect.macros.whitebox.Context
+
+object Helper {
+ def unapplySeq[T](x: List[T]): Option[Seq[T]] = List.unapplySeq[T](x)
+}
+
+object Macros {
+ def impl[T: c.WeakTypeTag](c: Context)(x: c.Expr[List[T]]) = {
+ c.universe.reify(Helper.unapplySeq(x.splice))
+ }
+
+ object UnapplyMacro {
+ def unapplySeq[T](x: List[T]): Option[Seq[T]] = macro impl[T]
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-expand-unapply-a/Test_2.scala b/test/files/run/macro-expand-unapply-a/Test_2.scala
new file mode 100644
index 0000000000..6169d86b19
--- /dev/null
+++ b/test/files/run/macro-expand-unapply-a/Test_2.scala
@@ -0,0 +1,6 @@
+import Macros._
+
+object Test extends App {
+ List(1, 2) match { case UnapplyMacro(x, y) => println((x, y)) }
+ List(1, 2, 3) match { case UnapplyMacro(x, y, z) => println((x, y, z)) }
+} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check
index 1c3ecfdefb..2709b57038 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check
+++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check
@@ -1,4 +1,4 @@
-reflective compilation has failed:
+reflective compilation has failed:
no `: _*' annotation allowed here
(such annotations are only allowed in arguments to *-parameters)
diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala
index 2ef8f04be9..18af84583a 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
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList)
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/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 c832826d64..64aaa07bf2 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
@@ -1,12 +1,12 @@
object Macros {
- def foo(xs: Int*) = macro Impls.foo
+ def foo(xs: Int*): Unit = macro Impls.foo
}
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(newTermName("Macros")), newTermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(tpnme.WILDCARD_STAR))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(typeNames.WILDCARD_STAR))))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/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 3c7f94f605..eb067c25a5 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
@@ -1,13 +1,13 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
val stripped_xs = xs map (_.tree) toList match {
- case List(Typed(stripped, Ident(wildstar))) if wildstar == tpnme.WILDCARD_STAR => List(stripped)
+ case List(Typed(stripped, Ident(wildstar))) if wildstar == typeNames.WILDCARD_STAR => List(stripped)
case _ => ???
}
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), stripped_xs)
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), stripped_xs)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala
index f127ebcde7..13d7cd5d5d 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros {
- def foo(xs: Int*) = macro Impls.foo
+ def foo(xs: Int*): Unit = macro Impls.foo
}
object Test extends App {
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 2066893bdc..64ab7de02a 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
@@ -1,13 +1,13 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
def myprintln(xs: Int*) = {
println(xs)
}
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
- val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList)
+ val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala
index f127ebcde7..13d7cd5d5d 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros {
- def foo(xs: Int*) = macro Impls.foo
+ def foo(xs: Int*): Unit = macro Impls.foo
}
object Test extends App {
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 2ef8f04be9..18af84583a 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
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList)
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala
index 2311ca0b95..9ab1be9e23 100644
--- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros {
- def foo(xs: Int*) = macro Impls.foo
+ def foo(xs: Int*): Unit = macro Impls.foo
}
object Test extends App {
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 2066893bdc..64ab7de02a 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
@@ -1,13 +1,13 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
def myprintln(xs: Int*) = {
println(xs)
}
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
- val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList)
+ val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala
index 2311ca0b95..9ab1be9e23 100644
--- a/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros {
- def foo(xs: Int*) = macro Impls.foo
+ def foo(xs: Int*): Unit = macro Impls.foo
}
object Test extends App {
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 7c40045c0f..9b1d0eed35 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,18 +1,17 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo_targs[T, U: c.WeakTypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = {
+ def foo_targs[T, U: c.WeakTypeTag](c: Context = null)(x: c.Expr[Int] = null) = {
import c.{prefix => prefix}
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Block(List(
- 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.staticType)))),
- 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(())))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"""
+ println("invoking foo_targs...")
+ println("type of prefix is: " + ${prefix.staticType.toString})
+ println("type of prefix tree is: " + ${prefix.tree.tpe.toString})
+ println("U is: " + ${U.tpe.toString})
+ """)
}
}
diff --git a/test/files/run/macro-impl-relaxed.check b/test/files/run/macro-impl-relaxed.check
new file mode 100644
index 0000000000..487b116534
--- /dev/null
+++ b/test/files/run/macro-impl-relaxed.check
@@ -0,0 +1,4 @@
+2
+2
+2
+2
diff --git a/test/files/run/macro-impl-relaxed/Macros_1.scala b/test/files/run/macro-impl-relaxed/Macros_1.scala
new file mode 100644
index 0000000000..420eb2a399
--- /dev/null
+++ b/test/files/run/macro-impl-relaxed/Macros_1.scala
@@ -0,0 +1,14 @@
+import language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def implUU(c: Context)(x: c.Tree): c.Tree = x
+ def implTU(c: Context)(x: c.Expr[Int]): c.Tree = x.tree
+ def implUT(c: Context)(x: c.Tree): c.Expr[Int] = c.Expr[Int](x)
+ def implTT(c: Context)(x: c.Expr[Int]): c.Expr[Int] = x
+
+ def fooUU(x: Int): Int = macro implUU
+ def fooTU(x: Int): Int = macro implTU
+ def fooUT(x: Int): Int = macro implUT
+ def fooTT(x: Int): Int = macro implTT
+} \ No newline at end of file
diff --git a/test/files/run/macro-impl-relaxed/Test_2.scala b/test/files/run/macro-impl-relaxed/Test_2.scala
new file mode 100644
index 0000000000..2eaeef0fd0
--- /dev/null
+++ b/test/files/run/macro-impl-relaxed/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ println(Macros.fooUU(2))
+ println(Macros.fooTU(2))
+ println(Macros.fooUT(2))
+ println(Macros.fooTT(2))
+} \ No newline at end of file
diff --git a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala
index 56c23f5faf..acc47fcde6 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
@@ -1,12 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = {
+ def foo(unconventionalName: Context)(x: unconventionalName.Expr[Int]) = {
import unconventionalName.universe._
- val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo..."))))),
- Literal(Constant(())))
- unconventionalName.Expr[Unit](body)
+ unconventionalName.Expr[Unit](q"""println("invoking foo...")""")
}
}
diff --git a/test/files/run/macro-reify-splice-splice.check b/test/files/run/macro-impl-tparam-only-in-impl.check
index 3b18e512db..3b18e512db 100644
--- a/test/files/run/macro-reify-splice-splice.check
+++ b/test/files/run/macro-impl-tparam-only-in-impl.check
diff --git a/test/files/run/macro-declared-in-default-param.flags b/test/files/run/macro-impl-tparam-only-in-impl.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-default-param.flags
+++ b/test/files/run/macro-impl-tparam-only-in-impl.flags
diff --git a/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala
new file mode 100644
index 0000000000..705defb18f
--- /dev/null
+++ b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo[U <: String](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+}
diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala b/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala
index 218c7aec7f..4901e24481 100644
--- a/test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala
+++ b/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros {
- def foo = macro Impls.foo[String]
+ def foo: Unit = macro Impls.foo[String]
}
object Test extends App {
diff --git a/test/files/run/macro-expand-tparams-optional.check b/test/files/run/macro-impl-tparam-typetag-is-optional.check
index b4a0f394c1..b4a0f394c1 100644
--- a/test/files/run/macro-expand-tparams-optional.check
+++ b/test/files/run/macro-impl-tparam-typetag-is-optional.check
diff --git a/test/files/run/macro-declared-in-implicit-class.flags b/test/files/run/macro-impl-tparam-typetag-is-optional.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-implicit-class.flags
+++ b/test/files/run/macro-impl-tparam-typetag-is-optional.flags
diff --git a/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala b/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala
new file mode 100644
index 0000000000..fc72e7a979
--- /dev/null
+++ b/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala
@@ -0,0 +1,9 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo[U](c: Context) = {
+ import c.universe._
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("don't know U"))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala b/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala
new file mode 100644
index 0000000000..2cf7b19d2a
--- /dev/null
+++ b/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ def foo[U]: Unit = macro Impls.foo[U]
+ foo[Int]
+} \ No newline at end of file
diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check
index 916195145e..1d531f6d86 100644
--- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check
+++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check
@@ -1,4 +1,4 @@
-reflective compilation has failed:
+reflective compilation has failed:
type mismatch;
found : String("42")
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 b3babd8848..603500b597 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
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx): c.Expr[Int] = {
+ def foo(c: Context): c.Expr[Int] = {
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 0b9986e9f6..61f0bdfadc 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
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val tree = Select(Ident(TermName("Macros")), TermName("foo"))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-invalidret-nontypeable.check b/test/files/run/macro-invalidret-nontypeable.check
index cf7acb0d60..25cef2c786 100644
--- a/test/files/run/macro-invalidret-nontypeable.check
+++ b/test/files/run/macro-invalidret-nontypeable.check
@@ -1,3 +1,3 @@
-reflective compilation has failed:
+reflective compilation has failed:
not found: value IDoNotExist
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 fb0d55208c..b6b9611743 100644
--- a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.universe._
- val body = Ident(newTermName("IDoNotExist"))
+ val body = Ident(TermName("IDoNotExist"))
c.Expr[Int](body)
}
}
diff --git a/test/files/run/macro-invalidret-nontypeable/Test_2.scala b/test/files/run/macro-invalidret-nontypeable/Test_2.scala
index 0daee49a08..7cd474ff52 100644
--- a/test/files/run/macro-invalidret-nontypeable/Test_2.scala
+++ b/test/files/run/macro-invalidret-nontypeable/Test_2.scala
@@ -2,7 +2,7 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val tree = Select(Ident(TermName("Macros")), TermName("foo"))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-invalidusage-badret.check b/test/files/run/macro-invalidusage-badret.check
index 221732eefc..e79550043f 100644
--- a/test/files/run/macro-invalidusage-badret.check
+++ b/test/files/run/macro-invalidusage-badret.check
@@ -1,5 +1,5 @@
-reflective compilation has failed:
+reflective compilation has failed:
type mismatch;
- found : Int(42)
+ found : Int
required: String
diff --git a/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala
index 0d840eed3f..0d4c5755f0 100644
--- a/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = x
+ def foo(c: Context)(x: c.Expr[Int]) = x
}
object Macros {
diff --git a/test/files/run/macro-invalidusage-badret/Test_2.scala b/test/files/run/macro-invalidusage-badret/Test_2.scala
index 5cb0be5ddd..fc71353f54 100644
--- a/test/files/run/macro-invalidusage-badret/Test_2.scala
+++ b/test/files/run/macro-invalidusage-badret/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Typed(Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42)))), Ident(newTypeName("String")))
+ val tree = Typed(Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))), Ident(TypeName("String")))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check
index f1d5e925fa..6cbcb9e5af 100644
--- a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check
+++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check
@@ -1,3 +1,3 @@
-reflective compilation has failed:
+reflective compilation has failed:
-macros cannot be partially applied
+too few argument lists for macro invocation
diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
index 4583a726cf..8b5c59bde8 100644
--- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[T]) = {
+ def foo[T: c.WeakTypeTag](c: Context)(x: c.Expr[T]) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(x.tree.toString))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(x.tree.toString))))
c.Expr[Unit](body)
}
}
diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala
index e453d0b70c..9a34c62e0f 100644
--- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala
+++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val tree = Select(Ident(TermName("Macros")), TermName("foo"))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-invalidusage-partialapplication.check b/test/files/run/macro-invalidusage-partialapplication.check
index f1d5e925fa..6cbcb9e5af 100644
--- a/test/files/run/macro-invalidusage-partialapplication.check
+++ b/test/files/run/macro-invalidusage-partialapplication.check
@@ -1,3 +1,3 @@
-reflective compilation has failed:
+reflective compilation has failed:
-macros cannot be partially applied
+too few argument lists for macro invocation
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 5866469499..6970b4dd7e 100644
--- a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = {
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))
+ val sum = Apply(Select(x.tree, TermName("$plus")), List(y.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
c.Expr[Unit](body)
}
}
diff --git a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala
index dc48c127f4..75b8c139d4 100644
--- a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala
+++ b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala
@@ -2,7 +2,7 @@ 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(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(40))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(40))))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-openmacros.flags b/test/files/run/macro-openmacros.flags
index cd66464f2f..2433c055a4 100644
--- a/test/files/run/macro-openmacros.flags
+++ b/test/files/run/macro-openmacros.flags
@@ -1 +1,2 @@
--language:experimental.macros \ No newline at end of file
+-Yrangepos:false
+-language:experimental.macros
diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala
index b863ac048b..b60ca90d91 100644
--- a/test/files/run/macro-openmacros/Impls_Macros_1.scala
+++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl(c: Context): c.Expr[Unit] = {
@@ -14,9 +14,9 @@ object Macros {
}
import c.universe._
- val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), newTermName("foo"))) else c.literalUnit
+ val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), TermName("foo"))) else c.Expr[Unit](Literal(Constant(())))
c.universe.reify {
- println(c.literal(normalizePaths(c.enclosingMacros.toString)).splice)
+ println(c.Expr[String](Literal(Constant(normalizePaths(c.enclosingMacros.toString)))).splice)
next.splice
}
}
diff --git a/test/files/run/macro-parse-position-malformed.check b/test/files/run/macro-parse-position-malformed.check
new file mode 100644
index 0000000000..00f0bc5b62
--- /dev/null
+++ b/test/files/run/macro-parse-position-malformed.check
@@ -0,0 +1 @@
+failed with 'source-<macro>,line-1,offset=7' position and '')' expected but eof found.' message
diff --git a/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala b/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala
new file mode 100644
index 0000000000..b623d8820a
--- /dev/null
+++ b/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala
@@ -0,0 +1,18 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+import scala.reflect.macros.ParseException
+
+object Macros {
+ def impl(c: Context)() = {
+ import c.universe._
+ val out = try {
+ c.parse("foo(bar")
+ "didn't fail"
+ } catch {
+ case e: ParseException =>
+ s"failed with '${e.pos}' position and '${e.msg}' message"
+ }
+ c.Expr[String](Literal(Constant(out)))
+ }
+ def foo(): String = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-splice-splice/Test_2.scala b/test/files/run/macro-parse-position-malformed/Test_2.scala
index f697da6020..cff569bd81 100644
--- a/test/files/run/macro-reify-splice-splice/Test_2.scala
+++ b/test/files/run/macro-parse-position-malformed/Test_2.scala
@@ -1,3 +1,3 @@
object Test extends App {
println(Macros.foo)
-} \ No newline at end of file
+}
diff --git a/test/files/run/macro-parse-position.check b/test/files/run/macro-parse-position.check
new file mode 100644
index 0000000000..3da0320696
--- /dev/null
+++ b/test/files/run/macro-parse-position.check
@@ -0,0 +1,5 @@
+false
+source-<macro>,line-1,offset=4
+8
+foo bar
+
diff --git a/test/files/run/macro-parse-position.flags b/test/files/run/macro-parse-position.flags
new file mode 100644
index 0000000000..ea7fc37e1a
--- /dev/null
+++ b/test/files/run/macro-parse-position.flags
@@ -0,0 +1 @@
+-Yrangepos:false
diff --git a/test/files/run/macro-parse-position/Impls_Macros_1.scala b/test/files/run/macro-parse-position/Impls_Macros_1.scala
new file mode 100644
index 0000000000..dd20fd291b
--- /dev/null
+++ b/test/files/run/macro-parse-position/Impls_Macros_1.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context)() = {
+ import c.universe._
+ val t = c.parse("foo bar")
+ val out = s"${t.pos == NoPosition}\n${t.pos}\n${t.pos.source.content.length}\n${new String(t.pos.source.content)}"
+ c.Expr[String](Literal(Constant(out)))
+ }
+ def foo(): String = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-parse-position/Test_2.scala b/test/files/run/macro-parse-position/Test_2.scala
new file mode 100644
index 0000000000..cff569bd81
--- /dev/null
+++ b/test/files/run/macro-parse-position/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ println(Macros.foo)
+}
diff --git a/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala b/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala
index 6c14428437..df189b70d3 100644
--- a/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala
+++ b/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
object Impls {
- def foo(c: Ctx)(x: c.Expr[Any]) = x
+ def foo(c: Context)(x: c.Expr[Any]) = x
}
def foo(x: Any) = macro Impls.foo
diff --git a/test/files/run/macro-quasiquotes.check b/test/files/run/macro-quasiquotes.check
new file mode 100644
index 0000000000..94ebaf9001
--- /dev/null
+++ b/test/files/run/macro-quasiquotes.check
@@ -0,0 +1,4 @@
+1
+2
+3
+4
diff --git a/test/files/run/macro-quasiquotes/Macros_1.scala b/test/files/run/macro-quasiquotes/Macros_1.scala
new file mode 100644
index 0000000000..764542a870
--- /dev/null
+++ b/test/files/run/macro-quasiquotes/Macros_1.scala
@@ -0,0 +1,15 @@
+import language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+class Impls(val c: Context) {
+ import c.universe._
+ def impl1 = q"println(1)"
+ def impl2 = q"{ println(2); println(3) }"
+ def impl3 = q"4"
+}
+
+object Macros {
+ def m1: Unit = macro Impls.impl1
+ def m2: Unit = macro Impls.impl2
+ def m3: Int = macro Impls.impl3
+} \ No newline at end of file
diff --git a/test/files/run/macro-quasiquotes/Test_2.scala b/test/files/run/macro-quasiquotes/Test_2.scala
new file mode 100644
index 0000000000..4be193938f
--- /dev/null
+++ b/test/files/run/macro-quasiquotes/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ Macros.m1
+ Macros.m2
+ println(Macros.m3)
+}
diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala
index 5c4bc211fc..35d2efd76d 100644
--- a/test/files/run/macro-range/Common_1.scala
+++ b/test/files/run/macro-range/Common_1.scala
@@ -1,4 +1,4 @@
-import reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
abstract class RangeDefault {
val from, to: Int
@@ -12,6 +12,7 @@ abstract class RangeDefault {
abstract class Utils {
val context: Context
import context.universe._
+ import internal._
class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer {
override def transform(tree: Tree): Tree = tree match {
@@ -23,7 +24,7 @@ abstract class Utils {
subst(from, to)
case _ =>
val tree1 = super.transform(tree)
- if (tree1 ne tree) tree1.tpe = null
+ if (tree1 ne tree) setType(tree1, null)
tree1
}
}
@@ -43,5 +44,5 @@ abstract class Utils {
LabelDef(lname, Nil, rhs)
}
def makeBinop(left: Tree, op: String, right: Tree): Tree =
- Apply(Select(left, newTermName(op)), List(right))
+ Apply(Select(left, TermName(op)), List(right))
}
diff --git a/test/files/run/macro-range/Expansion_Impossible_2.scala b/test/files/run/macro-range/Expansion_Impossible_2.scala
index 57e0cee97f..242e83a61a 100644
--- a/test/files/run/macro-range/Expansion_Impossible_2.scala
+++ b/test/files/run/macro-range/Expansion_Impossible_2.scala
@@ -1,4 +1,4 @@
-import reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Impls {
def foreach(c: Context)(f: c.Expr[Int => Unit]): c.Expr[Unit] = {
@@ -9,18 +9,18 @@ object Impls {
import c.universe._
import Flag._
- val initName = nme.CONSTRUCTOR
+ val initName = termNames.CONSTRUCTOR
// Either:
// scala"{ var i = $low; val h = $hi; while (i < h) { $f(i); i = i + 1 } }
// or:
// scala"($_this: RangeDefault).foreach($f)"
c.Expr(c.prefix.tree match {
case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" =>
- val iname = newTermName("$i")
- val hname = newTermName("$h")
+ val iname = TermName("$i")
+ val hname = TermName("$h")
def iref = Ident(iname)
def href = Ident(hname)
- val labelname = newTermName("$while")
+ val labelname = TermName("$while")
val cond = makeBinop(iref, "$less", href)
val body = Block(
List(makeApply(f.tree, List(iref))),
@@ -37,8 +37,8 @@ object Impls {
case _ =>
Apply(
Select(
- Typed(c.prefix.tree, Ident(newTypeName("RangeDefault"))),
- newTermName("foreach")),
+ Typed(c.prefix.tree, Ident(TypeName("RangeDefault"))),
+ TermName("foreach")),
List(f.tree))
})
}
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 fa559334d4..e964da2106 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
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
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 2e64c01e35..267d1bc7b0 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
@@ -2,6 +2,6 @@ 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(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42))))
println(cm.mkToolBox().eval(tree))
}
diff --git a/test/files/run/macro-reflective-mamd-normal-mi.check b/test/files/run/macro-reflective-mamd-normal-mi.check
index ac4213d6e9..920a139664 100644
--- a/test/files/run/macro-reflective-mamd-normal-mi.check
+++ b/test/files/run/macro-reflective-mamd-normal-mi.check
@@ -1 +1 @@
-43 \ No newline at end of file
+43
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 5d7e077731..89a818d99c 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
@@ -1,9 +1,9 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
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 70560009b1..410ec1b527 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
@@ -8,12 +8,12 @@ object Test extends App {
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.toType), EmptyTree)
- val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody)
- val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(()))))
- val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef)))
- val macroapp = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42))))
+ val macrobody = Select(Ident(TermName("Impls")), TermName("foo"))
+ val macroparam = ValDef(NoMods, TermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree)
+ val macrodef = DefDef(Modifiers(MACRO), TermName("foo"), Nil, List(List(macroparam)), Ident(TypeName("Int")), macrobody)
+ val modulector = DefDef(NoMods, termNames.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(()))))
+ val module = ModuleDef(NoMods, TermName("Macros"), Template(Nil, noSelfType, List(modulector, macrodef)))
+ val macroapp = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42))))
val tree = Block(List(macrodef, module), macroapp)
val toolbox = cm.mkToolBox(options = "-language:experimental.macros")
println(toolbox.eval(tree))
diff --git a/test/files/run/macro-reify-basic/Macros_1.scala b/test/files/run/macro-reify-basic/Macros_1.scala
index 3f6720f10a..1cf2a8a406 100644
--- a/test/files/run/macro-reify-basic/Macros_1.scala
+++ b/test/files/run/macro-reify-basic/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo(s: String) = macro Impls.foo
object Impls {
- def foo(c: Ctx)(s: c.Expr[String]) = c.universe.reify {
+ def foo(c: Context)(s: c.Expr[String]) = c.universe.reify {
println("hello " + s.splice)
}
}
diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-chained1/Impls_Macros_1.scala
index b4351c2c53..7f877b2729 100644
--- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-chained1/Impls_Macros_1.scala
@@ -1,6 +1,7 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
case class Utils[C <: Context]( c:C ) {
import c.universe._
@@ -23,18 +24,18 @@ case class Utils[C <: Context]( c:C ) {
object QueryableMacros{
def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
import c.universe._
- import treeBuild._
+ import internal._
val element_type = implicitly[c.WeakTypeTag[S]].tpe
val foo = c.Expr[ru.Expr[Queryable[S]]](
- c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck(
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
Utils[c.type](c).removeDoubleReify(
- Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree ))
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
).asInstanceOf[Tree]
)))
c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
- (c: scala.reflect.macros.Context)
+ (c: Context)
(projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
}
class Queryable[T]{
diff --git a/test/files/run/macro-reify-chained1/Test_2.scala b/test/files/run/macro-reify-chained1/Test_2.scala
new file mode 100644
index 0000000000..2adb07b035
--- /dev/null
+++ b/test/files/run/macro-reify-chained1/Test_2.scala
@@ -0,0 +1,9 @@
+object Test extends App{
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(x => x).map(x => x)
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(x => x).map(x => x)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-chained2/Impls_Macros_1.scala
index b4351c2c53..965b191044 100644
--- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-chained2/Impls_Macros_1.scala
@@ -1,6 +1,7 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
case class Utils[C <: Context]( c:C ) {
import c.universe._
@@ -23,18 +24,18 @@ case class Utils[C <: Context]( c:C ) {
object QueryableMacros{
def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
import c.universe._
- import treeBuild._
+ import internal._
val element_type = implicitly[c.WeakTypeTag[S]].tpe
val foo = c.Expr[ru.Expr[Queryable[S]]](
- c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck(
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
Utils[c.type](c).removeDoubleReify(
- Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree ))
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
).asInstanceOf[Tree]
)))
c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
- (c: scala.reflect.macros.Context)
+ (c: Context)
(projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
}
class Queryable[T]{
diff --git a/test/files/run/macro-reify-chained2/Test_2.scala b/test/files/run/macro-reify-chained2/Test_2.scala
new file mode 100644
index 0000000000..2adb07b035
--- /dev/null
+++ b/test/files/run/macro-reify-chained2/Test_2.scala
@@ -0,0 +1,9 @@
+object Test extends App{
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(x => x).map(x => x)
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(x => x).map(x => x)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-freevars.check b/test/files/run/macro-reify-freevars.check
index f13806889e..f618e307b2 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:
+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 20f80c06d1..912f602c6c 100644
--- a/test/files/run/macro-reify-freevars/Macros_1.scala
+++ b/test/files/run/macro-reify-freevars/Macros_1.scala
@@ -2,7 +2,7 @@ package scala.collection.slick
object QueryableMacros{
def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
- (c: scala.reflect.macros.Context)
+ (c: scala.reflect.macros.blackbox.Context)
(projection: c.Expr[T => S])
: c.Expr[scala.collection.slick.Queryable[S]] = {
import c.universe._
diff --git a/test/files/run/macro-reify-freevars/Test_2.scala b/test/files/run/macro-reify-freevars/Test_2.scala
index 7af9d89bdb..c2d0118e17 100644
--- a/test/files/run/macro-reify-freevars/Test_2.scala
+++ b/test/files/run/macro-reify-freevars/Test_2.scala
@@ -2,10 +2,10 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val q = New(AppliedTypeTree(Select(Select(Select(Ident(newTermName("scala")), newTermName("collection")), newTermName("slick")), newTypeName("Queryable")), List(Ident(newTermName("Int")))))
- val x = ValDef(NoMods, newTermName("x"), Ident(newTermName("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))
+ val q = New(AppliedTypeTree(Select(Select(Select(Ident(TermName("scala")), TermName("collection")), TermName("slick")), TypeName("Queryable")), List(Ident(TermName("Int")))))
+ val x = ValDef(NoMods, TermName("x"), Ident(TermName("Int")), EmptyTree)
+ val fn = Function(List(x), Apply(Select(Ident(TermName("x")), TermName("$plus")), List(Literal(Constant("5")))))
+ val tree = Apply(Select(q, TermName("map")), List(fn))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a.check b/test/files/run/macro-reify-nested-a.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/macro-reify-nested-a.check
+++ /dev/null
diff --git a/test/files/run/macro-reify-nested-a.flags b/test/files/run/macro-reify-nested-a.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-reify-nested-a.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a1/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a1/Impls_Macros_1.scala
new file mode 100644
index 0000000000..7f877b2729
--- /dev/null
+++ b/test/files/run/macro-reify-nested-a1/Impls_Macros_1.scala
@@ -0,0 +1,47 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+
+case class Utils[C <: Context]( c:C ) {
+ import c.universe._
+ import c.{Tree=>_}
+ object removeDoubleReify extends c.universe.Transformer {
+ def apply( tree:Tree ) = transform(tree)
+ override def transform(tree: Tree): Tree = {
+ super.transform {
+ tree match {
+ case Apply(TypeApply(Select(_this, termname), _), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case Apply(Select(_this, termname), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case _ => tree
+ }
+ }
+ }
+ }
+}
+object QueryableMacros{
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ import c.universe._
+ import internal._
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
+ val foo = c.Expr[ru.Expr[Queryable[S]]](
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ Utils[c.type](c).removeDoubleReify(
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
+ ).asInstanceOf[Tree]
+ )))
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
+ }
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: Context)
+ (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
+}
+class Queryable[T]{
+ def _map[S]( projection: T => S ) : Queryable[S] = ???
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a/Test_2.scala b/test/files/run/macro-reify-nested-a1/Test_2.scala
index fa0eb378af..b99c4c55e4 100644
--- a/test/files/run/macro-reify-nested-a/Test_2.scala
+++ b/test/files/run/macro-reify-nested-a1/Test_2.scala
@@ -1,4 +1,9 @@
object Test extends App{
val q : Queryable[Any] = new Queryable[Any]
q.map(e1 => q.map(e2=>e1))
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1))
+ }
} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a2/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a2/Impls_Macros_1.scala
new file mode 100644
index 0000000000..965b191044
--- /dev/null
+++ b/test/files/run/macro-reify-nested-a2/Impls_Macros_1.scala
@@ -0,0 +1,47 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+case class Utils[C <: Context]( c:C ) {
+ import c.universe._
+ import c.{Tree=>_}
+ object removeDoubleReify extends c.universe.Transformer {
+ def apply( tree:Tree ) = transform(tree)
+ override def transform(tree: Tree): Tree = {
+ super.transform {
+ tree match {
+ case Apply(TypeApply(Select(_this, termname), _), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case Apply(Select(_this, termname), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case _ => tree
+ }
+ }
+ }
+ }
+}
+object QueryableMacros{
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ import c.universe._
+ import internal._
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
+ val foo = c.Expr[ru.Expr[Queryable[S]]](
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ Utils[c.type](c).removeDoubleReify(
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
+ ).asInstanceOf[Tree]
+ )))
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
+ }
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: Context)
+ (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
+}
+class Queryable[T]{
+ def _map[S]( projection: T => S ) : Queryable[S] = ???
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a2/Test_2.scala b/test/files/run/macro-reify-nested-a2/Test_2.scala
new file mode 100644
index 0000000000..b99c4c55e4
--- /dev/null
+++ b/test/files/run/macro-reify-nested-a2/Test_2.scala
@@ -0,0 +1,9 @@
+object Test extends App{
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1))
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b.check b/test/files/run/macro-reify-nested-b.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/macro-reify-nested-b.check
+++ /dev/null
diff --git a/test/files/run/macro-reify-nested-b.flags b/test/files/run/macro-reify-nested-b.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-reify-nested-b.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b1/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b1/Impls_Macros_1.scala
new file mode 100644
index 0000000000..7f877b2729
--- /dev/null
+++ b/test/files/run/macro-reify-nested-b1/Impls_Macros_1.scala
@@ -0,0 +1,47 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+
+case class Utils[C <: Context]( c:C ) {
+ import c.universe._
+ import c.{Tree=>_}
+ object removeDoubleReify extends c.universe.Transformer {
+ def apply( tree:Tree ) = transform(tree)
+ override def transform(tree: Tree): Tree = {
+ super.transform {
+ tree match {
+ case Apply(TypeApply(Select(_this, termname), _), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case Apply(Select(_this, termname), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case _ => tree
+ }
+ }
+ }
+ }
+}
+object QueryableMacros{
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ import c.universe._
+ import internal._
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
+ val foo = c.Expr[ru.Expr[Queryable[S]]](
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ Utils[c.type](c).removeDoubleReify(
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
+ ).asInstanceOf[Tree]
+ )))
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
+ }
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: Context)
+ (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
+}
+class Queryable[T]{
+ def _map[S]( projection: T => S ) : Queryable[S] = ???
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b/Test_2.scala b/test/files/run/macro-reify-nested-b1/Test_2.scala
index fa13f57ffb..b199036349 100644
--- a/test/files/run/macro-reify-nested-b/Test_2.scala
+++ b/test/files/run/macro-reify-nested-b1/Test_2.scala
@@ -1,4 +1,9 @@
object Test extends App{
val q : Queryable[Any] = new Queryable[Any]
q.map(e1 => q.map(e2=>e1).map(e2=>e1))
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1).map(e2=>e1))
+ }
} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b2/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b2/Impls_Macros_1.scala
new file mode 100644
index 0000000000..965b191044
--- /dev/null
+++ b/test/files/run/macro-reify-nested-b2/Impls_Macros_1.scala
@@ -0,0 +1,47 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+case class Utils[C <: Context]( c:C ) {
+ import c.universe._
+ import c.{Tree=>_}
+ object removeDoubleReify extends c.universe.Transformer {
+ def apply( tree:Tree ) = transform(tree)
+ override def transform(tree: Tree): Tree = {
+ super.transform {
+ tree match {
+ case Apply(TypeApply(Select(_this, termname), _), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case Apply(Select(_this, termname), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case _ => tree
+ }
+ }
+ }
+ }
+}
+object QueryableMacros{
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ import c.universe._
+ import internal._
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
+ val foo = c.Expr[ru.Expr[Queryable[S]]](
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ Utils[c.type](c).removeDoubleReify(
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
+ ).asInstanceOf[Tree]
+ )))
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
+ }
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: Context)
+ (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
+}
+class Queryable[T]{
+ def _map[S]( projection: T => S ) : Queryable[S] = ???
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b2/Test_2.scala b/test/files/run/macro-reify-nested-b2/Test_2.scala
new file mode 100644
index 0000000000..b199036349
--- /dev/null
+++ b/test/files/run/macro-reify-nested-b2/Test_2.scala
@@ -0,0 +1,9 @@
+object Test extends App{
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1).map(e2=>e1))
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1).map(e2=>e1))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
index f19fd239f9..38ec6f022e 100644
--- a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
+++ b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
@@ -1,6 +1,6 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
val `Answer to the Ultimate Question of Life, the Universe, and Everything` = 42
- def foo(c: Ctx) = c.universe.reify { `Answer to the Ultimate Question of Life, the Universe, and Everything` }
+ def foo(c: Context) = c.universe.reify { `Answer to the Ultimate Question of Life, the Universe, and Everything` }
}
diff --git a/test/files/run/macro-reify-ref-to-packageless/Test_2.scala b/test/files/run/macro-reify-ref-to-packageless/Test_2.scala
index 9d475f756d..c167b160be 100644
--- a/test/files/run/macro-reify-ref-to-packageless/Test_2.scala
+++ b/test/files/run/macro-reify-ref-to-packageless/Test_2.scala
@@ -1,4 +1,4 @@
object Test extends App {
- def foo = macro Impls.foo
+ def foo: Int = macro Impls.foo
println(foo)
} \ 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
index 5330d0e32b..f038d8714f 100644
--- 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
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
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(c.eval(x1))
+ def foo(c: Context)(x: c.Expr[Int]) = {
+ import c.universe._
+ val x1 = c.Expr[Int](c.untypecheck(x.tree))
+ c.Expr[Int](Literal(Constant(c.eval(x1))))
}
}
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
index 54bd03fcd2..dbc17e7c15 100644
--- a/test/files/run/macro-reify-splice-outside-reify/Test_2.scala
+++ b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala
@@ -2,7 +2,7 @@ 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(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42))))
try println(cm.mkToolBox().eval(tree))
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-reify-splice-splice.flags b/test/files/run/macro-reify-splice-splice.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-reify-splice-splice.flags
+++ /dev/null
@@ -1 +0,0 @@
--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
deleted file mode 100644
index efdd5dbaa2..0000000000
--- a/test/files/run/macro-reify-splice-splice/Macros_1.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.reflect.macros.{Context => Ctx}
-
-object Macros {
- def foo = macro Impls.foo
-
- object Impls {
- def foo(c: Ctx) = c.universe.reify {
- { c.universe.reify(c.universe.reify("hello world")) }.splice.splice
- }
- }
-} \ No newline at end of file
diff --git a/test/files/run/macro-reify-staticXXX/Macros_1.scala b/test/files/run/macro-reify-staticXXX/Macros_1.scala
index f12c8f7dcc..2993218bb4 100644
--- a/test/files/run/macro-reify-staticXXX/Macros_1.scala
+++ b/test/files/run/macro-reify-staticXXX/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object B { override def toString = "object" }
class C { override def toString = "class" }
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 f2512dcfaf..6f061fd26a 100644
--- a/test/files/run/macro-reify-tagful-a/Macros_1.scala
+++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo[T](s: T) = macro Impls.foo[T]
object Impls {
- def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T: c.WeakTypeTag](c: Context)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}
diff --git a/test/files/run/macro-reify-tagless-a.check b/test/files/run/macro-reify-tagless-a.check
index 231741edc5..d160e8043c 100644
--- a/test/files/run/macro-reify-tagless-a.check
+++ b/test/files/run/macro-reify-tagless-a.check
@@ -1,3 +1,3 @@
-reflective compilation has failed:
+reflective compilation has failed:
Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.WeakTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala
index 96cfb75852..faac3e3a31 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
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo[T](s: T) = macro Impls.foo[T]
object Impls {
- def foo[T](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T](c: Context)(s: c.Expr[T]) = c.universe.reify {
List[T](s.splice)
}
}
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 584c4bdf5b..afb418a755 100644
--- a/test/files/run/macro-reify-tagless-a/Test_2.scala
+++ b/test/files/run/macro-reify-tagless-a/Test_2.scala
@@ -6,9 +6,9 @@ object Test extends App {
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(newTermName("Macros")), newTermName("foo")), List(Literal(Constant("hello world"))))
- val list = ValDef(NoMods, newTermName("list"), tpt, rhs)
- val tree = Block(List(list), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name))))
+ val rhs = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant("hello world"))))
+ val list = ValDef(NoMods, TermName("list"), tpt, rhs)
+ val tree = Block(List(list), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Ident(list.name))))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-reify-type/Macros_1.scala b/test/files/run/macro-reify-type/Macros_1.scala
index 06de05735d..c38cf8aa52 100644
--- a/test/files/run/macro-reify-type/Macros_1.scala
+++ b/test/files/run/macro-reify-type/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import scala.reflect.runtime.{universe => ru}
object StaticReflect {
@@ -6,9 +6,10 @@ object StaticReflect {
def methodImpl[A: c.WeakTypeTag](c: Context)(name: c.Expr[String]): c.Expr[ru.Type] = {
import c.universe._
+ import internal._
val nameName: TermName = name.tree match {
- case Literal(Constant(str: String)) => newTermName(str)
+ case Literal(Constant(str: String)) => TermName(str)
case _ => c.error(c.enclosingPosition, s"Method name not constant.") ; return reify(ru.NoType)
}
val clazz = weakTypeOf[A]
@@ -16,9 +17,9 @@ object StaticReflect {
clazz member nameName match {
case NoSymbol => c.error(c.enclosingPosition, s"No member called $nameName in $clazz.") ; reify(ru.NoType)
case member =>
- val mtpe = member typeSignatureIn clazz
- val mtag = c.reifyType(treeBuild.mkRuntimeUniverseRef, Select(treeBuild.mkRuntimeUniverseRef, newTermName("rootMirror")), mtpe)
- val mtree = Select(mtag, newTermName("tpe"))
+ val mtpe = member infoIn clazz
+ val mtag = c.reifyType(gen.mkRuntimeUniverseRef, Select(gen.mkRuntimeUniverseRef, TermName("rootMirror")), mtpe)
+ val mtree = Select(mtag, TermName("tpe"))
c.Expr[ru.Type](mtree)
}
diff --git a/test/files/run/macro-reify-type/Test_2.scala b/test/files/run/macro-reify-type/Test_2.scala
index 9beaf98681..8ec60e9f61 100644
--- a/test/files/run/macro-reify-type/Test_2.scala
+++ b/test/files/run/macro-reify-type/Test_2.scala
@@ -5,16 +5,16 @@ object Test extends App {
println(method[List[Int]]("map"))
//val $u: scala.reflect.runtime.universe.type = scala.reflect.runtime.universe;
//val $m: $u.Mirror = scala.reflect.runtime.universe.rootMirror;
- //import $u._, $m._, Flag._
+ //import $u._, $m._, Flag._, internal._
//val tpe = {
- // val symdef$B2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTypeName("B"), NoPosition, DEFERRED | PARAM, false);
- // val symdef$That2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTypeName("That"), NoPosition, DEFERRED | PARAM, false);
- // val symdef$f2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTermName("f"), NoPosition, PARAM, false);
- // val symdef$bf2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTermName("bf"), NoPosition, IMPLICIT | PARAM, false);
- // build.setTypeSignature(symdef$B2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor));
- // build.setTypeSignature(symdef$That2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor));
- // build.setTypeSignature(symdef$f2, TypeRef(ThisType(staticPackage("scala").asModule.moduleClass), staticClass("scala.Function1"), List(staticClass("scala.Int").asType.toTypeConstructor, TypeRef(NoPrefix, symdef$B2, List()))));
- // build.setTypeSignature(symdef$bf2, TypeRef(ThisType(staticPackage("scala.collection.generic").asModule.moduleClass), staticClass("scala.collection.generic.CanBuildFrom"), List(TypeRef(ThisType(staticPackage("scala.collection.immutable").asModule.moduleClass), staticClass("scala.collection.immutable.List"), List(staticClass("scala.Int").asType.toTypeConstructor)), TypeRef(NoPrefix, symdef$B2, List()), TypeRef(NoPrefix, symdef$That2, List()))));
+ // val symdef$B2 = reificationSupport.newNestedSymbol(reificationSupport.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TypeName("B"), NoPosition, DEFERRED | PARAM, false);
+ // val symdef$That2 = reificationSupport.newNestedSymbol(reificationSupport.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TypeName("That"), NoPosition, DEFERRED | PARAM, false);
+ // val symdef$f2 = reificationSupport.newNestedSymbol(reificationSupport.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TermName("f"), NoPosition, PARAM, false);
+ // val symdef$bf2 = reificationSupport.newNestedSymbol(reificationSupport.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TermName("bf"), NoPosition, IMPLICIT | PARAM, false);
+ // reificationSupport.setInfo(symdef$B2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor));
+ // reificationSupport.setInfo(symdef$That2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor));
+ // reificationSupport.setInfo(symdef$f2, TypeRef(ThisType(staticPackage("scala").asModule.moduleClass), staticClass("scala.Function1"), List(staticClass("scala.Int").asType.toTypeConstructor, TypeRef(NoPrefix, symdef$B2, List()))));
+ // reificationSupport.setInfo(symdef$bf2, TypeRef(ThisType(staticPackage("scala.collection.generic").asModule.moduleClass), staticClass("scala.collection.generic.CanBuildFrom"), List(TypeRef(ThisType(staticPackage("scala.collection.immutable").asModule.moduleClass), staticClass("scala.collection.immutable.List"), List(staticClass("scala.Int").asType.toTypeConstructor)), TypeRef(NoPrefix, symdef$B2, List()), TypeRef(NoPrefix, symdef$That2, List()))));
// PolyType(List(symdef$B2, symdef$That2), MethodType(List(symdef$f2), MethodType(List(symdef$bf2), TypeRef(NoPrefix, symdef$That2, List()))))
//}
//println(tpe)
diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala
index 9f04c13014..d92dfa3e24 100644
--- a/test/files/run/macro-reify-unreify/Macros_1.scala
+++ b/test/files/run/macro-reify-unreify/Macros_1.scala
@@ -1,15 +1,15 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo(s: String) = macro Impls.foo
object Impls {
- def foo(c: Ctx)(s: c.Expr[String]) = {
+ def foo(c: Context)(s: c.Expr[String]) = {
import c.universe._
- import treeBuild._
+ import internal._
- val world = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, s.tree)
- val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world)))))
+ val world = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, s.tree)
+ val greeting = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world)))))
val typedGreeting = c.Expr[String](greeting)
c.universe.reify {
diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check
index 7deed4a878..86b4d472ed 100644
--- a/test/files/run/macro-repl-basic.check
+++ b/test/files/run/macro-repl-basic.check
@@ -1,36 +1,34 @@
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.macros.{Context => Ctx}
-import scala.reflect.macros.{Context=>Ctx}
+scala> import scala.reflect.macros.blackbox.Context
+import scala.reflect.macros.blackbox.Context
scala>
scala> object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
- def bar(c: Ctx)(x: c.Expr[Int]) = {
+ def bar(c: Context)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
- def quux(c: Ctx)(x: c.Expr[Int]) = {
+ def quux(c: Context)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
}
}
-defined module Impls
+defined object Impls
scala> object Macros {
object Shmacros {
@@ -40,7 +38,7 @@ scala> object Macros {
}; class Macros {
def quux(x: Int): Int = macro Impls.quux
}
-defined module Macros
+defined object Macros
defined class Macros
scala>
diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala
index eae1febb3a..217f3bc0eb 100644
--- a/test/files/run/macro-repl-basic.scala
+++ b/test/files/run/macro-repl-basic.scala
@@ -3,24 +3,24 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
|import language.experimental.macros
- |import scala.reflect.macros.{Context => Ctx}
+ |import scala.reflect.macros.blackbox.Context
|
|object Impls {
- | def foo(c: Ctx)(x: c.Expr[Int]) = {
+ | def foo(c: Context)(x: c.Expr[Int]) = {
| import c.universe._
- | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
| c.Expr[Int](body)
| }
|
- | def bar(c: Ctx)(x: c.Expr[Int]) = {
+ | def bar(c: Context)(x: c.Expr[Int]) = {
| import c.universe._
- | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
| c.Expr[Int](body)
| }
|
- | def quux(c: Ctx)(x: c.Expr[Int]) = {
+ | def quux(c: Context)(x: c.Expr[Int]) = {
| import c.universe._
- | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
| c.Expr[Int](body)
| }
|}
diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check
index 628a9146c4..20d3b2d702 100644
--- a/test/files/run/macro-repl-dontexpand.check
+++ b/test/files/run/macro-repl-dontexpand.check
@@ -1,12 +1,16 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
+scala> def bar1(c: scala.reflect.macros.blackbox.Context) = ???
+bar1: (c: scala.reflect.macros.blackbox.Context)Nothing
+
+scala> def foo1 = macro bar1
+defined term macro foo1: Nothing
-scala> def bar(c: scala.reflect.macros.Context) = ???
-bar: (c: scala.reflect.macros.Context)Nothing
+scala> def bar2(c: scala.reflect.macros.whitebox.Context) = ???
+bar2: (c: scala.reflect.macros.whitebox.Context)Nothing
-scala> def foo = macro bar
-foo: Any
+scala> def foo2 = macro bar2
+defined term macro foo2: Nothing
scala>
diff --git a/test/files/run/macro-repl-dontexpand.scala b/test/files/run/macro-repl-dontexpand.scala
index f3422d88de..920f40084f 100644
--- a/test/files/run/macro-repl-dontexpand.scala
+++ b/test/files/run/macro-repl-dontexpand.scala
@@ -3,7 +3,9 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
override def extraSettings = "-language:experimental.macros"
def code = """
- |def bar(c: scala.reflect.macros.Context) = ???
- |def foo = macro bar
+ |def bar1(c: scala.reflect.macros.blackbox.Context) = ???
+ |def foo1 = macro bar1
+ |def bar2(c: scala.reflect.macros.whitebox.Context) = ???
+ |def foo2 = macro bar2
|""".stripMargin
}
diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala
index 83d80a5bff..851a987206 100644
--- a/test/files/run/macro-settings/Impls_Macros_1.scala
+++ b/test/files/run/macro-settings/Impls_Macros_1.scala
@@ -1,8 +1,11 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: Context) = c.universe.reify {
- println(c.literal(c.settings.toString).splice)
+ def impl(c: Context) = {
+ import c.universe._
+ reify {
+ println(c.Expr[String](Literal(Constant(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 5f3f61ca3f..ded4d85cfc 100644
--- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox.Context
object Macros {
def impl(c: Context) = {
@@ -7,11 +7,12 @@ object Macros {
val inscope = c.inferImplicitValue(c.mirror.staticClass("SourceLocation").toType)
val outer = c.Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null)))
- val Apply(fun, args) = c.enclosingImplicits(0)._2
+ val Apply(fun, args) = c.enclosingImplicits(0).tree
val fileName = fun.pos.source.file.file.getName
val line = fun.pos.line
val charOffset = fun.pos.point
- c.universe.reify { SourceLocation1(outer.splice, c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) }
+ def literal[T](x: T) = c.Expr[T](Literal(Constant(x)))
+ c.universe.reify { SourceLocation1(outer.splice, literal(fileName).splice, literal(line).splice, literal(charOffset).splice) }
}
implicit def sourceLocation: SourceLocation1 = macro impl
diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala
index 535ec2ccf0..f66ab71479 100644
--- a/test/files/run/macro-sip19/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19/Impls_Macros_1.scala
@@ -1,13 +1,14 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox.Context
object Macros {
def impl(c: Context) = {
import c.universe._
- val Apply(fun, args) = c.enclosingImplicits(0)._2
+ val Apply(fun, args) = c.enclosingImplicits(0).tree
val fileName = fun.pos.source.file.file.getName
val line = fun.pos.line
val charOffset = fun.pos.point
- c.universe.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) }
+ def literal[T](x: T) = c.Expr[T](Literal(Constant(x)))
+ c.universe.reify { SourceLocation(literal(fileName).splice, literal(line).splice, literal(charOffset).splice) }
}
implicit def sourceLocation: SourceLocation = macro impl
diff --git a/test/files/run/macro-subpatterns.check b/test/files/run/macro-subpatterns.check
new file mode 100644
index 0000000000..4997146cf2
--- /dev/null
+++ b/test/files/run/macro-subpatterns.check
@@ -0,0 +1,3 @@
+Some(List((a @ Extractor((b @ Extractor((c @ _)))))))
+Some(List((b @ Extractor((c @ _)))))
+Some(List((c @ _)))
diff --git a/test/files/run/macro-subpatterns/Macro_1.scala b/test/files/run/macro-subpatterns/Macro_1.scala
new file mode 100644
index 0000000000..e009e411a2
--- /dev/null
+++ b/test/files/run/macro-subpatterns/Macro_1.scala
@@ -0,0 +1,17 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Extractor {
+ def unapply(x: Any): Any = macro unapplyImpl
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ import internal._
+ q"""
+ new {
+ def isEmpty = false
+ def get = ${subpatterns(x).toString}
+ def unapply(x: Any) = this
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/macro-subpatterns/Test_2.scala b/test/files/run/macro-subpatterns/Test_2.scala
new file mode 100644
index 0000000000..dc6e668877
--- /dev/null
+++ b/test/files/run/macro-subpatterns/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ 42 match {
+ case Extractor(a @ Extractor(b @ Extractor(c))) => println(a); println(b); println(c)
+ }
+}
diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check
index dce976df02..ffbd5a8aa8 100644
--- a/test/files/run/macro-system-properties.check
+++ b/test/files/run/macro-system-properties.check
@@ -1,26 +1,22 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
-scala> import language.experimental._, reflect.macros.Context
-import language.experimental._
-import reflect.macros.Context
+scala> import scala.language.experimental._, scala.reflect.macros.blackbox.Context
+import scala.language.experimental._
+import scala.reflect.macros.blackbox.Context
scala> object GrabContext {
def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context])
// System.properties lets you stash true globals (unlike statics which are classloader scoped)
- def impl(c: Context)() = { System.getProperties.put("lastContext", c); c.literalUnit }
- def grab() = macro impl
+ def impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
+ def grab(): Unit = macro impl
}
-defined module GrabContext
+defined object GrabContext
scala> object Test { class C(implicit a: Any) { GrabContext.grab } }
-defined module Test
+defined object Test
scala> object Test { class C(implicit a: Any) { GrabContext.grab } }
-defined module Test
-
-scala>
+defined object Test
scala>
diff --git a/test/files/run/macro-system-properties.scala b/test/files/run/macro-system-properties.scala
index e182defc81..db88eb7df6 100644
--- a/test/files/run/macro-system-properties.scala
+++ b/test/files/run/macro-system-properties.scala
@@ -3,12 +3,12 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
- import language.experimental._, reflect.macros.Context
+ import scala.language.experimental._, scala.reflect.macros.blackbox.Context
object GrabContext {
def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context])
// System.properties lets you stash true globals (unlike statics which are classloader scoped)
- def impl(c: Context)() = { System.getProperties.put("lastContext", c); c.literalUnit }
- def grab() = macro impl
+ def impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
+ def grab(): Unit = macro impl
}
object Test { class C(implicit a: Any) { GrabContext.grab } }
object Test { class C(implicit a: Any) { GrabContext.grab } }
diff --git a/test/files/run/macro-def-path-dependent-a.check b/test/files/run/macro-term-declared-in-annotation.check
index 7658ad2c24..7658ad2c24 100644
--- a/test/files/run/macro-def-path-dependent-a.check
+++ b/test/files/run/macro-term-declared-in-annotation.check
diff --git a/test/files/run/macro-declared-in-method.flags b/test/files/run/macro-term-declared-in-annotation.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-method.flags
+++ b/test/files/run/macro-term-declared-in-annotation.flags
diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala
index a11ee2907a..c4bcfbc1ba 100644
--- a/test/files/run/macro-declared-in-annotation/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
val body = Block(List(printPrefix), Literal(Constant("this is deprecated")))
c.Expr[String](body)
}
diff --git a/test/files/run/macro-declared-in-annotation/Macros_2.scala b/test/files/run/macro-term-declared-in-annotation/Macros_2.scala
index 40d71c62fb..40d71c62fb 100644
--- a/test/files/run/macro-declared-in-annotation/Macros_2.scala
+++ b/test/files/run/macro-term-declared-in-annotation/Macros_2.scala
diff --git a/test/files/run/macro-declared-in-annotation/Test_3.scala b/test/files/run/macro-term-declared-in-annotation/Test_3.scala
index 866487f028..866487f028 100644
--- a/test/files/run/macro-declared-in-annotation/Test_3.scala
+++ b/test/files/run/macro-term-declared-in-annotation/Test_3.scala
diff --git a/test/files/run/macro-declared-in-anonymous.check b/test/files/run/macro-term-declared-in-anonymous.check
index 09b8d015a6..09b8d015a6 100644
--- a/test/files/run/macro-declared-in-anonymous.check
+++ b/test/files/run/macro-term-declared-in-anonymous.check
diff --git a/test/files/run/macro-declared-in-object-class.flags b/test/files/run/macro-term-declared-in-anonymous.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-object-class.flags
+++ b/test/files/run/macro-term-declared-in-anonymous.flags
diff --git a/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala
new file mode 100644
index 0000000000..5039dffd5f
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala
@@ -0,0 +1,6 @@
+import scala.language.reflectiveCalls
+
+object Test extends App {
+ val macros = new { def foo: Unit = macro Impls.foo }
+ macros.foo
+}
diff --git a/test/files/run/macro-declared-in-block.check b/test/files/run/macro-term-declared-in-block.check
index 5e687db8bf..5e687db8bf 100644
--- a/test/files/run/macro-declared-in-block.check
+++ b/test/files/run/macro-term-declared-in-block.check
diff --git a/test/files/run/macro-declared-in-object-object.flags b/test/files/run/macro-term-declared-in-block.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-object-object.flags
+++ b/test/files/run/macro-term-declared-in-block.flags
diff --git a/test/files/run/macro-term-declared-in-block/Impls_1.scala b/test/files/run/macro-term-declared-in-block/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-block/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-block/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala
index 69088e24bc..80bfc44bee 100644
--- a/test/files/run/macro-declared-in-block/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala
@@ -1,6 +1,6 @@
object Test extends App {
{
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
foo
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-class-class.check b/test/files/run/macro-term-declared-in-class-class.check
index 47248d7af7..47248d7af7 100644
--- a/test/files/run/macro-declared-in-class-class.check
+++ b/test/files/run/macro-term-declared-in-class-class.check
diff --git a/test/files/run/macro-declared-in-object.flags b/test/files/run/macro-term-declared-in-class-class.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-object.flags
+++ b/test/files/run/macro-term-declared-in-class-class.flags
diff --git a/test/files/run/macro-term-declared-in-class-class/Impls_1.scala b/test/files/run/macro-term-declared-in-class-class/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-class-class/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala
index 871857a97f..d6b1f9fab1 100644
--- a/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala
@@ -1,6 +1,6 @@
class Macros {
class Macros {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
}
diff --git a/test/files/run/macro-declared-in-class-object.check b/test/files/run/macro-term-declared-in-class-object.check
index 35af59e40f..35af59e40f 100644
--- a/test/files/run/macro-declared-in-class-object.check
+++ b/test/files/run/macro-term-declared-in-class-object.check
diff --git a/test/files/run/macro-declared-in-package-object.flags b/test/files/run/macro-term-declared-in-class-object.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-package-object.flags
+++ b/test/files/run/macro-term-declared-in-class-object.flags
diff --git a/test/files/run/macro-term-declared-in-class-object/Impls_1.scala b/test/files/run/macro-term-declared-in-class-object/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-class-object/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala
index 994f9fe935..957f666bb0 100644
--- a/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala
@@ -1,6 +1,6 @@
class Macros {
object Macros {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
}
diff --git a/test/files/run/macro-declared-in-class.check b/test/files/run/macro-term-declared-in-class.check
index a1c1d7af8b..a1c1d7af8b 100644
--- a/test/files/run/macro-declared-in-class.check
+++ b/test/files/run/macro-term-declared-in-class.check
diff --git a/test/files/run/macro-declared-in-refinement.flags b/test/files/run/macro-term-declared-in-class.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-refinement.flags
+++ b/test/files/run/macro-term-declared-in-class.flags
diff --git a/test/files/run/macro-term-declared-in-class/Impls_1.scala b/test/files/run/macro-term-declared-in-class/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-class/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala
index 1b9d13e775..5898d94dc1 100644
--- a/test/files/run/macro-declared-in-class/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala
@@ -1,5 +1,5 @@
class Macros {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
object Test extends App {
diff --git a/test/files/run/macro-declared-in-default-param.check b/test/files/run/macro-term-declared-in-default-param.check
index 6decd7aa4d..6decd7aa4d 100644
--- a/test/files/run/macro-declared-in-default-param.check
+++ b/test/files/run/macro-term-declared-in-default-param.check
diff --git a/test/files/run/macro-declared-in-trait.flags b/test/files/run/macro-term-declared-in-default-param.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-declared-in-trait.flags
+++ b/test/files/run/macro-term-declared-in-default-param.flags
diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala
index db1e5c7435..ef0f136139 100644
--- a/test/files/run/macro-declared-in-default-param/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
val body = Block(List(printPrefix), Literal(Constant("it works")))
c.Expr[String](body)
}
diff --git a/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala
new file mode 100644
index 0000000000..16bd95b1e6
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala
@@ -0,0 +1,7 @@
+object Test extends App {
+ def foo(bar: String = { def foo: String = macro Impls.foo; foo }) = println(bar)
+
+ foo()
+ foo("it works")
+ foo()
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-implicit-class.check b/test/files/run/macro-term-declared-in-implicit-class.check
index 5dc968c08c..5dc968c08c 100644
--- a/test/files/run/macro-declared-in-implicit-class.check
+++ b/test/files/run/macro-term-declared-in-implicit-class.check
diff --git a/test/files/run/macro-def-infer-return-type-a.flags b/test/files/run/macro-term-declared-in-implicit-class.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-def-infer-return-type-a.flags
+++ b/test/files/run/macro-term-declared-in-implicit-class.flags
diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala
index 837b306976..ef00f6ff32 100644
--- a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala
+++ b/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala
@@ -1,11 +1,11 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def toOptionOfInt(c: Ctx) = {
+ def toOptionOfInt(c: Context) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, newTermName("x")), newTermName("toInt")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, TermName("x")), TermName("toInt")))))
c.Expr[Option[Int]](body)
}
}
diff --git a/test/files/run/macro-declared-in-implicit-class/Test_2.scala b/test/files/run/macro-term-declared-in-implicit-class/Test_2.scala
index d0bc9cc38c..d0bc9cc38c 100644
--- a/test/files/run/macro-declared-in-implicit-class/Test_2.scala
+++ b/test/files/run/macro-term-declared-in-implicit-class/Test_2.scala
diff --git a/test/files/run/macro-declared-in-method.check b/test/files/run/macro-term-declared-in-method.check
index 5e687db8bf..5e687db8bf 100644
--- a/test/files/run/macro-declared-in-method.check
+++ b/test/files/run/macro-term-declared-in-method.check
diff --git a/test/files/run/macro-def-infer-return-type-b.flags b/test/files/run/macro-term-declared-in-method.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-def-infer-return-type-b.flags
+++ b/test/files/run/macro-term-declared-in-method.flags
diff --git a/test/files/run/macro-term-declared-in-method/Impls_1.scala b/test/files/run/macro-term-declared-in-method/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-method/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-method/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala
index ed5c8b7c43..523989df13 100644
--- a/test/files/run/macro-declared-in-method/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala
@@ -1,6 +1,6 @@
object Test extends App {
def bar() = {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
foo
}
diff --git a/test/files/run/macro-declared-in-object-class.check b/test/files/run/macro-term-declared-in-object-class.check
index 47248d7af7..47248d7af7 100644
--- a/test/files/run/macro-declared-in-object-class.check
+++ b/test/files/run/macro-term-declared-in-object-class.check
diff --git a/test/files/run/macro-def-infer-return-type-c.flags b/test/files/run/macro-term-declared-in-object-class.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-def-infer-return-type-c.flags
+++ b/test/files/run/macro-term-declared-in-object-class.flags
diff --git a/test/files/run/macro-term-declared-in-object-class/Impls_1.scala b/test/files/run/macro-term-declared-in-object-class/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-object-class/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala
index 204deed61c..fe9dbef255 100644
--- a/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala
@@ -1,6 +1,6 @@
object Macros {
class Macros {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
}
diff --git a/test/files/run/macro-declared-in-object-object.check b/test/files/run/macro-term-declared-in-object-object.check
index 35af59e40f..35af59e40f 100644
--- a/test/files/run/macro-declared-in-object-object.check
+++ b/test/files/run/macro-term-declared-in-object-object.check
diff --git a/test/files/run/macro-def-path-dependent-a.flags b/test/files/run/macro-term-declared-in-object-object.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-def-path-dependent-a.flags
+++ b/test/files/run/macro-term-declared-in-object-object.flags
diff --git a/test/files/run/macro-term-declared-in-object-object/Impls_1.scala b/test/files/run/macro-term-declared-in-object-object/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-object-object/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala
index e261a50f3d..4ba7551818 100644
--- a/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala
@@ -1,6 +1,6 @@
object Macros {
object Macros {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
}
diff --git a/test/files/run/macro-declared-in-object.check b/test/files/run/macro-term-declared-in-object.check
index 4d955a96b1..4d955a96b1 100644
--- a/test/files/run/macro-declared-in-object.check
+++ b/test/files/run/macro-term-declared-in-object.check
diff --git a/test/files/run/macro-def-path-dependent-b.flags b/test/files/run/macro-term-declared-in-object.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-def-path-dependent-b.flags
+++ b/test/files/run/macro-term-declared-in-object.flags
diff --git a/test/files/run/macro-term-declared-in-object/Impls_1.scala b/test/files/run/macro-term-declared-in-object/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-object/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala
index a5a4862ba0..9ebf5d7dba 100644
--- a/test/files/run/macro-declared-in-object/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
object Test extends App {
diff --git a/test/files/run/macro-declared-in-package-object.check b/test/files/run/macro-term-declared-in-package-object.check
index bc0069178d..bc0069178d 100644
--- a/test/files/run/macro-declared-in-package-object.check
+++ b/test/files/run/macro-term-declared-in-package-object.check
diff --git a/test/files/run/macro-def-path-dependent-c.flags b/test/files/run/macro-term-declared-in-package-object.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-def-path-dependent-c.flags
+++ b/test/files/run/macro-term-declared-in-package-object.flags
diff --git a/test/files/run/macro-term-declared-in-package-object/Impls_1.scala b/test/files/run/macro-term-declared-in-package-object/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-package-object/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala
index 54a5962e80..1f378b8bfd 100644
--- a/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala
@@ -1,5 +1,5 @@
package object Macros {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
object Test extends App {
diff --git a/test/files/run/macro-declared-in-refinement.check b/test/files/run/macro-term-declared-in-refinement.check
index 09b8d015a6..09b8d015a6 100644
--- a/test/files/run/macro-declared-in-refinement.check
+++ b/test/files/run/macro-term-declared-in-refinement.check
diff --git a/test/files/run/macro-def-path-dependent-d1.flags b/test/files/run/macro-term-declared-in-refinement.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-def-path-dependent-d1.flags
+++ b/test/files/run/macro-term-declared-in-refinement.flags
diff --git a/test/files/run/macro-term-declared-in-refinement/Impls_1.scala b/test/files/run/macro-term-declared-in-refinement/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-refinement/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala
new file mode 100644
index 0000000000..b38616b71a
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala
@@ -0,0 +1,8 @@
+import scala.language.reflectiveCalls
+
+class Base
+
+object Test extends App {
+ val macros = new Base { def foo: Unit = macro Impls.foo }
+ macros.foo
+}
diff --git a/test/files/run/macro-declared-in-trait.check b/test/files/run/macro-term-declared-in-trait.check
index 0d70ac74f3..0f3756ddb6 100644
--- a/test/files/run/macro-declared-in-trait.check
+++ b/test/files/run/macro-term-declared-in-trait.check
@@ -1,6 +1,6 @@
prefix = Expr[Nothing]({
final class $anon extends AnyRef with Base {
- def <init>(): anonymous class $anon = {
+ def <init>(): <$anon: Base> = {
$anon.super.<init>();
()
};
diff --git a/test/files/run/macro-def-path-dependent-d2.flags b/test/files/run/macro-term-declared-in-trait.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-def-path-dependent-d2.flags
+++ b/test/files/run/macro-term-declared-in-trait.flags
diff --git a/test/files/run/macro-term-declared-in-trait/Impls_1.scala b/test/files/run/macro-term-declared-in-trait/Impls_1.scala
new file mode 100644
index 0000000000..c43f5f3f53
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-trait/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
+ c.Expr[Unit](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-trait/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala
index f75906b636..09c60df351 100644
--- a/test/files/run/macro-declared-in-trait/Macros_Test_2.scala
+++ b/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala
@@ -1,5 +1,5 @@
trait Base {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
object Macros extends Base
diff --git a/test/files/run/macro-typecheck-implicitsdisabled.check b/test/files/run/macro-typecheck-implicitsdisabled.check
index c4fa2c5c28..91d8fabd72 100644
--- a/test/files/run/macro-typecheck-implicitsdisabled.check
+++ b/test/files/run/macro-typecheck-implicitsdisabled.check
@@ -1,2 +1,2 @@
-scala.this.Predef.any2ArrowAssoc[Int](1).->[Int](2)
+scala.this.Predef.ArrowAssoc[Int](1).->[Int](2)
scala.reflect.macros.TypecheckException: value -> is not a member of Int
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 633cb930fc..956331cfae 100644
--- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
@@ -1,12 +1,12 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl_with_implicits_enabled(c: Context) = {
import c.universe._
- val tree1 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2))))
- val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false)
- c.literal(ttree1.toString)
+ val tree1 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
+ val ttree1 = c.typecheck(tree1, withImplicitViewsDisabled = false)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_implicits_enabled = macro impl_with_implicits_enabled
@@ -15,12 +15,12 @@ object Macros {
import c.universe._
try {
- val tree2 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2))))
- val ttree2 = c.typeCheck(tree2, withImplicitViewsDisabled = true)
- c.literal(ttree2.toString)
+ val tree2 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
+ val ttree2 = c.typecheck(tree2, withImplicitViewsDisabled = true)
+ c.Expr[String](Literal(Constant(ttree2.toString)))
} catch {
case ex: Throwable =>
- c.literal(ex.toString)
+ c.Expr[String](Literal(Constant(ex.toString)))
}
}
diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check
index 29a881f8b1..c618d22d8d 100644
--- a/test/files/run/macro-typecheck-macrosdisabled.check
+++ b/test/files/run/macro-typecheck-macrosdisabled.check
@@ -1,4 +1,4 @@
-{
+({
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, {
@@ -7,7 +7,7 @@
$treecreator1.super.<init>();
()
};
- def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
+ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
$u.Literal.apply($u.Constant.apply(2))
@@ -20,13 +20,13 @@
$typecreator2.super.<init>();
()
};
- def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
+ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.ConstantType.apply($u.Constant.apply(2))
+ $u.internal.reificationSupport.ConstantType($u.Constant.apply(2))
}
};
new $typecreator2()
}))
-}
+}: reflect.runtime.universe.Expr[Int])
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 f693ad78cc..0e549f4ab8 100644
--- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
@@ -1,29 +1,30 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl_with_macros_enabled(c: Context) = {
import c.universe._
- val ru = Select(Select(Select(Select(Ident(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)
+ val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe"))
+ val tree1 = Apply(Select(ru, TermName("reify")), List(Literal(Constant(2))))
+ val ttree1 = c.typecheck(tree1, withMacrosDisabled = false)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_macros_enabled = macro impl_with_macros_enabled
def impl_with_macros_disabled(c: Context) = {
import c.universe._
+ import internal._
val rupkg = c.mirror.staticModule("scala.reflect.runtime.package")
- val rusym = build.selectTerm(rupkg, "universe")
- val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
- build.setTypeSignature(ru, rutpe)
+ val rusym = reificationSupport.selectTerm(rupkg, "universe")
+ val NullaryMethodType(rutpe) = rusym.info
+ val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe)
+ reificationSupport.setInfo(ru, rutpe)
- val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2))))
- val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
- c.literal(ttree2.toString)
+ val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
+ val ttree2 = c.typecheck(tree2, withMacrosDisabled = true)
+ c.Expr[String](Literal(Constant(ttree2.toString)))
}
def foo_with_macros_disabled = macro impl_with_macros_disabled
diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check
index 27d15d47af..2e862a6089 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2.check
+++ b/test/files/run/macro-typecheck-macrosdisabled2.check
@@ -1,4 +1,4 @@
-{
+({
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, {
@@ -7,10 +7,10 @@
$treecreator1.super.<init>();
()
};
- def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
+ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.build.Ident($m.staticModule("scala.Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ $u.Apply.apply($u.Select.apply($u.internal.reificationSupport.mkIdent($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
}
};
new $treecreator1()
@@ -20,13 +20,13 @@
$typecreator2.super.<init>();
()
};
- def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
+ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
+ $u.internal.reificationSupport.TypeRef($u.internal.reificationSupport.ThisType($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
}
};
new $typecreator2()
}))
-}
+}: reflect.runtime.universe.Expr[Array[Int]])
ru.reify[Array[Int]](scala.Array.apply(2))
diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
index 1dbf5a1a87..f99f5d2f80 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
@@ -1,29 +1,30 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl_with_macros_enabled(c: Context) = {
import c.universe._
- val ru = Select(Select(Select(Select(Ident(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)
+ val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe"))
+ val tree1 = Apply(Select(ru, TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
+ val ttree1 = c.typecheck(tree1, withMacrosDisabled = false)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_macros_enabled = macro impl_with_macros_enabled
def impl_with_macros_disabled(c: Context) = {
import c.universe._
+ import internal._
val rupkg = c.mirror.staticModule("scala.reflect.runtime.package")
- val rusym = build.selectTerm(rupkg, "universe")
- val NullaryMethodType(rutpe) = rusym.typeSignature
- val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
- build.setTypeSignature(ru, rutpe)
+ val rusym = reificationSupport.selectTerm(rupkg, "universe")
+ val NullaryMethodType(rutpe) = rusym.info
+ val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe)
+ reificationSupport.setInfo(ru, rutpe)
- val tree2 = Apply(Select(Ident(ru), 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)
+ val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
+ val ttree2 = c.typecheck(tree2, withMacrosDisabled = true)
+ c.Expr[String](Literal(Constant(ttree2.toString)))
}
def foo_with_macros_disabled = macro impl_with_macros_disabled
diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
index bcbd12817b..5df5f96aa8 100644
--- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
@@ -1,15 +1,21 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
- def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify {
- println("A = " + c.literal(implicitly[c.WeakTypeTag[A]].toString).splice)
- x.splice :: xs.splice
+ def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = {
+ import c.universe._
+ reify {
+ println("A = " + c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[A]].toString))).splice)
+ x.splice :: xs.splice
+ }
}
- def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = c.universe.reify {
- println("B = " + c.literal(implicitly[c.WeakTypeTag[B]].toString).splice)
- Nil
+ def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = {
+ import c.universe._
+ reify {
+ println("B = " + c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[B]].toString))).splice)
+ Nil
+ }
}
def cons[A](x: A, xs: List[A]): List[A] = macro cons_impl[A]
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 0244273b6f..1eb257e1d9 100644
--- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
@@ -1,8 +1,11 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl[T: c.WeakTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.WeakTypeTag[T]].toString).splice) }
+ def impl[T: c.WeakTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = {
+ import c.universe._
+ reify { println(c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[T]].toString))).splice) }
+ }
def foo[T](foo: T) = macro impl[T]
} \ No newline at end of file
diff --git a/test/files/run/macro-vampire-false-warning/Macros_1.scala b/test/files/run/macro-vampire-false-warning/Macros_1.scala
index a1c40a5510..63c34b3ab6 100644
--- a/test/files/run/macro-vampire-false-warning/Macros_1.scala
+++ b/test/files/run/macro-vampire-false-warning/Macros_1.scala
@@ -1,7 +1,7 @@
// As per http://meta.plasm.us/posts/2013/08/31/feeding-our-vampires/
import scala.annotation.StaticAnnotation
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox.Context
import scala.language.experimental.macros
class body(tree: Any) extends StaticAnnotation
@@ -10,8 +10,8 @@ object Macros {
def selFieldImpl(c: Context) = {
import c.universe._
val field = c.macroApplication.symbol
- val bodyAnn = field.annotations.filter(_.tpe <:< typeOf[body]).head
- c.Expr[Any](bodyAnn.scalaArgs.head)
+ val bodyAnn = field.annotations.filter(_.tree.tpe <:< typeOf[body]).head
+ c.Expr[Any](bodyAnn.tree.children(1))
}
def mkObjectImpl(c: Context)(xs: c.Expr[Any]*) = {
@@ -21,32 +21,32 @@ object Macros {
val kvps = xs.map(_.tree).toList map { case Apply(TypeApply(Select(Apply(_, List(Literal(Constant(name: String)))), _), _), List(value)) => name -> value }
// val fields = kvps map { case (k, v) => q"@body($v) def ${TermName(k)} = macro Macros.selFieldImpl" }
val fields = kvps map { case (k, v) => DefDef(
- Modifiers(MACRO, tpnme.EMPTY, List(Apply(Select(New(Ident(newTypeName("body"))), nme.CONSTRUCTOR), List(v)))),
- newTermName(k), Nil, Nil, TypeTree(), Select(Ident(newTermName("Macros")), newTermName("selFieldImpl"))) }
+ Modifiers(MACRO, typeNames.EMPTY, List(Apply(Select(New(Ident(TypeName("body"))), termNames.CONSTRUCTOR), List(v)))),
+ TermName(k), Nil, Nil, Ident(TypeName("Any")), Select(Ident(TermName("Macros")), TermName("selFieldImpl"))) }
// q"import scala.language.experimental.macros; class Workaround { ..$fields }; new Workaround{}"
c.Expr[Any](Block(
List(
- Import(Select(Select(Ident(newTermName("scala")), newTermName("language")), newTermName("experimental")), List(ImportSelector(newTermName("macros"), 51, newTermName("macros"), 51))),
+ Import(Select(Select(Ident(TermName("scala")), TermName("language")), TermName("experimental")), List(ImportSelector(TermName("macros"), 51, TermName("macros"), 51))),
ClassDef(
- NoMods, newTypeName("Workaround"), Nil,
+ NoMods, TypeName("Workaround"), Nil,
Template(
- List(Select(Ident(newTermName("scala")), newTypeName("AnyRef"))), emptyValDef,
+ List(Select(Ident(TermName("scala")), TypeName("AnyRef"))), noSelfType,
DefDef(
- NoMods, nme.CONSTRUCTOR, Nil, List(Nil), TypeTree(),
- Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(()))))
+ NoMods, termNames.CONSTRUCTOR, Nil, List(Nil), TypeTree(),
+ Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(()))))
+: fields)),
ClassDef(
- Modifiers(FINAL), newTypeName("$anon"), Nil,
+ Modifiers(FINAL), TypeName("$anon"), Nil,
Template(
- List(Ident(newTypeName("Workaround"))), emptyValDef,
+ List(Ident(TypeName("Workaround"))), noSelfType,
List(
DefDef(
- NoMods, nme.CONSTRUCTOR, Nil, List(Nil), TypeTree(),
- Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))))))),
- Apply(Select(New(Ident(newTypeName("$anon"))), nme.CONSTRUCTOR), List())))
+ NoMods, termNames.CONSTRUCTOR, Nil, List(Nil), TypeTree(),
+ Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))))))),
+ Apply(Select(New(Ident(TypeName("$anon"))), termNames.CONSTRUCTOR), List())))
}
}
object mkObject {
- def apply(xs: Any*) = macro Macros.mkObjectImpl
+ def apply(xs: Any*): Any = macro Macros.mkObjectImpl
}
diff --git a/test/files/run/t7733.check b/test/files/run/macro-whitebox-dynamic-materialization.check
index 19765bd501..ccec8e5b25 100644
--- a/test/files/run/t7733.check
+++ b/test/files/run/macro-whitebox-dynamic-materialization.check
@@ -1 +1,2 @@
null
+C2
diff --git a/test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala b/test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala
new file mode 100644
index 0000000000..a2e925bb3a
--- /dev/null
+++ b/test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+trait Foo[T]
+
+class C1(val x: Int)
+class C2(val x: String)
+
+trait LowPriority {
+ implicit def lessSpecific[T]: Foo[T] = null
+}
+
+object Foo extends LowPriority {
+ implicit def moreSpecific[T]: Foo[T] = macro Macros.impl[T]
+}
+
+object Macros {
+ def impl[T: c.WeakTypeTag](c: Context) = {
+ import c.universe._
+ val tpe = weakTypeOf[T]
+ if (tpe.members.exists(_.info =:= typeOf[Int]))
+ c.abort(c.enclosingPosition, "I don't like classes that contain integers")
+ q"new Foo[$tpe]{ override def toString = ${tpe.toString} }"
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-whitebox-dynamic-materialization/Test_2.scala b/test/files/run/macro-whitebox-dynamic-materialization/Test_2.scala
new file mode 100644
index 0000000000..bf19209ab7
--- /dev/null
+++ b/test/files/run/macro-whitebox-dynamic-materialization/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ println(implicitly[Foo[C1]])
+ println(implicitly[Foo[C2]])
+} \ No newline at end of file
diff --git a/test/files/run/macro-whitebox-extractor.check b/test/files/run/macro-whitebox-extractor.check
new file mode 100644
index 0000000000..d81cc0710e
--- /dev/null
+++ b/test/files/run/macro-whitebox-extractor.check
@@ -0,0 +1 @@
+42
diff --git a/test/files/run/macro-whitebox-extractor/Macros_1.scala b/test/files/run/macro-whitebox-extractor/Macros_1.scala
new file mode 100644
index 0000000000..d394c0241a
--- /dev/null
+++ b/test/files/run/macro-whitebox-extractor/Macros_1.scala
@@ -0,0 +1,21 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Extractor {
+ def unapply(x: Int): Any = macro Macros.unapplyImpl
+}
+
+object Macros {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/macro-whitebox-extractor/Test_2.scala b/test/files/run/macro-whitebox-extractor/Test_2.scala
new file mode 100644
index 0000000000..41be6f9767
--- /dev/null
+++ b/test/files/run/macro-whitebox-extractor/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ 42 match {
+ case Extractor(x) => println(x)
+ }
+}
diff --git a/test/files/run/macro-whitebox-fundep-materialization.check b/test/files/run/macro-whitebox-fundep-materialization.check
new file mode 100644
index 0000000000..bed7429108
--- /dev/null
+++ b/test/files/run/macro-whitebox-fundep-materialization.check
@@ -0,0 +1 @@
+(23,foo,true)
diff --git a/test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala b/test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala
new file mode 100644
index 0000000000..5e89e6b2f8
--- /dev/null
+++ b/test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala
@@ -0,0 +1,39 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+trait Iso[T, U] {
+ def to(t : T) : U
+ // def from(u : U) : T
+}
+
+object Iso {
+ implicit def materializeIso[T, U]: Iso[T, U] = macro impl[T, U]
+ def impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context): c.Expr[Iso[T, U]] = {
+ import c.universe._
+ import definitions._
+ import Flag._
+
+ val sym = c.weakTypeOf[T].typeSymbol
+ if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class")
+ val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+
+ def mkTpt() = {
+ val core = Ident(TupleClass(fields.length) orElse UnitClass)
+ if (fields.length == 0) core
+ else AppliedTypeTree(core, fields map (f => TypeTree(f.info)))
+ }
+
+ def mkFrom() = {
+ if (fields.length == 0) Literal(Constant(Unit))
+ else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim))))
+ }
+
+ val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template(
+ List(AppliedTypeTree(Ident(newTypeName("Iso")), List(Ident(sym), mkTpt()))),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))),
+ DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom()))))
+ c.Expr[Iso[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List())))
+ }
+}
diff --git a/test/files/run/macro-whitebox-fundep-materialization/Test_2.scala b/test/files/run/macro-whitebox-fundep-materialization/Test_2.scala
new file mode 100644
index 0000000000..40ca1d549c
--- /dev/null
+++ b/test/files/run/macro-whitebox-fundep-materialization/Test_2.scala
@@ -0,0 +1,12 @@
+// see the comments for macroExpand.onDelayed for an explanation of what's tested here
+object Test extends App {
+ case class Foo(i: Int, s: String, b: Boolean)
+ def foo[C, L](c: C)(implicit iso: Iso[C, L]): L = iso.to(c)
+
+ {
+ val equiv = foo(Foo(23, "foo", true))
+ def typed[T](t: => T) {}
+ typed[(Int, String, Boolean)](equiv)
+ println(equiv)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6955.check b/test/files/run/macro-whitebox-structural.check
index 0cfbf08886..0cfbf08886 100644
--- a/test/files/run/t6955.check
+++ b/test/files/run/macro-whitebox-structural.check
diff --git a/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala b/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala
new file mode 100644
index 0000000000..45fdb79c30
--- /dev/null
+++ b/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala
@@ -0,0 +1,16 @@
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ q"""
+ trait Foo {
+ def x = 2
+ }
+ new Foo {}
+ """
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-whitebox-structural/Test_2.scala b/test/files/run/macro-whitebox-structural/Test_2.scala
new file mode 100644
index 0000000000..ea6a817e34
--- /dev/null
+++ b/test/files/run/macro-whitebox-structural/Test_2.scala
@@ -0,0 +1,5 @@
+import Macros._
+
+object Test extends App {
+ println(Macros.foo.x)
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroArgs.check b/test/files/run/macroPlugins-macroArgs.check
new file mode 100644
index 0000000000..a68f8069b6
--- /dev/null
+++ b/test/files/run/macroPlugins-macroArgs.check
@@ -0,0 +1,2 @@
+hijacked 1
+hijacked 2
diff --git a/test/files/run/macroPlugins-macroArgs/Macros_2.scala b/test/files/run/macroPlugins-macroArgs/Macros_2.scala
new file mode 100644
index 0000000000..b19b8f18dc
--- /dev/null
+++ b/test/files/run/macroPlugins-macroArgs/Macros_2.scala
@@ -0,0 +1,11 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context)(arg: c.Tree) = {
+ import c.universe._
+ q"""println($arg)"""
+ }
+
+ def foo(arg: String): Unit = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroArgs/Plugin_1.scala b/test/files/run/macroPlugins-macroArgs/Plugin_1.scala
new file mode 100644
index 0000000000..23e80ced3b
--- /dev/null
+++ b/test/files/run/macroPlugins-macroArgs/Plugin_1.scala
@@ -0,0 +1,21 @@
+package macroArgs
+
+import scala.tools.nsc.Global
+import scala.tools.nsc.plugins.{Plugin => NscPlugin}
+
+class Plugin(val global: Global) extends NscPlugin {
+ import global._
+ import analyzer._
+
+ val name = "macroArgs"
+ val description = "A sample analyzer plugin that overrides macroArgs."
+ val components = Nil
+ addMacroPlugin(MacroPlugin)
+
+ object MacroPlugin extends MacroPlugin {
+ override def pluginsMacroArgs(typer: Typer, expandee: Tree): Option[MacroArgs] = {
+ val MacroArgs(c, List(Literal(Constant(s: String)))) = standardMacroArgs(typer, expandee)
+ Some(MacroArgs(c, List(Literal(Constant("hijacked " + s)))))
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroArgs/Test_3.flags b/test/files/run/macroPlugins-macroArgs/Test_3.flags
new file mode 100644
index 0000000000..966df731d0
--- /dev/null
+++ b/test/files/run/macroPlugins-macroArgs/Test_3.flags
@@ -0,0 +1 @@
+-Xplugin:. \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroArgs/Test_3.scala b/test/files/run/macroPlugins-macroArgs/Test_3.scala
new file mode 100644
index 0000000000..a54d608178
--- /dev/null
+++ b/test/files/run/macroPlugins-macroArgs/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ Macros.foo("1")
+ Macros.foo("2")
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroArgs/scalac-plugin.xml b/test/files/run/macroPlugins-macroArgs/scalac-plugin.xml
new file mode 100644
index 0000000000..0849f0f4ea
--- /dev/null
+++ b/test/files/run/macroPlugins-macroArgs/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>macro-args</name>
+ <classname>macroArgs.Plugin</classname>
+</plugin> \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroExpand.check b/test/files/run/macroPlugins-macroExpand.check
new file mode 100644
index 0000000000..6f685c2af4
--- /dev/null
+++ b/test/files/run/macroPlugins-macroExpand.check
@@ -0,0 +1,2 @@
+expanded into println("impl1")
+expanded into println("impl2")
diff --git a/test/files/run/macroPlugins-macroExpand.flags b/test/files/run/macroPlugins-macroExpand.flags
new file mode 100644
index 0000000000..ea7fc37e1a
--- /dev/null
+++ b/test/files/run/macroPlugins-macroExpand.flags
@@ -0,0 +1 @@
+-Yrangepos:false
diff --git a/test/files/run/macroPlugins-macroExpand/Macros_2.scala b/test/files/run/macroPlugins-macroExpand/Macros_2.scala
new file mode 100644
index 0000000000..c9c88ad2fd
--- /dev/null
+++ b/test/files/run/macroPlugins-macroExpand/Macros_2.scala
@@ -0,0 +1,18 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl1(c: Context) = {
+ import c.universe._
+ q"""println("impl1")"""
+ }
+
+ def impl2(c: Context) = {
+ import c.universe._
+ q"""println("impl2")"""
+ }
+
+ def foo1: Unit = macro impl1
+
+ def foo2: Unit = macro impl2
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroExpand/Plugin_1.scala b/test/files/run/macroPlugins-macroExpand/Plugin_1.scala
new file mode 100644
index 0000000000..13df85cb23
--- /dev/null
+++ b/test/files/run/macroPlugins-macroExpand/Plugin_1.scala
@@ -0,0 +1,27 @@
+package macroExpand
+
+import scala.tools.nsc.Global
+import scala.tools.nsc.plugins.{Plugin => NscPlugin}
+
+class Plugin(val global: Global) extends NscPlugin {
+ import global._
+ import analyzer._
+ import scala.reflect.internal.Mode
+
+ val name = "macroExpand"
+ val description = "A sample analyzer plugin that overrides macroExpand."
+ val components = Nil
+ addMacroPlugin(MacroPlugin)
+
+ object MacroPlugin extends MacroPlugin {
+ override def pluginsMacroExpand(typer: Typer, expandee: Tree, mode: Mode, pt: Type): Option[Tree] = {
+ object expander extends DefMacroExpander(typer, expandee, mode, pt) {
+ override def onSuccess(expanded: Tree) = {
+ val message = s"expanded into ${expanded.toString}"
+ typer.typed(q"println($message)")
+ }
+ }
+ Some(expander(expandee))
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroExpand/Test_3.flags b/test/files/run/macroPlugins-macroExpand/Test_3.flags
new file mode 100644
index 0000000000..966df731d0
--- /dev/null
+++ b/test/files/run/macroPlugins-macroExpand/Test_3.flags
@@ -0,0 +1 @@
+-Xplugin:. \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroExpand/Test_3.scala b/test/files/run/macroPlugins-macroExpand/Test_3.scala
new file mode 100644
index 0000000000..def9b5608a
--- /dev/null
+++ b/test/files/run/macroPlugins-macroExpand/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ Macros.foo1
+ Macros.foo2
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroExpand/scalac-plugin.xml b/test/files/run/macroPlugins-macroExpand/scalac-plugin.xml
new file mode 100644
index 0000000000..860150865c
--- /dev/null
+++ b/test/files/run/macroPlugins-macroExpand/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>macro-expand</name>
+ <classname>macroExpand.Plugin</classname>
+</plugin> \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroRuntime.check b/test/files/run/macroPlugins-macroRuntime.check
new file mode 100644
index 0000000000..af16d1ac36
--- /dev/null
+++ b/test/files/run/macroPlugins-macroRuntime.check
@@ -0,0 +1,2 @@
+hijacked
+hijacked
diff --git a/test/files/run/macroPlugins-macroRuntime/Macros_2.scala b/test/files/run/macroPlugins-macroRuntime/Macros_2.scala
new file mode 100644
index 0000000000..b19b8f18dc
--- /dev/null
+++ b/test/files/run/macroPlugins-macroRuntime/Macros_2.scala
@@ -0,0 +1,11 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context)(arg: c.Tree) = {
+ import c.universe._
+ q"""println($arg)"""
+ }
+
+ def foo(arg: String): Unit = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroRuntime/Plugin_1.scala b/test/files/run/macroPlugins-macroRuntime/Plugin_1.scala
new file mode 100644
index 0000000000..a55adadb48
--- /dev/null
+++ b/test/files/run/macroPlugins-macroRuntime/Plugin_1.scala
@@ -0,0 +1,20 @@
+package macroRuntime
+
+import scala.tools.nsc.Global
+import scala.tools.nsc.plugins.{Plugin => NscPlugin}
+
+class Plugin(val global: Global) extends NscPlugin {
+ import global._
+ import analyzer._
+
+ val name = "macroRuntime"
+ val description = "A sample analyzer plugin that overrides macroRuntime."
+ val components = Nil
+ addMacroPlugin(MacroPlugin)
+
+ object MacroPlugin extends MacroPlugin {
+ override def pluginsMacroRuntime(expandee: Tree): Option[MacroRuntime] = Some({
+ case MacroArgs(_, List(msg)) => q"""println("hijacked")"""
+ })
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroRuntime/Test_3.flags b/test/files/run/macroPlugins-macroRuntime/Test_3.flags
new file mode 100644
index 0000000000..966df731d0
--- /dev/null
+++ b/test/files/run/macroPlugins-macroRuntime/Test_3.flags
@@ -0,0 +1 @@
+-Xplugin:. \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroRuntime/Test_3.scala b/test/files/run/macroPlugins-macroRuntime/Test_3.scala
new file mode 100644
index 0000000000..a54d608178
--- /dev/null
+++ b/test/files/run/macroPlugins-macroRuntime/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ Macros.foo("1")
+ Macros.foo("2")
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-macroRuntime/scalac-plugin.xml b/test/files/run/macroPlugins-macroRuntime/scalac-plugin.xml
new file mode 100644
index 0000000000..8001af1054
--- /dev/null
+++ b/test/files/run/macroPlugins-macroRuntime/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>macro-runtime</name>
+ <classname>macroRuntime.Plugin</classname>
+</plugin> \ No newline at end of file
diff --git a/test/files/run/macroPlugins-namerHooks.check b/test/files/run/macroPlugins-namerHooks.check
new file mode 100644
index 0000000000..c2db5935d4
--- /dev/null
+++ b/test/files/run/macroPlugins-namerHooks.check
@@ -0,0 +1,45 @@
+enterSym(package <empty> { case class C extends scala.Product with scala.Serializable { <caseaccessor> <paramaccessor> val x: Int = _; <caseaccessor> <paramaccessor> val y: Int = _; def <init>(x: Int, y: Int) = { super.<init>(); () } } })
+enterSym(case class C extends scala.Product with scala.Serializable { <caseaccessor> <paramaccessor> val x: Int = _; <caseaccessor> <paramaccessor> val y: Int = _; def <init>(x: Int, y: Int) = { super.<init>(); () } })
+ensureCompanionObject(case class C extends scala.Product with scala.Serializable { <caseaccessor> <paramaccessor> val x: Int = _; <caseaccessor> <paramaccessor> val y: Int = _; def <init>(x: Int, y: Int) = { super.<init>(); () } }, ...)
+enterSym(<synthetic> object C extends runtime.this.AbstractFunction2[Int, Int, C] { def <init>() = { super.<init>(); () }; final override <synthetic> def toString() = "C" })
+enterStat(case class C extends scala.Product with scala.Serializable { <caseaccessor> <paramaccessor> val x: Int = _; <caseaccessor> <paramaccessor> val y: Int = _; def <init>(x: Int, y: Int) = { super.<init>(); () } })
+enterSym(<caseaccessor> <paramaccessor> val x: Int = _)
+enterSym(<caseaccessor> <paramaccessor> val y: Int = _)
+enterSym(def <init>(x: Int, y: Int) = { super.<init>(); () })
+enterSym(<synthetic> def copy(x = x, y = y) = new C(x, y))
+enterStat(<caseaccessor> <paramaccessor> private[this] val x: Int = _)
+enterStat(<caseaccessor> <paramaccessor> private[this] val y: Int = _)
+enterStat(def <init>(x: Int, y: Int) = { super.<init>(); () })
+enterSym(<caseaccessor> <paramaccessor> private[this] val x: Int = _)
+enterSym(<caseaccessor> <paramaccessor> private[this] val y: Int = _)
+enterSym(def <init>(x: Int, y: Int) = { super.<init>(); () })
+enterSym(super.<init>())
+enterStat(super.<init>())
+enterSym(<synthetic> def copy$default$1 = x)
+enterSym(<synthetic> def copy$default$2 = y)
+enterSym(<synthetic> var acc: Int = -889275714)
+enterSym(acc = Statics.this.mix(acc, x))
+enterSym(acc = Statics.this.mix(acc, y))
+enterStat(<synthetic> var acc: Int = -889275714)
+enterStat(acc = Statics.this.mix(acc, x))
+enterStat(acc = Statics.this.mix(acc, y))
+enterSym(<synthetic> val C$1: C = x$1.asInstanceOf[C])
+enterStat(<synthetic> val C$1: C = x$1.asInstanceOf[C])
+enterSym(def <init>() = { super.<init>(); () })
+enterSym(final override <synthetic> def toString() = "C")
+enterSym(case <synthetic> def apply(x: Int, y: Int): C = new C(x, y))
+enterSym(case <synthetic> def unapply(x$0: C) = if (x$0.==(null)) scala.this.None else Some(scala.Tuple2(x$0.x, x$0.y)))
+enterStat(def <init>() = { super.<init>(); () })
+enterStat(final override <synthetic> def toString() = "C")
+enterSym(def <init>() = { super.<init>(); () })
+enterSym(final override <synthetic> def toString() = "C")
+enterSym(super.<init>())
+enterStat(super.<init>())
+enterSym(case <synthetic> val x1: Int = x$1)
+enterStat(case <synthetic> val x1: Int = x$1)
+enterSym(case <synthetic> val x1: Any = x$1)
+enterSym(case5(){ if (x1.isInstanceOf[C]) matchEnd4(true) else case6() })
+enterSym(case6(){ matchEnd4(false) })
+enterStat(case <synthetic> val x1: Any = x$1)
+enterStat(case5(){ if (x1.isInstanceOf[C]) matchEnd4(true) else case6() })
+enterStat(case6(){ matchEnd4(false) })
diff --git a/test/files/run/macroPlugins-namerHooks.scala b/test/files/run/macroPlugins-namerHooks.scala
new file mode 100644
index 0000000000..302429b19e
--- /dev/null
+++ b/test/files/run/macroPlugins-namerHooks.scala
@@ -0,0 +1,39 @@
+import scala.tools.partest._
+import scala.tools.nsc._
+
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp"
+
+ def code = """
+ case class C(x: Int, y: Int)
+ """.trim
+
+ def show() {
+ val global = newCompiler()
+ import global._
+ import analyzer._
+
+ val output = collection.mutable.ListBuffer[String]()
+ def log(what: String) = output += what.replace(String.format("%n"), " ")
+
+ object macroPlugin extends MacroPlugin {
+ override def pluginsEnterSym(namer: Namer, tree: Tree): Boolean = {
+ log(s"enterSym($tree)")
+ namer.standardEnterSym(tree)
+ true
+ }
+ override def pluginsEnsureCompanionObject(namer: Namer, cdef: ClassDef, creator: ClassDef => Tree = companionModuleDef(_)): Option[Symbol] = {
+ log(s"ensureCompanionObject($cdef, ...)")
+ Some(namer.standardEnsureCompanionObject(cdef, creator))
+ }
+ override def pluginsEnterStats(typer: Typer, stats: List[Tree]): List[Tree] = {
+ stats.foreach(stat => log(s"enterStat($stat)"))
+ stats
+ }
+ }
+
+ addMacroPlugin(macroPlugin)
+ compileString(global)(code)
+ println(output.mkString("\n"))
+ }
+}
diff --git a/test/files/run/macroPlugins-typedMacroBody.check b/test/files/run/macroPlugins-typedMacroBody.check
new file mode 100644
index 0000000000..b6f8436189
--- /dev/null
+++ b/test/files/run/macroPlugins-typedMacroBody.check
@@ -0,0 +1,2 @@
+impl1
+impl2
diff --git a/test/files/run/macroPlugins-typedMacroBody.flags b/test/files/run/macroPlugins-typedMacroBody.flags
new file mode 100644
index 0000000000..ea7fc37e1a
--- /dev/null
+++ b/test/files/run/macroPlugins-typedMacroBody.flags
@@ -0,0 +1 @@
+-Yrangepos:false
diff --git a/test/files/run/macroPlugins-typedMacroBody/Macros_2.flags b/test/files/run/macroPlugins-typedMacroBody/Macros_2.flags
new file mode 100644
index 0000000000..966df731d0
--- /dev/null
+++ b/test/files/run/macroPlugins-typedMacroBody/Macros_2.flags
@@ -0,0 +1 @@
+-Xplugin:. \ No newline at end of file
diff --git a/test/files/run/macroPlugins-typedMacroBody/Macros_2.scala b/test/files/run/macroPlugins-typedMacroBody/Macros_2.scala
new file mode 100644
index 0000000000..80acfec659
--- /dev/null
+++ b/test/files/run/macroPlugins-typedMacroBody/Macros_2.scala
@@ -0,0 +1,18 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl1(c: Context) = {
+ import c.universe._
+ q"""println("impl1")"""
+ }
+
+ def impl2(c: Context) = {
+ import c.universe._
+ q"""println("impl2")"""
+ }
+
+ def foo1: Unit = macro 1
+
+ def foo2: Unit = macro 2
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-typedMacroBody/Plugin_1.scala b/test/files/run/macroPlugins-typedMacroBody/Plugin_1.scala
new file mode 100644
index 0000000000..e99cf7f75d
--- /dev/null
+++ b/test/files/run/macroPlugins-typedMacroBody/Plugin_1.scala
@@ -0,0 +1,21 @@
+package typedMacroBody
+
+import scala.tools.nsc.Global
+import scala.tools.nsc.plugins.{Plugin => NscPlugin}
+
+class Plugin(val global: Global) extends NscPlugin {
+ import global._
+ import analyzer._
+
+ val name = "typedMacroBody"
+ val description = "A sample analyzer plugin that overrides typedMacroBody."
+ val components = Nil
+ addMacroPlugin(MacroPlugin)
+
+ object MacroPlugin extends MacroPlugin {
+ override def pluginsTypedMacroBody(typer: Typer, ddef: DefDef): Option[Tree] = {
+ val DefDef(_, _, _, _, _, Literal(Constant(num: Int))) = ddef
+ Some(standardTypedMacroBody(typer, copyDefDef(ddef)(rhs = Ident(TermName("impl" + num)))))
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-typedMacroBody/Test_3.scala b/test/files/run/macroPlugins-typedMacroBody/Test_3.scala
new file mode 100644
index 0000000000..def9b5608a
--- /dev/null
+++ b/test/files/run/macroPlugins-typedMacroBody/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ Macros.foo1
+ Macros.foo2
+} \ No newline at end of file
diff --git a/test/files/run/macroPlugins-typedMacroBody/scalac-plugin.xml b/test/files/run/macroPlugins-typedMacroBody/scalac-plugin.xml
new file mode 100644
index 0000000000..e223fa5dca
--- /dev/null
+++ b/test/files/run/macroPlugins-typedMacroBody/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>typed-macro-body</name>
+ <classname>typedMacroBody.Plugin</classname>
+</plugin> \ No newline at end of file
diff --git a/test/files/run/manifests-new.scala b/test/files/run/manifests-new.scala
index f1596dee81..8b42e3ca73 100644
--- a/test/files/run/manifests-new.scala
+++ b/test/files/run/manifests-new.scala
@@ -1,3 +1,6 @@
+
+
+import scala.language.{ higherKinds, postfixOps }
import scala.reflect.runtime.universe._
object Test
@@ -146,4 +149,4 @@ object Test
}
def main(args: Array[String]): Unit = runAllTests
-} \ No newline at end of file
+}
diff --git a/test/files/run/manifests-old.scala b/test/files/run/manifests-old.scala
index 621689a254..d8b1e751d4 100644
--- a/test/files/run/manifests-old.scala
+++ b/test/files/run/manifests-old.scala
@@ -1,3 +1,6 @@
+import scala.language.{ higherKinds, postfixOps }
+
+@deprecated("Suppress warnings", since="2.11")
object Test
{
object Variances extends Enumeration {
@@ -144,4 +147,4 @@ object Test
}
def main(args: Array[String]): Unit = runAllTests
-} \ No newline at end of file
+}
diff --git a/test/files/run/mapConserve.scala b/test/files/run/mapConserve.scala
index 013095b1de..d1d52f3107 100644
--- a/test/files/run/mapConserve.scala
+++ b/test/files/run/mapConserve.scala
@@ -1,11 +1,14 @@
+/*
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
object Test {
val maxListLength = 7 // up to 16, but larger is slower
var testCount = 0
-
- def checkStackOverflow() = {
+
+ def checkStackOverflow() = {
var xs: List[String] = Nil
for (i <- 0 until 250000)
xs = "X" :: xs
@@ -47,7 +50,7 @@ object Test {
// Behaves like existing mapConserve with respect to eq
checkBehaviourUnchanged(data, data mapConserve lastHexDigit, data mapConserve lastHexDigit)
}
-
+
checkStackOverflow();
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/mapValues.scala b/test/files/run/mapValues.scala
index bd1794bc51..d3266bd18f 100644
--- a/test/files/run/mapValues.scala
+++ b/test/files/run/mapValues.scala
@@ -1,7 +1,7 @@
object Test {
val m = Map(1 -> 1, 2 -> 2)
val mv = (m mapValues identity) - 1
-
+
def main(args: Array[String]): Unit = {
assert(mv.size == 1)
}
diff --git a/test/files/run/map_java_conversions.scala b/test/files/run/map_java_conversions.scala
index 7714b2cc74..c007b3e0eb 100644
--- a/test/files/run/map_java_conversions.scala
+++ b/test/files/run/map_java_conversions.scala
@@ -4,53 +4,53 @@
object Test {
-
+
def main(args: Array[String]) {
import collection.JavaConversions._
-
+
test(new java.util.HashMap[String, String])
test(new java.util.Properties)
testConcMap
}
-
+
def testConcMap {
import collection.JavaConversions._
-
+
val concMap = new java.util.concurrent.ConcurrentHashMap[String, String]
-
+
test(concMap)
- val cmap = asScalaConcurrentMap(concMap)
+ val cmap = mapAsScalaConcurrentMap(concMap)
cmap.putIfAbsent("absentKey", "absentValue")
cmap.put("somekey", "somevalue")
assert(cmap.remove("somekey", "somevalue") == true)
assert(cmap.replace("absentKey", "newAbsentValue") == Some("absentValue"))
assert(cmap.replace("absentKey", "newAbsentValue", ".......") == true)
}
-
+
def test(m: collection.mutable.Map[String, String]) {
m.clear
assert(m.size == 0)
-
+
m.put("key", "value")
assert(m.size == 1)
-
+
assert(m.put("key", "anotherValue") == Some("value"))
assert(m.put("key2", "value2") == None)
assert(m.size == 2)
-
+
m += (("key3", "value3"))
assert(m.size == 3)
-
+
m -= "key2"
assert(m.size == 2)
assert(m.nonEmpty)
assert(m.remove("key") == Some("anotherValue"))
-
+
m.clear
for (i <- 0 until 10) m += (("key" + i, "value" + i))
for ((k, v) <- m) assert(k.startsWith("key"))
}
-
+
}
diff --git a/test/files/run/map_test.scala b/test/files/run/map_test.scala
index 1ea864ed58..b76dfb4577 100644
--- a/test/files/run/map_test.scala
+++ b/test/files/run/map_test.scala
@@ -20,7 +20,7 @@ object Test extends App {
val map2 = map1.updated(17,"A small random number")
val map3 = map2.updated(666,"A bigger random number")
val map4 = map3.updated(4711,"A big random number")
- map1 == myMap + Pair(42, "The answer")
+ map1 == myMap + ((42, "The answer"))
var i = 0
var map = map4
while(i < 43) {
diff --git a/test/files/run/matchbytes.scala b/test/files/run/matchbytes.scala
index 7190886bab..f2cea06eb3 100644
--- a/test/files/run/matchbytes.scala
+++ b/test/files/run/matchbytes.scala
@@ -4,4 +4,4 @@ object Test extends App{
case 1 => println(1);
case _ => println("????");
}
-}
+}
diff --git a/test/files/run/matchintasany.scala b/test/files/run/matchintasany.scala
index c6764b31b9..03f6ca2a84 100644
--- a/test/files/run/matchintasany.scala
+++ b/test/files/run/matchintasany.scala
@@ -5,4 +5,4 @@ object Test extends App{
case 1L => println(1);
case _ => println("????");
}
-}
+}
diff --git a/test/files/run/matchnull.scala b/test/files/run/matchnull.scala
index cfb3049239..2cc8550d47 100644
--- a/test/files/run/matchnull.scala
+++ b/test/files/run/matchnull.scala
@@ -3,7 +3,7 @@ object Test
def f1 = null match { case x: AnyRef => 1 case _ => -1 }
def f2(x: Any) = x match { case 52 => 1 ; case null => -1 ; case _ => 0 }
def f3(x: AnyRef) = x match { case x: String => 1 ; case List(_) => 0 ; case null => -1 ; case _ => -2 }
-
+
def main(args: Array[String]): Unit = {
println(f1)
println(f2(null))
diff --git a/test/files/run/matchonseq.scala b/test/files/run/matchonseq.scala
index 49b406a6ec..f6f320245a 100644
--- a/test/files/run/matchonseq.scala
+++ b/test/files/run/matchonseq.scala
@@ -1,8 +1,8 @@
-object Test extends App{
- Vector(1,2,3) match {
- case head +: tail => println("It worked! head=" + head)
+object Test extends App {
+ Vector(1,2,3) match {
+ case head +: tail => println("It worked! head=" + head)
}
- Vector(1,2,3) match {
- case init :+ last => println("It worked! last=" + last)
+ Vector(1,2,3) match {
+ case init :+ last => println("It worked! last=" + last)
}
}
diff --git a/test/files/run/memberpos.check b/test/files/run/memberpos.check
new file mode 100644
index 0000000000..9e3a807f5a
--- /dev/null
+++ b/test/files/run/memberpos.check
@@ -0,0 +1,11 @@
+newSource1.scala
+2,4 class A
+6,28 object A
+ 7,10 def bippy
+ 8 def hello
+ 11,27 class Dingo
+ 12,26 def foooooz
+ 22 val a
+30 class B
+ 30 def f
+
diff --git a/test/files/run/memberpos.scala b/test/files/run/memberpos.scala
new file mode 100644
index 0000000000..f2b79c0ec1
--- /dev/null
+++ b/test/files/run/memberpos.scala
@@ -0,0 +1,39 @@
+import scala.tools.partest._
+
+// Simple sanity test for -Yshow-member-pos.
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp -Ystop-after:parser -Yshow-member-pos \"\" -d " + testOutput.path
+ override def show() = compile()
+ override def code = """
+class A(val a: Int = 1) {
+
+}
+
+object A {
+ def bippy = {
+ def hello = 55
+ "" + hello
+ }
+ class Dingo {
+ def foooooz = /****
+
+
+
+
+
+ ****/ {
+
+
+
+ val a = 1
+
+
+ a
+ }
+ }
+}
+
+class B { def f = 1 }
+
+"""
+}
diff --git a/test/files/run/mirror_symbolof_x.check b/test/files/run/mirror_symbolof_x.check
new file mode 100644
index 0000000000..cc9cad7a13
--- /dev/null
+++ b/test/files/run/mirror_symbolof_x.check
@@ -0,0 +1,13 @@
+class Int
+object C
+type T
+type Id
+class Nothing
+class Null
+class Int
+object C
+type T
+type Id
+class Nothing
+class Null
+exception: class C not found.
diff --git a/test/files/run/mirror_symbolof_x.scala b/test/files/run/mirror_symbolof_x.scala
new file mode 100644
index 0000000000..8fec301f56
--- /dev/null
+++ b/test/files/run/mirror_symbolof_x.scala
@@ -0,0 +1,43 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.api.Mirror
+
+class C
+object C
+
+object Test extends App {
+ object test1 {
+ val m = cm
+ type T = Int
+ type Id[X] = X
+ println(m.symbolOf[Int]: ru.TypeSymbol)
+ println(m.symbolOf[C.type]: ru.TypeSymbol)
+ println(m.symbolOf[T]: ru.TypeSymbol)
+ println(m.symbolOf[Id[_]]: ru.TypeSymbol)
+ println(m.symbolOf[Nothing]: ru.TypeSymbol)
+ println(m.symbolOf[Null]: ru.TypeSymbol)
+ }
+
+ object test2 {
+ val m: Mirror[ru.type] = cm
+ type T = Int
+ type Id[X] = X
+ println(m.symbolOf[Int]: ru.TypeSymbol)
+ println(m.symbolOf[C.type]: ru.TypeSymbol)
+ println(m.symbolOf[T]: ru.TypeSymbol)
+ println(m.symbolOf[Id[_]]: ru.TypeSymbol)
+ println(m.symbolOf[Nothing]: ru.TypeSymbol)
+ println(m.symbolOf[Null]: ru.TypeSymbol)
+ }
+
+ object test3 {
+ val m = ru.runtimeMirror(classOf[Int].getClass.getClassLoader)
+ try println(m.symbolOf[C])
+ catch { case ex: ScalaReflectionException => println(s"exception: ${ex.getMessage}") }
+ }
+
+ test1
+ test2
+ test3
+}
diff --git a/test/files/run/misc.check b/test/files/run/misc.check
index 9fa7b72d50..56116f8104 100644
--- a/test/files/run/misc.check
+++ b/test/files/run/misc.check
@@ -1,3 +1,27 @@
+misc.scala:46: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 42;
+ ^
+misc.scala:47: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 42l;
+ ^
+misc.scala:48: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 23.5f;
+ ^
+misc.scala:49: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 23.5;
+ ^
+misc.scala:50: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ "Hello";
+ ^
+misc.scala:51: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 32 + 45;
+ ^
+misc.scala:62: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ x;
+ ^
+misc.scala:74: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 1 < 2;
+ ^
### Hello
### 17
### Bye
diff --git a/test/files/run/misc.scala b/test/files/run/misc.scala
index 139d2d70f7..2ae76bd968 100644
--- a/test/files/run/misc.scala
+++ b/test/files/run/misc.scala
@@ -60,7 +60,7 @@ object Test {
Console.println;
val x = 13;
x;
- // !!! why are DefDef replaced by Block(Tree[0])? we should use Empty!
+ // !!! why are DefDef replaced by Block(Tree[0])? we should use Empty!
def f = 19;
f;
def f0() = 11;
diff --git a/test/files/run/missingparams.scala b/test/files/run/missingparams.scala
index e9b1d27d68..fbc4d2a4f7 100644
--- a/test/files/run/missingparams.scala
+++ b/test/files/run/missingparams.scala
@@ -6,8 +6,8 @@ final class Foo(val x: Int) {
// test that the closure elimination is not wrongly replacing
// 'that' by 'this'
- def intersect(that: Foo) =
- filter { dummy =>
+ def intersect(that: Foo) =
+ filter { dummy =>
// x // dummy
that.x > 0
}
diff --git a/test/files/run/mixin-signatures.check b/test/files/run/mixin-signatures.check
new file mode 100644
index 0000000000..3031fe75af
--- /dev/null
+++ b/test/files/run/mixin-signatures.check
@@ -0,0 +1,59 @@
+class Test$bar1$ {
+ public java.lang.String Test$bar1$.f(java.lang.Object)
+ public java.lang.Object Test$bar1$.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar1$.g(java.lang.String)
+ public java.lang.Object Test$bar1$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar1$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar1$.h(java.lang.Object)
+}
+
+class Test$bar2$ {
+ public java.lang.Object Test$bar2$.f(java.lang.String)
+ public java.lang.Object Test$bar2$.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar2$.g(java.lang.String)
+ public java.lang.Object Test$bar2$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar2$.g(java.lang.String) <bridge> <synthetic>
+ public java.lang.Object Test$bar2$.h(java.lang.Object)
+}
+
+class Test$bar3$ {
+ public java.lang.String Foo3.f(java.lang.Object)
+ generic: public java.lang.String Foo3.f(T)
+ public java.lang.Object Foo3.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar3$.g(java.lang.String)
+ public java.lang.Object Test$bar3$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar3$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Foo3.h(java.lang.Object)
+}
+
+class Test$bar4$ {
+ public java.lang.Object Foo4.f(java.lang.String)
+ generic: public R Foo4.f(java.lang.String)
+ public java.lang.Object Foo4.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar4$.g(java.lang.String)
+ public java.lang.Object Test$bar4$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar4$.g(java.lang.String) <bridge> <synthetic>
+ public java.lang.Object Foo4.h(java.lang.Object)
+}
+
+class Test$bar5$ {
+ public java.lang.String Test$bar5$.f(java.lang.String)
+ public java.lang.Object Test$bar5$.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar5$.f(java.lang.String) <bridge> <synthetic>
+ public java.lang.String Test$bar5$.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar5$.g(java.lang.String)
+ public java.lang.Object Test$bar5$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar5$.g(java.lang.String) <bridge> <synthetic>
+ public java.lang.String Test$bar5$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar5$.h(java.lang.Object)
+}
+
+class Foo1$class {
+ public static java.lang.String Foo1$class.f(Foo1,java.lang.Object)
+}
+
+class Foo2$class {
+ public static java.lang.Object Foo2$class.f(Foo2,java.lang.String)
+}
+
+000000000000000000000000000000000000
diff --git a/test/files/run/mixin-signatures.scala b/test/files/run/mixin-signatures.scala
new file mode 100644
index 0000000000..afd3fad877
--- /dev/null
+++ b/test/files/run/mixin-signatures.scala
@@ -0,0 +1,105 @@
+trait Base[T, R] {
+ def f(x: T): R
+ def g(x: T): R
+ def h(x: T): R = null.asInstanceOf[R]
+}
+
+trait Foo1[T] extends Base[T, String] {
+ def f(x: T): String = null
+ def g(x: T): String
+}
+trait Foo2[R] extends Base[String, R] {
+ def f(x: String): R = { print(x.length) ; null.asInstanceOf[R] }
+ def g(x: String): R
+}
+abstract class Foo3[T] extends Base[T, String] {
+ def f(x: T): String = ""
+ def g(x: T): String
+}
+abstract class Foo4[R] extends Base[String, R] {
+ def f(x: String): R = { print(x.length) ; null.asInstanceOf[R] }
+ def g(x: String): R
+}
+
+object Test {
+ object bar1 extends Foo1[String] { def g(x: String): String = { print(x.length) ; "" } }
+ object bar2 extends Foo2[String] { def g(x: String): String = { print(x.length) ; "" } }
+ object bar3 extends Foo3[String] { def g(x: String): String = { print(x.length) ; "" } }
+ object bar4 extends Foo4[String] { def g(x: String): String = { print(x.length) ; "" } }
+
+ // Notice that in bar5, f and g require THREE bridges, because the final
+ // implementation is (String)String, but:
+ //
+ // inherited abstract signatures: T(R), (T)String, and (String)R
+ // which erase to: (Object)Object, (Object)String, and (String)Object
+ //
+ // each of which must be bridged to the actual (String)String implementation.
+ //
+ // public java.lang.String Test$bar5$.g(java.lang.String)
+ // public java.lang.Object Test$bar5$.g(java.lang.String) <bridge> <synthetic>
+ // public java.lang.Object Test$bar5$.g(java.lang.Object) <bridge> <synthetic>
+ // public java.lang.String Test$bar5$.g(java.lang.Object) <bridge> <synthetic>
+ object bar5 extends Foo1[String] with Foo2[String] {
+ override def f(x: String): String = { print(x.length) ; x }
+ def g(x: String): String = { print(x.length) ; x }
+ }
+
+ final def m1[T, R](x: Base[T, R], y: T) = { x.f(y) ; x.g(y) ; x.h(y) }
+ final def m2[T](x: Base[T, String], y: T) = { x.f(y) ; x.g(y) ; x.h(y) }
+ final def m3[R](x: Base[String, R]) = { x.f("") ; x.g("") ; x.h("") }
+ final def m4(x: Base[String, String]) = { x.f("") ; x.g("") ; x.h("") }
+
+ final def m11[T](x: Foo1[T], y: T) = { x.f(y) ; x.g(y) ; x.h(y) }
+ final def m12(x: Foo1[String]) = { x.f("") ; x.g("") ; x.h("") }
+ final def m21[T](x: Foo2[T], y: T) = { x.f("") ; x.g("") ; x.h("") }
+ final def m22(x: Foo2[String]) = { x.f("") ; x.g("") ; x.h("") }
+ final def m31[T](x: Foo3[T], y: T) = { x.f(y) ; x.g(y) ; x.h(y) }
+ final def m32(x: Foo3[String]) = { x.f("") ; x.g("") ; x.h("") }
+ final def m41[T](x: Foo4[T], y: T) = { x.f("") ; x.g("") ; x.h("") }
+ final def m42(x: Foo4[String]) = { x.f("") ; x.g("") ; x.h("") }
+
+ def go = {
+ m1(bar1, "") ; m2(bar1, "") ; m3(bar1) ; m4(bar1)
+ m1(bar2, "") ; m2(bar2, "") ; m3(bar2) ; m4(bar2)
+ m1(bar3, "") ; m2(bar3, "") ; m3(bar3) ; m4(bar3)
+ m1(bar4, "") ; m2(bar4, "") ; m3(bar4) ; m4(bar4)
+
+ m11(bar1, "") ; m12(bar1)
+ m21(bar2, "") ; m22(bar2)
+ m31(bar3, "") ; m32(bar3)
+ m41(bar4, "") ; m42(bar4)
+ ""
+ }
+
+ def flagsString(m: java.lang.reflect.Method) = {
+ val str = List(
+ if (m.isBridge) "<bridge>" else "",
+ if (m.isSynthetic) "<synthetic>" else ""
+ ) filterNot (_ == "") mkString " "
+
+ if (str == "") "" else " " + str
+ //
+ // val flags = scala.reflect.internal.ClassfileConstants.toScalaMethodFlags(m.getModifiers())
+ // scala.tools.nsc.symtab.Flags.flagsToString(flags)
+ }
+
+ def show(clazz: Class[_]) {
+ print(clazz + " {")
+ clazz.getMethods.sortBy(x => (x.getName, x.isBridge, x.toString)) filter (_.getName.length == 1) foreach { m =>
+ print("\n " + m + flagsString(m))
+ if ("" + m != "" + m.toGenericString) {
+ print("\n generic: " + m.toGenericString)
+ }
+ }
+ println("\n}")
+ println("")
+ }
+ def show(x: AnyRef) { show(x.getClass) }
+ def show(x: String) { show(Class.forName(x)) }
+
+ def main(args: Array[String]): Unit = {
+ List(bar1, bar2, bar3, bar4, bar5) foreach show
+ List("Foo1$class", "Foo2$class") foreach show
+ println(go)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/mutable-treeset.scala b/test/files/run/mutable-treeset.scala
new file mode 100644
index 0000000000..100ab39965
--- /dev/null
+++ b/test/files/run/mutable-treeset.scala
@@ -0,0 +1,145 @@
+import scala.collection.mutable.TreeSet
+
+object Test extends App {
+ val list = List(6,5,4,3,2,1,1,2,3,4,5,6,6,5,4,3,2,1)
+ val distinct = list.distinct
+ val sorted = distinct.sorted
+
+ // sublist stuff for a single level of slicing
+ val min = list.min
+ val max = list.max
+ val nonlist = ((min - 10) until (max + 20) filterNot list.contains).toList
+ val sublist = list filter {x => x >=(min + 1) && x < max}
+ val distinctSublist = sublist.distinct
+ val subnonlist = min :: max :: nonlist
+ val subsorted = distinctSublist.sorted
+
+ // subsublist for a 2nd level of slicing
+ val almostmin = sublist.min
+ val almostmax = sublist.max
+ val subsublist = sublist filter {x => x >=(almostmin + 1) && x < almostmax}
+ val distinctSubsublist = subsublist.distinct
+ val subsubnonlist = almostmin :: almostmax :: subnonlist
+ val subsubsorted = distinctSubsublist.sorted
+
+ def testSize {
+ def check(set : TreeSet[Int], list: List[Int]) {
+ assert(set.size == list.size, s"$set had size ${set.size} while $list had size ${list.size}")
+ }
+
+ check(TreeSet[Int](), List[Int]())
+ val set = TreeSet(list:_*)
+ check(set, distinct)
+ check(set.clone, distinct)
+
+ val subset = set from (min + 1) until max
+ check(subset, distinctSublist)
+ check(subset.clone, distinctSublist)
+
+ val subsubset = subset from (almostmin + 1) until almostmax
+ check(subsubset, distinctSubsublist)
+ check(subsubset.clone, distinctSubsublist)
+ }
+
+ def testContains {
+ def check(set : TreeSet[Int], list: List[Int], nonlist: List[Int]) {
+ assert(list forall set.apply, s"$set did not contain all elements of $list using apply")
+ assert(list forall set.contains, s"$set did not contain all elements of $list using contains")
+ assert(!(nonlist exists set.apply), s"$set had an element from $nonlist using apply")
+ assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains")
+ }
+
+ val set = TreeSet(list:_*)
+ check(set, list, nonlist)
+ check(set.clone, list, nonlist)
+
+ val subset = set from (min + 1) until max
+ check(subset, sublist, subnonlist)
+ check(subset.clone, sublist, subnonlist)
+
+ val subsubset = subset from (almostmin + 1) until almostmax
+ check(subsubset, subsublist, subsubnonlist)
+ check(subsubset.clone, subsublist, subsubnonlist)
+ }
+
+ def testAdd {
+ def check(set : TreeSet[Int], list: List[Int], nonlist: List[Int]) {
+ var builtList = List[Int]()
+ for (x <- list) {
+ set += x
+ builtList = (builtList :+ x).distinct.sorted filterNot nonlist.contains
+ assert(builtList forall set.apply, s"$set did not contain all elements of $builtList using apply")
+ assert(builtList.size == set.size, s"$set had size ${set.size} while $builtList had size ${builtList.size}")
+ }
+ assert(!(nonlist exists set.apply), s"$set had an element from $nonlist using apply")
+ assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains")
+ }
+
+ val set = TreeSet[Int]()
+ val clone = set.clone
+ val subset = set.clone from (min + 1) until max
+ val subclone = subset.clone
+ val subsubset = subset.clone from (almostmin + 1) until almostmax
+ val subsubclone = subsubset.clone
+
+ check(set, list, nonlist)
+ check(clone, list, nonlist)
+
+ check(subset, list, subnonlist)
+ check(subclone, list, subnonlist)
+
+ check(subsubset, list, subsubnonlist)
+ check(subsubclone, list, subsubnonlist)
+ }
+
+ def testRemove {
+ def check(set: TreeSet[Int], sorted: List[Int]) {
+ var builtList = sorted
+ for (x <- list) {
+ set remove x
+ builtList = builtList filterNot (_ == x)
+ assert(builtList forall set.apply, s"$set did not contain all elements of $builtList using apply")
+ assert(builtList.size == set.size, s"$set had size $set.size while $builtList had size $builtList.size")
+ }
+ }
+ val set = TreeSet(list:_*)
+ val clone = set.clone
+ val subset = set.clone from (min + 1) until max
+ val subclone = subset.clone
+ val subsubset = subset.clone from (almostmin + 1) until almostmax
+ val subsubclone = subsubset.clone
+
+ check(set, sorted)
+ check(clone, sorted)
+
+ check(subset, subsorted)
+ check(subclone, subsorted)
+
+ check(subsubset, subsubsorted)
+ check(subsubclone, subsubsorted)
+ }
+
+ def testIterator {
+ def check(set: TreeSet[Int], list: List[Int]) {
+ val it = set.iterator.toList
+ assert(it == list, s"$it did not equal $list")
+ }
+ val set = TreeSet(list: _*)
+ check(set, sorted)
+ check(set.clone, sorted)
+
+ val subset = set from (min + 1) until max
+ check(subset, subsorted)
+ check(subset.clone, subsorted)
+
+ val subsubset = subset from (almostmin + 1) until almostmax
+ check(subsubset, subsubsorted)
+ check(subsubset.clone, subsubsorted)
+ }
+
+ testSize
+ testContains
+ testAdd
+ testRemove
+ testIterator
+}
diff --git a/test/files/run/name-based-patmat.check b/test/files/run/name-based-patmat.check
new file mode 100644
index 0000000000..3d5fc40ed7
--- /dev/null
+++ b/test/files/run/name-based-patmat.check
@@ -0,0 +1,12 @@
+`catdog only` has 11 chars
+`catdog only, no product` has 23 chars
+catdog
+2 catdogs! A ha ha!
+3 catdogs! A ha ha!
+catdog
+2 catdogs! A ha ha!
+3 catdogs! A ha ha!
+1
+1
+2
+3
diff --git a/test/files/run/name-based-patmat.scala b/test/files/run/name-based-patmat.scala
new file mode 100644
index 0000000000..8e20940100
--- /dev/null
+++ b/test/files/run/name-based-patmat.scala
@@ -0,0 +1,105 @@
+final class MiniSome[T](val get: T) extends AnyVal { def isEmpty = false }
+
+package p0 {
+ class Single(val x: Any) extends AnyRef with Product1[String] {
+ private def s = "" + x
+ override def canEqual(x: Any) = this eq x.asInstanceOf[AnyRef]
+ def isEmpty = false
+ def get = this
+ def _1 = s + " only"
+
+ override def toString = s"Single(${_1})"
+ }
+
+ object Single {
+ def unapply(x: Any): Single = new Single(x)
+ }
+
+ class SingleNoProduct(val x: Any) extends AnyRef {
+ private def s = "" + x
+ def isEmpty = false
+ def get = s + " only, no product"
+
+ override def toString = s"SingleNoProduct($get)"
+ }
+
+ object SingleNoProduct {
+ def unapply(x: Any): SingleNoProduct = new SingleNoProduct(x)
+ }
+}
+
+package p1 {
+ class Triple(val x: Any) extends AnyRef with Product3[String, String, String] {
+ private def s = "" + x
+ override def canEqual(x: Any) = this eq x.asInstanceOf[AnyRef]
+ def isEmpty = false
+ def get = this
+ def _1 = s
+ def _2 = "2 " + s + "s! A ha ha!"
+ def _3 = "3 " + s + "s! A ha ha!"
+
+ override def toString = s"Triple(${_1}, ${_2}, ${_3})"
+ }
+
+ object Triple {
+ def unapply(x: Any): Triple = new Triple(x)
+ }
+}
+
+package p2 {
+ class Triple(val x: Any) {
+ private def s = "" + x
+ def isEmpty = false
+ def get = this
+ def _1 = s
+ def _2 = "2 " + s + "s! A ha ha!"
+ def _3 = "3 " + s + "s! A ha ha!"
+ override def toString = s"Triple(${_1}, ${_2}, ${_3})"
+ }
+
+ object Triple {
+ def unapply(x: Any): Triple = new Triple(x)
+ }
+}
+
+package p3 {
+ case class Foo(x: Int, y: Int, zs: Int*)
+
+ object Bar {
+ def f(x: Foo) = x match {
+ case Foo(5, 10, 15, 20, _*) => 1
+ case Foo(5, 10, 15, _*) => 2
+ case Foo(5, 10, _*) => 3
+ case Foo(5, 10) => 4 // should warn unreachable
+ case _ => 5
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ "catdog" match {
+ case p0.Single(x) => println(s"`${x._1}` has ${x._1.length} chars")
+ case x => println("fail: " + x)
+ }
+ "catdog" match {
+ case p0.SingleNoProduct(x) => println(s"`$x` has ${x.length} chars")
+ case x => println("fail: " + x)
+ }
+ "catdog" match {
+ case p1.Triple(x, y, z) => List(x, y, z) foreach println
+ case x => println("fail: " + x)
+ }
+ // TODO
+ "catdog" match {
+ case p2.Triple(x, y, z) => List(x, y, z) foreach println
+ case x => println("fail: " + x)
+ }
+
+ println(p3.Bar.f(p3.Foo(5, 10, 15, 20, 25)))
+ println(p3.Bar.f(p3.Foo(5, 10, 15, 20)))
+ println(p3.Bar.f(p3.Foo(5, 10, 15)))
+ println(p3.Bar.f(p3.Foo(5, 10)))
+ // println(p3.Bar.f(p3.Foo(5)))
+ }
+}
diff --git a/test/files/run/names-defaults.check b/test/files/run/names-defaults.check
index f253de71d6..0037822f3b 100644
--- a/test/files/run/names-defaults.check
+++ b/test/files/run/names-defaults.check
@@ -1,3 +1,7 @@
+names-defaults.scala:269: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ spawn(b = { val ttt = 1; ttt }, a = 0)
+ ^
+warning: there were 4 deprecation warning(s); re-run with -deprecation for details
1: @
get: $
get: 2
diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala
index 220414f02a..05cd4a540c 100644
--- a/test/files/run/names-defaults.scala
+++ b/test/files/run/names-defaults.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ higherKinds, existentials }
+
object Test extends App {
def get[T](x: T) = { println("get: "+ x); x }
diff --git a/test/files/run/no-pickle-skolems.check b/test/files/run/no-pickle-skolems.check
new file mode 100644
index 0000000000..d64066171a
--- /dev/null
+++ b/test/files/run/no-pickle-skolems.check
@@ -0,0 +1 @@
+OK!
diff --git a/test/files/run/no-pickle-skolems/Source_1.scala b/test/files/run/no-pickle-skolems/Source_1.scala
new file mode 100644
index 0000000000..1b4cbfa788
--- /dev/null
+++ b/test/files/run/no-pickle-skolems/Source_1.scala
@@ -0,0 +1,5 @@
+package s
+
+trait Foo { def to[CC[X]](implicit cc: CC[Int]): Unit }
+
+class Bar extends Foo { def to[CC[X]](implicit cc: CC[Int]): Unit = ??? }
diff --git a/test/files/run/no-pickle-skolems/Test_2.scala b/test/files/run/no-pickle-skolems/Test_2.scala
new file mode 100644
index 0000000000..da55ad9df0
--- /dev/null
+++ b/test/files/run/no-pickle-skolems/Test_2.scala
@@ -0,0 +1,39 @@
+
+import scala.language.reflectiveCalls
+import scala.reflect.runtime.universe._
+
+object Test {
+ /** Collects symbols by the given name, even if they're not
+ * named CC.
+ */
+ def collectSymbols[T: TypeTag](inMethod: TermName, name: String): List[String] = {
+ val m = typeOf[T] member inMethod infoIn typeOf[T]
+ var buf: List[Symbol] = Nil
+ var seen: Set[Symbol] = Set()
+ def id(s: Symbol): Int = s.asInstanceOf[{ def id: Int }].id
+
+ def check(s: Symbol) {
+ if (!seen(s)) {
+ seen += s
+ if (s.name.toString == name) buf ::= s
+ }
+ }
+ def loop(t: Type) {
+ t match {
+ case TypeRef(pre, sym, args) => loop(pre) ; check(sym) ; args foreach loop
+ case PolyType(tparams, restpe) => tparams foreach { tp => check(tp) ; check(tp.owner) ; loop(tp.info) } ; loop(restpe)
+ case MethodType(params, restpe) => params foreach { p => check(p) ; loop(p.info) } ; loop(restpe)
+ case _ =>
+ }
+ }
+ loop(m)
+
+ buf.reverse.distinct map (s => s.name + "#" + id(s))
+ }
+
+ def main(args: Array[String]): Unit = {
+ val syms = collectSymbols[s.Bar](TermName("to"), "CC")
+ assert(syms.size == 1, syms)
+ println("OK!")
+ }
+}
diff --git a/test/files/run/nodebuffer-array.check b/test/files/run/nodebuffer-array.check
deleted file mode 100644
index 49f8bfaf8d..0000000000
--- a/test/files/run/nodebuffer-array.check
+++ /dev/null
@@ -1,3 +0,0 @@
-<entry>
- <elem>a</elem><elem>b</elem><elem>c</elem>
- </entry>
diff --git a/test/files/run/nodebuffer-array.scala b/test/files/run/nodebuffer-array.scala
deleted file mode 100644
index 4e1ffe1e5e..0000000000
--- a/test/files/run/nodebuffer-array.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-object Test {
-
- def f(s: String) = {
- <entry>
- {
- for (item <- s split ',') yield
- <elem>{ item }</elem>
- }
- </entry>
- }
-
- def main(args: Array[String]): Unit = {
- println(f("a,b,c"))
- }
-}
diff --git a/test/files/run/null-and-intersect.scala b/test/files/run/null-and-intersect.scala
index 1437fa4b25..7266dabe6d 100644
--- a/test/files/run/null-and-intersect.scala
+++ b/test/files/run/null-and-intersect.scala
@@ -2,7 +2,7 @@ object Test {
trait Immortal
class Bippy extends Immutable with Immortal
class Boppy extends Immutable
-
+
def f[T](x: Traversable[T]) = x match {
case _: Map[_, _] => 3
case _: Seq[_] => 2
@@ -23,10 +23,10 @@ object Test {
println(f(Seq(1)))
println(f(Map(1 -> 2)))
println(f(null))
-
+
println(g(new Bippy))
println(g(null))
-
+
println(h(new Bippy))
println(h(new Boppy))
println(h(null))
diff --git a/test/files/run/null-hash.scala b/test/files/run/null-hash.scala
index abf15e8166..9b1f28b083 100644
--- a/test/files/run/null-hash.scala
+++ b/test/files/run/null-hash.scala
@@ -2,7 +2,7 @@ object Test {
def f1 = List(5, 10, null: String).##
def f2(x: Any) = x.##
def f3 = ((55, "abc", null: List[Int])).##
-
+
def main(args: Array[String]): Unit = {
f1
f2(null)
diff --git a/test/files/run/number-parsing.scala b/test/files/run/number-parsing.scala
index 21551a3a07..ad1481063e 100644
--- a/test/files/run/number-parsing.scala
+++ b/test/files/run/number-parsing.scala
@@ -2,12 +2,12 @@ object Test {
def numTests() = {
val MinusZero = Float.box(-0.0f)
val PlusZero = Float.box(0.0f)
-
+
assert(PlusZero match { case MinusZero => false ; case _ => true })
assert(MinusZero match { case PlusZero => false ; case _ => true })
assert((MinusZero: scala.Float) == (PlusZero: scala.Float))
assert(!(MinusZero equals PlusZero))
-
+
List(
-5f.max(2) ,
-5f max 2 ,
diff --git a/test/files/run/numbereq.scala b/test/files/run/numbereq.scala
index a1f11da205..7ce4b23cf8 100644
--- a/test/files/run/numbereq.scala
+++ b/test/files/run/numbereq.scala
@@ -13,13 +13,13 @@ object Test {
if (x >= Byte.MinValue && x <= Byte.MaxValue) List(new java.lang.Byte(x.toByte)) else Nil,
if (x >= Char.MinValue && x <= Char.MaxValue) List(new java.lang.Character(x.toChar)) else Nil
).flatten
-
+
base ::: extras
}
def mkNumbers(x: BigInt): List[AnyRef] = {
List(
- List(BigDecimal(x, java.math.MathContext.UNLIMITED)),
+ List(BigDecimal(x, java.math.MathContext.UNLIMITED)),
List(x),
if (x.isValidDouble) List(new java.lang.Double(x.toDouble)) else Nil,
if (x.isValidFloat) List(new java.lang.Float(x.toFloat)) else Nil,
@@ -30,23 +30,40 @@ object Test {
if (x.isValidChar) List(new java.lang.Character(x.toChar)) else Nil
).flatten
}
-
+
+ // Don't necessarily expect BigDecimal created from BigInt to agree with Double here.
+ def isIffy(x: Any, y: Any, canSwap: Boolean = true): Boolean = x match {
+ case bd: BigDecimal => y match {
+ case _: Float | _: Double => bd.toString.length > 15
+ case _ => false
+ }
+ case _ => canSwap && isIffy(y, x, false)
+ }
+
+ // Don't necessarily expect BigInt to agree with Float/Double beyond a Long
+ def isIffyB(x: Any, y: Any, canSwap: Boolean = true): Boolean = x match {
+ case bi: BigInt => y match {
+ case _: Float | _: Double => bi < Long.MinValue || bi > Long.MaxValue
+ case _ => false
+ }
+ case _ => canSwap && isIffyB(y, x, false)
+ }
+
def main(args: Array[String]): Unit = {
val ints = (0 to 15).toList map (Short.MinValue >> _)
val ints2 = ints map (x => -x)
val ints3 = ints map (_ + 1)
val ints4 = ints2 map (_ - 1)
-
+
val setneg1 = ints map mkNumbers
val setneg2 = ints3 map mkNumbers
val setpos1 = ints2 map mkNumbers
val setpos2 = ints4 map mkNumbers
val zero = mkNumbers(0)
-
- val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2
-
+
+ val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2
+
for (set <- sets ; x <- set ; y <- set) {
- // println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##))
assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
assert(x.## == y.##, "%s != %s".format(x.getClass, y.getClass))
}
@@ -55,18 +72,20 @@ object Test {
val bigInts2 = bigInts map (x => -x)
val bigInts3 = bigInts map (_ + 1)
val bigInts4 = bigInts2 map (_ - 1)
-
+
val setneg1b = bigInts map mkNumbers
val setneg2b = bigInts3 map mkNumbers
val setpos1b = bigInts2 map mkNumbers
val setpos2b = bigInts4 map mkNumbers
val sets2 = setneg1 ++ setneg1b ++ setneg2 ++ setneg2b ++ List(zero) ++ setpos1 ++ setpos1b ++ setpos2 ++ setpos2b
-
+
for (set <- sets2 ; x <- set ; y <- set) {
-// println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##))
- assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
-// assert(x.## == y.##, "%s != %s".format(x.getClass, y.getClass)) Disable until Double.## is fixed (SI-5640)
+ if (!isIffy(x,y)) {
+ assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
+ // The following is blocked by SI-8150
+ // if (!isIffyB(x,y)) assert(x.## == y.##, "%x/%s != %x/%s from %s.## and %s.##".format(x.##, x.getClass, y.##, y.getClass, x, y))
+ }
}
}
}
diff --git a/test/files/run/option-fold.scala b/test/files/run/option-fold.scala
index d554ba4f9b..84e346ec79 100644
--- a/test/files/run/option-fold.scala
+++ b/test/files/run/option-fold.scala
@@ -2,18 +2,19 @@ object Test {
sealed class A
case object B extends A
case class C(x: Int) extends A
-
+
def f[T](x: Option[T]) = x.fold(List.empty[T])(List(_))
def g(x: Option[A]) = x.fold(-1) {
case B => 0
case C(x) => x
+ case _ => ???
}
def main(args: Array[String]): Unit = {
- println(f(None))
- println(f(Some(5)))
- println(g(None))
- println(g(Some(B)))
- println(g(Some(C(1))))
+ println(f(None)) //List()
+ println(f(Some(5))) //List(5)
+ println(g(None)) //-1
+ println(g(Some(B))) //0
+ println(g(Some(C(1)))) //1
}
}
diff --git a/test/files/run/origins.flags b/test/files/run/origins.flags
index a7e64e4f0c..690753d807 100644
--- a/test/files/run/origins.flags
+++ b/test/files/run/origins.flags
@@ -1 +1 @@
--no-specialization \ No newline at end of file
+-no-specialization -Ydelambdafy:inline \ No newline at end of file
diff --git a/test/files/run/origins.scala b/test/files/run/origins.scala
index 0ad92297f5..6529351d3c 100644
--- a/test/files/run/origins.scala
+++ b/test/files/run/origins.scala
@@ -14,7 +14,7 @@ object Test {
def f1() = 1 to 5 map boop
def f2() = 1 to 10 map boop
def f3() = 1 to 50 map boop
-
+
def main(args: Array[String]): Unit = {
f1() ; f2() ; f3()
}
diff --git a/test/files/run/packrat1.check b/test/files/run/packrat1.check
deleted file mode 100644
index e9f797e1b6..0000000000
--- a/test/files/run/packrat1.check
+++ /dev/null
@@ -1,7 +0,0 @@
-1
-3
-5
-81
-4
-37
-9
diff --git a/test/files/run/packrat1.scala b/test/files/run/packrat1.scala
deleted file mode 100644
index b5a4687378..0000000000
--- a/test/files/run/packrat1.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-import scala.util.parsing.combinator._
-
-import scala.util.parsing.combinator.syntactical.StandardTokenParsers
-import scala.util.parsing.input._
-import scala.util.parsing.combinator.token._
-
-import scala.collection.mutable.HashMap
-
-object Test extends App{
- import grammars._
-
- val head = phrase(term)
-
- println(extractResult(head(new lexical.Scanner("1"))))
- println(extractResult(head(new lexical.Scanner("1+2"))))
- println(extractResult(head(new lexical.Scanner("9-4"))))
- println(extractResult(head(new lexical.Scanner("9*9"))))
- println(extractResult(head(new lexical.Scanner("8/2"))))
- println(extractResult(head(new lexical.Scanner("4*9-0/7+9-8*1"))))
- println(extractResult(head(new lexical.Scanner("(1+2)*3"))))
-}
-
-object grammars extends StandardTokenParsers with PackratParsers{
-
- def extractResult(r : ParseResult[_]) = r match {
- case Success(a,_) => a
- case NoSuccess(a,_) => a
- }
-
- lexical.delimiters ++= List("+","-","*","/","(",")")
- lexical.reserved ++= List("Hello","World")
-
- /****
- * term = term + fact | term - fact | fact
- * fact = fact * num | fact / num | num
- */
-
-
- val term: PackratParser[Int] = (term~("+"~>fact) ^^ {case x~y => x+y}
- |term~("-"~>fact) ^^ {case x~y => x-y}
- |fact)
-
- val fact: PackratParser[Int] = (fact~("*"~>numericLit) ^^ {case x~y => x*y.toInt}
- |fact~("/"~>numericLit) ^^ {case x~y => x/y.toInt}
- |"("~>term<~")"
- |numericLit ^^ {_.toInt})
- }
diff --git a/test/files/run/packrat2.check b/test/files/run/packrat2.check
deleted file mode 100644
index 55a32ac58b..0000000000
--- a/test/files/run/packrat2.check
+++ /dev/null
@@ -1,7 +0,0 @@
-1
-3
-81
-43
-59
-188
-960
diff --git a/test/files/run/packrat2.scala b/test/files/run/packrat2.scala
deleted file mode 100644
index f55021a6a8..0000000000
--- a/test/files/run/packrat2.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-import scala.util.parsing.combinator._
-
-import scala.util.parsing.combinator.syntactical.StandardTokenParsers
-import scala.util.parsing.input._
-import scala.util.parsing.combinator.token._
-
-import scala.collection.mutable.HashMap
-
-object Test extends App{
- import grammars2._
-
- val head = phrase(exp)
-
- println(extractResult(head(new lexical.Scanner("1"))))
- println(extractResult(head(new lexical.Scanner("1+2"))))
- println(extractResult(head(new lexical.Scanner("9*9"))))
- println(extractResult(head(new lexical.Scanner("4*9+7"))))
- println(extractResult(head(new lexical.Scanner("4*9+7*2+3*3"))))
- println(extractResult(head(new lexical.Scanner("4*9+7*2+3*3+9*5+7*6*2"))))
- println(extractResult(head(new lexical.Scanner("4*(9+7)*(2+3)*3"))))
-
-}
-
-object grammars2 extends StandardTokenParsers with PackratParsers{
-
- def extractResult(r : ParseResult[_]) = r match{
- case Success(a,_) => a
- case NoSuccess(a,_) => a
- }
-
- lexical.delimiters ++= List("+","-","*","/","(",")")
- lexical.reserved ++= List("Hello","World")
-
- /*
- * exp = sum | prod | num
- * sum = exp ~ "+" ~ num
- * prod = exp ~ "*" ~ num
- */
-
- val exp : PackratParser[Int] = sum | prod | numericLit ^^{_.toInt} | "("~>exp<~")"
- val sum : PackratParser[Int] = exp~("+"~>exp) ^^ {case x~y => x+y}
- val prod: PackratParser[Int] = exp~("*"~>(numericLit ^^{_.toInt} | exp)) ^^ {case x~y => x*y}
-
-
- /* lexical.reserved ++= List("a","b", "c")
- val a : PackratParser[Any] = numericLit^^{x => primeFactors(x.toInt)}
- val b : PackratParser[Any] = memo("b")
- val c : PackratParser[Any] = memo("c")
- val AnBnCn : PackratParser[Any] =
- parseButDontEat(repMany1(a,b))~not(b)~>rep1(a)~repMany1(b,c)// ^^{case x~y => x:::y}
- //val c : PackratParser[Any] = parseButDontEat(a)~a~a
- //println(c((new PackratReader(new lexical.Scanner("45 24")))))
- val r = new PackratReader(new lexical.Scanner("45 b c"))
- println(AnBnCn(r))
- println(r.getCache.size)
-*/
-}
diff --git a/test/files/run/packrat3.check b/test/files/run/packrat3.check
deleted file mode 100644
index 8c10626751..0000000000
--- a/test/files/run/packrat3.check
+++ /dev/null
@@ -1,7 +0,0 @@
-(((List(a, b)~())~List(a))~List(b, c))
-(((List(a, a, b, b)~())~List(a, a))~List(b, b, c, c))
-(((List(a, a, a, b, b, b)~())~List(a, a, a))~List(b, b, b, c, c, c))
-(((List(a, a, a, a, b, b, b, b)~())~List(a, a, a, a))~List(b, b, b, b, c, c, c, c))
-Expected failure
-``b'' expected but `c' found
-end of input
diff --git a/test/files/run/packrat3.scala b/test/files/run/packrat3.scala
deleted file mode 100644
index 216ef8f0af..0000000000
--- a/test/files/run/packrat3.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-import scala.util.parsing.combinator._
-
-import scala.util.parsing.combinator.syntactical.StandardTokenParsers
-import scala.util.parsing.input._
-import scala.util.parsing.combinator.token._
-
-import scala.collection.mutable.HashMap
-
-object Test {
- def main(args: Array[String]): Unit = {
- import grammars3._
-
- val head = phrase(AnBnCn)
-
- println(extractResult(head(new lexical.Scanner("a b c"))))
- println(extractResult(head(new lexical.Scanner("a a b b c c"))))
- println(extractResult(head(new lexical.Scanner("a a a b b b c c c"))))
- println(extractResult(head(new lexical.Scanner("a a a a b b b b c c c c"))))
-
- println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a b b b b c c c c")))))
- println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a a b b b c c c c")))))
- println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a a b b b b c c c")))))
- }
-}
-
-object grammars3 extends StandardTokenParsers with PackratParsers {
-
- def extractResult(r: ParseResult[_]) = r match {
- case Success(a,_) => a
- case NoSuccess(a,_) => a
- }
-
-
- lexical.reserved ++= List("a","b", "c")
- val a: PackratParser[Any] = memo("a")
- val b: PackratParser[Any] = memo("b")
- val c: PackratParser[Any] = memo("c")
-
- val AnBnCn: PackratParser[Any] =
- guard(repMany1(a,b) ~ not(b)) ~ rep1(a) ~ repMany1(b,c)// ^^{case x~y => x:::y}
-
-
- private def repMany[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] =
- ( p~repMany(p,q)~q ^^ {case x~xs~y => x::xs:::(y::Nil)}
- | success(Nil)
- )
-
- def repMany1[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] =
- p~opt(repMany(p,q))~q ^^ {case x~Some(xs)~y => x::xs:::(y::Nil)}
-
-}
diff --git a/test/files/run/parmap-ops.scala b/test/files/run/parmap-ops.scala
index f93bd7b77e..4274460c9d 100644
--- a/test/files/run/parmap-ops.scala
+++ b/test/files/run/parmap-ops.scala
@@ -1,10 +1,10 @@
import collection._
object Test {
-
+
def main(args: Array[String]) {
val gm: GenMap[Int, Int] = GenMap(0 -> 0, 1 -> 1).par
-
+
// ops
assert(gm.isDefinedAt(1))
assert(gm.contains(1))
@@ -21,11 +21,11 @@ object Test {
} catch {
case e: NoSuchElementException => // ok
}
-
+
assert(gm.filterKeys(_ % 2 == 0)(0) == 0)
assert(gm.filterKeys(_ % 2 == 0).get(1) == None)
assert(gm.mapValues(_ + 1)(0) == 1)
-
+
// with defaults
val pm = parallel.mutable.ParMap(0 -> 0, 1 -> 1)
val dm = pm.withDefault(x => -x)
@@ -37,12 +37,12 @@ object Test {
assert(dm(3) == 3)
assert(pm(3) == 3)
assert(dm(4) == -4)
-
+
val imdm = parallel.immutable.ParMap(0 -> 0, 1 -> 1).withDefault(x => -x)
assert(imdm(0) == 0)
assert(imdm(1) == 1)
assert(imdm(2) == -2)
assert(imdm.updated(2, 2) == parallel.ParMap(0 -> 0, 1 -> 1, 2 -> 2))
}
-
+
}
diff --git a/test/files/run/parserFilter.check b/test/files/run/parserFilter.check
deleted file mode 100644
index be04454426..0000000000
--- a/test/files/run/parserFilter.check
+++ /dev/null
@@ -1,9 +0,0 @@
-[1.3] failure: Input doesn't match filter: false
-
-if false
- ^
-[1.1] failure: Input doesn't match filter: not
-
-not true
-^
-[1.8] parsed: (if~true)
diff --git a/test/files/run/parserFilter.scala b/test/files/run/parserFilter.scala
deleted file mode 100644
index d007d441f4..0000000000
--- a/test/files/run/parserFilter.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-object Test extends scala.util.parsing.combinator.RegexParsers {
- val keywords = Set("if", "false")
- def word: Parser[String] = "\\w+".r
-
- def keyword: Parser[String] = word filter (keywords.contains)
- def ident: Parser[String] = word filter(!keywords.contains(_))
-
- def test = keyword ~ ident
-
- def main(args: Array[String]) {
- println(parseAll(test, "if false"))
- println(parseAll(test, "not true"))
- println(parseAll(test, "if true"))
- }
-}
diff --git a/test/files/run/parserForFilter.check b/test/files/run/parserForFilter.check
deleted file mode 100644
index a53c147719..0000000000
--- a/test/files/run/parserForFilter.check
+++ /dev/null
@@ -1 +0,0 @@
-[1.13] parsed: (second,first)
diff --git a/test/files/run/parserForFilter.scala b/test/files/run/parserForFilter.scala
deleted file mode 100644
index 1bc44f8033..0000000000
--- a/test/files/run/parserForFilter.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Test extends scala.util.parsing.combinator.RegexParsers {
- def word: Parser[String] = "\\w+".r
-
- def twoWords = for {
- (a ~ b) <- word ~ word
- } yield (b, a)
-
- def main(args: Array[String]) {
- println(parseAll(twoWords, "first second"))
- }
-}
-
diff --git a/test/files/run/parserJavaIdent.check b/test/files/run/parserJavaIdent.check
deleted file mode 100644
index 597ddbee47..0000000000
--- a/test/files/run/parserJavaIdent.check
+++ /dev/null
@@ -1,26 +0,0 @@
-[1.7] parsed: simple
-[1.8] parsed: with123
-[1.6] parsed: with$
-[1.10] parsed: withøßöèæ
-[1.6] parsed: with_
-[1.6] parsed: _with
-[1.1] failure: java identifier expected
-
-3start
-^
-[1.1] failure: java identifier expected
-
--start
-^
-[1.5] failure: java identifier expected
-
-with-s
- ^
-[1.3] failure: java identifier expected
-
-we♥scala
- ^
-[1.6] failure: java identifier expected
-
-with space
- ^
diff --git a/test/files/run/parserJavaIdent.scala b/test/files/run/parserJavaIdent.scala
deleted file mode 100644
index c068075e4e..0000000000
--- a/test/files/run/parserJavaIdent.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-object Test extends scala.util.parsing.combinator.JavaTokenParsers {
-
- def test[A](s: String) {
- val res = parseAll(ident, s) match {
- case Failure(_, in) => Failure("java identifier expected", in)
- case o => o
- }
- println(res)
- }
-
- def main(args: Array[String]) {
- // Happy tests
- test("simple")
- test("with123")
- test("with$")
- test("withøßöèæ")
- test("with_")
- test("_with")
- // Sad tests
- test("3start")
- test("-start")
- test("with-s")
- test("we♥scala")
- test("with space")
- }
-}
diff --git a/test/files/run/parserNoSuccessMessage.check b/test/files/run/parserNoSuccessMessage.check
deleted file mode 100644
index fe00d2fd3a..0000000000
--- a/test/files/run/parserNoSuccessMessage.check
+++ /dev/null
@@ -1,20 +0,0 @@
-[1.2] failure: string matching regex `\d+' expected but `x' found
-
--x
- ^
-[1.1] failure: string matching regex `\d+' expected but `x' found
-
-x
-^
-[1.3] parsed: (Some(-)~5)
-[1.2] parsed: (None~5)
-[1.2] error: Number expected!
-
--x
- ^
-[1.1] error: Number expected!
-
-x
-^
-[1.3] parsed: (Some(-)~5)
-[1.2] parsed: (None~5)
diff --git a/test/files/run/parserNoSuccessMessage.scala b/test/files/run/parserNoSuccessMessage.scala
deleted file mode 100644
index 93aa252db0..0000000000
--- a/test/files/run/parserNoSuccessMessage.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-object Test extends scala.util.parsing.combinator.RegexParsers {
- def sign = "-"
- def number = "\\d+".r
- def p = sign.? ~ number withErrorMessage "Number expected!"
- def q = sign.? ~! number withErrorMessage "Number expected!"
-
- def main(args: Array[String]) {
- println(parseAll(p, "-x"))
- println(parseAll(p, "x"))
- println(parseAll(p, "-5"))
- println(parseAll(p, "5"))
- println(parseAll(q, "-x"))
- println(parseAll(q, "x"))
- println(parseAll(q, "-5"))
- println(parseAll(q, "5"))
- }
-}
-
-
diff --git a/test/files/run/partialfun.scala b/test/files/run/partialfun.scala
index f3c53b94ae..71c7d3e61c 100644
--- a/test/files/run/partialfun.scala
+++ b/test/files/run/partialfun.scala
@@ -76,7 +76,7 @@ object Test {
}
val chained = pf0 orElse pf1 orElse pf2
- chained()
+ chained(())
}
def main(args: Array[String]): Unit = {
diff --git a/test/files/run/patch-boundary.scala b/test/files/run/patch-boundary.scala
index 8381956859..ed1a0e9fc1 100644
--- a/test/files/run/patch-boundary.scala
+++ b/test/files/run/patch-boundary.scala
@@ -1,8 +1,8 @@
object Test {
def f = collection.mutable.ArrayBuffer(1, 2, 3, 4, 5, 6, 7, 8)
def g = f.patch(4, List(1, 2), 10)
-
+
def main(args: Array[String]): Unit = {
- assert(g.size == 6)
+ assert(g.size == 6)
}
}
diff --git a/test/files/run/patmat-behavior-2.check b/test/files/run/patmat-behavior-2.check
new file mode 100644
index 0000000000..a928fe7918
--- /dev/null
+++ b/test/files/run/patmat-behavior-2.check
@@ -0,0 +1,24 @@
+f1(Foo(1)) == true
+f1(Foo(1, 2)) == false
+f1(Foo(1, 2, 3)) == false
+
+f2(Foo(1)) == false
+f2(Foo(1, 2)) == true
+f2(Foo(1, 2, 3)) == false
+
+f3(Foo(1)) == false
+f3(Foo(1, 2)) == false
+f3(Foo(1, 2, 3)) == true
+
+f1seq(Foo(1)) == true
+f1seq(Foo(1, 2)) == true
+f1seq(Foo(1, 2, 3)) == true
+
+f2seq(Foo(1)) == false
+f2seq(Foo(1, 2)) == true
+f2seq(Foo(1, 2, 3)) == true
+
+f3seq(Foo(1)) == false
+f3seq(Foo(1, 2)) == false
+f3seq(Foo(1, 2, 3)) == true
+
diff --git a/test/files/run/patmat-behavior-2.scala b/test/files/run/patmat-behavior-2.scala
new file mode 100644
index 0000000000..b31f773772
--- /dev/null
+++ b/test/files/run/patmat-behavior-2.scala
@@ -0,0 +1,50 @@
+case class Foo(x: Int, ys: Int*) {
+ // We write our own toString because of SI-7735
+ override def toString = (x +: ys).mkString("Foo(", ", ", ")")
+}
+
+object Test {
+ def f1(x: Any) = x match {
+ case Foo(x) => true
+ case _ => false
+ }
+ def f2(x: Any) = x match {
+ case Foo(x, y) => true
+ case _ => false
+ }
+ def f3(x: Any) = x match {
+ case Foo(x, y, z) => true
+ case _ => false
+ }
+ def f1seq(x: Any) = x match {
+ case Foo(x, ys @ _*) => true
+ case _ => false
+ }
+ def f2seq(x: Any) = x match {
+ case Foo(x, y, zs @ _*) => true
+ case _ => false
+ }
+ def f3seq(x: Any) = x match {
+ case Foo(x, y, z, qs @ _*) => true
+ case _ => false
+ }
+
+ val x1 = Foo(1)
+ val x2 = Foo(1, 2)
+ val x3 = Foo(1, 2, 3)
+
+ val fs = List[Any => Boolean](f1, f2, f3)
+ val fseqs = List[Any => Boolean](f1seq, f2seq, f3seq)
+ val xs = List[Foo](x1, x2, x3)
+
+ def main(args: Array[String]): Unit = {
+ for ((f, i) <- fs.zipWithIndex) {
+ xs foreach (x => println(s"f${i+1}($x) == ${f(x)}"))
+ println("")
+ }
+ for ((f, i) <- fseqs.zipWithIndex) {
+ xs foreach (x => println(s"f${i+1}seq($x) == ${f(x)}"))
+ println("")
+ }
+ }
+}
diff --git a/test/files/run/patmat-behavior.check b/test/files/run/patmat-behavior.check
new file mode 100644
index 0000000000..273a1434fb
--- /dev/null
+++ b/test/files/run/patmat-behavior.check
@@ -0,0 +1,90 @@
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C10[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C20[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C01[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C11[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C21[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C00[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C20[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C01[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C11[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C21[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C00[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C10[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C01[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C11[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C21[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C00[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C10[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C20[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C11[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C21[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C00[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C10[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C20[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C01[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C21[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C00[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C10[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C20[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C01[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C11[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
diff --git a/test/files/run/patmat-behavior.scala b/test/files/run/patmat-behavior.scala
new file mode 100644
index 0000000000..8b6370d796
--- /dev/null
+++ b/test/files/run/patmat-behavior.scala
@@ -0,0 +1,95 @@
+package s {
+ sealed trait C[+A]
+
+ case class C00[+A]() extends C[A]
+ case class C10[+A](x: A) extends C[A]
+ case class C20[+A](x: A, y: A) extends C[A]
+ case class C01[+A](xs: A*) extends C[A]
+ case class C11[+A](x: A, ys: A*) extends C[A]
+ case class C21[+A](x: A, y: A, zs: A*) extends C[A]
+
+ object E00 { def unapply[A](x: Any): Boolean = ??? }
+ object E10 { def unapply[A](x: Any): Option[A] = ??? }
+ object E20 { def unapply[A](x: Any): Option[(A, A)] = ??? }
+ object E01 { def unapplySeq[A](x: Any): Option[Seq[A]] = ??? }
+ object E11 { def unapplySeq[A](x: Any): Option[(A, Seq[A])] = ??? }
+ object E21 { def unapplySeq[A](x: Any): Option[(A, A, Seq[A])] = ??? }
+
+ object F00 { def unapply[A](x: C[A]): Boolean = ??? }
+ object F10 { def unapply[A](x: C[A]): Option[A] = ??? }
+ object F20 { def unapply[A](x: C[A]): Option[(A, A)] = ??? }
+ object F01 { def unapplySeq[A](x: C[A]): Option[Seq[A]] = ??? }
+ object F11 { def unapplySeq[A](x: C[A]): Option[(A, Seq[A])] = ??? }
+ object F21 { def unapplySeq[A](x: C[A]): Option[(A, A, Seq[A])] = ??? }
+
+ object G00 { def unapply[A](x: C00[A]): Boolean = ??? }
+ object G10 { def unapply[A](x: C10[A]): Option[A] = ??? }
+ object G20 { def unapply[A](x: C20[A]): Option[(A, A)] = ??? }
+ object G01 { def unapplySeq[A](x: C01[A]): Option[Seq[A]] = ??? }
+ object G11 { def unapplySeq[A](x: C11[A]): Option[(A, Seq[A])] = ??? }
+ object G21 { def unapplySeq[A](x: C21[A]): Option[(A, A, Seq[A])] = ??? }
+}
+import s._
+
+package pos {
+ object Test {
+ def ga1(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga2(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga3(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga4(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga5(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga6(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+
+ def gb1[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb2[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb3[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb4[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb5[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb6[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+
+ def gc1[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc2[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc3[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc4[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc5[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc6[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+
+ def gd1[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd2[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd3[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd4[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd5[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd6[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ }
+}
+
+package neg {
+ object Fail {
+ def gb1[A](x: C00[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb2[A](x: C10[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb3[A](x: C20[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb4[A](x: C01[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb5[A](x: C11[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb6[A](x: C21[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+
+ def gc1[A](x: C00[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc2[A](x: C10[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc3[A](x: C20[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc4[A](x: C01[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc5[A](x: C11[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc6[A](x: C21[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+
+ }
+}
diff --git a/test/files/run/patmat-bind-typed.check b/test/files/run/patmat-bind-typed.check
new file mode 100644
index 0000000000..8baef1b4ab
--- /dev/null
+++ b/test/files/run/patmat-bind-typed.check
@@ -0,0 +1 @@
+abc
diff --git a/test/files/run/patmat-bind-typed.scala b/test/files/run/patmat-bind-typed.scala
new file mode 100644
index 0000000000..10de921c51
--- /dev/null
+++ b/test/files/run/patmat-bind-typed.scala
@@ -0,0 +1,8 @@
+object Test {
+ def f(xs: List[Any]) = for (key @ (dummy: String) <- xs) yield key
+
+ def main(args: Array[String]): Unit = {
+ f("abc" :: Nil) foreach println
+ f(5 :: Nil) foreach println
+ }
+}
diff --git a/test/files/run/patmat-exprs.scala b/test/files/run/patmat-exprs.scala
index dfc78e2ca5..7ca5fd3063 100644
--- a/test/files/run/patmat-exprs.scala
+++ b/test/files/run/patmat-exprs.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ implicitConversions }
import runtime.ScalaRunTime
object Test {
@@ -37,7 +39,7 @@ trait Pattern {
//
// type Numeric[T]
// import java.io.Serializable
- //
+ //
// implicit def compat27a[T](x: Iterable[T]) = new {
// def iterator: Iterator[T] = x.elements
// def sum: Int = 5
@@ -278,8 +280,8 @@ trait Pattern {
case Mul(Mul(y, Const(z)), Const(x)) => Mul(const(num.mul(x, z)), y)
case Const(x) if x == num.one => One[T]
- case Const(x) if x == num.zero => Zero[T]
-
+ case Const(x) if x == num.zero => Zero[T]
+
case Sub(x, Neg(y)) => Add(List(x, y))
case Sub(Neg(x), y) => Neg(Add(List(x, y)))
case Neg(Neg(x)) => x
@@ -576,4 +578,4 @@ trait Pattern {
implicit def long2Constant[T](l: Long)(implicit num: NumericOps[T]): Leaf[T] =
const(num.fromDouble(l.toDouble))
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/patmat-finally.scala b/test/files/run/patmat-finally.scala
index 6f769b30a0..dfea5ad176 100644
--- a/test/files/run/patmat-finally.scala
+++ b/test/files/run/patmat-finally.scala
@@ -21,5 +21,5 @@ object Test extends App {
}
bar(null, null)
- x
+ x
}
diff --git a/test/files/run/patmat-mix-case-extractor.check b/test/files/run/patmat-mix-case-extractor.check
new file mode 100644
index 0000000000..a6e1bd23df
--- /dev/null
+++ b/test/files/run/patmat-mix-case-extractor.check
@@ -0,0 +1,8 @@
+-1
+6
+4
+18
+-1
+1006
+1004
+1018
diff --git a/test/files/run/patmat-mix-case-extractor.scala b/test/files/run/patmat-mix-case-extractor.scala
new file mode 100644
index 0000000000..964e6f743c
--- /dev/null
+++ b/test/files/run/patmat-mix-case-extractor.scala
@@ -0,0 +1,110 @@
+trait CaseClass
+trait ProdCaseClass extends CaseClass { def x: Int }
+trait SeqCaseClass extends CaseClass { def xs: Seq[Int] }
+
+case class CaseClass1() extends CaseClass
+case class CaseClass2(xs: Int*) extends SeqCaseClass
+case class CaseClass3(x: Int) extends ProdCaseClass
+case class CaseClass4(x: Int, xs: Int*) extends ProdCaseClass with SeqCaseClass
+
+object Extractor1 { def unapply(x: CaseClass): Boolean = false }
+object Extractor2 { def unapplySeq(x: SeqCaseClass): Option[Seq[Int]] = Some(x.xs) }
+object Extractor3 { def unapply(x: ProdCaseClass): Option[Int] = Some(x.x) }
+object Extractor4 { def unapplySeq(x: ProdCaseClass with SeqCaseClass): Option[(Int, Seq[Int])] = Some(x.x, x.xs) }
+
+class A {
+ def f1(x: Any) = x match {
+ case CaseClass1() => -1
+ case CaseClass2(xs @ _*) => xs.sum
+ case CaseClass3(x) => x
+ case CaseClass4(x, xs @ _*) => x + xs.sum
+ case Extractor4(x, xs @ _*) => 1000 + x + xs.sum
+ case Extractor3(x) => 1000 + x
+ case Extractor2(xs @ _*) => 1000 + xs.sum
+ case Extractor1() => -3
+ case _ => -2
+ }
+ def f2(x: Any) = x match {
+ case Extractor4(x, xs @ _*) => 1000 + x + xs.sum
+ case Extractor3(x) => 1000 + x
+ case Extractor2(xs @ _*) => 1000 + xs.sum
+ case Extractor1() => -3
+ case CaseClass1() => -1
+ case CaseClass2(xs @ _*) => xs.sum
+ case CaseClass3(x) => x
+ case CaseClass4(x, xs @ _*) => x + xs.sum
+ case _ => -2
+ }
+ def run() {
+ List(
+ f1(CaseClass1()),
+ f1(CaseClass2(1, 2, 3)),
+ f1(CaseClass3(4)),
+ f1(CaseClass4(5, 6, 7)),
+ f2(CaseClass1()),
+ f2(CaseClass2(1, 2, 3)),
+ f2(CaseClass3(4)),
+ f2(CaseClass4(5, 6, 7))
+ ) foreach println
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ (new A).run
+ }
+}
+
+
+class B {
+ case class CaseClass0()
+ case class CaseClass0v(xs: Int*)
+
+ case class CaseClass(x: Int, y: Int)
+ object Extractor { def unapply(x: Any): Option[(Int, Int)] = Some((1, 1)) }
+
+ case class CaseSeq(x: Char, y: Double, zs: Int*)
+ object ExtractorSeq { def unapplySeq(x: Any): Option[(Int, Int, Seq[Int])] = Some((1, 1, List(1))) }
+
+ def f1(x: CaseClass) = x match { case CaseClass(y, z) => y }
+ def f2(x: Any) = x match { case Extractor(y, z) => y }
+
+ def f3(x: CaseSeq) = x match {
+ case CaseSeq(x, y) => y
+ case CaseSeq(x, y, z) => z
+ }
+ def f4(x: CaseSeq) = x match {
+ case CaseSeq(x, y, z) => z :: Nil
+ case CaseSeq(x, y, z @ _*) => z
+ }
+
+ def f5(x: Any) = x match { case ExtractorSeq(x, y, z) => z }
+ def f6(x: Any) = x match { case ExtractorSeq(x, y, z @ _*) => z }
+
+ def g1(x: CaseClass0) = x match {
+ case CaseClass0() => true
+ }
+ def g2(x: CaseClass0v) = x match {
+ case CaseClass0v() => true
+ case CaseClass0v(5) => true
+ case CaseClass0v(x) => true
+ case CaseClass0v(xs @ _*) => false
+ }
+}
+
+package p1 {
+ trait _X {
+ case class _Foo();
+ object _Bar {
+ def unapply(foo: _Foo): Boolean = true;
+ }
+ }
+
+ object Y extends _X {
+ val foo = _Foo()
+ foo match {
+ case _Bar() =>
+ case _ => assert(false)
+ }
+ }
+}
diff --git a/test/files/run/patmat-seqs.scala b/test/files/run/patmat-seqs.scala
index e23711697c..b5c47b4b4b 100644
--- a/test/files/run/patmat-seqs.scala
+++ b/test/files/run/patmat-seqs.scala
@@ -7,14 +7,14 @@ object Test {
case Seq(_, _, _, _, _, x: String) => "ss6"
case _ => "d"
}
-
+
def f2(x: Any) = x match {
case Seq("a", "b", _*) => "s2"
case Seq(1, _*) => "s1"
case Seq(5, 6, 7, _*) => "s3"
case _ => "d"
}
-
+
def main(args: Array[String]): Unit = {
val xs1 = List(
List(1,2,3),
@@ -24,9 +24,9 @@ object Test {
Seq(1, 2, 3, 4, 5, "abcd"),
"abc"
) map f1
-
+
xs1 foreach println
-
+
val xs2 = List(
Seq(5, 6, 7),
Seq(5, 6, 7, 8, 9),
@@ -36,7 +36,7 @@ object Test {
Nil,
5
) map f2
-
+
xs2 foreach println
}
}
diff --git a/test/files/run/patmat_unapp_abstype-new.check b/test/files/run/patmat_unapp_abstype-new.check
index 42c54631d2..35447dbbfa 100644
--- a/test/files/run/patmat_unapp_abstype-new.check
+++ b/test/files/run/patmat_unapp_abstype-new.check
@@ -1,3 +1,9 @@
+patmat_unapp_abstype-new.scala:21: warning: abstract type pattern TypesUser.this.TypeRef is unchecked since it is eliminated by erasure
+ case TypeRef(x) => println("TypeRef")
+ ^
+patmat_unapp_abstype-new.scala:53: warning: abstract type pattern Intermed.this.Foo is unchecked since it is eliminated by erasure
+ case Foo(x) => println("Foo")
+ ^
TypeRef
MethodType
Bar
diff --git a/test/files/run/patmat_unapp_abstype-new.scala b/test/files/run/patmat_unapp_abstype-new.scala
index 1141177504..c2927bd124 100644
--- a/test/files/run/patmat_unapp_abstype-new.scala
+++ b/test/files/run/patmat_unapp_abstype-new.scala
@@ -18,7 +18,7 @@ trait TypesAPI {
trait TypesUser extends TypesAPI {
def shouldNotCrash(tp: Type): Unit = {
tp match {
- case TypeRef(x) => println("TypeRef")
+ case TypeRef(x) => println("TypeRef")
case MethodType(x) => println("MethodType")
case _ => println("none of the above")
}
@@ -27,7 +27,7 @@ trait TypesUser extends TypesAPI {
trait TypesImpl extends TypesAPI {
object TypeRef extends TypeRefExtractor // this will have a bridged unapply(x: Type) = unapply(x.asInstanceOf[TypeRef])
- case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef
+ case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef
// --> the cast in the bridge will fail because the pattern matcher can't type test against the abstract types in TypesUser
}
diff --git a/test/files/run/patmat_unapp_abstype-old.check b/test/files/run/patmat_unapp_abstype-old.check
deleted file mode 100644
index 72239d16cd..0000000000
--- a/test/files/run/patmat_unapp_abstype-old.check
+++ /dev/null
@@ -1,4 +0,0 @@
-TypeRef
-none of the above
-Bar
-Foo
diff --git a/test/files/run/patmat_unapp_abstype-old.flags b/test/files/run/patmat_unapp_abstype-old.flags
deleted file mode 100644
index ba80cad69b..0000000000
--- a/test/files/run/patmat_unapp_abstype-old.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xoldpatmat
diff --git a/test/files/run/patmat_unapp_abstype-old.scala b/test/files/run/patmat_unapp_abstype-old.scala
deleted file mode 100644
index 45496f08a2..0000000000
--- a/test/files/run/patmat_unapp_abstype-old.scala
+++ /dev/null
@@ -1,83 +0,0 @@
-// abstract types and extractors, oh my!
-trait TypesAPI {
- trait Type
-
- // an alternative fix (implemented in the virtual pattern matcher, is to replace the isInstanceOf by a manifest-based run-time test)
- // that's what typeRefMani is for
- type TypeRef <: Type //; implicit def typeRefMani: Manifest[TypeRef]
- val TypeRef: TypeRefExtractor; trait TypeRefExtractor {
- def apply(x: Int): TypeRef
- def unapply(x: TypeRef): Option[(Int)]
- }
-
- // just for illustration, should follow the same pattern as TypeRef
- case class MethodType(n: Int) extends Type
-}
-
-// user should not be exposed to the implementation
-trait TypesUser extends TypesAPI {
- def shouldNotCrash(tp: Type): Unit = {
- tp match {
- case TypeRef(x) => println("TypeRef")
- // the above checks tp.isInstanceOf[TypeRef], which is erased to tp.isInstanceOf[Type]
- // before calling TypeRef.unapply(tp), which will then crash unless tp.isInstanceOf[TypesImpl#TypeRef] (which is not implied by tp.isInstanceOf[Type])
- // tp.isInstanceOf[TypesImpl#TypeRef] is equivalent to classOf[TypesImpl#TypeRef].isAssignableFrom(tp.getClass)
- // this is equivalent to manifest
- // it is NOT equivalent to manifest[Type] <:< typeRefMani
- case MethodType(x) => println("MethodType")
- case _ => println("none of the above")
- }
- }
-}
-
-trait TypesImpl extends TypesAPI {
- object TypeRef extends TypeRefExtractor // this will have a bridged unapply(x: Type) = unapply(x.asInstanceOf[TypeRef])
- case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef
- // --> the cast in the bridge will fail because the pattern matcher can't type test against the abstract types in TypesUser
- //lazy val typeRefMani = manifest[TypeRef]
-}
-
-trait Foos {
- trait Bar
- type Foo <: Bar
- trait FooExtractor {
- def unapply(foo: Foo): Option[Int]
- }
- val Foo: FooExtractor
-}
-
-trait RealFoos extends Foos {
- class Foo(val x: Int) extends Bar
- object Foo extends FooExtractor {
- def unapply(foo: Foo): Option[Int] = Some(foo.x)
- }
-}
-
-trait Intermed extends Foos {
- def crash(bar: Bar): Unit =
- bar match {
- case Foo(x) => println("Foo")
- case _ => println("Bar")
- }
-}
-
-object TestUnappStaticallyKnownSynthetic extends TypesImpl with TypesUser {
- def test() = {
- shouldNotCrash(TypeRef(10)) // should and does print "TypeRef"
- // once #1697/#2337 are fixed, this should generate the correct output
- shouldNotCrash(MethodType(10)) // should print "MethodType" but prints "none of the above" -- good one, pattern matcher!
- }
-}
-
-object TestUnappDynamicSynth extends RealFoos with Intermed {
- case class FooToo(n: Int) extends Bar
- def test() = {
- crash(FooToo(10))
- crash(new Foo(5))
- }
-}
-
-object Test extends App {
- TestUnappStaticallyKnownSynthetic.test()
- TestUnappDynamicSynth.test()
-}
diff --git a/test/files/run/patmatnew.check b/test/files/run/patmatnew.check
index e69de29bb2..56b8ac2f4f 100644
--- a/test/files/run/patmatnew.check
+++ b/test/files/run/patmatnew.check
@@ -0,0 +1,15 @@
+patmatnew.scala:351: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ case 1 => "OK"
+ ^
+patmatnew.scala:352: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ case 2 => assert(false); "KO"
+ ^
+patmatnew.scala:353: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ case 3 => assert(false); "KO"
+ ^
+patmatnew.scala:670: warning: This catches all Throwables. If this is really intended, use `case e : Throwable` to clear this warning.
+ case e => {
+ ^
+patmatnew.scala:489: warning: unreachable code
+ case _ if false =>
+ ^
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index a6f8199457..3c0d00dc6c 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ postfixOps }
+
object Test {
def main(args: Array[String]) {
@@ -43,7 +46,7 @@ object Test {
object SimpleUnapply {
def run() { // from sortedmap, old version
List((1, 2)).head match {
- case kv@Pair(key, _) => kv.toString + " " + key.toString
+ case kv@(key, _) => kv.toString + " " + key.toString
}
}
@@ -111,7 +114,7 @@ object Test {
val foo2 = new Foo(2)
def run() {
val res = (foo1.Bar(2): Any) match {
- case foo2.Bar(2) => false
+
case foo1.Bar(2) => true
}
assert(res)
@@ -251,7 +254,7 @@ object Test {
}
// (not regular) fancy guards / bug#644
- object TestSequence06 {
+ object TestSequence06 {
case class A(i: Any)
@@ -397,9 +400,9 @@ object Test {
// these are exhaustive matches
// should not generate any warnings
def f[A](z: (Option[A], Option[A])) = z match {
- case Pair(None, Some(x)) => 1
- case Pair(Some(x), None) => 2
- case Pair(Some(x), Some(y)) => 3
+ case (None, Some(x)) => 1
+ case (Some(x), None) => 2
+ case (Some(x), Some(y)) => 3
case _ => 4
}
@@ -416,9 +419,9 @@ object Test {
}
def h[A](x: (Option[A], Option[A])) = x match {
- case Pair(None, _: Some[_]) => 1
- case Pair(_: Some[_], None) => 2
- case Pair(_: Some[_], _: Some[_]) => 3
+ case (None, _: Some[_]) => 1
+ case (_: Some[_], None) => 2
+ case (_: Some[_], _: Some[_]) => 3
case _ => 4
}
@@ -447,7 +450,7 @@ object Test {
object Get extends Sync
var ps: PartialFunction[Any, Any] = {
- case Get(y) if y > 4 => // y gets a wildcard type for some reason?! hack
+ case Get(y) if y > 4 => // y gets a wildcard type for some reason?! hack
}
}
def run() {
@@ -536,17 +539,17 @@ object Test {
case class Operator(x: Int);
val EQ = new Operator(2);
- def analyze(x: Pair[Operator, Int]) = x match {
- case Pair(EQ, 0) => "0"
- case Pair(EQ, 1) => "1"
- case Pair(EQ, 2) => "2"
+ def analyze(x: Tuple2[Operator, Int]) = x match {
+ case (EQ, 0) => "0"
+ case (EQ, 1) => "1"
+ case (EQ, 2) => "2"
}
def run() {
- val x = Pair(EQ, 0);
+ val x = (EQ, 0);
assertEquals("0", analyze(x)); // should print "0"
- val y = Pair(EQ, 1);
+ val y = (EQ, 1);
assertEquals("1", analyze(y)); // should print "1"
- val z = Pair(EQ, 2);
+ val z = (EQ, 2);
assertEquals("2", analyze(z)); // should print "2"
}
}
diff --git a/test/files/run/pc-conversions.scala b/test/files/run/pc-conversions.scala
index 60ee59c3c4..19fef355c8 100644
--- a/test/files/run/pc-conversions.scala
+++ b/test/files/run/pc-conversions.scala
@@ -1,15 +1,17 @@
-
+/*
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
import collection._
// test conversions between collections
object Test {
-
+
def main(args: Array[String]) {
testConversions
}
-
+
def testConversions {
// seq conversions
assertSeq(parallel.mutable.ParArray(1, 2, 3))
@@ -18,7 +20,7 @@ object Test {
assertSeq(parallel.immutable.ParRange(1, 50, 1, false))
assertSeq(parallel.immutable.ParHashMap(1 -> 2, 2 -> 4))
assertSeq(parallel.immutable.ParHashSet(1, 2, 3))
-
+
// par conversions
assertPar(Array(1, 2, 3))
assertPar(mutable.ArrayBuffer(1, 2, 3))
@@ -29,7 +31,7 @@ object Test {
assertPar(immutable.Range(1, 50, 1))
assertPar(immutable.HashMap(1 -> 1, 2 -> 2))
assertPar(immutable.HashSet(1, 2, 3))
-
+
// par.to* and to*.par tests
assertToPar(List(1 -> 1, 2 -> 2, 3 -> 3))
assertToPar(Stream(1 -> 1, 2 -> 2))
@@ -47,19 +49,19 @@ object Test {
assertToPar(parallel.mutable.ParHashSet(1 -> 2))
assertToPar(parallel.immutable.ParHashMap(1 -> 2))
assertToPar(parallel.immutable.ParHashSet(1 -> 3))
-
+
assertToParWoMap(immutable.Range(1, 10, 2))
-
+
// seq and par again conversions)
assertSeqPar(parallel.mutable.ParArray(1, 2, 3))
}
-
+
def assertSeqPar[T](pc: parallel.ParIterable[T]) = pc.seq.par == pc
-
+
def assertSeq[T](pc: parallel.ParIterable[T]) = assert(pc.seq == pc)
-
+
def assertPar[T, P <: Parallel](xs: GenIterable[T]) = assert(xs == xs.par)
-
+
def assertToPar[K, V](xs: GenTraversable[(K, V)]) {
xs match {
case _: Seq[_] =>
@@ -67,26 +69,26 @@ object Test {
assert(xs.par.toIterable == xs)
case _ =>
}
-
+
assert(xs.toSeq.par == xs.toSeq)
assert(xs.par.toSeq == xs.toSeq)
-
+
assert(xs.toSet.par == xs.toSet)
assert(xs.par.toSet == xs.toSet)
-
+
assert(xs.toMap.par == xs.toMap)
assert(xs.par.toMap == xs.toMap)
}
-
+
def assertToParWoMap[T](xs: GenSeq[T]) {
assert(xs.toIterable.par == xs.toIterable)
assert(xs.par.toIterable == xs.toIterable)
-
+
assert(xs.toSeq.par == xs.toSeq)
assert(xs.par.toSeq == xs.toSeq)
-
+
assert(xs.toSet.par == xs.toSet)
assert(xs.par.toSet == xs.toSet)
}
-
+
}
diff --git a/test/files/run/pf-catch.scala b/test/files/run/pf-catch.scala
index ba0781fe89..33982d0557 100644
--- a/test/files/run/pf-catch.scala
+++ b/test/files/run/pf-catch.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ postfixOps }
object Test {
def shortName(x: AnyRef) = x.getClass.getName split '.' last
type Handler[+T] = PartialFunction[Throwable, T]
@@ -6,12 +8,12 @@ object Test {
case x: java.util.NoSuchElementException => shortName(x)
case x: java.lang.IllegalArgumentException => shortName(x)
}
-
+
def fn[T: Handler](body: => T): T = {
try body
catch implicitly[Handler[T]]
}
-
+
def f1 = {
implicit val myHandler = standardHandler
println(fn(Nil.head))
@@ -27,8 +29,8 @@ object Test {
def main(args: Array[String]): Unit = {
try f1
- catch { case x => println(shortName(x) + " slipped by.") }
-
+ catch { case x: Throwable => println(shortName(x) + " slipped by.") }
+
f2
}
}
diff --git a/test/files/run/position-val-def.check b/test/files/run/position-val-def.check
new file mode 100644
index 0000000000..a92c77c68c
--- /dev/null
+++ b/test/files/run/position-val-def.check
@@ -0,0 +1,30 @@
+val x = 0
+[0:9]val x = [8:9]0
+
+var x = 0
+[0:9]var x = [8:9]0
+
+val x, y = 0
+[NoPosition]{
+ [0:5]val x = [11]0;
+ [7:12]val y = [11:12]0;
+ [NoPosition]()
+}
+
+var x, y = 0
+[NoPosition]{
+ [0:5]var x = [11]0;
+ [7:12]var y = [11:12]0;
+ [NoPosition]()
+}
+
+val (x, y) = 0
+[NoPosition]{
+ <0:14><synthetic> <artifact> private[this] val x$1 = <4:14>[13:14][13:14]0: @[13]scala.unchecked match {
+ <4:10>case <4:10>[4]scala.Tuple2(<5:6>(x @ [5]_), <8:9>(y @ [8]_)) => <4:10><4:10>scala.Tuple2(<4:10>x, <4:10>y)
+ };
+ [5:6]val x = [5]x$1._1;
+ [8:9]val y = [8]x$1._2;
+ [NoPosition]()
+}
+
diff --git a/test/files/run/position-val-def.scala b/test/files/run/position-val-def.scala
new file mode 100644
index 0000000000..62cb54acf8
--- /dev/null
+++ b/test/files/run/position-val-def.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test {
+ val toolbox = cm.mkToolBox(options = "-Yrangepos")
+
+ def main(args: Array[String]) {
+ def test(expr: String) {
+ val t = toolbox.parse(expr)
+ println(expr)
+ println(show(t, printPositions = true))
+ println()
+ }
+ val tests = """
+ val x = 0
+ var x = 0
+ val x, y = 0
+ var x, y = 0
+ val (x, y) = 0
+ """
+ val exprs = tests.split("\\n").map(_.trim).filterNot(_.isEmpty)
+ exprs foreach test
+ }
+}
diff --git a/test/files/run/preinits.check b/test/files/run/preinits.check
index 5584ab261e..e97a14b77f 100644
--- a/test/files/run/preinits.check
+++ b/test/files/run/preinits.check
@@ -1,3 +1,9 @@
+preinits.scala:2: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized.
+trait B extends { override val x = 1 } with A { println("B") }
+ ^
+preinits.scala:3: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized.
+trait C extends { override val x = 2 } with A
+ ^
A
B
2
diff --git a/test/files/run/primitive-sigs-2-new.flags b/test/files/run/primitive-sigs-2-new.flags
new file mode 100644
index 0000000000..2349d8294d
--- /dev/null
+++ b/test/files/run/primitive-sigs-2-new.flags
@@ -0,0 +1 @@
+-Ydelambdafy:inline
diff --git a/test/files/run/primitive-sigs-2-new.scala b/test/files/run/primitive-sigs-2-new.scala
index cf6de9c81b..1f39667b18 100644
--- a/test/files/run/primitive-sigs-2-new.scala
+++ b/test/files/run/primitive-sigs-2-new.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ postfixOps }
import scala.reflect.{ClassTag, classTag}
import java.{ lang => jl }
@@ -29,4 +31,4 @@ object Test {
println(new C f)
c3m.sorted foreach println
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/primitive-sigs-2-old.flags b/test/files/run/primitive-sigs-2-old.flags
new file mode 100644
index 0000000000..ac96850b69
--- /dev/null
+++ b/test/files/run/primitive-sigs-2-old.flags
@@ -0,0 +1 @@
+-Ydelambdafy:inline \ No newline at end of file
diff --git a/test/files/run/primitive-sigs-2-old.scala b/test/files/run/primitive-sigs-2-old.scala
index b7152f7e3d..16fe5ae555 100644
--- a/test/files/run/primitive-sigs-2-old.scala
+++ b/test/files/run/primitive-sigs-2-old.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ postfixOps }
import java.{ lang => jl }
trait T[A] {
@@ -25,7 +27,7 @@ object Test {
val c1: Class[_] = classOf[T[_]]
val c2: Class[_] = classOf[C]
val c3: Class[_] = classOf[Arr]
-
+
val c1m = c1.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString)
val c2m = c2.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString)
val c3m = c3.getDeclaredMethods.toList map (_.toGenericString)
diff --git a/test/files/run/priorityQueue.scala b/test/files/run/priorityQueue.scala
index edc0e32b02..327d8bf137 100644
--- a/test/files/run/priorityQueue.scala
+++ b/test/files/run/priorityQueue.scala
@@ -31,23 +31,23 @@ object Test {
// val pq2 = new PriorityQueue[String]
// val pq3 = new PriorityQueue[String]
// val pq4 = new PriorityQueue[String]
-
+
// val strings = (1 to 20).toList map (i => List.fill((Math.abs(nextInt % 20)) + 1)("x").mkString)
-
+
// pq1 ++= strings
// pq2 ++= strings.reverse
// for (s <- strings) pq3 += s
// for (s <- strings.reverse) pq4 += s
-
+
// val pqs = List(pq1, pq2, pq3, pq4, pq1.clone, pq2.clone)
-
+
// for (queue1 <- pqs ; queue2 <- pqs) {
// val l1: List[String] = queue1.dequeueAll[String, List[String]]
// val l2: List[String] = queue2.dequeueAll[String, List[String]]
// assert(l1 == l2)
// assert(queue1.max == queue2.max)
// }
-
+
// assertPriorityDestructive(pq1)
// }
@@ -83,7 +83,7 @@ object Test {
// }
// for (i <- 0 until 100) assert(intpq(i) == (99 - i))
// }
-
+
// def testTails {
// val pq = new PriorityQueue[Int]
// for (i <- 0 until 10) pq += i * 4321 % 200
@@ -108,13 +108,13 @@ object Test {
// prev = curr
// }
// }
-
+
// def testInits {
// val pq = new PriorityQueue[Long]
// for (i <- 0 until 20) pq += (i + 313) * 111 % 300
-
+
// assert(pq.size == 20)
-
+
// val initpq = pq.init
// assert(initpq.size == 19)
// assertPriorityDestructive(initpq)
@@ -123,19 +123,19 @@ object Test {
// def testFilters {
// val pq = new PriorityQueue[String]
// for (i <- 0 until 100) pq += "Some " + (i * 312 % 200)
-
+
// val filpq = pq.filter(_.indexOf('0') != -1)
// assertPriorityDestructive(filpq)
// }
// def testIntensiveEnqueueDequeue {
// val pq = new PriorityQueue[Int]
-
+
// testIntensive(1000, pq)
// pq.clear
// testIntensive(200, pq)
// }
-
+
// def testIntensive(sz: Int, pq: PriorityQueue[Int]) {
// val lst = new collection.mutable.ArrayBuffer[Int] ++ (0 until sz)
// val rand = new util.Random(7)
@@ -153,7 +153,7 @@ object Test {
// pq ++= (0 until 100)
// val droppq = pq.drop(50)
// assertPriority(droppq)
-
+
// pq.clear
// pq ++= droppq
// assertPriorityDestructive(droppq)
@@ -173,7 +173,7 @@ object Test {
// // assertPriority(pq)
// // pq.clear
-
+
// // pq ++= (1 to 100)
// // pq(5) = 200
// // assert(pq(0) == 200)
@@ -204,7 +204,7 @@ object Test {
// def testEquality {
// val pq1 = new PriorityQueue[Int]
// val pq2 = new PriorityQueue[Int]
-
+
// pq1 ++= (0 until 50)
// var i = 49
// while (i >= 0) {
@@ -213,7 +213,7 @@ object Test {
// }
// assert(pq1 == pq2)
// assertPriority(pq2)
-
+
// pq1 += 100
// assert(pq1 != pq2)
// pq2 += 100
@@ -230,7 +230,7 @@ object Test {
// val pq = new PriorityQueue[Int]
// pq ++= (0 until 100)
// assert(pq.size == 100)
-
+
// val (p1, p2) = pq.partition(_ < 50)
// assertPriorityDestructive(p1)
// assertPriorityDestructive(p2)
@@ -252,13 +252,13 @@ object Test {
// assert(pq.lastIndexWhere(_ == 9) == 0)
// assert(pq.lastIndexOf(8) == 1)
// assert(pq.lastIndexOf(7) == 2)
-
+
// pq += 5
// pq += 9
// assert(pq.lastIndexOf(9) == 1)
// assert(pq.lastIndexWhere(_ % 2 == 1) == 10)
// assert(pq.lastIndexOf(5) == 6)
-
+
// val lst = pq.reverseIterator.toList
// for (i <- 0 until 5) assert(lst(i) == i)
// assert(lst(5) == 5)
@@ -268,13 +268,13 @@ object Test {
// assert(lst(9) == 8)
// assert(lst(10) == 9)
// assert(lst(11) == 9)
-
+
// pq.clear
// assert(pq.reverseIterator.toList.isEmpty)
-
+
// pq ++= (50 to 75)
// assert(pq.lastIndexOf(70) == 5)
-
+
// pq += 55
// pq += 70
// assert(pq.lastIndexOf(70) == 6)
@@ -284,11 +284,11 @@ object Test {
// assert(pq.lastIndexWhere(_ > 54, 21) == 21)
// assert(pq.lastIndexWhere(_ > 69, 5) == 5)
// }
-
+
// def testReverse {
// val pq = new PriorityQueue[(Int, Int)]
// pq ++= (for (i <- 0 until 10) yield (i, i * i % 10))
-
+
// assert(pq.reverse.size == pq.reverseIterator.toList.size)
// assert((pq.reverse zip pq.reverseIterator.toList).forall(p => p._1 == p._2))
// assert(pq.reverse.sameElements(pq.reverseIterator.toSeq))
@@ -296,19 +296,19 @@ object Test {
// assert(pq.reverse(1)._1 == pq(8)._1)
// assert(pq.reverse(4)._1 == pq(5)._1)
// assert(pq.reverse(9)._1 == pq(0)._1)
-
+
// pq += ((7, 7))
// pq += ((7, 9))
// pq += ((7, 8))
// assert(pq.reverse.reverse == pq)
// assert(pq.reverse.lastIndexWhere(_._2 == 6) == 6)
// assertPriorityDestructive(pq.reverse.reverse)
-
+
// val iq = new PriorityQueue[Int]
// iq ++= (0 until 50)
// assert(iq.reverse == iq.reverseIterator.toSeq)
// assert(iq.reverse.reverse == iq)
-
+
// iq += 25
// iq += 40
// iq += 10
@@ -317,10 +317,10 @@ object Test {
// assert(iq.reverse.lastIndexWhere(_ == 10) == 11)
// assertPriorityDestructive(iq.reverse.reverse)
// }
-
+
// def testToList {
// val pq = new PriorityQueue[Int]
-
+
// pq += 1
// pq += 4
// pq += 0
@@ -330,16 +330,16 @@ object Test {
// assert(pq.toList == pq)
// assert(pq == List(5, 4, 3, 2, 1, 0))
// assert(pq.reverse == List(0, 1, 2, 3, 4, 5))
-
+
// pq.clear
// for (i <- -50 until 50) pq += i
// assert(pq.toList == pq)
// assert(pq.toList == (-50 until 50).reverse)
// }
-
+
// def testForeach {
// val pq = new PriorityQueue[Char]
-
+
// pq += 't'
// pq += 'o'
// pq += 'b'
@@ -351,7 +351,7 @@ object Test {
// assert(sbf.toString == sbi.toString)
// assert(sbf.toString == "ytob")
// }
-
+
}
diff --git a/test/files/run/private-inline.check b/test/files/run/private-inline.check
index 209e3ef4b6..e71aec2fcf 100644
--- a/test/files/run/private-inline.check
+++ b/test/files/run/private-inline.check
@@ -1 +1,13 @@
+private-inline.scala:24: warning: Could not inline required method wrapper1 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack.
+ def f1b() = identity(wrapper1(5))
+ ^
+private-inline.scala:24: warning: At the end of the day, could not inline @inline-marked method wrapper1
+ def f1b() = identity(wrapper1(5))
+ ^
+private-inline.scala:29: warning: Could not inline required method wrapper2 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack.
+ def f2b() = identity(wrapper2(5))
+ ^
+private-inline.scala:29: warning: At the end of the day, could not inline @inline-marked method wrapper2
+ def f2b() = identity(wrapper2(5))
+ ^
20
diff --git a/test/files/run/private-inline.flags b/test/files/run/private-inline.flags
index eb4d19bcb9..00d3643fd4 100644
--- a/test/files/run/private-inline.flags
+++ b/test/files/run/private-inline.flags
@@ -1 +1 @@
--optimise \ No newline at end of file
+-optimise -Yinline-warnings
diff --git a/test/files/run/private-inline.scala b/test/files/run/private-inline.scala
index a62007779c..60fef9efca 100644
--- a/test/files/run/private-inline.scala
+++ b/test/files/run/private-inline.scala
@@ -2,7 +2,7 @@
final class A {
private var x1 = false
var x2 = false
-
+
// manipulates private var
@inline private def wrapper1[T](body: => T): T = {
val saved = x1
@@ -17,35 +17,35 @@ final class A {
try body
finally x2 = saved
}
-
+
// not inlined
def f1a() = wrapper1(5)
// inlined!
def f1b() = identity(wrapper1(5))
-
+
// not inlined
def f2a() = wrapper2(5)
// inlined!
- def f2b() = identity(wrapper2(5))
+ def f2b() = identity(wrapper2(5))
}
object Test {
def methodClasses = List("f1a", "f2a") map ("A$$anonfun$" + _ + "$1")
-
+
def main(args: Array[String]): Unit = {
val a = new A
import a._
println(f1a() + f1b() + f2a() + f2b())
-
+
// Don't know how else to test this: all these should have been
// inlined, so all should fail.
methodClasses foreach { clazz =>
-
+
val foundClass = (
try Class.forName(clazz)
- catch { case _ => null }
+ catch { case _: Throwable => null }
)
-
+
assert(foundClass == null, foundClass)
}
}
diff --git a/test/files/run/private-override.check b/test/files/run/private-override.check
new file mode 100644
index 0000000000..00750edc07
--- /dev/null
+++ b/test/files/run/private-override.check
@@ -0,0 +1 @@
+3
diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check
index bdf76ddce1..1cd94ccb45 100644
--- a/test/files/run/programmatic-main.check
+++ b/test/files/run/programmatic-main.check
@@ -1,31 +1,27 @@
- phase name id description
- ---------- -- -----------
- parser 1 parse source into ASTs, perform simple desugaring
- namer 2 resolve names, attach symbols to named trees
- packageobjects 3 load package objects
- typer 4 the meat and potatoes: type the trees
- patmat 5 translate match expressions
- superaccessors 6 add super accessors in traits and nested classes
- extmethods 7 add extension methods for inline classes
- pickler 8 serialize symbol tables
- refchecks 9 reference/override checking, translate nested objects
- uncurry 10 uncurry, translate function values to anonymous classes
- tailcalls 11 replace tail calls by jumps
- specialize 12 @specialized-driven class and method specialization
- explicitouter 13 this refs to outer pointers, translate patterns
- erasure 14 erase types, add interfaces for traits
- posterasure 15 clean up erased inline classes
- lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
- lambdalift 17 move nested functions to top level
- constructors 18 move field definitions into constructors
- flatten 19 eliminate inner classes
- mixin 20 mixin composition
- cleanup 21 platform-specific cleanups, generate reflective calls
- icode 22 generate portable intermediate code
- inliner 23 optimization: do inlining
-inlineExceptionHandlers 24 optimization: inline exception handlers
- closelim 25 optimization: eliminate uncalled closures
- dce 26 optimization: eliminate dead code
- jvm 27 generate JVM bytecode
- terminal 28 The last phase in the compiler chain
-
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ delambdafy 22 remove lambdas
+ icode 23 generate portable intermediate code
+ jvm 24 generate JVM bytecode
+ terminal 25 the last phase during a compilation run
diff --git a/test/files/run/programmatic-main.scala b/test/files/run/programmatic-main.scala
index 7bc5c5dfcf..542ac2781e 100644
--- a/test/files/run/programmatic-main.scala
+++ b/test/files/run/programmatic-main.scala
@@ -1,3 +1,5 @@
+
+import scala.language.postfixOps
import scala.tools.nsc._
import io.Path
@@ -5,7 +7,7 @@ object Test {
val cwd = Option(System.getProperty("partest.cwd")) getOrElse "."
val basedir = Path(cwd).parent / "lib" path
val baseargs = Array("-usejavacp", "-bootclasspath", basedir + "/scala-library.jar", "-cp", basedir + "/scala-compiler.jar")
-
+
def main(args: Array[String]): Unit = {
Console.withErr(Console.out) {
Main process (baseargs ++ "-Xpluginsdir /does/not/exist/foo/quux -Xshow-phases".split(' '))
diff --git a/test/files/run/proxy.scala b/test/files/run/proxy.scala
index ea222cb496..8a6385dc85 100644
--- a/test/files/run/proxy.scala
+++ b/test/files/run/proxy.scala
@@ -1,16 +1,16 @@
object Test extends App {
val p = new Proxy {
- def self = 2
+ def self = 2
}
println(p equals 1)
println(p equals 2)
println(p equals 3)
println(p equals null)
-
+
case class Bippy(a: String) extends Proxy {
def self = a
}
-
+
val label = Bippy("bippy!")
println(label == label)
println(label == "bippy!")
diff --git a/test/files/run/range-unit.scala b/test/files/run/range-unit.scala
index ece0d9806c..d8ebc00e9c 100644
--- a/test/files/run/range-unit.scala
+++ b/test/files/run/range-unit.scala
@@ -6,14 +6,14 @@ object Test {
( (-3 to 3) ++ List(17, 127, Int.MaxValue, Int.MinValue + 1)
).distinct.sortBy(n => (math.abs(n), n))
) :+ Int.MinValue
-
+
// reducing output a little
val endpoints = numbers filterNot Set(-3, -2, 2, 17, 127)
-
+
def num(n: Int) = {
val frommax = Int.MaxValue - n
val frommin = Int.MinValue - n
-
+
if (n > 0) {
if (frommax == 0) "MAX"
else if (frommax < 1000) "MAX-" + frommax
@@ -25,7 +25,7 @@ object Test {
else "" + n
}
}
-
+
def run[T](body: => Range): List[Any] = {
try { val r = body ; if (r.isEmpty) List(r.length) else List(num(r.length), num(r.head), num(r.last)) }
catch { case e: IllegalArgumentException => List("---\n " + e) }
diff --git a/test/files/run/range.check b/test/files/run/range.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/range.check
+++ /dev/null
diff --git a/test/files/run/range.scala b/test/files/run/range.scala
index f08b2105d3..4637ab874d 100644
--- a/test/files/run/range.scala
+++ b/test/files/run/range.scala
@@ -6,7 +6,7 @@ object Test {
range.foreach(buffer += _);
assert(buffer.toList == range.iterator.toList, buffer.toList+"/"+range.iterator.toList)
}
-
+
def boundaryTests() = {
// #4321
assert((Int.MinValue to Int.MaxValue by Int.MaxValue).size == 3)
@@ -16,32 +16,43 @@ object Test {
catch { case _: IllegalArgumentException => true }
)
assert(caught)
+ // #7432
+ val noElemAtMin = (
+ try { (10 until 10).min ; false }
+ catch { case _: NoSuchElementException => true }
+ )
+ assert(noElemAtMin)
+ val noElemAtMax = (
+ try { (10 until 10).max ; false }
+ catch { case _: NoSuchElementException => true }
+ )
+ assert(noElemAtMax)
}
-
+
case class GR[T](val x: T)(implicit val num: Integral[T]) {
import num._
-
+
def negated = GR[T](-x)
-
+
def gr1 = NumericRange(x, x, x)
def gr2 = NumericRange.inclusive(x, x, x)
def gr3 = NumericRange(x, x * fromInt(10), x)
def gr4 = NumericRange.inclusive(x, x * fromInt(10), x)
def gr5 = gr3.toList ::: negated.gr3.toList
-
+
def check = {
assert(gr1.isEmpty && !gr2.isEmpty)
- assert(gr3.size == 9 && gr4.size == 10)
+ assert(gr3.size == 9 && gr4.size == 10)
assert(gr5.sum == num.zero, gr5.toString)
assert(!(gr3 contains (x * fromInt(10))))
assert((gr4 contains (x * fromInt(10))))
}
}
-
+
def main(args: Array[String]): Unit = {
implicit val imp1 = Numeric.BigDecimalAsIfIntegral
implicit val imp2 = Numeric.DoubleAsIfIntegral
-
+
val _grs = List[GR[_]](
GR(BigDecimal(5.0)),
GR(BigInt(5)),
@@ -51,21 +62,21 @@ object Test {
)
val grs = _grs ::: (_grs map (_.negated))
grs foreach (_.check)
-
+
assert(NumericRange(1, 10, 1) sameElements (1 until 10))
assert(NumericRange.inclusive(1, 10, 1) sameElements (1 to 10))
assert(NumericRange.inclusive(1, 100, 3) sameElements (1 to 100 by 3))
-
+
// #2518
assert((3L to 7 by 2) sameElements List(3L, 5L, 7L))
-
+
rangeForeach(1 to 10);
rangeForeach(1 until 10);
rangeForeach(10 to 1 by -1);
rangeForeach(10 until 1 by -1);
rangeForeach(10 to 1 by -3);
rangeForeach(10 until 1 by -3);
-
+
// living on the edges
boundaryTests()
}
diff --git a/test/files/run/records.scala b/test/files/run/records.scala
index 96b0b4cb0f..f2b582b950 100644
--- a/test/files/run/records.scala
+++ b/test/files/run/records.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ reflectiveCalls }
+
trait C {
def f: Int
}
@@ -16,10 +19,10 @@ object Test {
val y = new C {
def f = 2
def g = " world"
- }
-
+ }
+
val z: T = y
-
+
def main(args: Array[String]): Unit = {
assert(x.f+z.f == 3)
assert(x.g+z.g == "hello world")
diff --git a/test/files/run/reflect-priv-ctor.check b/test/files/run/reflect-priv-ctor.check
new file mode 100644
index 0000000000..a0fb1943b7
--- /dev/null
+++ b/test/files/run/reflect-priv-ctor.check
@@ -0,0 +1 @@
+privately constructed
diff --git a/test/files/run/reflect-priv-ctor.scala b/test/files/run/reflect-priv-ctor.scala
new file mode 100644
index 0000000000..9cb3e658cd
--- /dev/null
+++ b/test/files/run/reflect-priv-ctor.scala
@@ -0,0 +1,22 @@
+
+import language.postfixOps
+import reflect.runtime._
+import universe._
+
+object Test {
+
+ class Foo private () {
+ override def toString = "privately constructed"
+ }
+
+ def main(args: Array[String]): Unit = {
+
+ //val foo = new Foo // no access
+ val klass = currentMirror reflectClass typeOf[Foo].typeSymbol.asClass
+ val init = typeOf[Foo].members find { case m: MethodSymbol => m.isConstructor case _ => false } get
+ val ctor = klass reflectConstructor init.asMethod
+ val foo = ctor() // no access?
+ Console println foo
+ }
+}
+
diff --git a/test/files/run/reflection-allmirrors-tostring.check b/test/files/run/reflection-allmirrors-tostring.check
index 2a3be29402..3003cce6c0 100644
--- a/test/files/run/reflection-allmirrors-tostring.check
+++ b/test/files/run/reflection-allmirrors-tostring.check
@@ -1,14 +1,14 @@
class mirror for C (bound to null)
module mirror for M (bound to null)
instance mirror for an instance of C
-field mirror for C.f1 (bound to an instance of C)
-field mirror for C.f2 (bound to an instance of C)
-method mirror for C.m1: Int (bound to an instance of C)
-method mirror for C.m2(): Int (bound to an instance of C)
-method mirror for C.m3[T >: String <: Int]: T (bound to an instance of C)
-method mirror for C.m4[A, B <: A[Int]](x: A[B])(implicit y: Int): Nothing (bound to an instance of C)
-method mirror for C.m5(x: => Int, y: Int*): String (bound to an instance of C)
+field mirror for private[this] val f1: Int (bound to an instance of C)
+field mirror for private[this] var f2: Int (bound to an instance of C)
+method mirror for def m1: Int (bound to an instance of C)
+method mirror for def m2(): Int (bound to an instance of C)
+method mirror for def m3[T >: String <: Int]: T (bound to an instance of C)
+method mirror for def m4[A[_], B <: A[Int]](x: A[B])(implicit y: Int): Nothing (bound to an instance of C)
+method mirror for def m5(x: => Int,y: Int*): String (bound to an instance of C)
class mirror for C.C (bound to an instance of C)
module mirror for C.M (bound to an instance of C)
-constructor mirror for C.<init>(): C (bound to null)
-constructor mirror for C.C.<init>(): C.this.C (bound to an instance of C)
+constructor mirror for def <init>(): C (bound to null)
+constructor mirror for def <init>(): C.this.C (bound to an instance of C)
diff --git a/test/files/run/reflection-allmirrors-tostring.scala b/test/files/run/reflection-allmirrors-tostring.scala
index 73afff291c..f0614e9a98 100644
--- a/test/files/run/reflection-allmirrors-tostring.scala
+++ b/test/files/run/reflection-allmirrors-tostring.scala
@@ -1,3 +1,4 @@
+import scala.language.higherKinds
import scala.reflect.runtime.universe._
class C {
@@ -26,18 +27,18 @@ object Test extends App {
println(cm.reflect(new C))
val im = cm.reflect(new C)
- println(im.reflectField(typeOf[C].member(newTermName("f1")).asTerm))
- println(im.reflectField(typeOf[C].member(newTermName("f2")).asTerm))
- println(im.reflectMethod(typeOf[C].member(newTermName("m1")).asMethod))
- println(im.reflectMethod(typeOf[C].member(newTermName("m2")).asMethod))
- println(im.reflectMethod(typeOf[C].member(newTermName("m3")).asMethod))
- println(im.reflectMethod(typeOf[C].member(newTermName("m4")).asMethod))
- println(im.reflectMethod(typeOf[C].member(newTermName("m5")).asMethod))
- println(im.reflectClass(typeOf[C].member(newTypeName("C")).asClass))
- println(im.reflectModule(typeOf[C].member(newTermName("M")).asModule))
+ println(im.reflectField(typeOf[C].member(TermName("f1")).asTerm))
+ println(im.reflectField(typeOf[C].member(TermName("f2")).asTerm))
+ println(im.reflectMethod(typeOf[C].member(TermName("m1")).asMethod))
+ println(im.reflectMethod(typeOf[C].member(TermName("m2")).asMethod))
+ println(im.reflectMethod(typeOf[C].member(TermName("m3")).asMethod))
+ println(im.reflectMethod(typeOf[C].member(TermName("m4")).asMethod))
+ println(im.reflectMethod(typeOf[C].member(TermName("m5")).asMethod))
+ println(im.reflectClass(typeOf[C].member(TypeName("C")).asClass))
+ println(im.reflectModule(typeOf[C].member(TermName("M")).asModule))
val c = cm.staticClass("C")
- val cc = typeOf[C].member(newTypeName("C")).asClass
- println(cm.reflectClass(c).reflectConstructor(c.typeSignature.member(nme.CONSTRUCTOR).asMethod))
- println(im.reflectClass(cc).reflectConstructor(cc.typeSignature.member(nme.CONSTRUCTOR).asMethod))
-} \ No newline at end of file
+ val cc = typeOf[C].member(TypeName("C")).asClass
+ println(cm.reflectClass(c).reflectConstructor(c.info.member(termNames.CONSTRUCTOR).asMethod))
+ println(im.reflectClass(cc).reflectConstructor(cc.info.member(termNames.CONSTRUCTOR).asMethod))
+}
diff --git a/test/files/run/reflection-companion.check b/test/files/run/reflection-companion.check
new file mode 100644
index 0000000000..5dbff9960e
--- /dev/null
+++ b/test/files/run/reflection-companion.check
@@ -0,0 +1,6 @@
+C#MOD
+C#CLS
+C#CLS
+NoSymbol#???
+NoSymbol#???
+NoSymbol#???
diff --git a/test/files/run/reflection-companion.scala b/test/files/run/reflection-companion.scala
new file mode 100644
index 0000000000..0f62dead12
--- /dev/null
+++ b/test/files/run/reflection-companion.scala
@@ -0,0 +1,16 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+class C
+object C
+
+object Test extends App {
+ type T = C
+
+ println(showRaw(symbolOf[C].companion, printKinds = true))
+ println(showRaw(symbolOf[C].companion.companion, printKinds = true))
+ println(showRaw(symbolOf[C.type].companion, printKinds = true))
+ println(showRaw(symbolOf[T].companion, printKinds = true))
+ println(showRaw(cm.staticPackage("scala").moduleClass.companion, printKinds = true))
+ println(showRaw(cm.staticPackage("scala").companion, printKinds = true))
+} \ No newline at end of file
diff --git a/test/files/run/reflection-companiontype.check b/test/files/run/reflection-companiontype.check
new file mode 100644
index 0000000000..f87bc04480
--- /dev/null
+++ b/test/files/run/reflection-companiontype.check
@@ -0,0 +1,12 @@
+TypeRefs
+TypeRef(ThisType(<empty>#PKC), C#MODC, List())
+TypeRef(ThisType(<empty>#PKC), C#CLS, List())
+TypeRef(ThisType(<empty>#PKC), C#CLS, List())
+ClassInfoTypes
+TypeRef(ThisType(<empty>#PKC), C#MODC, List())
+TypeRef(ThisType(<empty>#PKC), C#CLS, List())
+TypeRef(ThisType(<empty>#PKC), C#CLS, List())
+Unrelated
+NoType
+NoType
+NoType
diff --git a/test/files/run/reflection-companiontype.scala b/test/files/run/reflection-companiontype.scala
new file mode 100644
index 0000000000..0f63457670
--- /dev/null
+++ b/test/files/run/reflection-companiontype.scala
@@ -0,0 +1,22 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+class C
+object C
+
+object Test extends App {
+ type T = C
+
+ println("TypeRefs")
+ println(showRaw(typeOf[C].companion, printKinds = true))
+ println(showRaw(typeOf[C].companion.companion, printKinds = true))
+ println(showRaw(typeOf[C.type].companion, printKinds = true))
+ println("ClassInfoTypes")
+ println(showRaw(typeOf[C].typeSymbol.info.companion, printKinds = true))
+ println(showRaw(typeOf[C].typeSymbol.info.companion.typeSymbol.info.companion, printKinds = true))
+ println(showRaw(typeOf[C.type].typeSymbol.info.companion, printKinds = true))
+ println("Unrelated")
+ println(showRaw(typeOf[T].companion, printKinds = true))
+ println(showRaw(cm.staticPackage("scala").moduleClass.asType.toType.companion, printKinds = true))
+ println(showRaw(cm.staticPackage("scala").info.companion, printKinds = true))
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-inner-badpath.scala b/test/files/run/reflection-constructormirror-inner-badpath.scala
index 4bccff21fe..e7c06b32ae 100644
--- a/test/files/run/reflection-constructormirror-inner-badpath.scala
+++ b/test/files/run/reflection-constructormirror-inner-badpath.scala
@@ -12,8 +12,8 @@ class Foo{
val classTag = implicitly[ClassTag[R]]
val cl = classTag.runtimeClass.getClassLoader
val cm = runtimeMirror(cl)
- val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod
- val sig = constructor.typeSignature
+ val constructor = expectedType.tpe.member( termNames.CONSTRUCTOR ).asMethod
+ val sig = constructor.info
val sym = cm.classSymbol( classTag.runtimeClass )
try {
val cls = cm.reflectClass( sym )
diff --git a/test/files/run/reflection-constructormirror-inner-good.scala b/test/files/run/reflection-constructormirror-inner-good.scala
index 861332161f..c09da5b300 100644
--- a/test/files/run/reflection-constructormirror-inner-good.scala
+++ b/test/files/run/reflection-constructormirror-inner-good.scala
@@ -12,8 +12,8 @@ class Foo{
val classTag = implicitly[ClassTag[R]]
val cl = classTag.runtimeClass.getClassLoader
val cm = runtimeMirror(cl)
- val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod
- val sig = constructor.typeSignature
+ val constructor = expectedType.tpe.member( termNames.CONSTRUCTOR ).asMethod
+ val sig = constructor.info
val sym = cm.classSymbol( classTag.runtimeClass )
val cls = cm.reflect( this ).reflectClass( sym )
cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
diff --git a/test/files/run/reflection-constructormirror-nested-badpath.scala b/test/files/run/reflection-constructormirror-nested-badpath.scala
index 2983f185de..cf0de77e10 100644
--- a/test/files/run/reflection-constructormirror-nested-badpath.scala
+++ b/test/files/run/reflection-constructormirror-nested-badpath.scala
@@ -8,8 +8,8 @@ class Foo{
val classTag = implicitly[ClassTag[R]]
val cl = classTag.runtimeClass.getClassLoader
val cm = runtimeMirror(cl)
- val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod
- val sig = constructor.typeSignature
+ val constructor = expectedType.tpe.member( termNames.CONSTRUCTOR ).asMethod
+ val sig = constructor.info
val sym = cm.classSymbol( classTag.runtimeClass )
try {
val cls = cm.reflect( this ).reflectClass( sym )
diff --git a/test/files/run/reflection-constructormirror-nested-good.scala b/test/files/run/reflection-constructormirror-nested-good.scala
index 0b7c413975..363b720461 100644
--- a/test/files/run/reflection-constructormirror-nested-good.scala
+++ b/test/files/run/reflection-constructormirror-nested-good.scala
@@ -8,8 +8,8 @@ class Foo{
val classTag = implicitly[ClassTag[R]]
val cl = classTag.runtimeClass.getClassLoader
val cm = runtimeMirror(cl)
- val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod
- val sig = constructor.typeSignature
+ val constructor = expectedType.tpe.member( termNames.CONSTRUCTOR ).asMethod
+ val sig = constructor.info
val sym = cm.classSymbol( classTag.runtimeClass )
val cls = cm.reflectClass( sym )
cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.scala b/test/files/run/reflection-constructormirror-toplevel-badpath.scala
index cf92929119..eda4aa0531 100644
--- a/test/files/run/reflection-constructormirror-toplevel-badpath.scala
+++ b/test/files/run/reflection-constructormirror-toplevel-badpath.scala
@@ -13,8 +13,8 @@ class Foo{
val classTag = implicitly[ClassTag[R]]
val cl = classTag.runtimeClass.getClassLoader
val cm = runtimeMirror(cl)
- val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod
- val sig = constructor.typeSignature
+ val constructor = expectedType.tpe.member( termNames.CONSTRUCTOR ).asMethod
+ val sig = constructor.info
val sym = cm.classSymbol( classTag.runtimeClass )
try {
val cls = cm.reflect( this ).reflectClass( sym )
diff --git a/test/files/run/reflection-constructormirror-toplevel-good.scala b/test/files/run/reflection-constructormirror-toplevel-good.scala
index b68134b2cb..9842d01695 100644
--- a/test/files/run/reflection-constructormirror-toplevel-good.scala
+++ b/test/files/run/reflection-constructormirror-toplevel-good.scala
@@ -13,8 +13,8 @@ class Foo{
val classTag = implicitly[ClassTag[R]]
val cl = classTag.runtimeClass.getClassLoader
val cm = runtimeMirror(cl)
- val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod
- val sig = constructor.typeSignature
+ val constructor = expectedType.tpe.member( termNames.CONSTRUCTOR ).asMethod
+ val sig = constructor.info
val sym = cm.classSymbol( classTag.runtimeClass )
val cls = cm.reflectClass( sym )
cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
diff --git a/test/files/run/reflection-enclosed-basic.scala b/test/files/run/reflection-enclosed-basic.scala
index 1dcb6c2a27..e001207e82 100644
--- a/test/files/run/reflection-enclosed-basic.scala
+++ b/test/files/run/reflection-enclosed-basic.scala
@@ -12,7 +12,7 @@ private object B6 extends B2 { override def toString = "B6"; override def foo =
object Test extends App {
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.info.decl(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
@@ -20,7 +20,7 @@ object Test extends App {
def testNestedClass(name: String) = {
val sym = cm.staticClass(name)
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.info.decl(termNames.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
diff --git a/test/files/run/reflection-enclosed-inner-basic.scala b/test/files/run/reflection-enclosed-inner-basic.scala
index 2b2c701993..fd81a8d115 100644
--- a/test/files/run/reflection-enclosed-inner-basic.scala
+++ b/test/files/run/reflection-enclosed-inner-basic.scala
@@ -14,19 +14,19 @@ class B {
object Test extends App {
val b = cm.classSymbol(classTag[B].runtimeClass)
println(b)
- println(b.typeSignature.declarations.toList)
+ println(b.info.decls.toList)
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.info.decl(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testInnerClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.info.decl(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.info.decl(termNames.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflect(new B).reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -37,7 +37,7 @@ object Test extends App {
testInnerClass("B2")
def testInnerModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.info.decl(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflect(new B).reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-enclosed-inner-inner-basic.scala b/test/files/run/reflection-enclosed-inner-inner-basic.scala
index 1b9e19d37d..45dfb8a61f 100644
--- a/test/files/run/reflection-enclosed-inner-inner-basic.scala
+++ b/test/files/run/reflection-enclosed-inner-inner-basic.scala
@@ -16,19 +16,19 @@ class B {
object Test extends App {
val b = cm.classSymbol(classTag[B#BB].runtimeClass)
println(b)
- println(b.typeSignature.declarations.toList)
+ println(b.info.decls.toList)
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.info.decl(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testInnerClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.info.decl(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.info.decl(termNames.CONSTRUCTOR).asMethod
val outer1 = new B
val outer2 = new outer1.BB
val ctorMirror = cm.reflect(outer2).reflectClass(sym).reflectConstructor(ctor)
@@ -41,7 +41,7 @@ object Test extends App {
testInnerClass("B2")
def testInnerModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.info.decl(TermName(name)).asModule
println(sym)
val outer1 = new B
val outer2 = new outer1.BB
diff --git a/test/files/run/reflection-enclosed-inner-nested-basic.scala b/test/files/run/reflection-enclosed-inner-nested-basic.scala
index 2800ee2548..1973f47397 100644
--- a/test/files/run/reflection-enclosed-inner-nested-basic.scala
+++ b/test/files/run/reflection-enclosed-inner-nested-basic.scala
@@ -17,19 +17,19 @@ object Test extends App {
val outer1 = new B()
val b = cm.moduleSymbol(classTag[outer1.BB.type].runtimeClass)
println(b)
- println(b.typeSignature.declarations.toList)
+ println(b.info.decls.toList)
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.info.decl(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testNestedClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.info.decl(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.info.decl(termNames.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflect(outer1.BB).reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -40,7 +40,7 @@ object Test extends App {
testNestedClass("B2")
def testNestedModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.info.decl(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflect(outer1.BB).reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-enclosed-nested-basic.scala b/test/files/run/reflection-enclosed-nested-basic.scala
index 8b740c2da2..4ff333d10f 100644
--- a/test/files/run/reflection-enclosed-nested-basic.scala
+++ b/test/files/run/reflection-enclosed-nested-basic.scala
@@ -14,19 +14,19 @@ object B {
object Test extends App {
val b = cm.moduleSymbol(classTag[B.type].runtimeClass)
println(b)
- println(b.typeSignature.declarations.toList)
+ println(b.info.decls.toList)
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.info.decl(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testNestedClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.info.decl(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.info.decl(termNames.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -37,7 +37,7 @@ object Test extends App {
testNestedClass("B2")
def testNestedModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.info.decl(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-enclosed-nested-inner-basic.scala b/test/files/run/reflection-enclosed-nested-inner-basic.scala
index 7466733d37..d45894c8c2 100644
--- a/test/files/run/reflection-enclosed-nested-inner-basic.scala
+++ b/test/files/run/reflection-enclosed-nested-inner-basic.scala
@@ -16,19 +16,19 @@ object B {
object Test extends App {
val b = cm.classSymbol(classTag[B.BB].runtimeClass)
println(b)
- println(b.typeSignature.declarations.toList)
+ println(b.info.decls.toList)
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.info.decl(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testInnerClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.info.decl(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.info.decl(termNames.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflect(new B.BB).reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -39,7 +39,7 @@ object Test extends App {
testInnerClass("B2")
def testInnerModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.info.decl(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflect(new B.BB).reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-enclosed-nested-nested-basic.scala b/test/files/run/reflection-enclosed-nested-nested-basic.scala
index 8335ea482a..8a630ea1fb 100644
--- a/test/files/run/reflection-enclosed-nested-nested-basic.scala
+++ b/test/files/run/reflection-enclosed-nested-nested-basic.scala
@@ -16,19 +16,19 @@ object B {
object Test extends App {
val b = cm.moduleSymbol(classTag[B.BB.type].runtimeClass)
println(b)
- println(b.typeSignature.declarations.toList)
+ println(b.info.decls.toList)
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.info.decl(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testNestedClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.info.decl(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.info.decl(termNames.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -39,7 +39,7 @@ object Test extends App {
testNestedClass("B2")
def testNestedModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.info.decl(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check
index 65b525731f..682326bc18 100644
--- a/test/files/run/reflection-equality.check
+++ b/test/files/run/reflection-equality.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> class X {
def methodIntIntInt(x: Int, y: Int) = x+y
}
@@ -22,17 +20,17 @@ im: reflect.runtime.universe.InstanceMirror
scala> val cs: ClassSymbol = im.symbol
cs: reflect.runtime.universe.ClassSymbol = class X
-scala> val ts: Type = cs.typeSignature
-ts: reflect.runtime.universe.Type =
+scala> val ts: Type = cs.info
+ts: reflect.runtime.universe.Type =
scala.AnyRef {
def <init>(): X
def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int
}
-scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod
+scala> val ms: MethodSymbol = ts.decl(TermName("methodIntIntInt")).asMethod
ms: reflect.runtime.universe.MethodSymbol = method methodIntIntInt
-scala> val MethodType( _, t1 ) = ms.typeSignature
+scala> val MethodType( _, t1 ) = ms.info
t1: reflect.runtime.universe.Type = scala.Int
scala> val t2 = typeOf[scala.Int]
diff --git a/test/files/run/reflection-equality.scala b/test/files/run/reflection-equality.scala
index 8fc82721e7..0416bc7726 100644
--- a/test/files/run/reflection-equality.scala
+++ b/test/files/run/reflection-equality.scala
@@ -10,9 +10,9 @@ object Test extends ReplTest {
|import scala.reflect.runtime.{ currentMirror => cm }
|def im: InstanceMirror = cm.reflect(new X)
|val cs: ClassSymbol = im.symbol
- |val ts: Type = cs.typeSignature
- |val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod
- |val MethodType( _, t1 ) = ms.typeSignature
+ |val ts: Type = cs.info
+ |val ms: MethodSymbol = ts.decl(TermName("methodIntIntInt")).asMethod
+ |val MethodType( _, t1 ) = ms.info
|val t2 = typeOf[scala.Int]
|t1 == t2
|t1 =:= t2
diff --git a/test/files/run/reflection-fancy-java-classes.check b/test/files/run/reflection-fancy-java-classes.check
new file mode 100644
index 0000000000..258208dd99
--- /dev/null
+++ b/test/files/run/reflection-fancy-java-classes.check
@@ -0,0 +1,12 @@
+===== JAVA POV =====
+class Foo_1$1
+getEnclosingClass = class Foo_1
+getEnclosingMethod = null
+getEnclosingConstructor = null
+isMemberClass = false
+isLocalClass = false
+isAnonymousClass = true
+
+===== SCALA POV =====
+class 1
+object Foo_1
diff --git a/test/files/run/reflection-fancy-java-classes/Foo_1.java b/test/files/run/reflection-fancy-java-classes/Foo_1.java
new file mode 100644
index 0000000000..f6fd76124b
--- /dev/null
+++ b/test/files/run/reflection-fancy-java-classes/Foo_1.java
@@ -0,0 +1,5 @@
+public class Foo_1 {
+ public static Bar bar = new Bar();
+ private static class Bar {
+ }
+} \ No newline at end of file
diff --git a/test/files/run/reflection-fancy-java-classes/Test_2.scala b/test/files/run/reflection-fancy-java-classes/Test_2.scala
new file mode 100644
index 0000000000..271960ee79
--- /dev/null
+++ b/test/files/run/reflection-fancy-java-classes/Test_2.scala
@@ -0,0 +1,20 @@
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+
+object Test extends App {
+ println("===== JAVA POV =====")
+ val jfancy = Class.forName("Foo_1$1")
+ println(jfancy)
+ println("getEnclosingClass = " + jfancy.getEnclosingClass)
+ println("getEnclosingMethod = " + jfancy.getEnclosingMethod)
+ println("getEnclosingConstructor = " + jfancy.getEnclosingConstructor)
+ println("isMemberClass = " + jfancy.isMemberClass)
+ println("isLocalClass = " + jfancy.isLocalClass)
+ println("isAnonymousClass = " + jfancy.isAnonymousClass)
+
+ println("")
+ println("===== SCALA POV =====")
+ val sfancy = cm.classSymbol(jfancy)
+ println(sfancy)
+ println(sfancy.owner)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-fieldmirror-accessorsareokay.scala b/test/files/run/reflection-fieldmirror-accessorsareokay.scala
index 16354025f3..0e75dcf7e6 100644
--- a/test/files/run/reflection-fieldmirror-accessorsareokay.scala
+++ b/test/files/run/reflection-fieldmirror-accessorsareokay.scala
@@ -24,6 +24,6 @@ object Test extends App {
}
}
- test(cs.typeSignature.declaration(newTermName("x")).asTerm)
- test(cs.typeSignature.declaration(newTermName("x_$eq")).asTerm)
+ test(cs.info.decl(TermName("x")).asTerm)
+ test(cs.info.decl(TermName("x_$eq")).asTerm)
}
diff --git a/test/files/run/reflection-fieldmirror-ctorparam.scala b/test/files/run/reflection-fieldmirror-ctorparam.scala
index b9d50fe97b..b5b6b21027 100644
--- a/test/files/run/reflection-fieldmirror-ctorparam.scala
+++ b/test/files/run/reflection-fieldmirror-ctorparam.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x")).asTerm
+ val f = cs.info.decl(TermName("x")).asTerm
try {
val fm: FieldMirror = im.reflectField(f)
println(fm.get)
diff --git a/test/files/run/reflection-fieldmirror-getsetval.scala b/test/files/run/reflection-fieldmirror-getsetval.scala
index 90221481d4..4fe0d2e4f3 100644
--- a/test/files/run/reflection-fieldmirror-getsetval.scala
+++ b/test/files/run/reflection-fieldmirror-getsetval.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
+ val f = cs.info.decl(TermName("x" + termNames.LOCAL_SUFFIX_STRING)).asTerm
val fm: FieldMirror = im.reflectField(f)
println(fm.get)
fm.set(2)
diff --git a/test/files/run/reflection-fieldmirror-getsetvar.scala b/test/files/run/reflection-fieldmirror-getsetvar.scala
index abcf396dd1..c64b0c46c0 100644
--- a/test/files/run/reflection-fieldmirror-getsetvar.scala
+++ b/test/files/run/reflection-fieldmirror-getsetvar.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
+ val f = cs.info.decl(TermName("x" + termNames.LOCAL_SUFFIX_STRING)).asTerm
val fm: FieldMirror = im.reflectField(f)
println(fm.get)
fm.set(2)
diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
index 2b4a9bb55e..ddc6c42e78 100644
--- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
+++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
+ val f = cs.info.decl(TermName("x" + termNames.LOCAL_SUFFIX_STRING)).asTerm
val fm: FieldMirror = im.reflectField(f)
println(fm.symbol.isVar)
}
diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala
index ab838dbb1b..1ece46576d 100644
--- a/test/files/run/reflection-fieldmirror-privatethis.scala
+++ b/test/files/run/reflection-fieldmirror-privatethis.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x")).asTerm
+ val f = cs.info.decl(TermName("x")).asTerm
val fm: FieldMirror = im.reflectField(f)
println(fm.symbol.isVar)
println(fm.get)
diff --git a/test/files/run/reflection-fieldsymbol-navigation.scala b/test/files/run/reflection-fieldsymbol-navigation.scala
index 4448724988..33dc18a7e3 100644
--- a/test/files/run/reflection-fieldsymbol-navigation.scala
+++ b/test/files/run/reflection-fieldsymbol-navigation.scala
@@ -5,7 +5,7 @@ class C {
}
object Test extends App {
- val x = typeOf[C].member(newTermName("x")).asTerm
+ val x = typeOf[C].member(TermName("x")).asTerm
println(x)
println(x.isVar)
println(x.accessed)
diff --git a/test/files/run/reflection-idtc.check b/test/files/run/reflection-idtc.check
new file mode 100644
index 0000000000..9cdeb02f8c
--- /dev/null
+++ b/test/files/run/reflection-idtc.check
@@ -0,0 +1,6 @@
+[X]X
+Int
+===
+[X]Id[X]
+Id[Int]
+Int
diff --git a/test/files/run/reflection-idtc.scala b/test/files/run/reflection-idtc.scala
new file mode 100644
index 0000000000..f9eae612f0
--- /dev/null
+++ b/test/files/run/reflection-idtc.scala
@@ -0,0 +1,16 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val idsym = tb.typecheck(q"type Id[X] = X").symbol.asType
+ val idTC1 = idsym.info
+ println(idTC1)
+ println(appliedType(idTC1, List(typeOf[Int])))
+ println("===")
+ val idTC2 = idsym.toType.etaExpand
+ println(idTC2)
+ println(appliedType(idTC2, List(typeOf[Int])))
+ println(appliedType(idTC2, List(typeOf[Int])).dealias)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala
index b3c0081ccf..4242530dd1 100644
--- a/test/files/run/reflection-implClass.scala
+++ b/test/files/run/reflection-implClass.scala
@@ -10,19 +10,19 @@ object Test extends App with Outer {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
- assert(cm.classSymbol(classTag[Foo].runtimeClass).typeSignature.declaration(newTermName("bar")).typeSignature ==
- cm.classSymbol(classTag[Bar].runtimeClass).typeSignature.declaration(newTermName("foo")).typeSignature)
+ assert(cm.classSymbol(classTag[Foo].runtimeClass).info.decl(TermName("bar")).info ==
+ cm.classSymbol(classTag[Bar].runtimeClass).info.decl(TermName("foo")).info)
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)
+ assert(s1.info != NoType)
+ assert(s1.companion.info != NoType)
+ assert(s1.companion.info.decl(TermName("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)
+ assert(s2.info != NoType)
+ assert(s2.companion.info != NoType)
+ assert(s2.companion.info.decl(TermName("foo")) != NoSymbol)
def implClass(clazz: Class[_]) = {
val implClass = Class.forName(clazz.getName + "$class")
cm.classSymbol(implClass)
diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala
index 0bcb0bc3a0..a6e939322a 100644
--- a/test/files/run/reflection-implicit.scala
+++ b/test/files/run/reflection-implicit.scala
@@ -1,3 +1,5 @@
+
+import scala.language.implicitConversions
import scala.reflect.runtime.universe._
class C {
@@ -7,9 +9,9 @@ class C {
}
object Test extends App {
- val decls = typeOf[C].typeSymbol.typeSignature.declarations.sorted.toList.filter(sym => !sym.isTerm || (sym.isMethod && !sym.asMethod.isConstructor))
+ val decls = typeOf[C].typeSymbol.info.decls.sorted.toList.filter(sym => !sym.isTerm || (sym.isMethod && !sym.asMethod.isConstructor))
println(decls map (_.isImplicit))
- val param = decls.find(_.name.toString == "d").get.asMethod.paramss.last.head
- param.typeSignature
+ val param = decls.find(_.name.toString == "d").get.asMethod.paramLists.last.head
+ param.info
println(param.isImplicit)
-} \ No newline at end of file
+}
diff --git a/test/files/run/reflection-java-annotations.check b/test/files/run/reflection-java-annotations.check
index 2d37fff1f4..72d40989fe 100644
--- a/test/files/run/reflection-java-annotations.check
+++ b/test/files/run/reflection-java-annotations.check
@@ -1 +1,4 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
List(JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee_1], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false))
+=======
+new JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = Array(101, 101), v102 = Array(102, 102), v103 = Array('g', 'g'), v104 = Array(104, 104), v105 = Array(105L, 105L), v106 = Array(106.0, 106.0), v107 = Array(107.0, 107.0), v108 = Array(false, true), v11 = classOf[JavaAnnottee_1], v110 = Array("hello", "world"), v111 = Array(classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]), v112 = Array(FOO, BAR), v113 = Array(new JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)), v12 = FOO, v13 = new JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false)
diff --git a/test/files/run/reflection-java-annotations/Test_2.scala b/test/files/run/reflection-java-annotations/Test_2.scala
index d2c3157071..dec5b45ca7 100644
--- a/test/files/run/reflection-java-annotations/Test_2.scala
+++ b/test/files/run/reflection-java-annotations/Test_2.scala
@@ -1,7 +1,9 @@
object Test extends App {
import scala.reflect.runtime.universe._
val sym = typeOf[JavaAnnottee_1].typeSymbol
- sym.typeSignature
+ sym.info
sym.annotations foreach (_.javaArgs)
println(sym.annotations)
+ println("=======")
+ sym.annotations.map(_.tree).map(println)
} \ No newline at end of file
diff --git a/test/files/run/reflection-java-crtp/Main_2.scala b/test/files/run/reflection-java-crtp/Main_2.scala
index fb5668f323..b9347869e4 100644
--- a/test/files/run/reflection-java-crtp/Main_2.scala
+++ b/test/files/run/reflection-java-crtp/Main_2.scala
@@ -3,6 +3,6 @@ object Test extends App {
val enum = typeOf[JavaSimpleEnumeration_1].baseClasses(1).asClass
// make sure that the E's in Enum<E extends Enum<E>> are represented by the same symbol
val e1 = enum.typeParams(0).asType
- val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature
+ val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.info
println(e1, e2, e1 eq e2)
} \ No newline at end of file
diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check
index 352aefaf25..f580296ae7 100644
--- a/test/files/run/reflection-magicsymbols-invoke.check
+++ b/test/files/run/reflection-magicsymbols-invoke.check
@@ -15,12 +15,12 @@ testing Any.!=: false
testing Any.##: 50
testing Any.==: true
testing Any.asInstanceOf: class scala.ScalaReflectionException: Any.asInstanceOf requires a type argument, it cannot be invoked with mirrors
-testing Any.asInstanceOf: class scala.ScalaReflectionException: scala.Any.asInstanceOf[T0]: T0 takes 0 arguments
+testing Any.asInstanceOf: class scala.ScalaReflectionException: final def asInstanceOf[T0]: T0 takes 0 arguments
testing Any.equals: true
testing Any.getClass: class java.lang.String
testing Any.hashCode: 50
testing Any.isInstanceOf: class scala.ScalaReflectionException: Any.isInstanceOf requires a type argument, it cannot be invoked with mirrors
-testing Any.isInstanceOf: class scala.ScalaReflectionException: scala.Any.isInstanceOf[T0]: Boolean takes 0 arguments
+testing Any.isInstanceOf: class scala.ScalaReflectionException: final def isInstanceOf[T0]: Boolean takes 0 arguments
testing Any.toString: 2
============
AnyVal
@@ -28,7 +28,7 @@ it's important to print the list of AnyVal's members
if some of them change (possibly, adding and/or removing magic symbols), we must update this test
constructor AnyVal: ()AnyVal
method getClass: ()Class[_ <: AnyVal]
-testing AnyVal.<init>: class java.lang.InstantiationException: null
+testing AnyVal.<init>: class scala.ScalaReflectionException: unsupported symbol constructor AnyVal when invoking bytecodeless method mirror for def <init>(): AnyVal (bound to null)
testing AnyVal.getClass: class scala.ScalaReflectionException: expected a member of class Integer, you provided method scala.AnyVal.getClass
============
AnyRef
@@ -36,12 +36,10 @@ it's important to print the list of AnyRef's members
if some of them change (possibly, adding and/or removing magic symbols), we must update this test
constructor Object: ()java.lang.Object
method !=: (x$1: Any)Boolean
-method !=: (x$1: AnyRef)Boolean
method ##: ()Int
method $asInstanceOf: [T0]()T0
method $isInstanceOf: [T0]()Boolean
method ==: (x$1: Any)Boolean
-method ==: (x$1: AnyRef)Boolean
method asInstanceOf: [T0]=> T0
method clone: ()java.lang.Object
method eq: (x$1: AnyRef)Boolean
@@ -61,9 +59,9 @@ method wait: (x$1: Long, x$2: Int)Unit
testing Object.!=: false
testing Object.##: 50
testing Object.$asInstanceOf: class scala.ScalaReflectionException: AnyRef.$asInstanceOf is an internal method, it cannot be invoked with mirrors
-testing Object.$asInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$asInstanceOf[T0](): T0 takes 0 arguments
+testing Object.$asInstanceOf: class scala.ScalaReflectionException: final def $asInstanceOf[T0](): T0 takes 0 arguments
testing Object.$isInstanceOf: class scala.ScalaReflectionException: AnyRef.$isInstanceOf is an internal method, it cannot be invoked with mirrors
-testing Object.$isInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$isInstanceOf[T0](): Boolean takes 0 arguments
+testing Object.$isInstanceOf: class scala.ScalaReflectionException: final def $isInstanceOf[T0](): Boolean takes 0 arguments
testing Object.==: true
testing Object.clone: class java.lang.CloneNotSupportedException: java.lang.String
testing Object.eq: true
@@ -82,14 +80,11 @@ Array
it's important to print the list of Array's members
if some of them change (possibly, adding and/or removing magic symbols), we must update this test
constructor Array: (_length: Int)Array[T]
-constructor Cloneable: ()java.lang.Cloneable
method !=: (x$1: Any)Boolean
-method !=: (x$1: AnyRef)Boolean
method ##: ()Int
method $asInstanceOf: [T0]()T0
method $isInstanceOf: [T0]()Boolean
method ==: (x$1: Any)Boolean
-method ==: (x$1: AnyRef)Boolean
method apply: (i: Int)T
method asInstanceOf: [T0]=> T0
method clone: ()Array[T]
@@ -120,5 +115,5 @@ testing String.+: 23
============
CTM
testing Predef.classOf: class scala.ScalaReflectionException: Predef.classOf is a compile-time function, it cannot be invoked with mirrors
-testing Predef.classOf: class scala.ScalaReflectionException: scala.Predef.classOf[T]: Class[T] takes 0 arguments
+testing Predef.classOf: class scala.ScalaReflectionException: def classOf[T]: Class[T] takes 0 arguments
testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.api.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors
diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala
index 5f39370708..793f78bff4 100644
--- a/test/files/run/reflection-magicsymbols-invoke.scala
+++ b/test/files/run/reflection-magicsymbols-invoke.scala
@@ -9,7 +9,7 @@ package scala {
}
object Test extends App {
- def key(sym: Symbol) = sym + ": " + sym.typeSignature
+ def key(sym: Symbol) = sym + ": " + sym.info
def test(tpe: Type, receiver: Any, method: String, args: Any*) {
def wrap[T](op: => T) =
try {
@@ -24,11 +24,11 @@ object Test extends App {
}
print(s"testing ${tpe.typeSymbol.name}.$method: ")
wrap({
- if (method == nme.CONSTRUCTOR.toString) {
- val ctor = tpe.declaration(nme.CONSTRUCTOR).asMethod
+ if (method == termNames.CONSTRUCTOR.toString) {
+ val ctor = tpe.decl(termNames.CONSTRUCTOR).asMethod
cm.reflectClass(ctor.owner.asClass).reflectConstructor(ctor)(args: _*)
} else {
- val meth = tpe.declaration(newTermName(method).encodedName.toTermName).asMethod
+ val meth = tpe.decl(TermName(method).encodedName.toTermName).asMethod
cm.reflect(receiver).reflectMethod(meth)(args: _*)
}
})
@@ -53,8 +53,8 @@ object Test extends App {
println("============\nAnyVal")
println("it's important to print the list of AnyVal's members")
println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test")
- typeOf[AnyVal].declarations.toList.sortBy(key).foreach(sym => println(key(sym)))
- test(typeOf[AnyVal], null, "<init>")
+ typeOf[AnyVal].decls.toList.sortBy(key).foreach(sym => println(key(sym)))
+ test(typeOf[AnyVal], null, termNames.CONSTRUCTOR.toString)
test(typeOf[AnyVal], 2, "getClass")
println("============\nAnyRef")
@@ -84,17 +84,17 @@ object Test extends App {
println("============\nArray")
println("it's important to print the list of Array's members")
println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test")
- ArrayClass.typeSignature.members.toList.sortBy(key).foreach(sym => println(key(sym)))
- test(ArrayClass.typeSignature, Array(1, 2), "length")
- test(ArrayClass.typeSignature, Array(1, 2), "apply", 0)
- test(ArrayClass.typeSignature, Array(1, 2), "update", 0, 0)
- test(ArrayClass.typeSignature, Array(1, 2), "clone")
+ ArrayClass.info.members.toList.sortBy(key).foreach(sym => println(key(sym)))
+ test(ArrayClass.info, Array(1, 2), "length")
+ test(ArrayClass.info, Array(1, 2), "apply", 0)
+ test(ArrayClass.info, Array(1, 2), "update", 0, 0)
+ test(ArrayClass.info, Array(1, 2), "clone")
println("============\nOther")
test(typeOf[String], "2", "+", 3)
println("============\nCTM")
- test(PredefModule.moduleClass.typeSignature, Predef, "classOf")
- test(PredefModule.moduleClass.typeSignature, Predef, "classOf", typeOf[String])
+ test(PredefModule.moduleClass.info, Predef, "classOf")
+ test(PredefModule.moduleClass.info, Predef, "classOf", typeOf[String])
test(typeOf[scala.reflect.api.Universe], scala.reflect.runtime.universe, "reify", "2")
} \ No newline at end of file
diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check
index 2535e3f43d..a1bee76652 100644
--- a/test/files/run/reflection-magicsymbols-repl.check
+++ b/test/files/run/reflection-magicsymbols-repl.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
@@ -19,9 +17,9 @@ scala> class A {
defined class A
scala> def test(n: Int): Unit = {
- val sig = typeOf[A] member newTermName("foo" + n) typeSignature
+ val sig = typeOf[A] member TermName("foo" + n) info
val x = sig.asInstanceOf[MethodType].params.head
- println(x.typeSignature)
+ println(x.info)
}
warning: there were 1 feature warning(s); re-run with -feature for details
test: (n: Int)Unit
diff --git a/test/files/run/reflection-magicsymbols-repl.scala b/test/files/run/reflection-magicsymbols-repl.scala
index 26127b8661..c006e85b3a 100644
--- a/test/files/run/reflection-magicsymbols-repl.scala
+++ b/test/files/run/reflection-magicsymbols-repl.scala
@@ -14,9 +14,9 @@ object Test extends ReplTest {
| def foo8(x: Singleton) = ???
|}
|def test(n: Int): Unit = {
- | val sig = typeOf[A] member newTermName("foo" + n) typeSignature
+ | val sig = typeOf[A] member TermName("foo" + n) info
| val x = sig.asInstanceOf[MethodType].params.head
- | println(x.typeSignature)
+ | println(x.info)
|}
|for (i <- 1 to 8) test(i)
|""".stripMargin
diff --git a/test/files/run/reflection-magicsymbols-vanilla.scala b/test/files/run/reflection-magicsymbols-vanilla.scala
index 32819dcc46..328caf945d 100644
--- a/test/files/run/reflection-magicsymbols-vanilla.scala
+++ b/test/files/run/reflection-magicsymbols-vanilla.scala
@@ -1,3 +1,5 @@
+import scala.language.postfixOps
+
class A {
def foo1(x: Int*) = ???
def foo2(x: => Int) = ???
@@ -12,9 +14,9 @@ class A {
object Test extends App {
import scala.reflect.runtime.universe._
def test(n: Int): Unit = {
- val sig = typeOf[A] member newTermName("foo" + n) typeSignature
+ val sig = typeOf[A] member TermName("foo" + n) info
val x = sig.asInstanceOf[MethodType].params.head
- println(x.typeSignature)
+ println(x.info)
}
for (i <- 1 to 8) test(i)
}
diff --git a/test/files/run/reflection-mem-typecheck.scala b/test/files/run/reflection-mem-typecheck.scala
index a312c2c893..e3cabf689d 100644
--- a/test/files/run/reflection-mem-typecheck.scala
+++ b/test/files/run/reflection-mem-typecheck.scala
@@ -21,6 +21,6 @@ object Test extends MemoryTest {
foo(List(new A {}, new B {}))
""".trim
snippet = snippet + "\n" + (List.fill(50)(snippet.split("\n").last) mkString "\n")
- tb.typeCheck(tb.parse(snippet))
+ tb.typecheck(tb.parse(snippet))
}
} \ No newline at end of file
diff --git a/test/files/run/reflection-methodsymbol-params.scala b/test/files/run/reflection-methodsymbol-params.scala
index 45b1f9628f..bc1289a625 100644
--- a/test/files/run/reflection-methodsymbol-params.scala
+++ b/test/files/run/reflection-methodsymbol-params.scala
@@ -13,12 +13,12 @@ class C {
}
object Test extends App {
- println(typeOf[C].member(newTermName("x1")).asMethod.paramss)
- println(typeOf[C].member(newTermName("x2")).asMethod.paramss)
- println(typeOf[C].member(newTermName("x3")).asMethod.paramss)
- println(typeOf[C].member(newTermName("x4")).asMethod.paramss)
- println(typeOf[C].member(newTermName("y1")).asMethod.paramss)
- println(typeOf[C].member(newTermName("y2")).asMethod.paramss)
- println(typeOf[C].member(newTermName("y3")).asMethod.paramss)
- println(typeOf[C].member(newTermName("y4")).asMethod.paramss)
+ println(typeOf[C].member(TermName("x1")).asMethod.paramLists)
+ println(typeOf[C].member(TermName("x2")).asMethod.paramLists)
+ println(typeOf[C].member(TermName("x3")).asMethod.paramLists)
+ println(typeOf[C].member(TermName("x4")).asMethod.paramLists)
+ println(typeOf[C].member(TermName("y1")).asMethod.paramLists)
+ println(typeOf[C].member(TermName("y2")).asMethod.paramLists)
+ println(typeOf[C].member(TermName("y3")).asMethod.paramLists)
+ println(typeOf[C].member(TermName("y4")).asMethod.paramLists)
} \ No newline at end of file
diff --git a/test/files/run/reflection-methodsymbol-returntype.scala b/test/files/run/reflection-methodsymbol-returntype.scala
index 392754dbe4..74a9e5dac0 100644
--- a/test/files/run/reflection-methodsymbol-returntype.scala
+++ b/test/files/run/reflection-methodsymbol-returntype.scala
@@ -13,12 +13,12 @@ class C {
}
object Test extends App {
- println(typeOf[C].member(newTermName("x1")).asMethod.returnType)
- println(typeOf[C].member(newTermName("x2")).asMethod.returnType)
- println(typeOf[C].member(newTermName("x3")).asMethod.returnType)
- println(typeOf[C].member(newTermName("x4")).asMethod.returnType)
- println(typeOf[C].member(newTermName("y1")).asMethod.returnType)
- println(typeOf[C].member(newTermName("y2")).asMethod.returnType)
- println(typeOf[C].member(newTermName("y3")).asMethod.returnType)
- println(typeOf[C].member(newTermName("y4")).asMethod.returnType)
+ println(typeOf[C].member(TermName("x1")).asMethod.returnType)
+ println(typeOf[C].member(TermName("x2")).asMethod.returnType)
+ println(typeOf[C].member(TermName("x3")).asMethod.returnType)
+ println(typeOf[C].member(TermName("x4")).asMethod.returnType)
+ println(typeOf[C].member(TermName("y1")).asMethod.returnType)
+ println(typeOf[C].member(TermName("y2")).asMethod.returnType)
+ println(typeOf[C].member(TermName("y3")).asMethod.returnType)
+ println(typeOf[C].member(TermName("y4")).asMethod.returnType)
} \ No newline at end of file
diff --git a/test/files/run/reflection-methodsymbol-typeparams.scala b/test/files/run/reflection-methodsymbol-typeparams.scala
index bb0a3c3aec..56d37ebeaa 100644
--- a/test/files/run/reflection-methodsymbol-typeparams.scala
+++ b/test/files/run/reflection-methodsymbol-typeparams.scala
@@ -13,12 +13,12 @@ class C {
}
object Test extends App {
- println(typeOf[C].member(newTermName("x1")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("x2")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("x3")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("x4")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("y1")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("y2")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("y3")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("y4")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("x1")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("x2")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("x3")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("x4")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("y1")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("y2")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("y3")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("y4")).asMethod.typeParams)
} \ No newline at end of file
diff --git a/test/files/run/reflection-names.scala b/test/files/run/reflection-names.scala
index 2433c84813..a297b85825 100644
--- a/test/files/run/reflection-names.scala
+++ b/test/files/run/reflection-names.scala
@@ -4,10 +4,10 @@ object Test {
val global = new Global(new Settings())
import global._
- val x1 = "abc" drop 1 // "bc": String
- val x2 = ("abc": TermName) drop 1 // "bc": TermName
- val x3 = ("abc": TypeName) drop 1 // "bc": TypeName
- val x4 = (("abc": TypeName): Name) drop 1 // "bc": Name
+ val x1 = "abc" drop 1 // "bc": String
+ val x2 = TermName("abc") drop 1 // "bc": TermName
+ val x3 = TypeName("abc") drop 1 // "bc": TypeName
+ val x4 = (TypeName("abc"): Name) drop 1 // "bc": Name
def main(args: Array[String]): Unit = {
List(x1, x2, x3, x4) foreach (x => println(x.getClass.getName, x))
diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check
index 2dd96a93bf..03a6aef2b5 100644
--- a/test/files/run/reflection-repl-classes.check
+++ b/test/files/run/reflection-repl-classes.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> class A
defined class A
@@ -19,10 +17,10 @@ scala> object defs {
val cm = reflect.runtime.currentMirror
val u = cm.universe
val im = cm.reflect(new B)
- val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod
+ val method = im.symbol.info.member(u.TermName("foo")).asMethod
val mm = im.reflectMethod(method)
}
-defined module defs
+defined object defs
scala> import defs._
import defs._
diff --git a/test/files/run/reflection-repl-classes.scala b/test/files/run/reflection-repl-classes.scala
index 80e332cde3..048e6b8ce0 100644
--- a/test/files/run/reflection-repl-classes.scala
+++ b/test/files/run/reflection-repl-classes.scala
@@ -12,7 +12,7 @@ object Test extends ReplTest {
| val cm = reflect.runtime.currentMirror
| val u = cm.universe
| val im = cm.reflect(new B)
- | val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod
+ | val method = im.symbol.info.member(u.TermName("foo")).asMethod
| val mm = im.reflectMethod(method)
|}
|import defs._
diff --git a/test/files/run/reflection-repl-elementary.check b/test/files/run/reflection-repl-elementary.check
index d9133f7e3e..4a223e8a24 100644
--- a/test/files/run/reflection-repl-elementary.check
+++ b/test/files/run/reflection-repl-elementary.check
@@ -1,8 +1,6 @@
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 = scala.List[Nothing]
diff --git a/test/files/run/reflection-sanitychecks.scala b/test/files/run/reflection-sanitychecks.scala
index f817f23731..3f4873bbee 100644
--- a/test/files/run/reflection-sanitychecks.scala
+++ b/test/files/run/reflection-sanitychecks.scala
@@ -32,14 +32,14 @@ object Test extends App {
def test(tpe: Type): Unit = {
def failsafe(action: => Any): Any = try action catch { case ex: Throwable => ex.toString }
println(s"=========members of ${tpe.typeSymbol.name} in a mirror of D=========")
- println("field #1: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTerm).get))
- println("method #1: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethod)()))
- println("field #2: " + failsafe(im.reflectField(tpe.member(newTermName("quux")).asTerm).get))
- println("method #2: " + failsafe(im.reflectMethod(tpe.member(newTermName("baz")).asMethod)()))
- println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("bar")).asMethod)()))
- println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("<init>")).asMethod)()))
- println("class: " + failsafe(im.reflectClass(tpe.member(newTypeName("C")).asClass).reflectConstructor(typeOf[C].member(newTypeName("C")).asClass.typeSignature.member(newTermName("<init>")).asMethod)()))
- println("object: " + failsafe(im.reflectModule(tpe.member(newTermName("O")).asModule).instance))
+ println("field #1: " + failsafe(im.reflectField(tpe.member(TermName("foo")).asTerm).get))
+ println("method #1: " + failsafe(im.reflectMethod(tpe.member(TermName("bar")).asMethod)()))
+ println("field #2: " + failsafe(im.reflectField(tpe.member(TermName("quux")).asTerm).get))
+ println("method #2: " + failsafe(im.reflectMethod(tpe.member(TermName("baz")).asMethod)()))
+ println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(TermName("bar")).asMethod)()))
+ println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(TermName("<init>")).asMethod)()))
+ println("class: " + failsafe(im.reflectClass(tpe.member(TypeName("C")).asClass).reflectConstructor(typeOf[C].member(TypeName("C")).asClass.info.member(termNames.CONSTRUCTOR).asMethod)()))
+ println("object: " + failsafe(im.reflectModule(tpe.member(TermName("O")).asModule).instance))
println()
}
diff --git a/test/files/run/reflection-scala-annotations.check b/test/files/run/reflection-scala-annotations.check
new file mode 100644
index 0000000000..5bc2786161
--- /dev/null
+++ b/test/files/run/reflection-scala-annotations.check
@@ -0,0 +1,7 @@
+reflection-scala-annotations.scala:5: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class jann(x: Int, y: Array[Int]) extends ClassfileAnnotation
+ ^
+new sann(1, immutable.this.List.apply[Int](1, 2))
+new jann(y = Array(1, 2), x = 2)
diff --git a/test/files/run/reflection-scala-annotations.scala b/test/files/run/reflection-scala-annotations.scala
new file mode 100644
index 0000000000..f6a6895ee0
--- /dev/null
+++ b/test/files/run/reflection-scala-annotations.scala
@@ -0,0 +1,16 @@
+import scala.reflect.runtime.universe._
+import scala.annotation._
+
+class sann(x: Int, y: List[Int]) extends StaticAnnotation
+class jann(x: Int, y: Array[Int]) extends ClassfileAnnotation
+
+@sann(1, List(1, 2))
+class S
+
+@jann(y = Array(1, 2), x = 2)
+class J
+
+object Test extends App {
+ println(symbolOf[S].annotations.head.tree)
+ println(symbolOf[J].annotations.head.tree)
+}
diff --git a/test/files/run/reflection-sorted-decls.scala b/test/files/run/reflection-sorted-decls.scala
index 5616e10b3b..8dcb0f3ec6 100644
--- a/test/files/run/reflection-sorted-decls.scala
+++ b/test/files/run/reflection-sorted-decls.scala
@@ -2,7 +2,7 @@ object Test {
def main(args: Array[String]) {
class Foo(val a: Int, val b: Int, val c: Int)
import scala.reflect.runtime.{currentMirror => cm}
- val decls = cm.classSymbol(classOf[Foo]).typeSignature.declarations
+ val decls = cm.classSymbol(classOf[Foo]).info.decls
decls.sorted.toList.filter(!_.isMethod) foreach System.out.println
}
}
diff --git a/test/files/run/reflection-sorted-members.check b/test/files/run/reflection-sorted-members.check
index c148e19e69..415e073149 100644
--- a/test/files/run/reflection-sorted-members.check
+++ b/test/files/run/reflection-sorted-members.check
@@ -1,4 +1,3 @@
value a
value b
value c
-value x
diff --git a/test/files/run/reflection-sorted-members.scala b/test/files/run/reflection-sorted-members.scala
index a8379234c0..fa028c99c6 100644
--- a/test/files/run/reflection-sorted-members.scala
+++ b/test/files/run/reflection-sorted-members.scala
@@ -5,7 +5,7 @@ object Test {
class Bar(val x: Int)
class Foo(val a: Int, val b: Int, val c: Int) extends Bar(a + b + c) with T1 with T2
import scala.reflect.runtime.{currentMirror => cm}
- val members = cm.classSymbol(classOf[Foo]).typeSignature.members
+ val members = cm.classSymbol(classOf[Foo]).info.members
members.sorted.toList.filter(!_.isMethod) foreach System.out.println
}
}
diff --git a/test/files/run/reflection-sync-potpourri.scala b/test/files/run/reflection-sync-potpourri.scala
new file mode 100644
index 0000000000..f65131f18a
--- /dev/null
+++ b/test/files/run/reflection-sync-potpourri.scala
@@ -0,0 +1,32 @@
+import scala.reflect.runtime.universe._
+
+// this test checks that under heavily multithreaded conditions:
+// 1) scala.reflect.runtime.universe, its rootMirror and definitions are initialized correctly
+// 2) symbols are correctly materialized into PackageScopes (no dupes)
+// 3) unpickling works okay even we unpickle the same symbol a lot of times
+
+object Test extends App {
+ def foo[T: TypeTag](x: T) = typeOf[T].toString
+ val n = 1000
+ val rng = new scala.util.Random()
+ val types = List(
+ () => typeOf[java.lang.reflect.Method],
+ () => typeOf[java.lang.annotation.Annotation],
+ () => typeOf[scala.io.BufferedSource],
+ () => typeOf[scala.io.Codec])
+ val perms = types.permutations.toList
+ def force(lazytpe: () => Type): String = {
+ lazytpe().typeSymbol.info
+ lazytpe().toString
+ }
+ val diceRolls = List.fill(n)(rng.nextInt(perms.length))
+ val threads = (1 to n) map (i => new Thread(s"Reflector-$i") {
+ override def run(): Unit = {
+ val s1 = foo("42")
+ val s2 = perms(diceRolls(i - 1)).map(x => force(x)).sorted.mkString(", ")
+ assert(s1 == "String" || s1 == "java.lang.String")
+ assert(s2 == "java.lang.annotation.Annotation, java.lang.reflect.Method, scala.io.BufferedSource, scala.io.Codec")
+ }
+ })
+ threads foreach (_.start)
+} \ No newline at end of file
diff --git a/test/files/run/dead-code-elimination.check b/test/files/run/reflection-sync-subtypes.check
index e69de29bb2..e69de29bb2 100644
--- a/test/files/run/dead-code-elimination.check
+++ b/test/files/run/reflection-sync-subtypes.check
diff --git a/test/files/run/reflection-sync-subtypes.scala b/test/files/run/reflection-sync-subtypes.scala
new file mode 100644
index 0000000000..7f75a464ac
--- /dev/null
+++ b/test/files/run/reflection-sync-subtypes.scala
@@ -0,0 +1,20 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ val n = 1000
+ val rng = new scala.util.Random()
+ val tasks = List(
+ () => typeOf[List[Int]] <:< typeOf[List[T] forSome { type T }],
+ () => typeOf[List[T] forSome { type T }] <:< typeOf[List[Any]],
+ () => typeOf[Map[Int, Object]] <:< typeOf[Iterable[(Int, String)]],
+ () => typeOf[Expr[Any] { val mirror: rootMirror.type }] <:< typeOf[Expr[List[List[List[Int]]]]{ val mirror: rootMirror.type }])
+ val perms = tasks.permutations.toList
+ val diceRolls = List.fill(n)(rng.nextInt(perms.length))
+ val threads = (1 to n) map (i => new Thread(s"Reflector-$i") {
+ override def run(): Unit = {
+ val result = perms(diceRolls(i - 1)).map(_())
+ assert(result.sorted == List(false, false, true, true))
+ }
+ })
+ threads foreach (_.start)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-tags.check b/test/files/run/reflection-tags.check
new file mode 100644
index 0000000000..375518e921
--- /dev/null
+++ b/test/files/run/reflection-tags.check
@@ -0,0 +1 @@
+List()
diff --git a/test/files/run/reflection-tags.scala b/test/files/run/reflection-tags.scala
new file mode 100644
index 0000000000..3d7c7b2a0a
--- /dev/null
+++ b/test/files/run/reflection-tags.scala
@@ -0,0 +1,21 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+object Test extends App {
+ var typeMembers = typeOf[scala.reflect.api.Universe].members.filter(sym => sym.isType && !sym.isClass).toList
+ typeMembers = typeMembers.filter(_.name != TypeName("ModifiersCreator")) // type ModifiersCreator = ModifiersExtractor
+ typeMembers = typeMembers.filter(_.name != TypeName("Importer")) // deprecated
+ typeMembers = typeMembers.filter(_.name != TypeName("Internal")) // internal
+ typeMembers = typeMembers.filter(_.name != TypeName("Compat")) // internal
+ typeMembers = typeMembers.filter(_.name != TypeName("BuildApi")) // deprecated
+ val tags = typeOf[scala.reflect.api.Universe].members.filter(sym => sym.isImplicit).toList
+
+ typeMembers.foreach(_.info)
+ tags.foreach(_.info)
+
+ val outliers = typeMembers.filter(tm => !tags.exists(tag => tag.info match {
+ case NullaryMethodType(TypeRef(_, sym, targ :: Nil)) => sym == typeOf[ClassTag[_]].typeSymbol && targ.typeSymbol == tm
+ case _ => false
+ }))
+ println(outliers)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-valueclasses-derived.scala b/test/files/run/reflection-valueclasses-derived.scala
index 6b08f987ba..8d25e2929c 100644
--- a/test/files/run/reflection-valueclasses-derived.scala
+++ b/test/files/run/reflection-valueclasses-derived.scala
@@ -6,7 +6,7 @@ class C(val x: Int) extends AnyVal {
}
object Test extends App {
- println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)(2))
- println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("getClass")).asMethod)())
- println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("toString")).asMethod)())
+ println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("foo")).asMethod)(2))
+ println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("getClass")).asMethod)())
+ println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("toString")).asMethod)())
} \ No newline at end of file
diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala
index c4a26e460a..366b5fe270 100644
--- a/test/files/run/reflection-valueclasses-magic.scala
+++ b/test/files/run/reflection-valueclasses-magic.scala
@@ -13,9 +13,9 @@ object Test extends App {
def key(sym: Symbol) = {
sym match {
// initialize parameter symbols
- case meth: MethodSymbol => meth.paramss.flatten.map(_.typeSignature)
+ case meth: MethodSymbol => meth.paramLists.flatten.map(_.info)
}
- sym + ": " + sym.typeSignature
+ sym + ": " + sym.info
}
def convert(value: Any, tpe: Type) = {
@@ -44,11 +44,11 @@ object Test extends App {
val realex = scala.ExceptionUtils.unwrapThrowable(ex)
println(realex.getClass + ": " + realex.getMessage)
}
- val meth = tpe.declaration(newTermName(method).encodedName.toTermName)
+ val meth = tpe.decl(TermName(method).encodedName.toTermName)
val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod)
testees foreach (testee => {
- val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.paramss.flatten.apply(i).typeSignature) }
- print(s"testing ${tpe.typeSymbol.name}.$method(${testee.paramss.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ")
+ val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.paramLists.flatten.apply(i).info) }
+ print(s"testing ${tpe.typeSymbol.name}.$method(${testee.paramLists.flatten.map(_.info).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ")
wrap(cm.reflect(receiver).reflectMethod(testee)(convertedArgs: _*))
})
}
diff --git a/test/files/run/reflection-valueclasses-standard.scala b/test/files/run/reflection-valueclasses-standard.scala
index 18a3d1fa04..b6b5a2ede2 100644
--- a/test/files/run/reflection-valueclasses-standard.scala
+++ b/test/files/run/reflection-valueclasses-standard.scala
@@ -5,8 +5,8 @@ import scala.reflect.{ClassTag, classTag}
object Test extends App {
def test[T: ClassTag: TypeTag](x: T) = {
println(s"========${classTag[T].runtimeClass}========")
- println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("getClass")).asMethod)())
- println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("toString")).asMethod)())
+ println(cm.reflect(x).reflectMethod(typeOf[T].member(TermName("getClass")).asMethod)())
+ println(cm.reflect(x).reflectMethod(typeOf[T].member(TermName("toString")).asMethod)())
}
test(2.toByte)
diff --git a/test/files/run/reify-aliases.check b/test/files/run/reify-aliases.check
index aa846b9bc6..da784227af 100644
--- a/test/files/run/reify-aliases.check
+++ b/test/files/run/reify-aliases.check
@@ -1 +1 @@
-TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())
+TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())
diff --git a/test/files/run/reify-each-node-type.check b/test/files/run/reify-each-node-type.check
new file mode 100644
index 0000000000..afc65add7a
--- /dev/null
+++ b/test/files/run/reify-each-node-type.check
@@ -0,0 +1,35 @@
+ 1 s Ident
+ 2 r.List Select
+ 3 r.List.apply() Apply
+ 4 r.List.apply(1) Literal
+ 5 r.List.apply[Int]() TypeApply
+ 6 (1: Int) Typed
+ 7 (null: r.List[Int]) AppliedTypeTree
+ 8 { (); () } Block
+ 9 { val x: Int = 0; () } ValDef
+10 { val x = 0; () } TypeTree
+11 if (true) () else () If
+12 { def f: Unit = (); () } DefDef
+13 { def m = NN.super.q; () } Super
+14 { abstract trait A extends AnyRef; () } ClassDef Template
+15 { def f(x: Any): Unit = (); () } EmptyTree
+16 (null: r.D with r.E) CompoundTypeTree
+17 { type T = Int; () } TypeDef
+18 { type CC[T <: r.D] = r.C[T]; () } TypeBoundsTree
+19 try { 0 } finally Predef.println("") Try
+20 ((x: Int) => x) Function
+21 { var v = 1; v = 2 } Assign
+22 { class A extends AnyRef { def <init>() = { super.<init>(); This
+23 new r.List[Int]() New
+24 0: @unchecked Annotated
+25 (null: r.Outer#Inner) SelectFromTypeTree
+26 (null: Nil.type) SingletonTypeTree
+27 (null: T forSome { type T }) ExistentialTypeTree
+28 { import r.{A, B=>C}; () } Import
+29 { def f: Int = return 0; () } Return
+30 { object x extends AnyRef { def <init>() = { super.<init>(); ModuleDef
+31 throw new Exception() Throw
+32 0 match { case _ => 0 } Match CaseDef
+33 0 match { case (1| 2) => 0 } Alternative
+34 NN.q match { case (x @ r.List) => 0 } Bind
+35 NN.q match { case r.UnSeq(1, (_)*) => 0 } Star
diff --git a/test/files/run/reify-each-node-type.scala b/test/files/run/reify-each-node-type.scala
new file mode 100644
index 0000000000..425061f955
--- /dev/null
+++ b/test/files/run/reify-each-node-type.scala
@@ -0,0 +1,110 @@
+
+import scala.language.{ existentials, postfixOps }
+import scala.reflect.runtime.universe._
+
+object r {
+ class A
+ class B
+ class List[+A]
+ object List { def apply[A](xs: A*): List[A] = new List[A] }
+ object Nil extends List[Nothing]
+
+ trait OuterP[A] {
+ trait Inner
+ trait InnerP[B]
+ }
+ trait Outer {
+ trait Inner
+ trait InnerP[B]
+ }
+ object Un { def unapply(x: Any) = Some(5) }
+ object UnSeq { def unapplySeq(x: Any) = Some(Seq(5)) }
+ class C[T]
+ class D
+ trait E
+
+ trait SN {
+ def q: Any = null
+ }
+}
+
+object s {
+ import r._
+
+ trait NN extends SN {
+ def act[T](expr: Expr[T]): Unit
+
+ act(reify { s /* Ident */ })
+ act(reify { r.List /* Select */ })
+ act(reify { List() /* Apply */ })
+ act(reify { List(1) /* Literal */ })
+ act(reify { List[Int]() /* TypeApply */ })
+ act(reify { 1: Int /* Typed */ })
+ act(reify { null: List[Int] /* AppliedTypeTree */ })
+ act(reify { () ; () /* Block */ })
+ act(reify { val x: Int = 0 /* ValDef */ })
+ act(reify { val x = 0 /* TypeTree */ })
+ act(reify { if (true) () /* If */ })
+ act(reify { def f { } /* DefDef */ })
+ act(reify { def m = super.q /* Super */ })
+ act(reify { trait A /* ClassDef Template */ })
+ act(reify { def f(x: Any) { } /* EmptyTree */ })
+ act(reify { null: D with E /* CompoundTypeTree */ })
+ act(reify { type T = Int /* TypeDef */ })
+ act(reify { type CC[T <: D] = C[T] /* TypeBoundsTree */ })
+ act(reify { try 0 finally println("") /* Try */ })
+ act(reify { (x: Int) => x /* Function */ })
+ act(reify { var v = 1 ; v = 2 /* Assign */ })
+ act(reify { class A() { def this(x: A) = this() } /* This */ })
+ act(reify { new List[Int] /* New */ })
+ act(reify { 0: @unchecked /* Annotated */ })
+ act(reify { null: Outer#Inner /* SelectFromTypeTree */ })
+ act(reify { null: Nil.type /* SingletonTypeTree */ })
+ act(reify { null: (T forSome { type T }) /* ExistentialTypeTree */ })
+ act(reify { import r.{ A, B => C }; /* Import */ })
+ act(reify { def f: Int = return 0 /* Return */ })
+ act(reify { object x /* ModuleDef */ })
+ act(reify { throw new java.lang.Exception /* Throw */ })
+ act(reify { 0 match { case _ => 0 } /* Match CaseDef */ })
+ act(reify { 0 match { case 1 | 2 => 0 } /* Alternative */ })
+ act(reify { q match { case x @ List => 0 } /* Bind */ })
+ act(reify { q match { case UnSeq(1, _*) => 0 } /* Star */ })
+
+ // ``unexpected: bound type that doesn't have a tpe: Ident(newTypeName("Int"))''
+ // act(reify { r.List[T forSome { type T <: Int }]() }) // Was crashing , no longer
+ //
+ // error: exception during macro expansion:
+ // scala.MatchError: collection.this.Seq.unapplySeq[A] (of class scala.reflect.internal.Trees$TypeApply)
+ // at scala.reflect.reify.phases.Reshape$$anon$1.extractExtractor$1(Reshape.scala:73)
+ // at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:82)
+ // at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:24)
+ // at scala.reflect.internal.Trees$class.itransform(Trees.scala:1290)
+ //
+ // act(reify { r.List[Any]() match { case Seq(1, _*) => 1 } } )
+
+ // act(reify { List[OuterP[Int]#InnerP[Byte]]() })
+ //
+ // SI-7243
+ //
+ // test/files/run/reify-each-node-type.scala:85: error: Cannot materialize r.List.apply[r.OuterP[Int]#InnerP[Byte]]() as { ... } because:
+ // scala.reflect.macros.TypecheckException: value TypeTreeWithDeferredRefCheck is not a member of type parameter U
+ // act(reify { List[OuterP[Int]#InnerP[Byte]]() })
+ // ^
+ // one error found
+ }
+}
+
+object Test {
+ var idx = 0
+ val seen = scala.collection.mutable.Set[String]()
+
+ object N extends s.NN {
+ def act[T](expr: Expr[T]): Unit = {
+ idx += 1
+ val ts = expr.tree filter (_ => true) map (_.getClass.getName split "[.$]" last) filterNot seen distinct;
+ println("%2d %60s %s".format(idx, expr.tree.toString.replaceAll("""\s+""", " ").take(60), ts mkString " "))
+ seen ++= ts
+ }
+ }
+ def main(args: Array[String]): Unit = N
+}
diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check
index 1b0f3f2162..29ccee3cc6 100644
--- a/test/files/run/reify-repl-fail-gracefully.check
+++ b/test/files/run/reify-repl-fail-gracefully.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> import language.experimental.macros
import language.experimental.macros
@@ -12,10 +10,8 @@ import scala.reflect.runtime.universe._
scala>
scala> reify
-<console>:12: error: macros cannot be partially applied
+<console>:12: error: too few argument lists for macro invocation
reify
^
scala>
-
-scala>
diff --git a/test/files/run/reify_ann1a.check b/test/files/run/reify_ann1a.check
index 99a966f38b..71841ff83b 100644
--- a/test/files/run/reify_ann1a.check
+++ b/test/files/run/reify_ann1a.check
@@ -1,5 +1,5 @@
{
- @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T >: Nothing <: Any] extends AnyRef {
+ @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T] extends AnyRef {
@new ann(List.apply("3a")) @new ann(List.apply("3b")) <paramaccessor> private[this] val x: T @ann(List.apply("4a")) @ann(List.apply("4b")) = _;
def <init>(@new ann(List.apply("3a")) @new ann(List.apply("3b")) x: T @ann(List.apply("4a")) @ann(List.apply("4b"))) = {
super.<init>();
diff --git a/test/files/run/reify_ann1a.scala b/test/files/run/reify_ann1a.scala
index c23048e463..e3ff9e532d 100644
--- a/test/files/run/reify_ann1a.scala
+++ b/test/files/run/reify_ann1a.scala
@@ -20,7 +20,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/reify_ann1b.check b/test/files/run/reify_ann1b.check
index 6a5f32a492..a046dafeab 100644
--- a/test/files/run/reify_ann1b.check
+++ b/test/files/run/reify_ann1b.check
@@ -1,5 +1,10 @@
+reify_ann1b.scala:6: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class ann(bar: String) extends annotation.ClassfileAnnotation
+ ^
{
- @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T >: Nothing <: Any] extends AnyRef {
+ @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T] extends AnyRef {
@new ann(bar = "3a") @new ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _;
def <init>(@new ann(bar = "3a") @new ann(bar = "3b") x: T @ann(bar = "4a") @ann(bar = "4b")) = {
super.<init>();
diff --git a/test/files/run/reify_ann1b.scala b/test/files/run/reify_ann1b.scala
index 29ce6021a2..30bafadf75 100644
--- a/test/files/run/reify_ann1b.scala
+++ b/test/files/run/reify_ann1b.scala
@@ -20,7 +20,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/reify_ann2a.check b/test/files/run/reify_ann2a.check
index ccbcb4c31e..a26fa42045 100644
--- a/test/files/run/reify_ann2a.check
+++ b/test/files/run/reify_ann2a.check
@@ -6,7 +6,7 @@
()
}
};
- @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T >: Nothing <: Any] extends AnyRef {
+ @new ann(List.apply("1a")) @new ann(List.apply("1b")) class C[@new ann(List.apply("2a")) @new ann(List.apply("2b")) T] extends AnyRef {
@new ann(List.apply("3a")) @new ann(List.apply("3b")) <paramaccessor> private[this] val x: T @ann(List.apply("4a")) @ann(List.apply("4b")) = _;
def <init>(@new ann(List.apply("3a")) @new ann(List.apply("3b")) x: T @ann(List.apply("4a")) @ann(List.apply("4b"))) = {
super.<init>();
diff --git a/test/files/run/reify_ann2a.scala b/test/files/run/reify_ann2a.scala
index 53423e12c3..515fba015f 100644
--- a/test/files/run/reify_ann2a.scala
+++ b/test/files/run/reify_ann2a.scala
@@ -20,7 +20,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/reify_ann3.check b/test/files/run/reify_ann3.check
index 8caceb2696..4f1c61cf0e 100644
--- a/test/files/run/reify_ann3.check
+++ b/test/files/run/reify_ann3.check
@@ -1,5 +1,5 @@
{
- class Tree[A >: Nothing <: Any, B >: Nothing <: Any] extends AnyRef {
+ class Tree[A, +B] extends AnyRef {
@new inline @getter() final <paramaccessor> val key: A = _;
def <init>(key: A) = {
super.<init>();
@@ -9,7 +9,7 @@
()
}
{
- class Tree[A, B] extends AnyRef {
+ class Tree[A, +B] extends AnyRef {
final <paramaccessor> private[this] val key: A = _;
@inline @scala.annotation.meta.getter final <stable> <accessor> <paramaccessor> def key: A = Tree.this.key;
def <init>(key: A): Tree[A,B] = {
diff --git a/test/files/run/reify_ann3.scala b/test/files/run/reify_ann3.scala
index 4162fa532f..7098e928a7 100644
--- a/test/files/run/reify_ann3.scala
+++ b/test/files/run/reify_ann3.scala
@@ -14,7 +14,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/reify_ann4.scala b/test/files/run/reify_ann4.scala
index 0aedb77b5e..f6426213df 100644
--- a/test/files/run/reify_ann4.scala
+++ b/test/files/run/reify_ann4.scala
@@ -18,7 +18,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/reify_ann5.scala b/test/files/run/reify_ann5.scala
index d27be3b6d5..5e2f058a39 100644
--- a/test/files/run/reify_ann5.scala
+++ b/test/files/run/reify_ann5.scala
@@ -15,7 +15,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/reify_classfileann_a.check b/test/files/run/reify_classfileann_a.check
index 0c919020a8..51f255b232 100644
--- a/test/files/run/reify_classfileann_a.check
+++ b/test/files/run/reify_classfileann_a.check
@@ -1,3 +1,8 @@
+reify_classfileann_a.scala:6: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation
+ ^
{
@new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends AnyRef {
def <init>() = {
diff --git a/test/files/run/reify_classfileann_a.scala b/test/files/run/reify_classfileann_a.scala
index 1d51688e78..9ae12bff82 100644
--- a/test/files/run/reify_classfileann_a.scala
+++ b/test/files/run/reify_classfileann_a.scala
@@ -14,7 +14,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/reify_classfileann_b.check b/test/files/run/reify_classfileann_b.check
index c204fa8dc0..05f2e5bfc6 100644
--- a/test/files/run/reify_classfileann_b.check
+++ b/test/files/run/reify_classfileann_b.check
@@ -1,3 +1,8 @@
+reify_classfileann_b.scala:6: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation
+ ^
{
class C extends AnyRef {
def <init>() = {
diff --git a/test/files/run/reify_classfileann_b.scala b/test/files/run/reify_classfileann_b.scala
index ef19e9240b..a0cb8f0b49 100644
--- a/test/files/run/reify_classfileann_b.scala
+++ b/test/files/run/reify_classfileann_b.scala
@@ -18,7 +18,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/reify_closure8b.check b/test/files/run/reify_closure8b.check
index 5a7863ff15..5d48d3ab36 100644
--- a/test/files/run/reify_closure8b.check
+++ b/test/files/run/reify_closure8b.check
@@ -1,3 +1,3 @@
-scala.tools.reflect.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_copypaste1.scala b/test/files/run/reify_copypaste1.scala
index c597b7af19..cf813182ae 100644
--- a/test/files/run/reify_copypaste1.scala
+++ b/test/files/run/reify_copypaste1.scala
@@ -9,10 +9,10 @@ object Test extends App {
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")))
+ val reify = Select(Select(Select(Select(Ident(ScalaPackage), TermName("reflect")), TermName("runtime")), TermName("universe")), TermName("reify"))
+ val reifee = Block(List(ValDef(Modifiers(LAZY), TermName("x"), TypeTree(), Apply(Ident(ListModule), List(Literal(Constant(1)), Literal(Constant(2)))))), Ident(TermName("x")))
toolBox.eval(Apply(reify, List(reifee)))
- val Block(List(tpeCopypaste), exprCopypaste @ ModuleDef(_, _, Template(_, _, (_ :: stats) :+ expr))) = toolBox.parse(output.toString())
+ val Block(List(tpeCopypaste, exprCopypaste @ ModuleDef(_, _, Template(_, _, (_ :: stats) :+ expr))), Literal(Constant(()))) = toolBox.parse(output.toString())
output.reset()
toolBox.eval(Block(stats, expr))
stdout.println(output.toString)
diff --git a/test/files/run/reify_extendbuiltins.scala b/test/files/run/reify_extendbuiltins.scala
index a2d546579d..46d5b7e55e 100644
--- a/test/files/run/reify_extendbuiltins.scala
+++ b/test/files/run/reify_extendbuiltins.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ implicitConversions, postfixOps }
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
@@ -12,4 +14,4 @@ object Test extends App {
println("10! = " + (10!))
}.eval
-} \ No newline at end of file
+}
diff --git a/test/files/run/reify_for1.check b/test/files/run/reify_for1.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/reify_for1.check
+++ /dev/null
diff --git a/test/files/run/reify_fors_oldpatmat.flags b/test/files/run/reify_fors_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/reify_fors_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/reify_implicits-new.check b/test/files/run/reify_implicits-new.check
new file mode 100644
index 0000000000..e3aeb20f6b
--- /dev/null
+++ b/test/files/run/reify_implicits-new.check
@@ -0,0 +1 @@
+x = List(1, 2, 3, 4)
diff --git a/test/files/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala
new file mode 100644
index 0000000000..1d90d907ea
--- /dev/null
+++ b/test/files/run/reify_implicits-new.scala
@@ -0,0 +1,18 @@
+
+import scala.language.{ implicitConversions, reflectiveCalls }
+import scala.reflect.{ClassTag, classTag}
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ reify {
+ implicit def arrayWrapper[A : ClassTag](x: Array[A]) =
+ new {
+ def sort(p: (A, A) => Boolean) = {
+ util.Sorting.stableSort(x, p); x
+ }
+ }
+ val x = Array(2, 3, 1, 4)
+ println("x = "+ x.sort((x: Int, y: Int) => x < y).toList)
+ }.eval
+}
diff --git a/test/files/run/reify_implicits-old.check b/test/files/run/reify_implicits-old.check
new file mode 100644
index 0000000000..e3aeb20f6b
--- /dev/null
+++ b/test/files/run/reify_implicits-old.check
@@ -0,0 +1 @@
+x = List(1, 2, 3, 4)
diff --git a/test/files/run/reify_implicits-old.scala b/test/files/run/reify_implicits-old.scala
new file mode 100644
index 0000000000..a4e90488e5
--- /dev/null
+++ b/test/files/run/reify_implicits-old.scala
@@ -0,0 +1,17 @@
+
+import scala.language.{ implicitConversions, reflectiveCalls }
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ reify {
+ implicit def arrayWrapper[A : ClassManifest](x: Array[A]) =
+ new {
+ def sort(p: (A, A) => Boolean) = {
+ util.Sorting.stableSort(x, p); x
+ }
+ }
+ val x = Array(2, 3, 1, 4)
+ println("x = "+ x.sort((x: Int, y: Int) => x < y).toList)
+ }.eval
+}
diff --git a/test/files/run/reify_lazyevaluation.scala b/test/files/run/reify_lazyevaluation.scala
index 5b310d95f7..3f2530ddee 100644
--- a/test/files/run/reify_lazyevaluation.scala
+++ b/test/files/run/reify_lazyevaluation.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ implicitConversions }
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
diff --git a/test/files/run/reify_lazyunit.check b/test/files/run/reify_lazyunit.check
index 1b46c909be..579ecfe8aa 100644
--- a/test/files/run/reify_lazyunit.check
+++ b/test/files/run/reify_lazyunit.check
@@ -1,3 +1,6 @@
+reify_lazyunit.scala:6: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ lazy val x = { 0; println("12")}
+ ^
12
one
two
diff --git a/test/files/run/reify_maps_oldpatmat.flags b/test/files/run/reify_maps_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/reify_maps_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/reify_newimpl_11.check b/test/files/run/reify_newimpl_11.check
index 2f5cb581e6..c019c6db2d 100644
--- a/test/files/run/reify_newimpl_11.check
+++ b/test/files/run/reify_newimpl_11.check
@@ -1,2 +1,4 @@
-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
+scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables:
+ T defined by C in reify_newimpl_11.scala:6:11
+have you forgotten to use TypeTag annotations for type parameters external to a reifee?
+if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_13.check b/test/files/run/reify_newimpl_13.check
index d518cd7b84..13e3c9af1e 100644
--- a/test/files/run/reify_newimpl_13.check
+++ b/test/files/run/reify_newimpl_13.check
@@ -1,2 +1,4 @@
-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
+scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables:
+ T defined by C in reify_newimpl_13.scala:7:13
+have you forgotten to use TypeTag annotations for type parameters external to a reifee?
+if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_19.check b/test/files/run/reify_newimpl_19.check
index 8b8652f92c..c749d4f106 100644
--- a/test/files/run/reify_newimpl_19.check
+++ b/test/files/run/reify_newimpl_19.check
@@ -1,2 +1,4 @@
-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
+scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables:
+ T defined by C in reify_newimpl_19.scala:7:10
+have you forgotten to use TypeTag annotations for type parameters external to a reifee?
+if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check
index dcb3e2889b..1432d10127 100644
--- a/test/files/run/reify_newimpl_22.check
+++ b/test/files/run/reify_newimpl_22.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
@@ -19,11 +17,9 @@ scala> {
}
println(code.eval)
}
-<console>:15: free term: Ident(newTermName("x")) defined by res0 in <console>:14:21
+<console>:15: free term: Ident(TermName("x")) defined by res0 in <console>:14:21
val code = reify {
^
2
scala>
-
-scala>
diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check
index 882124657e..217f0a98c7 100644
--- a/test/files/run/reify_newimpl_23.check
+++ b/test/files/run/reify_newimpl_23.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
@@ -18,11 +16,9 @@ scala> def foo[T]{
}
println(code.eval)
}
-<console>:13: free type: Ident(newTypeName("T")) defined by foo in <console>:12:16
+<console>:13: free type: Ident(TypeName("T")) defined by foo in <console>:12:16
val code = reify {
^
foo: [T]=> Unit
scala>
-
-scala>
diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check
index d1028b94c7..93ad69defa 100644
--- a/test/files/run/reify_newimpl_25.check
+++ b/test/files/run/reify_newimpl_25.check
@@ -1,19 +1,15 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> {
import scala.reflect.runtime.universe._
val x = "2"
val tt = implicitly[TypeTag[x.type]]
println(tt)
}
-<console>:11: free term: Ident(newTermName("x")) defined by res0 in <console>:10:21
+<console>:11: free term: Ident(TermName("x")) defined by res0 in <console>:10:21
val tt = implicitly[TypeTag[x.type]]
^
TypeTag[x.type]
scala>
-
-scala>
diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check
index 347f6365aa..8e0ad87bf2 100644
--- a/test/files/run/reify_newimpl_26.check
+++ b/test/files/run/reify_newimpl_26.check
@@ -1,14 +1,12 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> def foo[T]{
import scala.reflect.runtime.universe._
val tt = implicitly[WeakTypeTag[List[T]]]
println(tt)
}
-<console>:9: free type: Ident(newTypeName("T")) defined by foo in <console>:7:16
+<console>:9: free type: Ident(TypeName("T")) defined by foo in <console>:7:16
val tt = implicitly[WeakTypeTag[List[T]]]
^
foo: [T]=> Unit
@@ -17,5 +15,3 @@ scala> foo[Int]
WeakTypeTag[scala.List[T]]
scala>
-
-scala>
diff --git a/test/files/run/reify_newimpl_30.check b/test/files/run/reify_newimpl_30.check
index 29baac911e..7557c750a6 100644
--- a/test/files/run/reify_newimpl_30.check
+++ b/test/files/run/reify_newimpl_30.check
@@ -1,2 +1,4 @@
-reflective toolbox has failed:
-unresolved free type variables (namely: C defined by <local Test> in reify_newimpl_30.scala:7: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
+reflective toolbox failed due to unresolved free type variables:
+ C defined by <local Test> in reify_newimpl_30.scala:7:11
+have you forgotten to use TypeTag annotations for type parameters external to a reifee?
+if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check
index 52aaa171e0..f884d2c0d0 100644
--- a/test/files/run/reify_newimpl_35.check
+++ b/test/files/run/reify_newimpl_35.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
@@ -13,5 +11,3 @@ scala> println(foo)
Expr[List[Nothing]](Nil)
scala>
-
-scala>
diff --git a/test/files/run/reify_newimpl_45.scala b/test/files/run/reify_newimpl_45.scala
index 2a6c68d441..fd8011f468 100644
--- a/test/files/run/reify_newimpl_45.scala
+++ b/test/files/run/reify_newimpl_45.scala
@@ -2,13 +2,13 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
+import internal._
object Test extends App {
class C[T >: Null] {
val code = reify{val x: T = "2".asInstanceOf[T]; println("ima worx: %s".format(x)); x}
- println(code.tree.freeTypes)
- val T = code.tree.freeTypes(0)
- val tree = code.tree.substituteSymbols(List(T), List(definitions.StringClass))
+ println(freeTypes(code.tree))
+ val tree = substituteSymbols(code.tree, freeTypes(code.tree), List(definitions.StringClass))
cm.mkToolBox().eval(tree)
}
diff --git a/test/files/run/reify_printf.check b/test/files/run/reify_printf.check
index e69de29bb2..3b18e512db 100644
--- a/test/files/run/reify_printf.check
+++ b/test/files/run/reify_printf.check
@@ -0,0 +1 @@
+hello world
diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala
index 272856b962..c4ade79837 100644
--- a/test/files/run/reify_printf.scala
+++ b/test/files/run/reify_printf.scala
@@ -9,13 +9,13 @@ import scala.reflect.internal.Types
import scala.util.matching.Regex
object Test extends App {
- val output = new ByteArrayOutputStream()
- Console.setOut(new PrintStream(output))
+ //val output = new ByteArrayOutputStream()
+ //Console.setOut(new PrintStream(output))
val toolbox = cm.mkToolBox()
val tree = tree_printf(reify("hello %s").tree, reify("world").tree)
val evaluated = toolbox.eval(tree)
- assert(output.toString() == "hello world", output.toString() +" == hello world")
+ //assert(output.toString() == "hello world", output.toString() +" == hello world")
/*
// upd. Oh, good old times, our very-very first experiments with macros :)
@@ -23,7 +23,7 @@ object Test extends App {
*/
var i = 0
- def gensym(name: String) = { i += 1; newTermName(name + i) }
+ def gensym(name: String) = { i += 1; TermName(name + i) }
def createTempValDef( value : Tree, tpe : Type ) : (Option[Tree],Tree) = {
val local = gensym("temp")
@@ -59,13 +59,13 @@ object Test extends App {
Apply(
Select(
Select(
- Ident( newTermName("scala") )
- , newTermName("Predef")
+ Ident( TermName("scala") )
+ , TermName("Predef")
)
- , newTermName("print")
+ , TermName("print")
)
, List(ref)
): Tree
Block((evals ++ prints).toList, Literal(Constant(())))
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/reify_renamed_term_si5841.check b/test/files/run/reify_renamed_term_t5841.check
index 6031277b76..6031277b76 100644
--- a/test/files/run/reify_renamed_term_si5841.check
+++ b/test/files/run/reify_renamed_term_t5841.check
diff --git a/test/files/run/reify_renamed_term_si5841.scala b/test/files/run/reify_renamed_term_t5841.scala
index ef18d650bf..ef18d650bf 100644
--- a/test/files/run/reify_renamed_term_si5841.scala
+++ b/test/files/run/reify_renamed_term_t5841.scala
diff --git a/test/files/run/reify_this.scala b/test/files/run/reify_this.scala
index ecbf394bba..c385da6360 100644
--- a/test/files/run/reify_this.scala
+++ b/test/files/run/reify_this.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
-trait Eval {
+trait Transvaal {
def eval(tree: Expr[_]) = tree.eval
}
-object Test extends App with Eval {
+object Test extends App with Transvaal {
// select a value from package
eval(reify{println("foo")})
eval(reify{println((new Object).toString == (new Object).toString)})
@@ -17,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/repl-assign.check b/test/files/run/repl-assign.check
index c6b0458f04..bdc7793c37 100644
--- a/test/files/run/repl-assign.check
+++ b/test/files/run/repl-assign.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> var x = 10
x: Int = 10
@@ -16,5 +14,3 @@ scala> y = 13
y: Int = 13
scala>
-
-scala>
diff --git a/test/files/run/repl-backticks.scala b/test/files/run/repl-backticks.scala
index 5eaa1ec4c1..e40a8bc662 100644
--- a/test/files/run/repl-backticks.scala
+++ b/test/files/run/repl-backticks.scala
@@ -1,14 +1,14 @@
import scala.tools.nsc._
object Test {
- val testCode = <code>
+ val testCode = """
import java.lang.Thread.`yield`
import scala.`package`.Throwable
`yield`
- </code>.text
+ """
- def main(args: Array[String]) = {
+ def main(args: Array[String]) {
val settings = new Settings()
settings.classpath.value = System.getProperty("java.class.path")
val repl = new interpreter.IMain(settings)
diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check
index 8b6434e986..97ae208ff4 100644
--- a/test/files/run/repl-bare-expr.check
+++ b/test/files/run/repl-bare-expr.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> 2 ; 3
<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
2 ;;
@@ -31,7 +29,7 @@ scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Mooo
<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
^
-defined module Cow
+defined object Cow
defined class Moo
bippy: Int
res2: Int = 105
@@ -39,7 +37,7 @@ res2: Int = 105
scala>
scala> object Bovine { var x: List[_] = null } ; case class Ruminant(x: Int) ; bippy * bippy * bippy
-defined module Bovine
+defined object Bovine
defined class Ruminant
res3: Int = 216
@@ -50,5 +48,3 @@ scala> Bovine.x
res4: List[Any] = List(Ruminant(5), Cow, Moooooo)
scala>
-
-scala>
diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check
index 0cb18e989a..1f6d3e2b39 100644
--- a/test/files/run/repl-colon-type.check
+++ b/test/files/run/repl-colon-type.check
@@ -1,14 +1,11 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> :type List[1, 2, 3]
<console>:1: error: identifier expected but integer literal found.
List[1, 2, 3]
^
-
scala> :type List(1, 2, 3)
List[Int]
@@ -41,12 +38,11 @@ Int
scala> :type protected lazy val f = 5
<console>:5: error: lazy value f cannot be accessed in object $iw
Access to protected value f not permitted because
- enclosing object $eval in package $line13 is not a subclass of
+ enclosing object $eval in package $line13 is not a subclass of
object $iw where target is defined
- lazy val $result = `f`
+ lazy val $result = f
^
-
scala> :type def f = 5
=> Int
@@ -81,8 +77,8 @@ TypeRef(
)
TypeRef(
TypeSymbol(
- sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]]
-
+ sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable
+
)
args = List(
TypeRef(TypeSymbol(final abstract class Int extends AnyVal))
@@ -103,7 +99,7 @@ PolyType(
resultType = TypeRef(
TypeSymbol(
abstract trait Set[A] extends Iterable[A] with Set[A] with GenericSetTemplate[A,scala.collection.immutable.Set] with SetLike[A,scala.collection.immutable.Set[A]] with Parallelizable[A,scala.collection.parallel.immutable.ParSet[A]]
-
+
)
args = List(TypeRef(TypeSymbol(abstract class Any extends )))
)
@@ -148,8 +144,8 @@ TypeRef(
args = List(
TypeRef(
TypeSymbol(
- sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]]
-
+ sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable
+
)
args = List(
TypeRef(
@@ -181,8 +177,8 @@ PolyType(
args = List(
TypeRef(
TypeSymbol(
- sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]]
-
+ sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable
+
)
args = List(TypeParamTypeRef(TypeParam(T <: AnyVal)))
)
@@ -204,8 +200,8 @@ PolyType(
params = List(TermSymbol(x: T), TermSymbol(y: List[U]))
resultType = TypeRef(
TypeSymbol(
- sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]]
-
+ sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable
+
)
args = List(TypeParamTypeRef(TypeParam(U >: T)))
)
@@ -223,5 +219,3 @@ scala> :type println("side effect!")
Unit
scala>
-
-scala>
diff --git a/test/files/run/repl-empty-package.check b/test/files/run/repl-empty-package.check
new file mode 100644
index 0000000000..ecf79c2c6d
--- /dev/null
+++ b/test/files/run/repl-empty-package.check
@@ -0,0 +1,7 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> println(Bippy.bippy)
+bippy!
+
+scala>
diff --git a/test/files/run/repl-empty-package/s_1.scala b/test/files/run/repl-empty-package/s_1.scala
new file mode 100644
index 0000000000..b59d16b338
--- /dev/null
+++ b/test/files/run/repl-empty-package/s_1.scala
@@ -0,0 +1,3 @@
+object Bippy {
+ def bippy = "bippy!"
+}
diff --git a/test/files/run/repl-empty-package/s_2.scala b/test/files/run/repl-empty-package/s_2.scala
new file mode 100644
index 0000000000..512e6dd382
--- /dev/null
+++ b/test/files/run/repl-empty-package/s_2.scala
@@ -0,0 +1,5 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = "println(Bippy.bippy)"
+}
diff --git a/test/files/run/repl-javap-app.check b/test/files/run/repl-javap-app.check
new file mode 100644
index 0000000000..490860585c
--- /dev/null
+++ b/test/files/run/repl-javap-app.check
@@ -0,0 +1,38 @@
+#partest java6
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> :javap -app MyApp$
+public final void delayedEndpoint$MyApp$1();
+ Code:
+ Stack=2, Locals=1, Args_size=1
+ 0: getstatic #61; //Field scala/Console$.MODULE$:Lscala/Console$;
+ 3: ldc #63; //String Hello, delayed world.
+ 5: invokevirtual #67; //Method scala/Console$.println:(Ljava/lang/Object;)V
+ 8: return
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 9 0 this LMyApp$;
+
+scala>
+#partest !java6
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> :javap -app MyApp$
+ public final void delayedEndpoint$MyApp$1();
+ flags: ACC_PUBLIC, ACC_FINAL
+ Code:
+ stack=2, locals=1, args_size=1
+ 0: getstatic #61 // Field scala/Console$.MODULE$:Lscala/Console$;
+ 3: ldc #63 // String Hello, delayed world.
+ 5: invokevirtual #67 // Method scala/Console$.println:(Ljava/lang/Object;)V
+ 8: return
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 9 0 this LMyApp$;
+ LineNumberTable:
+ line 5: 0
+}
+
+scala>
diff --git a/test/files/run/repl-javap-app.scala b/test/files/run/repl-javap-app.scala
new file mode 100644
index 0000000000..be04920be1
--- /dev/null
+++ b/test/files/run/repl-javap-app.scala
@@ -0,0 +1,10 @@
+
+import scala.tools.partest.ReplTest
+
+object MyApp extends App {
+ Console println "Hello, delayed world."
+}
+
+object Test extends ReplTest {
+ def code = ":javap -app MyApp$"
+}
diff --git a/test/files/run/repl-javap-def.scala b/test/files/run/repl-javap-def.scala
new file mode 100644
index 0000000000..dbd769613a
--- /dev/null
+++ b/test/files/run/repl-javap-def.scala
@@ -0,0 +1,17 @@
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |def f = 7
+ |:javap -public -raw f
+ """.stripMargin
+
+ // it should find f wrapped in repl skins. replstiltskin.
+ override def yah(res: Seq[String]) = {
+ // replstiltskin: what be my name?
+ val keywords = List("public", "class", "line")
+ def isLineClass(s: String) = keywords forall (s contains _)
+ def filtered = res filter isLineClass
+ 1 == filtered.size
+ }
+}
diff --git a/test/files/run/repl-javap-fun.scala b/test/files/run/repl-javap-fun.scala
new file mode 100644
index 0000000000..5c9a6b7691
--- /dev/null
+++ b/test/files/run/repl-javap-fun.scala
@@ -0,0 +1,16 @@
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |object Betty {
+ | List(1,2,3) filter (_ % 2 != 0) map (_ * 2)
+ |}
+ |:javap -fun Betty
+ """.stripMargin
+
+ // two anonfuns of Betty
+ override def yah(res: Seq[String]) = {
+ def filtered = res filter (_ contains "public final class Betty")
+ 2 == filtered.size
+ }
+}
diff --git a/test/files/run/repl-javap-mem.scala b/test/files/run/repl-javap-mem.scala
new file mode 100644
index 0000000000..8db30e835c
--- /dev/null
+++ b/test/files/run/repl-javap-mem.scala
@@ -0,0 +1,19 @@
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |object Betty {
+ | val ds = List(1,2,3) filter (_ % 2 == 0) map (_ * 3)
+ | def m(vs: List[Int]) = vs filter (_ % 2 != 0) map (_ * 2)
+ |}
+ |:javap Betty#m
+ """.stripMargin
+
+ // filter for requested method member
+ override def yah(res: Seq[String]) = {
+ // cheaply, methods end in arg list
+ val p = """.*m\(.*\);""".r
+ def filtered = res filter (_ match { case p() => true case _ => false })
+ 1 == filtered.size
+ }
+}
diff --git a/test/files/run/repl-javap-memfun.scala b/test/files/run/repl-javap-memfun.scala
new file mode 100644
index 0000000000..d2b4243c8b
--- /dev/null
+++ b/test/files/run/repl-javap-memfun.scala
@@ -0,0 +1,18 @@
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |object Betty {
+ | List(1,2,3) count (_ % 2 != 0)
+ | def f = List(1,2,3) filter (_ % 2 != 0) map (_ * 2)
+ | def g = List(1,2,3) filter (_ % 2 == 0) map (_ * 3) map (_ + 1)
+ |}
+ |:javap -fun Betty#g
+ """.stripMargin
+
+ // three anonfuns of Betty#g
+ override def yah(res: Seq[String]) = {
+ def filtered = res filter (_ contains "public final class Betty")
+ 3 == filtered.size
+ }
+}
diff --git a/test/files/run/repl-javap-more-fun.scala b/test/files/run/repl-javap-more-fun.scala
new file mode 100644
index 0000000000..e603faf75a
--- /dev/null
+++ b/test/files/run/repl-javap-more-fun.scala
@@ -0,0 +1,17 @@
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |object Betty {
+ | val ds = List(1,2,3) filter (_ % 2 == 0) map (_ * 3)
+ | def m(vs: List[Int]) = vs filter (_ % 2 != 0) map (_ * 2)
+ |}
+ |:javap -fun Betty
+ """.stripMargin
+
+ // two anonfuns of Betty
+ override def yah(res: Seq[String]) = {
+ def filtered = res filter (_ contains "public final class Betty")
+ 4 == filtered.size
+ }
+}
diff --git a/test/files/run/repl-javap-outdir-funs/foo_1.scala b/test/files/run/repl-javap-outdir-funs/foo_1.scala
new file mode 100644
index 0000000000..9b98e94733
--- /dev/null
+++ b/test/files/run/repl-javap-outdir-funs/foo_1.scala
@@ -0,0 +1,6 @@
+
+package disktest
+
+class Foo {
+ def m(vs: List[Int]) = vs map (_ + 1)
+}
diff --git a/test/files/run/repl-javap-outdir-funs/run-repl_7.scala b/test/files/run/repl-javap-outdir-funs/run-repl_7.scala
new file mode 100644
index 0000000000..6c6fe2d515
--- /dev/null
+++ b/test/files/run/repl-javap-outdir-funs/run-repl_7.scala
@@ -0,0 +1,17 @@
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |:javap -fun disktest/Foo.class
+ """.stripMargin
+
+ override def yah(res: Seq[String]) =
+ // It's currently unknown why this test fails on Avian with
+ // “Failed: No anonfuns found.”, skip it for now. See SI-7630.
+ if (scala.tools.partest.utils.Properties.isAvian)
+ true
+ else {
+ def filtered = res filter (_ contains "public final class disktest.Foo")
+ 1 == filtered.size
+ }
+}
diff --git a/test/files/run/repl-javap-outdir/foo_1.scala b/test/files/run/repl-javap-outdir/foo_1.scala
new file mode 100644
index 0000000000..9b98e94733
--- /dev/null
+++ b/test/files/run/repl-javap-outdir/foo_1.scala
@@ -0,0 +1,6 @@
+
+package disktest
+
+class Foo {
+ def m(vs: List[Int]) = vs map (_ + 1)
+}
diff --git a/test/files/run/repl-javap-outdir/run-repl_7.scala b/test/files/run/repl-javap-outdir/run-repl_7.scala
new file mode 100644
index 0000000000..dc2c5719ff
--- /dev/null
+++ b/test/files/run/repl-javap-outdir/run-repl_7.scala
@@ -0,0 +1,12 @@
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |:javap disktest/Foo.class
+ """.stripMargin
+
+ override def yah(res: Seq[String]) = {
+ def filtered = res filter (_ contains "public class disktest.Foo")
+ 1 == filtered.size
+ }
+}
diff --git a/test/files/run/repl-javap.scala b/test/files/run/repl-javap.scala
new file mode 100644
index 0000000000..7a19852d4e
--- /dev/null
+++ b/test/files/run/repl-javap.scala
@@ -0,0 +1,13 @@
+import scala.tools.partest.JavapTest
+
+object Test extends JavapTest {
+ def code = """
+ |case class Betty(i: Int) { def next = Betty(i+1) }
+ |:javap Betty
+ """.stripMargin
+
+ override def yah(res: Seq[String]) = {
+ def filtered = res filter (_ contains "public class Betty")
+ 1 == filtered.size
+ }
+}
diff --git a/test/files/run/repl-out-dir.check b/test/files/run/repl-out-dir.check
new file mode 100644
index 0000000000..3e51c63155
--- /dev/null
+++ b/test/files/run/repl-out-dir.check
@@ -0,0 +1,49 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> case class Bippy(x: Int)
+defined class Bippy
+
+scala> val x = Bippy(1)
+x: Bippy = Bippy(1)
+
+scala> $intp.showDirectory
+repl-out-dir-run.obj
+ $line1
+ $eval$.class
+ $eval.class
+ $line2
+ $eval$.class
+ $eval.class
+ $read$$iw$$iw$.class
+ $read$$iw$.class
+ $read$.class
+ $read.class
+ $line3
+ $eval$.class
+ $eval.class
+ $read$$iw$$iw$.class
+ $read$$iw$$iw$Bippy$.class
+ $read$$iw$$iw$Bippy.class
+ $read$$iw$.class
+ $read$.class
+ $read.class
+ $line4
+ $eval$.class
+ $eval.class
+ $read$$iw$$iw$.class
+ $read$$iw$.class
+ $read$.class
+ $read.class
+ $line5
+ $eval$.class
+ $eval.class
+ $read$$iw$$iw$.class
+ $read$$iw$.class
+ $read$.class
+ $read.class
+ $repl_$init.class
+ Test$.class
+ Test.class
+
+scala>
diff --git a/test/files/run/repl-out-dir.scala b/test/files/run/repl-out-dir.scala
new file mode 100644
index 0000000000..33c823aa2d
--- /dev/null
+++ b/test/files/run/repl-out-dir.scala
@@ -0,0 +1,13 @@
+import scala.tools.partest.ReplTest
+import scala.tools.nsc.Settings
+
+object Test extends ReplTest {
+ override def extraSettings = s"-Yrepl-outdir ${testOutput.path}"
+
+ def code = s"""
+case class Bippy(x: Int)
+val x = Bippy(1)
+$$intp.showDirectory
+ """
+
+}
diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check
index 203b020f2c..ab3809a2e0 100644
--- a/test/files/run/repl-paste-2.check
+++ b/test/files/run/repl-paste-2.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> scala> 999l
// Detected repl transcript paste: ctrl-D to finish.
@@ -31,7 +29,6 @@ res9: Int = 6
scala> x.length + res5
res10: Int = 12
-
// Replaying 8 commands from transcript.
scala> 999l
diff --git a/test/files/run/repl-paste-3.check b/test/files/run/repl-paste-3.check
index 2b4c941c33..8fae61792e 100644
--- a/test/files/run/repl-paste-3.check
+++ b/test/files/run/repl-paste-3.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> println(3)
3
@@ -10,5 +8,3 @@ scala> List(1,2)
res1: List[Int] = List(1, 2)
scala>
-
-scala>
diff --git a/test/files/run/repl-paste-4.pastie b/test/files/run/repl-paste-4.pastie
new file mode 100644
index 0000000000..853a66f6a4
--- /dev/null
+++ b/test/files/run/repl-paste-4.pastie
@@ -0,0 +1,4 @@
+
+// if we are truly companions, I can see your foo
+class Foo { private val foo = 7 }
+object Foo { def apply(f: Foo) = f.foo }
diff --git a/test/files/run/repl-paste-4.scala b/test/files/run/repl-paste-4.scala
new file mode 100644
index 0000000000..0060dc1ff6
--- /dev/null
+++ b/test/files/run/repl-paste-4.scala
@@ -0,0 +1,20 @@
+
+import scala.tools.partest.SessionTest
+
+object Test extends SessionTest {
+ def session =
+s"""|Type in expressions to have them evaluated.
+ |Type :help for more information.
+ |
+ |scala> :paste $pastie
+ |Pasting file $pastie...
+ |defined class Foo
+ |defined object Foo
+ |
+ |scala> Foo(new Foo)
+ |res0: Int = 7
+ |
+ |scala> """
+ def pastie = testPath changeExtension "pastie"
+}
+
diff --git a/test/files/run/repl-paste-raw.pastie b/test/files/run/repl-paste-raw.pastie
new file mode 100644
index 0000000000..f13b4bcf8b
--- /dev/null
+++ b/test/files/run/repl-paste-raw.pastie
@@ -0,0 +1,8 @@
+
+// a raw paste is not a script
+// hence it can be packaged
+
+package brown_paper
+
+// these are a few of my favorite things
+case class Gift (hasString: Boolean)
diff --git a/test/files/run/repl-paste-raw.scala b/test/files/run/repl-paste-raw.scala
new file mode 100644
index 0000000000..2953796f99
--- /dev/null
+++ b/test/files/run/repl-paste-raw.scala
@@ -0,0 +1,20 @@
+
+import scala.tools.partest.SessionTest
+
+object Test extends SessionTest {
+ def session =
+s"""|Type in expressions to have them evaluated.
+ |Type :help for more information.
+ |
+ |scala> :paste -raw $pastie
+ |Pasting file $pastie...
+ |
+ |scala> val favoriteThing = brown_paper.Gift(true)
+ |favoriteThing: brown_paper.Gift = Gift(true)
+ |
+ |scala> favoriteThing.hasString
+ |res0: Boolean = true
+ |
+ |scala> """
+ def pastie = testPath changeExtension "pastie"
+}
diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check
index d3e171fbfb..97f177ddc4 100644
--- a/test/files/run/repl-paste.check
+++ b/test/files/run/repl-paste.check
@@ -17,11 +17,10 @@ object Dingus
val x = (new Dingus).y
-
// Exiting paste mode, now interpreting.
defined class Dingus
-defined module Dingus
+defined object Dingus
x: Int = 110
scala>
diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check
index 9d63ecde94..e56901e0f2 100644
--- a/test/files/run/repl-power.check
+++ b/test/files/run/repl-power.check
@@ -11,22 +11,20 @@ scala> :power
scala> // guarding against "error: reference to global is ambiguous"
scala> global.emptyValDef // "it is imported twice in the same scope by ..."
-res0: $r.global.emptyValDef.type = private val _ = _
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+res0: $r.global.noSelfType.type = private val _ = _
scala> val tp = ArrayClass[scala.util.Random] // magic with tags
+warning: there were 1 feature warning(s); re-run with -feature for details
tp: $r.global.Type = Array[scala.util.Random]
scala> tp.memberType(Array_apply) // evidence
res1: $r.global.Type = (i: Int)scala.util.Random
-scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl
-m: $r.treedsl.global.Match =
-10 match {
- case 5 => false
- case _ => true
-}
+scala> val m = LIT(10) // treedsl
+m: $r.treedsl.global.Literal = 10
scala> typed(m).tpe // typed is in scope
-res2: $r.treedsl.global.Type = Boolean
+res2: $r.treedsl.global.Type = Int(10)
scala>
diff --git a/test/files/run/repl-power.scala b/test/files/run/repl-power.scala
index f7c88c63ff..4dfeb37885 100644
--- a/test/files/run/repl-power.scala
+++ b/test/files/run/repl-power.scala
@@ -7,7 +7,7 @@ object Test extends ReplTest {
global.emptyValDef // "it is imported twice in the same scope by ..."
val tp = ArrayClass[scala.util.Random] // magic with tags
tp.memberType(Array_apply) // evidence
-val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl
+val m = LIT(10) // treedsl
typed(m).tpe // typed is in scope
""".trim
}
diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check
index 7256b851bb..ed95c7b8ff 100644
--- a/test/files/run/repl-reset.check
+++ b/test/files/run/repl-reset.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> val x1 = 1
x1: Int = 1
@@ -35,6 +33,12 @@ scala> x1 + x2 + x3
<console>:8: error: not found: value x1
x1 + x2 + x3
^
+<console>:8: error: not found: value x2
+ x1 + x2 + x3
+ ^
+<console>:8: error: not found: value x3
+ x1 + x2 + x3
+ ^
scala> val x1 = 4
x1: Int = 4
@@ -51,5 +55,3 @@ scala> { new BippyBungus ; x1 }
res2: Int = 4
scala>
-
-scala>
diff --git a/test/files/run/repl-save.check b/test/files/run/repl-save.check
new file mode 100644
index 0000000000..5f928688d0
--- /dev/null
+++ b/test/files/run/repl-save.check
@@ -0,0 +1,3 @@
+val i = 7
+val j = 8
+i * j
diff --git a/test/files/run/repl-save.scala b/test/files/run/repl-save.scala
new file mode 100644
index 0000000000..4539790b1a
--- /dev/null
+++ b/test/files/run/repl-save.scala
@@ -0,0 +1,25 @@
+import scala.tools.partest.SessionTest
+
+object Test extends SessionTest {
+ def session =
+s"""|Type in expressions to have them evaluated.
+ |Type :help for more information.
+ |
+ |scala> val i = 7
+ |i: Int = 7
+ |
+ |scala> val j = 8
+ |j: Int = 8
+ |
+ |scala> i * j
+ |res0: Int = 56
+ |
+ |scala> :save $saveto
+ |
+ |scala> """
+ def saveto = testOutput / "session.repl"
+ override def show() = {
+ super.show()
+ Console print saveto.toFile.slurp
+ }
+}
diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check
new file mode 100644
index 0000000000..3580bfe1f1
--- /dev/null
+++ b/test/files/run/repl-term-macros.check
@@ -0,0 +1,40 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> import scala.reflect.macros.blackbox.Context
+import scala.reflect.macros.blackbox.Context
+
+scala> import language.experimental.macros
+import language.experimental.macros
+
+scala>
+
+scala> def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
+impl1: (c: scala.reflect.macros.blackbox.Context)c.Expr[Unit]
+
+scala> def foo1: Unit = macro impl1
+defined term macro foo1: Unit
+
+scala> foo1
+
+scala>
+
+scala> def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
+impl2: (c: scala.reflect.macros.blackbox.Context)()c.Expr[Unit]
+
+scala> def foo2(): Unit = macro impl2
+defined term macro foo2: ()Unit
+
+scala> foo2()
+
+scala>
+
+scala> def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
+impl3: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit]
+
+scala> def foo3(x: Int)(y: Int): Unit = macro impl3
+defined term macro foo3: (x: Int)(y: Int)Unit
+
+scala> foo3(2)(3)
+
+scala>
diff --git a/test/files/run/repl-term-macros.scala b/test/files/run/repl-term-macros.scala
new file mode 100644
index 0000000000..32892b7314
--- /dev/null
+++ b/test/files/run/repl-term-macros.scala
@@ -0,0 +1,20 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+ import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
+def foo1: Unit = macro impl1
+foo1
+
+def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
+def foo2(): Unit = macro impl2
+foo2()
+
+def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
+def foo3(x: Int)(y: Int): Unit = macro impl3
+foo3(2)(3)
+ """
+} \ No newline at end of file
diff --git a/test/files/run/repl-transcript.check b/test/files/run/repl-transcript.check
index 6d22353882..49891af900 100644
--- a/test/files/run/repl-transcript.check
+++ b/test/files/run/repl-transcript.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> scala> class Bippity
// Detected repl transcript paste: ctrl-D to finish.
@@ -19,7 +17,6 @@ scala> 1 to 100 map (_ + 1)
res6: scala.collection.immutable.IndexedSeq[Int] = Vector(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101)
scala> res6.sum + res5
-
// Replaying 5 commands from transcript.
scala> class Bippity
diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala
new file mode 100644
index 0000000000..483659146a
--- /dev/null
+++ b/test/files/run/repl-trim-stack-trace.scala
@@ -0,0 +1,45 @@
+
+import scala.tools.partest.{ SessionTest, Welcoming }
+
+// SI-7740
+object Test extends SessionTest with Welcoming {
+ def session =
+"""Welcome to Scala
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> def f = throw new Exception("Uh-oh")
+f: Nothing
+
+scala> f
+java.lang.Exception: Uh-oh
+ at .f(<console>:7)
+ ... 69 elided
+
+scala> def f = throw new Exception("")
+f: Nothing
+
+scala> f
+java.lang.Exception:
+ at .f(<console>:7)
+ ... 69 elided
+
+scala> def f = throw new Exception
+f: Nothing
+
+scala> f
+java.lang.Exception
+ at .f(<console>:7)
+ ... 69 elided
+
+scala> """
+
+ // normalize the "elided" lines because the frame count depends on test context
+ lazy val elided = """(\s+\.{3} )\d+( elided)""".r
+ override def normalize(line: String) = line match {
+ case welcome(w) => w
+ case elided(ellipsis, suffix) => s"$ellipsis???$suffix"
+ case s => s
+ }
+ override def expected = super.expected map normalize
+}
diff --git a/test/files/run/repl-type-verbose.check b/test/files/run/repl-type-verbose.check
index 989c0735b0..e37754a060 100644
--- a/test/files/run/repl-type-verbose.check
+++ b/test/files/run/repl-type-verbose.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> // verbose!
scala> :type -v def f = 5
@@ -165,7 +163,7 @@ PolyType(
normalize = TypeRef(
TypeSymbol(
abstract trait Ordering[T] extends Comparator[T] with PartialOrdering[T] with Serializable
-
+
)
args = List(TypeParamTypeRef(TypeParam(T)))
)
@@ -190,5 +188,3 @@ PolyType(
)
scala>
-
-scala>
diff --git a/test/files/run/resetattrs-this.scala b/test/files/run/resetattrs-this.scala
index 12afa3d712..ff45d61dfe 100644
--- a/test/files/run/resetattrs-this.scala
+++ b/test/files/run/resetattrs-this.scala
@@ -4,8 +4,8 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val tb = cm.mkToolBox()
- val tree = Select(This(cm.staticPackage("scala").moduleClass), newTermName("Predef"))
- val ttree = tb.typeCheck(tree)
- val rttree = tb.resetAllAttrs(ttree)
+ val tree = Select(This(cm.staticPackage("scala").moduleClass), TermName("Predef"))
+ val ttree = tb.typecheck(tree)
+ val rttree = tb.untypecheck(ttree)
println(tb.eval(rttree) == Predef)
-} \ No newline at end of file
+}
diff --git a/test/files/run/richs.check b/test/files/run/richs.check
index a970a814b1..02a98b376d 100644
--- a/test/files/run/richs.check
+++ b/test/files/run/richs.check
@@ -1,3 +1,4 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
RichCharTest1:
true
diff --git a/test/files/run/richs.scala b/test/files/run/richs.scala
index 5ee573673d..4b5345757c 100644
--- a/test/files/run/richs.scala
+++ b/test/files/run/richs.scala
@@ -11,8 +11,8 @@ trait RichTest {
val cn = this.getClass().getName()
cn.substring(0, cn.length-1)
}
- def length[A](it: Iterator[A]) = it.toList length
- def length[A](it: Iterable[A]) = it.toList length
+ def length[A](it: Iterator[A]) = it.toList.length
+ def length[A](it: Iterable[A]) = it.toList.length
def run: Unit
}
object RichCharTest1 extends RichTest {
diff --git a/test/files/run/run-bug4840.scala b/test/files/run/run-bug4840.scala
index 5f98bc9f4b..dda280fd17 100644
--- a/test/files/run/run-bug4840.scala
+++ b/test/files/run/run-bug4840.scala
@@ -1,6 +1,6 @@
object Test {
def g(x: Boolean): Option[String] = if (x) Some("booya") else None
-
+
def f1() = {
for (x <- g(true)) yield {
g(false) match {
@@ -9,11 +9,11 @@ object Test {
}
}
}
-
+
def f2() = {
for (x <- g(true) ; y <- g(true) ; z <- g(true)) yield {
for (x <- g(true) ; y <- g(true) ; z <- g(true)) yield {
- g(true) map { _ =>
+ g(true) map { _ =>
(null: Any) match {
case Some(x: Int) => x
case _ => 5
@@ -21,7 +21,7 @@ object Test {
}
}
}
- }
+ }
def main(args: Array[String]): Unit = {
println(f1())
diff --git a/test/files/run/runtime-richChar.scala b/test/files/run/runtime-richChar.scala
index cf18a1d302..dceb70e74d 100644
--- a/test/files/run/runtime-richChar.scala
+++ b/test/files/run/runtime-richChar.scala
@@ -5,19 +5,19 @@ object Test extends App {
else
println(name + " failed: " + expected + " differs from " + got)
}
-
+
testSeq("'a' to 'c'", List('a', 'b', 'c'), 'a' to 'c')
testSeq("'a' until 'c'", List('a', 'b'), 'a' until 'c')
-
+
testSeq("'a' to 'b'", List('a', 'b'), 'a' to 'b')
testSeq("'a' until 'b'", List('a'), 'a' until 'b')
-
+
testSeq("'a' to 'a'", List('a'), 'a' to 'a')
testSeq("'a' until 'a'", List(), 'a' until 'a')
-
+
testSeq("'b' to 'a'", List(), 'b' to 'a')
testSeq("'b' until 'a'", List(), 'b' until 'a')
-
+
testSeq("'c' to 'a'", List(), 'c' to 'a')
testSeq("'c' until 'a'", List(), 'c' until 'a')
}
diff --git a/test/files/run/runtime.check b/test/files/run/runtime.check
index 990a087da0..d613c9bd42 100644
--- a/test/files/run/runtime.check
+++ b/test/files/run/runtime.check
@@ -1,3 +1,9 @@
+runtime.scala:141: warning: comparing values of types Null and Null using `eq' will always yield true
+ check(true , null eq null, null ne null);
+ ^
+runtime.scala:141: warning: comparing values of types Null and Null using `ne' will always yield false
+ check(true , null eq null, null ne null);
+ ^
<<< Test0
[false,true]
[0,1,2]
diff --git a/test/files/run/runtime.scala b/test/files/run/runtime.scala
index 2dcb41fb50..89348b294d 100644
--- a/test/files/run/runtime.scala
+++ b/test/files/run/runtime.scala
@@ -125,7 +125,7 @@ object Test2Test {
object Test3Test {
- class Foo { override def equals(that: Any) = error("abort"); }
+ class Foo { override def equals(that: Any) = sys.error("abort"); }
def check(expected: Boolean, actual1: Boolean, actual2: Boolean): Unit =
Console.println(
@@ -171,7 +171,7 @@ object Test {
try {
test;
} catch {
- case exception => {
+ case exception: Throwable => {
//val name: String = Thread.currentThread().getName();
Console.print("Exception in thread \"" + name + "\" " + exception);
Console.println;
diff --git a/test/files/run/interpolation.flags b/test/files/run/sammy_java8.flags
index 48fd867160..48fd867160 100644
--- a/test/files/run/interpolation.flags
+++ b/test/files/run/sammy_java8.flags
diff --git a/test/files/run/sammy_java8.scala b/test/files/run/sammy_java8.scala
new file mode 100644
index 0000000000..db9df7f5fe
--- /dev/null
+++ b/test/files/run/sammy_java8.scala
@@ -0,0 +1,34 @@
+import scala.tools.partest._
+
+// java8 version of sammy_poly.scala
+object Test extends CompilerTest {
+ import global._
+
+ override lazy val units: List[CompilationUnit] = {
+ global.settings.Xexperimental.value = true
+
+ // This test itself does not depend on JDK8.
+ javaCompilationUnits(global)(samSource) ++
+ compilationUnits(global)(useSamSource)
+ }
+
+ private def samSource = """
+// trait F[T, U] { def apply(x: T): U }
+public interface F<T, U> {
+ U apply(T t);
+ default void yadayada() {
+ throw new UnsupportedOperationException("yadayada");
+ }
+}
+ """
+
+ private def useSamSource = """
+class T {
+ def app[T, U](x: T)(f: F[T, U]): U = f(x)
+ app(1)(x => List(x))
+}
+ """
+
+ // We're only checking we can compile it.
+ def check(source: String, unit: global.CompilationUnit): Unit = ()
+}
diff --git a/test/files/run/scan.scala b/test/files/run/scan.scala
index f056c77ba1..47e0a7d976 100644
--- a/test/files/run/scan.scala
+++ b/test/files/run/scan.scala
@@ -6,17 +6,17 @@ object Test {
def main(args: Array[String]) {
val lst = List(1, 2, 3, 4, 5)
-
+
assert(lst.scanLeft(0)(_ + _) == List(0, 1, 3, 6, 10, 15))
assert(lst.scanRight(0)(_ + _) == List(15, 14, 12, 9, 5, 0))
-
+
val emp = List[Int]()
assert(emp.scanLeft(0)(_ + _) == List(0))
assert(emp.scanRight(0)(_ + _) == List(0))
-
+
val stream = Stream(1, 2, 3, 4, 5)
assert(stream.scanLeft(0)(_ + _) == Stream(0, 1, 3, 6, 10, 15))
-
+
assert(Stream.from(1).scanLeft(0)(_ + _).take(5) == Stream(0, 1, 3, 6, 10))
}
diff --git a/test/files/run/search.check b/test/files/run/search.check
new file mode 100644
index 0000000000..a885696509
--- /dev/null
+++ b/test/files/run/search.check
@@ -0,0 +1,6 @@
+Found(2)
+Found(4)
+InsertionPoint(9)
+Found(2)
+Found(4)
+InsertionPoint(9)
diff --git a/test/files/run/search.scala b/test/files/run/search.scala
new file mode 100644
index 0000000000..ed7fed54a7
--- /dev/null
+++ b/test/files/run/search.scala
@@ -0,0 +1,14 @@
+object Test extends App {
+ import scala.collection.{LinearSeq, IndexedSeq}
+ import scala.collection.Searching.search
+
+ val ls = LinearSeq(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13)
+ println(ls.search(3))
+ println(ls.search(5, 3, 8))
+ println(ls.search(12))
+
+ val is = IndexedSeq(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13)
+ println(is.search(3))
+ println(is.search(5, 3, 8))
+ println(is.search(12))
+}
diff --git a/test/files/run/seqlike-kmp.scala b/test/files/run/seqlike-kmp.scala
index 514990cfa2..af39fda9af 100644
--- a/test/files/run/seqlike-kmp.scala
+++ b/test/files/run/seqlike-kmp.scala
@@ -2,7 +2,7 @@ object Test {
val source = 0 to 99
val idxes = (-1 to 2) ++ (97 to 100)
def str(xs: Seq[Int]) = xs.mkString("(", ", ", ")")
-
+
def f(tgt: Seq[Int]) = {
println("indexOfSlice")
// the first index `>= from` such that...
@@ -17,11 +17,11 @@ object Test {
println(" %s with idx <= %d = %d".format(str(tgt), x, res))
}
}
-
+
def g(idx: Int, len: Int) = {
f(source.slice(idx, idx + len))
}
-
+
def main(args: Array[String]): Unit = {
g(97, 1)
g(97, 2)
diff --git a/test/files/run/sequenceComparisons.scala b/test/files/run/sequenceComparisons.scala
index 5d7958bc7e..613b37f45a 100644
--- a/test/files/run/sequenceComparisons.scala
+++ b/test/files/run/sequenceComparisons.scala
@@ -2,12 +2,12 @@ import scala.collection.{ mutable, immutable }
import collection.{ Seq, Traversable }
object Test {
- // TODO:
+ // TODO:
//
// SeqProxy
// SeqForwarder
// the commented out ones in seqMakers
-
+
val seqMakers = List[List[Int] => Seq[Int]](
// scala.Array(_: _*),
mutable.ArrayBuffer(_: _*),
@@ -23,13 +23,13 @@ object Test {
immutable.Seq(_: _*),
mutable.Seq(_: _*),
immutable.Stack(_: _*),
- // mutable.Stack(_: _*),
+ // mutable.Stack(_: _*),
immutable.IndexedSeq(_: _*), // was Vector
//mutable.Vector(_: _*),
immutable.List(_: _*),
immutable.Stream(_: _*)
)
-
+
abstract class Data[T] {
val seq: Seq[T]
private def seqList = seq.toList
@@ -45,50 +45,50 @@ object Test {
}
lazy val eqeq = Method(_ == _, (List(seqList), List(Nil, seqList drop 1, seqList ::: seqList)), "%s == %s")
-
+
val startsWithInputs: Inputs
lazy val startsWith = Method(_ startsWith _, startsWithInputs, "%s startsWith %s")
-
+
val endsWithInputs: Inputs
lazy val endsWith = Method(_ endsWith _, endsWithInputs, "%s endsWith %s")
val indexOfSliceInputs: Inputs
private def subseqTest(s1: Seq[T], s2: Seq[T]) = (s1 indexOfSlice s2) != -1
lazy val indexOfSlice = Method(subseqTest _, indexOfSliceInputs, "(%s indexOfSlice %s) != -1")
-
+
val sameElementsInputs: Inputs
lazy val sameElements = Method(_ sameElements _, sameElementsInputs, "%s sameElements %s")
-
+
def methodList = List(eqeq, startsWith, endsWith, indexOfSlice, sameElements)
}
-
+
object test1 extends Data[Int] {
val seq = List(1,2,3,4,5)
-
+
val startsWithInputs = (
List(Nil, List(1), List(1,2), seq),
List(List(1,2,3,4,6), seq ::: List(5), List(0))
)
-
+
val endsWithInputs = (
List(Nil, List(5), List(4,5), seq),
List(0 :: seq, List(5,2,3,4,5), List(3,4), List(5,6))
)
-
+
val indexOfSliceInputs = (
List(Nil, List(1), List(3), List(5), List(1,2), List(2,3,4), List(4,5), seq),
List(List(1,2,3,5), List(6), List(5,4,3,2,1), List(2,1))
)
-
+
val sameElementsInputs = (
List(List(1,2,3,4,5)),
- List(Nil, List(1), List(1,2), List(2,3,4), List(2,3,4,5), List(2,3,4,5,1), List(1,2,3,5,4), seq reverse)
+ List(Nil, List(1), List(1,2), List(2,3,4), List(2,3,4,5), List(2,3,4,5,1), List(1,2,3,5,4), seq.reverse)
)
}
-
+
val failures = new mutable.ListBuffer[String]
var testCount = 0
-
+
def assertOne(op1: Any, op2: Any, res: Boolean, str: String) {
testCount += 1
val resStr = str.format(op1, op2)
@@ -97,25 +97,25 @@ object Test {
failures += ("FAIL: " + resStr)
// assert(res, resStr)
}
-
+
def runSeqs() = {
for (s1f <- seqMakers ; s2f <- seqMakers ; testData <- List(test1)) {
import testData._
val scrut = s1f(seq)
-
+
for (Method(f, (trueList, falseList), descr) <- methodList) {
for (s <- trueList; rhs = s2f(s))
assertOne(scrut, rhs, f(scrut, rhs), descr)
-
+
for (s <- falseList; rhs = s2f(s))
assertOne(scrut, rhs, !f(scrut, rhs), "!(" + descr + ")")
}
}
}
-
+
def main(args: Array[String]) {
runSeqs()
-
+
assert(failures.isEmpty, failures mkString "\n")
}
}
diff --git a/test/files/run/serialize-stream.scala b/test/files/run/serialize-stream.scala
index e424d5b629..3ab9f2df34 100644
--- a/test/files/run/serialize-stream.scala
+++ b/test/files/run/serialize-stream.scala
@@ -5,13 +5,13 @@ object Test {
val bos = new java.io.ByteArrayOutputStream()
val oos = new java.io.ObjectOutputStream(bos)
oos.writeObject(s)
-
+
val ois = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bos.toByteArray))
val obj = ois.readObject()
println(obj)
println(obj.asInstanceOf[Seq[T]].toList)
}
-
+
def main(args: Array[String]) {
ser(Stream(1, 2, 3))
ser(Stream(1))
diff --git a/test/files/run/settings-parse.check b/test/files/run/settings-parse.check
new file mode 100644
index 0000000000..18145c9100
--- /dev/null
+++ b/test/files/run/settings-parse.check
@@ -0,0 +1,566 @@
+0) List(-cp, ) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+1) List(-cp, , ) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+2) List(, -cp, ) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+3) List(-cp, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+4) List(-cp, , , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+5) List(-cp, , -deprecation, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+6) List(, -cp, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+7) List(-cp, , -deprecation, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+8) List(-cp, , , -deprecation, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+9) List(-cp, , -deprecation, , foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+10) List(-cp, , -deprecation, foo.scala, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+11) List(, -cp, , -deprecation, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+12) List(-cp, , foo.scala) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+13) List(-cp, , , foo.scala) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+14) List(-cp, , foo.scala, ) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+15) List(, -cp, , foo.scala) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+16) List(-cp, , foo.scala, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+17) List(-cp, , , foo.scala, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+18) List(-cp, , foo.scala, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+19) List(-cp, , foo.scala, -deprecation, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+20) List(, -cp, , foo.scala, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+21) List(-deprecation, -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+22) List(, -deprecation, -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+23) List(-deprecation, -cp, , ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+24) List(-deprecation, , -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+25) List(-deprecation, -cp, , foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+26) List(, -deprecation, -cp, , foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+27) List(-deprecation, -cp, , , foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+28) List(-deprecation, -cp, , foo.scala, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+29) List(-deprecation, , -cp, , foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+30) List(-deprecation, foo.scala, -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+31) List(, -deprecation, foo.scala, -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+32) List(-deprecation, , foo.scala, -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+33) List(-deprecation, foo.scala, -cp, , ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+34) List(-deprecation, foo.scala, , -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+35) List(foo.scala, -cp, ) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+36) List(, foo.scala, -cp, ) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+37) List(foo.scala, -cp, , ) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+38) List(foo.scala, , -cp, ) ==> Settings {
+ -d = .
+ -classpath = ""
+}
+
+39) List(foo.scala, -cp, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+40) List(, foo.scala, -cp, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+41) List(foo.scala, -cp, , , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+42) List(foo.scala, -cp, , -deprecation, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+43) List(foo.scala, , -cp, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+44) List(foo.scala, -deprecation, -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+45) List(, foo.scala, -deprecation, -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+46) List(foo.scala, , -deprecation, -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+47) List(foo.scala, -deprecation, -cp, , ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+48) List(foo.scala, -deprecation, , -cp, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = ""
+}
+
+0) List(-cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+1) List(-cp, /tmp:/bippy, ) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+2) List(, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+3) List(-cp, /tmp:/bippy, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+4) List(-cp, /tmp:/bippy, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+5) List(-cp, /tmp:/bippy, -deprecation, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+6) List(, -cp, /tmp:/bippy, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+7) List(-cp, /tmp:/bippy, -deprecation, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+8) List(-cp, /tmp:/bippy, , -deprecation, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+9) List(-cp, /tmp:/bippy, -deprecation, , foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+10) List(-cp, /tmp:/bippy, -deprecation, foo.scala, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+11) List(, -cp, /tmp:/bippy, -deprecation, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+12) List(-cp, /tmp:/bippy, foo.scala) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+13) List(-cp, /tmp:/bippy, , foo.scala) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+14) List(-cp, /tmp:/bippy, foo.scala, ) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+15) List(, -cp, /tmp:/bippy, foo.scala) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+16) List(-cp, /tmp:/bippy, foo.scala, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+17) List(-cp, /tmp:/bippy, , foo.scala, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+18) List(-cp, /tmp:/bippy, foo.scala, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+19) List(-cp, /tmp:/bippy, foo.scala, -deprecation, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+20) List(, -cp, /tmp:/bippy, foo.scala, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+21) List(-deprecation, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+22) List(, -deprecation, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+23) List(-deprecation, -cp, /tmp:/bippy, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+24) List(-deprecation, , -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+25) List(-deprecation, -cp, /tmp:/bippy, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+26) List(, -deprecation, -cp, /tmp:/bippy, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+27) List(-deprecation, -cp, /tmp:/bippy, , foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+28) List(-deprecation, -cp, /tmp:/bippy, foo.scala, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+29) List(-deprecation, , -cp, /tmp:/bippy, foo.scala) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+30) List(-deprecation, foo.scala, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+31) List(, -deprecation, foo.scala, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+32) List(-deprecation, , foo.scala, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+33) List(-deprecation, foo.scala, -cp, /tmp:/bippy, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+34) List(-deprecation, foo.scala, , -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+35) List(foo.scala, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+36) List(, foo.scala, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+37) List(foo.scala, -cp, /tmp:/bippy, ) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+38) List(foo.scala, , -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -classpath = /tmp:/bippy
+}
+
+39) List(foo.scala, -cp, /tmp:/bippy, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+40) List(, foo.scala, -cp, /tmp:/bippy, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+41) List(foo.scala, -cp, /tmp:/bippy, , -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+42) List(foo.scala, -cp, /tmp:/bippy, -deprecation, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+43) List(foo.scala, , -cp, /tmp:/bippy, -deprecation) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+44) List(foo.scala, -deprecation, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+45) List(, foo.scala, -deprecation, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+46) List(foo.scala, , -deprecation, -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+47) List(foo.scala, -deprecation, -cp, /tmp:/bippy, ) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
+48) List(foo.scala, -deprecation, , -cp, /tmp:/bippy) ==> Settings {
+ -d = .
+ -deprecation = true
+ -classpath = /tmp:/bippy
+}
+
diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala
new file mode 100644
index 0000000000..2754feb972
--- /dev/null
+++ b/test/files/run/settings-parse.scala
@@ -0,0 +1,29 @@
+
+import scala.language.postfixOps
+import scala.tools.nsc._
+
+object Test {
+ val tokens = List("", "-deprecation", "foo.scala")
+ val subsets = tokens.toSet.subsets.toList
+ val permutations0 = subsets.flatMap(_.toList.permutations).distinct
+
+ def runWithCp(cp: String) = {
+ val permutations = permutations0 flatMap ("-cp CPTOKEN" :: _ permutations)
+
+ for ((p, i) <- permutations.distinct.sortBy(_ mkString "").zipWithIndex) {
+ val args = p flatMap (_ split "\\s+") map (x => if (x == "CPTOKEN") cp else x)
+ val s = new settings.MutableSettings(println)
+ val (ok, residual) = s.processArguments(args, processAll = true)
+
+ val expected = args filter (_ == "foo.scala")
+ assert(residual == expected, residual)
+ assert(ok, args)
+ println(s"$i) $args ==> $s")
+ }
+ }
+
+ def main(args0: Array[String]): Unit = {
+ runWithCp("")
+ runWithCp("/tmp:/bippy")
+ }
+}
diff --git a/test/files/run/shortClass.check b/test/files/run/shortClass.check
new file mode 100644
index 0000000000..fbdb725cca
--- /dev/null
+++ b/test/files/run/shortClass.check
@@ -0,0 +1,10 @@
+bippity.bop.Foo
+bippity.bop.Foo$Bar
+bippity.bop.Foo$Bar$
+Test$$anon$1
+Test$$anon$2
+Foo
+Bar
+Bar$
+Foo with DingDongBippy
+Bar with DingDongBippy
diff --git a/test/files/run/shortClass.scala b/test/files/run/shortClass.scala
new file mode 100644
index 0000000000..b7bb016896
--- /dev/null
+++ b/test/files/run/shortClass.scala
@@ -0,0 +1,24 @@
+import scala.reflect.internal.util._
+
+package bippity {
+ trait DingDongBippy
+
+ package bop {
+ class Foo {
+ class Bar
+ object Bar
+ }
+ }
+}
+
+object Test {
+ import bippity._
+ import bop._
+
+ def main(args: Array[String]): Unit = {
+ val f = new Foo
+ val instances = List(f, new f.Bar, f.Bar, new Foo with DingDongBippy, new f.Bar with DingDongBippy)
+ instances map (_.getClass.getName) foreach println
+ instances map shortClassOfInstance foreach println
+ }
+}
diff --git a/test/files/run/showdecl.check b/test/files/run/showdecl.check
new file mode 100644
index 0000000000..b8d7f94c57
--- /dev/null
+++ b/test/files/run/showdecl.check
@@ -0,0 +1,34 @@
+compile-time
+uninitialized D: class D extends
+initialized D: class D extends C
+uninitialized x: val x: <?>
+initialized x: val x: Int
+uninitialized y: lazy val y: <?>
+initialized y: lazy val y: Int
+uninitialized z: def z: <?>
+initialized z: def z: Int
+uninitialized t: def t: <?>
+initialized t: def t[T <: Int](x: D)(y: x.W): Int
+uninitialized W: type W = String
+initialized W: type W = String
+uninitialized C: class C extends
+initialized C: class C extends D
+uninitialized O: object O
+initialized O: object O
+runtime
+autoinitialized D: class D extends C
+autoinitialized D: class D extends C
+autoinitialized x: val x: Int
+autoinitialized x: val x: Int
+autoinitialized y: lazy val y: Int
+autoinitialized y: lazy val y: Int
+autoinitialized z: def z: Int
+autoinitialized z: def z: Int
+autoinitialized t: def t[T <: Int](x: D)(y: x.W): Int
+autoinitialized t: def t[T <: Int](x: D)(y: x.W): Int
+autoinitialized W: type W = String
+autoinitialized W: type W = String
+autoinitialized C: class C extends D
+autoinitialized C: class C extends D
+autoinitialized O: object O
+autoinitialized O: object O
diff --git a/test/files/run/showdecl/Macros_1.scala b/test/files/run/showdecl/Macros_1.scala
new file mode 100644
index 0000000000..c68dd275de
--- /dev/null
+++ b/test/files/run/showdecl/Macros_1.scala
@@ -0,0 +1,30 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ var messages = List[String]()
+ def println(msg: String) = messages :+= msg
+
+ import c.universe._
+ def test(sym: Symbol): Unit = {
+ println(s"uninitialized ${sym.name}: ${showDecl(sym)}")
+ sym.info
+ println(s"initialized ${sym.name}: ${showDecl(sym)}")
+ }
+
+ println("compile-time")
+ test(c.mirror.staticClass("D"))
+ test(c.mirror.staticClass("D").info.member(TermName("x")))
+ test(c.mirror.staticClass("D").info.member(TermName("y")))
+ test(c.mirror.staticClass("D").info.member(TermName("z")))
+ test(c.mirror.staticClass("D").info.member(TermName("t")))
+ test(c.mirror.staticClass("D").info.member(TypeName("W")))
+ test(c.mirror.staticClass("D").info.member(TypeName("C")))
+ test(c.mirror.staticClass("D").info.member(TermName("O")))
+
+ q"..${messages.map(msg => q"println($msg)")}"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/showdecl/Test_2.scala b/test/files/run/showdecl/Test_2.scala
new file mode 100644
index 0000000000..6eb64baf34
--- /dev/null
+++ b/test/files/run/showdecl/Test_2.scala
@@ -0,0 +1,32 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+object Test extends App {
+ def test(sym: Symbol): Unit = {
+ println(s"autoinitialized ${sym.name}: ${showDecl(sym)}")
+ sym.info
+ println(s"autoinitialized ${sym.name}: ${showDecl(sym)}")
+ }
+
+ Macros.foo
+ println("runtime")
+ test(symbolOf[D])
+ test(typeOf[D].member(TermName("x")))
+ test(typeOf[D].member(TermName("y")))
+ test(typeOf[D].member(TermName("z")))
+ test(typeOf[D].member(TermName("t")))
+ test(typeOf[D].member(TypeName("W")))
+ test(typeOf[D].member(TypeName("C")))
+ test(typeOf[D].member(TermName("O")))
+}
+
+class C
+class D extends C {
+ val x = 2
+ lazy val y = 3
+ var z = 4
+ def t[T <: Int](x: D)(y: x.W) = 5
+ type W = String
+ class C extends D
+ object O extends C
+}
diff --git a/test/files/run/showraw_aliases.check b/test/files/run/showraw_aliases.check
index aebd354031..d6a198b1cb 100644
--- a/test/files/run/showraw_aliases.check
+++ b/test/files/run/showraw_aliases.check
@@ -1,2 +1,2 @@
-Block(List(Import(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), List(ImportSelector(newTermName("universe"), <offset>, newTermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), scala.reflect.runtime.package), [newTermName("universe") aka newTermName("ru")]))
-Block(List(Import(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), List(ImportSelector(newTermName("universe"), <offset>, newTermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), scala.reflect.runtime.package#<id>), [newTermName("universe")#<id> aka newTermName("ru")]))
+Block(List(Import(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), List(ImportSelector(TermName("universe"), <offset>, TermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), scala.reflect.runtime.package), [TermName("universe") aka TermName("ru")]))
+Block(List(Import(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), List(ImportSelector(TermName("universe"), <offset>, TermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), scala.reflect.runtime.package#<id>), [TermName("universe")#<id> aka TermName("ru")]))
diff --git a/test/files/run/showraw_aliases.scala b/test/files/run/showraw_aliases.scala
index 65b4fcb1cd..56bd13707d 100644
--- a/test/files/run/showraw_aliases.scala
+++ b/test/files/run/showraw_aliases.scala
@@ -7,7 +7,7 @@ object Test extends App {
import scala.reflect.runtime.{universe => ru}
ru
""")
- val ttree = tb.typeCheck(tree)
+ val ttree = tb.typecheck(tree)
def stabilizeIds(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>")
def stabilizePositions(s: String) = """\d+""".r.replaceAllIn(s, "<offset>")
diff --git a/test/files/run/showraw_mods.check b/test/files/run/showraw_mods.check
index 7fca027614..4d34160422 100644
--- a/test/files/run/showraw_mods.check
+++ b/test/files/run/showraw_mods.check
@@ -1 +1 @@
-Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), newTypeName("C"), List(), Template(List(Ident(newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), newTermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), newTermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), newTermName("y"), TypeTree(), Select(This(newTypeName("C")), newTermName("x"))), ValDef(Modifiers(LAZY), newTermName("z"), TypeTree(), Select(This(newTypeName("C")), newTermName("y"))))))), Literal(Constant(())))
+Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), TypeName("C"), List(), Template(List(Ident(TypeName("AnyRef"))), noSelfType, List(DefDef(Modifiers(), TermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), TermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), TermName("y"), TypeTree(), Select(This(TypeName("C")), TermName("x"))), ValDef(Modifiers(LAZY), TermName("z"), TypeTree(), Select(This(TypeName("C")), TermName("y"))))))), Literal(Constant(())))
diff --git a/test/files/run/showraw_tree.check b/test/files/run/showraw_tree.check
index b71018d4fe..d8cb1fde02 100644
--- a/test/files/run/showraw_tree.check
+++ b/test/files/run/showraw_tree.check
@@ -1,2 +1,2 @@
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Select(Ident(scala.Predef), newTypeName("String")), Select(Ident(scala.Predef), newTypeName("String"))))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Select(Ident(scala.Predef), newTypeName("String")), Select(Ident(scala.Predef), newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Select(Ident(scala.Predef), TypeName("String")), Select(Ident(scala.Predef), TypeName("String"))))), termNames.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Select(Ident(scala.Predef), TypeName("String")), Select(Ident(scala.Predef), TypeName("String"))))), termNames.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_ids.check b/test/files/run/showraw_tree_ids.check
index 5835ffa6de..d7a7aa5959 100644
--- a/test/files/run/showraw_tree_ids.check
+++ b/test/files/run/showraw_tree_ids.check
@@ -1,2 +1,2 @@
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Select(Ident(scala.Predef#<id>), newTypeName("String")), Select(Ident(scala.Predef#<id>), newTypeName("String"))))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Select(Ident(scala.Predef#<id>), newTypeName("String")), Select(Ident(scala.Predef#<id>), newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Select(Ident(scala.Predef#<id>), TypeName("String")), Select(Ident(scala.Predef#<id>), TypeName("String"))))), termNames.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Select(Ident(scala.Predef#<id>), TypeName("String")), Select(Ident(scala.Predef#<id>), TypeName("String"))))), termNames.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_kinds.check b/test/files/run/showraw_tree_kinds.check
index c4d66856d4..85939b02f0 100644
--- a/test/files/run/showraw_tree_kinds.check
+++ b/test/files/run/showraw_tree_kinds.check
@@ -1,2 +1,2 @@
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Select(Ident(scala.Predef#MOD), newTypeName("String")), Select(Ident(scala.Predef#MOD), newTypeName("String"))))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Select(Ident(scala.Predef#MOD), newTypeName("String")), Select(Ident(scala.Predef#MOD), newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Select(Ident(scala.Predef#MOD), TypeName("String")), Select(Ident(scala.Predef#MOD), TypeName("String"))))), termNames.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Select(Ident(scala.Predef#MOD), TypeName("String")), Select(Ident(scala.Predef#MOD), TypeName("String"))))), termNames.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_types_ids.check b/test/files/run/showraw_tree_types_ids.check
index fccb81d8df..75347463cb 100644
--- a/test/files/run/showraw_tree_types_ids.check
+++ b/test/files/run/showraw_tree_types_ids.check
@@ -1,12 +1,12 @@
-Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
-[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List()))))
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), TypeName("String")#<id>)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), TypeName("String")#<id>)))))), termNames.CONSTRUCTOR#<id>), List())
+[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()))))
[3] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List())
-[4] TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List())
+[4] TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List())
[5] SingleType(ThisType(scala#<id>), scala.Predef#<id>)
-Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
-[4] TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List())
+Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), TypeName("String")#<id>)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), TypeName("String")#<id>)))))), termNames.CONSTRUCTOR#<id>), List())
+[4] TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List())
[5] SingleType(ThisType(scala#<id>), scala.Predef#<id>)
-[6] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List())))
-[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), newTypeName("String")#<id>, List()))))
+[6] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List())))
+[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()))))
[8] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List())
diff --git a/test/files/run/showraw_tree_types_ids.scala b/test/files/run/showraw_tree_types_ids.scala
index 198729e705..883af0110a 100644
--- a/test/files/run/showraw_tree_types_ids.scala
+++ b/test/files/run/showraw_tree_types_ids.scala
@@ -6,6 +6,6 @@ object Test extends App {
val tree1 = reify(new collection.immutable.HashMap[String, String])
val tree2 = reify(new collection.mutable.HashMap[String, String])
def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>")
- println(stabilize(showRaw(tb.typeCheck(tree1.tree), printIds = true, printTypes = true)))
- println(stabilize(showRaw(tb.typeCheck(tree2.tree), printIds = true, printTypes = true)))
+ println(stabilize(showRaw(tb.typecheck(tree1.tree), printIds = true, printTypes = true)))
+ println(stabilize(showRaw(tb.typecheck(tree2.tree), printIds = true, printTypes = true)))
} \ No newline at end of file
diff --git a/test/files/run/showraw_tree_types_typed.check b/test/files/run/showraw_tree_types_typed.check
index f3e0f8c5f6..de691e369e 100644
--- a/test/files/run/showraw_tree_types_typed.check
+++ b/test/files/run/showraw_tree_types_typed.check
@@ -1,12 +1,12 @@
-Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), newTypeName("String"))), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), newTypeName("String"))))))), nme.CONSTRUCTOR), List())
-[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List()))))
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))))))), termNames.CONSTRUCTOR), List())
+[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()))))
[3] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List())
-[4] TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())
+[4] TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())
[5] SingleType(ThisType(scala), scala.Predef)
-Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), newTypeName("String"))), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), newTypeName("String"))))))), nme.CONSTRUCTOR), List())
-[4] TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())
+Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))))))), termNames.CONSTRUCTOR), List())
+[4] TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())
[5] SingleType(ThisType(scala), scala.Predef)
-[6] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())))
-[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List()))))
+[6] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())))
+[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()))))
[8] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List())
diff --git a/test/files/run/showraw_tree_types_typed.scala b/test/files/run/showraw_tree_types_typed.scala
index d7ccc84ea3..3dd696c77e 100644
--- a/test/files/run/showraw_tree_types_typed.scala
+++ b/test/files/run/showraw_tree_types_typed.scala
@@ -5,6 +5,6 @@ object Test extends App {
val tb = runtimeMirror(getClass.getClassLoader).mkToolBox()
val tree1 = reify(new collection.immutable.HashMap[String, String])
val tree2 = reify(new collection.mutable.HashMap[String, String])
- println(showRaw(tb.typeCheck(tree1.tree), printTypes = true))
- println(showRaw(tb.typeCheck(tree2.tree), printTypes = true))
+ println(showRaw(tb.typecheck(tree1.tree), printTypes = true))
+ println(showRaw(tb.typecheck(tree2.tree), printTypes = true))
} \ No newline at end of file
diff --git a/test/files/run/showraw_tree_types_untyped.check b/test/files/run/showraw_tree_types_untyped.check
index b71018d4fe..d8cb1fde02 100644
--- a/test/files/run/showraw_tree_types_untyped.check
+++ b/test/files/run/showraw_tree_types_untyped.check
@@ -1,2 +1,2 @@
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Select(Ident(scala.Predef), newTypeName("String")), Select(Ident(scala.Predef), newTypeName("String"))))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Select(Ident(scala.Predef), newTypeName("String")), Select(Ident(scala.Predef), newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Select(Ident(scala.Predef), TypeName("String")), Select(Ident(scala.Predef), TypeName("String"))))), termNames.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Select(Ident(scala.Predef), TypeName("String")), Select(Ident(scala.Predef), TypeName("String"))))), termNames.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_ultimate.check b/test/files/run/showraw_tree_ultimate.check
index a6286ba754..81efcc05ab 100644
--- a/test/files/run/showraw_tree_ultimate.check
+++ b/test/files/run/showraw_tree_ultimate.check
@@ -1,12 +1,12 @@
-Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#PCTOR), List())
-[1] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List()))))
-[3] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List())
-[4] TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List())
-[5] SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD)
-Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#CTOR), List())
-[4] TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List())
-[5] SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD)
-[6] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List())))
-[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PK), scala.Predef#<id>#MOD), newTypeName("String")#<id>#TPE, List()))))
-[8] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List())
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE)))))), termNames.CONSTRUCTOR#<id>#PCTOR), List())
+[1] TypeRef(ThisType(scala.collection.immutable#<id>#PKC), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PKC), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()))))
+[3] TypeRef(ThisType(scala.collection.immutable#<id>#PKC), scala.collection.immutable.HashMap#<id>#CLS, List())
+[4] TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List())
+[5] SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD)
+Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE)))))), termNames.CONSTRUCTOR#<id>#CTOR), List())
+[4] TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List())
+[5] SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD)
+[6] TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List())))
+[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()))))
+[8] TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List())
diff --git a/test/files/run/showraw_tree_ultimate.scala b/test/files/run/showraw_tree_ultimate.scala
index a8507623bc..e0d36e6bb7 100644
--- a/test/files/run/showraw_tree_ultimate.scala
+++ b/test/files/run/showraw_tree_ultimate.scala
@@ -6,6 +6,6 @@ object Test extends App {
val tree1 = reify(new collection.immutable.HashMap[String, String])
val tree2 = reify(new collection.mutable.HashMap[String, String])
def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>")
- println(stabilize(showRaw(tb.typeCheck(tree1.tree), printIds = true, printKinds = true, printTypes = true)))
- println(stabilize(showRaw(tb.typeCheck(tree2.tree), printIds = true, printKinds = true, printTypes = true)))
+ println(stabilize(showRaw(tb.typecheck(tree1.tree), printIds = true, printKinds = true, printTypes = true)))
+ println(stabilize(showRaw(tb.typecheck(tree2.tree), printIds = true, printKinds = true, printTypes = true)))
} \ No newline at end of file
diff --git a/test/files/run/slice-strings.scala b/test/files/run/slice-strings.scala
index 23085866f5..129314387a 100644
--- a/test/files/run/slice-strings.scala
+++ b/test/files/run/slice-strings.scala
@@ -1,7 +1,7 @@
-object Test {
+object Test {
def cmp(x1: String) = {
val x2 = x1.toList
-
+
-10 to 10 foreach { i =>
assert(x1.take(i) == x2.take(i).mkString)
assert(x1.drop(i) == x2.drop(i).mkString)
@@ -12,7 +12,7 @@ object Test {
assert(x1.slice(idx1, idx2) == x2.slice(idx1, idx2).mkString)
}
}
-
+
def main(args: Array[String]): Unit = {
cmp("abcde")
}
diff --git a/test/files/run/slices.scala b/test/files/run/slices.scala
index e31ea4046f..107b8e658a 100644
--- a/test/files/run/slices.scala
+++ b/test/files/run/slices.scala
@@ -1,3 +1,6 @@
+
+import scala.language.postfixOps
+
object Test extends App {
// lists
diff --git a/test/files/run/sm-interpolator.scala b/test/files/run/sm-interpolator.scala
index 7f7b9f061a..b99daa2a8b 100644
--- a/test/files/run/sm-interpolator.scala
+++ b/test/files/run/sm-interpolator.scala
@@ -1,14 +1,14 @@
object Test extends App {
import scala.reflect.internal.util.StringContextStripMarginOps
- def check(actual: Any, expected: Any) = if (actual != expected) sys.error(s"expected: [$expected], actual: [$actual])")
+ def check(actual: Any, expected: Any) = if (actual != expected) sys.error(s"\nexpected:\n$expected\n\nactual:\n$actual")
val bar = "|\n ||"
check(
- sm"""|ab
+ sm"""|ab
|de
|${bar} | ${1}""",
- "ab \nde\n|\n || | 1")
+ "ab\nde\n|\n || | 1")
check(
sm"|",
diff --git a/test/files/run/spec-nlreturn.scala b/test/files/run/spec-nlreturn.scala
index ec5e7229d3..5ab1747856 100644
--- a/test/files/run/spec-nlreturn.scala
+++ b/test/files/run/spec-nlreturn.scala
@@ -1,10 +1,11 @@
+
object Test {
def f(): Int = {
try {
- val g = 1 to 10 map { i => return 16 ; i } sum;
+ val g = (1 to 10 map { i => return 16 ; i }).sum
g
}
- catch { case x: runtime.NonLocalReturnControl[_] =>
+ catch { case x: runtime.NonLocalReturnControl[_] =>
println(x.getClass.getName)
x.value.asInstanceOf[Int]
}
diff --git a/test/files/run/static-module-method.check b/test/files/run/static-module-method.check
new file mode 100644
index 0000000000..ce01362503
--- /dev/null
+++ b/test/files/run/static-module-method.check
@@ -0,0 +1 @@
+hello
diff --git a/test/files/run/static-module-method.scala b/test/files/run/static-module-method.scala
new file mode 100644
index 0000000000..a8691300de
--- /dev/null
+++ b/test/files/run/static-module-method.scala
@@ -0,0 +1,14 @@
+// During development of delayed delambdafy there was a problem where
+// GenASM would eliminate a loadmodule for all methods defined within that module
+// even if those methods were static. This test would thus fail
+// with a verify error under -Ydelambdafy:method
+
+object Test {
+ def moduleMethod(x: String) = x
+
+ def map(x: String, f: String => String) = f(x)
+
+ def main(args: Array[String]) {
+ println(map("hello", Test.moduleMethod))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/streamWithFilter.scala b/test/files/run/streamWithFilter.scala
index 7f8f9a09d2..cb919d4f55 100644
--- a/test/files/run/streamWithFilter.scala
+++ b/test/files/run/streamWithFilter.scala
@@ -4,7 +4,7 @@ object Test {
def isBuzz(x: Int) = x % 5 == 0
// next line will run forever if withFilter isn't doing its thing.
val fizzbuzzes = for (n <- nums ; if isFizz(n) ; if isBuzz(n)) yield n
-
+
def main(args: Array[String]): Unit = {
fizzbuzzes take 5 foreach println
}
diff --git a/test/files/run/stream_flatmap_odds.scala b/test/files/run/stream_flatmap_odds.scala
index 6fb202ca68..1935253595 100644
--- a/test/files/run/stream_flatmap_odds.scala
+++ b/test/files/run/stream_flatmap_odds.scala
@@ -1,4 +1,4 @@
object Test extends App {
lazy val odds: Stream[Int] = Stream(1) append ( odds flatMap {x => Stream(x + 2)} )
- println(odds take 42 force)
+ Console println (odds take 42).force
}
diff --git a/test/files/run/stream_length.check b/test/files/run/stream_length.check
index 9906de773c..e4350aa741 100644
--- a/test/files/run/stream_length.check
+++ b/test/files/run/stream_length.check
@@ -1 +1,5 @@
+#partest !avian
Length: 970299
+#partest avian
+!!!TEST SKIPPED!!!
+See SI-7600 for further information.
diff --git a/test/files/run/stream_length.scala b/test/files/run/stream_length.scala
index 2808fbc495..33929f4b57 100644
--- a/test/files/run/stream_length.scala
+++ b/test/files/run/stream_length.scala
@@ -10,6 +10,10 @@ object Test {
}
def main(args: Array[String]) {
- println("Length: " + walk(3, "---").length)
+ if (scala.tools.partest.utils.Properties.isAvian) {
+ println("!!!TEST SKIPPED!!!")
+ println("See SI-7600 for further information.")
+ } else
+ println("Length: " + walk(3, "---").length)
}
}
diff --git a/test/files/run/streams.scala b/test/files/run/streams.scala
index 03b2622edd..350e103eab 100644
--- a/test/files/run/streams.scala
+++ b/test/files/run/streams.scala
@@ -41,7 +41,7 @@ object Test extends App {
def powers(x: Int) = if ((x&(x-1)) == 0) Some(x) else None
println(s3.flatMap(powers).reverse.head)
- // large enough to generate StackOverflows (on most systems)
+ // large enough to generate StackOverflows (on most systems)
// unless the following methods are tail call optimized.
val size = 100000
diff --git a/test/files/run/string-extractor.check b/test/files/run/string-extractor.check
new file mode 100644
index 0000000000..47f3722c86
--- /dev/null
+++ b/test/files/run/string-extractor.check
@@ -0,0 +1,9 @@
+by
+BY
+oTheClown
+nope
+1: ob
+2: obby
+2: OBBY
+3: BOBO
+3: TomTomTheClown
diff --git a/test/files/run/string-extractor.scala b/test/files/run/string-extractor.scala
new file mode 100644
index 0000000000..c0fe911ff3
--- /dev/null
+++ b/test/files/run/string-extractor.scala
@@ -0,0 +1,60 @@
+final class StringExtract(val s: String) extends AnyVal {
+ def isEmpty = (s eq null) || (s == "")
+ def get = this
+ def length = s.length
+ def lengthCompare(n: Int) = s.length compare n
+ def apply(idx: Int): Char = s charAt idx
+ def head: Char = s charAt 0
+ def tail: String = s drop 1
+ def drop(n: Int): StringExtract = new StringExtract(s drop n)
+
+ override def toString = s
+}
+
+final class ThreeStringExtract(val s: String) extends AnyVal {
+ def isEmpty = (s eq null) || (s == "")
+ def get: (List[Int], Double, ThreeStringExtract) = ((s.length :: Nil, s.length.toDouble, this))
+ def length = s.length
+ def lengthCompare(n: Int) = s.length compare n
+ def apply(idx: Int): Char = s charAt idx
+ def head: Char = s charAt 0
+ def tail: String = s drop 1
+ def drop(n: Int): ThreeStringExtract = new ThreeStringExtract(s drop n)
+
+ override def toString = s
+}
+
+
+object Bippy {
+ def unapplySeq(x: Any): StringExtract = new StringExtract("" + x)
+}
+object TripleBippy {
+ def unapplySeq(x: Any): ThreeStringExtract = new ThreeStringExtract("" + x)
+}
+
+object Test {
+ def f(x: Any) = x match {
+ case Bippy('B' | 'b', 'O' | 'o', 'B' | 'b', xs @ _*) => xs
+ case _ => "nope"
+ }
+
+ def g(x: Any): String = x match {
+ case TripleBippy(3 :: Nil, 3.0, 'b', chars @ _*) => "1: " + chars
+ case TripleBippy(5 :: Nil, 5.0, 'b' | 'B', chars @ _*) => "2: " + chars
+ case TripleBippy(_, _, chars @ _*) => "3: " + chars
+ case _ => "nope"
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f("Bobby"))
+ println(f("BOBBY"))
+ println(f("BoBoTheClown"))
+ println(f("TomTomTheClown"))
+
+ println(g("bob"))
+ println(g("bobby"))
+ println(g("BOBBY"))
+ println(g("BOBO"))
+ println(g("TomTomTheClown"))
+ }
+}
diff --git a/test/files/run/stringbuilder-drop.scala b/test/files/run/stringbuilder-drop.scala
index a9e5a71762..422fb2bc7c 100644
--- a/test/files/run/stringbuilder-drop.scala
+++ b/test/files/run/stringbuilder-drop.scala
@@ -1,7 +1,7 @@
object Test {
def main(args: Array[String]): Unit = {
- val s = (new StringBuilder ++= "hello world") dropRight 1 toString;
- assert(s == "hello worl")
+ val s = (new StringBuilder ++= "hello world") dropRight 1
+ assert("" + s == "hello worl")
}
}
diff --git a/test/files/run/stringbuilder.scala b/test/files/run/stringbuilder.scala
index ef85fc02a6..a98f9cf37d 100644
--- a/test/files/run/stringbuilder.scala
+++ b/test/files/run/stringbuilder.scala
@@ -1,21 +1,24 @@
+
+import scala.language.reflectiveCalls
+
object Test extends App {
val str = "ABCDEFGHIJKLMABCDEFGHIJKLM"
val surrogateStr = "an old Turkic letter: \uD803\uDC22"
-
- type SB = {
+
+ type SB = {
def indexOf(str: String): Int
def indexOf(str: String, fromIndex: Int): Int
def lastIndexOf(str: String): Int
def lastIndexOf(str: String, fromIndex: Int): Int
}
-
+
import scala.collection.mutable.{ StringBuilder => ScalaStringBuilder }
import java.lang.{ StringBuilder => JavaStringBuilder }
-
+
val sbScala = new ScalaStringBuilder() append str
val sbJava = new JavaStringBuilder() append str
val sbs: List[SB] = List[SB](sbScala, sbJava)
-
+
def sameAnswers(f: (SB) => Int) = assert(f(sbScala) == f(sbJava))
sameAnswers(_.indexOf(""))
@@ -31,10 +34,10 @@ object Test extends App {
sameAnswers(_.lastIndexOf("QZV"))
sameAnswers(_.lastIndexOf("GHI", 22))
sameAnswers(_.lastIndexOf("KLM", 22))
-
+
// testing that the "reverse" implementation avoids reversing surrogate pairs
- val jsb = new JavaStringBuilder(surrogateStr) reverse
- val ssb = new ScalaStringBuilder(surrogateStr) reverseContents ;
-
+ val jsb = new JavaStringBuilder(surrogateStr).reverse
+ val ssb = new ScalaStringBuilder(surrogateStr).reverseContents
+
assert(jsb.toString == ssb.toString)
}
diff --git a/test/files/run/stringinterpolation_macro-run.check b/test/files/run/stringinterpolation_macro-run.check
index be62c5780b..ead61e76ac 100644
--- a/test/files/run/stringinterpolation_macro-run.check
+++ b/test/files/run/stringinterpolation_macro-run.check
@@ -46,6 +46,8 @@ S
120
120
120
+ 0X4
+She is 4 feet tall.
120
42
3.400000e+00
@@ -60,3 +62,6 @@ S
05/26/12
05/26/12
05/26/12
+%
+7 7 9
+7 9 9
diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala
index 9c59c334f8..ff779dd1d3 100644
--- a/test/files/run/stringinterpolation_macro-run.scala
+++ b/test/files/run/stringinterpolation_macro-run.scala
@@ -1,3 +1,6 @@
+/*
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
object Test extends App {
// 'b' / 'B' (category: general)
@@ -69,6 +72,14 @@ println(f"${120 : java.lang.Integer}%d")
println(f"${120 : java.lang.Long}%d")
println(f"${BigInt(120)}%d")
println(f"${new java.math.BigInteger("120")}%d")
+println(f"${4}%#10X")
+
+locally {
+ val fff = new java.util.Formattable {
+ def formatTo(f: java.util.Formatter, g: Int, w: Int, p: Int) = f.format("4")
+ }
+ println(f"She is ${fff}%#s feet tall.")
+}
{
implicit val strToShort = (s: String) => java.lang.Short.parseShort(s)
@@ -100,4 +111,11 @@ println(f"${c.getTime.getTime}%TD")
implicit val strToDate = (x: String) => c
println(f"""${"1234"}%TD""")
+
+
+// literals and arg indexes
+println(f"%%")
+println(f"${7}%d %<d ${9}%d")
+println(f"${7}%d %2$$d ${9}%d")
+
}
diff --git a/test/files/run/structural.scala b/test/files/run/structural.scala
index 36af8c4bfc..7da104ca6e 100644
--- a/test/files/run/structural.scala
+++ b/test/files/run/structural.scala
@@ -1,18 +1,21 @@
+
+import scala.language.{ reflectiveCalls }
+
object test1 {
-
+
val o1 = new Object { override def toString = "ohone" }
val o2 = new Object { override def toString = "ohtwo" }
-
+
val t1 = new Tata("tieone")
val t2 = new Tata("tietwo")
-
+
class Tata(name: String) {
override def toString = name
def tatMe = "oy"
}
-
+
class Titi extends Tata("titi")
-
+
object Rec {
val a = 1
val b = 2
@@ -41,7 +44,7 @@ object test1 {
val y: Tata = null
def z(t: Tata) = ()
}
-
+
type rt = Object {
val a: Int;
val c: String;
@@ -65,7 +68,7 @@ object test1 {
var v: Int
val y: Tata
}
-
+
def l (r: rt) {
println(" 1. " + r.c)
println(" 2. " + r.a + 1)
@@ -94,33 +97,33 @@ object test1 {
println("25. " + r.y)
println("26. " + r.e(null))
}
-
+
/*def ma[T](r: Object{def e(x: T): T; val x: T}) {
println("30. " + r.e(r.x)) // static error
}*/
-
+
def mb(r: Object { def e[T](x: T): T }) {
println("31. " + r.e[Int](4)) // while this is ok
}
-
+
def m1(r: Object { def z(x: Tata): Unit }) {
println("32. " + r.z(new Titi)) // while this is ok
}
-
+
def m2[T](r: Object { def e(x: Tata): T; val x: Tata }) {
println("33. " + r.e(r.x)) // and this too
}
-
+
class Rec3[T] {
def e(x: T): T = x
}
-
+
def m3[T](r: Rec3[T], x: T) {
println("33. " + r.e(x)) // and this too
}
-
+
Rec.g(11)
-
+
this.l(Rec)
this.mb(new Object{def e[T](x: T): T = x})
this.m1(Rec)
@@ -132,7 +135,7 @@ object test2 {
class C extends { def f() { println("1") } }
val x1 = new C
x1.f()
-
+
abstract class D extends { def f() }
val x2 = new D { def f() { println("2") } }
x2.f()
@@ -152,45 +155,45 @@ object test2 {
object test3 {
- case class Exc extends Exception
-
+ case class Exc() extends Exception
+
object Rec {
def f = throw Exc()
}
-
+
def m(r: { def f: Nothing }) =
try {
r.f
}
catch {
case e: Exc => println("caught")
- case e => println(e)
+ case e: Throwable => println(e)
}
-
+
m(Rec)
-
+
}
object test4 {
class A
-
+
val aar = Array(new A, new A, new A)
val nar = Array(1, 2)
-
+
def f(p: {def size: Int}) = println(p.size)
//def g[T <: {def size: Int}](p: T) = println(p.size) // open issue
//def h[T <% {def size: Int}](p: T) = println(p.size) // open issue
-
+
f(aar)
f(nar)
-
+
//g(aar)
//g(nar)
-
+
//h(aar)
//h(nar)
-
+
}
object Test extends App {
diff --git a/test/files/run/synchronized.check b/test/files/run/synchronized.check
index dd9f4ef424..6e99739633 100644
--- a/test/files/run/synchronized.check
+++ b/test/files/run/synchronized.check
@@ -1,3 +1,4 @@
+warning: there were 14 inliner warning(s); re-run with -Yinline-warnings for details
.|. c1.f1: OK
.|. c1.fi: OK
.|... c1.fv: OK
diff --git a/test/files/run/synchronized.flags b/test/files/run/synchronized.flags
index 1182725e86..49d036a887 100644
--- a/test/files/run/synchronized.flags
+++ b/test/files/run/synchronized.flags
@@ -1 +1 @@
--optimize \ No newline at end of file
+-optimize
diff --git a/test/files/run/sysprops.scala b/test/files/run/sysprops.scala
index 4d98e2cdd0..bdad677221 100644
--- a/test/files/run/sysprops.scala
+++ b/test/files/run/sysprops.scala
@@ -3,16 +3,16 @@ import sys._
/** Basic sys.Prop test. */
object Test {
val key = "ding.dong.doobie"
-
+
def bool() = {
val prop = BooleanProp.valueIsTrue(key)
assert(prop.key == key)
-
+
prop.clear()
assert(!prop.value)
assert(!prop.isSet)
assert(prop.get != null)
-
+
prop set "dingus"
assert(prop.get == "dingus")
assert(!prop.value)
@@ -32,7 +32,7 @@ object Test {
prop.set("523")
assert(prop.value == 523)
prop.set("DingusInt")
-
+
try { println(prop.value) ; assert(false, "should not get here") }
catch { case _: Exception => () }
}
@@ -41,7 +41,7 @@ object Test {
prop.set("55.0")
assert(prop.value == 55.0)
}
-
+
def main(args: Array[String]): Unit = {
bool()
int()
diff --git a/test/files/run/t0017.scala b/test/files/run/t0017.scala
index e976f453d8..245cbb7e42 100644
--- a/test/files/run/t0017.scala
+++ b/test/files/run/t0017.scala
@@ -7,7 +7,7 @@ def transpose[A](arr: Array[Array[A]]) = {
var my_arr = Array(Array(1,2),Array(3,4))
-for (i <- Array.range(0, my_arr(0).length)) yield
+for (i <- Array.range(0, my_arr(0).length)) yield
for (row <- my_arr) yield row(i)
val transposed = transpose(my_arr)
diff --git a/test/files/run/t0091.check b/test/files/run/t0091.check
index 7ed6ff82de..fd3c81a4d7 100644
--- a/test/files/run/t0091.check
+++ b/test/files/run/t0091.check
@@ -1 +1,2 @@
5
+5
diff --git a/test/files/run/t0091.scala b/test/files/run/t0091.scala
index eaddde0dbf..45235eb77b 100644
--- a/test/files/run/t0091.scala
+++ b/test/files/run/t0091.scala
@@ -4,10 +4,13 @@ object C extends B {
object m extends A { def x = 5 }
}
object Test {
- // The type annotation here is necessary, otherwise
- // the compiler would reference C$m$ directly.
- def o : B = C
- def main(argv : Array[String]) : Unit = {
- println(o.m.x)
- }
+ // The type annotation here is necessary, otherwise
+ // the compiler would reference C$m$ directly.
+ def o1 : B = C
+ def o2 = C
+
+ def main(argv : Array[String]) : Unit = {
+ println(o1.m.x)
+ println(o2.m.x)
+ }
}
diff --git a/test/files/run/t0325.scala b/test/files/run/t0325.scala
index 92331ab05f..a126a3a204 100644
--- a/test/files/run/t0325.scala
+++ b/test/files/run/t0325.scala
@@ -7,7 +7,7 @@ case class RS(self: String) {
}
def split(separator: Char): Array[String] = self.split(escape(separator))
-
+
def split(separators: Array[Char]): Array[String] = {
val re = separators.foldLeft("[")(_+escape(_)) + "]"
self.split(re)
@@ -24,10 +24,10 @@ object Test {
else
println(ret)
} catch {
- case e@_ => println(which + " failed with " + e.getClass)
+ case e: Throwable => println(which + " failed with " + e.getClass)
}
}
-
+
def main(args: Array[String]) {
val badChars = "?*{+([\\^.$"
@@ -46,8 +46,8 @@ object Test {
for ((c,str) <- badCases)
test(("a"+c+"b").split(str.toArray),"RichString split(\""+ str + "\")")
println
-
+
for ((c,str) <- badCases)
- test(RS("a"+c+"b").split(str.toArray),"RS split(\""+ str + "\")")
+ test(RS("a"+c+"b").split(str.toArray),"RS split(\""+ str + "\")")
}
}
diff --git a/test/files/run/t0421-old.scala b/test/files/run/t0421-old.scala
index 8d51013924..dde89bc542 100644
--- a/test/files/run/t0421-old.scala
+++ b/test/files/run/t0421-old.scala
@@ -1,4 +1,6 @@
// ticket #421
+
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
def transpose[A: ClassManifest](xss: Array[Array[A]]) = {
@@ -7,17 +9,17 @@ object Test extends App {
}
def scalprod(xs: Array[Double], ys: Array[Double]) = {
- var acc = 0.0
- for ((x, y) <- xs zip ys) acc = acc + x * y
+ var acc = 0.0
+ for ((x, y) <- xs zip ys) acc = acc + x * y
acc
}
def matmul(xss: Array[Array[Double]], yss: Array[Array[Double]]) = {
- val ysst = transpose(yss)
+ val ysst = transpose(yss)
val ysst1: Array[Array[Double]] = yss.transpose
assert(ysst.deep == ysst1.deep)
for (xs <- xss) yield
- for (yst <- ysst) yield
+ for (yst <- ysst) yield
scalprod(xs, yst)
}
@@ -25,6 +27,6 @@ object Test extends App {
println(transpose(a1).deep.mkString("[", ",", "]"))
println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deep.mkString("[", ",", "]"))
-
+
println(matmul(Array(Array(4)), Array(Array(6, 8))).deep.mkString("[", ",", "]"))
}
diff --git a/test/files/run/t0432.scala b/test/files/run/t0432.scala
index 8ba9015d81..b860a0874f 100644
--- a/test/files/run/t0432.scala
+++ b/test/files/run/t0432.scala
@@ -1,3 +1,6 @@
+
+import scala.language.reflectiveCalls
+
object Test {
type valueType = { def value: this.type }
diff --git a/test/files/run/t0486.check b/test/files/run/t0486.check
deleted file mode 100644
index dd1ec28223..0000000000
--- a/test/files/run/t0486.check
+++ /dev/null
@@ -1,8 +0,0 @@
-<wsdl:definitions name="service1" xmlns:tns="target1">
- </wsdl:definitions>
-<wsdl:definitions name="service2" xmlns:tns="target2">
- </wsdl:definitions>
-<wsdl:definitions name="service3" xmlns:tns="target3">
- </wsdl:definitions>
-<wsdl:definitions name="service4" xmlns:tns="target4">
- </wsdl:definitions>
diff --git a/test/files/run/t0486.scala b/test/files/run/t0486.scala
deleted file mode 100644
index d3ed8f4225..0000000000
--- a/test/files/run/t0486.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-object Test extends App {
- import scala.xml._
-
- def wsdlTemplate1(serviceName: String): Node =
- <wsdl:definitions name={serviceName} xmlns:tns = { "target1" } >
- </wsdl:definitions>;
-
- def wsdlTemplate2(serviceName: String, targetNamespace: String): Node =
- <wsdl:definitions name={serviceName} xmlns:tns = { targetNamespace } >
- </wsdl:definitions>;
-
- def wsdlTemplate3(serviceName: String): Node =
- <wsdl:definitions name={serviceName} xmlns:tns = { Text("target3") } >
- </wsdl:definitions>;
-
- def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node =
- <wsdl:definitions name={serviceName} xmlns:tns = { targetNamespace() } >
- </wsdl:definitions>;
-
- println(wsdlTemplate1("service1"))
- println(wsdlTemplate2("service2", "target2"))
- println(wsdlTemplate3("service3"))
- println(wsdlTemplate4("service4", () => "target4"))
-}
diff --git a/test/files/run/t0508.scala b/test/files/run/t0508.scala
index 0f4325e629..2283c46c36 100644
--- a/test/files/run/t0508.scala
+++ b/test/files/run/t0508.scala
@@ -9,5 +9,5 @@ object Test extends App {
}
}
- foo(Foo.unapply, Foo("this might be fun", 10))
+ foo(Foo.unapply, Foo("this might be fun", 10))
}
diff --git a/test/files/run/t0528.scala b/test/files/run/t0528.scala
index a76f602ed3..68a9975173 100644
--- a/test/files/run/t0528.scala
+++ b/test/files/run/t0528.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ existentials }
trait Sequ[A] {
def toArray: Array[T forSome {type T <: A}]
}
diff --git a/test/files/run/t0631.scala b/test/files/run/t0631.scala
index 5bceab6193..c401ed31cb 100644
--- a/test/files/run/t0631.scala
+++ b/test/files/run/t0631.scala
@@ -1,5 +1,5 @@
object Test extends App {
- class Foo {
+ class Foo {
override def equals(that: Any) = {
println("Foo.equals called")
super.equals(that)
diff --git a/test/files/run/t0663.check b/test/files/run/t0663.check
deleted file mode 100755
index dd9be2af70..0000000000
--- a/test/files/run/t0663.check
+++ /dev/null
@@ -1 +0,0 @@
-<feed/>
diff --git a/test/files/run/t0663.scala b/test/files/run/t0663.scala
deleted file mode 100644
index dd0326d4e3..0000000000
--- a/test/files/run/t0663.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test extends App {
- val src = scala.io.Source.fromString("<?xml version='1.0' encoding='UTF-8'?><feed/>")
- val parser = xml.parsing.ConstructingParser.fromSource(src, true)
- println(parser.document)
-}
-
diff --git a/test/files/run/t0668.check b/test/files/run/t0668.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t0668.check
+++ /dev/null
diff --git a/test/files/run/t0677-old.scala b/test/files/run/t0677-old.scala
index 6c8a3a7e99..8d4c3ee060 100644
--- a/test/files/run/t0677-old.scala
+++ b/test/files/run/t0677-old.scala
@@ -1,5 +1,8 @@
+
+
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
- class X[T: ClassManifest] {
+ class X[T: ClassManifest] {
val a = Array.ofDim[T](3, 4)
}
val x = new X[String]
diff --git a/test/files/run/t0700.check b/test/files/run/t0700.check
deleted file mode 100644
index b4eabbab1a..0000000000
--- a/test/files/run/t0700.check
+++ /dev/null
@@ -1,2 +0,0 @@
-[3.2] parsed: List(2, 2, 2)
-[3.2] parsed: List(2, 2, 2)
diff --git a/test/files/run/t0700.scala b/test/files/run/t0700.scala
deleted file mode 100644
index 5a7180528c..0000000000
--- a/test/files/run/t0700.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import java.io.{File,StringReader}
-
-import scala.util.parsing.combinator.Parsers
-import scala.util.parsing.input.{CharArrayReader, StreamReader}
-
-class TestParsers extends Parsers {
- type Elem = Char
-
- def p: Parser[List[Int]] = rep(p1 | p2)
- def p1: Parser[Int] = 'a' ~ nl ~ 'b' ~ nl ^^^ 1
- def p2: Parser[Int] = 'a' ~ nl ^^^ 2
- def nl: Parser[Int] = rep(accept('\n') | accept('\r')) ^^^ 0
-}
-
-object Test {
- def main(args: Array[String]): Unit = {
- val tstParsers = new TestParsers
- val s = "a\na\na"
- val r1 = new CharArrayReader(s.toCharArray())
- val r2 = StreamReader(new StringReader(s))
- println(tstParsers.p(r1))
- println(tstParsers.p(r2))
- }
-}
diff --git a/test/files/run/t0807.scala b/test/files/run/t0807.scala
index 1a1add6b3a..1e2a26664a 100644
--- a/test/files/run/t0807.scala
+++ b/test/files/run/t0807.scala
@@ -1,5 +1,5 @@
trait A
-trait B extends A { val x = println("early") }
+trait B extends A { val x = println("early") }
object Test extends App {
new B {}
}
diff --git a/test/files/run/t0883.scala b/test/files/run/t0883.scala
index adde95197b..c8ed06dbfe 100644
--- a/test/files/run/t0883.scala
+++ b/test/files/run/t0883.scala
@@ -1,14 +1,14 @@
object Foo { def apply(x: String) = new Foo(x) }
class Foo(name: String)
case object Bar extends Foo("Bar")
-case class Baz() extends Foo("Baz")
+case class Baz() extends Foo("Baz")
object Test extends App {
- Foo("Bar") match {
- case Bar => println("What?")
+ Foo("Bar") match {
+ case Bar => println("What?")
case _ => println("OK")
}
- Foo("Baz") match {
- case Baz() => println("What?")
+ Foo("Baz") match {
+ case Baz() => println("What?")
case _ => println("OK")
- }
+ }
}
diff --git a/test/files/run/t1005.scala b/test/files/run/t1005.scala
index 60129bcc51..562e2e4c6d 100644
--- a/test/files/run/t1005.scala
+++ b/test/files/run/t1005.scala
@@ -1,19 +1,20 @@
+import scala.language.postfixOps
object Test
{
class Foo[T](x : Array[AnyRef]) { def bar = x.asInstanceOf[Array[T]] }
class Bar[T](x : Array[T]) { def bar = x.asInstanceOf[Array[AnyRef]] }
object FromMono{
- def main(args : Array[String]) = (new Foo[AnyRef](Array[AnyRef]("Halp!"))).bar
+ def mainer(args : Array[String]) = (new Foo[AnyRef](Array[AnyRef]("Halp!"))).bar
}
object FromPoly{
- def main(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar
+ def mainer(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar
}
-
+
def main(args: Array[String]): Unit = {
- println(FromMono main null mkString)
- println(FromPoly main null mkString)
+ println(FromMono mainer null mkString)
+ println(FromPoly mainer null mkString)
}
}
diff --git a/test/files/run/t1042.scala b/test/files/run/t1042.scala
index 1f39fff24a..302ff31053 100644
--- a/test/files/run/t1042.scala
+++ b/test/files/run/t1042.scala
@@ -6,7 +6,7 @@ abstract class A {
case class B() extends A {
// overloaded version is implemented, causing toString not to be implemented?
- def toString(sb: StringBuilder): StringBuilder = error("")
+ def toString(sb: StringBuilder): StringBuilder = sys.error("")
}
object Test extends App {
diff --git a/test/files/run/t107.check b/test/files/run/t107.check
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/test/files/run/t107.check
@@ -0,0 +1 @@
+1
diff --git a/test/files/run/t107.scala b/test/files/run/t107.scala
new file mode 100644
index 0000000000..ab1b289882
--- /dev/null
+++ b/test/files/run/t107.scala
@@ -0,0 +1,8 @@
+object Test {
+ def main(args : Array[String]) : Unit = {
+ var hash : Long = 0
+ val bytes = Array(1.toByte, 2.toByte, 3.toByte)
+ hash += bytes(0)
+ Console.println(hash)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t1079.check b/test/files/run/t1079.check
deleted file mode 100644
index c508d5366f..0000000000
--- a/test/files/run/t1079.check
+++ /dev/null
@@ -1 +0,0 @@
-false
diff --git a/test/files/run/t1079.scala b/test/files/run/t1079.scala
deleted file mode 100644
index ce435d254b..0000000000
--- a/test/files/run/t1079.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test extends App {
- println(<t user:tag=""/> == <t user:tag="X"/>)
-}
diff --git a/test/files/run/t1100.check b/test/files/run/t1100.check
deleted file mode 100644
index d3a49a47df..0000000000
--- a/test/files/run/t1100.check
+++ /dev/null
@@ -1,4 +0,0 @@
-[1.4] error: errors are propagated
-
-aaab
- ^
diff --git a/test/files/run/t1100.scala b/test/files/run/t1100.scala
deleted file mode 100644
index 6b95fd6ecb..0000000000
--- a/test/files/run/t1100.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import scala.util.parsing.combinator.Parsers
-import scala.util.parsing.input.CharSequenceReader
-
-class TestParsers extends Parsers {
- type Elem = Char
-
- def p: Parser[List[Char]] = rep1(p1)
- def p1: Parser[Char] = accept('a') | err("errors are propagated")
-}
-
-object Test {
- def main(args: Array[String]): Unit = {
- val tstParsers = new TestParsers
- val s = new CharSequenceReader("aaab")
- println(tstParsers.p(s))
- }
-}
diff --git a/test/files/run/t1110.scala b/test/files/run/t1110.scala
index 824643868c..81917789c8 100644
--- a/test/files/run/t1110.scala
+++ b/test/files/run/t1110.scala
@@ -1,8 +1,12 @@
+
+
+import scala.language.{ reflectiveCalls }
+
class Stuff {
def zoop(p: Any{def &(q: Int): Int}) = p & 7
def floop = new { def & = "Hello" }
- assert((floop &) == "Hello")
+ assert((floop.&) == "Hello")
assert(zoop(10) == 2)
}
diff --git a/test/files/run/t1141.scala b/test/files/run/t1141.scala
index ee4f2e7fd2..732c57943c 100644
--- a/test/files/run/t1141.scala
+++ b/test/files/run/t1141.scala
@@ -1,7 +1,11 @@
+
+
+import scala.language.reflectiveCalls
+
object Test extends App {
val foo = new {
def apply(args : String*) = args foreach println
}
-
+
foo("var", "args")
}
diff --git a/test/files/run/t1167.flags b/test/files/run/t1167.flags
new file mode 100644
index 0000000000..ac96850b69
--- /dev/null
+++ b/test/files/run/t1167.flags
@@ -0,0 +1 @@
+-Ydelambdafy:inline \ No newline at end of file
diff --git a/test/files/run/t1167.scala b/test/files/run/t1167.scala
index c2ec4cff4e..3dd0a30c00 100644
--- a/test/files/run/t1167.scala
+++ b/test/files/run/t1167.scala
@@ -10,17 +10,17 @@ trait Test1 {
/* getName
* Returns the binary name of the class if this class object represents a
- * reference type that is not an array type.
+ * reference type that is not an array type.
* getSimpleName
* Returns the simple name of the underlying class as given in the source
* code. Returns an empty string if the underlying class is anonymous.
*/
abstract class Foo {
override def toString = getClass.getSimpleName
-
+
abstract class Bar {
override def toString = getClass.getSimpleName
- }
+ }
}
object Test extends App {
diff --git a/test/files/run/t1195-new.scala b/test/files/run/t1195-new.scala
index 0f62b140c9..fcb80082a2 100644
--- a/test/files/run/t1195-new.scala
+++ b/test/files/run/t1195-new.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ existentials }
import scala.reflect.runtime.universe._
object Test {
@@ -9,7 +11,7 @@ object Test {
val g1 = g()
val h1 = h()
- def m[T: WeakTypeTag](x: T) = println(weakTypeOf[T] + ", underlying = " + weakTypeOf[T].typeSymbol.typeSignature)
+ def m[T: WeakTypeTag](x: T) = println(weakTypeOf[T] + ", underlying = " + weakTypeOf[T].typeSymbol.info)
def main(args: Array[String]): Unit = {
m(f)
@@ -25,4 +27,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/t1195-old.scala b/test/files/run/t1195-old.scala
index b46a3b70f5..f80734c228 100644
--- a/test/files/run/t1195-old.scala
+++ b/test/files/run/t1195-old.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ existentials }
+
object Test {
def f() = { case class Bar(x: Int); Bar }
def g() = { case class Bar(x: Int); Bar(5) }
diff --git a/test/files/run/t1220.scala b/test/files/run/t1220.scala
index 0ba188d02d..75e0ea07e8 100644
--- a/test/files/run/t1220.scala
+++ b/test/files/run/t1220.scala
@@ -1,7 +1,7 @@
object Test extends App {
class QSRichIterable[A](self: Iterable[A]) {
- def filterMap[R](f: PartialFunction[A,R]) =
+ def filterMap[R](f: PartialFunction[A,R]) =
self filter (f.isDefinedAt) map f
}
diff --git a/test/files/run/t1300.scala b/test/files/run/t1300.scala
index ce2f80eb4e..aa3580e33c 100644
--- a/test/files/run/t1300.scala
+++ b/test/files/run/t1300.scala
@@ -4,10 +4,10 @@ object Test extends App
// val a1 = x1.toArray[Any]
val a2 = Array('a','b','c','d').toArray[Any]
val a3 = Array("e","f","g","h").toArray[Any]
-
+
Array.copy(a3, 0, a1, 0, 4)
Array.copy(a2, 0, a3, 0, 4)
Array.copy(a2, 0, a1, 0, 4)
-
+
println(a1.mkString + a2.mkString + a3.mkString)
}
diff --git a/test/files/run/t1309.scala b/test/files/run/t1309.scala
index b6a75fe6ae..84963549a2 100644
--- a/test/files/run/t1309.scala
+++ b/test/files/run/t1309.scala
@@ -1,6 +1,6 @@
object Test {
def f(ras: => IndexedSeq[Byte]): IndexedSeq[Byte] = ras
-
+
def main(args: Array[String]): Unit = {
f(new Array[Byte](0))
}
diff --git a/test/files/run/t1323.scala b/test/files/run/t1323.scala
index 8209b85219..94b51bd2a4 100644
--- a/test/files/run/t1323.scala
+++ b/test/files/run/t1323.scala
@@ -3,9 +3,9 @@ object Test extends App {
println(" 2:" + List(1,2,3,4).indexOfSlice(List(1,2))) // 0
println(" 3:" + List(1,2,3,4).indexOfSlice(List(2,3))) // 1
println(" 4:" + List(1,2,3,4).indexOfSlice(List(3,4))) // 2
- println(" 5:" + List(1,2,3,4).indexOfSlice(List(4,5))) // -1
+ println(" 5:" + List(1,2,3,4).indexOfSlice(List(4,5))) // -1
println(" 6:" + List(1,2,3,4).indexOfSlice(List(2,4))) // -1
- println(" 7:" + List(1,2,3,4).indexOfSlice(List(4,3))) // -1
+ println(" 7:" + List(1,2,3,4).indexOfSlice(List(4,3))) // -1
println(" 8:" + List(1,2,3,4).indexOfSlice(List(1,3))) // -1
println(" 9:" + List(1,2,3,4).indexOfSlice(List(1,3))) // -1
println("10:" + List(1,2,3,4).indexOfSlice(List(1,2,3,4))) // 0
diff --git a/test/files/run/t1333.scala b/test/files/run/t1333.scala
index 514b4ffc8a..1696629cbb 100644
--- a/test/files/run/t1333.scala
+++ b/test/files/run/t1333.scala
@@ -1,11 +1,11 @@
object Test {
case class A(x: Int)(y: Int)(z: String)
-
+
def f(x: Any) = x match {
case A(x) => x
case _ => -1
}
-
+
def main(args: Array[String]): Unit = {
println(f(A(10)(20)("abc")))
println(f(A(-10)(20)("abc")))
diff --git a/test/files/run/t1368.check b/test/files/run/t1368.check
new file mode 100644
index 0000000000..581e8a4039
--- /dev/null
+++ b/test/files/run/t1368.check
@@ -0,0 +1,3 @@
+t1368.scala:7: warning: Reference to uninitialized value blurp
+ def go3 = (new AnyRef with Happy with Sad { override val status = blurp ; val blurp = "happysad" }).status
+ ^
diff --git a/test/files/run/t1423.scala b/test/files/run/t1423.scala
index 44c6653287..073483aeee 100644
--- a/test/files/run/t1423.scala
+++ b/test/files/run/t1423.scala
@@ -5,4 +5,4 @@ object Test extends App{
case 1L => println(1);
case _ => println("????");
}
-}
+}
diff --git a/test/files/run/t1427.check b/test/files/run/t1427.check
new file mode 100644
index 0000000000..11a3d2f4a9
--- /dev/null
+++ b/test/files/run/t1427.check
@@ -0,0 +1,3 @@
+t1427.scala:6: warning: abstract type X in type pattern Bob[_[_] <: Any] is unchecked since it is eliminated by erasure
+ case x: (Bob[X] forSome { type X[_] }) => true
+ ^
diff --git a/test/files/run/t1427.scala b/test/files/run/t1427.scala
index 21bd71ffef..4b8057ffe8 100644
--- a/test/files/run/t1427.scala
+++ b/test/files/run/t1427.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ higherKinds }
+
class Bob[K[_]] {
def foo(other: Any) = other match {
case x: (Bob[X] forSome { type X[_] }) => true
@@ -9,7 +12,7 @@ object Test {
def main(args: Array[String]): Unit = {
val x = new Bob[List]
val results = List(x, new Bob[Set], 55) map (x foo _)
-
+
assert(results == List(true, true, false))
}
}
diff --git a/test/files/run/t1430/Bar_1.java b/test/files/run/t1430/Bar_1.java
index 4db2eafcbd..e49b6becb2 100644
--- a/test/files/run/t1430/Bar_1.java
+++ b/test/files/run/t1430/Bar_1.java
@@ -2,7 +2,7 @@ package j;
interface Foo {
public void foo();
-}
+}
public interface Bar_1 extends Foo {
public void bar();
-}
+}
diff --git a/test/files/run/t1430/Test_2.scala b/test/files/run/t1430/Test_2.scala
index 7af65de5cd..278d9c7fd3 100644
--- a/test/files/run/t1430/Test_2.scala
+++ b/test/files/run/t1430/Test_2.scala
@@ -6,7 +6,7 @@ package s {
class Baz(x: j.Bar_1) {
x.foo
override def toString = "Baz"
- }
+ }
}
object Test {
diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala
index ab132b724f..30c026f70f 100644
--- a/test/files/run/t1500.scala
+++ b/test/files/run/t1500.scala
@@ -6,7 +6,7 @@ object Test {
* Type inference overlooks constraints posed by type parameters in annotations on types.
*/
- val testCode = <code>
+ val testCode = """
class posingAs[A] extends annotation.TypeConstraint
@@ -14,14 +14,14 @@ object Test {
val x = resolve(7: @posingAs[Any])
- </code>.text
+ """
- def main(args: Array[String]) = {
+ def main(args: Array[String]) {
val settings = new Settings()
settings.classpath.value = System.getProperty("java.class.path")
val tool = new interpreter.IMain(settings)
- val global = tool.compiler
+ val global = tool.global
import global._
import definitions._
diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala
index aba206bc7a..ca6bf357fb 100644
--- a/test/files/run/t1501.scala
+++ b/test/files/run/t1501.scala
@@ -6,7 +6,7 @@ object Test {
* ...
*/
- val testCode = <code>
+ val testCode = """
class xyz[A] extends annotation.TypeConstraint
@@ -25,13 +25,13 @@ object Test {
}}
}}
- </code>.text
+ """
- def main(args: Array[String]) = {
+ def main(args: Array[String]) {
val settings = new Settings()
settings.classpath.value = System.getProperty("java.class.path")
val tool = new interpreter.IMain(settings)
- val global = tool.compiler
+ val global = tool.global
import global._
import definitions._
diff --git a/test/files/run/t1503.check b/test/files/run/t1503.check
new file mode 100644
index 0000000000..43eceb0229
--- /dev/null
+++ b/test/files/run/t1503.check
@@ -0,0 +1 @@
+whoops
diff --git a/test/files/run/t1503.scala b/test/files/run/t1503.scala
new file mode 100644
index 0000000000..1be0e74ac2
--- /dev/null
+++ b/test/files/run/t1503.scala
@@ -0,0 +1,20 @@
+object Whatever {
+ override def equals(x: Any) = true
+}
+
+object Test extends App {
+ // this should make it abundantly clear Any is the best return type we can guarantee
+ def matchWhatever(x: Any): Any = x match { case n @ Whatever => n }
+ // when left to its own devices, and not under -Xfuture, the return type is Whatever.type
+ def matchWhateverCCE(x: Any) = x match { case n @ Whatever => n }
+
+ // just to exercise it a bit
+ assert(matchWhatever(1) == 1)
+ assert(matchWhatever("1") == "1")
+
+ try {
+ matchWhateverCCE("1"): Whatever.type
+ } catch {
+ case _: ClassCastException => println("whoops")
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t1503_future.flags b/test/files/run/t1503_future.flags
new file mode 100644
index 0000000000..112fc720a0
--- /dev/null
+++ b/test/files/run/t1503_future.flags
@@ -0,0 +1 @@
+-Xfuture \ No newline at end of file
diff --git a/test/files/run/t1503_future.scala b/test/files/run/t1503_future.scala
new file mode 100644
index 0000000000..1e3daad761
--- /dev/null
+++ b/test/files/run/t1503_future.scala
@@ -0,0 +1,17 @@
+object Whatever {
+ override def equals(x: Any) = true
+}
+
+object Test extends App {
+ // this should make it abundantly clear Any is the best return type we can guarantee
+ def matchWhatever(x: Any): Any = x match { case n @ Whatever => n }
+ // when left to its own devices, and not under -Xfuture, the return type is Whatever.type
+ def matchWhateverCCE(x: Any) = x match { case n @ Whatever => n }
+
+ // just to exercise it a bit
+ assert(matchWhatever(1) == 1)
+ assert(matchWhatever("1") == "1")
+
+ assert(matchWhateverCCE(1) == 1)
+ assert(matchWhateverCCE("1") == "1")
+} \ No newline at end of file
diff --git a/test/files/run/t1505.scala b/test/files/run/t1505.scala
index a246e8a35b..4afbb99ef7 100644
--- a/test/files/run/t1505.scala
+++ b/test/files/run/t1505.scala
@@ -1,5 +1,3 @@
-object P extends Enumeration(0, "A", "B", "C") { val A, B, C = Value }
-
object Q extends Enumeration {
val A = Value("A")
val B = Value("B")
@@ -11,9 +9,14 @@ object R extends Enumeration {
}
object Test extends App {
- assert(P(0) == P.withName("A"))
- assert(P.C == P.withName("C"))
-
assert(Q(0) == Q.withName("A"))
assert(Q.C == Q.withName("C"))
+
+ assert(R(0) == R.withName("A"))
+ assert(R.C == R.withName("C"))
+
+ var failed = false
+ try { Q.withName("x") } catch { case _: NoSuchElementException => failed = true }
+ assert(failed)
+
}
diff --git a/test/files/run/t153.scala b/test/files/run/t153.scala
index 82492fdbe6..3fdb423865 100644
--- a/test/files/run/t153.scala
+++ b/test/files/run/t153.scala
@@ -1,5 +1,5 @@
object Test extends App {
def powers(x: Int) = if ((x&(x-1))==0) Some(x) else None
val res = (Stream.range(1, 500000) flatMap powers).reverse
- println(res take 42 force)
+ println((res take 42).force)
}
diff --git a/test/files/run/t1537.scala b/test/files/run/t1537.scala
index ddbfb29ac4..1dce501990 100644
--- a/test/files/run/t1537.scala
+++ b/test/files/run/t1537.scala
@@ -4,15 +4,15 @@ trait Syntax {
trait Evaluation {
val syntax: Syntax
-
+
def equalInTrait = this.syntax.Foo == this.syntax.Foo
}
object Test extends Evaluation with App {
- object syntax extends Syntax
+ object syntax extends Syntax
def equalInObject = this.syntax.Foo == this.syntax.Foo
-
+
println(equalInTrait)
println(equalInObject)
}
diff --git a/test/files/run/t1591.scala b/test/files/run/t1591.scala
index bd43f0b23d..6dd9605042 100644
--- a/test/files/run/t1591.scala
+++ b/test/files/run/t1591.scala
@@ -1,8 +1,8 @@
abstract class A {
-
+
lazy val lazyBar = bar
-
- object bar {
+
+ object bar {
val foo = 12
}
diff --git a/test/files/run/t1620.check b/test/files/run/t1620.check
deleted file mode 100755
index afa1e6acd5..0000000000
--- a/test/files/run/t1620.check
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!DOCTYPE foo PUBLIC "-//Foo Corp//DTD 1.0//EN" "foo.dtd">
-<foo/>
-<?xml version='1.0' encoding='utf-8'?>
-<!DOCTYPE foo PUBLIC "-//Foo Corp//DTD 1.0//EN">
-<foo/>
diff --git a/test/files/run/t1620.scala b/test/files/run/t1620.scala
deleted file mode 100644
index e8ea06eb5f..0000000000
--- a/test/files/run/t1620.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-import java.io.PrintWriter
-import scala.xml.XML
-import scala.xml.dtd.{DocType, PublicID}
-
-object Test extends App {
- val dt = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq())
- val pw = new PrintWriter(System.out)
- XML.write(pw, <foo/>, "utf-8", true, dt)
- pw.println()
- pw.flush()
-
- val dt2 = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq())
- XML.write(pw, <foo/>, "utf-8", true, dt2)
- pw.println()
- pw.flush()
-}
diff --git a/test/files/run/t1718.scala b/test/files/run/t1718.scala
index 358bd1be5a..d1b19c38cd 100644
--- a/test/files/run/t1718.scala
+++ b/test/files/run/t1718.scala
@@ -1,10 +1,10 @@
object Test extends App{
- def matchesNull[T](mightBeNull: Array[T]): Boolean = mightBeNull match {
+ def matchesNull[T](mightBeNull: Array[T]): Boolean = mightBeNull match {
case null => true
case x => false
}
val nullArray: Array[String] = null
- println(matchesNull(nullArray))
+ println(matchesNull(nullArray))
}
diff --git a/test/files/run/t1766.scala b/test/files/run/t1766.scala
index 2afd883755..ff81da3f8e 100644
--- a/test/files/run/t1766.scala
+++ b/test/files/run/t1766.scala
@@ -1,16 +1,19 @@
+
+import scala.language.{ reflectiveCalls }
+
object Test extends App {
-
+
class C(s: String) {
-
+
def this(i: Int) = this("bar")
-
+
def f = {
val v: { def n: Int } = new { val n = 3 }
v.n
}
-
+
}
-
+
new C("foo").f
-
+
}
diff --git a/test/files/run/t1773.scala b/test/files/run/t1773.scala
deleted file mode 100644
index c50b62512f..0000000000
--- a/test/files/run/t1773.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Test extends App
-{
- val xs = List(
- <a></a>,
- <a/>,
- <a>{ xml.NodeSeq.Empty }</a>,
- <a>{""}</a>,
- <a>{ if (true) "" else "I like turtles" }</a>
- )
-
- for (x1 <- xs; x2 <- xs) assert (x1 xml_== x2)
-}
diff --git a/test/files/run/t1829.check b/test/files/run/t1829.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t1829.check
+++ /dev/null
diff --git a/test/files/run/t1829.scala b/test/files/run/t1829.scala
index 7c39d33ae9..8240527424 100644
--- a/test/files/run/t1829.scala
+++ b/test/files/run/t1829.scala
@@ -1,6 +1,6 @@
object Test{
def main(args : Array[String]){
- import scala.collection.immutable._
+ import scala.collection.immutable._
assert(IntMap.empty == HashMap.empty);
assert(HashMap.empty == IntMap.empty);
assert(LongMap.empty == HashMap.empty);
diff --git a/test/files/run/t1909.check b/test/files/run/t1909.check
new file mode 100644
index 0000000000..7d25be60fd
--- /dev/null
+++ b/test/files/run/t1909.check
@@ -0,0 +1,3 @@
+t1909.scala:7: warning: A try without a catch or finally is equivalent to putting its body in a block; no exceptions are handled.
+ def this(p: String) = this(try 0)
+ ^
diff --git a/test/files/run/t1909.scala b/test/files/run/t1909.scala
new file mode 100644
index 0000000000..8ead7bacf2
--- /dev/null
+++ b/test/files/run/t1909.scala
@@ -0,0 +1,12 @@
+// Until #1909 is fixed, if this compiles the bytecode
+// will trigger a VerifyError. This liftings and the one
+// in 1909b.scala actually happen in two different places
+// (uncurry and lambdalifter.)
+class Ticket1909 {
+ def this(value: Int) = this()
+ def this(p: String) = this(try 0)
+}
+
+object Test extends App {
+ new Ticket1909("")
+}
diff --git a/test/files/run/t1909b.scala b/test/files/run/t1909b.scala
new file mode 100644
index 0000000000..89b2af57dc
--- /dev/null
+++ b/test/files/run/t1909b.scala
@@ -0,0 +1,9 @@
+class Ticket1909 (x: Int) {
+ def this() = this({
+ def bar() = 5
+ bar
+ })
+}
+object Test extends App {
+ new Ticket1909()
+}
diff --git a/test/files/run/t1909c.scala b/test/files/run/t1909c.scala
new file mode 100644
index 0000000000..87c0eb08b5
--- /dev/null
+++ b/test/files/run/t1909c.scala
@@ -0,0 +1,9 @@
+class Base(a: Any)
+
+// java.lang.VerifyError: (class: Sub, method: <init> signature: ()V) Expecting to find object/array on stack
+// at Test$.<init>(t1909c.scala)
+class Sub() extends Base({ def bippy = 5; bippy })
+
+object Test extends App {
+ new Sub()
+}
diff --git a/test/files/run/t1987.scala b/test/files/run/t1987.scala
index 4c278ec6a0..de869edea0 100644
--- a/test/files/run/t1987.scala
+++ b/test/files/run/t1987.scala
@@ -5,7 +5,7 @@ package foo {
package object bar {
def duh(n: Long) = println("long")
def duh(n: Double) = println("double")
-
+
def duh2(n: Double) = println("double")
def duh2(n: Long) = println("long")
}
@@ -16,7 +16,7 @@ package foo {
bip.bar.duh(33L)
duh(33d)
bip.bar.duh(33d)
-
+
duh2(33L)
bip.bar.duh2(33L)
duh2(33d)
@@ -35,7 +35,7 @@ package bip {
def duh2(n: Double) = println("double")
def duh2(n: Long) = println("long")
}
-
+
package object bar extends Duh with Duh2 { }
package bar {
object Main {
@@ -44,7 +44,7 @@ package bip {
bip.bar.duh(33L)
duh(33d)
bip.bar.duh(33d)
-
+
duh2(33L)
bip.bar.duh2(33L)
duh2(33d)
diff --git a/test/files/run/t2029.scala b/test/files/run/t2029.scala
index 1cbe97a350..32b04f0b47 100644
--- a/test/files/run/t2029.scala
+++ b/test/files/run/t2029.scala
@@ -3,10 +3,10 @@ object Test{
import scala.collection.immutable.TreeSet;
val mainSet = TreeSet(1 to 5 :_*)
-
+
var compareCalled = false;
val smallerSet = TreeSet(2 to 4 :_*)(Ordering[Int].reverse)
-
+
println(mainSet.mkString(","))
println(smallerSet.mkString(","))
println(smallerSet.subsetOf(mainSet));
diff --git a/test/files/run/t2074_2.scala b/test/files/run/t2074_2.scala
index 1f59e0b8a1..4624170f89 100644
--- a/test/files/run/t2074_2.scala
+++ b/test/files/run/t2074_2.scala
@@ -12,7 +12,7 @@ object Test {
def iterator = underlying.iterator
}
val w = IndexedSeq(1, 2, 3).view
-
+
def main(args: Array[String]): Unit = {
println(v)
println(w)
diff --git a/test/files/run/t2087-and-2400.scala b/test/files/run/t2087-and-2400.scala
index 93cd633ffb..19a5df26e3 100644
--- a/test/files/run/t2087-and-2400.scala
+++ b/test/files/run/t2087-and-2400.scala
@@ -3,14 +3,14 @@ object Test
def negativeCharMaker = new (Short => Char) { def apply(x: Short) = x.toChar }
def main(args: Array[String]): Unit = {
// throws exception if -100 gets to Character.valueOf
- val x = negativeCharMaker(-100)
-
+ val x = negativeCharMaker(-100)
+
// chars are unsigned, they should never be equal to negative values
assert((-100).toShort != (-100).toChar)
assert((-100).toChar != (-100).toShort)
assert((-100).toChar != (-100).toByte)
assert((-100).toByte != (-100).toChar)
-
+
// BoxesRunTime must agree as well
assert(((-100).toShort: Any) != (-100).toChar)
assert(((-100).toChar: Any) != (-100).toShort)
diff --git a/test/files/run/t2106.check b/test/files/run/t2106.check
new file mode 100644
index 0000000000..f8f625ff46
--- /dev/null
+++ b/test/files/run/t2106.check
@@ -0,0 +1,6 @@
+t2106.scala:7: warning: Could not inline required method foo because access level required by callee not matched by caller.
+ def main(args: Array[String]): Unit = x.foo
+ ^
+t2106.scala:7: warning: At the end of the day, could not inline @inline-marked method foo
+ def main(args: Array[String]): Unit = x.foo
+ ^
diff --git a/test/files/run/t2106.flags b/test/files/run/t2106.flags
index eb4d19bcb9..00d3643fd4 100644
--- a/test/files/run/t2106.flags
+++ b/test/files/run/t2106.flags
@@ -1 +1 @@
--optimise \ No newline at end of file
+-optimise -Yinline-warnings
diff --git a/test/files/run/t2106.scala b/test/files/run/t2106.scala
index e8124dabab..55b89da805 100644
--- a/test/files/run/t2106.scala
+++ b/test/files/run/t2106.scala
@@ -4,5 +4,5 @@ class A extends Cloneable {
object Test {
val x = new A
- def main(args: Array[String]) = x.foo
+ def main(args: Array[String]): Unit = x.foo
}
diff --git a/test/files/run/t2124.check b/test/files/run/t2124.check
deleted file mode 100755
index 51b40469aa..0000000000
--- a/test/files/run/t2124.check
+++ /dev/null
@@ -1 +0,0 @@
-<p><lost/><q/></p>
diff --git a/test/files/run/t2124.scala b/test/files/run/t2124.scala
deleted file mode 100644
index a4fd654d76..0000000000
--- a/test/files/run/t2124.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-import scala.xml._
-
-import scala.xml.transform._
-
-object Test {
- val sampleXml = <p><lost/><t><s><r></r></s></t></p>
-
- def main(args: scala.Array[String]) {
-
- println(new RuleTransformer(new RewriteRule {
-
- override def transform(n: Node): NodeSeq = {
- val result = n match {
- case <t>{_*}</t> => <q/>
-
- case n => n
-
- }
-// println ("Rewriting '" +n+ "' to: '" + result+ "'")
-
- result
- }
- }).transform(sampleXml))
- }
-}
diff --git a/test/files/run/t2125.check b/test/files/run/t2125.check
deleted file mode 100755
index 51b40469aa..0000000000
--- a/test/files/run/t2125.check
+++ /dev/null
@@ -1 +0,0 @@
-<p><lost/><q/></p>
diff --git a/test/files/run/t2125.scala b/test/files/run/t2125.scala
deleted file mode 100644
index a10ed9827b..0000000000
--- a/test/files/run/t2125.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-import scala.xml._
-
-import scala.xml.transform._
-
-object Test {
-
- val sampleXml = <xml:group><p><lost/><t><s><r></r></s></t></p></xml:group>
-
- def main(args: scala.Array[String]) {
- println(new RuleTransformer(new RewriteRule {
-
- override def transform(n: Node): NodeSeq = {
-
- val result = n match {
-
- case <t>{_*}</t> => <q/>
-
- case n => n
- }
-// println ("Rewriting '" +n+ "' to: '" + result+ "'")
- result
- }
- }).transform(sampleXml))
- }
-}
diff --git a/test/files/run/t2212.check b/test/files/run/t2212.check
index 302bd0b6a8..8ab4d60ab3 100644
--- a/test/files/run/t2212.check
+++ b/test/files/run/t2212.check
@@ -1,3 +1,4 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
LinkedList(1)
LinkedList(1)
true
diff --git a/test/files/run/t2251.check b/test/files/run/t2251.check
new file mode 100644
index 0000000000..55ad2a5857
--- /dev/null
+++ b/test/files/run/t2251.check
@@ -0,0 +1 @@
+Set(List(List(C), Stream(D, ?)))
diff --git a/test/files/run/t2251.flags b/test/files/run/t2251.flags
new file mode 100644
index 0000000000..19243266d1
--- /dev/null
+++ b/test/files/run/t2251.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/test/files/run/t2251.scala b/test/files/run/t2251.scala
new file mode 100644
index 0000000000..00c5619b49
--- /dev/null
+++ b/test/files/run/t2251.scala
@@ -0,0 +1,19 @@
+class A
+trait B[T <: B[T]] extends A
+class C extends B[C] { override def toString = "C" }
+class D extends B[D] { override def toString = "D" }
+
+class E {
+ val ys = List(List(new C), Stream(new D))
+}
+
+object Test {
+ def trav = List(List(), Stream())
+
+ def main(args: Array[String]): Unit = {
+ val f = (new E).ys _
+ var xs: Set[List[_ <: Seq[B[_]]]] = Set()
+ xs += f()
+ println(xs)
+ }
+}
diff --git a/test/files/run/t2251b.check b/test/files/run/t2251b.check
new file mode 100644
index 0000000000..4231fc6ea6
--- /dev/null
+++ b/test/files/run/t2251b.check
@@ -0,0 +1,11 @@
+TypeTag[List[scala.collection.immutable.LinearSeq[B[_ >: D with C <: B[_ >: D with C <: A]]] with scala.collection.AbstractSeq[B[_ >: D with C <: B[_ >: D with C <: A]]] with java.io.Serializable]]
+TypeTag[List[scala.collection.immutable.Iterable[B[_ >: F with E with D with C <: B[_ >: F with E with D with C <: A]]] with F with Int => Any]]
+TypeTag[List[scala.collection.immutable.Seq[B[_ >: D with C <: B[_ >: D with C <: A]]] with scala.collection.AbstractSeq[B[_ >: D with C <: B[_ >: D with C <: A]]] with Serializable]]
+TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]]
+TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]]
+TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]]
+TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]]
+TypeTag[List[scala.collection.Map[_ >: F with C <: B[_ >: F with C <: B[_ >: F with C <: A]], B[_ >: G with D <: B[_ >: G with D <: A]]]]]
+TypeTag[List[scala.collection.AbstractSeq[B[_ >: G with F <: B[_ >: G with F <: A]]] with scala.collection.LinearSeq[B[_ >: G with F <: B[_ >: G with F <: A]]] with java.io.Serializable]]
+TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]]
+TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]]
diff --git a/test/files/run/t2251b.flags b/test/files/run/t2251b.flags
new file mode 100644
index 0000000000..19243266d1
--- /dev/null
+++ b/test/files/run/t2251b.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/test/files/run/t2251b.scala b/test/files/run/t2251b.scala
new file mode 100644
index 0000000000..b67b3aec1e
--- /dev/null
+++ b/test/files/run/t2251b.scala
@@ -0,0 +1,48 @@
+class A
+trait B[T <: B[T]] extends A
+class B1[T <: B1[T]] extends B[T]
+class C extends B[C] { override def toString = "C" }
+class D extends B[D] { override def toString = "D" }
+class E extends B[E] { override def toString = "E" }
+class F extends B[F] { override def toString = "F" }
+class G extends B1[G] { override def toString = "G" }
+
+object Test {
+ import scala.collection.{ mutable, immutable }
+ import scala.collection.immutable.{ Vector }
+ import scala.reflect.runtime.universe._
+ def what[T: TypeTag](x: T) = println(typeTag[T])
+
+ def main(args: Array[String]): Unit = {
+ what(List(List(new C), Stream(new D)))
+ what(List(List(new C), Stream(new D), Vector(new E), Set(new F)))
+ what(List(immutable.Vector(new C), Stream(new D)))
+ what(List(collection.Set(new F), mutable.Set(new G)))
+ what(List(collection.Set(new F), immutable.Set(new G)))
+ what(List(mutable.Set(new F), immutable.Set(new G)))
+ what(List(mutable.Seq(new F), immutable.Seq(new G)))
+ what(List(mutable.Map(new C -> new D), immutable.Map(new F -> new G)))
+ what(List(mutable.MutableList(new F), immutable.List(new G)))
+ what(List(mutable.Seq(new F), collection.Seq(new G)))
+ what(List(mutable.LinearSeq(new F), collection.IndexedSeq(new G)))
+ }
+}
+
+
+// class D extends B[D] { override def toString = "D" }
+
+
+// class E {
+// val ys = List(List(new C), Stream(new D))
+// }
+
+// object Test {
+// def trav = List(List(), Stream())
+
+// def main(args: Array[String]): Unit = {
+// val f = (new E).ys _
+// var xs: Set[List[_ <: Seq[B[_]]]] = Set()
+// xs += f()
+// println(xs)
+// }
+// }
diff --git a/test/files/run/t2276.check b/test/files/run/t2276.check
deleted file mode 100644
index 95f51c8e29..0000000000
--- a/test/files/run/t2276.check
+++ /dev/null
@@ -1,8 +0,0 @@
-<root>
- <subnode>
- <version>2</version>
- </subnode>
- <contents>
- <version>2</version>
- </contents>
- </root>
diff --git a/test/files/run/t2276.scala b/test/files/run/t2276.scala
deleted file mode 100644
index f0404e5fab..0000000000
--- a/test/files/run/t2276.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import scala.xml._
-import scala.xml.transform._
-
-object Test extends App {
- val inputXml : Node =
- <root>
- <subnode>
- <version>1</version>
- </subnode>
- <contents>
- <version>1</version>
- </contents>
- </root>
-
- object t1 extends RewriteRule {
- override def transform(n: Node): Seq[Node] = n match {
- case <version>{x}</version> if x.toString.toInt < 4 => <version>{x.toString.toInt+1}</version>
- case other => other
- }
- }
-
- val ruleTransformer = new RuleTransformer(t1)
- println(ruleTransformer(inputXml))
-}
diff --git a/test/files/run/t2296c/Action.java b/test/files/run/t2296c/Action.java
index 50ba9a4de1..4a6b69a5b8 100644
--- a/test/files/run/t2296c/Action.java
+++ b/test/files/run/t2296c/Action.java
@@ -8,7 +8,7 @@ public abstract class Action {
public Action(Global glob0) {
m_glob = glob0;
}
-
+
public Action() {
this(null);
}
diff --git a/test/files/run/t2308a.scala b/test/files/run/t2308a.scala
index abb568064a..d1144db37d 100644
--- a/test/files/run/t2308a.scala
+++ b/test/files/run/t2308a.scala
@@ -1,7 +1,9 @@
+
+import scala.language.{ higherKinds }
object Test {
trait T[M[_]]
-
+
def f1 = classOf[T[X] forSome { type X[_] } ]
-
+
def main(args: Array[String]): Unit = println(f1)
}
diff --git a/test/files/run/t2318.check b/test/files/run/t2318.check
new file mode 100644
index 0000000000..a486f1ac47
--- /dev/null
+++ b/test/files/run/t2318.check
@@ -0,0 +1,2 @@
+bar
+bar
diff --git a/test/files/run/t2318.scala b/test/files/run/t2318.scala
new file mode 100644
index 0000000000..b638c433f5
--- /dev/null
+++ b/test/files/run/t2318.scala
@@ -0,0 +1,41 @@
+import java.security._
+
+import scala.language.{ reflectiveCalls }
+
+object Test {
+ trait Bar { def bar: Unit }
+
+ object Mgr extends SecurityManager {
+ override def checkPermission(perm: Permission) = perm match {
+ case _: java.lang.RuntimePermission => ()
+ case _: java.io.FilePermission => ()
+ case x: java.security.SecurityPermission if x.getName contains ".networkaddress." => () // generality ftw
+ case x: java.util.PropertyPermission if x.getName == "sun.net.inetaddr.ttl" => ()
+ case _ => super.checkPermission(perm)
+ }
+ }
+
+ def t1() = {
+ val p = Runtime.getRuntime().exec("ls");
+ type Destroyable = { def destroy() : Unit }
+ def doDestroy( obj : Destroyable ) : Unit = obj.destroy();
+ doDestroy( p );
+ }
+ def t2() = {
+ System.setSecurityManager(Mgr)
+
+ val b = new Bar { def bar = println("bar") }
+ b.bar
+
+ val structural = b.asInstanceOf[{ def bar: Unit }]
+ structural.bar
+ }
+
+ def main(args: Array[String]) {
+ // figuring this will otherwise break on windows
+ try t1()
+ catch { case _: java.io.IOException => () }
+
+ t2()
+ }
+}
diff --git a/test/files/run/t2333.scala b/test/files/run/t2333.scala
index da43386572..7dc7a92df2 100644
--- a/test/files/run/t2333.scala
+++ b/test/files/run/t2333.scala
@@ -1,7 +1,7 @@
class A {
def whatever() {
lazy val a = 1
- lazy val b = try { 2 } catch { case _ => 0 }
+ lazy val b = try { 2 } catch { case _: Throwable => 0 }
a
b
@@ -13,4 +13,4 @@ object Test {
val a = new A
a.whatever
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/t2337.scala b/test/files/run/t2337.scala
index 86a372ce56..edb574cba4 100644
--- a/test/files/run/t2337.scala
+++ b/test/files/run/t2337.scala
@@ -10,7 +10,7 @@ object Test {
// throw new Exception("Unsupported compare " + first + "; " + second)
}
}
-
+
def main(args: Array[String]): Unit = {
println("Both Int", -1, compare(0, 1))
println("Both Float", 1, compare(1.0, 0.0))
diff --git a/test/files/run/t2354.scala b/test/files/run/t2354.scala
deleted file mode 100644
index 5419911ac3..0000000000
--- a/test/files/run/t2354.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import scala.xml.parsing._
-import scala.io.Source
-
-object Test
-{
- val xml_good = "<title><![CDATA[Hello [tag]]]></title>"
- val xml_bad = "<title><![CDATA[Hello [tag] ]]></title>"
-
- val parser1 = ConstructingParser.fromSource(Source.fromString(xml_good),false)
- val parser2 = ConstructingParser.fromSource(Source.fromString(xml_bad),false)
-
- def main(args: Array[String]): Unit = {
- parser1.document
- parser2.document
- }
-}
-
diff --git a/test/files/run/t2417.scala b/test/files/run/t2417.scala
index 2d0bc2d405..8d1527e2d6 100644
--- a/test/files/run/t2417.scala
+++ b/test/files/run/t2417.scala
@@ -1,6 +1,6 @@
// #2417
object Test {
-
+
def parallel(numThreads: Int)(block: => Unit) {
var failure: Throwable = null
val threads = Array.tabulate(numThreads)(i => new Thread {
@@ -8,7 +8,7 @@ object Test {
try {
block
} catch {
- case x => failure = x
+ case x: Throwable => failure = x
}
}
})
@@ -16,7 +16,7 @@ object Test {
for (t <- threads) t.join
if (failure != null) println("FAILURE: " + failure)
}
-
+
def testSet(initialSize: Int, numThreads: Int, passes: Int) {
val orig = Set.empty ++ (1 to initialSize)
parallel(numThreads) {
@@ -32,7 +32,7 @@ object Test {
}
}
}
-
+
def testMap(initialSize: Int, numThreads: Int, passes: Int) {
val orig = Map.empty ++ ((1 to initialSize) map ((_,"v")))
parallel(numThreads) {
@@ -48,28 +48,28 @@ object Test {
}
}
}
-
+
def main(args: Array[String]) {
println("testing small Map that doesn't promote to HashMap...")
testMap(4, 2, 1000000)
println()
-
+
println("testing single-threaded HashMap use...")
testMap(5, 1, 1000000)
println()
-
+
println("testing HashMap.size from multiple threads...")
testMap(5, 2, 1000000)
println()
-
+
println("testing small Set that doesn't promote to HashSet...")
testSet(4, 2, 1000000)
println()
-
+
println("testing single-threaded HashSet use...")
testSet(5, 1, 1000000)
println()
-
+
println("testing HashSet.size from multiple threads...")
testSet(5, 2, 1000000)
println()
diff --git a/test/files/run/t2464/Annotated.java b/test/files/run/t2464/Annotated.java
new file mode 100644
index 0000000000..d022f9852c
--- /dev/null
+++ b/test/files/run/t2464/Annotated.java
@@ -0,0 +1,5 @@
+package test;
+
+@Connect(loadStyle = Connect.LoadStyle.EAGER)
+public class Annotated {
+}
diff --git a/test/files/run/t2464/Connect.java b/test/files/run/t2464/Connect.java
new file mode 100644
index 0000000000..59349f94c8
--- /dev/null
+++ b/test/files/run/t2464/Connect.java
@@ -0,0 +1,20 @@
+package test;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Connect {
+
+ LoadStyle loadStyle() default LoadStyle.EAGER;
+
+ public enum LoadStyle {
+ EAGER,
+ DEFERRED,
+ LAZY
+ }
+}
diff --git a/test/files/run/t2464/Test.scala b/test/files/run/t2464/Test.scala
new file mode 100644
index 0000000000..90e1a03c17
--- /dev/null
+++ b/test/files/run/t2464/Test.scala
@@ -0,0 +1,35 @@
+import scala.reflect.io.Streamable
+import scala.tools.asm.{ClassWriter, ClassReader}
+import scala.tools.asm.tree.ClassNode
+import scala.tools.partest._
+import scala.tools.partest.BytecodeTest.modifyClassFile
+import java.io.{FileOutputStream, FileInputStream, File}
+
+object Test extends DirectTest {
+ def code = ???
+
+ def compileCode(code: String) = {
+ val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
+ compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code)
+ }
+
+ def app = """
+ object O {
+ new test.Annotated
+ }
+ """
+
+ def show(): Unit = {
+ compileCode(app)
+ modifyClassFile(new File(testOutput.toFile, "test/Annotated.class")) {
+ (cn: ClassNode) =>
+ // As investigated https://issues.scala-lang.org/browse/SI-2464?focusedCommentId=64521&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-64521
+ // classfiles in the wild sometimes lack the required InnerClass attribute for nested enums that
+ // are referenced in an annotation. I don't know what compiler or bytecode processor leaves things
+ // that way, but this test makes sure we don't crash.
+ cn.innerClasses.clear()
+ cn
+ }
+ compileCode(app)
+ }
+}
diff --git a/test/files/run/t2512.scala b/test/files/run/t2512.scala
index de20af5e72..8166839a9a 100644
--- a/test/files/run/t2512.scala
+++ b/test/files/run/t2512.scala
@@ -3,11 +3,11 @@ import scala.tools.nsc.util.HashSet
object Test {
val runs = 10000
class Bop
-
+
def main(args: Array[String]): Unit = {
val set: HashSet[Bop] = HashSet("Bop", 16)
(1 to runs).toList foreach (_ => set addEntry new Bop)
-
+
assert(runs == set.size && set.size == set.iterator.length)
}
}
diff --git a/test/files/run/t2514.scala b/test/files/run/t2514.scala
index 21c4afb472..0bf716e8bb 100644
--- a/test/files/run/t2514.scala
+++ b/test/files/run/t2514.scala
@@ -1,7 +1,11 @@
+
+
+import scala.language.{ implicitConversions, postfixOps, reflectiveCalls }
+
object Test
{
implicit def x[A](a: A) = new { def xx = a }
-
+
def main(args: Array[String]): Unit = {
val r1 = 12 xx;
val r2 = 12.xx
@@ -9,7 +13,7 @@ object Test
val r4 = 12.xx + 12.xx
val r5 = 12.`xx` + 12.xx
val r6 = 12.3.`xx` + 12.xx
-
+
assert(r5 == 24)
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/t2526.scala b/test/files/run/t2526.scala
index d37185535f..53f3059135 100644
--- a/test/files/run/t2526.scala
+++ b/test/files/run/t2526.scala
@@ -4,18 +4,18 @@
*/
object Test {
import collection._
-
+
def main(args: Array[String]) {
val m = new mutable.HashMap[String, String]
-
+
/* Use non hash-based structure for verification */
val keys = List("a", "b", "c", "d", "e")
val valueSuffix = "value"
val values = keys.map(_ + valueSuffix)
val entries = keys.zip(values)
-
+
for (k <- keys) m(k) = k + valueSuffix
-
+
assertForeach(keys, m.keySet.iterator)
assertForeach(keys, m.keysIterator)
assertForeach(keys, m.keySet)
@@ -25,7 +25,7 @@ object Test {
assertForeach(entries, m)
}
-
+
/* Checks foreach of `actual` goes over all the elements in `expected` */
private def assertForeach[E](expected: Traversable[E], actual: Iterator[E]): Unit = {
val notYetFound = new mutable.ArrayBuffer[E]() ++= expected
@@ -35,12 +35,12 @@ object Test {
}
assert(notYetFound.size == 0, "mutable.HashMap.foreach should have iterated over: " + notYetFound)
}
-
- /*
+
+ /*
* Checks foreach of `actual` goes over all the elements in `expected`
* We duplicate the method above because there is no common inteface between Traversable and
* Iterator and we want to avoid converting between collections to ensure that we test what
- * we mean to test.
+ * we mean to test.
*/
private def assertForeach[E](expected: Traversable[E], actual: Traversable[E]): Unit = {
val notYetFound = new mutable.ArrayBuffer[E]() ++= expected
diff --git a/test/files/run/t2552.scala b/test/files/run/t2552.scala
index 17dcac596b..0c6b4f005b 100644
--- a/test/files/run/t2552.scala
+++ b/test/files/run/t2552.scala
@@ -2,11 +2,11 @@ object Test extends App {
def testTakeWhile = {
val numbers = Iterator.range(0, 50)
val zeroTo9 = numbers.takeWhile(x => { println("p(" + x + ")"); x < 10 } )
-
+
zeroTo9.foreach(println _)
-
+
val zeroTo1 = Iterator.range(0, 20).takeWhile(x => { println("p(" + x + ")"); x < 2 } )
-
+
println(zeroTo1.hasNext)
println(zeroTo1.hasNext)
println(zeroTo1.next)
@@ -15,16 +15,16 @@ object Test extends App {
println(zeroTo1.hasNext)
println(zeroTo1.hasNext)
}
-
+
def testFilter = {
val predicate = (x: Int) => { println("p(" + x + ")"); x % 2 == 0 }
-
+
val evens = Iterator.range(0, 10).filter(predicate)
-
+
println(evens.hasNext)
println(evens.hasNext)
println(evens.next)
-
+
evens.foreach(println _)
}
diff --git a/test/files/run/t2577.check b/test/files/run/t2577.check
new file mode 100644
index 0000000000..4a584e4989
--- /dev/null
+++ b/test/files/run/t2577.check
@@ -0,0 +1 @@
+Nothing
diff --git a/test/files/run/t2577.scala b/test/files/run/t2577.scala
new file mode 100644
index 0000000000..6d836a3996
--- /dev/null
+++ b/test/files/run/t2577.scala
@@ -0,0 +1,17 @@
+case class annot[T]() extends scala.annotation.StaticAnnotation
+
+// type inference should infer @annot[Nothing] instead of @annot[T]
+// note the T is not in scope here!
+class Foo[@annot U]
+
+object Test {
+ import scala.reflect.runtime.universe._
+ val x = new Foo
+
+ def main(args: Array[String]): Unit = {
+ val targ = typeOf[x.type].widen match {
+ case TypeRef(_, _, arg :: _) => arg
+ }
+ println(targ)
+ }
+}
diff --git a/test/files/run/t2594_tcpoly.check b/test/files/run/t2594_tcpoly.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t2594_tcpoly.check
+++ /dev/null
diff --git a/test/files/run/t2594_tcpoly.scala b/test/files/run/t2594_tcpoly.scala
index e759ca8b0f..a9d26693f9 100644
--- a/test/files/run/t2594_tcpoly.scala
+++ b/test/files/run/t2594_tcpoly.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ higherKinds }
+
trait Monad[M[_]] {
def foo[A](a: M[A]): M[A]
}
@@ -15,4 +18,4 @@ object Test {
}
def main(as: Array[String]) { BarMonad[Int] foo (new Bar[Int, Int]) }
-} \ No newline at end of file
+}
diff --git a/test/files/run/t261.check b/test/files/run/t261.check
new file mode 100644
index 0000000000..35d242ba79
--- /dev/null
+++ b/test/files/run/t261.check
@@ -0,0 +1,2 @@
+A
+B
diff --git a/test/files/run/t261.scala b/test/files/run/t261.scala
new file mode 100644
index 0000000000..d8ddb28c00
--- /dev/null
+++ b/test/files/run/t261.scala
@@ -0,0 +1,11 @@
+trait A { val foo: String = "A" }
+trait B {
+ private val foo: String = "B"
+ def f = println(foo)
+}
+object Test extends A with B {
+ def main(args: Array[String]) = {
+ println(foo)
+ f
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t2636.scala b/test/files/run/t2636.scala
index 3271f79ffc..2f55c8ad5a 100644
--- a/test/files/run/t2636.scala
+++ b/test/files/run/t2636.scala
@@ -1,30 +1,33 @@
+
+import scala.language.{ reflectiveCalls }
+
object Test
{
type Foo = { def update(x: Int, value: String): Unit }
type Foo2 = { def update(x: Int, value: String): Int }
type Foo3 = { def update(x: Int, value: String): Array[Int] }
-
+
def alen() = {
type L1 = { def length: Int }
def len(p: L1) = p.length
val x: L1 = Array(1,2,3)
len(x)
}
-
+
type A1 = { def apply(x: Int): String }
def arrApply(a: A1, x: Int) = a(x)
-
+
def main(args: Array[String]): Unit = {
val arr = new Array[String](3)
val p1: Foo = arr
def a1 = p1(0) = "b"
val p2: Foo2 = new { def update(x: Int, value: String) = { p1(1) = "o" ; 1 } }
- def a2 = p2(0) = "c"
-
+ def a2 = p2(0) = "c"
+
val p3: Foo3 = new { def update(x: Int, value: String) = { p1(2) = "b" ; Array(1) } }
def a3 = p3(10) = "hi mom"
-
+
a1 ; a2 ; a3 ;
assert(arr.mkString == "bob")
@@ -32,4 +35,4 @@ object Test
assert(arrApply(arr, 1) == "o")
assert(arrApply(new { def apply(x: Int) = "tom" }, -100) == "tom")
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/t266.scala b/test/files/run/t266.scala
index 1fd6dab185..20a29dabbb 100644
--- a/test/files/run/t266.scala
+++ b/test/files/run/t266.scala
@@ -2,9 +2,9 @@
trait O {
self: Test.type =>
-
+
Nil foreach identity
-
+
def f = (1 to 10).toList map identity
}
diff --git a/test/files/run/t2721.check b/test/files/run/t2721.check
deleted file mode 100644
index 2bd7656b36..0000000000
--- a/test/files/run/t2721.check
+++ /dev/null
@@ -1,2 +0,0 @@
-root:-rootVal-sub:-subVal-
-root:-rootVal-sub:-subVal-
diff --git a/test/files/run/t2721.scala b/test/files/run/t2721.scala
deleted file mode 100644
index 93af884a60..0000000000
--- a/test/files/run/t2721.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Test
-{
- val xml1 = <root xmlns:ns="nsUri" ns:at="rootVal"><sub ns:at="subVal"/></root>
- val xml2= scala.xml.XML.loadString("""<root xmlns:ns="nsUri" ns:at="rootVal"><sub ns:at="subVal"/></root>""")
-
- def backslashSearch(x: xml.Elem) = "root:-"+(x \ "@{nsUri}at") +"-sub:-"+(x \ "sub" \ "@{nsUri}at") +"-"
-
- def main(args: Array[String]): Unit = {
- println(backslashSearch(xml1))
- println(backslashSearch(xml2))
- }
-}
diff --git a/test/files/run/t2755.scala b/test/files/run/t2755.scala
index c279ecc24e..8d10b56734 100644
--- a/test/files/run/t2755.scala
+++ b/test/files/run/t2755.scala
@@ -28,7 +28,7 @@ object Test {
case x: Array[_] => 6
case _ => 7
}
-
+
def main(args: Array[String]): Unit = {
println(f1(Array(1, 2, 3)))
@@ -38,7 +38,7 @@ object Test {
println(f1(new Array[Any](10))) // should match as Array[AnyRef]
println(f1(Array(1L)))
println(f1(null))
-
+
println(f2(Array(1, 2, 3)))
println(f2(Array(1.0, -2.0, 3.0, 1.0)))
println(f2(Array(1.0f, 2.0f, 3.0f, -3.0f)))
@@ -46,7 +46,7 @@ object Test {
println(f2(new Array[Any](10))) // should match as Array[AnyRef]
println(f2(Array(1L)))
println(f2(null))
-
+
println(f3(Array(1, 2, 3)))
println(f3(Array(1.0, -2.0, 3.0, 1.0)))
println(f3(Array(1.0f, 2.0f, 3.0f, -3.0f)))
diff --git a/test/files/run/t2800.scala b/test/files/run/t2800.scala
index cc6fb30bbc..84d1de0507 100644
--- a/test/files/run/t2800.scala
+++ b/test/files/run/t2800.scala
@@ -3,20 +3,20 @@ object Test {
def f2 = (5: Any) match { case List(x @ _*) => x ; case _ => false }
def f3 = (Nil: Any) match { case List(x @ _*) => x ; case _ => false }
def f4 = (Array(1): Any) match { case List(x @ _*) => x ; case _ => false }
-
+
def f5 = ("": Any) match { case Array(x @ _*) => x ; case _ => false }
def f6 = (5: Any) match { case Array(x @ _*) => x ; case _ => false }
def f7 = (Nil: Any) match { case Array(x @ _*) => x ; case _ => false }
def f8 = (Array(1): Any) match { case Array(x @ _*) => x ; case _ => false }
-
+
def f9 = ("": Any) match { case x @ List(_*) => x ; case _ => false }
def f10 = ("": Any) match { case List(_*) => true ; case _ => false }
def f11 = (Nil: Any) match { case List(_*) => true ; case _ => false }
def f12 = ("": Any) match { case x @ Array(_*) => x ; case _ => false }
def f13 = ("": Any) match { case Array(_*) => true ; case _ => false }
def f14 = (Nil: Any) match { case Array(_*) => true ; case _ => false }
-
-
+
+
def main(args: Array[String]): Unit = {
println(f1)
println(f2)
diff --git a/test/files/run/t2818.scala b/test/files/run/t2818.scala
index 19b67cbc88..746cdfb049 100644
--- a/test/files/run/t2818.scala
+++ b/test/files/run/t2818.scala
@@ -1,6 +1,6 @@
object Test extends App {
println((List.range(1L, 15L) :\ 0L) (_ + _))
println((List.range(1L, 1000000L) :\ 0L) (_ + _))
- println((List.fill(5)(1) :\ 1) (_ - _))
- println((List.fill(1000000)(1) :\ 1) (_ - _))
+ println((List.fill(5)(1) :\ 1) (_ - _))
+ println((List.fill(1000000)(1) :\ 1) (_ - _))
}
diff --git a/test/files/run/t2849.scala b/test/files/run/t2849.scala
index 0995f64010..cadf605ae0 100644
--- a/test/files/run/t2849.scala
+++ b/test/files/run/t2849.scala
@@ -16,9 +16,9 @@ object Test {
def ticketExample {
var big = 100000
-
+
var aSortedSet: SortedSet[Int] = TreeSet(big)
-
+
for (i <- 1 until N) {
aSortedSet = (aSortedSet - big) ++ (TreeSet(i, big - 1))
big -= 1
@@ -42,7 +42,7 @@ object Test {
}
}
}
-
+
}
diff --git a/test/files/run/t2867.scala b/test/files/run/t2867.scala
index 0d30f95f8d..25e55eaecd 100644
--- a/test/files/run/t2867.scala
+++ b/test/files/run/t2867.scala
@@ -1,6 +1,6 @@
object Test {
- case class A(l: List[_]*)
-
+ case class A(l: List[_]*)
+
def main(args: Array[String]): Unit = {
/** Kind of sneaking a slightly different test in here as well as
* testing 2867. How subversive.
@@ -9,7 +9,7 @@ object Test {
val xs2 = List(1.0, 2.0, 3.0)
val xs3 = List[Any](1.0f, 2.0f, 3.0f)
val xs4 = List[Byte](1, 2, 3)
-
+
assert(A(List(xs1, xs2)) == A(List(xs3, xs4)))
}
}
diff --git a/test/files/run/t2873.check b/test/files/run/t2873.check
index 9198280f61..209b679c07 100644
--- a/test/files/run/t2873.check
+++ b/test/files/run/t2873.check
@@ -1 +1 @@
-scala.collection.immutable.RedBlack<A>.Empty$
+RedBlack<A>.Empty$
diff --git a/test/files/run/t2873.scala b/test/files/run/t2873.scala
index 8d48a8dbb4..3a3cc59b46 100644
--- a/test/files/run/t2873.scala
+++ b/test/files/run/t2873.scala
@@ -1,5 +1,10 @@
+abstract class RedBlack[A] extends Serializable {
+ abstract class Tree[+B] extends Serializable
+ case object Empty extends Tree[Nothing]
+}
+
object Test {
def main(args: Array[String]): Unit = {
- println(classOf[scala.collection.immutable.RedBlack[_]].getMethod("Empty").getGenericReturnType)
+ println(classOf[RedBlack[_]].getMethod("Empty").getGenericReturnType)
}
}
diff --git a/test/files/run/t2886.check b/test/files/run/t2886.check
index a70f9935ed..61e36948bd 100644
--- a/test/files/run/t2886.check
+++ b/test/files/run/t2886.check
@@ -1,5 +1,5 @@
((x: Predef.String) => {
- val x$1 = x;
- val x$2 = x;
+ <artifact> val x$1 = x;
+ <artifact> val x$2 = x;
Test.this.test(x$2, x$1)
})
diff --git a/test/files/run/t2958.scala b/test/files/run/t2958.scala
index b9563a1b77..dcd24ecc36 100644
--- a/test/files/run/t2958.scala
+++ b/test/files/run/t2958.scala
@@ -2,14 +2,14 @@ object Test {
def f(args: Array[String]) = args match {
case Array("-p", prefix, from, to) =>
prefix + from + to
-
+
case Array(from, to) =>
from + to
case _ =>
"default"
}
-
+
def main(args: Array[String]) {
assert(f(Array("1", "2")) == "12")
}
diff --git a/test/files/run/t3026.scala b/test/files/run/t3026.scala
index 0231c7bcd1..22dde9cc03 100755
--- a/test/files/run/t3026.scala
+++ b/test/files/run/t3026.scala
@@ -3,6 +3,6 @@ object Test {
case object RED extends Colour
case object YELLOW extends Colour
val items = Array(RED, YELLOW)
-
+
def main(args: Array[String]): Unit = items foreach println
}
diff --git a/test/files/run/t3038.scala b/test/files/run/t3038.scala
index 986fc982e7..7eb69f7fb5 100644
--- a/test/files/run/t3038.scala
+++ b/test/files/run/t3038.scala
@@ -2,18 +2,18 @@ class A {
private lazy val a1 = "a1"
object B
private lazy val a2 = "a2"
-
+
@transient lazy val a3 = "a3"
@transient private lazy val a4 = "a4"
@transient lazy val a5 = "a5"
@transient private lazy val a6 = "a6"
-
+
final val a7 = "a7"
private final val a8 = "a8"
@transient final val a9 = "a9"
-
-
+
+
def run = {
@@ -27,13 +27,13 @@ class A {
println(a7)
println(a8)
println(a9)
- }
+ }
}
class C extends A {
private lazy val c1 = "c1"
lazy val c2 = "c2"
-
+
private lazy val c3 = "c3"
@transient lazy val c4 = "c4"
@@ -41,7 +41,7 @@ class C extends A {
@transient lazy val c6 = "c6"
@transient private lazy val c7 = "c7"
lazy val c8 = "c8"
-
+
final val c9 = "c9"
private final val c10 = "c10"
diff --git a/test/files/run/t3038c/A_1.scala b/test/files/run/t3038c/A_1.scala
index 14579fcf67..91564e3021 100644
--- a/test/files/run/t3038c/A_1.scala
+++ b/test/files/run/t3038c/A_1.scala
@@ -59,7 +59,7 @@ class A {
lazy val a57 = 58
lazy val a58 = 59
lazy val a59 = 60
- private lazy val a60 = 61
+ private lazy val a60 = 61
private lazy val a61 = 62
private lazy val a62 = 63
private lazy val a63 = 64
@@ -69,7 +69,7 @@ class A {
private lazy val a67 = 68
private lazy val a68 = 69
private lazy val a69 = 70
-
+
def run = {
println(List(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,
diff --git a/test/files/run/t3038d.scala b/test/files/run/t3038d.scala
index 6cd2d83776..44fb047b0b 100644
--- a/test/files/run/t3038d.scala
+++ b/test/files/run/t3038d.scala
@@ -16,19 +16,17 @@ trait Foo {
}
}
-
-@serializable
-class Bar extends Foo {
+class Bar extends Foo with Serializable {
@transient protected var first: Any = null
def size = a
@transient var second: Any = null
-
- def checkMember { first }
-
+
+ def checkMember { if (first == null) print("") }
+
private def writeObject(out: java.io.ObjectOutputStream) {
serializeTo(out)
}
-
+
private def readObject(in: java.io.ObjectInputStream) {
first = null
init(in)
@@ -40,7 +38,7 @@ object Test {
val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bytes))
in.readObject.asInstanceOf[A]
}
-
+
private def toBytes(o: AnyRef): Array[Byte] = {
val bos = new java.io.ByteArrayOutputStream
val out = new java.io.ObjectOutputStream(bos)
@@ -49,7 +47,7 @@ object Test {
bos.toByteArray
}
-
+
def main(args: Array[String]) {
val a1 = new Bar()
val serialized:Array[Byte] = toBytes(a1)
diff --git a/test/files/run/t3050.scala b/test/files/run/t3050.scala
index ca9d91e191..160f8b664b 100644
--- a/test/files/run/t3050.scala
+++ b/test/files/run/t3050.scala
@@ -1,9 +1,9 @@
object Test {
def main(args: Array[String]): Unit = {
- val x =
+ val x =
try { ("": Any) match { case List(_*) => true } }
- catch { case _ => false }
-
+ catch { case _: Throwable => false }
+
assert(!x)
}
}
diff --git a/test/files/run/t3112.scala b/test/files/run/t3112.scala
index 88677fa09e..eb8eec6327 100644
--- a/test/files/run/t3112.scala
+++ b/test/files/run/t3112.scala
@@ -7,5 +7,5 @@ object Test {
println((Vector() ++ (0 until 32)) takeRight 0) // works
println((Vector() ++ (0 until 33)) takeRight 0) // error
}
-
+
} \ No newline at end of file
diff --git a/test/files/run/t3150.scala b/test/files/run/t3150.scala
index 8acdb50354..034703b5f7 100644
--- a/test/files/run/t3150.scala
+++ b/test/files/run/t3150.scala
@@ -1,7 +1,7 @@
object Test {
case object Bob { override def equals(other: Any) = true }
def f(x: Any) = x match { case Bob => Bob }
-
+
def main(args: Array[String]): Unit = {
assert(f(Bob) eq Bob)
assert(f(0) eq Bob)
diff --git a/test/files/run/t3158.scala b/test/files/run/t3158.scala
index 2261b5cd81..c824b62e96 100644
--- a/test/files/run/t3158.scala
+++ b/test/files/run/t3158.scala
@@ -1,6 +1,6 @@
object Test {
def main(args: Array[String]) {
- println(args.map(_ => foo _).deep)
+ println(args.map(_ => foo _).deep)
}
def foo(xs: String*) {
diff --git a/test/files/run/t3175.scala b/test/files/run/t3175.scala
index aff2e67d0d..ea56ded229 100644
--- a/test/files/run/t3175.scala
+++ b/test/files/run/t3175.scala
@@ -1,51 +1,54 @@
/** A bit down the road this test will examine
* the bytecode.
*/
+
+import scala.language.reflectiveCalls
+
object Test {
def len(x:{ def length: Int }) = x.length
def f1(x:{ def apply(x: Int): Long }) = x(0)
def f2(x:{ def apply(x: Int): Byte }) = x(0)
def f3(x:{ def apply(x: Int): String }) = x(0).length
-
+
def f4(x:{ def update(x: Int, y: Long): Unit }, y: Long) = x(0) = y
def f5(x:{ def update(x: Int, y: Byte): Unit }, y: Byte) = x(0) = y
def f6(x:{ def update(x: Int, y: String): Unit }, y: String) = x(0) = y
-
+
def f7(x: { def length: Any }) = x.length
-
+
def f8(x: { def apply(x: Int): Any }) = x(0)
def f9(x: { def apply(x: Int): Int }) = x(0)
def f10(x: { def apply(x: Int): Long }) = x(0)
-
+
// update has some interesting special cases
def f11(x:{ def update(x: Int, y: Long): Any }, y: Long) = x(0) = y
- def f12(x:{ def update(x: Int, y: String): AnyVal }, y: String) = x(0) = y
+ def f12(x:{ def update(x: Int, y: String): AnyVal }, y: String) = x(0) = y
def f13(x:{ def update(x: Int, y: String): AnyRef }, y: String) = x(0) = y
-
+
// doesn't work yet, see #3197
// def fclone(x:{ def clone(): AnyRef }) = x.clone()
-
+
def main(args: Array[String]): Unit = {
val longs = Array(5L)
val bytes = Array(5: Byte)
val strs = Array("abcde", "fghjij")
-
+
println(len(Array(1,2,3)) + len(Array(4.0,5.0f)) + len(Array("abc", 5)) + len("bop"))
println(f1(longs) + f2(bytes) + f3(strs))
-
+
f4(longs, 1)
f5(bytes, 1)
f6(strs, "a")
-
+
println(f1(longs) + f2(bytes) + f3(strs))
-
+
println(f7(Array(1,2,3)))
println(f7("def"))
-
+
println(f8(Array(5)))
println(f9(Array(5)))
println(f10(Array(5)))
-
+
f11(longs, 100L)
f12(strs, "jabooboo")
println(longs(0))
diff --git a/test/files/run/t3199b.check b/test/files/run/t3199b.check
new file mode 100644
index 0000000000..b5d8bb58d9
--- /dev/null
+++ b/test/files/run/t3199b.check
@@ -0,0 +1 @@
+[1, 2, 3]
diff --git a/test/files/run/t3199b.scala b/test/files/run/t3199b.scala
new file mode 100644
index 0000000000..5010f2b085
--- /dev/null
+++ b/test/files/run/t3199b.scala
@@ -0,0 +1,11 @@
+object Test {
+
+ def test() = {
+ java.util.Arrays.asList(Array(1,2,3):_*)
+ }
+
+ def main(args: Array[String]) {
+ println(test())
+ }
+
+}
diff --git a/test/files/run/t3232.scala b/test/files/run/t3232.scala
index feff7e7089..900a1f5dba 100644
--- a/test/files/run/t3232.scala
+++ b/test/files/run/t3232.scala
@@ -4,18 +4,18 @@ object Test {
val r2 = 1 to Int.MaxValue
val r3 = Int.MinValue to -2
val r4 = Int.MinValue until -1
-
+
// some exceptional conditions
val e1 = () => (0 to Int.MaxValue).length
val e2 = () => (5 until 5).last
-
+
def main(args: Array[String]): Unit = {
List(r1, r2, r3, r4) foreach (x => assert(x.length == Int.MaxValue))
-
+
// exception required
List(e1, e2) foreach { f =>
try { f() ; assert(false) }
- catch { case _ => () }
+ catch { case _: Throwable => () }
}
}
}
diff --git a/test/files/run/t3235-minimal.check b/test/files/run/t3235-minimal.check
new file mode 100644
index 0000000000..d7f716002f
--- /dev/null
+++ b/test/files/run/t3235-minimal.check
@@ -0,0 +1,12 @@
+t3235-minimal.scala:3: warning: method round in class RichInt is deprecated: This is an integer type; there is no reason to round it. Perhaps you meant to call this on a floating-point value?
+ assert(123456789.round == 123456789)
+ ^
+t3235-minimal.scala:4: warning: method round in package math is deprecated: This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value?
+ assert(math.round(123456789) == 123456789)
+ ^
+t3235-minimal.scala:5: warning: method round in class RichLong is deprecated: This is an integer type; there is no reason to round it. Perhaps you meant to call this on a floating-point value?
+ assert(1234567890123456789L.round == 1234567890123456789L)
+ ^
+t3235-minimal.scala:6: warning: method round in package math is deprecated: This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value?
+ assert(math.round(1234567890123456789L) == 1234567890123456789L)
+ ^
diff --git a/test/files/run/t3235-minimal.flags b/test/files/run/t3235-minimal.flags
new file mode 100644
index 0000000000..dcc59ebe32
--- /dev/null
+++ b/test/files/run/t3235-minimal.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/test/files/run/t3235-minimal.scala b/test/files/run/t3235-minimal.scala
new file mode 100644
index 0000000000..dc9907b63b
--- /dev/null
+++ b/test/files/run/t3235-minimal.scala
@@ -0,0 +1,8 @@
+object Test {
+ def main(args: Array[String]) {
+ assert(123456789.round == 123456789)
+ assert(math.round(123456789) == 123456789)
+ assert(1234567890123456789L.round == 1234567890123456789L)
+ assert(math.round(1234567890123456789L) == 1234567890123456789L)
+ }
+}
diff --git a/test/files/run/t3242.scala b/test/files/run/t3242.scala
index f8defaa5cd..0a449d51f9 100644
--- a/test/files/run/t3242.scala
+++ b/test/files/run/t3242.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ higherKinds }
+
object Test {
def benchmarkA(num: Int) {
diff --git a/test/files/run/t3269.scala b/test/files/run/t3269.scala
index 6fe727111c..17e42cdb0e 100644
--- a/test/files/run/t3269.scala
+++ b/test/files/run/t3269.scala
@@ -4,6 +4,6 @@ object Test {
println(it.next)
it.hasNext
it.hasNext
- it.hasNext
+ it.hasNext
}
}
diff --git a/test/files/run/t3273.scala b/test/files/run/t3273.scala
index a4dfc4b30c..379a8a29c1 100644
--- a/test/files/run/t3273.scala
+++ b/test/files/run/t3273.scala
@@ -1,7 +1,7 @@
object Test {
val num1: Stream[Int] = 1 #:: num1.map(_ + 1)
val num2: Stream[Int] = 1 #:: num2.iterator.map(_ + 1).toStream
-
+
def main(args: Array[String]): Unit = {
val x1 = (num1 take 10).toList
val x2 = (num2 take 10).toList
diff --git a/test/files/run/t3326.scala b/test/files/run/t3326.scala
index f70cb01504..4ac7ef9138 100644
--- a/test/files/run/t3326.scala
+++ b/test/files/run/t3326.scala
@@ -10,7 +10,7 @@ import scala.math.Ordering
*
* There are 2 `++` overloads - a generic one in traversables and
* a map-specific one in `MapLike` - which knows about the ordering.
- *
+ *
* The problem here is that the expected return type for the expression
* in which `++` appears drives the decision of the overload that needs
* to be taken.
@@ -18,36 +18,36 @@ import scala.math.Ordering
* `SortedMap`, but `immutable.Map` instead.
* This is why `collection.SortedMap` used to resort to the generic
* `TraversableLike.++` which knows nothing about the ordering.
- *
+ *
* To avoid `collection.SortedMap`s resort to the more generic `TraverableLike.++`,
* we override the `MapLike.++` overload in `collection.SortedMap` to return
* the proper type `SortedMap`.
*/
object Test {
-
+
def main(args: Array[String]) {
testCollectionSorted()
testImmutableSorted()
}
-
+
def testCollectionSorted() {
import collection._
val order = implicitly[Ordering[Int]].reverse
var m1: SortedMap[Int, String] = SortedMap.empty[Int, String](order)
var m2: SortedMap[Int, String] = SortedMap.empty[Int, String](order)
-
+
m1 += (1 -> "World")
m1 += (2 -> "Hello")
-
+
m2 += (4 -> "Bar")
m2 += (5 -> "Foo")
-
+
val m3: SortedMap[Int, String] = m1 ++ m2
-
+
println(m1)
println(m2)
println(m3)
-
+
println(m1 + (3 -> "?"))
}
@@ -56,19 +56,19 @@ object Test {
val order = implicitly[Ordering[Int]].reverse
var m1: SortedMap[Int, String] = SortedMap.empty[Int, String](order)
var m2: SortedMap[Int, String] = SortedMap.empty[Int, String](order)
-
+
m1 += (1 -> "World")
m1 += (2 -> "Hello")
-
+
m2 += (4 -> "Bar")
m2 += (5 -> "Foo")
-
+
val m3: SortedMap[Int, String] = m1 ++ m2
-
+
println(m1)
println(m2)
println(m3)
-
+
println(m1 + (3 -> "?"))
}
}
diff --git a/test/files/run/t3346a.check b/test/files/run/t3346a.check
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/test/files/run/t3346a.check
@@ -0,0 +1 @@
+1
diff --git a/test/files/run/t3346a.scala b/test/files/run/t3346a.scala
new file mode 100644
index 0000000000..c0a90b011b
--- /dev/null
+++ b/test/files/run/t3346a.scala
@@ -0,0 +1,11 @@
+import scala.language.implicitConversions
+
+object Test extends App {
+ class Rep[T](x : T)
+
+ class SomeOps[T](x : Rep[T]) { def foo = 1 }
+ implicit def mkOps[X, T](x : X)(implicit conv: X => Rep[T]) : SomeOps[T] = new SomeOps(conv(x))
+
+ val a: Rep[Int] = new Rep(42)
+ println(a.foo)
+} \ No newline at end of file
diff --git a/test/files/run/t3346d.scala b/test/files/run/t3346d.scala
new file mode 100644
index 0000000000..3f79896210
--- /dev/null
+++ b/test/files/run/t3346d.scala
@@ -0,0 +1,21 @@
+import scala.language.implicitConversions
+
+object Test extends App {
+ trait TARInt
+
+ trait Basket[A,B] {
+ def iAmABasket = {}
+ }
+
+ trait BasketFactory[A,B] {
+ def create(v: A): Basket[A,B]
+ }
+
+ implicit val bf = new BasketFactory[Int,TARInt] {
+ def create(v: Int): Basket[Int,TARInt] = new Basket[Int, TARInt]{}
+ }
+
+ implicit def i2[A,B](a: A)(implicit bf: BasketFactory[A,B]): Basket[A,B] = bf.create(a)
+
+ 1.iAmABasket // <-- i2 conversion not applicable
+} \ No newline at end of file
diff --git a/test/files/run/t3346e.check b/test/files/run/t3346e.check
new file mode 100644
index 0000000000..71a57ffa70
--- /dev/null
+++ b/test/files/run/t3346e.check
@@ -0,0 +1,12 @@
+eqw
+List(0, 2)
+List(0, 2)
+BitSet(0, 2)
+Vector(113, 119, 101)
+qwe
+List(2, 0)
+List(0!)
+BitSet(0, 2)
+qwe
+List(2, 0)
+qwe
diff --git a/test/files/run/t3346e.scala b/test/files/run/t3346e.scala
new file mode 100644
index 0000000000..ac0de564d4
--- /dev/null
+++ b/test/files/run/t3346e.scala
@@ -0,0 +1,81 @@
+import scala.language.implicitConversions
+import scala.collection.generic.CanBuildFrom
+import scala.math.Ordering
+import collection.{TraversableLike, SeqLike}
+import collection.immutable.BitSet
+
+class QuickSort[Coll](a: Coll) {
+ //should be able to sort only something with defined order (someting like a Seq)
+ def quickSort[T](implicit ev0: Coll => SeqLike[T, Coll],
+ cbf: CanBuildFrom[Coll, T, Coll],
+ n: Ordering[T]): Coll = {
+ quickSortAnything(ev0, cbf, n)
+ }
+
+ //we can even sort a Set, if we really want to
+ def quickSortAnything[T](implicit ev0: Coll => TraversableLike[T, Coll],
+ cbf: CanBuildFrom[Coll, T, Coll],
+ n: Ordering[T]): Coll = {
+ import n._
+ if (a.size < 2) {
+ a
+ } else {
+ // We pick the first value for the pivot.
+ val pivot = a.head
+ val (lower, tmp) = a.partition(_ < pivot)
+ val (upper, same) = tmp.partition(_ > pivot)
+ val b = cbf()
+ b.sizeHint(a.size)
+ b ++= new QuickSort(lower).quickSortAnything
+ b ++= same
+ b ++= new QuickSort(upper).quickSortAnything
+ b.result
+ }
+ }
+}
+
+class FilterMap[Repr](a: Repr) {
+ def filterMap[A, B, That](f: A => Option[B])(implicit ev0: Repr => TraversableLike[A, Repr],
+ cbf: CanBuildFrom[Repr, B, That]): That = {
+ a.flatMap(e => f(e).toSeq)
+ }
+}
+
+class FilterMapFixed[A, Repr <% TraversableLike[A, Repr]](a: Repr) {
+ def filterMap2[B, That](f: A => Option[B])(implicit cbf: CanBuildFrom[Repr, B, That]): That = {
+ a.flatMap(e => f(e).toSeq)
+ }
+}
+
+object MyEnhancements {
+ implicit def toQS[Coll](a: Coll) = new QuickSort(a)
+ implicit def toFM[Coll](a: Coll) = new FilterMap(a)
+ implicit def toFM2[A, Repr <% TraversableLike[A, Repr]](a: Repr) = new FilterMapFixed(a)
+}
+
+object Test extends App {
+
+ import MyEnhancements._
+
+ println("qwe".quickSort)
+ println(Array(2, 0).quickSort.toList)
+ println(Seq(2, 0).quickSort)
+ //not very useful to sort a set, but just as a demonstration
+ println(BitSet(2, 0).quickSortAnything)
+
+ //need to hint type inferencer,
+ //probably will be able to overcome after https://issues.scala-lang.org/browse/SI-4699 and
+ // related issues are fixed (by moving ev0 parameter from filterMap to toFM), see toFM2
+ println("qwe".filterMap((c: Char) => Some(c.toInt)))
+ println("qwe".filterMap((c: Char) => Some(c)))
+ println(Array(2, 0).filterMap((c: Int) => Some(c.toInt)).toList)
+ println(Seq(2, 0).filterMap((c: Int) => if (c < 2) Some(c + "!") else None))
+ def test(i:Int) = Option(i)
+ println(BitSet(2,0).filterMap(test))
+
+ println(toFM2("qwe").filterMap2(c => Some(c)))
+ println(toFM2(Array(2, 0)).filterMap2(c => Some(c.toInt)).toList)
+ //No implicit view available from java.lang.String => scala.collection.TraversableLike[A,java.lang.String]. :(
+ //Not anymore :)
+ println("qwe".filterMap2(c => Some(c)))
+}
diff --git a/test/files/run/t3346f.check b/test/files/run/t3346f.check
new file mode 100644
index 0000000000..fd3c81a4d7
--- /dev/null
+++ b/test/files/run/t3346f.check
@@ -0,0 +1,2 @@
+5
+5
diff --git a/test/files/run/t3346f.scala b/test/files/run/t3346f.scala
new file mode 100644
index 0000000000..4799ca2ca9
--- /dev/null
+++ b/test/files/run/t3346f.scala
@@ -0,0 +1,15 @@
+import scala.language.implicitConversions
+import scala.language.reflectiveCalls
+
+object Test extends App {
+ trait Foo[A]
+ implicit def fooString: Foo[String] = null
+ implicit def value[A](implicit foo: Foo[A]) = 5
+
+ println(implicitly[Int])
+
+ implicit def conversion[A](x: Int)(implicit foo: Foo[A]) = new {
+ def aMethod = 5
+ }
+ println(1.aMethod)
+}
diff --git a/test/files/run/t3346g.check b/test/files/run/t3346g.check
new file mode 100644
index 0000000000..ce894825e0
--- /dev/null
+++ b/test/files/run/t3346g.check
@@ -0,0 +1 @@
+A(3,asdf)
diff --git a/test/files/run/t3346g.scala b/test/files/run/t3346g.scala
new file mode 100644
index 0000000000..d7c9d79c7f
--- /dev/null
+++ b/test/files/run/t3346g.scala
@@ -0,0 +1,9 @@
+import scala.language.implicitConversions
+
+case class A(b: Int, c: String)
+
+object Test extends App {
+ implicit def s2i(s: String): Int = s.length
+ implicit def toA[T](t: T)(implicit f: T => Int): A = A(f(t), t.toString)
+ println("asdf".copy(b = 3))
+} \ No newline at end of file
diff --git a/test/files/run/t3346h.check b/test/files/run/t3346h.check
new file mode 100644
index 0000000000..587be6b4c3
--- /dev/null
+++ b/test/files/run/t3346h.check
@@ -0,0 +1 @@
+x
diff --git a/test/files/run/t3346h.scala b/test/files/run/t3346h.scala
new file mode 100644
index 0000000000..97ebc9380c
--- /dev/null
+++ b/test/files/run/t3346h.scala
@@ -0,0 +1,9 @@
+import scala.language.implicitConversions
+
+object Test extends App {
+ trait Fundep[T, U] { def u(t: T): U }
+ class C { def y = "x" }
+ implicit val FundepStringC = new Fundep[String, C]{ def u(t: String) = new C }
+ implicit def foo[T, U](x: T)(implicit y: Fundep[T, U]): U = y.u(x)
+ println("x".y)
+} \ No newline at end of file
diff --git a/test/files/run/t3346j.check b/test/files/run/t3346j.check
new file mode 100644
index 0000000000..59e8626fc5
--- /dev/null
+++ b/test/files/run/t3346j.check
@@ -0,0 +1 @@
+Int
diff --git a/test/files/run/t3346j.scala b/test/files/run/t3346j.scala
new file mode 100644
index 0000000000..98b5a870a7
--- /dev/null
+++ b/test/files/run/t3346j.scala
@@ -0,0 +1,11 @@
+import scala.language.implicitConversions
+import scala.language.reflectiveCalls
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ class A[T]
+ class B[T]
+ implicit def foo[T: TypeTag](a: A[T])(implicit b: B[T]) = new { def baz = typeOf[T] }
+ implicit def bar[T <: Int]: B[T] = new B[T]()
+ println(new A[Int]().baz)
+} \ No newline at end of file
diff --git a/test/files/run/t3361.check b/test/files/run/t3361.check
new file mode 100644
index 0000000000..c18bdc9aff
--- /dev/null
+++ b/test/files/run/t3361.check
@@ -0,0 +1 @@
+warning: there were 16 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t3361.scala b/test/files/run/t3361.scala
index 7fbc6777f2..d49bcbc905 100644
--- a/test/files/run/t3361.scala
+++ b/test/files/run/t3361.scala
@@ -40,7 +40,7 @@ object Test extends App {
def insert_1 {
val ten = DoubleLinkedList(1 to 10: _*)
ten.append(DoubleLinkedList(11))
-
+
// Post-insert size test
require(11 == ten.size)
// Post-insert data test
@@ -57,7 +57,7 @@ object Test extends App {
DoubleLinkedList().insert(ten)
} catch {
case _: IllegalArgumentException => require(true)
- case _ => require(false)
+ case _: Throwable => require(false)
}
val zero = DoubleLinkedList(0)
zero.insert(ten)
@@ -87,7 +87,7 @@ object Test extends App {
DoubleLinkedList().append(ten)
} catch {
case _: IllegalArgumentException => require(true)
- case _ => require(false)
+ case _: Throwable => require(false)
}
val zero = DoubleLinkedList(0)
zero.append(ten)
diff --git a/test/files/run/t3376.check b/test/files/run/t3376.check
index 3a1d7d581b..cc6949d326 100644
--- a/test/files/run/t3376.check
+++ b/test/files/run/t3376.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> class M[@specialized T] { override def toString = "mmm" }
defined class M
diff --git a/test/files/run/t3395.scala b/test/files/run/t3395.scala
index 01cc431871..b4990a1716 100644
--- a/test/files/run/t3395.scala
+++ b/test/files/run/t3395.scala
@@ -1,11 +1,11 @@
object Test {
def main(args: Array[String]): Unit = {
- Seq("") match {
+ Seq("") match {
case Seq("") => println("abc")
case Seq(_, _, x) => println(x)
}
-
- Seq(1, 2, "def") match {
+
+ Seq(1, 2, "def") match {
case Seq("") => println("abc")
case Seq(_, _, x) => println(x)
}
diff --git a/test/files/run/t3397.scala b/test/files/run/t3397.scala
index 243fe766de..2c8cbed3ab 100644
--- a/test/files/run/t3397.scala
+++ b/test/files/run/t3397.scala
@@ -1,7 +1,7 @@
object Test {
def main(args: Array[String]): Unit = {
val x = Seq(Set(1,2,3),Set(4,5,6),Set(7,8,9)).transpose
-
+
()
}
}
diff --git a/test/files/run/t3425.check b/test/files/run/t3425.check
new file mode 100644
index 0000000000..5be779bd74
--- /dev/null
+++ b/test/files/run/t3425.check
@@ -0,0 +1,4 @@
+123
+456
+789
+789
diff --git a/test/files/run/t3425.scala b/test/files/run/t3425.scala
new file mode 100644
index 0000000000..c61d1071a5
--- /dev/null
+++ b/test/files/run/t3425.scala
@@ -0,0 +1,41 @@
+import scala.language.reflectiveCalls
+object Other {
+ abstract class Foo {
+ type R1 <: { def x: Any }
+ type R2 <: R1 { def x: Int }
+
+ def f(x: R2) = x.x
+ }
+
+ abstract class Bar {
+ trait R0 { def x: Any }
+ type R1 <: R0 { def x: AnyVal }
+ type R2 <: R1 { def x: Int }
+
+ def f(x: R2) = x.x
+ }
+}
+object Test {
+ trait A
+ trait B
+ def x(a: (A { val y: Int }) with B { val y: Int }) = a.y
+
+ class C extends A with B {
+ val y = 456
+ }
+
+ class Bippy { def x: Int = 789 }
+
+ def main(args: Array[String]): Unit = {
+ println(x(new A with B { val y = 123 }))
+ println(x(new C))
+
+ { val foo = new Other.Foo { type R1 = Bippy ; type R2 = Bippy }
+ println(foo.f(new Bippy))
+ }
+ { val bar = new Other.Bar { type R1 = Bippy with R0 ; type R2 = R1 }
+ println(bar.f(new Bippy with bar.R0))
+ }
+ }
+}
+
diff --git a/test/files/run/t3425b.check b/test/files/run/t3425b.check
new file mode 100644
index 0000000000..5d34c43de3
--- /dev/null
+++ b/test/files/run/t3425b.check
@@ -0,0 +1,152 @@
+==== Direct Calls ====
+
+Any{val y: P} with C{val y: P}
+Any{val y: P} with C{val y: Q}
+Any{val y: P} with C{val y: R forSome { type R <: P with Q }}
+Any{val y: Q} with C{val y: P}
+Any{val y: Q} with C{val y: Q}
+Any{val y: Q} with C{val y: R forSome { type R <: P with Q }}
+Any{val y: R forSome { type R <: P with Q }} with C{val y: P}
+Any{val y: R forSome { type R <: P with Q }} with C{val y: Q}
+Any{val y: R forSome { type R <: P with Q }} with C{val y: R forSome { type R <: P with Q }}
+A{val y: P} with C{val y: P}
+A{val y: P} with C{val y: Q}
+A{val y: P} with C{val y: R forSome { type R <: P with Q }}
+A{val y: Q} with C{val y: P}
+A{val y: Q} with C{val y: Q}
+A{val y: Q} with C{val y: R forSome { type R <: P with Q }}
+A{val y: R forSome { type R <: P with Q }} with C{val y: P}
+A{val y: R forSome { type R <: P with Q }} with C{val y: Q}
+A{val y: R forSome { type R <: P with Q }} with C{val y: R forSome { type R <: P with Q }}
+B{val y: P} with C{val y: P}
+B{val y: P} with C{val y: Q}
+B{val y: P} with C{val y: R forSome { type R <: P with Q }}
+B{val y: Q} with C{val y: P}
+B{val y: Q} with C{val y: Q}
+B{val y: Q} with C{val y: R forSome { type R <: P with Q }}
+B{val y: R forSome { type R <: P with Q }} with C{val y: P}
+B{val y: R forSome { type R <: P with Q }} with C{val y: Q}
+B{val y: R forSome { type R <: P with Q }} with C{val y: R forSome { type R <: P with Q }}
+C{val y: P} with C{val y: P}
+C{val y: P} with C{val y: Q}
+C{val y: P} with C{val y: R forSome { type R <: P with Q }}
+C{val y: Q} with C{val y: P}
+C{val y: Q} with C{val y: Q}
+C{val y: Q} with C{val y: R forSome { type R <: P with Q }}
+C{val y: R forSome { type R <: P with Q }} with C{val y: P}
+C{val y: R forSome { type R <: P with Q }} with C{val y: Q}
+C{val y: R forSome { type R <: P with Q }} with C{val y: R forSome { type R <: P with Q }}
+
+
+==== Reflective Calls ====
+
+Any{val y: P} with Any{val y: P}
+Any{val y: P} with Any{val y: Q}
+Any{val y: P} with Any{val y: R forSome { type R <: P with Q }}
+Any{val y: P} with A{val y: P}
+Any{val y: P} with A{val y: Q}
+Any{val y: P} with A{val y: R forSome { type R <: P with Q }}
+Any{val y: P} with B{val y: P}
+Any{val y: P} with B{val y: Q}
+Any{val y: P} with B{val y: R forSome { type R <: P with Q }}
+Any{val y: Q} with Any{val y: P}
+Any{val y: Q} with Any{val y: Q}
+Any{val y: Q} with Any{val y: R forSome { type R <: P with Q }}
+Any{val y: Q} with A{val y: P}
+Any{val y: Q} with A{val y: Q}
+Any{val y: Q} with A{val y: R forSome { type R <: P with Q }}
+Any{val y: Q} with B{val y: P}
+Any{val y: Q} with B{val y: Q}
+Any{val y: Q} with B{val y: R forSome { type R <: P with Q }}
+Any{val y: R forSome { type R <: P with Q }} with Any{val y: P}
+Any{val y: R forSome { type R <: P with Q }} with Any{val y: Q}
+Any{val y: R forSome { type R <: P with Q }} with Any{val y: R forSome { type R <: P with Q }}
+Any{val y: R forSome { type R <: P with Q }} with A{val y: P}
+Any{val y: R forSome { type R <: P with Q }} with A{val y: Q}
+Any{val y: R forSome { type R <: P with Q }} with A{val y: R forSome { type R <: P with Q }}
+Any{val y: R forSome { type R <: P with Q }} with B{val y: P}
+Any{val y: R forSome { type R <: P with Q }} with B{val y: Q}
+Any{val y: R forSome { type R <: P with Q }} with B{val y: R forSome { type R <: P with Q }}
+A{val y: P} with Any{val y: P}
+A{val y: P} with Any{val y: Q}
+A{val y: P} with Any{val y: R forSome { type R <: P with Q }}
+A{val y: P} with A{val y: P}
+A{val y: P} with A{val y: Q}
+A{val y: P} with A{val y: R forSome { type R <: P with Q }}
+A{val y: P} with B{val y: P}
+A{val y: P} with B{val y: Q}
+A{val y: P} with B{val y: R forSome { type R <: P with Q }}
+A{val y: Q} with Any{val y: P}
+A{val y: Q} with Any{val y: Q}
+A{val y: Q} with Any{val y: R forSome { type R <: P with Q }}
+A{val y: Q} with A{val y: P}
+A{val y: Q} with A{val y: Q}
+A{val y: Q} with A{val y: R forSome { type R <: P with Q }}
+A{val y: Q} with B{val y: P}
+A{val y: Q} with B{val y: Q}
+A{val y: Q} with B{val y: R forSome { type R <: P with Q }}
+A{val y: R forSome { type R <: P with Q }} with Any{val y: P}
+A{val y: R forSome { type R <: P with Q }} with Any{val y: Q}
+A{val y: R forSome { type R <: P with Q }} with Any{val y: R forSome { type R <: P with Q }}
+A{val y: R forSome { type R <: P with Q }} with A{val y: P}
+A{val y: R forSome { type R <: P with Q }} with A{val y: Q}
+A{val y: R forSome { type R <: P with Q }} with A{val y: R forSome { type R <: P with Q }}
+A{val y: R forSome { type R <: P with Q }} with B{val y: P}
+A{val y: R forSome { type R <: P with Q }} with B{val y: Q}
+A{val y: R forSome { type R <: P with Q }} with B{val y: R forSome { type R <: P with Q }}
+B{val y: P} with Any{val y: P}
+B{val y: P} with Any{val y: Q}
+B{val y: P} with Any{val y: R forSome { type R <: P with Q }}
+B{val y: P} with A{val y: P}
+B{val y: P} with A{val y: Q}
+B{val y: P} with A{val y: R forSome { type R <: P with Q }}
+B{val y: P} with B{val y: P}
+B{val y: P} with B{val y: Q}
+B{val y: P} with B{val y: R forSome { type R <: P with Q }}
+B{val y: Q} with Any{val y: P}
+B{val y: Q} with Any{val y: Q}
+B{val y: Q} with Any{val y: R forSome { type R <: P with Q }}
+B{val y: Q} with A{val y: P}
+B{val y: Q} with A{val y: Q}
+B{val y: Q} with A{val y: R forSome { type R <: P with Q }}
+B{val y: Q} with B{val y: P}
+B{val y: Q} with B{val y: Q}
+B{val y: Q} with B{val y: R forSome { type R <: P with Q }}
+B{val y: R forSome { type R <: P with Q }} with Any{val y: P}
+B{val y: R forSome { type R <: P with Q }} with Any{val y: Q}
+B{val y: R forSome { type R <: P with Q }} with Any{val y: R forSome { type R <: P with Q }}
+B{val y: R forSome { type R <: P with Q }} with A{val y: P}
+B{val y: R forSome { type R <: P with Q }} with A{val y: Q}
+B{val y: R forSome { type R <: P with Q }} with A{val y: R forSome { type R <: P with Q }}
+B{val y: R forSome { type R <: P with Q }} with B{val y: P}
+B{val y: R forSome { type R <: P with Q }} with B{val y: Q}
+B{val y: R forSome { type R <: P with Q }} with B{val y: R forSome { type R <: P with Q }}
+C{val y: P} with Any{val y: P}
+C{val y: P} with Any{val y: Q}
+C{val y: P} with Any{val y: R forSome { type R <: P with Q }}
+C{val y: P} with A{val y: P}
+C{val y: P} with A{val y: Q}
+C{val y: P} with A{val y: R forSome { type R <: P with Q }}
+C{val y: P} with B{val y: P}
+C{val y: P} with B{val y: Q}
+C{val y: P} with B{val y: R forSome { type R <: P with Q }}
+C{val y: Q} with Any{val y: P}
+C{val y: Q} with Any{val y: Q}
+C{val y: Q} with Any{val y: R forSome { type R <: P with Q }}
+C{val y: Q} with A{val y: P}
+C{val y: Q} with A{val y: Q}
+C{val y: Q} with A{val y: R forSome { type R <: P with Q }}
+C{val y: Q} with B{val y: P}
+C{val y: Q} with B{val y: Q}
+C{val y: Q} with B{val y: R forSome { type R <: P with Q }}
+C{val y: R forSome { type R <: P with Q }} with Any{val y: P}
+C{val y: R forSome { type R <: P with Q }} with Any{val y: Q}
+C{val y: R forSome { type R <: P with Q }} with Any{val y: R forSome { type R <: P with Q }}
+C{val y: R forSome { type R <: P with Q }} with A{val y: P}
+C{val y: R forSome { type R <: P with Q }} with A{val y: Q}
+C{val y: R forSome { type R <: P with Q }} with A{val y: R forSome { type R <: P with Q }}
+C{val y: R forSome { type R <: P with Q }} with B{val y: P}
+C{val y: R forSome { type R <: P with Q }} with B{val y: Q}
+C{val y: R forSome { type R <: P with Q }} with B{val y: R forSome { type R <: P with Q }}
+
+
diff --git a/test/files/run/t3425b/Base_1.scala b/test/files/run/t3425b/Base_1.scala
new file mode 100644
index 0000000000..bdbc124d29
--- /dev/null
+++ b/test/files/run/t3425b/Base_1.scala
@@ -0,0 +1,89 @@
+trait P { def reflected: Boolean }
+trait Q { def reflected: Boolean }
+class PQ(val reflected: Boolean) extends P with Q { }
+
+trait A
+trait B
+trait C { val y: P }
+class ABC extends A with B with C {
+ private def reflected = (
+ Thread.currentThread.getStackTrace
+ takeWhile (_.getMethodName != "main")
+ exists (_.toString contains "sun.reflect.")
+ )
+ lazy val y: PQ = new PQ(reflected)
+}
+
+/*** The source used to generate the second file
+ Not otherwise used in the test except that compiling
+ it helps make sure it still compiles.
+
+****/
+
+object Gen {
+ case class Tp(outer: String, elem: String) {
+ override def toString = s"$outer { val y: $elem }"
+ }
+ case class Pair(tp1: Tp, tp2: Tp) {
+ def expr = s"((new ABC): $tp)"
+ def tp = s"($tp1) with ($tp2)"
+ }
+ val traits = Vector("Any", "A", "B", "C") map ("%6s" format _)
+ val types = Vector("P", "Q", "R forSome { type R <: P with Q }")
+ val allTypes = for (c <- traits ; tp <- types) yield Tp(c, tp)
+ val pairs = allTypes flatMap (t1 => allTypes map (t2 => Pair(t1, t2)))
+ val indices = pairs.indices
+
+ def aliases(idx: Int) = {
+ val p = pairs(idx)
+ import p._
+ List(
+ s"type R1_$idx = $tp",
+ s"type R2_$idx = R1_$idx { val y: (${tp1.elem}) with (${tp2.elem}) }"
+ )
+ }
+
+ def mkMethodContent(pre: String)(f: Int => String) =
+ indices map (i => s"def $pre$i${f(i)}") mkString "\n "
+
+ def content = List(
+ indices flatMap aliases mkString "\n ",
+ mkMethodContent("f")(i => s" = { val x = ${pairs(i).expr} ; x.y.reflected -> whatis(x).toString }"),
+ mkMethodContent("g")(i => s"""(x: R1_$i) = x.y"""),
+ mkMethodContent("h")(i => s"""(x: R2_$i) = x.y""")
+ ) mkString "\n "
+
+ def fCalls = indices map ("f" + _) mkString ("\n ", ",\n ", "\n ")
+
+ def main(args: Array[String]): Unit = {
+ // One cannot attain proper appreciation for the inadequacies of
+ // string interpolation without becoming one with the newline.
+ val nl = "\\n"
+
+ println(s"""
+ |import scala.reflect.runtime.universe._
+ |import scala.language._
+ |
+ |object Test {
+ | def whatis[T: TypeTag](x: T) = typeOf[T]
+ | def sshow(label: String, xs: Traversable[Any]) {
+ | println("==== " + label + " ====$nl")
+ | xs.toList.map("" + _).sorted foreach println
+ | println("$nl")
+ | }
+ |
+ | $content
+ | lazy val fcalls = List($fCalls)
+ |
+ | def main(args: Array[String]) {
+ | sshow("Direct Calls", fcalls collect { case (false, n) => n })
+ | sshow("Reflective Calls", fcalls collect { case (true, n) => n })
+ | // For a good time try printing this - have to fix bugs in
+ | // reflection before that's going to be a good idea
+ | // println(typeOf[Test.type].typeSymbol.asClass.info)
+ | }
+ |}
+ """.stripMargin.trim
+ )
+ }
+}
diff --git a/test/files/run/t3425b/Generated_2.scala b/test/files/run/t3425b/Generated_2.scala
new file mode 100644
index 0000000000..d08f17e8b2
--- /dev/null
+++ b/test/files/run/t3425b/Generated_2.scala
@@ -0,0 +1,886 @@
+import scala.reflect.runtime.universe._
+import scala.language._
+
+object Test {
+ def whatis[T: TypeTag](x: T) = typeOf[T]
+ def sshow(label: String, xs: Traversable[Any]) {
+ println("==== " + label + " ====\n")
+ xs.toList.map("" + _).sorted foreach println
+ println("\n")
+ }
+
+ type R1_0 = ( Any { val y: P }) with ( Any { val y: P })
+ type R2_0 = R1_0 { val y: (P) with (P) }
+ type R1_1 = ( Any { val y: P }) with ( Any { val y: Q })
+ type R2_1 = R1_1 { val y: (P) with (Q) }
+ type R1_2 = ( Any { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_2 = R1_2 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_3 = ( Any { val y: P }) with ( A { val y: P })
+ type R2_3 = R1_3 { val y: (P) with (P) }
+ type R1_4 = ( Any { val y: P }) with ( A { val y: Q })
+ type R2_4 = R1_4 { val y: (P) with (Q) }
+ type R1_5 = ( Any { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_5 = R1_5 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_6 = ( Any { val y: P }) with ( B { val y: P })
+ type R2_6 = R1_6 { val y: (P) with (P) }
+ type R1_7 = ( Any { val y: P }) with ( B { val y: Q })
+ type R2_7 = R1_7 { val y: (P) with (Q) }
+ type R1_8 = ( Any { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_8 = R1_8 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_9 = ( Any { val y: P }) with ( C { val y: P })
+ type R2_9 = R1_9 { val y: (P) with (P) }
+ type R1_10 = ( Any { val y: P }) with ( C { val y: Q })
+ type R2_10 = R1_10 { val y: (P) with (Q) }
+ type R1_11 = ( Any { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_11 = R1_11 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_12 = ( Any { val y: Q }) with ( Any { val y: P })
+ type R2_12 = R1_12 { val y: (Q) with (P) }
+ type R1_13 = ( Any { val y: Q }) with ( Any { val y: Q })
+ type R2_13 = R1_13 { val y: (Q) with (Q) }
+ type R1_14 = ( Any { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_14 = R1_14 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_15 = ( Any { val y: Q }) with ( A { val y: P })
+ type R2_15 = R1_15 { val y: (Q) with (P) }
+ type R1_16 = ( Any { val y: Q }) with ( A { val y: Q })
+ type R2_16 = R1_16 { val y: (Q) with (Q) }
+ type R1_17 = ( Any { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_17 = R1_17 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_18 = ( Any { val y: Q }) with ( B { val y: P })
+ type R2_18 = R1_18 { val y: (Q) with (P) }
+ type R1_19 = ( Any { val y: Q }) with ( B { val y: Q })
+ type R2_19 = R1_19 { val y: (Q) with (Q) }
+ type R1_20 = ( Any { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_20 = R1_20 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_21 = ( Any { val y: Q }) with ( C { val y: P })
+ type R2_21 = R1_21 { val y: (Q) with (P) }
+ type R1_22 = ( Any { val y: Q }) with ( C { val y: Q })
+ type R2_22 = R1_22 { val y: (Q) with (Q) }
+ type R1_23 = ( Any { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_23 = R1_23 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_24 = ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })
+ type R2_24 = R1_24 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_25 = ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })
+ type R2_25 = R1_25 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_26 = ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_26 = R1_26 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_27 = ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })
+ type R2_27 = R1_27 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_28 = ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })
+ type R2_28 = R1_28 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_29 = ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_29 = R1_29 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_30 = ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })
+ type R2_30 = R1_30 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_31 = ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })
+ type R2_31 = R1_31 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_32 = ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_32 = R1_32 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_33 = ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })
+ type R2_33 = R1_33 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_34 = ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })
+ type R2_34 = R1_34 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_35 = ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_35 = R1_35 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_36 = ( A { val y: P }) with ( Any { val y: P })
+ type R2_36 = R1_36 { val y: (P) with (P) }
+ type R1_37 = ( A { val y: P }) with ( Any { val y: Q })
+ type R2_37 = R1_37 { val y: (P) with (Q) }
+ type R1_38 = ( A { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_38 = R1_38 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_39 = ( A { val y: P }) with ( A { val y: P })
+ type R2_39 = R1_39 { val y: (P) with (P) }
+ type R1_40 = ( A { val y: P }) with ( A { val y: Q })
+ type R2_40 = R1_40 { val y: (P) with (Q) }
+ type R1_41 = ( A { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_41 = R1_41 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_42 = ( A { val y: P }) with ( B { val y: P })
+ type R2_42 = R1_42 { val y: (P) with (P) }
+ type R1_43 = ( A { val y: P }) with ( B { val y: Q })
+ type R2_43 = R1_43 { val y: (P) with (Q) }
+ type R1_44 = ( A { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_44 = R1_44 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_45 = ( A { val y: P }) with ( C { val y: P })
+ type R2_45 = R1_45 { val y: (P) with (P) }
+ type R1_46 = ( A { val y: P }) with ( C { val y: Q })
+ type R2_46 = R1_46 { val y: (P) with (Q) }
+ type R1_47 = ( A { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_47 = R1_47 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_48 = ( A { val y: Q }) with ( Any { val y: P })
+ type R2_48 = R1_48 { val y: (Q) with (P) }
+ type R1_49 = ( A { val y: Q }) with ( Any { val y: Q })
+ type R2_49 = R1_49 { val y: (Q) with (Q) }
+ type R1_50 = ( A { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_50 = R1_50 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_51 = ( A { val y: Q }) with ( A { val y: P })
+ type R2_51 = R1_51 { val y: (Q) with (P) }
+ type R1_52 = ( A { val y: Q }) with ( A { val y: Q })
+ type R2_52 = R1_52 { val y: (Q) with (Q) }
+ type R1_53 = ( A { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_53 = R1_53 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_54 = ( A { val y: Q }) with ( B { val y: P })
+ type R2_54 = R1_54 { val y: (Q) with (P) }
+ type R1_55 = ( A { val y: Q }) with ( B { val y: Q })
+ type R2_55 = R1_55 { val y: (Q) with (Q) }
+ type R1_56 = ( A { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_56 = R1_56 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_57 = ( A { val y: Q }) with ( C { val y: P })
+ type R2_57 = R1_57 { val y: (Q) with (P) }
+ type R1_58 = ( A { val y: Q }) with ( C { val y: Q })
+ type R2_58 = R1_58 { val y: (Q) with (Q) }
+ type R1_59 = ( A { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_59 = R1_59 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_60 = ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })
+ type R2_60 = R1_60 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_61 = ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })
+ type R2_61 = R1_61 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_62 = ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_62 = R1_62 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_63 = ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })
+ type R2_63 = R1_63 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_64 = ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })
+ type R2_64 = R1_64 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_65 = ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_65 = R1_65 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_66 = ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })
+ type R2_66 = R1_66 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_67 = ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })
+ type R2_67 = R1_67 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_68 = ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_68 = R1_68 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_69 = ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })
+ type R2_69 = R1_69 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_70 = ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })
+ type R2_70 = R1_70 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_71 = ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_71 = R1_71 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_72 = ( B { val y: P }) with ( Any { val y: P })
+ type R2_72 = R1_72 { val y: (P) with (P) }
+ type R1_73 = ( B { val y: P }) with ( Any { val y: Q })
+ type R2_73 = R1_73 { val y: (P) with (Q) }
+ type R1_74 = ( B { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_74 = R1_74 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_75 = ( B { val y: P }) with ( A { val y: P })
+ type R2_75 = R1_75 { val y: (P) with (P) }
+ type R1_76 = ( B { val y: P }) with ( A { val y: Q })
+ type R2_76 = R1_76 { val y: (P) with (Q) }
+ type R1_77 = ( B { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_77 = R1_77 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_78 = ( B { val y: P }) with ( B { val y: P })
+ type R2_78 = R1_78 { val y: (P) with (P) }
+ type R1_79 = ( B { val y: P }) with ( B { val y: Q })
+ type R2_79 = R1_79 { val y: (P) with (Q) }
+ type R1_80 = ( B { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_80 = R1_80 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_81 = ( B { val y: P }) with ( C { val y: P })
+ type R2_81 = R1_81 { val y: (P) with (P) }
+ type R1_82 = ( B { val y: P }) with ( C { val y: Q })
+ type R2_82 = R1_82 { val y: (P) with (Q) }
+ type R1_83 = ( B { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_83 = R1_83 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_84 = ( B { val y: Q }) with ( Any { val y: P })
+ type R2_84 = R1_84 { val y: (Q) with (P) }
+ type R1_85 = ( B { val y: Q }) with ( Any { val y: Q })
+ type R2_85 = R1_85 { val y: (Q) with (Q) }
+ type R1_86 = ( B { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_86 = R1_86 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_87 = ( B { val y: Q }) with ( A { val y: P })
+ type R2_87 = R1_87 { val y: (Q) with (P) }
+ type R1_88 = ( B { val y: Q }) with ( A { val y: Q })
+ type R2_88 = R1_88 { val y: (Q) with (Q) }
+ type R1_89 = ( B { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_89 = R1_89 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_90 = ( B { val y: Q }) with ( B { val y: P })
+ type R2_90 = R1_90 { val y: (Q) with (P) }
+ type R1_91 = ( B { val y: Q }) with ( B { val y: Q })
+ type R2_91 = R1_91 { val y: (Q) with (Q) }
+ type R1_92 = ( B { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_92 = R1_92 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_93 = ( B { val y: Q }) with ( C { val y: P })
+ type R2_93 = R1_93 { val y: (Q) with (P) }
+ type R1_94 = ( B { val y: Q }) with ( C { val y: Q })
+ type R2_94 = R1_94 { val y: (Q) with (Q) }
+ type R1_95 = ( B { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_95 = R1_95 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_96 = ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })
+ type R2_96 = R1_96 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_97 = ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })
+ type R2_97 = R1_97 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_98 = ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_98 = R1_98 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_99 = ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })
+ type R2_99 = R1_99 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_100 = ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })
+ type R2_100 = R1_100 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_101 = ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_101 = R1_101 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_102 = ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })
+ type R2_102 = R1_102 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_103 = ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })
+ type R2_103 = R1_103 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_104 = ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_104 = R1_104 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_105 = ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })
+ type R2_105 = R1_105 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_106 = ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })
+ type R2_106 = R1_106 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_107 = ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_107 = R1_107 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_108 = ( C { val y: P }) with ( Any { val y: P })
+ type R2_108 = R1_108 { val y: (P) with (P) }
+ type R1_109 = ( C { val y: P }) with ( Any { val y: Q })
+ type R2_109 = R1_109 { val y: (P) with (Q) }
+ type R1_110 = ( C { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_110 = R1_110 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_111 = ( C { val y: P }) with ( A { val y: P })
+ type R2_111 = R1_111 { val y: (P) with (P) }
+ type R1_112 = ( C { val y: P }) with ( A { val y: Q })
+ type R2_112 = R1_112 { val y: (P) with (Q) }
+ type R1_113 = ( C { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_113 = R1_113 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_114 = ( C { val y: P }) with ( B { val y: P })
+ type R2_114 = R1_114 { val y: (P) with (P) }
+ type R1_115 = ( C { val y: P }) with ( B { val y: Q })
+ type R2_115 = R1_115 { val y: (P) with (Q) }
+ type R1_116 = ( C { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_116 = R1_116 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_117 = ( C { val y: P }) with ( C { val y: P })
+ type R2_117 = R1_117 { val y: (P) with (P) }
+ type R1_118 = ( C { val y: P }) with ( C { val y: Q })
+ type R2_118 = R1_118 { val y: (P) with (Q) }
+ type R1_119 = ( C { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_119 = R1_119 { val y: (P) with (R forSome { type R <: P with Q }) }
+ type R1_120 = ( C { val y: Q }) with ( Any { val y: P })
+ type R2_120 = R1_120 { val y: (Q) with (P) }
+ type R1_121 = ( C { val y: Q }) with ( Any { val y: Q })
+ type R2_121 = R1_121 { val y: (Q) with (Q) }
+ type R1_122 = ( C { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_122 = R1_122 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_123 = ( C { val y: Q }) with ( A { val y: P })
+ type R2_123 = R1_123 { val y: (Q) with (P) }
+ type R1_124 = ( C { val y: Q }) with ( A { val y: Q })
+ type R2_124 = R1_124 { val y: (Q) with (Q) }
+ type R1_125 = ( C { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_125 = R1_125 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_126 = ( C { val y: Q }) with ( B { val y: P })
+ type R2_126 = R1_126 { val y: (Q) with (P) }
+ type R1_127 = ( C { val y: Q }) with ( B { val y: Q })
+ type R2_127 = R1_127 { val y: (Q) with (Q) }
+ type R1_128 = ( C { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_128 = R1_128 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_129 = ( C { val y: Q }) with ( C { val y: P })
+ type R2_129 = R1_129 { val y: (Q) with (P) }
+ type R1_130 = ( C { val y: Q }) with ( C { val y: Q })
+ type R2_130 = R1_130 { val y: (Q) with (Q) }
+ type R1_131 = ( C { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_131 = R1_131 { val y: (Q) with (R forSome { type R <: P with Q }) }
+ type R1_132 = ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })
+ type R2_132 = R1_132 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_133 = ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })
+ type R2_133 = R1_133 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_134 = ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })
+ type R2_134 = R1_134 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_135 = ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })
+ type R2_135 = R1_135 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_136 = ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })
+ type R2_136 = R1_136 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_137 = ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })
+ type R2_137 = R1_137 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_138 = ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })
+ type R2_138 = R1_138 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_139 = ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })
+ type R2_139 = R1_139 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_140 = ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })
+ type R2_140 = R1_140 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ type R1_141 = ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })
+ type R2_141 = R1_141 { val y: (R forSome { type R <: P with Q }) with (P) }
+ type R1_142 = ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })
+ type R2_142 = R1_142 { val y: (R forSome { type R <: P with Q }) with (Q) }
+ type R1_143 = ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })
+ type R2_143 = R1_143 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) }
+ def f0 = { val x = ((new ABC): ( Any { val y: P }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f1 = { val x = ((new ABC): ( Any { val y: P }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f2 = { val x = ((new ABC): ( Any { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f3 = { val x = ((new ABC): ( Any { val y: P }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f4 = { val x = ((new ABC): ( Any { val y: P }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f5 = { val x = ((new ABC): ( Any { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f6 = { val x = ((new ABC): ( Any { val y: P }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f7 = { val x = ((new ABC): ( Any { val y: P }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f8 = { val x = ((new ABC): ( Any { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f9 = { val x = ((new ABC): ( Any { val y: P }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f10 = { val x = ((new ABC): ( Any { val y: P }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f11 = { val x = ((new ABC): ( Any { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f12 = { val x = ((new ABC): ( Any { val y: Q }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f13 = { val x = ((new ABC): ( Any { val y: Q }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f14 = { val x = ((new ABC): ( Any { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f15 = { val x = ((new ABC): ( Any { val y: Q }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f16 = { val x = ((new ABC): ( Any { val y: Q }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f17 = { val x = ((new ABC): ( Any { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f18 = { val x = ((new ABC): ( Any { val y: Q }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f19 = { val x = ((new ABC): ( Any { val y: Q }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f20 = { val x = ((new ABC): ( Any { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f21 = { val x = ((new ABC): ( Any { val y: Q }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f22 = { val x = ((new ABC): ( Any { val y: Q }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f23 = { val x = ((new ABC): ( Any { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f24 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f25 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f26 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f27 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f28 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f29 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f30 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f31 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f32 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f33 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f34 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f35 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f36 = { val x = ((new ABC): ( A { val y: P }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f37 = { val x = ((new ABC): ( A { val y: P }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f38 = { val x = ((new ABC): ( A { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f39 = { val x = ((new ABC): ( A { val y: P }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f40 = { val x = ((new ABC): ( A { val y: P }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f41 = { val x = ((new ABC): ( A { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f42 = { val x = ((new ABC): ( A { val y: P }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f43 = { val x = ((new ABC): ( A { val y: P }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f44 = { val x = ((new ABC): ( A { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f45 = { val x = ((new ABC): ( A { val y: P }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f46 = { val x = ((new ABC): ( A { val y: P }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f47 = { val x = ((new ABC): ( A { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f48 = { val x = ((new ABC): ( A { val y: Q }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f49 = { val x = ((new ABC): ( A { val y: Q }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f50 = { val x = ((new ABC): ( A { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f51 = { val x = ((new ABC): ( A { val y: Q }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f52 = { val x = ((new ABC): ( A { val y: Q }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f53 = { val x = ((new ABC): ( A { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f54 = { val x = ((new ABC): ( A { val y: Q }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f55 = { val x = ((new ABC): ( A { val y: Q }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f56 = { val x = ((new ABC): ( A { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f57 = { val x = ((new ABC): ( A { val y: Q }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f58 = { val x = ((new ABC): ( A { val y: Q }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f59 = { val x = ((new ABC): ( A { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f60 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f61 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f62 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f63 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f64 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f65 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f66 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f67 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f68 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f69 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f70 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f71 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f72 = { val x = ((new ABC): ( B { val y: P }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f73 = { val x = ((new ABC): ( B { val y: P }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f74 = { val x = ((new ABC): ( B { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f75 = { val x = ((new ABC): ( B { val y: P }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f76 = { val x = ((new ABC): ( B { val y: P }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f77 = { val x = ((new ABC): ( B { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f78 = { val x = ((new ABC): ( B { val y: P }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f79 = { val x = ((new ABC): ( B { val y: P }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f80 = { val x = ((new ABC): ( B { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f81 = { val x = ((new ABC): ( B { val y: P }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f82 = { val x = ((new ABC): ( B { val y: P }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f83 = { val x = ((new ABC): ( B { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f84 = { val x = ((new ABC): ( B { val y: Q }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f85 = { val x = ((new ABC): ( B { val y: Q }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f86 = { val x = ((new ABC): ( B { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f87 = { val x = ((new ABC): ( B { val y: Q }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f88 = { val x = ((new ABC): ( B { val y: Q }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f89 = { val x = ((new ABC): ( B { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f90 = { val x = ((new ABC): ( B { val y: Q }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f91 = { val x = ((new ABC): ( B { val y: Q }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f92 = { val x = ((new ABC): ( B { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f93 = { val x = ((new ABC): ( B { val y: Q }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f94 = { val x = ((new ABC): ( B { val y: Q }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f95 = { val x = ((new ABC): ( B { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f96 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f97 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f98 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f99 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f100 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f101 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f102 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f103 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f104 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f105 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f106 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f107 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f108 = { val x = ((new ABC): ( C { val y: P }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f109 = { val x = ((new ABC): ( C { val y: P }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f110 = { val x = ((new ABC): ( C { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f111 = { val x = ((new ABC): ( C { val y: P }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f112 = { val x = ((new ABC): ( C { val y: P }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f113 = { val x = ((new ABC): ( C { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f114 = { val x = ((new ABC): ( C { val y: P }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f115 = { val x = ((new ABC): ( C { val y: P }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f116 = { val x = ((new ABC): ( C { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f117 = { val x = ((new ABC): ( C { val y: P }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f118 = { val x = ((new ABC): ( C { val y: P }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f119 = { val x = ((new ABC): ( C { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f120 = { val x = ((new ABC): ( C { val y: Q }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f121 = { val x = ((new ABC): ( C { val y: Q }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f122 = { val x = ((new ABC): ( C { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f123 = { val x = ((new ABC): ( C { val y: Q }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f124 = { val x = ((new ABC): ( C { val y: Q }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f125 = { val x = ((new ABC): ( C { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f126 = { val x = ((new ABC): ( C { val y: Q }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f127 = { val x = ((new ABC): ( C { val y: Q }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f128 = { val x = ((new ABC): ( C { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f129 = { val x = ((new ABC): ( C { val y: Q }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f130 = { val x = ((new ABC): ( C { val y: Q }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f131 = { val x = ((new ABC): ( C { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f132 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f133 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f134 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f135 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f136 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f137 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f138 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f139 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f140 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def f141 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString }
+ def f142 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString }
+ def f143 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString }
+ def g0(x: R1_0) = x.y
+ def g1(x: R1_1) = x.y
+ def g2(x: R1_2) = x.y
+ def g3(x: R1_3) = x.y
+ def g4(x: R1_4) = x.y
+ def g5(x: R1_5) = x.y
+ def g6(x: R1_6) = x.y
+ def g7(x: R1_7) = x.y
+ def g8(x: R1_8) = x.y
+ def g9(x: R1_9) = x.y
+ def g10(x: R1_10) = x.y
+ def g11(x: R1_11) = x.y
+ def g12(x: R1_12) = x.y
+ def g13(x: R1_13) = x.y
+ def g14(x: R1_14) = x.y
+ def g15(x: R1_15) = x.y
+ def g16(x: R1_16) = x.y
+ def g17(x: R1_17) = x.y
+ def g18(x: R1_18) = x.y
+ def g19(x: R1_19) = x.y
+ def g20(x: R1_20) = x.y
+ def g21(x: R1_21) = x.y
+ def g22(x: R1_22) = x.y
+ def g23(x: R1_23) = x.y
+ def g24(x: R1_24) = x.y
+ def g25(x: R1_25) = x.y
+ def g26(x: R1_26) = x.y
+ def g27(x: R1_27) = x.y
+ def g28(x: R1_28) = x.y
+ def g29(x: R1_29) = x.y
+ def g30(x: R1_30) = x.y
+ def g31(x: R1_31) = x.y
+ def g32(x: R1_32) = x.y
+ def g33(x: R1_33) = x.y
+ def g34(x: R1_34) = x.y
+ def g35(x: R1_35) = x.y
+ def g36(x: R1_36) = x.y
+ def g37(x: R1_37) = x.y
+ def g38(x: R1_38) = x.y
+ def g39(x: R1_39) = x.y
+ def g40(x: R1_40) = x.y
+ def g41(x: R1_41) = x.y
+ def g42(x: R1_42) = x.y
+ def g43(x: R1_43) = x.y
+ def g44(x: R1_44) = x.y
+ def g45(x: R1_45) = x.y
+ def g46(x: R1_46) = x.y
+ def g47(x: R1_47) = x.y
+ def g48(x: R1_48) = x.y
+ def g49(x: R1_49) = x.y
+ def g50(x: R1_50) = x.y
+ def g51(x: R1_51) = x.y
+ def g52(x: R1_52) = x.y
+ def g53(x: R1_53) = x.y
+ def g54(x: R1_54) = x.y
+ def g55(x: R1_55) = x.y
+ def g56(x: R1_56) = x.y
+ def g57(x: R1_57) = x.y
+ def g58(x: R1_58) = x.y
+ def g59(x: R1_59) = x.y
+ def g60(x: R1_60) = x.y
+ def g61(x: R1_61) = x.y
+ def g62(x: R1_62) = x.y
+ def g63(x: R1_63) = x.y
+ def g64(x: R1_64) = x.y
+ def g65(x: R1_65) = x.y
+ def g66(x: R1_66) = x.y
+ def g67(x: R1_67) = x.y
+ def g68(x: R1_68) = x.y
+ def g69(x: R1_69) = x.y
+ def g70(x: R1_70) = x.y
+ def g71(x: R1_71) = x.y
+ def g72(x: R1_72) = x.y
+ def g73(x: R1_73) = x.y
+ def g74(x: R1_74) = x.y
+ def g75(x: R1_75) = x.y
+ def g76(x: R1_76) = x.y
+ def g77(x: R1_77) = x.y
+ def g78(x: R1_78) = x.y
+ def g79(x: R1_79) = x.y
+ def g80(x: R1_80) = x.y
+ def g81(x: R1_81) = x.y
+ def g82(x: R1_82) = x.y
+ def g83(x: R1_83) = x.y
+ def g84(x: R1_84) = x.y
+ def g85(x: R1_85) = x.y
+ def g86(x: R1_86) = x.y
+ def g87(x: R1_87) = x.y
+ def g88(x: R1_88) = x.y
+ def g89(x: R1_89) = x.y
+ def g90(x: R1_90) = x.y
+ def g91(x: R1_91) = x.y
+ def g92(x: R1_92) = x.y
+ def g93(x: R1_93) = x.y
+ def g94(x: R1_94) = x.y
+ def g95(x: R1_95) = x.y
+ def g96(x: R1_96) = x.y
+ def g97(x: R1_97) = x.y
+ def g98(x: R1_98) = x.y
+ def g99(x: R1_99) = x.y
+ def g100(x: R1_100) = x.y
+ def g101(x: R1_101) = x.y
+ def g102(x: R1_102) = x.y
+ def g103(x: R1_103) = x.y
+ def g104(x: R1_104) = x.y
+ def g105(x: R1_105) = x.y
+ def g106(x: R1_106) = x.y
+ def g107(x: R1_107) = x.y
+ def g108(x: R1_108) = x.y
+ def g109(x: R1_109) = x.y
+ def g110(x: R1_110) = x.y
+ def g111(x: R1_111) = x.y
+ def g112(x: R1_112) = x.y
+ def g113(x: R1_113) = x.y
+ def g114(x: R1_114) = x.y
+ def g115(x: R1_115) = x.y
+ def g116(x: R1_116) = x.y
+ def g117(x: R1_117) = x.y
+ def g118(x: R1_118) = x.y
+ def g119(x: R1_119) = x.y
+ def g120(x: R1_120) = x.y
+ def g121(x: R1_121) = x.y
+ def g122(x: R1_122) = x.y
+ def g123(x: R1_123) = x.y
+ def g124(x: R1_124) = x.y
+ def g125(x: R1_125) = x.y
+ def g126(x: R1_126) = x.y
+ def g127(x: R1_127) = x.y
+ def g128(x: R1_128) = x.y
+ def g129(x: R1_129) = x.y
+ def g130(x: R1_130) = x.y
+ def g131(x: R1_131) = x.y
+ def g132(x: R1_132) = x.y
+ def g133(x: R1_133) = x.y
+ def g134(x: R1_134) = x.y
+ def g135(x: R1_135) = x.y
+ def g136(x: R1_136) = x.y
+ def g137(x: R1_137) = x.y
+ def g138(x: R1_138) = x.y
+ def g139(x: R1_139) = x.y
+ def g140(x: R1_140) = x.y
+ def g141(x: R1_141) = x.y
+ def g142(x: R1_142) = x.y
+ def g143(x: R1_143) = x.y
+ def h0(x: R2_0) = x.y
+ def h1(x: R2_1) = x.y
+ def h2(x: R2_2) = x.y
+ def h3(x: R2_3) = x.y
+ def h4(x: R2_4) = x.y
+ def h5(x: R2_5) = x.y
+ def h6(x: R2_6) = x.y
+ def h7(x: R2_7) = x.y
+ def h8(x: R2_8) = x.y
+ def h9(x: R2_9) = x.y
+ def h10(x: R2_10) = x.y
+ def h11(x: R2_11) = x.y
+ def h12(x: R2_12) = x.y
+ def h13(x: R2_13) = x.y
+ def h14(x: R2_14) = x.y
+ def h15(x: R2_15) = x.y
+ def h16(x: R2_16) = x.y
+ def h17(x: R2_17) = x.y
+ def h18(x: R2_18) = x.y
+ def h19(x: R2_19) = x.y
+ def h20(x: R2_20) = x.y
+ def h21(x: R2_21) = x.y
+ def h22(x: R2_22) = x.y
+ def h23(x: R2_23) = x.y
+ def h24(x: R2_24) = x.y
+ def h25(x: R2_25) = x.y
+ def h26(x: R2_26) = x.y
+ def h27(x: R2_27) = x.y
+ def h28(x: R2_28) = x.y
+ def h29(x: R2_29) = x.y
+ def h30(x: R2_30) = x.y
+ def h31(x: R2_31) = x.y
+ def h32(x: R2_32) = x.y
+ def h33(x: R2_33) = x.y
+ def h34(x: R2_34) = x.y
+ def h35(x: R2_35) = x.y
+ def h36(x: R2_36) = x.y
+ def h37(x: R2_37) = x.y
+ def h38(x: R2_38) = x.y
+ def h39(x: R2_39) = x.y
+ def h40(x: R2_40) = x.y
+ def h41(x: R2_41) = x.y
+ def h42(x: R2_42) = x.y
+ def h43(x: R2_43) = x.y
+ def h44(x: R2_44) = x.y
+ def h45(x: R2_45) = x.y
+ def h46(x: R2_46) = x.y
+ def h47(x: R2_47) = x.y
+ def h48(x: R2_48) = x.y
+ def h49(x: R2_49) = x.y
+ def h50(x: R2_50) = x.y
+ def h51(x: R2_51) = x.y
+ def h52(x: R2_52) = x.y
+ def h53(x: R2_53) = x.y
+ def h54(x: R2_54) = x.y
+ def h55(x: R2_55) = x.y
+ def h56(x: R2_56) = x.y
+ def h57(x: R2_57) = x.y
+ def h58(x: R2_58) = x.y
+ def h59(x: R2_59) = x.y
+ def h60(x: R2_60) = x.y
+ def h61(x: R2_61) = x.y
+ def h62(x: R2_62) = x.y
+ def h63(x: R2_63) = x.y
+ def h64(x: R2_64) = x.y
+ def h65(x: R2_65) = x.y
+ def h66(x: R2_66) = x.y
+ def h67(x: R2_67) = x.y
+ def h68(x: R2_68) = x.y
+ def h69(x: R2_69) = x.y
+ def h70(x: R2_70) = x.y
+ def h71(x: R2_71) = x.y
+ def h72(x: R2_72) = x.y
+ def h73(x: R2_73) = x.y
+ def h74(x: R2_74) = x.y
+ def h75(x: R2_75) = x.y
+ def h76(x: R2_76) = x.y
+ def h77(x: R2_77) = x.y
+ def h78(x: R2_78) = x.y
+ def h79(x: R2_79) = x.y
+ def h80(x: R2_80) = x.y
+ def h81(x: R2_81) = x.y
+ def h82(x: R2_82) = x.y
+ def h83(x: R2_83) = x.y
+ def h84(x: R2_84) = x.y
+ def h85(x: R2_85) = x.y
+ def h86(x: R2_86) = x.y
+ def h87(x: R2_87) = x.y
+ def h88(x: R2_88) = x.y
+ def h89(x: R2_89) = x.y
+ def h90(x: R2_90) = x.y
+ def h91(x: R2_91) = x.y
+ def h92(x: R2_92) = x.y
+ def h93(x: R2_93) = x.y
+ def h94(x: R2_94) = x.y
+ def h95(x: R2_95) = x.y
+ def h96(x: R2_96) = x.y
+ def h97(x: R2_97) = x.y
+ def h98(x: R2_98) = x.y
+ def h99(x: R2_99) = x.y
+ def h100(x: R2_100) = x.y
+ def h101(x: R2_101) = x.y
+ def h102(x: R2_102) = x.y
+ def h103(x: R2_103) = x.y
+ def h104(x: R2_104) = x.y
+ def h105(x: R2_105) = x.y
+ def h106(x: R2_106) = x.y
+ def h107(x: R2_107) = x.y
+ def h108(x: R2_108) = x.y
+ def h109(x: R2_109) = x.y
+ def h110(x: R2_110) = x.y
+ def h111(x: R2_111) = x.y
+ def h112(x: R2_112) = x.y
+ def h113(x: R2_113) = x.y
+ def h114(x: R2_114) = x.y
+ def h115(x: R2_115) = x.y
+ def h116(x: R2_116) = x.y
+ def h117(x: R2_117) = x.y
+ def h118(x: R2_118) = x.y
+ def h119(x: R2_119) = x.y
+ def h120(x: R2_120) = x.y
+ def h121(x: R2_121) = x.y
+ def h122(x: R2_122) = x.y
+ def h123(x: R2_123) = x.y
+ def h124(x: R2_124) = x.y
+ def h125(x: R2_125) = x.y
+ def h126(x: R2_126) = x.y
+ def h127(x: R2_127) = x.y
+ def h128(x: R2_128) = x.y
+ def h129(x: R2_129) = x.y
+ def h130(x: R2_130) = x.y
+ def h131(x: R2_131) = x.y
+ def h132(x: R2_132) = x.y
+ def h133(x: R2_133) = x.y
+ def h134(x: R2_134) = x.y
+ def h135(x: R2_135) = x.y
+ def h136(x: R2_136) = x.y
+ def h137(x: R2_137) = x.y
+ def h138(x: R2_138) = x.y
+ def h139(x: R2_139) = x.y
+ def h140(x: R2_140) = x.y
+ def h141(x: R2_141) = x.y
+ def h142(x: R2_142) = x.y
+ def h143(x: R2_143) = x.y
+ lazy val fcalls = List(
+ f0,
+ f1,
+ f2,
+ f3,
+ f4,
+ f5,
+ f6,
+ f7,
+ f8,
+ f9,
+ f10,
+ f11,
+ f12,
+ f13,
+ f14,
+ f15,
+ f16,
+ f17,
+ f18,
+ f19,
+ f20,
+ f21,
+ f22,
+ f23,
+ f24,
+ f25,
+ f26,
+ f27,
+ f28,
+ f29,
+ f30,
+ f31,
+ f32,
+ f33,
+ f34,
+ f35,
+ f36,
+ f37,
+ f38,
+ f39,
+ f40,
+ f41,
+ f42,
+ f43,
+ f44,
+ f45,
+ f46,
+ f47,
+ f48,
+ f49,
+ f50,
+ f51,
+ f52,
+ f53,
+ f54,
+ f55,
+ f56,
+ f57,
+ f58,
+ f59,
+ f60,
+ f61,
+ f62,
+ f63,
+ f64,
+ f65,
+ f66,
+ f67,
+ f68,
+ f69,
+ f70,
+ f71,
+ f72,
+ f73,
+ f74,
+ f75,
+ f76,
+ f77,
+ f78,
+ f79,
+ f80,
+ f81,
+ f82,
+ f83,
+ f84,
+ f85,
+ f86,
+ f87,
+ f88,
+ f89,
+ f90,
+ f91,
+ f92,
+ f93,
+ f94,
+ f95,
+ f96,
+ f97,
+ f98,
+ f99,
+ f100,
+ f101,
+ f102,
+ f103,
+ f104,
+ f105,
+ f106,
+ f107,
+ f108,
+ f109,
+ f110,
+ f111,
+ f112,
+ f113,
+ f114,
+ f115,
+ f116,
+ f117,
+ f118,
+ f119,
+ f120,
+ f121,
+ f122,
+ f123,
+ f124,
+ f125,
+ f126,
+ f127,
+ f128,
+ f129,
+ f130,
+ f131,
+ f132,
+ f133,
+ f134,
+ f135,
+ f136,
+ f137,
+ f138,
+ f139,
+ f140,
+ f141,
+ f142,
+ f143
+ )
+
+ def main(args: Array[String]) {
+ sshow("Direct Calls", fcalls collect { case (false, n) => n })
+ sshow("Reflective Calls", fcalls collect { case (true, n) => n })
+ // For a good time try printing this - have to fix bugs in
+ // reflection before that's going to be a good idea
+ // println(typeOf[Test.type].typeSymbol.asClass.info)
+ }
+}
diff --git a/test/files/run/t3452.check b/test/files/run/t3452.check
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/test/files/run/t3452.check
@@ -0,0 +1 @@
+4
diff --git a/test/files/run/t3452.scala b/test/files/run/t3452.scala
new file mode 100644
index 0000000000..253fc93cfa
--- /dev/null
+++ b/test/files/run/t3452.scala
@@ -0,0 +1,21 @@
+trait IStringPair[T] {
+ def a : String
+ def b : String
+ def build(a : String, b : String) : T
+ def cat(that : IStringPair[T]) = build(this.a + that.a, this.b + that.b)
+ override def toString = a + b
+}
+
+class StringPair(val a : String, val b : String) extends IStringPair[StringPair] {
+ def build(a : String, b : String) = new StringPair(a, b)
+ def len = a.length + b.length
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val a = new StringPair("A", "B")
+ val b = new StringPair("1", "2")
+ val c = a cat b
+ println(c.len)
+ }
+}
diff --git a/test/files/run/t3452a.check b/test/files/run/t3452a.check
new file mode 100644
index 0000000000..9ff787eb86
--- /dev/null
+++ b/test/files/run/t3452a.check
@@ -0,0 +1 @@
+BulkSearch.searchFor called.
diff --git a/test/files/run/t3452a/J_2.java b/test/files/run/t3452a/J_2.java
new file mode 100644
index 0000000000..62057ffe61
--- /dev/null
+++ b/test/files/run/t3452a/J_2.java
@@ -0,0 +1,5 @@
+public class J_2 {
+ public static void main(String[] args) {
+ BulkSearchInstance.searchFor(new UpRelation());
+ }
+}
diff --git a/test/files/run/t3452a/S_1.scala b/test/files/run/t3452a/S_1.scala
new file mode 100644
index 0000000000..791faf42fa
--- /dev/null
+++ b/test/files/run/t3452a/S_1.scala
@@ -0,0 +1,24 @@
+abstract class BulkSearch {
+ type R <: Row
+ type Rel <: Relation [R]
+ type Corr <: Correspondence[R]
+
+ def searchFor(input: Rel): Mapping[Corr] = { println("BulkSearch.searchFor called.") ; null }
+}
+
+object BulkSearchInstance extends BulkSearch {
+ type R = UpRow
+ type Rel = UpRelation
+ type Corr = UpCorrespondence
+}
+
+class Row
+class UpRow extends Row
+
+class Relation [R <: Row]
+class UpRelation extends Relation [UpRow]
+
+class Correspondence [R <: Row]
+class UpCorrespondence extends Correspondence [UpRow]
+
+class Mapping[MC <: Correspondence[_]]
diff --git a/test/files/run/t3452a/S_3.scala b/test/files/run/t3452a/S_3.scala
new file mode 100644
index 0000000000..aaa898dcde
--- /dev/null
+++ b/test/files/run/t3452a/S_3.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ J_2.main(args)
+ }
+}
diff --git a/test/files/run/t3452b-bcode.check b/test/files/run/t3452b-bcode.check
new file mode 100644
index 0000000000..204c3d0437
--- /dev/null
+++ b/test/files/run/t3452b-bcode.check
@@ -0,0 +1,2 @@
+Search received: test
+SearchC received: test
diff --git a/test/files/run/t3452b-bcode.flags b/test/files/run/t3452b-bcode.flags
new file mode 100644
index 0000000000..c30091d3de
--- /dev/null
+++ b/test/files/run/t3452b-bcode.flags
@@ -0,0 +1 @@
+-Ybackend:GenBCode
diff --git a/test/files/run/t3452b-bcode/J_2.java b/test/files/run/t3452b-bcode/J_2.java
new file mode 100644
index 0000000000..839f334508
--- /dev/null
+++ b/test/files/run/t3452b-bcode/J_2.java
@@ -0,0 +1,6 @@
+public class J_2 {
+ public static void j() {
+ StringSearch.search("test");
+ StringSearch.searchC("test");
+ }
+}
diff --git a/test/files/run/t3452b-bcode/S_1.scala b/test/files/run/t3452b-bcode/S_1.scala
new file mode 100644
index 0000000000..a209f12035
--- /dev/null
+++ b/test/files/run/t3452b-bcode/S_1.scala
@@ -0,0 +1,17 @@
+trait Search[M] {
+ def search(input: M): C[Int] = {
+ println("Search received: " + input)
+ null
+ }
+}
+
+class SearchC[M] {
+ def searchC(input: M): C[Int] = {
+ println("SearchC received: " + input)
+ null
+ }
+}
+
+object StringSearch extends SearchC[String] with Search[String]
+
+trait C[T]
diff --git a/test/files/run/t3452b-bcode/S_3.scala b/test/files/run/t3452b-bcode/S_3.scala
new file mode 100644
index 0000000000..102b433f47
--- /dev/null
+++ b/test/files/run/t3452b-bcode/S_3.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ J_2.j()
+ }
+}
diff --git a/test/files/run/t3452b.check b/test/files/run/t3452b.check
new file mode 100644
index 0000000000..204c3d0437
--- /dev/null
+++ b/test/files/run/t3452b.check
@@ -0,0 +1,2 @@
+Search received: test
+SearchC received: test
diff --git a/test/files/run/t3452b/J_2.java b/test/files/run/t3452b/J_2.java
new file mode 100644
index 0000000000..839f334508
--- /dev/null
+++ b/test/files/run/t3452b/J_2.java
@@ -0,0 +1,6 @@
+public class J_2 {
+ public static void j() {
+ StringSearch.search("test");
+ StringSearch.searchC("test");
+ }
+}
diff --git a/test/files/run/t3452b/S_1.scala b/test/files/run/t3452b/S_1.scala
new file mode 100644
index 0000000000..a209f12035
--- /dev/null
+++ b/test/files/run/t3452b/S_1.scala
@@ -0,0 +1,17 @@
+trait Search[M] {
+ def search(input: M): C[Int] = {
+ println("Search received: " + input)
+ null
+ }
+}
+
+class SearchC[M] {
+ def searchC(input: M): C[Int] = {
+ println("SearchC received: " + input)
+ null
+ }
+}
+
+object StringSearch extends SearchC[String] with Search[String]
+
+trait C[T]
diff --git a/test/files/run/t3452b/S_3.scala b/test/files/run/t3452b/S_3.scala
new file mode 100644
index 0000000000..102b433f47
--- /dev/null
+++ b/test/files/run/t3452b/S_3.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ J_2.j()
+ }
+}
diff --git a/test/files/run/t3452c.check b/test/files/run/t3452c.check
new file mode 100644
index 0000000000..ab47181198
--- /dev/null
+++ b/test/files/run/t3452c.check
@@ -0,0 +1,8 @@
+3
+3
+3
+3
+3
+3
+3
+3
diff --git a/test/files/run/t3452c.scala b/test/files/run/t3452c.scala
new file mode 100644
index 0000000000..2c55767abc
--- /dev/null
+++ b/test/files/run/t3452c.scala
@@ -0,0 +1,113 @@
+trait Base[A, B, C] {
+ def f(x: A, y: B, z: C): Unit
+ def g(x: A, y: B, z: C) = f(x, y, z)
+ def h(x: A, y: B, z: C) = g(x, y, z)
+}
+
+trait D1[B, C] extends Base[String, B, C]
+trait D2[A, B] extends Base[A, B, String]
+trait D3[A, C] extends Base[A, String, C]
+trait D4[A] extends Base[A, String, String]
+trait D5[B] extends Base[String, B, String]
+trait D6[C] extends Base[String, String, C]
+trait D7 extends Base[String, String, String]
+
+trait E1[B, C] extends Base[String, B, C] { def f(x: String, y: B, z: C): Unit ; override def h(x: String, y: B, z: C) = g(x, y, z) }
+trait E2[A, B] extends Base[A, B, String] { def f(x: A, y: B, z: String): Unit ; override def h(x: A, y: B, z: String) = g(x, y, z) }
+trait E3[A, C] extends Base[A, String, C] { def f(x: A, y: String, z: C): Unit ; override def h(x: A, y: String, z: C) = g(x, y, z) }
+trait E4[A] extends Base[A, String, String] { def f(x: A, y: String, z: String): Unit ; override def h(x: A, y: String, z: String) = g(x, y, z) }
+trait E5[B] extends Base[String, B, String] { def f(x: String, y: B, z: String): Unit ; override def h(x: String, y: B, z: String) = g(x, y, z) }
+trait E6[C] extends Base[String, String, C] { def f(x: String, y: String, z: C): Unit ; override def h(x: String, y: String, z: C) = g(x, y, z) }
+trait E7 extends Base[String, String, String] { def f(x: String, y: String, z: String): Unit ; override def h(x: String, y: String, z: String) = g(x, y, z) }
+
+trait F1[B, C] extends Base[String, B, C] { def f(x: String, y: B, z: C): Unit = println(x.length) }
+trait F2[A, B] extends Base[A, B, String] { def f(x: A, y: B, z: String): Unit = println(z.length) }
+trait F3[A, C] extends Base[A, String, C] { def f(x: A, y: String, z: C): Unit = println(y.length) }
+trait F4[A] extends Base[A, String, String] { def f(x: A, y: String, z: String): Unit = println(y.length) }
+trait F5[B] extends Base[String, B, String] { def f(x: String, y: B, z: String): Unit = println(x.length) }
+trait F6[C] extends Base[String, String, C] { def f(x: String, y: String, z: C): Unit = println(x.length) }
+trait F7 extends Base[String, String, String] { def f(x: String, y: String, z: String): Unit = println(x.length) }
+
+abstract class DBag extends D1[String, String] with D2[String, String] with D3[String, String] with D4[String] with D5[String] with D6[String] with D7 {
+ def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+abstract class EBag extends E1[String, String] with E2[String, String] with E3[String, String] with E4[String] with E5[String] with E6[String] with E7 {
+ def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+abstract class FBag extends F1[String, String] with F2[String, String] with F3[String, String] with F4[String] with F5[String] with F6[String] with F7 {
+ override def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+
+abstract class GBag1[A, B] extends Base[A, B, String] with D2[A, B] {
+ def f(x: A, y: B, z: String) = println(z.length)
+}
+abstract class GBag2[A] extends GBag1[A, String] with D4[A] {
+ override def f(x: A, y: String, z: String) = println(z.length)
+}
+abstract class GBag3 extends GBag2[String] with D7 {
+ override def f(x: String, y: String, z: String) = println(z.length)
+}
+class GBag extends GBag3 with D2[String, String] with D3[String, String] with D4[String] with D5[String] with D6[String] with D7 {
+}
+
+object Test {
+ def f0(x: Base[String, String, String]) = x.f("a", "b", "c")
+ def f1(x: D1[String, String]) = x.f("a", "b", "c")
+ def f2(x: D2[String, String]) = x.f("a", "b", "c")
+ def f3(x: D3[String, String]) = x.f("a", "b", "c")
+ def f4(x: D4[String]) = x.f("a", "b", "c")
+ def f5(x: D5[String]) = x.f("a", "b", "c")
+ def f6(x: D6[String]) = x.f("a", "b", "c")
+ def f7(x: D7) = x.f("a", "b", "c")
+
+ def main(args: Array[String]): Unit = {
+ val x = new DBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ f4(x)
+ f5(x)
+ f6(x)
+ f7(x)
+ }
+}
+
+object TestE {
+ def f0(x: Base[String, String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f1(x: E1[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f2(x: E2[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f3(x: E3[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f4(x: E4[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f5(x: E5[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f6(x: E6[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f7(x: E7) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+
+ def main(args: Array[String]): Unit = {
+ val x = new EBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ f4(x)
+ f5(x)
+ f6(x)
+ f7(x)
+ }
+}
+
+
+object TestG {
+ def f0(x: Base[String, String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f1(x: GBag1[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f2(x: GBag2[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f3(x: GBag3) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+
+ def main(args: Array[String]): Unit = {
+ val x = new GBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ }
+}
diff --git a/test/files/run/t3452d/A.scala b/test/files/run/t3452d/A.scala
new file mode 100644
index 0000000000..67a2080d27
--- /dev/null
+++ b/test/files/run/t3452d/A.scala
@@ -0,0 +1,7 @@
+trait TraversableLike[A, Repr] {
+ def tail: Repr = null.asInstanceOf[Repr]
+}
+
+abstract class AbstractTrav[A] extends TraversableLike[A, Traversable[A]]
+
+class C[A] extends AbstractTrav[A]
diff --git a/test/files/run/t3452d/Test.java b/test/files/run/t3452d/Test.java
new file mode 100644
index 0000000000..875be6176c
--- /dev/null
+++ b/test/files/run/t3452d/Test.java
@@ -0,0 +1,12 @@
+import scala.collection.immutable.Nil;
+import scala.collection.immutable.List;
+import scala.collection.Traversable;
+
+public class Test {
+ public static void main(String[] args) {
+ C<String> c = new C<String>();
+ // TODO add a bridge during mixin so we can expose
+ // sharper generic signature for `tail`.
+ /*Traversable<String>*/ Object ls = c.tail();
+ }
+}
diff --git a/test/files/run/t3452e/A.scala b/test/files/run/t3452e/A.scala
new file mode 100644
index 0000000000..939172f401
--- /dev/null
+++ b/test/files/run/t3452e/A.scala
@@ -0,0 +1,4 @@
+trait F1[T, R] {
+ def andThen[A](g: R => A): Int = 0
+}
+class C1[TT, RR] extends F1[TT, RR]
diff --git a/test/files/run/t3452e/B.java b/test/files/run/t3452e/B.java
new file mode 100644
index 0000000000..0268af9987
--- /dev/null
+++ b/test/files/run/t3452e/B.java
@@ -0,0 +1,2 @@
+class B extends C1<String, String> {
+}
diff --git a/test/files/run/macro-def-path-dependent-d2/Test_3.scala b/test/files/run/t3452e/Test.scala
index 7dffc5107d..fc175bf94a 100644
--- a/test/files/run/macro-def-path-dependent-d2/Test_3.scala
+++ b/test/files/run/t3452e/Test.scala
@@ -1,3 +1,3 @@
object Test extends App {
- println("it works")
-} \ No newline at end of file
+ new B
+}
diff --git a/test/files/run/t3452f.scala b/test/files/run/t3452f.scala
new file mode 100644
index 0000000000..af64f5c042
--- /dev/null
+++ b/test/files/run/t3452f.scala
@@ -0,0 +1,19 @@
+import language.higherKinds
+
+trait GenSet[A]
+
+trait GenSetTemplate[A, +CC[X] <: GenSet[X]] {
+ def empty: CC[A] = ???
+}
+
+trait SetLike[A, +This <: SetLike[A, This] with Set[A]] {
+ def empty: This
+}
+
+abstract class Set[A] extends GenSet[A] with SetLike[A,Set[A]] with GenSetTemplate[A,Set]
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ locally(classOf[Set[_]]) // trigger classloading to verify class
+ }
+}
diff --git a/test/files/run/t3452g/A.scala b/test/files/run/t3452g/A.scala
new file mode 100644
index 0000000000..a3f74c1e1e
--- /dev/null
+++ b/test/files/run/t3452g/A.scala
@@ -0,0 +1,9 @@
+trait TraversableLike[A, Repr] {
+ def tail: Repr = null.asInstanceOf[Repr]
+}
+
+abstract class AbstractTrav[A] extends TraversableLike[A, AbstractTrav[A]]
+
+object O extends AbstractTrav[String]
+
+class C[A] extends AbstractTrav[A]
diff --git a/test/files/run/t3452g/Test.java b/test/files/run/t3452g/Test.java
new file mode 100644
index 0000000000..c3b4222d16
--- /dev/null
+++ b/test/files/run/t3452g/Test.java
@@ -0,0 +1,14 @@
+
+public class Test {
+ public static void main(String[] args) {
+ // To get better types here, we would need to
+ // add bridge during mixin so we can expose
+ // a generic return type of Traversable<A>, because the erasure
+ // of this (Traversable) differs from the erasure of the mixed
+ // method (erasure(Repr) = Object)
+
+ Object lsSharp = O.tail();
+
+ Object lsSharp2 = new C<String>().tail();
+ }
+}
diff --git a/test/files/run/t3452h.scala b/test/files/run/t3452h.scala
new file mode 100644
index 0000000000..6237d3ea64
--- /dev/null
+++ b/test/files/run/t3452h.scala
@@ -0,0 +1,8 @@
+class Mix___eFoo_I_wBar__f extends Foo_I_ with Bar__f { f; }
+trait T
+abstract class Foo_I_ { class I extends T ; def f: I ; f; }
+trait Bar__f { type I>:Null<:T; def f: I = {null}; f; def gobble: I = {null}}
+
+object Test extends App {
+ new Mix___eFoo_I_wBar__f
+}
diff --git a/test/files/run/t3488.check b/test/files/run/t3488.check
index 0d66ea1aee..314dfc7838 100644
--- a/test/files/run/t3488.check
+++ b/test/files/run/t3488.check
@@ -1,2 +1,8 @@
+t3488.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ println(foo { val List(_*)=List(0); 1 } ())
+ ^
+t3488.scala:5: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ println(foo { val List(_*)=List(0); 1 } (1))
+ ^
0
1
diff --git a/test/files/run/t3488.scala b/test/files/run/t3488.scala
index 20a1400dce..a8cfa9b808 100644
--- a/test/files/run/t3488.scala
+++ b/test/files/run/t3488.scala
@@ -1,6 +1,6 @@
object Test extends App {
def foo(p: => Unit)(x:Int = 0) = x
-
+
println(foo { val List(_*)=List(0); 1 } ())
println(foo { val List(_*)=List(0); 1 } (1))
}
diff --git a/test/files/run/t3493.scala b/test/files/run/t3493.scala
index b0b7589cfd..aafe7a3a4a 100644
--- a/test/files/run/t3493.scala
+++ b/test/files/run/t3493.scala
@@ -3,7 +3,7 @@
object Test {
-
+
def main(args: Array[String]) {
import scala.collection.immutable._
val x = TreeSet("a", "b", "c", "d")
@@ -11,5 +11,5 @@ object Test {
assert(x2.toString == "TreeSet(a, b, c, d, e)")
assert(x2.toString == runtime.ScalaRunTime.stringOf(x2).trim)
}
-
+
}
diff --git a/test/files/run/t3496.scala b/test/files/run/t3496.scala
index 80a4e6bd86..e1aa032ab1 100644
--- a/test/files/run/t3496.scala
+++ b/test/files/run/t3496.scala
@@ -4,12 +4,12 @@
// ticket #3496
object Test {
-
+
def main(args: Array[String]) {
val s = Stream.from(1)
s.take(5)
s.drop(5)
s.splitAt(5)
}
-
+
}
diff --git a/test/files/run/t3502.scala b/test/files/run/t3502.scala
index 9492b2d4d4..cc78e54c86 100644
--- a/test/files/run/t3502.scala
+++ b/test/files/run/t3502.scala
@@ -5,7 +5,7 @@
// ticket #3502
object Test {
-
+
object GeneratePrimeFactorsLazy extends (Int => List[Int]) {
override def apply(n:Int) = {
val s = Stream.range(2, n / 2).filter(n % _ == 0)
@@ -13,12 +13,12 @@ object Test {
s.headOption.map(x => x :: apply(n / x)).getOrElse(List(n))
}
}
-
+
def main(args:Array[String]) {
// a prime number
//val num = 623456789
val num = 2796203
assert(GeneratePrimeFactorsLazy(num) == List(num))
}
-
+
}
diff --git a/test/files/run/t3507-new.scala b/test/files/run/t3507-new.scala
index f045755b8f..bd16849e8a 100644
--- a/test/files/run/t3507-new.scala
+++ b/test/files/run/t3507-new.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ existentials }
import scala.reflect.runtime.universe._
class A {
@@ -14,4 +16,4 @@ object Test extends App {
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/t3509.scala b/test/files/run/t3509.scala
index 7ec150eb01..76f8d6016e 100644
--- a/test/files/run/t3509.scala
+++ b/test/files/run/t3509.scala
@@ -1,7 +1,7 @@
object Test {
- class Foo(final var i:Int)
-
+ class Foo(final var i:Int)
+
def main(args : Array[String]) : Unit = {
val foo = new Foo(0)
foo.i += 1
diff --git a/test/files/run/t3511.scala b/test/files/run/t3511.scala
index 9b4d581462..30757b1a66 100644
--- a/test/files/run/t3511.scala
+++ b/test/files/run/t3511.scala
@@ -6,31 +6,31 @@ import scala.collection.immutable._
// ticket #3511
object Test {
-
+
def main(args: Array[String]) {
assert(Stream.from(0).view.force.take(5) == List(0, 1, 2, 3, 4))
-
+
val s = Stream.from(0)
val smap = s.view.map(_ * 2).force.take(5)
assert(smap == List(0, 2, 4, 6, 8))
-
+
val sfilter = s.view.filter(_ % 2 == 0).force.take(5)
assert(sfilter == List(0, 2, 4, 6, 8))
-
+
val sflatmap = s.view.flatMap(n => List(n, n * 2)).force.take(6)
assert(sflatmap == List(0, 0, 1, 2, 2, 4))
-
+
val stakewhile = s.view.takeWhile(_ < 10).force
assert(stakewhile == List.range(0, 10))
-
+
val szip = s.view.zip(s.map(_ / 2)).force.take(5)
assert(szip == List((0, 0), (1, 0), (2, 1), (3, 1), (4, 2)))
-
+
val szipall = s.view.zipAll(List(0, 1, 2), 0, 0).force.take(5)
assert(szipall == List((0, 0), (1, 1), (2, 2), (3, 0), (4, 0)))
-
+
val spatch = s.view.patch(1, List(5, 5, 5), 5).force.take(5)
assert(spatch == List(0, 5, 5, 5, 6))
}
-
+
}
diff --git a/test/files/run/t3516.scala b/test/files/run/t3516.scala
index 82a97f27de..aa302ce85a 100644
--- a/test/files/run/t3516.scala
+++ b/test/files/run/t3516.scala
@@ -1,7 +1,7 @@
object Test {
def mkIterator = (1 to 5).iterator map (x => { println(x) ; x })
def mkInfinite = Iterator continually { println(1) ; 1 }
-
+
def main(args: Array[String]): Unit = {
// Stream is strict in its head so we should see 1 from each of them.
val s1 = mkIterator.toStream
diff --git a/test/files/run/t3518.scala b/test/files/run/t3518.scala
index 36ca9daaa2..033cc19548 100644
--- a/test/files/run/t3518.scala
+++ b/test/files/run/t3518.scala
@@ -4,7 +4,7 @@ object Test {
val r3 = 10.0 to 1.0 by -0.5
val r4 = 1.0 until 1.0 by 1.0
val r5 = 1 to 100 by 2
-
+
def main(args: Array[String]): Unit = {
assert(r3 forall (r1 contains _))
assert(r1 forall (r3 contains _))
diff --git a/test/files/run/t3529.scala b/test/files/run/t3529.scala
index bb82424bf6..a5977d0a6c 100644
--- a/test/files/run/t3529.scala
+++ b/test/files/run/t3529.scala
@@ -1,3 +1,4 @@
+import scala.language.postfixOps
object Test {
def main(args: Array[String]): Unit = {
assert(1 to 10 drop 10 isEmpty)
diff --git a/test/files/run/t3530.scala b/test/files/run/t3530.scala
index 3fedc66dbe..f6f7fb4229 100644
--- a/test/files/run/t3530.scala
+++ b/test/files/run/t3530.scala
@@ -5,7 +5,7 @@ object Test {
case xs @ List(_*) => "list: " + xs.length
case _ => "not a list"
})
-
+
def f2[T](x: List[T]) = println(x match {
case List(_, _) => "two"
case List(_, _, _) => "three"
@@ -21,9 +21,9 @@ object Test {
f(Nil)
f(List(1,2,3,4,5))
f(null)
-
+
println
-
+
f2(List(1, 2))
f2(List('a', 'b', 'c'))
f2(List('a', 'b', 'c', 'd'))
diff --git a/test/files/run/t3540.scala b/test/files/run/t3540.scala
index 4eb3de780b..5ffacb5dff 100644
--- a/test/files/run/t3540.scala
+++ b/test/files/run/t3540.scala
@@ -2,6 +2,6 @@ object Test {
def main(args: Array[String]): Unit = {
assert(List.iterate(List(1,2,3), 4)(_.tail).last.isEmpty)
assert(Stream.iterate(Stream(1,2,3), 4)(_.tail).last.isEmpty)
- assert(Array.iterate(Array(1,2,3), 4)(_.tail).last.isEmpty)
+ assert(Array.iterate(Array(1,2,3), 4)(_.tail).last.isEmpty)
}
}
diff --git a/test/files/run/t3563.scala b/test/files/run/t3563.scala
index 2a80ef412a..8abbb60803 100644
--- a/test/files/run/t3563.scala
+++ b/test/files/run/t3563.scala
@@ -5,17 +5,17 @@
// ticket #3563
object Test {
-
+
def main(args: Array[String]) {
var sum = 0
val setseq = Set(1, 2, 3, 4).toSeq
setseq.map( n => { sum += n; n * n }).head
assert(sum == 10)
-
+
sum = 0
val mapseq = Map(1 -> 1, 2 -> 2, 3 -> 3, 4 -> 4).toSeq
mapseq.map( n => { sum += n._1; (n._1 + n._1, n._2 * n._2) }).head
assert(sum == 10)
}
-
+
}
diff --git a/test/files/run/t3569.scala b/test/files/run/t3569.scala
index 4699aeaab3..eb3b424439 100644
--- a/test/files/run/t3569.scala
+++ b/test/files/run/t3569.scala
@@ -1,9 +1,9 @@
object Test {
final val bippy1 = 1
final lazy val bippy2 = 2
-
+
lazy val lv = scala.util.Random.nextInt()
-
+
class X(final var x: Int) {
final var var1: Int = 0
final private var var2: Int = 0
@@ -12,21 +12,22 @@ object Test {
final val val1: Int = 1
final private val val2: Int = 1
final private[this] val val3: Int = 1
-
+
final lazy val lval1: Int = 2
final private lazy val lval2: Int = 2
final private[this] lazy val lval3: Int = 2
}
case class Y(final var x: Int, final private var y: Int, final val z1: Int, final private val z2: Int) { }
-
+
def f = new X(0).x += 1
def main(args: Array[String]) {
f
val s = new X(0)
s.x += 1
println(s.x)
-
- (classOf[X].getDeclaredFields map ("" + _)).sorted foreach println
+
+ // under -Xcheckinit there's an additional $init$ field
+ (classOf[X].getDeclaredFields map ("" + _)).sorted.filter(_ != "private volatile byte Test$X.bitmap$init$0") foreach println
(classOf[Y].getDeclaredFields map ("" + _)).sorted foreach println
}
}
diff --git a/test/files/run/t3575.scala b/test/files/run/t3575.scala
index 7ede65b00c..ef83e84f14 100644
--- a/test/files/run/t3575.scala
+++ b/test/files/run/t3575.scala
@@ -46,7 +46,7 @@ object Test {
println(TwoShort(12, "Hello").getClass().getName());
println(TwoShort("Hello", 12).getClass().getName());
println(TwoShort(12, 12).getClass().getName());
-
+
println(TwoMinimal("Hello", "World").getClass().getName());
println(TwoMinimal(12, "Hello").getClass().getName());
println(TwoMinimal("Hello", 12).getClass().getName());
diff --git a/test/files/run/t3580.scala b/test/files/run/t3580.scala
index ac9f81ab9e..50ff6c4551 100644
--- a/test/files/run/t3580.scala
+++ b/test/files/run/t3580.scala
@@ -4,14 +4,14 @@
object Test {
-
+
class Empty extends Traversable[Nothing] {
def foreach[U](f: Nothing => U) {}
}
-
+
def main(args: Array[String]) {
val t = new Empty
t.toStream
}
-
+
}
diff --git a/test/files/run/t3603.scala b/test/files/run/t3603.scala
index a0821a2a45..a89cb7080a 100644
--- a/test/files/run/t3603.scala
+++ b/test/files/run/t3603.scala
@@ -2,17 +2,17 @@
object Test {
-
+
def main(args: Array[String]) {
import collection.immutable._
-
+
val intmap = IntMap(1 -> 1, 2 -> 2)
val intres = intmap.map { case (a, b) => (a, b.toString) }
assert(intres.isInstanceOf[IntMap[_]])
-
+
val longmap = LongMap(1L -> 1, 2L -> 2)
val longres = longmap.map { case (a, b) => (a, b.toString) }
assert(longres.isInstanceOf[LongMap[_]])
}
-
+
}
diff --git a/test/files/run/t3613.scala b/test/files/run/t3613.scala
index 171a6a21aa..1293f62c0f 100644
--- a/test/files/run/t3613.scala
+++ b/test/files/run/t3613.scala
@@ -1,7 +1,7 @@
class Boopy {
private val s = new Schnuck
def observer : PartialFunction[ Any, Unit ] = s.observer
-
+
private class Schnuck extends javax.swing.AbstractListModel {
model =>
val observer : PartialFunction[ Any, Unit ] = {
@@ -10,13 +10,13 @@ class Boopy {
def getSize = 0
def getElementAt( idx: Int ) = ???
}
-
+
}
object Test {
def main(args: Array[String]): Unit = {
val x = new Boopy
val o = x.observer
- o( "Boopy" ) // --> throws runtime error
+ o( "Boopy" ) // --> throws runtime error
}
}
diff --git a/test/files/run/t3619.scala b/test/files/run/t3619.scala
index 46324b4d69..3f4c56ea53 100644
--- a/test/files/run/t3619.scala
+++ b/test/files/run/t3619.scala
@@ -17,7 +17,7 @@ object Test extends App {
}
}
*/
-
+
new Meh
}
diff --git a/test/files/run/t363.scala b/test/files/run/t363.scala
index 5f3f30a098..c747be2ec9 100644
--- a/test/files/run/t363.scala
+++ b/test/files/run/t363.scala
@@ -3,7 +3,7 @@ object Test {
println("I love the smell of (Array[String])Unit in the morning.")
}
}
-
+
class Test {
def kurtz() = "We must kill them. We must incinerate them."
}
diff --git a/test/files/run/t3647.scala b/test/files/run/t3647.scala
index 434a13f414..a970e887f6 100644
--- a/test/files/run/t3647.scala
+++ b/test/files/run/t3647.scala
@@ -13,10 +13,10 @@ object Test {
"line4"
).iterator)
assert(ps.filter(_ == '\n').size == 3)
-
+
val ps1 = PagedSeq.fromLines(List("Ok").iterator)
assert(ps1.filter(_ == '\n').size == 0)
-
+
val eps = PagedSeq.fromLines(List().iterator)
assert(eps.filter(_ == '\n').size == 0)
}
diff --git a/test/files/run/t3651.scala b/test/files/run/t3651.scala
index 49ae173249..3a6dda0de3 100644
--- a/test/files/run/t3651.scala
+++ b/test/files/run/t3651.scala
@@ -5,6 +5,6 @@ class LongKlass( override val a: Long ) extends Klass[Long](a)
object Test {
def main(args: Array[String]) {
val lk = new LongKlass(10)
- lk.a
+ val a = lk.a
}
}
diff --git a/test/files/run/t3667.check b/test/files/run/t3667.check
index bbe5d1bc48..6375c88997 100644
--- a/test/files/run/t3667.check
+++ b/test/files/run/t3667.check
@@ -1,6 +1,3 @@
-1
-2
-3
4
2
3
diff --git a/test/files/run/t3667.scala b/test/files/run/t3667.scala
index f30d57ce3a..ada09d5886 100644
--- a/test/files/run/t3667.scala
+++ b/test/files/run/t3667.scala
@@ -1,27 +1,9 @@
object Test {
def main(args: Array[String]) {
- val o1 = new Outer1
- val o2 = new Outer2
- val o3 = new Outer3
val o4 = new Outer4
val o5 = new Outer5
val o6 = new Outer6
- println(1)
- ser(new o1.Inner(1))
- o1.Inner // make sure the Inner$module field of the Outer1 instance is initialized!
- ser(new o1.Inner(1))
-
- println(2)
- ser(new o2.Inner(1))
- o2.Inner
- ser(new o2.Inner(1))
-
- println(3)
- ser(new o3.Inner(1))
- o3.Inner
- ser(new o3.Inner(1))
-
println(4)
ser(new o4.Inner(1))
o4.Inner
@@ -54,23 +36,6 @@ object Test {
}
-@serializable
-class Outer1 {
- @serializable
- class Inner(x: Int = 1)
-}
-
-@serializable
-class Outer2 {
- case class Inner(x: Int = 1)
-}
-
-@serializable
-class Outer3 {
- case class Inner(x: Int)
-}
-
-
class Outer4 extends Serializable {
class Inner(x: Int = 1) extends Serializable
}
diff --git a/test/files/run/t3702.scala b/test/files/run/t3702.scala
index 021abcb625..0cdafd90b6 100644
--- a/test/files/run/t3702.scala
+++ b/test/files/run/t3702.scala
@@ -3,7 +3,7 @@ object Test {
case 5 :: _ => ()
case List(from) => from
}
-
+
def main(args: Array[String]): Unit = {
println(foo(5 :: Nil, List(1,2,3)))
println(foo(6 :: Nil, List(1,2,3)))
diff --git a/test/files/run/t3705.scala b/test/files/run/t3705.scala
deleted file mode 100644
index fcc020f28c..0000000000
--- a/test/files/run/t3705.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-// package foo
-
-import scala.xml._
-object Test {
- def updateNodes(ns: Seq[Node]): Seq[Node] =
- for(subnode <- ns) yield subnode match {
- case <d>{_}</d> if true => <d>abc</d>
- case Elem(prefix, label, attribs, scope, children @ _*) =>
- Elem(prefix, label, attribs, scope, updateNodes(children) : _*)
- case other => other
- }
- def main(args: Array[String]): Unit = {
- updateNodes(<b />)
-
- }
-}
-
diff --git a/test/files/run/t3714.scala b/test/files/run/t3714.scala
index c344b40f1f..2d600f97f1 100644
--- a/test/files/run/t3714.scala
+++ b/test/files/run/t3714.scala
@@ -21,7 +21,7 @@ object Test {
case BreakImpl(x) => x
case _ => -1
}
-
+
def main(args: Array[String]) {
val break = BreakImpl(22)
// assert(f1(break) == 22)
diff --git a/test/files/run/t3719.scala b/test/files/run/t3719.scala
index 4649f11bb1..01dc205545 100644
--- a/test/files/run/t3719.scala
+++ b/test/files/run/t3719.scala
@@ -1,7 +1,7 @@
object Days extends Enumeration {
type Day = DayValue
val Mon, Tue, Wed, Thu, Fri, Sat, Sun = new DayValue // DayValue
-
+
protected class DayValue extends Val {
def isWeekday: Boolean =
this match {
@@ -21,7 +21,7 @@ object Test extends App {
val d: Day = Mon
d.toString
}
-
+
def nameOfTue(): String = {
import Days._
val d: Day = Tue
diff --git a/test/files/run/t3758-old.scala b/test/files/run/t3758-old.scala
index f00254afee..d5e4a6cc1c 100644
--- a/test/files/run/t3758-old.scala
+++ b/test/files/run/t3758-old.scala
@@ -1,3 +1,5 @@
+
+@deprecated("Suppress warnings", since="2.11")
object Test {
def main(args: Array[String]): Unit = {
assert(classManifest[Array[String]].typeArguments contains classManifest[String])
@@ -7,4 +9,4 @@ object Test {
assert(manifest[Array[Int]].typeArguments contains manifest[Int])
assert(manifest[Array[Float]].typeArguments contains manifest[Float])
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/t3822.scala b/test/files/run/t3822.scala
index eaf0a145d3..c35804035e 100644
--- a/test/files/run/t3822.scala
+++ b/test/files/run/t3822.scala
@@ -1,17 +1,17 @@
import scala.collection.{ mutable, immutable, generic }
import immutable.ListSet
-object Test {
+object Test {
def main(args: Array[String]): Unit = {
val xs = ListSet(-100000 to 100001: _*)
-
+
assert(xs.size == 200002)
assert(xs.sum == 100001)
-
+
val ys = ListSet[Int]()
val ys1 = (1 to 12).grouped(3).foldLeft(ys)(_ ++ _)
val ys2 = (1 to 12).foldLeft(ys)(_ + _)
-
+
assert(ys1 == ys2)
}
}
diff --git a/test/files/run/t3829.scala b/test/files/run/t3829.scala
index e3d8c56882..780a6a95b7 100644
--- a/test/files/run/t3829.scala
+++ b/test/files/run/t3829.scala
@@ -1,11 +1,11 @@
// ticket #3829
object Test {
import collection.{ mutable, immutable }
-
+
def main(args: Array[String]) {
val map = immutable.Map(1 -> 2, 3 -> 4)
assert(map.get(0) == None)
-
+
// Since r24255 defaultMap.get(x) returns None rather than
// using the default, so these mostly use apply.
val defmap = map.withDefaultValue(-1)
@@ -19,10 +19,10 @@ object Test {
assert((defmap - 1)(0) == -1)
assert((defmap - 1)(1) == -1)
assert((defmap - 1)(3) == 4)
-
+
val mutmap = mutable.Map(1 -> 2, 2 -> 3)
assert(mutmap.get(0) == None)
-
+
val defmutmap = mutmap.withDefaultValue(-1)
assert(defmutmap(0) == -1)
assert(defmutmap(3) == -1)
@@ -36,5 +36,5 @@ object Test {
assert(defmutmap(1) == 2)
assert(mutmap(1) == 2)
}
-
+
}
diff --git a/test/files/run/t3832.scala b/test/files/run/t3832.scala
new file mode 100644
index 0000000000..ac44358bc7
--- /dev/null
+++ b/test/files/run/t3832.scala
@@ -0,0 +1,17 @@
+class t3832 {
+ def this(un: Int) = {
+ this()
+ def bippy = this
+ ()
+ }
+ def this(un: Boolean) = {
+ this()
+ def boppy = () => this
+ ()
+ }
+}
+
+object Test extends App {
+ new t3832(0)
+ new t3832(true)
+}
diff --git a/test/files/run/t3835.scala b/test/files/run/t3835.scala
index c120a61f6e..766b6ddc2e 100644
--- a/test/files/run/t3835.scala
+++ b/test/files/run/t3835.scala
@@ -1,6 +1,6 @@
object Test extends App {
// work around optimizer bug SI-5672 -- generates wrong bytecode for switches in arguments
- // virtpatmat happily emits a switch for a one-case switch, whereas -Xoldpatmat did not
+ // virtpatmat happily emits a switch for a one-case switch
// this is not the focus of this test, hence the temporary workaround
def a = (1, 2, 3) match { case (r, \u03b8, \u03c6) => r + \u03b8 + \u03c6 }
println(a)
diff --git a/test/files/run/t3855.scala b/test/files/run/t3855.scala
index e55714201f..d10aab5383 100644
--- a/test/files/run/t3855.scala
+++ b/test/files/run/t3855.scala
@@ -1,13 +1,13 @@
object Test {
def byval[A](a: => A) = a
def closure[A](f: () => A) = f()
-
+
def f1(s: String) = {
- var n = try { s.toInt } catch { case _ => 1 }
+ var n = try { s.toInt } catch { case _: Throwable => 1 }
byval(n)
}
def f2(s: String) = {
- var n = try { s.toInt } catch { case _ => 1 }
+ var n = try { s.toInt } catch { case _: Throwable => 1 }
closure(() => n)
}
diff --git a/test/files/run/t3877.scala b/test/files/run/t3877.scala
index ce1e9283a7..5710e982a0 100644
--- a/test/files/run/t3877.scala
+++ b/test/files/run/t3877.scala
@@ -11,7 +11,7 @@ object Test {
println("test1: " + d)
}
}
-
+
def test2 {
var d = 2
var i = 0
@@ -25,7 +25,7 @@ object Test {
return
}
}
-
+
def test3 {
var d = 2
var i = 0
@@ -34,9 +34,9 @@ object Test {
d = b
i += 1
println("test3: " + d)
- } while (d < LIMIT && i < LIMIT)
+ } while (d < LIMIT && i < LIMIT)
}
-
+
def test4 {
var d = 2
var i = 0
@@ -47,9 +47,9 @@ object Test {
println("test4: " + d)
if (d >= LIMIT || i >= LIMIT)
return
- } while (true)
+ } while (true)
}
-
+
def test5 {
var d = 2
var i = 0
@@ -58,7 +58,7 @@ object Test {
d = b
i += 1
println("test5.1: " + d)
-
+
var e = 2
var j = 0
while (e < LIMIT && j < LIMIT) {
@@ -69,7 +69,7 @@ object Test {
}
}
}
-
+
def main(args: Array[String]) {
test1
diff --git a/test/files/run/t3886.scala b/test/files/run/t3886.scala
deleted file mode 100644
index 1e8e7ad252..0000000000
--- a/test/files/run/t3886.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-object Test {
- def main(args: Array[String]) {
- assert( <k a="1" b="2"/> == <k a="1" b="2"/> )
- assert( <k a="1" b="2"/> != <k a="1" b="3"/> )
- assert( <k a="1" b="2"/> != <k a="2" b="2"/> )
-
- assert( <k a="1" b="2"/> != <k/> )
- assert( <k a="1" b="2"/> != <k a="1"/> )
- assert( <k a="1" b="2"/> != <k b="2"/> )
- }
-}
diff --git a/test/files/run/t3887.scala b/test/files/run/t3887.scala
index 81fa7a917e..16ce983efc 100644
--- a/test/files/run/t3887.scala
+++ b/test/files/run/t3887.scala
@@ -13,4 +13,4 @@ object Test {
val option1: (Int, String) = (1, "abc")
-}
+}
diff --git a/test/files/run/t3888.check b/test/files/run/t3888.check
new file mode 100644
index 0000000000..844ca54682
--- /dev/null
+++ b/test/files/run/t3888.check
@@ -0,0 +1 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t3888.scala b/test/files/run/t3888.scala
index e0f1453b1d..8701b42ff0 100644
--- a/test/files/run/t3888.scala
+++ b/test/files/run/t3888.scala
@@ -1,15 +1,18 @@
+
+// in a match, which notion of equals prevails?
+// extending Tuple doesn't seem to be at issue here.
object Test {
val T1 = new P
private[this] val T2 = T1
- def m1 =
+ def m1 =
(1, 2) match {
case T1 => true
case _ => false
}
- def m2 =
+ def m2 =
(1, 2) match {
case T2 => true
case _ => false
@@ -21,6 +24,6 @@ object Test {
}
}
-class P extends Pair(1, 1) {
+class P extends Tuple2(1, 1) {
override def equals(x: Any) = true
-} \ No newline at end of file
+}
diff --git a/test/files/run/t3897.check b/test/files/run/t3897.check
new file mode 100644
index 0000000000..244b83716f
--- /dev/null
+++ b/test/files/run/t3897.check
@@ -0,0 +1,8 @@
+(One$$messages,scala.collection.mutable.MutableList<java.lang.String>)
+(One$$messages,scala.collection.mutable.MutableList<java.lang.String>)
+(messages,scala.collection.mutable.MutableList<java.lang.String>)
+(messages,scala.collection.mutable.MutableList<java.lang.String>)
+(One$$messages,scala.collection.mutable.MutableList<java.lang.String>)
+(One$$messages,scala.collection.mutable.MutableList<java.lang.String>)
+(messages,scala.collection.mutable.MutableList<java.lang.String>)
+(messages,scala.collection.mutable.MutableList<java.lang.String>)
diff --git a/test/files/run/t3897.flags b/test/files/run/t3897.flags
new file mode 100644
index 0000000000..ac96850b69
--- /dev/null
+++ b/test/files/run/t3897.flags
@@ -0,0 +1 @@
+-Ydelambdafy:inline \ No newline at end of file
diff --git a/test/files/run/t3897/J_2.java b/test/files/run/t3897/J_2.java
new file mode 100644
index 0000000000..a4c9a98fb1
--- /dev/null
+++ b/test/files/run/t3897/J_2.java
@@ -0,0 +1,27 @@
+import java.lang.reflect.*;
+
+public class J_2 {
+ public void f1(Class<?> clazz) {
+ Field[] fields = clazz.getDeclaredFields();
+ for (int i = 0 ; i < fields.length; i++) {
+ String name = fields[i].getName();
+ if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { }
+ else System.out.println("(" + name + "," + fields[i].getGenericType() + ")");
+ }
+ }
+ public void f2(Class<?> clazz) {
+ Method[] methods = clazz.getDeclaredMethods();
+ for (int i = 0 ; i < methods.length; i++) {
+ String name = methods[i].getName();
+ if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { }
+ else System.out.println("(" + name + "," + methods[i].getGenericReturnType() + ")");
+ }
+ }
+
+ public void javaRun() {
+ f1(One.class);
+ f2(One.class);
+ f1(Two.class);
+ f2(Two.class);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t3897/a_1.scala b/test/files/run/t3897/a_1.scala
new file mode 100644
index 0000000000..4da959e2ac
--- /dev/null
+++ b/test/files/run/t3897/a_1.scala
@@ -0,0 +1,8 @@
+class One {
+ private val messages = new collection.mutable.MutableList[String]
+ List("a") foreach { messages += _ }
+}
+
+class Two {
+ private val messages = new collection.mutable.MutableList[String]
+}
diff --git a/test/files/run/t3897/a_2.scala b/test/files/run/t3897/a_2.scala
new file mode 100644
index 0000000000..7a161fcbe4
--- /dev/null
+++ b/test/files/run/t3897/a_2.scala
@@ -0,0 +1,23 @@
+object Test {
+ def f1(clazz: Class[_]) = (
+ clazz.getDeclaredFields.toList
+ . filterNot (_.getName contains "bitmap$")
+ . map (f => (f.getName, f.getGenericType))
+ . foreach (println)
+ )
+ def f2(clazz: Class[_]) = (
+ clazz.getDeclaredMethods.toList
+ . filterNot (_.getName contains "bitmap$")
+ . map (f => (f.getName, f.getGenericReturnType))
+ . foreach (println)
+ )
+
+ def main(args: Array[String]): Unit = {
+ f1(classOf[One])
+ f2(classOf[One])
+ f1(classOf[Two])
+ f2(classOf[Two])
+
+ new J_2().javaRun
+ }
+}
diff --git a/test/files/run/t3932.scala b/test/files/run/t3932.scala
index 51fc16d6ea..f577ef8315 100644
--- a/test/files/run/t3932.scala
+++ b/test/files/run/t3932.scala
@@ -23,10 +23,10 @@ object Test {
def main(args: Array[String]): Unit = {
println(O1.g1)
println(O1.g2)
-
+
println(O2.g1)
println(O2.g2)
-
+
val o3 = new O3()
println(o3.g1)
println(o3.g2)
diff --git a/test/files/run/t3935.scala b/test/files/run/t3935.scala
index c66b1b0599..fa1bbf8d3f 100644
--- a/test/files/run/t3935.scala
+++ b/test/files/run/t3935.scala
@@ -9,7 +9,7 @@ object Test {
try {
assert(q.front != null)
} catch {
- case _ =>
+ case _: Throwable =>
}
}
}
diff --git a/test/files/run/t3964.scala b/test/files/run/t3964.scala
index 80ba361a20..9b46cdb298 100644
--- a/test/files/run/t3964.scala
+++ b/test/files/run/t3964.scala
@@ -1,13 +1,16 @@
+
+import scala.language.implicitConversions
+
object Test {
- class Base
+ class Base
object Bob extends Base
class Foo { def bippy = 42 }
class Oof { def bippy = -21 }
-
+
// I am more specific than you
implicit def f1(x: Bob.type): Foo = new Foo
implicit def f2(x: Base): Oof = new Oof
-
+
def main(args: Array[String]): Unit = {
// this would of course print an unambiguous 42
println(Bob.bippy)
diff --git a/test/files/run/t3970.check b/test/files/run/t3970.check
new file mode 100644
index 0000000000..bd89fff9d9
--- /dev/null
+++ b/test/files/run/t3970.check
@@ -0,0 +1 @@
+warning: there were 5 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t3970.scala b/test/files/run/t3970.scala
index f8c763bc85..35b5ce6e1b 100644
--- a/test/files/run/t3970.scala
+++ b/test/files/run/t3970.scala
@@ -9,11 +9,11 @@ object Test {
def main(args: Array[String]) {
val dl = DoubleLinkedList[Int]()
dl.remove()
-
+
val dl2 = DoubleLinkedList[Int](1, 2, 3)
dl2.next.remove()
assert(dl2 == DoubleLinkedList(1, 3))
-
+
val dl3 = DoubleLinkedList[Int](1, 2, 3)
assert(dl3.drop(1) == DoubleLinkedList(2, 3))
assert(dl3.drop(1).prev == null)
diff --git a/test/files/run/t3980.scala b/test/files/run/t3980.scala
index 4e693eba9b..c140176ce4 100644
--- a/test/files/run/t3980.scala
+++ b/test/files/run/t3980.scala
@@ -2,7 +2,7 @@ object A {
def run1 {
lazy val x: Unit = {(); println("once")}
x
- x
+ x
}
def run2 {
lazy val y: Int = 2
diff --git a/test/files/run/t3984.scala b/test/files/run/t3984.scala
index 9a2e00a2a8..0747b0ee25 100644
--- a/test/files/run/t3984.scala
+++ b/test/files/run/t3984.scala
@@ -36,7 +36,7 @@ object MapBug {
im = im + ((ih,ih))
mm = mm + ((ih,ih))
}
- assert(im == mm)
+ assert(im == mm)
val x = IH(6,4)
im = im - x
mm = mm - x
diff --git a/test/files/run/t3996.check b/test/files/run/t3996.check
new file mode 100644
index 0000000000..a92ddc0e51
--- /dev/null
+++ b/test/files/run/t3996.check
@@ -0,0 +1 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t4013.scala b/test/files/run/t4013.scala
index da7fbc5b3f..7060559317 100644
--- a/test/files/run/t4013.scala
+++ b/test/files/run/t4013.scala
@@ -5,12 +5,12 @@ trait Base[B] {
}
-class Suba[@specialized B](override val data: Array[B]) extends Base[B] {
+class Suba[@specialized B](override val data: Array[B]) extends Base[B] {
assert(data != null)
}
-class Subopt[@specialized B](override val data: Option[B]) extends Base[B] {
+class Subopt[@specialized B](override val data: Option[B]) extends Base[B] {
assert(data != null)
}
diff --git a/test/files/run/t4013b.scala b/test/files/run/t4013b.scala
index f17eaea3d3..1262e261f5 100644
--- a/test/files/run/t4013b.scala
+++ b/test/files/run/t4013b.scala
@@ -8,7 +8,7 @@ trait Base[B] {
class M[@specialized(Int) A]
-class Sub3[@specialized(Int) B](override val data: M[B]) extends Base[B] {
+class Sub3[@specialized(Int) B](override val data: M[B]) extends Base[B] {
assert(data != null)
}
diff --git a/test/files/run/t4023.check b/test/files/run/t4023.check
new file mode 100644
index 0000000000..05f867c397
--- /dev/null
+++ b/test/files/run/t4023.check
@@ -0,0 +1,21 @@
+Try 1: (6 classes)
+class Test$C$B1
+class Test$C$B2
+class Test$C$B3$
+class Test$C$B4$
+class Test$C$B5$
+class Test$C$B6$
+Try 2: (6 classes)
+class Test$C$B1
+class Test$C$B2
+class Test$C$B3$
+class Test$C$B4$
+class Test$C$B5$
+class Test$C$B6$
+Try 3: (6 classes)
+class Test$C$B1
+class Test$C$B2
+class Test$C$B3$
+class Test$C$B4$
+class Test$C$B5$
+class Test$C$B6$
diff --git a/test/files/run/t4023.scala b/test/files/run/t4023.scala
new file mode 100644
index 0000000000..518b58382a
--- /dev/null
+++ b/test/files/run/t4023.scala
@@ -0,0 +1,34 @@
+object Test {
+ object C {
+ class B1
+ private class B2
+ object B3
+ private object B4
+ object B5 extends B1
+ private object B6 extends B2
+
+ val classes1 = this.getClass.getDeclaredClasses
+ val classes2 = C.getClass .getDeclaredClasses
+ val classes3 = getClass .getDeclaredClasses
+ }
+
+ // sortBy(_.getName) introduces additional classes which we don't want to see in C,
+ // so we call sortBy outside of C.
+ object TestHelper {
+ val valuesTry1 = C.classes1.sortBy(_.getName)
+ val valuesTry2 = C.classes2.sortBy(_.getName)
+ val valuesTry3 = C.classes3.sortBy(_.getName)
+ }
+
+ def main(args: Array[String]) {
+ println("Try 1: (" + TestHelper.valuesTry1.length + " classes)")
+ TestHelper.valuesTry1.foreach(println)
+ println("Try 2: (" + TestHelper.valuesTry2.length + " classes)")
+ TestHelper.valuesTry2.foreach(println)
+ println("Try 3: (" + TestHelper.valuesTry3.length + " classes)")
+ TestHelper.valuesTry3.foreach(println)
+ }
+
+
+}
+
diff --git a/test/files/run/t4024.scala b/test/files/run/t4024.scala
index 7c62a3fc6e..f48410915d 100644
--- a/test/files/run/t4024.scala
+++ b/test/files/run/t4024.scala
@@ -1,9 +1,9 @@
object Test extends App {
- val x = "abc"
+ val x = "abc"
val m = x.getClass.getMethod("toString")
-
+
assert(m.invoke(x, (Nil: List[AnyRef]): _*) == "abc")
Test2.main(Array())
diff --git a/test/files/run/t4025.check b/test/files/run/t4025.check
index 6715003cb6..2d4f644c5a 100644
--- a/test/files/run/t4025.check
+++ b/test/files/run/t4025.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> class Color(val red: Int)
defined class Color
diff --git a/test/files/run/t4027.scala b/test/files/run/t4027.scala
index d70ca0cc3a..585c5c8b37 100644
--- a/test/files/run/t4027.scala
+++ b/test/files/run/t4027.scala
@@ -7,7 +7,7 @@ import collection._
* Mapping, filtering, etc. on these views should return sorted maps again.
*/
object Test extends App {
-
+
val sortedmap = SortedMap(1 -> false, 2 -> true, 3 -> false, 4 -> true)
println(sortedmap.filterKeys(_ % 2 == 0): SortedMap[Int, Boolean])
println(sortedmap.mapValues(_ + "!"): SortedMap[Int, String])
@@ -15,7 +15,7 @@ object Test extends App {
println(sortedmap.mapValues(_ + "!").map(t => (t._1, t._2.toString.length)): SortedMap[Int, Int])
println(sortedmap.filterKeys(_ % 2 == 0).filter(t => t._1 < 2): SortedMap[Int, Boolean])
println(sortedmap.mapValues(_ + "!").filter(t => t._1 < 2): SortedMap[Int, String])
-
+
val immsortedmap = immutable.SortedMap(1 -> false, 2 -> true, 3 -> false, 4 -> true)
println(immsortedmap.filterKeys(_ % 2 == 0): immutable.SortedMap[Int, Boolean])
println(immsortedmap.mapValues(_ + "!"): immutable.SortedMap[Int, String])
@@ -23,5 +23,5 @@ object Test extends App {
println(immsortedmap.mapValues(_ + "!").map(t => (t._1, t._2.toString.length)): immutable.SortedMap[Int, Int])
println(immsortedmap.filterKeys(_ % 2 == 0).filter(t => t._1 < 2): immutable.SortedMap[Int, Boolean])
println(immsortedmap.mapValues(_ + "!").filter(t => t._1 < 2): immutable.SortedMap[Int, String])
-
+
}
diff --git a/test/files/run/t4047.check b/test/files/run/t4047.check
index 2a942a70e0..3c41e6e244 100644
--- a/test/files/run/t4047.check
+++ b/test/files/run/t4047.check
@@ -1,3 +1,15 @@
+t4047.scala:23: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ a.foo
+ ^
+t4047.scala:24: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ a.foo
+ ^
+t4047.scala:26: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ b.foo
+ ^
+t4047.scala:27: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ b.foo
+ ^
Unit: called A.foo
Unit: called B.foo
Unit: called C.foo
diff --git a/test/files/run/t4047.scala b/test/files/run/t4047.scala
index cd42a8b4df..08989bd278 100644
--- a/test/files/run/t4047.scala
+++ b/test/files/run/t4047.scala
@@ -18,7 +18,7 @@ class D extends Bar[Unit]{
def foo = println("Unit: called D.foo")
}
-object Test extends Application {
+object Test extends App {
val a: Foo[Unit] = new A
a.foo
a.foo
diff --git a/test/files/run/t4054.scala b/test/files/run/t4054.scala
index 8f1f685854..83a58ef97c 100644
--- a/test/files/run/t4054.scala
+++ b/test/files/run/t4054.scala
@@ -9,7 +9,7 @@
object Test {
def main(args: Array[String]) {
val it = Iterator.from(1).map(n => n * n).scanLeft(0)(_+_)
-
+
assert(it.next == 0)
assert(it.next == 1)
assert(it.next == 5)
diff --git a/test/files/run/t4062.scala b/test/files/run/t4062.scala
index 6a5aea5b47..f5478e7593 100644
--- a/test/files/run/t4062.scala
+++ b/test/files/run/t4062.scala
@@ -1,7 +1,7 @@
class A(val f : String)
class B(f: String) extends A(f) {
- def foo(x: String) = x match {
+ def foo(x: String) = x match {
case `f` => true
case _ => false
}
diff --git a/test/files/run/t4072.scala b/test/files/run/t4072.scala
index 872072a4ce..c035fcc22a 100644
--- a/test/files/run/t4072.scala
+++ b/test/files/run/t4072.scala
@@ -1,12 +1,14 @@
import scala.tools.nsc._
+import scala.language.{ reflectiveCalls }
+
object Test {
class DryRun {
- val compiler = new Global(new Settings()) {
+ val compiler = new Global(new Settings()) {
lazy val test1 = new AnyRef
}
}
-
+
def main(args: Array[String]) {
new DryRun().compiler.test1
}
diff --git a/test/files/run/t408.scala b/test/files/run/t408.scala
index 4d3dcbcb84..9e51e881ed 100644
--- a/test/files/run/t408.scala
+++ b/test/files/run/t408.scala
@@ -2,7 +2,7 @@ object Test
{
val a = scala.collection.immutable.Set.empty ++ (0 to 100000)
val b = scala.collection.immutable.Set.empty ++ (0 to 100000)
-
+
def main(args: Array[String]): Unit = {
a -- b
a -- b
diff --git a/test/files/run/t4080.check b/test/files/run/t4080.check
index 66ce31bb43..1953a68ad3 100644
--- a/test/files/run/t4080.check
+++ b/test/files/run/t4080.check
@@ -1 +1,2 @@
+warning: there were 3 deprecation warning(s); re-run with -deprecation for details
LinkedList(1, 0, 2, 3)
diff --git a/test/files/run/t4080.scala b/test/files/run/t4080.scala
index 92740ed776..1d1418847d 100644
--- a/test/files/run/t4080.scala
+++ b/test/files/run/t4080.scala
@@ -1,4 +1,5 @@
import scala.collection.mutable.LinkedList
+import java.util.NoSuchElementException
object Test {
def main(args: Array[String]) {
@@ -6,7 +7,7 @@ object Test {
ll.insert(LinkedList(0))
println(ll)
val ll2 = LinkedList[Int]()
- try println(ll2.head)
- catch { case _ => () }
+ try println("Empty head? " + ll2.head)
+ catch { case _: NoSuchElementException => () }
}
}
diff --git a/test/files/run/t4119/J.java b/test/files/run/t4119/J.java
index 42508993ea..ee65d33e22 100644
--- a/test/files/run/t4119/J.java
+++ b/test/files/run/t4119/J.java
@@ -1,6 +1,6 @@
package foo.bar;
-public abstract class J {
+public abstract class J {
protected void foo(J j) {
return;
}
diff --git a/test/files/run/t4119/S.scala b/test/files/run/t4119/S.scala
index e5e3db5da3..d6ae5f1b87 100644
--- a/test/files/run/t4119/S.scala
+++ b/test/files/run/t4119/S.scala
@@ -1,6 +1,6 @@
class S extends foo.bar.J {
sss =>
-
+
val fn = () => {
foo(S.this)
}
diff --git a/test/files/run/t4122.scala b/test/files/run/t4122.scala
index 7ead2b7742..5ff570c009 100644
--- a/test/files/run/t4122.scala
+++ b/test/files/run/t4122.scala
@@ -4,7 +4,7 @@ object Test {
val sw3 = Seq('a', 'b')
val sw4 = "ab".toList
val all = List(sw, sw2, sw3, sw4)
-
+
def main(args: Array[String]): Unit = {
for (s1 <- all ; s2 <- all) {
assert(s1 == s2, s1 + " != " + s2)
diff --git a/test/files/run/t4138.check b/test/files/run/t4138.check
deleted file mode 100644
index f561b5e6b0..0000000000
--- a/test/files/run/t4138.check
+++ /dev/null
@@ -1,2 +0,0 @@
-[1.45] parsed: "lir 'de\' ' \\ \n / upa \"new\" \t parsing"
-[1.5] parsed: "s "
diff --git a/test/files/run/t4138.scala b/test/files/run/t4138.scala
deleted file mode 100644
index 131489e581..0000000000
--- a/test/files/run/t4138.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test extends App {
- object p extends scala.util.parsing.combinator.JavaTokenParsers
-
- println(p.parse(p.stringLiteral, """"lir 'de\' ' \\ \n / upa \"new\" \t parsing""""))
- println(p.parse(p.stringLiteral, """"s " lkjse""""))
-}
diff --git a/test/files/run/t4146.scala b/test/files/run/t4146.scala
deleted file mode 100644
index 93ce22b519..0000000000
--- a/test/files/run/t4146.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-object bob extends Application {
- var name = "Bob"
-}
-
-object Test extends App {
- assert(bob.name == "Bob")
-}
diff --git a/test/files/run/t4148.scala b/test/files/run/t4148.scala
index 0739403594..d543e093ab 100644
--- a/test/files/run/t4148.scala
+++ b/test/files/run/t4148.scala
@@ -1,8 +1,8 @@
object Test {
- val x1 = try { "aaa".asInstanceOf[Int] } catch { case _ => "cce1" }
- val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _ => "cce2" }
- val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _ => "cce3" }
-
+ val x1 = try { "aaa".asInstanceOf[Int] } catch { case _: Throwable => "cce1" }
+ val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _: Throwable => "cce2" }
+ val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _: Throwable => "cce3" }
+
def main(args: Array[String]): Unit = {
List(x1, x2, x3) foreach println
}
diff --git a/test/files/run/t4171.scala b/test/files/run/t4171.scala
index fba2fb5ed6..7f6dfd48ce 100644
--- a/test/files/run/t4171.scala
+++ b/test/files/run/t4171.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ reflectiveCalls }
+
object Test {
val c = { class C; new C { def foo = 1 } }
val a = { class B { def bar = 5 }; class C extends B; new C }
diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check
index b48c9ca056..d94638d27e 100644
--- a/test/files/run/t4172.check
+++ b/test/files/run/t4172.check
@@ -1,12 +1,8 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
-scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) }
+scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) }
warning: there were 1 feature warning(s); re-run with -feature for details
c: (C, C{def f: Int}) forSome { type C <: AnyRef } = (C,C)
scala>
-
-scala>
diff --git a/test/files/run/t4238/J_1.java b/test/files/run/t4238/J_1.java
index 21a4b182ad..47a9c21000 100644
--- a/test/files/run/t4238/J_1.java
+++ b/test/files/run/t4238/J_1.java
@@ -3,14 +3,14 @@ import scala.*;
class J_1 {
scala.collection.mutable.HashMap<String, String> map =
new scala.collection.mutable.HashMap<String, String>();
-
+
Function1<Tuple2<String, String>, Integer> f =
new scala.runtime.AbstractFunction1<Tuple2<String, String>, Integer>() {
public Integer apply(Tuple2<String, String> s) {
return s._1().length();
}
};
-
+
scala.collection.Seq<Integer> counts =
map.groupBy(f).keys().toList();
}
diff --git a/test/files/run/t4285.check b/test/files/run/t4285.check
index 84f8929e43..314c8e5a35 100644
--- a/test/files/run/t4285.check
+++ b/test/files/run/t4285.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> val x = Array(1,2,3,4,5,6,7)
x: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7)
@@ -13,5 +11,3 @@ scala> println(y.sum)
56
scala>
-
-scala>
diff --git a/test/files/run/t4287inferredMethodTypes.check b/test/files/run/t4287inferredMethodTypes.check
new file mode 100644
index 0000000000..56e9c097cc
--- /dev/null
+++ b/test/files/run/t4287inferredMethodTypes.check
@@ -0,0 +1,30 @@
+[[syntax trees at end of typer]] // newSource1.scala
+[0:92]package [0:0]<empty> {
+ [0:21]class A extends [7:21][23]scala.AnyRef {
+ [8:16]<paramaccessor> private[this] val a: [8]Int = _;
+ <8:20>def <init>(<8:20>a: [11]<type: [11]scala.Int> = [17:20]A.a): [7]A = <8:20>{
+ <8:20><8:20><8:20>A.super.<init>();
+ <8:20>()
+ }
+ };
+ [23:47]object A extends [32:47][49]scala.AnyRef {
+ [49]def <init>(): [32]A.type = [49]{
+ [49][49][49]A.super.<init>();
+ [32]()
+ };
+ [36:45]private[this] val a: [40]Int = [44:45]2;
+ [40]<stable> <accessor> def a: [40]Int = [40][40]A.this.a;
+ [8]<synthetic> def <init>$default$1: [8]Int = [19]A.a
+ };
+ [49:92]class B extends [57:92][65:66]A {
+ [65]def <init>(): [57]B = [65]{
+ [65][65][65]B.super.<init>([65]A.<init>$default$1);
+ [57]()
+ };
+ [70:90]def <init>([79:80]a: [79]Int): [74]B = [84:90]{
+ [84:90][84:90][84]B.this.<init>();
+ [84]()
+ }
+ }
+}
+
diff --git a/test/files/run/t4287inferredMethodTypes.scala b/test/files/run/t4287inferredMethodTypes.scala
new file mode 100644
index 0000000000..f14e672da8
--- /dev/null
+++ b/test/files/run/t4287inferredMethodTypes.scala
@@ -0,0 +1,25 @@
+import scala.tools.partest.DirectTest
+
+object Test extends DirectTest {
+
+ override def extraSettings: String =
+ s"-usejavacp -Yinfer-argument-types -Xprint-pos -Xprint:typer -Yrangepos -Ystop-after:typer -d ${testOutput.path}"
+
+ override def code = """
+class A(a: Int = A.a)
+
+object A {
+ val a = 2
+}
+
+class B extends A {
+ def this(a) = this()
+}
+ """.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t4288.scala b/test/files/run/t4288.scala
index eafd2808f1..23319d1c27 100644
--- a/test/files/run/t4288.scala
+++ b/test/files/run/t4288.scala
@@ -1,12 +1,12 @@
object Test {
def f1 = scala.collection.mutable.ListBuffer(1 to 9: _*).slice(-5, -1)
- def f2 = scala.collection.mutable.ListBuffer(1 to 9: _*).readOnly.slice(-5, -1)
+ def f2 = List(1 to 9: _*).slice(-5, -1)
def f3 = Vector(1 to 9: _*).slice(-5, -1)
def f4 = Traversable(1 to 9: _*).slice(-5, -1)
def f5 = (1 to 9).toArray.slice(-5, -1)
def f6 = (1 to 9).toStream.slice(-5, -1)
def f7 = (1 to 9).slice(-5, -1)
-
+
def main(args: Array[String]): Unit = {
List[Traversable[Int]](f1, f2, f3, f4, f5, f6, f7) foreach (x => assert(x.isEmpty, x))
}
diff --git a/test/files/run/t4294.scala b/test/files/run/t4294.scala
index fafaf1d8ef..e15c716047 100644
--- a/test/files/run/t4294.scala
+++ b/test/files/run/t4294.scala
@@ -1,7 +1,12 @@
object Test {
def main(args: Array[String]) {
+ // Skip test on Avian, see SI-7600 for further information
+ if (!scala.tools.partest.utils.Properties.isAvian)
+ run()
+ }
+
+ def run(): Unit = {
(Stream.from(1).collect{case x if x > 5000000 => x}: Stream[Int])
-
assert((Stream from 1 take 10 collect { case x if x <= 3 => x*x }).sum == 14)
}
}
diff --git a/test/files/run/t4317/S_3.scala b/test/files/run/t4317/S_3.scala
index dd04ea31ef..ce8e2330e3 100644
--- a/test/files/run/t4317/S_3.scala
+++ b/test/files/run/t4317/S_3.scala
@@ -1,4 +1,4 @@
-object Test {
+object Test {
def main(args: Array[String]): Unit = {
val j = new J_2()
println(j.bar1())
diff --git a/test/files/run/t4332.check b/test/files/run/t4332.check
new file mode 100644
index 0000000000..ff9d9b8647
--- /dev/null
+++ b/test/files/run/t4332.check
@@ -0,0 +1,25 @@
+
+======================================================================
+Checking scala.collection.TraversableView
+======================================================================
+
+
+======================================================================
+Checking scala.collection.IterableView
+======================================================================
+
+
+======================================================================
+Checking scala.collection.SeqView
+======================================================================
+
+
+======================================================================
+Checking scala.collection.mutable.IndexedSeqView
+======================================================================
+
+
+======================================================================
+Checking scala.collection.immutable.StreamView
+======================================================================
+
diff --git a/test/files/run/t4332.scala b/test/files/run/t4332.scala
new file mode 100644
index 0000000000..5a67922911
--- /dev/null
+++ b/test/files/run/t4332.scala
@@ -0,0 +1,44 @@
+import scala.tools.partest._
+
+object Test extends DirectTest {
+ override def code = ""
+ lazy val global = newCompiler("-usejavacp")
+ import global._, definitions._
+
+ override def show() {
+ new global.Run()
+ // Once we plug all of the view gaps, the output should be empty!
+ checkViews()
+ }
+
+ def isExempt(sym: Symbol) = {
+ val exempt = Set("view", "repr", "sliceWithKnownDelta", "sliceWithKnownBound", "transform")
+ (exempt contains sym.name.decoded)
+ }
+
+ def checkView(viewType: Type, viewLikeType: Type) {
+ val sep = "=" * 70
+ println(s"\n$sep\nChecking ${viewType.typeSymbol.fullName}\n$sep")
+ val termMembers = viewType.nonPrivateMembers.toList filter (_.isTerm) map fullyInitializeSymbol
+ val inheritedFromGenericCollection
+ = termMembers filterNot (_.owner.name.decoded contains "ViewLike") filterNot (_.owner == viewType.typeSymbol)
+ def returnsView(sym: Symbol) = viewType.memberType(sym).finalResultType contains viewType.typeSymbol
+ val needOverride = inheritedFromGenericCollection filterNot isExempt filter returnsView
+
+ val grouped = needOverride.groupBy(_.owner).toSeq.sortBy { case (owner, _) => viewType baseTypeIndex owner }
+ val report = grouped.map {
+ case (owner, syms) => s"\n$owner\n${"-" * 70}\n${syms.map(_.defString).sorted.mkString("\n")}"
+ }.mkString("\n")
+ println(report)
+ }
+
+ def checkViews() {
+ import collection._
+ checkView(typeOf[TraversableView[_, _]], typeOf[TraversableViewLike[_, _, _]])
+ checkView(typeOf[IterableView[_, _]], typeOf[IterableViewLike[_, _, _]])
+ checkView(typeOf[SeqView[_, _]], typeOf[SeqViewLike[_, _, _]])
+ checkView(typeOf[mutable.IndexedSeqView[_, _]], typeOf[SeqViewLike[_, _, _]])
+ checkView(typeOf[immutable.StreamView[_, _]], typeOf[immutable.StreamViewLike[_, _, _]])
+ // Parallel views not checked, assuming we will drop them in 2.11
+ }
+}
diff --git a/test/files/run/t4332b.scala b/test/files/run/t4332b.scala
new file mode 100644
index 0000000000..8ee069ca2d
--- /dev/null
+++ b/test/files/run/t4332b.scala
@@ -0,0 +1,35 @@
+object Test extends App {
+ def check(expected: Any, actual: Any, msg: String = "") = {
+ if (expected != actual)
+ sys.error(s"($actual != $expected) $msg")
+ }
+ val ls = List(1, 3, 2, 1)
+ for (N <- -1 to (ls.length + 1)) {
+ check(ls.takeRight(N), ls.view.takeRight(N).toList, s"takeRight($N)")
+ check(ls.dropRight(N), ls.view.dropRight(N).toList, s"dropRight($N)")
+ }
+ for (N <- 1 to (ls.length + 1)) {
+ check(ls.sliding(N).toList, ls.view.sliding(N).toList.map(_.toList), s"sliding($N)")
+ check(ls.sliding(N, 2).toList, ls.view.sliding(N, 2).toList.map(_.toList), s"sliding($N, 2)")
+ }
+ for (b <- List(true, false))
+ check(ls.filterNot(x => true), ls.view.filterNot(x => true), s"filterNot($b)")
+
+ check(ls.inits.toList, ls.view.inits.toList.map(_.toList), "inits")
+ check(ls.tails.toList, ls.view.tails.toList.map(_.toList), "tails")
+
+ check(ls.combinations(2).toList.map(_.toList), ls.view.combinations(2).toList.map(_.toList), "combinations(2)")
+ check(ls.permutations.toList.map(_.toList), ls.view.permutations.toList.map(_.toList), "permutations")
+
+ check(ls.sortBy(_ * -1), ls.view.sortBy(_ * -1).toList, "sortBy")
+ check(ls.sortWith((x, y) => y < x), ls.view.sortWith((x, y) => y < x).toList, "sortWith")
+ check(ls.sorted, ls.view.sorted.toList, "sorted")
+
+ check(ls.distinct, ls.view.distinct.toList, "distinct")
+
+ check(ls.tail, ls.view.tail.toList, "tail")
+
+ import collection.mutable.Buffer
+ check(Buffer(1, 2, 3).tail, Buffer(1, 2, 3).view.tail.toList, "Buffer#tail")
+ check(Buffer(1, 2, 3).tail.length, Buffer(1, 2, 3).view.tail.length, "Buffer#tail#length")
+}
diff --git a/test/files/run/t4351.check b/test/files/run/t4351.check
new file mode 100644
index 0000000000..cb5d407e13
--- /dev/null
+++ b/test/files/run/t4351.check
@@ -0,0 +1 @@
+runtime exception
diff --git a/test/files/run/t4351.scala b/test/files/run/t4351.scala
new file mode 100644
index 0000000000..d954d748b7
--- /dev/null
+++ b/test/files/run/t4351.scala
@@ -0,0 +1,21 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ try new BooleanPropImpl().value
+ catch {
+ // was: StackOverflowError
+ case e: RuntimeException => println("runtime exception")
+ }
+ }
+}
+
+trait Prop[@specialized(Boolean) +T] {
+ def value: T
+}
+
+class PropImpl[+T] extends Prop[T] {
+ def value: T = scala.sys.error("")
+}
+
+trait BooleanProp extends Prop[Boolean]
+
+class BooleanPropImpl() extends PropImpl[Boolean] with BooleanProp
diff --git a/test/files/run/t4387.scala b/test/files/run/t4387.scala
deleted file mode 100644
index 68cbe97d08..0000000000
--- a/test/files/run/t4387.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Test {
- import xml.XML.loadString
- def mkElem(arg: String) = <foo a="1" b="2" c="3" d="4" e={arg} />
-
- val x1 = mkElem("5")
- val x2 = mkElem("50")
-
- def main(args: Array[String]): Unit = {
- assert(x1 == loadString("" + x1))
- assert(x2 != loadString("" + x1))
- }
-}
diff --git a/test/files/run/t4396.check b/test/files/run/t4396.check
index 58f4fc5138..a75e1f257f 100644
--- a/test/files/run/t4396.check
+++ b/test/files/run/t4396.check
@@ -1,3 +1,4 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
hallo
constructor
out:22
diff --git a/test/files/run/t4396.scala b/test/files/run/t4396.scala
index ca143165b7..d67eaa378e 100644
--- a/test/files/run/t4396.scala
+++ b/test/files/run/t4396.scala
@@ -1,4 +1,4 @@
-// #43896
+// #43896
trait M extends DelayedInit {
def delayedInit(body : => Unit) {
println("hallo")
diff --git a/test/files/run/t4398.scala b/test/files/run/t4398.scala
index 1d57eb688d..87dc870afc 100644
--- a/test/files/run/t4398.scala
+++ b/test/files/run/t4398.scala
@@ -1,5 +1,7 @@
+import scala.language.{ postfixOps }
+
object Test {
def main(args: Array[String]) {
val x = 1 to 10 toSet
diff --git a/test/files/run/t4415.scala b/test/files/run/t4415.scala
index f96031d650..caf1609b9e 100644
--- a/test/files/run/t4415.scala
+++ b/test/files/run/t4415.scala
@@ -39,7 +39,7 @@ class SecondProperty extends TopProperty
class SubclassSecondProperty extends StandardProperty
trait MyProp[T]
-case class MyPropImpl[T] extends MyProp[T]
+case class MyPropImpl[T]() extends MyProp[T]
object SubclassMatch {
diff --git a/test/files/run/t4426.scala b/test/files/run/t4426.scala
index 95759444d6..1cbd42da25 100644
--- a/test/files/run/t4426.scala
+++ b/test/files/run/t4426.scala
@@ -5,7 +5,7 @@ object Test {
val settings = new Settings()
settings.classpath.value = System.getProperty("java.class.path")
- object cc extends Global(settings) {
+ object cc extends Global(settings) {
object dummy
override def computePluginPhases() = {
@@ -16,9 +16,9 @@ object Test {
new cc.Run
()
}
-
+
def main(args: Array[String]): Unit = {
-
+
}
}
diff --git a/test/files/run/t4461.check b/test/files/run/t4461.check
index e9c01e769d..9488669324 100644
--- a/test/files/run/t4461.check
+++ b/test/files/run/t4461.check
@@ -1,3 +1,4 @@
+warning: there were 4 deprecation warning(s); re-run with -deprecation for details
Include(End,1)
Include(End,2)
Include(End,3)
@@ -8,4 +9,4 @@ Include(End,7)
Script([1] Include(Index(7),8), [2] Include(Index(8),9), [3] Include(Index(9),10))
Include(Start,0)
Script([1] Include(Index(0),-2), [2] Include(Index(1),-1))
-Remove(Index(0),-2) \ No newline at end of file
+Remove(Index(0),-2)
diff --git a/test/files/run/t4461.scala b/test/files/run/t4461.scala
index adc9201313..1801a653e7 100644
--- a/test/files/run/t4461.scala
+++ b/test/files/run/t4461.scala
@@ -9,7 +9,7 @@ object Test {
buf.subscribe(new Subscriber[Message[Int], ObservableBuffer[Int]] {
def notify(pub: ObservableBuffer[Int], event: Message[Int]) = println(event)
})
-
+
buf += 1 // works
buf ++= Array(2) // works
buf ++= ArrayBuffer(3, 4) // works
diff --git a/test/files/run/t4535.scala b/test/files/run/t4535.scala
index eba79431c9..91c13a28cd 100644
--- a/test/files/run/t4535.scala
+++ b/test/files/run/t4535.scala
@@ -5,26 +5,26 @@ import collection._
// #4535
object Test {
-
+
def main(args: Array[String]) {
val as = new mutable.ArrayStack[Int]
as push 1
as push 2
as push 3
println(as.reverse)
-
+
as push 4
as push 5
as push 6
println(as.reverse)
-
+
println(as map { x => x })
-
+
for (i <- 0 until 100) {
as push i
assert(as == as.map(x => x))
assert(as == as.reverse.reverse)
}
}
-
+
}
diff --git a/test/files/run/t4536.scala b/test/files/run/t4536.scala
index acd91deb7f..6661eae6a7 100644
--- a/test/files/run/t4536.scala
+++ b/test/files/run/t4536.scala
@@ -37,10 +37,10 @@ object dynamicMixin extends dynamicAbstractClass with dynamicTrait {
object Test {
-
+
def main(args: Array[String]) {
val cls = new dynamicClass
dynamicMixin
}
-
+
}
diff --git a/test/files/run/t4537.check b/test/files/run/t4537.check
new file mode 100644
index 0000000000..63739ca64a
--- /dev/null
+++ b/test/files/run/t4537.check
@@ -0,0 +1 @@
+b.Settings
diff --git a/test/files/run/t4537/a.scala b/test/files/run/t4537/a.scala
new file mode 100644
index 0000000000..125e223e13
--- /dev/null
+++ b/test/files/run/t4537/a.scala
@@ -0,0 +1,5 @@
+package a
+
+private[a] object Settings {
+ val X = "a.Settings"
+}
diff --git a/test/files/run/t4537/b.scala b/test/files/run/t4537/b.scala
new file mode 100644
index 0000000000..c709d49b04
--- /dev/null
+++ b/test/files/run/t4537/b.scala
@@ -0,0 +1,5 @@
+package b
+
+object Settings {
+ val Y = "b.Settings"
+}
diff --git a/test/files/run/t4537/c.scala b/test/files/run/t4537/c.scala
new file mode 100644
index 0000000000..ee05d4bbfb
--- /dev/null
+++ b/test/files/run/t4537/c.scala
@@ -0,0 +1,8 @@
+package b
+package c
+
+import a._
+
+object Unambiguous {
+ println(Settings.Y)
+}
diff --git a/test/files/run/t4537/d.scala b/test/files/run/t4537/d.scala
new file mode 100644
index 0000000000..dd1d2045ed
--- /dev/null
+++ b/test/files/run/t4537/d.scala
@@ -0,0 +1,6 @@
+import a._
+import b._
+
+object Test extends App {
+ println(Settings.Y)
+}
diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check
index 5c293a8d80..a53f31a3c7 100644
--- a/test/files/run/t4542.check
+++ b/test/files/run/t4542.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() {
override def toString = "Bippy"
}
@@ -15,5 +13,3 @@ scala> val f = new Foo
f: Foo = Bippy
scala>
-
-scala>
diff --git a/test/files/run/t4560.scala b/test/files/run/t4560.scala
index 9979199067..ee657e47eb 100644
--- a/test/files/run/t4560.scala
+++ b/test/files/run/t4560.scala
@@ -7,6 +7,9 @@
// TEST 1
// self-type is other trait
+
+import scala.language.{ reflectiveCalls }
+
trait Aa
trait Ab
diff --git a/test/files/run/t4570.scala b/test/files/run/t4570.scala
index 5408caf6db..5e1a20c52d 100644
--- a/test/files/run/t4570.scala
+++ b/test/files/run/t4570.scala
@@ -1,8 +1,8 @@
object Test extends Enumeration {
val foo = Value
def bar = withName("foo")
-
+
def main(args: Array[String]): Unit = {
- values foreach println
+ values foreach println
}
}
diff --git a/test/files/run/t4574.check b/test/files/run/t4574.check
deleted file mode 100644
index a4522fff24..0000000000
--- a/test/files/run/t4574.check
+++ /dev/null
@@ -1,2 +0,0 @@
-I hereby refute null!
-I denounce null as unListLike!
diff --git a/test/files/run/t4577.scala b/test/files/run/t4577.scala
new file mode 100644
index 0000000000..b08100d3ea
--- /dev/null
+++ b/test/files/run/t4577.scala
@@ -0,0 +1,38 @@
+object Test {
+ val bippy = new Symbol("bippy")
+ val imposter = new Symbol("bippy")
+ val notBippy = new Symbol("not-bippy")
+ val syms = List(bippy, imposter, notBippy)
+
+ // the equals method should only be used for case `bippy`,
+ // for the singleton type pattern, case _: bippy.type, the spec mandates `bippy eq _` as the test
+ class Symbol(val name: String) {
+ override def equals(other: Any) = other match {
+ case x: Symbol => name == x.name
+ case _ => false
+ }
+ override def toString = name
+ }
+
+ // TODO: test bytecode equality for f and fDirect (and g and gDirect),
+ // for now the optimizer doesn't quite get from `f` to `fDirect`
+ def f(s: Symbol) = s match {
+ case _: bippy.type => true
+ case _ => false
+ }
+ def fDirect(s: Symbol) = bippy eq s
+
+ def g(s: Symbol) = s match {
+ case _: bippy.type => 1
+ case `bippy` => 2
+ case _ => 3
+ }
+ def gDirect(s: Symbol) = if (bippy eq s) 1 else if (bippy == s) 2 else 3
+
+ def main(args: Array[String]): Unit = {
+ // `syms map f` should be: true false false
+ assert(syms forall (s => f(s) == fDirect(s)))
+ // `syms map g` should be: 1 2 3
+ assert(syms forall (s => g(s) == gDirect(s)))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala
new file mode 100644
index 0000000000..d2335460e5
--- /dev/null
+++ b/test/files/run/t4594-repl-settings.scala
@@ -0,0 +1,26 @@
+
+import scala.tools.partest.SessionTest
+
+// Detected repl transcript paste: ctrl-D to finish.
+object Test extends SessionTest {
+ def session =
+""" |Type in expressions to have them evaluated.
+ |Type :help for more information.
+ |
+ |scala> @deprecated(message="Please don't do that.", since="Time began.") def depp = "john"
+ |depp: String
+ |
+ |scala> def a = depp
+ |warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+ |a: String
+ |
+ |scala> :settings +deprecation
+ |
+ |scala> def b = depp
+ |<console>:8: warning: method depp is deprecated: Please don't do that.
+ | def b = depp
+ | ^
+ |b: String
+ |
+ |scala> """
+}
diff --git a/test/files/run/t4608.scala b/test/files/run/t4608.scala
index 2d43bebd10..9ffcb0f3f1 100644
--- a/test/files/run/t4608.scala
+++ b/test/files/run/t4608.scala
@@ -1,8 +1,8 @@
// #4608
object Test {
-
+
def main(args: Array[String]) {
((1 to 100) sliding 10).toList.par.map{_.map{i => i * i}}.flatten
}
-
+
}
diff --git a/test/files/run/t4617.scala b/test/files/run/t4617.scala
index 3a877c1915..2fea5e29ec 100644
--- a/test/files/run/t4617.scala
+++ b/test/files/run/t4617.scala
@@ -3,7 +3,7 @@ object Test {
def f2 = {
lazy val d = 4D
lazy val f = 4f
-
+
def bar = "Str " + (d + f)
bar
}
diff --git a/test/files/run/t4656.scala b/test/files/run/t4656.scala
index ab3e3cf53d..4f3d189c8f 100644
--- a/test/files/run/t4656.scala
+++ b/test/files/run/t4656.scala
@@ -6,7 +6,7 @@ object Test {
buf prependToList List(4, 5, 6)
l
}
-
+
def main(args: Array[String]): Unit = {
println(f)
}
diff --git a/test/files/run/t4660.scala b/test/files/run/t4660.scala
index e57bb4bf25..9aac10ddfd 100644
--- a/test/files/run/t4660.scala
+++ b/test/files/run/t4660.scala
@@ -3,7 +3,7 @@ object Test {
val traversable = 1 to 20 map (_.toString)
def normalize(m: Map[Char, Traversable[String]]) = m.map { case (k,v) => (k, v.toList) }
- val groupedFromView = (traversable view).groupBy(_(0))
+ val groupedFromView = traversable.view.groupBy(_(0))
val groupedFromStrict = traversable.groupBy(_(0))
assert(normalize(groupedFromView) == normalize(groupedFromStrict))
diff --git a/test/files/run/t4671.check b/test/files/run/t4671.check
index 4699818cd4..0c36083759 100644
--- a/test/files/run/t4671.check
+++ b/test/files/run/t4671.check
@@ -2,7 +2,7 @@ Type in expressions to have them evaluated.
Type :help for more information.
scala> object o { val file = sys.props("partest.cwd") + "/t4671.scala" }
-defined module o
+defined object o
scala> val s = scala.io.Source.fromFile(o.file)
s: scala.io.BufferedSource = non-empty iterator
@@ -10,7 +10,7 @@ s: scala.io.BufferedSource = non-empty iterator
scala> println(s.getLines.mkString("\n"))
import scala.tools.partest.ReplTest
-object Test extends ReplTest {
+object Test extends ReplTest {
// My god...it's full of quines
def code = """
object o { val file = sys.props("partest.cwd") + "/t4671.scala" }
@@ -30,7 +30,7 @@ s: scala.io.BufferedSource = non-empty iterator
scala> println(s.mkString(""))
import scala.tools.partest.ReplTest
-object Test extends ReplTest {
+object Test extends ReplTest {
// My god...it's full of quines
def code = """
object o { val file = sys.props("partest.cwd") + "/t4671.scala" }
diff --git a/test/files/run/t4671.scala b/test/files/run/t4671.scala
index aba0138aad..6170104c33 100644
--- a/test/files/run/t4671.scala
+++ b/test/files/run/t4671.scala
@@ -1,6 +1,6 @@
import scala.tools.partest.ReplTest
-object Test extends ReplTest {
+object Test extends ReplTest {
// My god...it's full of quines
def code = """
object o { val file = sys.props("partest.cwd") + "/t4671.scala" }
diff --git a/test/files/run/t4680.check b/test/files/run/t4680.check
index b5cfc651f2..512bfd4b54 100644
--- a/test/files/run/t4680.check
+++ b/test/files/run/t4680.check
@@ -1,3 +1,10 @@
+t4680.scala:51: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ new C { 5 }
+ ^
+t4680.scala:69: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ new { val x = 5 } with E() { 5 }
+ ^
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
// new C { }
diff --git a/test/files/run/t4680.scala b/test/files/run/t4680.scala
index 88611df7ae..d5c8d0e7af 100644
--- a/test/files/run/t4680.scala
+++ b/test/files/run/t4680.scala
@@ -43,13 +43,13 @@ class E() extends D() {
object Test {
def p(msg: String) = println("\n\n// " + msg)
-
+
def main(args: Array[String]) {
p("new C { }")
new C { }
p("new C { 5 }")
new C { 5 }
-
+
p("new D()")
new D()
p("new D() { }")
diff --git a/test/files/run/t4697.scala b/test/files/run/t4697.scala
index 728d095ff8..95592172e0 100644
--- a/test/files/run/t4697.scala
+++ b/test/files/run/t4697.scala
@@ -1,7 +1,7 @@
object Test {
var st = Stream(0)
for (i <- 1 to 10000) st = i +: st
-
+
def main(args: Array[String]): Unit = {
println(st.take(10000).sum)
}
diff --git a/test/files/run/t4729/S_2.scala b/test/files/run/t4729/S_2.scala
index e34e3d34d4..f823433ded 100644
--- a/test/files/run/t4729/S_2.scala
+++ b/test/files/run/t4729/S_2.scala
@@ -1,3 +1,4 @@
+import scala.language.reflectiveCalls
// Scala class:
class ScalaVarArgs extends J_1 {
// -- no problem on overriding it using ordinary class
@@ -20,7 +21,7 @@ object Test {
(new ScalaVarArgs).method("1", "2")
(new ScalaVarArgs: J_1).method("1", "2")
- //[4] Not Ok -- error when assigning anonymous class to a explictly typed val
+ //[4] Not Ok -- error when assigning anonymous class to an explictly typed val
// Compiler error: object creation impossible, since method method in trait VarArgs of type (s: <repeated...>[java.lang.String])Unit is not defined
val tagged: J_1 = new J_1 {
def method(s: String*) { println(s) }
diff --git a/test/files/run/t4742.flags b/test/files/run/t4742.flags
new file mode 100644
index 0000000000..ae08446055
--- /dev/null
+++ b/test/files/run/t4742.flags
@@ -0,0 +1 @@
+-Xcheckinit \ No newline at end of file
diff --git a/test/files/run/t4742.scala b/test/files/run/t4742.scala
new file mode 100644
index 0000000000..3b42c0c120
--- /dev/null
+++ b/test/files/run/t4742.scala
@@ -0,0 +1,7 @@
+trait T { val x: Int = 0 }
+object O extends T { override final val x = 1 }
+
+object Test extends App {
+ // was throwing an UnitializedFieldError as constant 1 is folded into the accessor
+ assert((O: T).x == 1)
+}
diff --git a/test/files/run/si4750.check b/test/files/run/t4750.check
index bf55f70df3..bf55f70df3 100644
--- a/test/files/run/si4750.check
+++ b/test/files/run/t4750.check
diff --git a/test/files/run/si4750.scala b/test/files/run/t4750.scala
index 96d2c4fec7..96d2c4fec7 100644
--- a/test/files/run/si4750.scala
+++ b/test/files/run/t4750.scala
diff --git a/test/files/run/t4752.scala b/test/files/run/t4752.scala
index 2a9fc5361f..3d5c166a7a 100644
--- a/test/files/run/t4752.scala
+++ b/test/files/run/t4752.scala
@@ -2,8 +2,8 @@ object Test {
object Bippy {
case object Dingus
}
-
- def main(args: Array[String]): Unit = {
+
+ def main(args: Array[String]): Unit = {
assert(None.## == "None".##, None)
assert(Test.Bippy.Dingus.## == "Dingus".##, Test.Bippy.Dingus)
}
diff --git a/test/files/run/t4753.scala b/test/files/run/t4753.scala
index 98f3e92678..cfb252cbe5 100644
--- a/test/files/run/t4753.scala
+++ b/test/files/run/t4753.scala
@@ -1,4 +1,4 @@
-trait A {
+trait A {
val actualType: Class[_]
}
trait B extends A {
diff --git a/test/files/run/t4761.scala b/test/files/run/t4761.scala
index a9c245d7d5..e4bd87cb15 100644
--- a/test/files/run/t4761.scala
+++ b/test/files/run/t4761.scala
@@ -3,7 +3,7 @@ object Test {
val gs = for (x <- (1 to 5)) yield { if (x % 2 == 0) List(1).seq else List(1).par }
println(gs.flatten)
println(gs.transpose)
-
+
val s = Stream(Vector(1).par, Vector(2).par)
println(s.flatten.toList)
println(s.transpose.map(_.toList).toList)
diff --git a/test/files/run/t4766.scala b/test/files/run/t4766.scala
index c2a864ddb2..d67431f50e 100644
--- a/test/files/run/t4766.scala
+++ b/test/files/run/t4766.scala
@@ -1,3 +1,7 @@
+
+import scala.language.postfixOps
+import scala.language.reflectiveCalls
+
object Test extends App {
val x = new {
def > = 1
diff --git a/test/files/run/t4777.scala b/test/files/run/t4777.scala
index 4a811d3b9a..6c7b856e39 100644
--- a/test/files/run/t4777.scala
+++ b/test/files/run/t4777.scala
@@ -3,6 +3,6 @@ class DefaultsTest(x: Int = 25) extends A(28)
object DefaultsTest extends DefaultsTest(12)
object Test extends App {
- println(new DefaultsTest() a)
- println(DefaultsTest a)
+ println(new DefaultsTest().a)
+ println(DefaultsTest.a)
}
diff --git a/test/files/run/t4794.scala b/test/files/run/t4794.scala
index afe89fa429..720906f507 100644
--- a/test/files/run/t4794.scala
+++ b/test/files/run/t4794.scala
@@ -7,6 +7,7 @@ class Arr[@specialized A](val arr: Array[A]) {
object Test {
def main(args: Array[String]): Unit = {
- println(classOf[Arr[_]].getMethods filter (_.getName contains "quux") size) // expect 10, not 1
+ def quuxae = classOf[Arr[_]].getMethods filter (_.getName contains "quux")
+ println(quuxae.size) // expect 10, not 1
}
}
diff --git a/test/files/run/t4809.scala b/test/files/run/t4809.scala
index b30d80562f..4b721d111b 100644
--- a/test/files/run/t4809.scala
+++ b/test/files/run/t4809.scala
@@ -5,7 +5,7 @@ import scala.util.control.Breaks._
object Test {
-
+
def main(args: Array[String]) {
val x = tryBreakable {
break
@@ -14,14 +14,14 @@ object Test {
3
}
assert(x == 3, x)
-
+
val y = tryBreakable {
2
} catchBreak {
3
}
assert(y == 2, y)
-
+
val z = tryBreakable {
break
1.0
@@ -30,5 +30,5 @@ object Test {
}
assert(z == 2.0, z)
}
-
+
}
diff --git a/test/files/run/t4813.check b/test/files/run/t4813.check
new file mode 100644
index 0000000000..a92ddc0e51
--- /dev/null
+++ b/test/files/run/t4813.check
@@ -0,0 +1 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t4835.scala b/test/files/run/t4835.scala
index c964e42e7c..26275c0ab4 100644
--- a/test/files/run/t4835.scala
+++ b/test/files/run/t4835.scala
@@ -1,6 +1,6 @@
/*
* Test case for SI-4835. This tests confirm that the fix
- * doesn't break laziness. To test memory consumption,
+ * doesn't break laziness. To test memory consumption,
* I need to confirm that OutOfMemoryError doesn't occur.
* I could create such tests. However, such tests consume
* too much time and memory.
diff --git a/test/files/run/t4841-isolate-plugins.check b/test/files/run/t4841-isolate-plugins.check
new file mode 100644
index 0000000000..a6462b424b
--- /dev/null
+++ b/test/files/run/t4841-isolate-plugins.check
@@ -0,0 +1,2 @@
+My phase name is ploogin1_1
+My phase name is ploogin1_2
diff --git a/test/files/run/t4841-isolate-plugins/ploogin.scala b/test/files/run/t4841-isolate-plugins/ploogin.scala
new file mode 100644
index 0000000000..bd8c7275ec
--- /dev/null
+++ b/test/files/run/t4841-isolate-plugins/ploogin.scala
@@ -0,0 +1,30 @@
+
+package t4841
+
+import scala.tools.nsc.{ Global, Phase }
+import scala.tools.nsc.plugins.{ Plugin, PluginComponent }
+import scala.reflect.io.Path
+import scala.reflect.io.File
+
+/** A test plugin. */
+class Ploogin(val global: Global, val name: String = "ploogin") extends Plugin {
+ import global._
+
+ val description = "A sample plugin for testing."
+ val components = List[PluginComponent](TestComponent)
+
+ private object TestComponent extends PluginComponent {
+ val global: Ploogin.this.global.type = Ploogin.this.global
+ //override val runsBefore = List("refchecks")
+ val runsAfter = List("jvm")
+ val phaseName = Ploogin.this.name
+ override def description = "A sample phase that does so many things it's kind of hard to describe briefly."
+ def newPhase(prev: Phase) = new TestPhase(prev)
+ class TestPhase(prev: Phase) extends StdPhase(prev) {
+ override def description = TestComponent.this.description
+ def apply(unit: CompilationUnit) {
+ if (settings.developer) inform(s"My phase name is $phaseName")
+ }
+ }
+ }
+}
diff --git a/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala b/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala
new file mode 100644
index 0000000000..5421922c9c
--- /dev/null
+++ b/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala
@@ -0,0 +1,39 @@
+
+import tools.nsc.plugins.PluginDescription
+import tools.partest.DirectTest
+
+import java.io.File
+
+// show that plugins are on isolated class loaders
+object Test extends DirectTest {
+ override def code = "class Code"
+
+ override def extraSettings = s"-usejavacp"
+
+ // plugin named ploogin1_1 or ploogin1_2, but not ploogin2_x
+ // Although the samples are in different classloaders, the plugin
+ // loader checks for distinctness by class name, so the names must differ.
+ def pluginCode(index: Int) = s"""
+ |package t4841 {
+ | class SamplePloogin$index(global: scala.tools.nsc.Global) extends Ploogin(global, s"$${PlooginCounter.named}_$index")
+ | object PlooginCounter {
+ | val count = new java.util.concurrent.atomic.AtomicInteger
+ | def named = s"ploogin$${count.incrementAndGet}"
+ | }
+ |}""".stripMargin.trim
+
+ def compilePlugin(i: Int) = {
+ val out = (testOutput / s"p$i").createDirectory()
+ val args = Seq("-usejavacp", "-d", out.path)
+ compileString(newCompiler(args: _*))(pluginCode(i))
+ val xml = PluginDescription(s"p$i", s"t4841.SamplePloogin$i").toXML
+ (out / "scalac-plugin.xml").toFile writeAll xml
+ out
+ }
+
+ override def show() = {
+ val dirs = 1 to 2 map (compilePlugin(_))
+ compile("-Xdev", s"-Xplugin:${dirs mkString ","}", "-usejavacp", "-d", testOutput.path)
+ }
+}
+
diff --git a/test/files/run/t4841-no-plugin.check b/test/files/run/t4841-no-plugin.check
new file mode 100644
index 0000000000..4338f0ce23
--- /dev/null
+++ b/test/files/run/t4841-no-plugin.check
@@ -0,0 +1 @@
+warning: No plugin in path t4841-no-plugin-run.obj/plugins.partest
diff --git a/test/files/run/t4841-no-plugin.scala b/test/files/run/t4841-no-plugin.scala
new file mode 100644
index 0000000000..d91bf7ee21
--- /dev/null
+++ b/test/files/run/t4841-no-plugin.scala
@@ -0,0 +1,17 @@
+
+import tools.partest.DirectTest
+
+import java.io.File
+
+// warn only if no plugin on Xplugin path
+object Test extends DirectTest {
+ override def code = "class Code"
+
+ override def extraSettings = s"-usejavacp -d ${testOutput.path}"
+
+ override def show() = {
+ val tmp = new File(testOutput.jfile, "plugins.partest").getAbsolutePath
+ compile("-Xdev", s"-Xplugin:$tmp", "-Xpluginsdir", tmp)
+ }
+}
+
diff --git a/test/files/run/t4859.check b/test/files/run/t4859.check
new file mode 100644
index 0000000000..d329744ca0
--- /dev/null
+++ b/test/files/run/t4859.check
@@ -0,0 +1,8 @@
+Inner
+Inner.i
+About to reference Inner.i
+Outer
+Inner.i
+About to reference O.N
+About to reference O.N
+About to reference O.N.apply()
diff --git a/test/files/run/t4859.scala b/test/files/run/t4859.scala
new file mode 100644
index 0000000000..3c20cea983
--- /dev/null
+++ b/test/files/run/t4859.scala
@@ -0,0 +1,29 @@
+object O {
+ case class N()
+ object P
+}
+
+object Outer {
+ println("Outer")
+ object Inner {
+ println("Inner")
+ def i {
+ println("Inner.i")
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ Outer.Inner.i // we still don't initialize Outer here (but should we?)
+
+ {println("About to reference Inner.i"); Outer}.Inner.i // Outer will be initialized.
+
+ {println("About to reference O.N" ); O}.N
+
+ {println("About to reference O.N" ); O}.N
+
+ {println("About to reference O.N.apply()"); O}.N.apply()
+ }
+}
+
diff --git a/test/files/run/t4871.scala b/test/files/run/t4871.scala
index 70d8b7145c..e25d5c1387 100644
--- a/test/files/run/t4871.scala
+++ b/test/files/run/t4871.scala
@@ -5,7 +5,7 @@ object Test {
def main(args: Array[String]): Unit = {
val z: Class[C] = classOf
val z2: Class[D] = classOf[D]
-
+
println(z)
println(z2)
}
diff --git a/test/files/run/t4894.scala b/test/files/run/t4894.scala
index aa3b4340af..2b70da141d 100644
--- a/test/files/run/t4894.scala
+++ b/test/files/run/t4894.scala
@@ -4,24 +4,24 @@
object Test {
-
+
def main(args: Array[String]) {
import collection._
val hs = mutable.HashSet[Int]()
hs ++= 1 to 10
hs --= 1 to 10
-
+
val phs = parallel.mutable.ParHashSet[Int]()
phs ++= 1 to 10
for (i <- 1 to 10) assert(phs(i))
phs --= 1 to 10
assert(phs.isEmpty)
-
+
val phm = parallel.mutable.ParHashMap[Int, Int]()
phm ++= ((1 to 10) zip (1 to 10))
for (i <- 1 to 10) assert(phm(i) == i)
phm --= 1 to 10
assert(phm.isEmpty)
}
-
+
}
diff --git a/test/files/run/t4895.scala b/test/files/run/t4895.scala
index a0e8c19f00..3842f8a389 100644
--- a/test/files/run/t4895.scala
+++ b/test/files/run/t4895.scala
@@ -1,16 +1,16 @@
object Test {
-
+
def checkPar(sz: Int) {
import collection._
val hs = mutable.HashSet[Int]() ++ (1 to sz)
assert(hs.par.map(_ + 1).seq.toSeq.sorted == (2 to (sz + 1)))
}
-
+
def main(args: Array[String]) {
for (i <- 0 until 100) checkPar(i)
for (i <- 100 until 1000 by 50) checkPar(i)
for (i <- 1000 until 10000 by 500) checkPar(i)
for (i <- 10000 until 100000 by 5000) checkPar(i)
}
-
+
}
diff --git a/test/files/run/t4929.check b/test/files/run/t4929.check
deleted file mode 100644
index 0f0c913d55..0000000000
--- a/test/files/run/t4929.check
+++ /dev/null
@@ -1 +0,0 @@
-success \ No newline at end of file
diff --git a/test/files/run/t4929.scala b/test/files/run/t4929.scala
deleted file mode 100644
index 3208cd1b09..0000000000
--- a/test/files/run/t4929.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-import scala.util.parsing.json._
-import java.util.concurrent._
-import collection.JavaConversions._
-
-object Test extends App {
-
- val LIMIT = 2000
- val THREAD_COUNT = 20
- val count = new java.util.concurrent.atomic.AtomicInteger(0)
-
- val begin = new CountDownLatch(THREAD_COUNT)
- val finish = new CountDownLatch(THREAD_COUNT)
-
- val errors = new ConcurrentLinkedQueue[Throwable]
-
- (1 to THREAD_COUNT) foreach { i =>
- val thread = new Thread {
- override def run() {
- begin.await(1, TimeUnit.SECONDS)
- try {
- while (count.getAndIncrement() < LIMIT && errors.isEmpty) {
- JSON.parseFull("""{"foo": [1,2,3,4]}""")
- }
- } catch {
- case t: Throwable => errors.add(t)
- }
-
- finish.await(10, TimeUnit.SECONDS)
- }
- }
-
- thread.setDaemon(true)
- thread.start()
-
- }
-
-
- errors foreach { throw(_) }
-
- println("success")
-
-}
diff --git a/test/files/run/t4935.flags b/test/files/run/t4935.flags
index ac14fe5dbd..49d036a887 100644
--- a/test/files/run/t4935.flags
+++ b/test/files/run/t4935.flags
@@ -1 +1 @@
--optimize
+-optimize
diff --git a/test/files/run/t4954.scala b/test/files/run/t4954.scala
index b4916e651d..f0bb1cc02d 100644
--- a/test/files/run/t4954.scala
+++ b/test/files/run/t4954.scala
@@ -4,7 +4,7 @@ import collection._
object Test {
-
+
def main(args: Array[String]) {
val m = scala.collection.mutable.LinkedHashMap("one" -> 1, "two" -> 2, "three" -> 3, "four" -> 4, "five" -> 5)
val expected = List("one", "two", "three", "four", "five")
@@ -15,7 +15,7 @@ object Test {
assert(m.keys.drop(3).iterator.toList == expected.drop(3))
assert(m.keys.drop(4).iterator.toList == expected.drop(4))
assert(m.keys.drop(5).iterator.toList == expected.drop(5))
-
+
val expvals = List(1, 2, 3, 4, 5)
assert(m.values.iterator.toList == expvals)
assert(m.values.drop(0).iterator.toList == expvals)
@@ -24,7 +24,7 @@ object Test {
assert(m.values.drop(3).iterator.toList == expvals.drop(3))
assert(m.values.drop(4).iterator.toList == expvals.drop(4))
assert(m.values.drop(5).iterator.toList == expvals.drop(5))
-
+
val pred = (x: String) => x.length < 6
val filtered = m.filterKeys(pred)
assert(filtered.drop(0).keys.toList == expected.filter(pred))
@@ -32,7 +32,7 @@ object Test {
assert(filtered.drop(2).keys.toList == expected.filter(pred).drop(2))
assert(filtered.drop(3).keys.toList == expected.filter(pred).drop(3))
assert(filtered.drop(4).keys.toList == expected.filter(pred).drop(4))
-
+
val mapped = m.mapValues(-_)
assert(mapped.drop(0).keys.toList == expected)
assert(mapped.drop(1).keys.toList == expected.drop(1))
@@ -41,5 +41,5 @@ object Test {
assert(mapped.drop(4).keys.toList == expected.drop(4))
assert(mapped.drop(5).keys.toList == expected.drop(5))
}
-
+
}
diff --git a/test/files/run/t498.scala b/test/files/run/t498.scala
index b4ede951f0..5c10e6630f 100644
--- a/test/files/run/t498.scala
+++ b/test/files/run/t498.scala
@@ -1,3 +1,6 @@
+
+import scala.language.postfixOps
+
object Test extends App {
// the function passed to flatMap produces lots of empty streams, but this should not overflow the stack
val res = Stream.from(1).flatMap(i => if (i < 3000) Stream.empty else List(1))
diff --git a/test/files/run/t4996.check b/test/files/run/t4996.check
new file mode 100644
index 0000000000..8d45b413c9
--- /dev/null
+++ b/test/files/run/t4996.check
@@ -0,0 +1,4 @@
+B.foo
+M.foo
+B.foo
+M.foo \ No newline at end of file
diff --git a/test/files/run/t4996.scala b/test/files/run/t4996.scala
new file mode 100644
index 0000000000..8a38e7fe7f
--- /dev/null
+++ b/test/files/run/t4996.scala
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+trait A[@specialized(Int) T] {
+ def foo(t: T)
+}
+
+
+trait B extends A[Int] {
+ def foo(t: Int) {
+ println("B.foo")
+ }
+}
+
+
+trait M extends B {
+ abstract override def foo(t: Int) {
+ super.foo(t)
+ println("M.foo")
+ }
+}
+
+
+object C extends B with M
+
+
+object D extends B {
+ override def foo(t: Int) {
+ super.foo(t)
+ println("M.foo")
+ }
+}
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ D.foo(42) // OK, prints B.foo M.foo
+ C.foo(42) // was StackOverflowError
+ }
+
+}
+
+
diff --git a/test/files/run/t5018.scala b/test/files/run/t5018.scala
index bb67a252e5..70bd6c52ea 100644
--- a/test/files/run/t5018.scala
+++ b/test/files/run/t5018.scala
@@ -7,7 +7,7 @@ import collection._
object Test {
-
+
def serializeDeserialize[T <: AnyRef](obj: T) = {
val buffer = new ByteArrayOutputStream
val out = new ObjectOutputStream(buffer)
@@ -15,23 +15,23 @@ object Test {
val in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray))
in.readObject.asInstanceOf[T]
}
-
+
def main(args: Array[String]) {
val values = mutable.Map(1 -> 1).values
assert(serializeDeserialize(values).toList == values.toList)
-
+
val keyset = mutable.Map(1 -> 1).keySet
assert(serializeDeserialize(keyset) == keyset)
-
+
val imkeyset = immutable.Map(1 -> 1).keySet
assert(serializeDeserialize(imkeyset) == imkeyset)
-
+
val defaultmap = immutable.Map(1 -> 1).withDefaultValue(1)
assert(serializeDeserialize(defaultmap) == defaultmap)
-
+
val minusmap = mutable.Map(1 -> 1).withDefault(x => -x)
assert(serializeDeserialize(minusmap) == minusmap)
}
-
+
}
diff --git a/test/files/run/si5045.check b/test/files/run/t5045.check
index 7e9c1961b7..7e9c1961b7 100644
--- a/test/files/run/si5045.check
+++ b/test/files/run/t5045.check
diff --git a/test/files/run/si5045.scala b/test/files/run/t5045.scala
index e198b101f3..b0c3a4ddc4 100644
--- a/test/files/run/si5045.scala
+++ b/test/files/run/t5045.scala
@@ -1,3 +1,6 @@
+
+import scala.language.postfixOps
+
object Test extends App {
import scala.util.matching.{ Regex, UnanchoredRegex }
diff --git a/test/files/run/t5052.scala b/test/files/run/t5052.scala
deleted file mode 100644
index 9e418e8ac5..0000000000
--- a/test/files/run/t5052.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test extends App {
- assert(<elem attr={null:String} /> xml_== <elem />)
- assert(<elem attr={None} /> xml_== <elem />)
- assert(<elem /> xml_== <elem attr={null:String} />)
- assert(<elem /> xml_== <elem attr={None} />)
-}
diff --git a/test/files/run/t5053.scala b/test/files/run/t5053.scala
index e46dad5ac6..50057ce66c 100644
--- a/test/files/run/t5053.scala
+++ b/test/files/run/t5053.scala
@@ -1,20 +1,23 @@
+
+import scala.language.{ existentials }
+
object Test extends App {
{
val (left, right) = Seq((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip
println(left.isInstanceOf[scala.collection.SeqViewLike[_,_,_]])
val (l, m, r) = Seq((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3
- println(l.isInstanceOf[scala.collection.SeqViewLike[_,_,_]])
+ println(l.isInstanceOf[scala.collection.SeqViewLike[_,_,_]])
}
{
val (left, right) = Iterable((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip
println(left.isInstanceOf[scala.collection.IterableViewLike[_,_,_]])
val (l, m, r) = Iterable((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3
- println(l.isInstanceOf[scala.collection.IterableViewLike[_,_,_]])
+ println(l.isInstanceOf[scala.collection.IterableViewLike[_,_,_]])
}
{
val (left, right) = Traversable((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip
println(left.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]])
val (l, m, r) = Traversable((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3
- println(l.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]])
+ println(l.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]])
}
}
diff --git a/test/files/run/t5064.check b/test/files/run/t5064.check
index 077006abd9..61ccfd16e7 100644
--- a/test/files/run/t5064.check
+++ b/test/files/run/t5064.check
@@ -1,6 +1,6 @@
-[12] T5064.super.<init>()
-[12] T5064.super.<init>
-[12] this
+[53] T5064.super.<init>()
+[53] T5064.super.<init>
+[53] this
[16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1}))
[16:20] immutable.this.List.apply
<16:20> immutable.this.List
diff --git a/test/files/run/t5072.check b/test/files/run/t5072.check
index 8fe75f55d6..ddd49c71cb 100644
--- a/test/files/run/t5072.check
+++ b/test/files/run/t5072.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> class C
defined class C
@@ -10,5 +8,3 @@ scala> Thread.currentThread.getContextClassLoader.loadClass(classOf[C].getName)
res0: Class[_] = class C
scala>
-
-scala>
diff --git a/test/files/run/t5080.scala b/test/files/run/t5080.scala
index ce72d13a54..acb6167f46 100644
--- a/test/files/run/t5080.scala
+++ b/test/files/run/t5080.scala
@@ -1,3 +1,7 @@
+
+import scala.language.implicitConversions
+import scala.language.reflectiveCalls
+
object Test extends App {
abstract class Value {
diff --git a/test/files/run/t5115.scala b/test/files/run/t5115.scala
deleted file mode 100644
index cf25214715..0000000000
--- a/test/files/run/t5115.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-import scala.collection.Iterable
-
-object Test extends App {
- def assertHonorsIterableContract(i: Iterable[_]) = assert(i.size == i.iterator.size)
-
- assertHonorsIterableContract(<a/>.attributes)
- assertHonorsIterableContract(<a x=""/>.attributes)
- assertHonorsIterableContract(<a y={None}/>.attributes)
- assertHonorsIterableContract(<a y={None} x=""/>.attributes)
- assertHonorsIterableContract(<a a="" y={None} />.attributes)
- assertHonorsIterableContract(<a y={null:String}/>.attributes)
- assertHonorsIterableContract(<a y={null:String} x=""/>.attributes)
- assertHonorsIterableContract(<a a="" y={null:String} />.attributes)
-}
diff --git a/test/files/run/t5125b.scala b/test/files/run/t5125b.scala
index 29c08fee4c..149c49e213 100644
--- a/test/files/run/t5125b.scala
+++ b/test/files/run/t5125b.scala
@@ -7,7 +7,7 @@ class C2 {
@scala.annotation.varargs
def f(values:String*) = println("Calling C2.f(): " + values)
def g(): String => Int = s => s.hashCode
-
+
class C3 {
@scala.annotation.varargs
def f(values:String*) = println("Calling C3.f(): " + values)
diff --git a/test/files/run/t5134.scala b/test/files/run/t5134.scala
new file mode 100644
index 0000000000..384442fda2
--- /dev/null
+++ b/test/files/run/t5134.scala
@@ -0,0 +1,8 @@
+import language._
+
+object Test extends App {
+ def b = new AnyRef {
+ def a= ()
+ }
+ b.a match { case _ => () }
+}
diff --git a/test/files/run/t5224.check b/test/files/run/t5224.check
index e15c1c90eb..b11480acdf 100644
--- a/test/files/run/t5224.check
+++ b/test/files/run/t5224.check
@@ -1,3 +1,8 @@
+t5224.scala:3: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class Foo(bar: String) extends annotation.ClassfileAnnotation
+ ^
{
@new Foo(bar = "qwe") class C extends AnyRef {
def <init>() = {
diff --git a/test/files/run/t5225_2.check b/test/files/run/t5225_2.check
index 5faa365bce..477ea4eb6d 100644
--- a/test/files/run/t5225_2.check
+++ b/test/files/run/t5225_2.check
@@ -1,4 +1,4 @@
{
- def foo(@new `package`.cloneable() x: Int) = "";
+ def foo(@new elidable(0) x: Int) = "";
()
}
diff --git a/test/files/run/t5225_2.scala b/test/files/run/t5225_2.scala
index d1b607499c..cf0f23a5c8 100644
--- a/test/files/run/t5225_2.scala
+++ b/test/files/run/t5225_2.scala
@@ -1,6 +1,6 @@
import scala.reflect.runtime.universe._
object Test extends App {
- val tree = reify{def foo(@cloneable x: Int) = ""}.tree
+ val tree = reify{def foo(@annotation.elidable(0) x: Int) = ""}.tree
println(tree.toString)
} \ No newline at end of file
diff --git a/test/files/run/t5229_1.check b/test/files/run/t5229_1.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5229_1.check
+++ /dev/null
diff --git a/test/files/run/t5256a.scala b/test/files/run/t5256a.scala
index 84ef97b0d2..c8cea53028 100644
--- a/test/files/run/t5256a.scala
+++ b/test/files/run/t5256a.scala
@@ -7,5 +7,5 @@ object Test extends App {
val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
- println(c.typeSignature)
+ println(c.info)
} \ No newline at end of file
diff --git a/test/files/run/t5256b.scala b/test/files/run/t5256b.scala
index 0ffab8a668..5cd172e032 100644
--- a/test/files/run/t5256b.scala
+++ b/test/files/run/t5256b.scala
@@ -6,5 +6,5 @@ object Test extends App {
val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
- println(c.typeSignature)
+ println(c.info)
} \ No newline at end of file
diff --git a/test/files/run/t5256c.scala b/test/files/run/t5256c.scala
index d56215f6eb..66ddd3df5c 100644
--- a/test/files/run/t5256c.scala
+++ b/test/files/run/t5256c.scala
@@ -7,6 +7,6 @@ object Test extends App {
val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
- println(c.typeSignature)
+ println(c.info)
}
} \ No newline at end of file
diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check
index b7617e80a2..d42d234386 100644
--- a/test/files/run/t5256d.check
+++ b/test/files/run/t5256d.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
@@ -21,12 +19,10 @@ class A
scala> println(c.fullName)
$line8.$read.$iw.$iw.$iw.$iw.A
-scala> println(c.typeSignature)
+scala> println(c.info)
scala.AnyRef {
def <init>(): A
def foo: scala.Nothing
}
scala>
-
-scala>
diff --git a/test/files/run/t5256d.scala b/test/files/run/t5256d.scala
index 24ac1eb316..5aa26071c0 100644
--- a/test/files/run/t5256d.scala
+++ b/test/files/run/t5256d.scala
@@ -8,6 +8,6 @@ class A { def foo = ??? }
val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
-println(c.typeSignature)
+println(c.info)
"""
} \ No newline at end of file
diff --git a/test/files/run/t5256e.scala b/test/files/run/t5256e.scala
index f83546f2c0..2f57ea68b9 100644
--- a/test/files/run/t5256e.scala
+++ b/test/files/run/t5256e.scala
@@ -6,5 +6,5 @@ object Test extends App {
val c = cm.classSymbol(classOf[C#A])
println(c)
println(c.fullName)
- println(c.typeSignature)
+ println(c.info)
} \ No newline at end of file
diff --git a/test/files/run/t5256f.scala b/test/files/run/t5256f.scala
index 80c7ad8018..1de2592416 100644
--- a/test/files/run/t5256f.scala
+++ b/test/files/run/t5256f.scala
@@ -7,7 +7,7 @@ object Test extends App {
val c1 = cm.classSymbol(classOf[A1])
println(c1)
println(c1.fullName)
- println(c1.typeSignature)
+ println(c1.info)
new Test
}
@@ -18,5 +18,5 @@ class Test {
val c2 = cm.classSymbol(classOf[A2])
println(c2)
println(c2.fullName)
- println(c2.typeSignature)
+ println(c2.info)
}
diff --git a/test/files/run/t5256g.check b/test/files/run/t5256g.check
index c9c8d6e63d..cef3a413c2 100644
--- a/test/files/run/t5256g.check
+++ b/test/files/run/t5256g.check
@@ -1,3 +1,5 @@
-anonymous class $anon$1
+$anon
Test.$anon$1
-A with B{def <init>(): A with B}
+A with B {
+ def <init>(): A with B
+}
diff --git a/test/files/run/t5256g.scala b/test/files/run/t5256g.scala
index 358c18601a..2d4c1b5068 100644
--- a/test/files/run/t5256g.scala
+++ b/test/files/run/t5256g.scala
@@ -9,5 +9,5 @@ object Test extends App {
val c = cm.classSymbol(mutant.getClass)
println(c)
println(c.fullName)
- println(c.typeSignature)
+ println(c.info)
}
diff --git a/test/files/run/t5256h.check b/test/files/run/t5256h.check
index 1b23a71a4c..dc3e919897 100644
--- a/test/files/run/t5256h.check
+++ b/test/files/run/t5256h.check
@@ -1,7 +1,7 @@
-anonymous class $anon$1
+$anon
Test.$anon$1
java.lang.Object {
final private val x: Int
def x(): Int
- def <init>(): java.lang.Object{def x(): Int}
+ def <init>(): $anon$1
}
diff --git a/test/files/run/t5256h.scala b/test/files/run/t5256h.scala
index fd4ffd9b12..435124a469 100644
--- a/test/files/run/t5256h.scala
+++ b/test/files/run/t5256h.scala
@@ -6,5 +6,6 @@ object Test extends App {
val c = cm.classSymbol(mutant.getClass)
println(c)
println(c.fullName)
- println(c.typeSignature)
+ // under -Xcheckinit there's an additional $init$ field
+ c.info.toString.lines.filter(_ != " private var bitmap$init$0: Boolean") foreach println
}
diff --git a/test/files/run/t5262.scala b/test/files/run/t5262.scala
index fc4e57aa96..67448442da 100644
--- a/test/files/run/t5262.scala
+++ b/test/files/run/t5262.scala
@@ -6,21 +6,21 @@
object Test {
-
+
def serializationDeserialization(obj : Any) {
val bos = new java.io.ByteArrayOutputStream()
val out = new java.io.ObjectOutputStream(bos)
out.writeObject(obj)
-
+
val arr = bos.toByteArray()
val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(arr))
val o = in.readObject()
println(o)
}
-
+
def main(args : Array[String]) {
serializationDeserialization(List(1,2,3,4))
serializationDeserialization(List(1,2,null,4))
}
-
+
}
diff --git a/test/files/run/t5271_4.check b/test/files/run/t5271_4.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5271_4.check
+++ /dev/null
diff --git a/test/files/run/t5272_1_oldpatmat.flags b/test/files/run/t5272_1_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5272_1_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5272_2_oldpatmat.flags b/test/files/run/t5272_2_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5272_2_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5273_1_oldpatmat.flags b/test/files/run/t5273_1_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5273_1_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5273_2a_oldpatmat.flags b/test/files/run/t5273_2a_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5273_2a_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5273_2b_oldpatmat.flags b/test/files/run/t5273_2b_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5273_2b_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5277_1.scala b/test/files/run/t5277_1.scala
index a2d546579d..65232967c2 100644
--- a/test/files/run/t5277_1.scala
+++ b/test/files/run/t5277_1.scala
@@ -1,6 +1,7 @@
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
+import scala.language.{ implicitConversions, postfixOps }
object Test extends App {
reify {
def fact(n: Int): BigInt =
@@ -12,4 +13,4 @@ object Test extends App {
println("10! = " + (10!))
}.eval
-} \ No newline at end of file
+}
diff --git a/test/files/run/t5284b.check b/test/files/run/t5284b.check
index 98d9bcb75a..71426ad0b7 100644
--- a/test/files/run/t5284b.check
+++ b/test/files/run/t5284b.check
@@ -1 +1,4 @@
+t5284b.scala:27: warning: type S is unused or used in non-specializable positions.
+ def bar[@specialized(Int) W <: T, @specialized(Int) S](w: W) = id(w)
+ ^
17
diff --git a/test/files/run/t5284b.scala b/test/files/run/t5284b.scala
index a9282a895f..0da7972490 100644
--- a/test/files/run/t5284b.scala
+++ b/test/files/run/t5284b.scala
@@ -23,6 +23,6 @@ object Foo {
class Foo[@specialized(Int) T] {
val id: T => T = x => x
-
+
def bar[@specialized(Int) W <: T, @specialized(Int) S](w: W) = id(w)
}
diff --git a/test/files/run/t5284c.check b/test/files/run/t5284c.check
index 00750edc07..cf578ad102 100644
--- a/test/files/run/t5284c.check
+++ b/test/files/run/t5284c.check
@@ -1 +1,4 @@
+t5284c.scala:29: warning: type W is unused or used in non-specializable positions.
+ def bar[@specialized(Int) W <: T](ws: List[W]) = len(ws)
+ ^
3
diff --git a/test/files/run/t5284c.scala b/test/files/run/t5284c.scala
index 383b84c2cc..dec743fb94 100644
--- a/test/files/run/t5284c.scala
+++ b/test/files/run/t5284c.scala
@@ -25,6 +25,6 @@ object Foo {
class Foo[@specialized(Int) T] {
val len: List[T] => Int = xs => xs.length
-
+
def bar[@specialized(Int) W <: T](ws: List[W]) = len(ws)
}
diff --git a/test/files/run/t5293-map.scala b/test/files/run/t5293-map.scala
new file mode 100644
index 0000000000..ad1bbcfe30
--- /dev/null
+++ b/test/files/run/t5293-map.scala
@@ -0,0 +1,88 @@
+
+
+
+import scala.collection.JavaConverters._
+
+
+
+object Test extends App {
+
+ def bench(label: String)(body: => Unit): Long = {
+ val start = System.nanoTime
+
+ 0.until(10).foreach(_ => body)
+
+ val end = System.nanoTime
+
+ //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0))
+
+ end - start
+ }
+
+ def benchJava(values: java.util.Map[Int, Int]) = {
+ bench("Java Map") {
+ val m = new java.util.HashMap[Int, Int]
+
+ m.putAll(values)
+ }
+ }
+
+ def benchScala(values: Iterable[(Int, Int)]) = {
+ bench("Scala Map") {
+ val m = new scala.collection.mutable.HashMap[Int, Int]
+
+ m ++= values
+ }
+ }
+
+ def benchScalaSorted(values: Iterable[(Int, Int)]) = {
+ bench("Scala Map sorted") {
+ val m = new scala.collection.mutable.HashMap[Int, Int]
+
+ m ++= values.toArray.sorted
+ }
+ }
+
+ def benchScalaPar(values: Iterable[(Int, Int)]) = {
+ bench("Scala ParMap") {
+ val m = new scala.collection.parallel.mutable.ParHashMap[Int, Int] map { x => x }
+
+ m ++= values
+ }
+ }
+
+ val total = 50000
+ val values = (0 until total) zip (0 until total)
+ val map = scala.collection.mutable.HashMap.empty[Int, Int]
+
+ map ++= values
+
+ // warmup
+ for (x <- 0 until 5) {
+ benchJava(map.asJava)
+ benchScala(map)
+ benchScalaPar(map)
+ benchJava(map.asJava)
+ benchScala(map)
+ benchScalaPar(map)
+ }
+
+ val javamap = benchJava(map.asJava)
+ val scalamap = benchScala(map)
+ val scalaparmap = benchScalaPar(map)
+
+ // println(javamap)
+ // println(scalamap)
+ // println(scalaparmap)
+
+ assert(scalamap < (javamap * 10), "scalamap: " + scalamap + " vs. javamap: " + javamap)
+ assert(scalaparmap < (javamap * 10), "scalaparmap: " + scalaparmap + " vs. javamap: " + javamap)
+}
+
+
+
+
+
+
+
+
diff --git a/test/files/run/t5293.scala b/test/files/run/t5293.scala
new file mode 100644
index 0000000000..c42c967b42
--- /dev/null
+++ b/test/files/run/t5293.scala
@@ -0,0 +1,83 @@
+
+
+
+import scala.collection.JavaConverters._
+
+
+
+object Test extends App {
+
+ def bench(label: String)(body: => Unit): Long = {
+ val start = System.nanoTime
+
+ 0.until(10).foreach(_ => body)
+
+ val end = System.nanoTime
+
+ //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0))
+
+ end - start
+ }
+
+ def benchJava(values: java.util.Collection[Int]) = {
+ bench("Java Set") {
+ val set = new java.util.HashSet[Int]
+
+ set.addAll(values)
+ }
+ }
+
+ def benchScala(values: Iterable[Int]) = {
+ bench("Scala Set") {
+ val set = new scala.collection.mutable.HashSet[Int]
+
+ set ++= values
+ }
+ }
+
+ def benchScalaSorted(values: Iterable[Int]) = {
+ bench("Scala Set sorted") {
+ val set = new scala.collection.mutable.HashSet[Int]
+
+ set ++= values.toArray.sorted
+ }
+ }
+
+ def benchScalaPar(values: Iterable[Int]) = {
+ bench("Scala ParSet") {
+ val set = new scala.collection.parallel.mutable.ParHashSet[Int] map { x => x }
+
+ set ++= values
+ }
+ }
+
+ val values = 0 until 50000
+ val set = scala.collection.mutable.HashSet.empty[Int]
+
+ set ++= values
+
+ // warmup
+ for (x <- 0 until 5) {
+ benchJava(set.asJava)
+ benchScala(set)
+ benchScalaPar(set)
+ benchJava(set.asJava)
+ benchScala(set)
+ benchScalaPar(set)
+ }
+
+ val javaset = benchJava(set.asJava)
+ val scalaset = benchScala(set)
+ val scalaparset = benchScalaPar(set)
+
+ assert(scalaset < (javaset * 8), "scalaset: " + scalaset + " vs. javaset: " + javaset)
+ assert(scalaparset < (javaset * 8), "scalaparset: " + scalaparset + " vs. javaset: " + javaset)
+}
+
+
+
+
+
+
+
+
diff --git a/test/files/run/t5300.scala b/test/files/run/t5300.scala
index 073b29604a..0f1c807177 100644
--- a/test/files/run/t5300.scala
+++ b/test/files/run/t5300.scala
@@ -1,6 +1,6 @@
object Test {
val pf: PartialFunction[Any, Unit] = { case _ => () }
-
+
def main(args: Array[String]): Unit = {
pf orElse pf
}
diff --git a/test/files/run/t5313.scala b/test/files/run/t5313.scala
index 7da8726a1f..0d7168fa89 100644
--- a/test/files/run/t5313.scala
+++ b/test/files/run/t5313.scala
@@ -1,13 +1,13 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
override def printIcodeAfterPhase = "dce"
- override def extraSettings: String = super.extraSettings + " -optimize"
+ override def extraSettings: String = super.extraSettings + " -optimize"
override def code =
"""class Foo {
- def randomBoolean = util.Random.nextInt % 2 == 0
+ def randomBoolean = scala.util.Random.nextInt % 2 == 0
def bar = {
var kept1 = new Object
val result = new java.lang.ref.WeakReference(kept1)
@@ -18,11 +18,11 @@ object Test extends IcodeTest {
val erased3 = erased2 // and this
var erased4 = erased2 // and this
val erased5 = erased4 // and this
- var kept2: Object = new Object // ultimately can't be eliminated
+ var kept2: Object = new Object // ultimately can't be eliminated
while(randomBoolean) {
val kept3 = kept2
kept2 = null // this can't, because it clobbers kept2, which is used
- erased4 = null // safe to eliminate
+ erased4 = null // safe to eliminate
println(kept3)
}
var kept4 = new Object // have to keep, it's used
@@ -48,7 +48,7 @@ object Test extends IcodeTest {
override def show() {
val storeLocal = "STORE_LOCAL"
- val lines1 = collectIcode("") filter (_ contains storeLocal) map (x => x.drop(x.indexOf(storeLocal)))
+ val lines1 = collectIcode() filter (_ contains storeLocal) map (x => x.drop(x.indexOf(storeLocal)))
println(lines1 mkString "\n")
}
}
diff --git a/test/files/run/t5356.scala b/test/files/run/t5356.scala
index ec17e036ad..dabb9ef855 100644
--- a/test/files/run/t5356.scala
+++ b/test/files/run/t5356.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ reflectiveCalls }
object Test {
def f(x: Any { def toInt: Int }) = println(x.toInt + " " + x.getClass.getName)
diff --git a/test/files/run/t5375.check b/test/files/run/t5375.check
index 7d3002ffda..b1a57eeeec 100644
--- a/test/files/run/t5375.check
+++ b/test/files/run/t5375.check
@@ -1 +1 @@
-Composite throwable \ No newline at end of file
+Runtime exception
diff --git a/test/files/run/t5375.scala b/test/files/run/t5375.scala
index e4b329deae..826ecd841e 100644
--- a/test/files/run/t5375.scala
+++ b/test/files/run/t5375.scala
@@ -1,19 +1,8 @@
-
-
-
-import collection.parallel.CompositeThrowable
-
-
-
-object Test {
-
- def main(args: Array[String]) {
- val foos = (1 to 1000) toSeq;
- try {
- foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i)
- } catch {
- case CompositeThrowable(thr) => println("Composite throwable")
- }
+object Test extends App {
+ val foos = (1 to 1000).toSeq
+ try
+ foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i)
+ catch {
+ case ex: RuntimeException => println("Runtime exception")
}
-
}
diff --git a/test/files/run/t5380.check b/test/files/run/t5380.check
new file mode 100644
index 0000000000..731a798301
--- /dev/null
+++ b/test/files/run/t5380.check
@@ -0,0 +1,9 @@
+t5380.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ val f = () => return try { 1 } catch { case _: Throwable => 0 }
+ ^
+t5380.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ val f = () => return try { 1 } catch { case _: Throwable => 0 }
+ ^
+t5380.scala:3: warning: enclosing method main has result type Unit: return value discarded
+ val f = () => return try { 1 } catch { case _: Throwable => 0 }
+ ^
diff --git a/test/files/run/t5380.scala b/test/files/run/t5380.scala
index 6083161a9b..66d12a0ca6 100644
--- a/test/files/run/t5380.scala
+++ b/test/files/run/t5380.scala
@@ -1,6 +1,6 @@
object Test {
def main(args: Array[String]) {
- val f = () => return try { 1 } catch { case _ => 0 }
+ val f = () => return try { 1 } catch { case _: Throwable => 0 }
f()
}
}
diff --git a/test/files/run/t5415.check b/test/files/run/t5415.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5415.check
+++ /dev/null
diff --git a/test/files/run/t5415.scala b/test/files/run/t5415.scala
index c12e209bb7..65de86245b 100644
--- a/test/files/run/t5415.scala
+++ b/test/files/run/t5415.scala
@@ -8,5 +8,5 @@ object Test extends App{
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(code.tree)
+ val ttree = toolbox.typecheck(code.tree)
}
diff --git a/test/files/run/t5418.scala b/test/files/run/t5418.scala
new file mode 100644
index 0000000000..e3cb20cf82
--- /dev/null
+++ b/test/files/run/t5418.scala
@@ -0,0 +1,8 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ reify {
+ new Object().getClass
+ }.eval
+} \ No newline at end of file
diff --git a/test/files/run/t5418b.check b/test/files/run/t5418b.check
index 48d82a2aae..f036a4be84 100644
--- a/test/files/run/t5418b.check
+++ b/test/files/run/t5418b.check
@@ -1,2 +1,2 @@
new Object().getClass()
-TypeRef(ThisType(java.lang), java.lang.Class, List(TypeRef(NoPrefix, newTypeName("?0"), List())))
+TypeRef(ThisType(java.lang), java.lang.Class, List(TypeRef(NoPrefix, TypeName("?0"), List())))
diff --git a/test/files/run/t5418b.scala b/test/files/run/t5418b.scala
index 08e8bb163b..c6172613d5 100644
--- a/test/files/run/t5418b.scala
+++ b/test/files/run/t5418b.scala
@@ -5,7 +5,7 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val tb = cm.mkToolBox()
val untyped = reify(new Object().getClass).tree
- val typed = tb.typeCheck(untyped)
+ val typed = tb.typecheck(untyped)
println(typed)
println(showRaw(typed.tpe))
} \ No newline at end of file
diff --git a/test/files/run/t5428.check b/test/files/run/t5428.check
index 7b4b1d6558..a46514ae7c 100644
--- a/test/files/run/t5428.check
+++ b/test/files/run/t5428.check
@@ -1 +1,2 @@
-Stack(8, 7, 6, 5, 4, 3) \ No newline at end of file
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+Stack(8, 7, 6, 5, 4, 3)
diff --git a/test/files/run/t5428.scala b/test/files/run/t5428.scala
index 106bb7fc31..44003e06ba 100644
--- a/test/files/run/t5428.scala
+++ b/test/files/run/t5428.scala
@@ -11,19 +11,19 @@ class A extends StackProxy[Int] {
object Test {
-
+
def main(args: Array[String]) {
val a = new A
-
+
a push 3
a push 4
a push 5
-
+
a.push(6, 7, 8)
-
+
println(a)
-
- a pop
+
+ a.pop
}
-
+
}
diff --git a/test/files/run/t5488-fn.scala b/test/files/run/t5488-fn.scala
index d17bcf90a5..e6efe176c7 100644
--- a/test/files/run/t5488-fn.scala
+++ b/test/files/run/t5488-fn.scala
@@ -4,7 +4,7 @@ class C[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized(I
object Test {
def main(args:Array[String]) {
def show(x: Any) = println(x.getClass.getName)
-
+
show(new B((x: Int) => 1))
show(new B((x: Int) => "abc"))
show(new B((x: Int) => ()))
diff --git a/test/files/run/t5488.scala b/test/files/run/t5488.scala
index 7bab0cdc3c..f93cf29060 100644
--- a/test/files/run/t5488.scala
+++ b/test/files/run/t5488.scala
@@ -5,15 +5,15 @@ class C0[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized(
object Test {
def main(args:Array[String]) {
def show(x: Any) = println(x.getClass.getName)
-
+
show(new A0[Int]())
show(new A0[AnyRef]())
-
+
show(new B0[Int, Int]())
show(new B0[Int, AnyRef]())
show(new B0[AnyRef, Int]())
show(new B0[AnyRef, AnyRef]())
-
+
show(new C0[Int, Int, Int]())
show(new C0[Int, Int, AnyRef]())
show(new C0[Int, AnyRef, Int]())
diff --git a/test/files/run/t5500b.scala b/test/files/run/t5500b.scala
index 32de858e7b..9a49624fde 100644
--- a/test/files/run/t5500b.scala
+++ b/test/files/run/t5500b.scala
@@ -26,7 +26,7 @@ object Test {
println(new C1A[Double, Int].getClass.getName)
println(new C1A[Double, Double].getClass.getName)
println(new C1A[Double, String].getClass.getName)
-
+
println(new C1B[String, Int]("abc").getClass.getName)
println(new C1B[String, Double]("abc").getClass.getName)
println(new C1B[String, String]("abc").getClass.getName)
@@ -36,7 +36,7 @@ object Test {
println(new C1B[Double, Int](1d).getClass.getName)
println(new C1B[Double, Double](1d).getClass.getName)
println(new C1B[Double, String](1d).getClass.getName)
-
+
println(new C1C("abc", 123).getClass.getName)
println(new C1C("abc", 123).getClass.getName)
println(new C1C("a", 1d).getClass.getName)
diff --git a/test/files/run/t5514.check b/test/files/run/t5514.check
deleted file mode 100644
index c68f7c9029..0000000000
--- a/test/files/run/t5514.check
+++ /dev/null
@@ -1,19 +0,0 @@
-constructed reader: 10
-constructed reader: 9
-constructed reader: 8
-constructed reader: 7
-constructed reader: 6
-constructed reader: 5
-constructed reader: 4
-constructed reader: 3
-constructed reader: 2
-constructed reader: 1
-constructed reader: 0
-[0.0] parsed: List(s10, s9, s8, s7, s6, s5, s4, s3, s2, s1)
-constructed reader: 10
-constructed reader: 9
-constructed reader: 8
-constructed reader: 7
-constructed reader: 6
-constructed reader: 5
-[0.0] parsed: List(s10, s9, s8, s7, s6) \ No newline at end of file
diff --git a/test/files/run/t5514.scala b/test/files/run/t5514.scala
deleted file mode 100644
index efd5ba6cb9..0000000000
--- a/test/files/run/t5514.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-import scala.io.Source
-import scala.util.parsing.combinator.Parsers
-import scala.util.parsing.input.Reader
-import scala.util.parsing.input.Position
-
-
-
-class DemoReader(n: Int) extends Reader[String] {
- def atEnd = n == 0
- def first = if (n >= 0) "s" + n else throw new IllegalArgumentException("No more input.")
- def rest = new DemoReader(n - 1)
- def pos = new Position {
- def line = 0
- def column = 0
- def lineContents = first
- }
- println("constructed reader: " + n)
-}
-
-
-object Test extends App with Parsers {
- type Elem = String
- def startsWith(prefix: String) = acceptIf(_ startsWith prefix)("Error: " + _)
-
- val resrep = startsWith("s").*(new DemoReader(10))
- Console println resrep
-
- val resrep5 = repN(5, startsWith("s"))(new DemoReader(10))
- Console println resrep5
-}
-
-
diff --git a/test/files/run/t5527.check b/test/files/run/t5527.check
deleted file mode 100644
index 36bee9bb55..0000000000
--- a/test/files/run/t5527.check
+++ /dev/null
@@ -1,99 +0,0 @@
-[[syntax trees at end of parser]] // newSource1.scala
-package <empty> {
- object UselessComments extends scala.AnyRef {
- def <init>() = {
- super.<init>();
- ()
- };
- var z = 0;
- def test1 = {
- object Maybe extends scala.AnyRef {
- def <init>() = {
- super.<init>();
- ()
- };
- /** Some comment inside */
- def nothing() = ()
- };
- ()
- };
- def test2 = {
- var x = 4;
- if (true)
- {
- x = 5;
- val y = 6;
- ()
- }
- else
- ()
- };
- def test3 = {
- if (true)
- z = 3
- else
- ();
- val t = 4;
- 0.to(4).foreach(((i) => println(i)))
- };
- val test4 = 'a' match {
- case ('0'| '1'| '2'| '3'| '4'| '5'| '6'| '7'| '8'| '9') => true
- case _ => false
- }
- };
- /** comments that we should keep */
- object UsefulComments extends scala.AnyRef {
- def <init>() = {
- super.<init>();
- ()
- };
- /** class A */
- class A extends scala.AnyRef {
- def <init>() = {
- super.<init>();
- ()
- };
- /** f */
- def f(i: Int) = i;
- /** v */
- val v = 1;
- /** u */
- var u = 2
- };
- /** trait B */
- abstract trait B extends scala.AnyRef {
- def $init$() = {
- ()
- };
- /** T */
- type T >: _root_.scala.Nothing <: _root_.scala.Any;
- /** f */
- def f(i: Int): scala.Unit;
- /** v */
- val v = 1;
- /** u */
- var u = 2
- };
- /** object C */
- object C extends scala.AnyRef {
- def <init>() = {
- super.<init>();
- ()
- };
- /** f */
- def f(i: Int) = i;
- /** v */
- val v = 1;
- /** u */
- var u = 2
- };
- /** class D */
- @new deprecated("use ... instead", "2.10.0") class D extends scala.AnyRef {
- def <init>() = {
- super.<init>();
- ()
- }
- }
- }
-}
-
diff --git a/test/files/run/t5527.scala b/test/files/run/t5527.scala
deleted file mode 100644
index 2449ff60c3..0000000000
--- a/test/files/run/t5527.scala
+++ /dev/null
@@ -1,107 +0,0 @@
-import scala.tools.partest._
-import java.io._
-import scala.tools.nsc._
-import scala.tools.nsc.util.CommandLineParser
-import scala.tools.nsc.doc.{Settings, DocFactory}
-import scala.tools.nsc.reporters.ConsoleReporter
-
-object Test extends DirectTest {
-
- override def extraSettings: String = "-usejavacp -Xprint:parser -Yrangepos -Ystop-after:parser -d " + testOutput.path
-
- override def code = """
- // SI-5527
- object UselessComments {
-
- var z = 0
-
- def test1 = {
- /** Some comment here */
- object Maybe {
- /** Some comment inside */
- def nothing() = ()
- }
- }
-
- def test2 = {
- var x = 4
- if (true) {
- /** Testing 123 */
- x = 5
- val y = 6
- }
- }
-
- def test3 = {
- if (true)
- z = 3
-
- /** Calculate this result. */
- val t = 4
- for (i <- 0 to 4)
- println(i)
- }
-
- val test4 = ('a') match {
- /** Another digit is a giveaway. */
- case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' =>
- true
- case _ =>
- false
- }
- }
-
- /** comments that we should keep */
- object UsefulComments {
- /** class A */
- class A {
- /** f */
- def f(i: Int) = i
- /** v */
- val v = 1
- /** u */
- var u = 2
- }
- /** trait B */
- trait B {
- /** T */
- type T
- /** f */
- def f(i: Int)
- /** v */
- val v = 1
- /** u */
- var u = 2
- }
- /** object C */
- object C {
- /** f */
- def f(i: Int) = i
- /** v */
- val v = 1
- /** u */
- var u = 2
- }
- /** class D */
- @deprecated("use ... instead", "2.10.0")
- class D
- }
- """.trim
-
- override def show(): Unit = {
- // redirect err to out, for logging
- val prevErr = System.err
- System.setErr(System.out)
- compile()
- System.setErr(prevErr)
- }
-
- override def newCompiler(args: String*): Global = {
- // we want the Scaladoc compiler here, because it keeps DocDef nodes in the tree
- val settings = new Settings(_ => ())
- val command = new ScalaDoc.Command((CommandLineParser tokenize extraSettings) ++ args.toList, settings)
- new DocFactory(new ConsoleReporter(settings), settings).compiler
- }
-
- override def isDebug = false // so we don't get the newSettings warning
-}
diff --git a/test/files/run/t5535.check b/test/files/run/t5535.check
index 8da9829b78..a0c87a47f4 100644
--- a/test/files/run/t5535.check
+++ b/test/files/run/t5535.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> def h()(i: Int) = 1 + i
h: ()(i: Int)Int
@@ -16,5 +14,3 @@ scala> println(f(10))
11
scala>
-
-scala>
diff --git a/test/files/run/t5537.check b/test/files/run/t5537.check
index 68c3ebf2e2..b9d521f301 100644
--- a/test/files/run/t5537.check
+++ b/test/files/run/t5537.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> List[Predef.type]()
res0: List[scala.Predef.type] = List()
@@ -16,5 +14,3 @@ scala> List[Set.type]()
res3: List[Set.type] = List()
scala>
-
-scala>
diff --git a/test/files/run/t5545.check b/test/files/run/t5545.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5545.check
+++ /dev/null
diff --git a/test/files/run/t5565.scala b/test/files/run/t5565.scala
new file mode 100644
index 0000000000..9ced87ca21
--- /dev/null
+++ b/test/files/run/t5565.scala
@@ -0,0 +1,12 @@
+import scala.language.reflectiveCalls
+import scala.language.implicitConversions
+
+object Test extends App {
+ implicit def doubleWithApproxEquals(d: Double) = new {
+ def ~==(v: Double, margin: Double = 0.001): Boolean =
+ math.abs(d - v) < margin
+ }
+
+ assert(math.abs(-4.0) ~== (4.0, 0.001))
+ assert(math.abs(-4.0) ~== 4.0)
+}
diff --git a/test/files/run/t5568.flags b/test/files/run/t5568.flags
new file mode 100644
index 0000000000..ad51758c39
--- /dev/null
+++ b/test/files/run/t5568.flags
@@ -0,0 +1 @@
+-nowarn
diff --git a/test/files/run/t5577.scala b/test/files/run/t5577.scala
index b5d6d8c5b6..650b3c2c69 100644
--- a/test/files/run/t5577.scala
+++ b/test/files/run/t5577.scala
@@ -6,22 +6,22 @@ import collection._
object Test {
-
+
class AlarmingBuffer[T] extends mutable.ArrayBuffer[T] {
override def sizeHint(x: Int) {
println("Received a size hint: " + x)
super.sizeHint(x)
}
}
-
+
def main(args: Array[String]) {
val iteratorBuilder = (new AlarmingBuffer[Int]) mapResult {
res => res.iterator
}
-
+
iteratorBuilder.sizeHint(10)
iteratorBuilder ++= (0 until 10)
iteratorBuilder.result.foreach(println)
}
-
+
}
diff --git a/test/files/run/t5583.check b/test/files/run/t5583.check
index 39b969fbe7..af96405bdd 100644
--- a/test/files/run/t5583.check
+++ b/test/files/run/t5583.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> var s = 0
s: Int = 0
@@ -16,5 +14,3 @@ scala> println(s)
165
scala>
-
-scala>
diff --git a/test/files/run/t5590.scala b/test/files/run/t5590.scala
index 9c806e0b7d..baf0503a04 100644
--- a/test/files/run/t5590.scala
+++ b/test/files/run/t5590.scala
@@ -7,25 +7,25 @@ import collection._
object Test {
-
+
def check(obj: AnyRef) {
println(obj)
-
+
val bos = new ByteArrayOutputStream()
val out = new ObjectOutputStream(bos)
out.writeObject(obj)
val arr = bos.toByteArray()
val in = new ObjectInputStream(new ByteArrayInputStream(arr))
val deser = in.readObject()
-
+
println(deser)
}
-
+
def main(args: Array[String]) {
val lhm = mutable.LinkedHashMap("a" -> "a", "b" -> "b", "c" -> "c")
val lhs = mutable.LinkedHashSet("a", "b", "c", "d", "e")
check(lhm)
check(lhs)
}
-
+
}
diff --git a/test/files/run/t5603.check b/test/files/run/t5603.check
index 3f19a0a4b1..760a92567c 100644
--- a/test/files/run/t5603.check
+++ b/test/files/run/t5603.check
@@ -10,17 +10,17 @@
[87:209]class C extends [94:209][151:159]Greeting {
[119:139]val nameElse = _;
[95:101]<paramaccessor> private[this] val i: [98:101]Int = _;
- <119:139>def <init>([95]i: [98]Int) = <119:139>{
+ <95:139>def <init>(<95:101>i: [98]Int) = <95:139>{
<119:139>val nameElse = <134:139>"Bob";
- [94][94][94]super.<init>();
- [94]()
+ [NoPosition][NoPosition][NoPosition]super.<init>();
+ <95:139>()
};
[168:184]val name = [179:184]"avc";
[191:203][191:198]println([199:202]msg)
};
[215:241]object Test extends [227:241][235:238]App {
[227]def <init>() = [227]{
- [227][227][227]super.<init>();
+ [NoPosition][NoPosition][NoPosition]super.<init>();
[227]()
};
[NoPosition]<empty>
diff --git a/test/files/run/t5603.scala b/test/files/run/t5603.scala
index 60dfd01fee..77c2775cc3 100644
--- a/test/files/run/t5603.scala
+++ b/test/files/run/t5603.scala
@@ -1,7 +1,7 @@
import scala.tools.partest._
import java.io._
import scala.tools.nsc._
-import scala.tools.nsc.util.CommandLineParser
+import scala.tools.cmd.CommandLineParser
import scala.tools.nsc.{Global, Settings, CompilerCommand}
import scala.tools.nsc.reporters.ConsoleReporter
@@ -36,7 +36,8 @@ object Test extends DirectTest {
val settings = new Settings()
settings.Xprintpos.value = true
+ settings.Yrangepos.value = true
val command = new CompilerCommand((CommandLineParser tokenize extraSettings) ++ args.toList, settings)
- new Global(command.settings, new ConsoleReporter(settings)) with interactive.RangePositions
+ Global(command.settings, new ConsoleReporter(settings))
}
}
diff --git a/test/files/run/t5610.scala b/test/files/run/t5610.scala
index f62b2df6b4..82dabcc59f 100644
--- a/test/files/run/t5610.scala
+++ b/test/files/run/t5610.scala
@@ -20,7 +20,7 @@ object Test {
val f: (String, Int*) => Unit = m(2, 3)
f("", 5, 6)
}
-
+
def foo(s: => String)(dummy: Int) = () => println(s)
def m(a: Int*)(z: String, b: Int*) {
diff --git a/test/files/run/t5610a.check b/test/files/run/t5610a.check
new file mode 100644
index 0000000000..2aa46b3b91
--- /dev/null
+++ b/test/files/run/t5610a.check
@@ -0,0 +1 @@
+Stroke a kitten
diff --git a/test/files/run/t5610a.scala b/test/files/run/t5610a.scala
new file mode 100644
index 0000000000..f20b295762
--- /dev/null
+++ b/test/files/run/t5610a.scala
@@ -0,0 +1,19 @@
+object Test extends App {
+ class Result(_str: => String) {
+ lazy val str = _str
+ }
+
+ def foo(str: => String)(i: Int) = new Result(str)
+
+ def bar(f: Int => Result) = f(42)
+
+ var test: String = null
+ val result = bar(foo(test))
+ test = "bar"
+
+ if (result.str == null) {
+ println("Destroy ALL THE THINGS!!!")
+ } else {
+ println("Stroke a kitten")
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t5629.scala b/test/files/run/t5629.scala
index 69feddd3a5..5b91007f7e 100644
--- a/test/files/run/t5629.scala
+++ b/test/files/run/t5629.scala
@@ -27,10 +27,10 @@ class AnyChild extends Parent[Any] {
object Test {
-
+
def main(args: Array[String]) {
new IntChild().foo(33)
new AnyChild().foo(33)
}
-
+
}
diff --git a/test/files/run/t5629b.check b/test/files/run/t5629b.check
index 1bc0248c3d..e0f25f0b05 100644
--- a/test/files/run/t5629b.check
+++ b/test/files/run/t5629b.check
@@ -2,7 +2,7 @@
MySmartPF.apply entered...
newPF.applyOrElse entered...
default
-scala.MatchError: () (of class scala.runtime.BoxedUnit)
+scala.MatchError: 1 (of class java.lang.Integer)
=== pf(42):
MySmartPF.apply entered...
newPF.applyOrElse entered...
diff --git a/test/files/run/t5629b.scala b/test/files/run/t5629b.scala
index 6c908081b9..5d402201ae 100644
--- a/test/files/run/t5629b.scala
+++ b/test/files/run/t5629b.scala
@@ -1,10 +1,5 @@
-
-
-
-
-
object Test extends App {
-
+
trait MyPF[@specialized(Int) -A] extends (A => Unit) {
def isDefinedAt(x: A): Boolean
def applyOrElse[A1 <: A](x: A1, default: A1 => Unit): Unit = {
@@ -12,30 +7,30 @@ object Test extends App {
if (isDefinedAt(x)) apply(x) else default(x)
}
}
-
+
trait MySmartPF[@specialized(Int) -A] extends MyPF[A] {
def apply(x: A): Unit = {
println("MySmartPF.apply entered...")
- applyOrElse(x, { _: Any => throw new MatchError })
+ applyOrElse(x, { default: Any => throw new MatchError(default) })
}
}
-
+
type T = Int
//type T = Any
-
+
def newPF(test: T): MyPF[T] = new MySmartPF[T] {
def isDefinedAt(x: T): Boolean = x != test
override def applyOrElse[A1 <: T](x: A1, default: A1 => Unit): Unit = {
println("newPF.applyOrElse entered...")
- if (x != test) { println("ok"); () } else { println("default"); default(x) }
+ if (x != test) { println("ok"); () } else { println("default"); default(x) }
}
}
-
+
val pf = newPF(1)
println("=== pf(1):")
- try { pf(1) } catch { case x => println(x) }
+ try { pf(1) } catch { case x: Throwable => println(x) }
println("=== pf(42):")
pf(42)
println("=== done")
-
+
}
diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check
index 43ebd50e7a..06c6b32599 100644
--- a/test/files/run/t5655.check
+++ b/test/files/run/t5655.check
@@ -1,10 +1,8 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> object x { def x={} }
-defined module x
+defined object x
scala> import x._
import x._
@@ -26,5 +24,3 @@ and import x
^
scala>
-
-scala>
diff --git a/test/files/run/t5656.scala b/test/files/run/t5656.scala
index f5ea147a4e..5eb1df51af 100644
--- a/test/files/run/t5656.scala
+++ b/test/files/run/t5656.scala
@@ -3,9 +3,9 @@
object Test {
-
+
def main(args: Array[String]) {
println(Seq(List('1', '2', '3'), List('a', 'b', 'c')).view.addString(new StringBuilder, "_"))
}
-
+
}
diff --git a/test/files/run/t5676.scala b/test/files/run/t5676.scala
index b643c300ce..0c920e4a9d 100644
--- a/test/files/run/t5676.scala
+++ b/test/files/run/t5676.scala
@@ -13,12 +13,12 @@ class Baz[S] extends Foo[S] {
}
object Test {
-
+
def main(a: Array[String]) {
val b = new Baz[Any]
println(b.A.foo())
println(Modifier.isFinal(classOf[Baz[Any]].getModifiers()))
println(Modifier.isFinal(Test.getClass.getModifiers()))
}
-
+
}
diff --git a/test/files/run/t5699.scala b/test/files/run/t5699.scala
index 5cef67e3b1..ec3b1d26b4 100755
--- a/test/files/run/t5699.scala
+++ b/test/files/run/t5699.scala
@@ -1,5 +1,5 @@
import scala.tools.partest.DirectTest
-import scala.tools.nsc.util.BatchSourceFile
+import scala.reflect.internal.util.BatchSourceFile
object Test extends DirectTest {
// Java code
diff --git a/test/files/run/t5704.scala b/test/files/run/t5704.scala
index ddcbcc27b3..495a82e4f0 100644
--- a/test/files/run/t5704.scala
+++ b/test/files/run/t5704.scala
@@ -8,7 +8,7 @@ object Test extends App {
def findUserByName( name:String ) = {
val tree = reify{ "test" == name }.tree
val toolbox = cm.mkToolBox()
- toolbox.typeCheck(tree) match{
+ toolbox.typecheck(tree) match{
case Apply(Select(lhs,op),rhs::Nil) =>
println(rhs.tpe)
}
diff --git a/test/files/run/t5713/Impls_Macros_1.scala b/test/files/run/t5713/Impls_Macros_1.scala
index 12c3da2ff0..7b04197cfa 100644
--- a/test/files/run/t5713/Impls_Macros_1.scala
+++ b/test/files/run/t5713/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
package m
import language.experimental.macros
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Level extends Enumeration {
val Error = Value(5)
diff --git a/test/files/run/t5717.scala b/test/files/run/t5717.scala
new file mode 100755
index 0000000000..a0997f5a49
--- /dev/null
+++ b/test/files/run/t5717.scala
@@ -0,0 +1,21 @@
+import scala.tools.partest._
+import java.io.File
+
+object Test extends StoreReporterDirectTest {
+ def code = ???
+
+ def compileCode(code: String) = {
+ val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
+ compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code)
+ }
+ // TODO
+ // Don't assume output is on physical disk
+ // Let the compiler tell us output dir
+ // val sc = newCompiler("-cp", classpath, "-d", testOutput.path)
+ // val out = sc.settings.outputDirs.getSingleOutput.get
+ def show(): Unit = {
+ // Don't crash when we find a file 'a' where package 'a' should go.
+ scala.reflect.io.File(testOutput.path + "/a").writeAll("a")
+ compileCode("package a { class B }")
+ }
+}
diff --git a/test/files/run/t5753_1/Impls_Macros_1.scala b/test/files/run/t5753_1/Impls_Macros_1.scala
index 1664301f5f..ce07138852 100644
--- a/test/files/run/t5753_1/Impls_Macros_1.scala
+++ b/test/files/run/t5753_1/Impls_Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
trait Impls {
diff --git a/test/files/run/t5753_1/Test_2.scala b/test/files/run/t5753_1/Test_2.scala
index a2777638bc..864d356fdb 100644
--- a/test/files/run/t5753_1/Test_2.scala
+++ b/test/files/run/t5753_1/Test_2.scala
@@ -1,4 +1,4 @@
-object Test extends App {
+object Test extends App {
import Macros._
println(foo(42))
} \ No newline at end of file
diff --git a/test/files/run/t5753_2/Impls_Macros_1.scala b/test/files/run/t5753_2/Impls_Macros_1.scala
index e23c0b938b..d446d37bdf 100644
--- a/test/files/run/t5753_2/Impls_Macros_1.scala
+++ b/test/files/run/t5753_2/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
trait Macro_T {
- def foo[T](c: Ctx)(s: c.Expr[T]) = s
+ def foo[T](c: Context)(s: c.Expr[T]) = s
}
object Macros {
diff --git a/test/files/run/t5753_2/Test_2.scala b/test/files/run/t5753_2/Test_2.scala
index a2777638bc..864d356fdb 100644
--- a/test/files/run/t5753_2/Test_2.scala
+++ b/test/files/run/t5753_2/Test_2.scala
@@ -1,4 +1,4 @@
-object Test extends App {
+object Test extends App {
import Macros._
println(foo(42))
} \ No newline at end of file
diff --git a/test/files/run/t576.check b/test/files/run/t576.check
index 8a1218a102..6458d5d743 100644
--- a/test/files/run/t576.check
+++ b/test/files/run/t576.check
@@ -1,3 +1,4 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
1
2
3
diff --git a/test/files/run/t576.scala b/test/files/run/t576.scala
index 756a241572..5c8c9a90cb 100644
--- a/test/files/run/t576.scala
+++ b/test/files/run/t576.scala
@@ -1,3 +1,5 @@
+import scala.language.reflectiveCalls
+
class A {
override def equals(other: Any) = other match {
case _: this.type => true
diff --git a/test/files/run/t5789.check b/test/files/run/t5789.check
index ea8d4966b1..bcb2382559 100644
--- a/test/files/run/t5789.check
+++ b/test/files/run/t5789.check
@@ -1,14 +1,10 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
-scala> val n = 2
+scala> val n = 2
n: Int = 2
scala> () => n
res0: () => Int = <function0>
scala>
-
-scala>
diff --git a/test/files/run/t5804.scala b/test/files/run/t5804.scala
index b96a736035..b6a8940c1f 100644
--- a/test/files/run/t5804.scala
+++ b/test/files/run/t5804.scala
@@ -4,29 +4,29 @@ import collection.mutable._
object Test {
-
+
def main(args: Array[String]) {
class CustomHashMap extends HashMap[Int, Int] {
override def initialSize = 65
-
+
println(table.length)
}
-
+
new CustomHashMap
new HashMap {
println(table.length)
}
-
+
class CustomHashSet extends HashSet[Int] {
override def initialSize = 96
-
+
println(table.length)
}
-
+
new CustomHashSet
new HashSet {
println(table.length)
}
}
-
+
}
diff --git a/test/files/run/t5816.scala b/test/files/run/t5816.scala
index f0279e5703..e8367ea81e 100644
--- a/test/files/run/t5816.scala
+++ b/test/files/run/t5816.scala
@@ -6,7 +6,7 @@ object Test extends App {
val toolbox = cm.mkToolBox()
def printSource[T](expr: Expr[T]) {
- val ttree = toolbox typeCheck expr.tree
+ val ttree = toolbox typecheck expr.tree
println(ttree.toString)
}
diff --git a/test/files/run/t5843.check b/test/files/run/t5843.check
deleted file mode 100644
index 2bf97f4cdb..0000000000
--- a/test/files/run/t5843.check
+++ /dev/null
@@ -1,9 +0,0 @@
- foo="1"
- bar="2" foo="1"
-null
- bar="2"
- foo="1"
- bar="2"
- foo="1"
- bar="2" foo="1"
- bar="2" foo="1"
diff --git a/test/files/run/t5843.scala b/test/files/run/t5843.scala
deleted file mode 100644
index 43d588c7b7..0000000000
--- a/test/files/run/t5843.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-object Test extends App {
- val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null)
- val bar = scala.xml.Attribute(null, "bar", "2", foo)
- println(foo)
- println(bar)
- println(scala.xml.TopScope.getURI(foo.pre))
- println(bar remove "foo")
- println(bar remove "bar")
- println(bar remove (null, scala.xml.TopScope, "foo"))
- println(bar remove (null, scala.xml.TopScope, "bar"))
-
- val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope)
- println(bar remove (null, ns, "foo"))
- println(bar remove (null, ns, "bar"))
-}
diff --git a/test/files/run/t5857.scala b/test/files/run/t5857.scala
index bf67bedf54..c82fd88c08 100644
--- a/test/files/run/t5857.scala
+++ b/test/files/run/t5857.scala
@@ -2,44 +2,44 @@
object Test {
-
+
def time[U](b: =>U): Long = {
val start = System.currentTimeMillis
b
val end = System.currentTimeMillis
-
+
end - start
}
-
+
def main(args: Array[String]) {
val sz = 1000000000
-
+
val range = 1 to sz
check { assert(range.min == 1, range.min) }
check { assert(range.max == sz, range.max) }
-
+
val descending = sz to 1 by -1
check { assert(descending.min == 1) }
check { assert(descending.max == sz) }
-
+
val numeric = 1.0 to sz.toDouble by 1
check { assert(numeric.min == 1.0) }
check { assert(numeric.max == sz.toDouble) }
-
+
val numdesc = sz.toDouble to 1.0 by -1
check { assert(numdesc.min == 1.0) }
check { assert(numdesc.max == sz.toDouble) }
}
-
+
def check[U](b: =>U) {
val exectime = time {
b
}
-
+
// whatever it is, it should be less than, say, 250ms
// if `max` involves traversal, it takes over 5 seconds on a 3.2GHz i7 CPU
//println(exectime)
assert(exectime < 250, exectime)
}
-
+
}
diff --git a/test/files/run/t5867.scala b/test/files/run/t5867.scala
index 6a86ac3e6d..f7e9393b7a 100644
--- a/test/files/run/t5867.scala
+++ b/test/files/run/t5867.scala
@@ -3,12 +3,12 @@ import collection.mutable.UnrolledBuffer
object Test {
-
+
def main(args: Array[String]) {
val buf = UnrolledBuffer(1 to 50: _*)
val dub = buf ++ buf
-
+
println(dub)
}
-
+
}
diff --git a/test/files/run/t5879.check b/test/files/run/t5879.check
index b6cbda35a7..4bdf3f5fcf 100644
--- a/test/files/run/t5879.check
+++ b/test/files/run/t5879.check
@@ -1,16 +1,8 @@
Map(1 -> 1)
1
-Map(1 -> 1)
-1
-(1,1)
-Map(1 -> 1)
-1
(1,1)
Map(1 -> 1)
1
(1,2)
Map(1 -> 2)
2
-(1,2)
-Map(1 -> 2)
-2 \ No newline at end of file
diff --git a/test/files/run/t5879.scala b/test/files/run/t5879.scala
index e1c07fc4c2..83a583da54 100644
--- a/test/files/run/t5879.scala
+++ b/test/files/run/t5879.scala
@@ -2,27 +2,23 @@ import collection.immutable.HashMap
object Test {
-
+
def main(args: Array[String]) {
resolveDefault()
resolveFirst()
resolveSecond()
resolveMany()
}
-
+
def resolveDefault() {
val a = HashMap(1 -> "1")
val b = HashMap(1 -> "2")
-
+
val r = a.merged(b)(null)
println(r)
println(r(1))
-
- val rold = a.merge(b)
- println(rold)
- println(rold(1))
}
-
+
def resolveFirst() {
val a = HashMap(1 -> "1")
val b = HashMap(1 -> "2")
@@ -30,16 +26,12 @@ object Test {
println(a)
a
}
-
+
val r = a.merged(b) { collision }
println(r)
println(r(1))
-
- val rold = a.merge(b, collision)
- println(rold)
- println(rold(1))
}
-
+
def resolveSecond() {
val a = HashMap(1 -> "1")
val b = HashMap(1 -> "2")
@@ -47,28 +39,21 @@ object Test {
println(b)
b
}
-
+
val r = a.merged(b) { collision }
println(r)
println(r(1))
-
- val rold = a.merge(b, collision)
- println(rold)
- println(rold(1))
}
-
+
def resolveMany() {
val a = HashMap((0 until 100) zip (0 until 100): _*)
val b = HashMap((0 until 100) zip (100 until 200): _*)
def collision(a: (Int, Int), b: (Int, Int)) = {
(a._1, a._2 + b._2)
}
-
+
val r = a.merged(b) { collision }
for ((k, v) <- r) assert(v == 100 + 2 * k, (k, v))
-
- val rold = a.merge(b, collision)
- for ((k, v) <- r) assert(v == 100 + 2 * k, (k, v))
}
-
+
}
diff --git a/test/files/run/t5880.scala b/test/files/run/t5880.scala
index 4cda599f79..f88df90160 100644
--- a/test/files/run/t5880.scala
+++ b/test/files/run/t5880.scala
@@ -5,13 +5,13 @@ import scala.collection.JavaConversions._
object Test {
-
+
def main(args:Array[String]) = {
val tests = 5000
val jm: java.util.Map[Int, Int] = scala.collection.mutable.Map((0 until tests) zip (0 until tests).reverse: _*)
val es = jm.entrySet()
val it = es.iterator
-
+
// chi square test
val groups = 10
val hits = new Array[Int](groups)
@@ -28,7 +28,7 @@ object Test {
val diffs = for (i <- 0 until groups) yield (hits(i) - expected) * (hits(i) - expected)
diffs.sum.toDouble / expected
}
-
+
while (it.hasNext) {
val x = it.next()
hit(x.##)
@@ -37,5 +37,5 @@ object Test {
// println(ChiSquare)
assert(ChiSquare < 4.0, ChiSquare + " -> " + hits.mkString(", "))
}
-
+
}
diff --git a/test/files/run/t5881.scala b/test/files/run/t5881.scala
index 01bee29181..04b24b713d 100644
--- a/test/files/run/t5881.scala
+++ b/test/files/run/t5881.scala
@@ -1,6 +1,7 @@
+import scala.language.existentials
import scala.reflect.ClassTag
object Test extends App {
println(implicitly[ClassTag[List[T forSome {type T <: List[T]}]]])
println(implicitly[ClassTag[List[Any]]])
-} \ No newline at end of file
+}
diff --git a/test/files/run/t5894.scala b/test/files/run/t5894.scala
index abeec32365..6e118fd396 100644
--- a/test/files/run/t5894.scala
+++ b/test/files/run/t5894.scala
@@ -1,10 +1,11 @@
-import language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
class Test
object Test {
- def foo = macro fooImpl
- def fooImpl(c: reflect.macros.Context) = c.literalUnit
+ def foo: Unit = macro fooImpl
+ def fooImpl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def main(args: Array[String]) {
try {
diff --git a/test/files/run/t5903a.check b/test/files/run/t5903a.check
new file mode 100644
index 0000000000..ce6efd812d
--- /dev/null
+++ b/test/files/run/t5903a.check
@@ -0,0 +1 @@
+(SomeTree,SomeTree)
diff --git a/test/files/run/t5903a.flags b/test/files/run/t5903a.flags
new file mode 100644
index 0000000000..02ecab49e7
--- /dev/null
+++ b/test/files/run/t5903a.flags
@@ -0,0 +1 @@
+-Xlog-reflective-calls \ No newline at end of file
diff --git a/test/files/run/t5903a/Macros_1.scala b/test/files/run/t5903a/Macros_1.scala
new file mode 100644
index 0000000000..5d084ceed5
--- /dev/null
+++ b/test/files/run/t5903a/Macros_1.scala
@@ -0,0 +1,28 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+trait Tree
+case object SomeTree extends Tree
+
+object NewQuasiquotes {
+ implicit class QuasiquoteInterpolation(c: StringContext) {
+ object nq {
+ def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl
+ }
+ }
+}
+
+object QuasiquoteMacros {
+ def unapplyImpl(c: Context)(t: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = this
+ def _1 = SomeTree
+ def _2 = SomeTree
+ def unapply(t: Tree) = this
+ }.unapply($t)
+ """
+ }
+}
diff --git a/test/files/run/t5903a/Test_2.scala b/test/files/run/t5903a/Test_2.scala
new file mode 100644
index 0000000000..3a0b68b568
--- /dev/null
+++ b/test/files/run/t5903a/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import NewQuasiquotes._
+ SomeTree match {
+ case nq"$x + $y" => println((x, y))
+ }
+}
diff --git a/test/files/run/t5903b.check b/test/files/run/t5903b.check
new file mode 100644
index 0000000000..75891bc672
--- /dev/null
+++ b/test/files/run/t5903b.check
@@ -0,0 +1 @@
+oops
diff --git a/test/files/run/t5903b.flags b/test/files/run/t5903b.flags
new file mode 100644
index 0000000000..02ecab49e7
--- /dev/null
+++ b/test/files/run/t5903b.flags
@@ -0,0 +1 @@
+-Xlog-reflective-calls \ No newline at end of file
diff --git a/test/files/run/t5903b/Macros_1.scala b/test/files/run/t5903b/Macros_1.scala
new file mode 100644
index 0000000000..29a05f7fec
--- /dev/null
+++ b/test/files/run/t5903b/Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply[T](x: T): Any = macro Macros.unapplyImpl[T]
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = this
+ def _1 = 2
+ def unapply(x: Int) = this
+ override def toString = "oops"
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/t5903b/Test_2.scala b/test/files/run/t5903b/Test_2.scala
new file mode 100644
index 0000000000..0f6f80d327
--- /dev/null
+++ b/test/files/run/t5903b/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 2 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/run/t6956.check b/test/files/run/t5903c.check
index 0cfbf08886..0cfbf08886 100644
--- a/test/files/run/t6956.check
+++ b/test/files/run/t5903c.check
diff --git a/test/files/run/t5903c.flags b/test/files/run/t5903c.flags
new file mode 100644
index 0000000000..02ecab49e7
--- /dev/null
+++ b/test/files/run/t5903c.flags
@@ -0,0 +1 @@
+-Xlog-reflective-calls \ No newline at end of file
diff --git a/test/files/run/t5903c/Macros_1.scala b/test/files/run/t5903c/Macros_1.scala
new file mode 100644
index 0000000000..34fe1d8808
--- /dev/null
+++ b/test/files/run/t5903c/Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply[T](x: T): Any = macro Macros.unapplyImpl[T]
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = 2
+ def unapply(x: Int) = this
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/t5903c/Test_2.scala b/test/files/run/t5903c/Test_2.scala
new file mode 100644
index 0000000000..0f6f80d327
--- /dev/null
+++ b/test/files/run/t5903c/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 2 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/run/t5903d.check b/test/files/run/t5903d.check
new file mode 100644
index 0000000000..d81cc0710e
--- /dev/null
+++ b/test/files/run/t5903d.check
@@ -0,0 +1 @@
+42
diff --git a/test/files/run/t5903d.flags b/test/files/run/t5903d.flags
new file mode 100644
index 0000000000..02ecab49e7
--- /dev/null
+++ b/test/files/run/t5903d.flags
@@ -0,0 +1 @@
+-Xlog-reflective-calls \ No newline at end of file
diff --git a/test/files/run/t5903d/Macros_1.scala b/test/files/run/t5903d/Macros_1.scala
new file mode 100644
index 0000000000..f1f8dc1fde
--- /dev/null
+++ b/test/files/run/t5903d/Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply(x: Int): Any = macro Macros.unapplyImpl
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/t5903d/Test_2.scala b/test/files/run/t5903d/Test_2.scala
new file mode 100644
index 0000000000..95c717a9d8
--- /dev/null
+++ b/test/files/run/t5903d/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 42 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/run/t5905-features.flags b/test/files/run/t5905-features.flags
new file mode 100644
index 0000000000..ad51758c39
--- /dev/null
+++ b/test/files/run/t5905-features.flags
@@ -0,0 +1 @@
+-nowarn
diff --git a/test/files/run/t5905-features.scala b/test/files/run/t5905-features.scala
new file mode 100644
index 0000000000..a3848eef2a
--- /dev/null
+++ b/test/files/run/t5905-features.scala
@@ -0,0 +1,29 @@
+
+import tools.partest.DirectTest
+
+// verify that all languageFeature names are accepted by -language
+object Test extends DirectTest {
+ override def code = "class Code { def f = (1 to 10) size }" // exercise a feature
+
+ override def extraSettings = s"-usejavacp -d ${testOutput.path}"
+
+ override def show() = {
+ val global = newCompiler("-language:postfixOps", "-Ystop-after:typer")
+ compileString(global)(code)
+ import global._
+ exitingTyper {
+ //def isFeature(s: Symbol) = s.annotations.exists((a: AnnotationInfo) => a.tpe <:< typeOf[scala.annotation.meta.languageFeature])
+ def isFeature(s: Symbol) = s hasAnnotation definitions.LanguageFeatureAnnot
+ val langf = definitions.languageFeatureModule.typeSignature
+ val feats = langf.declarations filter (s => isFeature(s)) map (_.name.decoded)
+ val xmen = langf.member(TermName("experimental")).typeSignature.declarations filter (s => isFeature(s)) map (s => s"experimental.${s.name.decoded}")
+ val all = (feats ++ xmen) mkString ","
+
+ assert(feats.nonEmpty, "Test must find feature flags.")
+
+ //dynamics,postfixOps,reflectiveCalls,implicitConversions,higherKinds,existentials,experimental.macros
+ compile(s"-language:$all")
+ }
+ }
+}
+
diff --git a/test/files/run/t5905b-features.check b/test/files/run/t5905b-features.check
new file mode 100644
index 0000000000..08c76d74aa
--- /dev/null
+++ b/test/files/run/t5905b-features.check
@@ -0,0 +1 @@
+'noob' is not a valid choice for '-language'
diff --git a/test/files/run/t5905b-features.scala b/test/files/run/t5905b-features.scala
new file mode 100644
index 0000000000..627df8334b
--- /dev/null
+++ b/test/files/run/t5905b-features.scala
@@ -0,0 +1,15 @@
+
+import tools.partest.DirectTest
+
+// verify that only languageFeature names are accepted by -language
+object Test extends DirectTest {
+ override def code = "class Code"
+
+ override def extraSettings = s"-usejavacp -d ${testOutput.path}"
+
+ override def show() = {
+ //compile("-language", "--") // no error
+ compile(s"-language:noob")
+ }
+}
+
diff --git a/test/files/run/t5912.scala b/test/files/run/t5912.scala
index 7710d04396..fc879a0537 100644
--- a/test/files/run/t5912.scala
+++ b/test/files/run/t5912.scala
@@ -1,6 +1,7 @@
+import scala.language.existentials
object Test extends App{
import scala.reflect.runtime.{currentMirror=>cm}
import scala.tools.reflect._
import scala.reflect.runtime.universe._
- val tree = cm.mkToolBox().typeCheck( Literal(Constant("test")) )
-} \ No newline at end of file
+ val tree = cm.mkToolBox().typecheck( Literal(Constant("test")) )
+}
diff --git a/test/files/run/t5923a/Macros_1.scala b/test/files/run/t5923a/Macros_1.scala
index 6d21362c4d..9050fd4b11 100644
--- a/test/files/run/t5923a/Macros_1.scala
+++ b/test/files/run/t5923a/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
case class C[T](t: String)
@@ -7,8 +7,47 @@ object C {
}
object Macros {
- def impl[T: c.WeakTypeTag](c: Context) = {
+ def impl[T](c: Context)(ttag: c.WeakTypeTag[T]) = {
import c.universe._
- reify(C[T](c.literal(weakTypeOf[T].toString).splice))
+ import internal._
+ val ttag0 = ttag;
+ {
+ // When we're expanding implicitly[C[Nothing]], the type inferencer will see
+ // that foo[T] returns C[T] and that we request an implicit of type C[Nothing].
+ //
+ // Then the type inferencer will try to match C[T] against C[Nothing] and infer everything it can infer
+ // from that match, but not more (e.g. if we were returning Iso[T, U] and the type we were looking at was Iso[Foo, L],
+ // we wouldn't want U to be auto-inferred to Nothing, as it usually happens with normal methods,
+ // but would rather want it to remain unknown, so that our macro could take a stab at inferring it:
+ // see the comments in this commit for more information).
+ //
+ // Equipped with common sense, in our case of C[T] and C[Nothing] we would expect T to be inferred as Nothing, and then we
+ // would expect T in the corresponding macro invocation to be Nothing. Unfortunately it is not that simple.
+ //
+ // Internally the type inferencer uses Nothing as a dummy value, which stands for "don't know how to
+ // infer this type parameter". In the Iso example, matching Iso[T, U] against Iso[Foo, L] would result in
+ // T being inferred as Foo and U being inferred as Nothing (!!). Then the type inferencer will think:
+ // "Aha! U ended up being Nothing. This means that I failed to infer it,
+ // therefore the result of my work is: T -> Foo, U -> still unknown".
+ //
+ // That's all very good and works very well until Nothing is a genuine result of type inference,
+ // as in our original example of inferring T in C[T] from C[Nothing]. In that case, the inferencer becomes confused
+ // and here in the macro implementation we get weakTypeOf[T] equal to some dummy type carrying a type parameter
+ // instead of Nothing.
+ //
+ // This eccentric behavior of the type inferencer is a long-standing problem in scalac,
+ // so the best one can do for now until it's fixed is to work around, manually converting
+ // suspicious T's into Nothings. Of course, this means that we would have to approximate,
+ // because there's no way to know whether having T here stands for a failed attempt to infer Nothing
+ // or for a failed attempt to infer anything, but at least we're in full control of making the best
+ // of this sad situation.
+ implicit def ttag: WeakTypeTag[T] = {
+ val tpe = ttag0.tpe
+ val sym = tpe.typeSymbol.asType
+ if (sym.isParameter && !isSkolem(sym)) TypeTag.Nothing.asInstanceOf[TypeTag[T]]
+ else ttag0
+ }
+ reify(C[T](c.Expr[String](Literal(Constant(weakTypeOf[T].toString))).splice))
+ }
}
} \ No newline at end of file
diff --git a/test/files/run/t5923c.scala b/test/files/run/t5923c.scala
new file mode 100644
index 0000000000..956b256785
--- /dev/null
+++ b/test/files/run/t5923c.scala
@@ -0,0 +1,4 @@
+// see neg/macro-blackbox-fundep-materialization and run/macro-whitebox-fundep-materialization
+object Test extends App {
+ // do nothing
+} \ No newline at end of file
diff --git a/test/files/run/t5923d/Macros_1.scala b/test/files/run/t5923d/Macros_1.scala
new file mode 100644
index 0000000000..1400674d4b
--- /dev/null
+++ b/test/files/run/t5923d/Macros_1.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+trait MappedRow
+trait RowMapper[T <: MappedRow]
+object RowMapper {
+ implicit def mapper[T <: MappedRow]: RowMapper[T] = macro impl[T]
+ def impl[T <: MappedRow : c.WeakTypeTag](c: Context) = c.universe.reify(new RowMapper[T]{})
+} \ No newline at end of file
diff --git a/test/files/run/t5923d/Test_2.scala b/test/files/run/t5923d/Test_2.scala
new file mode 100644
index 0000000000..6be10227c2
--- /dev/null
+++ b/test/files/run/t5923d/Test_2.scala
@@ -0,0 +1,7 @@
+class RowA extends MappedRow
+class RowB extends MappedRow
+
+object Test extends App {
+ implicitly[RowMapper[RowA]]
+ implicitly[RowMapper[RowB]]
+} \ No newline at end of file
diff --git a/test/files/run/t5937.scala b/test/files/run/t5937.scala
index e5bf6617af..9ec4ff12d3 100644
--- a/test/files/run/t5937.scala
+++ b/test/files/run/t5937.scala
@@ -6,7 +6,7 @@ import collection._
object Test extends App {
-
+
val list: List[Int] = (immutable.Vector(1, 2, 3) :+ 4)(breakOut)
-
+
}
diff --git a/test/files/run/t5940.scala b/test/files/run/t5940.scala
index 147ff38256..7b025b43af 100644
--- a/test/files/run/t5940.scala
+++ b/test/files/run/t5940.scala
@@ -4,16 +4,16 @@ object Test extends DirectTest {
def code = ???
def macros_1 = """
- import scala.reflect.macros.Context
+ import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: Context) = c.literalUnit
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
}
object Macros {
//import Impls._
- def impl(c: Context) = c.literalUnit
- def foo = macro impl
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
+ def foo: Unit = macro impl
}
"""
def compileMacros() = {
diff --git a/test/files/run/t5942.check b/test/files/run/t5942.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5942.check
+++ /dev/null
diff --git a/test/files/run/t5942.scala b/test/files/run/t5942.scala
index 44a8be93f6..c90d29e1ca 100644
--- a/test/files/run/t5942.scala
+++ b/test/files/run/t5942.scala
@@ -5,6 +5,6 @@ import scala.tools.reflect._
object Test extends App {
val tb = cm.mkToolBox()
tb.parse("def x = {}")
- try { tb.parse("def x = {") } catch { case _ => }
+ try { tb.parse("def x = {") } catch { case _: Throwable => }
tb.parse("def x = {}")
}
diff --git a/test/files/run/t5943a1.scala b/test/files/run/t5943a1.scala
index 00f4afa808..6bb828de85 100644
--- a/test/files/run/t5943a1.scala
+++ b/test/files/run/t5943a1.scala
@@ -5,5 +5,5 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val tb = cm.mkToolBox()
val expr = tb.parse("1 to 3 map (_+1)")
- println(tb.typeCheck(expr))
+ println(tb.typecheck(expr))
} \ No newline at end of file
diff --git a/test/files/run/t5971.scala b/test/files/run/t5971.scala
index dbd9beebb3..bc24255ece 100644
--- a/test/files/run/t5971.scala
+++ b/test/files/run/t5971.scala
@@ -12,12 +12,12 @@
* Mind blowing, I know.
*/
object Test {
-
+
def main(args: Array[String]) {
println("bar".view.reverse.filter(_ > 'a').mkString(","))
println("bar".view.reverse.take(1).mkString(","))
println("bar".view.reverse.dropWhile(_ > 'a').mkString(","))
println("bar".view.reverse.takeWhile(_ => true).mkString(","))
}
-
+
}
diff --git a/test/files/run/t5986.scala b/test/files/run/t5986.scala
index 8cf7086f98..b9c21a7b37 100644
--- a/test/files/run/t5986.scala
+++ b/test/files/run/t5986.scala
@@ -9,22 +9,22 @@ import scala.collection._
* and the element already exists in the set.
*/
object Test {
-
+
class Foo(val name: String, val n: Int) {
override def equals(obj: Any): Boolean = obj match { case other: Foo => name == other.name; case _ => false }
override def hashCode = name.##
override def toString = "Foo(" + name + ", " + n + ")"
}
-
+
implicit val ordering: Ordering[Foo] = Ordering.fromLessThan[Foo] { (a, b) => a.name.compareTo(b.name) < 0 }
-
+
def check[S <: Set[Foo]](set: S) {
def output(s: Set[Foo]) = println(s.toList.sorted.mkString(","))
output(set + new Foo("bar", 2))
output(set ++ List(new Foo("bar", 2), new Foo("bar", 3), new Foo("bar", 4)))
output(set union Set(new Foo("bar", 2), new Foo("baz", 3), new Foo("bazz", 4)))
}
-
+
def main(args: Array[String]) {
check(Set(new Foo("bar", 1)))
check(immutable.Set(new Foo("bar", 1)))
@@ -32,5 +32,5 @@ object Test {
check(immutable.SortedSet(new Foo("bar", 1)))
check(mutable.SortedSet(new Foo("bar", 1)))
}
-
+
}
diff --git a/test/files/run/t6011c.check b/test/files/run/t6011c.check
new file mode 100644
index 0000000000..088e6fdaae
--- /dev/null
+++ b/test/files/run/t6011c.check
@@ -0,0 +1,3 @@
+t6011c.scala:11: warning: unreachable code
+ case 1 => 3 // crash
+ ^
diff --git a/test/files/run/t6023.scala b/test/files/run/t6023.scala
index 07af3685a5..2753b93ac4 100644
--- a/test/files/run/t6023.scala
+++ b/test/files/run/t6023.scala
@@ -9,7 +9,7 @@ object Test extends App {
// test 2: import and typecheck
val toolbox = cm.mkToolBox()
- val ttree = toolbox.typeCheck(tree)
+ val ttree = toolbox.typecheck(tree)
println(ttree.toString)
// test 3: import and compile
diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check
index 613d25b075..a6c4db8f11 100644
--- a/test/files/run/t6028.check
+++ b/test/files/run/t6028.check
@@ -1,7 +1,7 @@
[[syntax trees at end of lambdalift]] // newSource1.scala
package <empty> {
class T extends Object {
- <paramaccessor> val T$$classParam: Int = _;
+ <paramaccessor> val classParam: Int = _;
def <init>(classParam: Int): T = {
T.super.<init>();
()
@@ -11,34 +11,34 @@ package <empty> {
def foo(methodParam: Int): Function0 = {
val methodLocal: Int = 0;
{
- (new anonymous class $anonfun$foo$1(T.this, methodParam, methodLocal): Function0)
+ (new <$anon: Function0>(T.this, methodParam, methodLocal): Function0)
}
};
def bar(barParam: Int): Object = {
- @volatile var MethodLocalObject$module: runtime.VolatileObjectRef = new runtime.VolatileObjectRef(null);
+ @volatile var MethodLocalObject$module: runtime.VolatileObjectRef = scala.runtime.VolatileObjectRef.zero();
T.this.MethodLocalObject$1(barParam, MethodLocalObject$module)
};
def tryy(tryyParam: Int): Function0 = {
- var tryyLocal: runtime.IntRef = new runtime.IntRef(0);
+ var tryyLocal: runtime.IntRef = scala.runtime.IntRef.create(0);
{
- (new anonymous class $anonfun$tryy$1(T.this, tryyParam, tryyLocal): Function0)
+ (new <$anon: Function0>(T.this, tryyParam, tryyLocal): Function0)
}
};
- @SerialVersionUID(0) final <synthetic> class $anonfun$foo$1 extends runtime.AbstractFunction0$mcI$sp with Serializable {
- def <init>($outer: T, methodParam$1: Int, methodLocal$1: Int): anonymous class $anonfun$foo$1 = {
+ @SerialVersionUID(0) final <synthetic> class $anonfun$foo$1 extends scala.runtime.AbstractFunction0$mcI$sp with Serializable {
+ def <init>($outer: T, methodParam$1: Int, methodLocal$1: Int): <$anon: Function0> = {
$anonfun$foo$1.super.<init>();
()
};
final def apply(): Int = $anonfun$foo$1.this.apply$mcI$sp();
- <specialized> def apply$mcI$sp(): Int = $anonfun$foo$1.this.$outer.T$$classParam.+($anonfun$foo$1.this.$outer.field()).+($anonfun$foo$1.this.methodParam$1).+($anonfun$foo$1.this.methodLocal$1);
- <synthetic> <paramaccessor> private[this] val $outer: T = _;
- <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer;
- final <bridge> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply());
+ <specialized> def apply$mcI$sp(): Int = $anonfun$foo$1.this.$outer.classParam.+($anonfun$foo$1.this.$outer.field()).+($anonfun$foo$1.this.methodParam$1).+($anonfun$foo$1.this.methodLocal$1);
+ <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _;
+ <synthetic> <stable> <artifact> def $outer(): T = $anonfun$foo$1.this.$outer;
+ final <bridge> <artifact> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply());
<synthetic> <paramaccessor> private[this] val methodParam$1: Int = _;
<synthetic> <paramaccessor> private[this] val methodLocal$1: Int = _
};
abstract trait MethodLocalTrait$1 extends Object {
- <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T
+ <synthetic> <stable> <artifact> def $outer(): T
};
object MethodLocalObject$2 extends Object with T#MethodLocalTrait$1 {
def <init>($outer: T, barParam$1: Int): T#MethodLocalObject$2.type = {
@@ -46,9 +46,9 @@ package <empty> {
MethodLocalObject$2.this.$asInstanceOf[T#MethodLocalTrait$1$class]()./*MethodLocalTrait$1$class*/$init$(barParam$1);
()
};
- <synthetic> <paramaccessor> private[this] val $outer: T = _;
- <synthetic> <stable> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer;
- <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer
+ <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _;
+ <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer;
+ <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer
};
final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = {
MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1);
@@ -60,8 +60,8 @@ package <empty> {
};
scala.this.Predef.print(scala.Int.box(barParam$1))
};
- @SerialVersionUID(0) final <synthetic> class $anonfun$tryy$1 extends runtime.AbstractFunction0$mcV$sp with Serializable {
- def <init>($outer: T, tryyParam$1: Int, tryyLocal$1: runtime.IntRef): anonymous class $anonfun$tryy$1 = {
+ @SerialVersionUID(0) final <synthetic> class $anonfun$tryy$1 extends scala.runtime.AbstractFunction0$mcV$sp with Serializable {
+ def <init>($outer: T, tryyParam$1: Int, tryyLocal$1: runtime.IntRef): <$anon: Function0> = {
$anonfun$tryy$1.super.<init>();
()
};
@@ -69,9 +69,9 @@ package <empty> {
<specialized> def apply$mcV$sp(): Unit = try {
$anonfun$tryy$1.this.tryyLocal$1.elem = $anonfun$tryy$1.this.tryyParam$1
} finally ();
- <synthetic> <paramaccessor> private[this] val $outer: T = _;
- <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer;
- final <bridge> def apply(): Object = {
+ <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _;
+ <synthetic> <stable> <artifact> def $outer(): T = $anonfun$tryy$1.this.$outer;
+ final <bridge> <artifact> def apply(): Object = {
$anonfun$tryy$1.this.apply();
scala.runtime.BoxedUnit.UNIT
};
diff --git a/test/files/run/t6028.scala b/test/files/run/t6028.scala
index cab17535fc..a6f920c5bb 100644
--- a/test/files/run/t6028.scala
+++ b/test/files/run/t6028.scala
@@ -3,7 +3,7 @@ import java.io.{Console => _, _}
object Test extends DirectTest {
- override def extraSettings: String = "-usejavacp -Xprint:lambdalift -d " + testOutput.path
+ override def extraSettings: String = "-usejavacp -Ydelambdafy:inline -Xprint:lambdalift -d " + testOutput.path
override def code = """class T(classParam: Int) {
| val field: Int = 0
diff --git a/test/files/run/t603.scala b/test/files/run/t603.scala
index b8825c933b..84a224a40a 100644
--- a/test/files/run/t603.scala
+++ b/test/files/run/t603.scala
@@ -1,4 +1,6 @@
object forceDelay {
+ import scala.language.implicitConversions
+
class Susp[+A](lazyValue: => A) extends Function0[A] {
private var func: () => Any = () => lazyValue
private var value: Any = null
@@ -22,7 +24,7 @@ object forceDelay {
object Test {
import forceDelay._
-
+
def main(args: Array[String]) = {
val s: Susp[Int] = delay { Console.println("evaluating..."); 3 }
Console.println("s = " + s)
diff --git a/test/files/run/t6052.scala b/test/files/run/t6052.scala
index 385d5390d3..5482cfb293 100644
--- a/test/files/run/t6052.scala
+++ b/test/files/run/t6052.scala
@@ -8,13 +8,13 @@
object Test extends App {
def seqarr(i: Int) = Array[Int]() ++ (0 until i)
def pararr(i: Int) = seqarr(i).par
-
+
def check[T](i: Int, f: Int => T) {
val gseq = seqarr(i).toSeq.groupBy(f)
val gpar = pararr(i).groupBy(f)
assert(gseq == gpar, (gseq, gpar))
}
-
+
for (i <- 0 until 20) check(i, _ > 0)
for (i <- 0 until 20) check(i, _ % 2)
for (i <- 0 until 20) check(i, _ % 4)
diff --git a/test/files/run/t6064.scala b/test/files/run/t6064.scala
new file mode 100644
index 0000000000..fc184dd92d
--- /dev/null
+++ b/test/files/run/t6064.scala
@@ -0,0 +1,9 @@
+object Test extends App {
+ assert(Option(42) contains 42)
+ assert(Some(42) contains 42)
+ assert(Option(BigInt(42)) contains 42)
+ assert(Option(42) contains BigInt(42))
+ assert(!(None contains 42))
+ assert(Some(null) contains null)
+ assert(!(Option(null) contains null))
+} \ No newline at end of file
diff --git a/test/files/run/t6070.scala b/test/files/run/t6070.scala
index b6af48ef21..434949f869 100644
--- a/test/files/run/t6070.scala
+++ b/test/files/run/t6070.scala
@@ -11,7 +11,7 @@ class StringBomb extends Bomb {
def size(that: String): Int = that.length
}
-class IntBomb extends Bomb {
+class IntBomb extends Bomb {
type T = Int
val x = 10
@@ -22,7 +22,7 @@ case class Mean(var bomb: Bomb)
object Test extends App {
def foo(x: Mean) = x match {
- case Mean(b) =>
+ case Mean(b) =>
// BUG: b is assumed to be a stable identifier, but it can actually be mutated
println(b.size({ mutate(); b.x }))
}
diff --git a/test/files/run/t6086-repl.check b/test/files/run/t6086-repl.check
index 97f20bd66b..115eff5f85 100644
--- a/test/files/run/t6086-repl.check
+++ b/test/files/run/t6086-repl.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> case class X(s: String)
defined class X
diff --git a/test/files/run/t6102.check b/test/files/run/t6102.check
index b6fc4c620b..aa3e6cc9e2 100644
--- a/test/files/run/t6102.check
+++ b/test/files/run/t6102.check
@@ -1 +1,32 @@
-hello \ No newline at end of file
+[running phase parser on t6102.scala]
+[running phase namer on t6102.scala]
+[running phase packageobjects on t6102.scala]
+[running phase typer on t6102.scala]
+[running phase patmat on t6102.scala]
+[running phase superaccessors on t6102.scala]
+[running phase extmethods on t6102.scala]
+[running phase pickler on t6102.scala]
+[running phase refchecks on t6102.scala]
+[running phase uncurry on t6102.scala]
+[running phase tailcalls on t6102.scala]
+[running phase specialize on t6102.scala]
+[running phase explicitouter on t6102.scala]
+[running phase erasure on t6102.scala]
+[running phase posterasure on t6102.scala]
+[running phase lazyvals on t6102.scala]
+[running phase lambdalift on t6102.scala]
+[running phase constructors on t6102.scala]
+[running phase flatten on t6102.scala]
+[running phase mixin on t6102.scala]
+[running phase cleanup on t6102.scala]
+[running phase delambdafy on t6102.scala]
+[running phase icode on t6102.scala]
+#partest -optimise
+[running phase inliner on t6102.scala]
+[running phase inlinehandlers on t6102.scala]
+[running phase closelim on t6102.scala]
+[running phase constopt on t6102.scala]
+#partest
+[running phase dce on t6102.scala]
+[running phase jvm on icode]
+hello
diff --git a/test/files/run/t6102.flags b/test/files/run/t6102.flags
index e35535c8ea..726e2a997f 100644
--- a/test/files/run/t6102.flags
+++ b/test/files/run/t6102.flags
@@ -1 +1 @@
- -Ydead-code
+-Ydead-code -Ydebug -Xfatal-warnings
diff --git a/test/files/run/t6111.check b/test/files/run/t6111.check
index 7fd2e33526..1f23a87f73 100644
--- a/test/files/run/t6111.check
+++ b/test/files/run/t6111.check
@@ -1,2 +1,3 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
(8,8)
(x,x)
diff --git a/test/files/run/t6111.scala b/test/files/run/t6111.scala
index 7cceea1d09..c0bcf17a07 100644
--- a/test/files/run/t6111.scala
+++ b/test/files/run/t6111.scala
@@ -1,3 +1,5 @@
+// SI-6675 DEPRECATED AUTO-TUPLING BECAUSE BAD IDEA -- MEAMAXIMACULPA
+// TODO: remove this test case in 2.12, when the deprecation will go into effect and this will no longer compile
// slightly overkill, but a good test case for implicit resolution in extractor calls,
// along with the real fix: an extractor pattern with 1 sub-pattern should type check for all extractors
// that return Option[T], whatever T (even if it's a tuple)
diff --git a/test/files/run/t6113.scala b/test/files/run/t6113.scala
index 321cae86a3..b77a56029a 100644
--- a/test/files/run/t6113.scala
+++ b/test/files/run/t6113.scala
@@ -1,6 +1,8 @@
+import scala.language.higherKinds
+
trait Foo[C[_]]
object Test extends App {
import scala.reflect.runtime.universe._
println(typeOf[Foo[({type l[X] = (Int, X)})#l]])
-} \ No newline at end of file
+}
diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check
index 49ff70697e..a3b09efcd9 100644
--- a/test/files/run/t6146b.check
+++ b/test/files/run/t6146b.check
@@ -1,3 +1,7 @@
+t6146b.scala:15: warning: match may not be exhaustive.
+It would fail on the following inputs: S2(), S3()
+ def foo(f: F[Int]) = f match { case X.S1 => }
+ ^
Type in expressions to have them evaluated.
Type :help for more information.
@@ -41,7 +45,7 @@ scala> val mt1 = memType(S1, fTpe)
mt1: u.Type = O.X.S1.type
scala> global.typeDeconstruct.show(mt1)
-res0: String =
+res0: String =
TypeRef(
pre = SingleType(pre = ThisType(object O), object X)
TypeSymbol(class S1 extends C.this.F[T])
diff --git a/test/files/run/t6150.scala b/test/files/run/t6150.scala
index bd8af5d460..f3e83e1549 100644
--- a/test/files/run/t6150.scala
+++ b/test/files/run/t6150.scala
@@ -1,7 +1,3 @@
-
-
-
-
object Test {
import collection.{ immutable, mutable, generic }
def TheOneTrueCBF = collection.IndexedSeq.ReusableCBF
@@ -38,7 +34,3 @@ object Test {
check(iv.:+(4)(cbf3))
}
}
-
-
-
-
diff --git a/test/files/run/t6168/Context.java b/test/files/run/t6168/Context.java
new file mode 100644
index 0000000000..d0fb5d2543
--- /dev/null
+++ b/test/files/run/t6168/Context.java
@@ -0,0 +1,34 @@
+public class Context<ParentType> {
+ private ParentType parent;
+
+ public Context() {}
+
+ public ParentType getParent() {
+ return parent;
+ }
+
+ public void setParent(ParentType parent) {
+ this.parent = parent;
+ }
+
+ public Field<Integer> intField() {
+ return new Field<Integer>() {
+ @Override
+ public Integer get() {
+ return 0;
+ }
+
+ @Override
+ public ParentType set(Integer t) {
+ return parent;
+ }
+ };
+ }
+
+ public abstract class Field<T> { //Note this is a path dependent type
+
+ public abstract T get();
+
+ public abstract ParentType set(T t);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168/JavaTest.java b/test/files/run/t6168/JavaTest.java
new file mode 100644
index 0000000000..94ae91661d
--- /dev/null
+++ b/test/files/run/t6168/JavaTest.java
@@ -0,0 +1,8 @@
+public class JavaTest {
+ public static void main(String[] args) {
+ SomeClass a = new SomeClass();
+ SomeClass2 a2 = new SomeClass2();
+ SomeClass b = a.f.set(23).f.set(23);
+ SomeClass2 b2 = a2.f.set(23).f.set(23);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168/SomeClass.java b/test/files/run/t6168/SomeClass.java
new file mode 100644
index 0000000000..6f76b829bb
--- /dev/null
+++ b/test/files/run/t6168/SomeClass.java
@@ -0,0 +1,14 @@
+public class SomeClass {
+ private final Context<SomeClass> context = new Context<SomeClass>();
+ {
+ context.setParent(this);
+ }
+
+ public final Context<SomeClass>.Field<Integer> f = context.intField();
+
+ public SomeClass() {
+ f.set(23).f.set(23);
+ }
+}
+
+
diff --git a/test/files/run/t6168/SomeClass2.java b/test/files/run/t6168/SomeClass2.java
new file mode 100644
index 0000000000..b2c7a7540b
--- /dev/null
+++ b/test/files/run/t6168/SomeClass2.java
@@ -0,0 +1,12 @@
+public class SomeClass2 {
+ private final Context<SomeClass2> context = new Context<SomeClass2>();
+ {
+ context.setParent(this);
+ }
+
+ public final Context<SomeClass2>.Field<Integer> f = context.intField();
+
+ public SomeClass2() {
+ f.set(23).f.set(23);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168/main.scala b/test/files/run/t6168/main.scala
new file mode 100644
index 0000000000..c7ad37830b
--- /dev/null
+++ b/test/files/run/t6168/main.scala
@@ -0,0 +1,15 @@
+
+
+object Test extends App {
+ JavaTest.main(null)
+
+ var a1 : SomeClass = new SomeClass
+ var a2 : SomeClass2 = new SomeClass2
+ //import language.implicitConversions
+ //implicit def setParentType2SomeClass(x:Any) = x.asInstanceOf[SomeClass]
+ //implicit def setParentType2SomeClass2(x:Any) = x.asInstanceOf[SomeClass2]
+ //var b : SomeClass = a.f.set(23).asInstanceOf[SomeClass].f.set(23).asInstanceOf[SomeClass]
+ //var b2 : SomeClass2 = a2.f.set(23).asInstanceOf[SomeClass2].f.set(23).asInstanceOf[SomeClass2]
+ var b1 : SomeClass = a1.f.set(23).f.set(23)
+ var b2 : SomeClass2 = a2.f.set(23).f.set(23)
+}
diff --git a/test/files/run/t6168b/Context.java b/test/files/run/t6168b/Context.java
new file mode 100644
index 0000000000..b3ea22126f
--- /dev/null
+++ b/test/files/run/t6168b/Context.java
@@ -0,0 +1,34 @@
+public class Context<ParentType> {
+ private ParentType parent;
+
+ public Context() {}
+
+ public ParentType getParent() {
+ return parent;
+ }
+
+ public void setParent(ParentType parent) {
+ this.parent = parent;
+ }
+
+ public Field<Integer> intField() {
+ return new Field<Integer>() {
+ @Override
+ public Integer get() {
+ return 0;
+ }
+
+ @Override
+ public ParentType set(Integer t) {
+ return parent;
+ }
+ };
+ }
+
+ public static abstract class Field<T> {
+
+ public abstract T get();
+
+ public abstract Object set(T t);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168b/JavaTest.java b/test/files/run/t6168b/JavaTest.java
new file mode 100644
index 0000000000..a09fa0382d
--- /dev/null
+++ b/test/files/run/t6168b/JavaTest.java
@@ -0,0 +1,6 @@
+public class JavaTest {
+ public static void main(String[] args) {
+ SomeClass a = new SomeClass();
+ Object b = a.f.set(23);
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6168b/SomeClass.java b/test/files/run/t6168b/SomeClass.java
new file mode 100644
index 0000000000..566c55e1c5
--- /dev/null
+++ b/test/files/run/t6168b/SomeClass.java
@@ -0,0 +1,11 @@
+public class SomeClass {
+ private final Context<SomeClass> context = new Context<SomeClass>();
+ {
+ context.setParent(this);
+ }
+
+ public final Context.Field<Integer> f = context.intField();
+
+}
+
+
diff --git a/test/files/run/t6168b/main.scala b/test/files/run/t6168b/main.scala
new file mode 100644
index 0000000000..187e9fe85e
--- /dev/null
+++ b/test/files/run/t6168b/main.scala
@@ -0,0 +1,8 @@
+
+
+object Test extends App {
+ JavaTest.main(null)
+
+ var a1 : SomeClass = new SomeClass
+ var b1 : Object = a1.f.set(23)
+}
diff --git a/test/files/run/t6178.scala b/test/files/run/t6178.scala
index 0b4cf0bbf5..41e148af91 100644
--- a/test/files/run/t6178.scala
+++ b/test/files/run/t6178.scala
@@ -2,6 +2,6 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
- val plus = typeOf[java.lang.String].member(newTermName("$plus")).asMethod
+ val plus = typeOf[java.lang.String].member(TermName("$plus")).asMethod
println(cm.reflect("").reflectMethod(plus).apply("2"))
} \ No newline at end of file
diff --git a/test/files/run/t6181.scala b/test/files/run/t6181.scala
index fb23eaff63..eaa7340178 100644
--- a/test/files/run/t6181.scala
+++ b/test/files/run/t6181.scala
@@ -3,6 +3,6 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class C { def test(x: => Int) = println(x) }
- val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("test")).asMethod)
+ val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(TermName("test")).asMethod)
mm(2)
} \ No newline at end of file
diff --git a/test/files/run/t6187.check b/test/files/run/t6187.check
index c0ca02923b..0180125809 100644
--- a/test/files/run/t6187.check
+++ b/test/files/run/t6187.check
@@ -1,18 +1,18 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala> import language.experimental.macros, reflect.macros.Context
-import language.experimental.macros
-import reflect.macros.Context
+scala> import scala.language.experimental.macros, scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
scala> def macroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = {
val r = c.universe.reify { List(t.splice) }
- c.Expr[List[T]]( c.resetLocalAttrs(r.tree) )
+ c.Expr[List[T]]( c.untypecheck(r.tree) )
}
-macroImpl: [T](c: scala.reflect.macros.Context)(t: c.Expr[T])(implicit evidence$1: c.WeakTypeTag[T])c.Expr[List[T]]
+macroImpl: [T](c: scala.reflect.macros.blackbox.Context)(t: c.Expr[T])(implicit evidence$1: c.WeakTypeTag[T])c.Expr[List[T]]
scala> def demo[T](t: T): List[T] = macro macroImpl[T]
-demo: [T](t: T)List[T]
+defined term macro demo: [T](t: T)List[T]
scala> def m[T](t: T): List[List[T]] =
demo( List((t,true)) collect { case (x,true) => x } )
diff --git a/test/files/run/t6187.scala b/test/files/run/t6187.scala
index ae642917e7..7a39cfd9e7 100644
--- a/test/files/run/t6187.scala
+++ b/test/files/run/t6187.scala
@@ -2,10 +2,10 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
override def code = """
-import language.experimental.macros, reflect.macros.Context
+import scala.language.experimental.macros, scala.reflect.macros.blackbox.Context
def macroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = {
val r = c.universe.reify { List(t.splice) }
- c.Expr[List[T]]( c.resetLocalAttrs(r.tree) )
+ c.Expr[List[T]]( c.untypecheck(r.tree) )
}
def demo[T](t: T): List[T] = macro macroImpl[T]
def m[T](t: T): List[List[T]] =
diff --git a/test/files/run/t6196.scala b/test/files/run/t6196.scala
new file mode 100644
index 0000000000..a75911fb9e
--- /dev/null
+++ b/test/files/run/t6196.scala
@@ -0,0 +1,68 @@
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ case class Collision(value: Int) extends Ordered[Collision] {
+ def compare(that:Collision) = value compare that.value
+
+ override def hashCode = value / 5
+ }
+
+ def testCorrectness[T : Ordering](n: Int, mkKey: Int => T) {
+ val o = implicitly[Ordering[T]]
+ val s = HashSet.empty[T] ++ (0 until n).map(mkKey)
+ for (i <- 0 until n) {
+ val ki = mkKey(i)
+ val a = s.filter(o.lt(_,ki))
+ val b = s.filterNot(o.lt(_,ki))
+ require(a.size == i && (0 until i).forall(i => a.contains(mkKey(i))))
+ require(b.size == n - i && (i until n).forall(i => b.contains(mkKey(i))))
+ }
+ }
+
+ // this tests the structural sharing of the new filter
+ // I could not come up with a simple test that tests structural sharing when only parts are reused, but
+ // at least this fails with the old and passes with the new implementation
+ def testSharing() {
+ val s = HashSet.empty[Int] ++ (0 until 100)
+ require(s.filter(_ => true) eq s)
+ require(s.filterNot(_ => false) eq s)
+ }
+
+ // this tests that neither hashCode nor equals are called during filter
+ def testNoHashing() {
+ var hashCount = 0
+ var equalsCount = 0
+ case class HashCounter(value:Int) extends Ordered[HashCounter] {
+ def compare(that:HashCounter) = value compare that.value
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+
+ override def equals(that:Any) = {
+ equalsCount += 1
+ that match {
+ case HashCounter(value) => this.value == value
+ case _ => false
+ }
+ }
+ }
+
+ val s = HashSet.empty[HashCounter] ++ (0 until 100).map(HashCounter)
+ val hashCount0 = hashCount
+ val equalsCount0 = equalsCount
+ val t = s.filter(_<HashCounter(50))
+ require(hashCount == hashCount0)
+ require(equalsCount == equalsCount0)
+ }
+
+ // this tests correctness of filter and filterNot for integer keys
+ testCorrectness[Int](100, identity _)
+ // this tests correctness of filter and filterNot for keys with lots of collisions
+ // this is necessary because usually collisions are rare so the collision-related code is not thoroughly tested
+ testCorrectness[Collision](100, Collision.apply _)
+ testSharing()
+ testNoHashing()
+}
diff --git a/test/files/run/t6197.check b/test/files/run/t6197.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t6197.check
+++ /dev/null
diff --git a/test/files/run/t6198.check b/test/files/run/t6198.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t6198.check
+++ /dev/null
diff --git a/test/files/run/t6199-mirror.scala b/test/files/run/t6199-mirror.scala
index 772a384542..3fda56bf7c 100644
--- a/test/files/run/t6199-mirror.scala
+++ b/test/files/run/t6199-mirror.scala
@@ -3,5 +3,5 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class C { def foo = () }
- println(cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)())
+ println(cm.reflect(new C).reflectMethod(typeOf[C].member(TermName("foo")).asMethod)())
} \ No newline at end of file
diff --git a/test/files/run/t6199-toolbox.scala b/test/files/run/t6199-toolbox.scala
index 89015f5878..6ba5e50f66 100644
--- a/test/files/run/t6199-toolbox.scala
+++ b/test/files/run/t6199-toolbox.scala
@@ -4,5 +4,5 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val tb = cm.mkToolBox()
- println(tb.eval(Literal(Constant(()))))
+ println(tb.eval(q"()"))
} \ No newline at end of file
diff --git a/test/files/run/t6200.scala b/test/files/run/t6200.scala
new file mode 100644
index 0000000000..75600cd557
--- /dev/null
+++ b/test/files/run/t6200.scala
@@ -0,0 +1,68 @@
+import scala.collection.immutable.HashMap
+
+object Test extends App {
+
+ case class Collision(value: Int) extends Ordered[Collision] {
+ def compare(that: Collision) = value compare that.value
+
+ override def hashCode = value / 5
+ }
+
+ def testCorrectness[T: Ordering](n: Int, mkKey: Int => T) {
+ val o = implicitly[Ordering[T]]
+ val s = HashMap.empty[T, Unit] ++ (0 until n).map(x => mkKey(x) -> (()))
+ for (i <- 0 until n) {
+ val ki = mkKey(i)
+ val a = s.filter(kv => o.lt(kv._1, ki))
+ val b = s.filterNot(kv => o.lt(kv._1, ki))
+ require(a.size == i && (0 until i).forall(i => a.contains(mkKey(i))))
+ require(b.size == n - i && (i until n).forall(i => b.contains(mkKey(i))))
+ }
+ }
+
+ // this tests the structural sharing of the new filter
+ // I could not come up with a simple test that tests structural sharing when only parts are reused, but
+ // at least this fails with the old and passes with the new implementation
+ def testSharing() {
+ val s = HashMap.empty[Int, Unit] ++ (0 until 100).map(_ -> (()))
+ require(s.filter(_ => true) eq s)
+ require(s.filterNot(_ => false) eq s)
+ }
+
+ // this tests that neither hashCode nor equals are called during filter
+ def testNoHashing() {
+ var hashCount = 0
+ var equalsCount = 0
+ case class HashCounter(value: Int) extends Ordered[HashCounter] {
+ def compare(that: HashCounter) = value compare that.value
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+
+ override def equals(that: Any) = {
+ equalsCount += 1
+ that match {
+ case HashCounter(value) => this.value == value
+ case _ => false
+ }
+ }
+ }
+
+ val s = HashMap.empty[HashCounter, Unit] ++ (0 until 100).map(k => HashCounter(k) -> (()))
+ val hashCount0 = hashCount
+ val equalsCount0 = equalsCount
+ val t = s.filter(_._1 < HashCounter(50))
+ require(hashCount == hashCount0)
+ require(equalsCount == equalsCount0)
+ }
+
+ // this tests correctness of filter and filterNot for integer keys
+ testCorrectness[Int](100, identity _)
+ // this tests correctness of filter and filterNot for keys with lots of collisions
+ // this is necessary because usually collisions are rare so the collision-related code is not thoroughly tested
+ testCorrectness[Collision](100, Collision.apply _)
+ testSharing()
+ testNoHashing()
+}
diff --git a/test/files/run/t6221.check b/test/files/run/t6221.check
new file mode 100644
index 0000000000..aa1bdd0e6e
--- /dev/null
+++ b/test/files/run/t6221.check
@@ -0,0 +1 @@
+((x) => x.$percent(2).$eq$eq(0))
diff --git a/test/files/run/t6221/Macros_1.scala b/test/files/run/t6221/Macros_1.scala
new file mode 100644
index 0000000000..0aeaa00c86
--- /dev/null
+++ b/test/files/run/t6221/Macros_1.scala
@@ -0,0 +1,23 @@
+import language.experimental.macros
+import language.implicitConversions
+import scala.reflect.macros.blackbox.Context
+import scala.reflect.runtime.universe.Tree
+
+class ReflectiveClosure[A, B](val tree: Tree, fn: A => B) extends (A => B) {
+ def apply(x: A) = fn(x)
+}
+
+object ReflectiveClosure {
+ implicit def reflectClosure[A, B](f: A => B): ReflectiveClosure[A, B] = macro Macros.reflectiveClosureImpl[A, B]
+}
+
+object Macros {
+ def reflectiveClosureImpl[A, B](c: Context)(f: c.Expr[A => B]): c.Expr[ReflectiveClosure[A, B]] = {
+ import c.universe._
+ import internal._
+ val u = gen.mkRuntimeUniverseRef
+ val m = EmptyTree
+ val tree = c.Expr[scala.reflect.runtime.universe.Tree](Select(c.reifyTree(u, m, f.tree), newTermName("tree")))
+ c.universe.reify(new ReflectiveClosure(tree.splice, f.splice))
+ }
+}
diff --git a/test/files/run/t6221/Test_2.scala b/test/files/run/t6221/Test_2.scala
new file mode 100644
index 0000000000..9f6b2280a7
--- /dev/null
+++ b/test/files/run/t6221/Test_2.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ implicit class PimpedList[T](val list: List[T]) {
+ def query(predicate: ReflectiveClosure[T, Boolean]): List[T] = {
+ println(predicate.tree)
+ list filter predicate
+ }
+ }
+
+ List(1, 2, 3).query(x => x % 2 == 0)
+} \ No newline at end of file
diff --git a/test/files/run/t6223.check b/test/files/run/t6223.check
index f83799bab1..4a09d1930f 100644
--- a/test/files/run/t6223.check
+++ b/test/files/run/t6223.check
@@ -1,4 +1,4 @@
bar
bar$mIc$sp
bar$mIcI$sp
-bar$mcI$sp \ No newline at end of file
+bar$mcI$sp
diff --git a/test/files/run/t6240-universe-code-gen.scala b/test/files/run/t6240-universe-code-gen.scala
new file mode 100644
index 0000000000..9f7061ee1b
--- /dev/null
+++ b/test/files/run/t6240-universe-code-gen.scala
@@ -0,0 +1,82 @@
+import scala.tools.partest.nest.FileManager._
+
+object Test extends App {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+ import u._
+
+ val JavaUniverseTpe = typeOf[reflect.runtime.JavaUniverse]
+ val DefinitionsModule = JavaUniverseTpe.member(TermName("definitions"))
+
+ def forceCode(prefix: String, tp: Type): String = {
+ def isLazyAccessorOrObject(sym: Symbol) = (
+ (sym.isMethod && sym.asMethod.isLazy)
+ || sym.isModule
+ )
+ val forcables = tp.members.sorted.filter(isLazyAccessorOrObject)
+ forcables.map {
+ sym =>
+ val path = s"$prefix.${sym.name}"
+ " " + (
+ if (sym.isPrivate || sym.isProtected) s"// inaccessible: $path"
+ else path
+ )
+ }.mkString("\n")
+ }
+
+ val code =
+ s"""|// Generated Code, validated by run/t6240-universe-code-gen.scala
+ |package scala.reflect
+ |package runtime
+ |
+ |trait JavaUniverseForce { self: runtime.JavaUniverse =>
+ | def force() {
+ | Literal(Constant(42)).duplicate
+ | nme.flattenedName()
+ | nme.raw
+ | WeakTypeTag
+ | TypeTag
+ | TypeTag.Byte.tpe
+ | TypeTag.Short.tpe
+ | TypeTag.Char.tpe
+ | TypeTag.Int.tpe
+ | TypeTag.Long.tpe
+ | TypeTag.Float.tpe
+ | TypeTag.Double.tpe
+ | TypeTag.Boolean.tpe
+ | TypeTag.Unit.tpe
+ | TypeTag.Any.tpe
+ | TypeTag.AnyVal.tpe
+ | TypeTag.AnyRef.tpe
+ | TypeTag.Object.tpe
+ | TypeTag.Nothing.tpe
+ | TypeTag.Null.tpe
+ |
+ |${forceCode("this", JavaUniverseTpe)}
+ |${forceCode("definitions", DefinitionsModule.info)}
+ |${forceCode("refChecks", typeOf[scala.reflect.internal.transform.RefChecks])}
+ |${forceCode("uncurry", typeOf[scala.reflect.internal.transform.UnCurry])}
+ |${forceCode("erasure", typeOf[scala.reflect.internal.transform.Erasure])}
+ | }
+ |}""".stripMargin
+
+ import java.io.File
+ val testFile = new File(sys.props("partest.test-path"))
+ val actualFile = new java.io.File(testFile.getParent + "/../../../src/reflect/scala/reflect/runtime/JavaUniverseForce.scala").getCanonicalFile
+ val actual = scala.io.Source.fromFile(actualFile)
+ val actualLines = actual.getLines.toList
+ val generatedLines = code.lines.toList
+ if (actualLines != generatedLines) {
+ val msg = s"""|${actualFile} must be updated.
+ |===========================================================
+ | DIFF:
+ |===========================================================
+ |${compareContents(actualLines, generatedLines)}
+ |===========================================================
+ | NEW CONTENTS:
+ |===========================================================
+ |${code}""".stripMargin
+
+ assert(false, msg)
+ }
+}
diff --git a/test/files/run/t6240a.check b/test/files/run/t6240a.check
new file mode 100644
index 0000000000..29f695b6f4
--- /dev/null
+++ b/test/files/run/t6240a.check
@@ -0,0 +1 @@
+StepTwo.type
diff --git a/test/files/run/t6240a/StepOne.java b/test/files/run/t6240a/StepOne.java
new file mode 100644
index 0000000000..342d617c79
--- /dev/null
+++ b/test/files/run/t6240a/StepOne.java
@@ -0,0 +1,41 @@
+import java.io.File;
+import java.io.IOException;
+import java.lang.ClassNotFoundException;
+import java.lang.NoSuchMethodException;
+import java.lang.IllegalAccessException;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.MalformedURLException;
+
+public class StepOne {
+ public static void main(String[] args)
+ throws MalformedURLException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IOException {
+ String[] launchPaths = System.getProperty("launch.classpath").split(File.pathSeparator);
+
+ // move away StepThree
+ File tempDir = File.createTempFile("temp", Long.toString(System.nanoTime()));
+ System.setProperty("launch.step.three", tempDir.getAbsolutePath());
+ tempDir.delete();
+ tempDir.mkdir();
+ File[] testClasses = new File(launchPaths[0]).listFiles();
+ for (int i = 0; i < testClasses.length; i++) {
+ File testClass = testClasses[i];
+ if (testClass.getPath().contains("StepThree")) {
+ File testClassMoved = new File(tempDir.getAbsolutePath() + "/" + testClass.getName());
+ testClass.renameTo(testClassMoved);
+ }
+ }
+
+ // launch StepTwo
+ URL[] launchURLs = new URL[launchPaths.length];
+ for (int i = 0; i < launchPaths.length; i++) {
+ launchURLs[i] = new File(launchPaths[i]).toURL();
+ }
+ URLClassLoader classLoader = new URLClassLoader(launchURLs, Object.class.getClassLoader());
+ Class<?> stepTwo = classLoader.loadClass("StepTwo");
+ Method main = stepTwo.getDeclaredMethod("main", String[].class);
+ main.invoke(null, (Object)(new String[]{}));
+ }
+}
diff --git a/test/files/run/t6240a/StepTwo.scala b/test/files/run/t6240a/StepTwo.scala
new file mode 100644
index 0000000000..fc3221921d
--- /dev/null
+++ b/test/files/run/t6240a/StepTwo.scala
@@ -0,0 +1,7 @@
+import java.io.File
+import java.net.URLClassLoader
+
+object StepTwo extends App {
+ import scala.reflect.runtime.universe._
+ println(typeOf[StepTwo.type])
+} \ No newline at end of file
diff --git a/test/files/run/t6240a/Test.scala b/test/files/run/t6240a/Test.scala
new file mode 100644
index 0000000000..05c3678cbe
--- /dev/null
+++ b/test/files/run/t6240a/Test.scala
@@ -0,0 +1,15 @@
+import java.io.File
+import scala.sys.process._
+
+object Test extends App {
+ def prop(key: String) = {
+ val value = System.getProperties.getProperty(key)
+ assert(value != null, key)
+ value
+ }
+ val testClassesDir = prop("partest.output")
+ assert(new File(testClassesDir).exists, testClassesDir)
+ val fullTestClassesClasspath = testClassesDir + prop("path.separator") + prop("java.class.path")
+ val javaBinary = if (new File(prop("javacmd")).isAbsolute) prop("javacmd") else prop("java.home") + "/bin/" + prop("javacmd")
+ List(javaBinary, "-cp", testClassesDir, "-Dlaunch.classpath=" + fullTestClassesClasspath, "StepOne").!
+} \ No newline at end of file
diff --git a/test/files/run/t6240b.check b/test/files/run/t6240b.check
new file mode 100644
index 0000000000..255836105a
--- /dev/null
+++ b/test/files/run/t6240b.check
@@ -0,0 +1 @@
+StepThree.type
diff --git a/test/files/run/t6240b/StepOne.java b/test/files/run/t6240b/StepOne.java
new file mode 100644
index 0000000000..342d617c79
--- /dev/null
+++ b/test/files/run/t6240b/StepOne.java
@@ -0,0 +1,41 @@
+import java.io.File;
+import java.io.IOException;
+import java.lang.ClassNotFoundException;
+import java.lang.NoSuchMethodException;
+import java.lang.IllegalAccessException;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.MalformedURLException;
+
+public class StepOne {
+ public static void main(String[] args)
+ throws MalformedURLException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IOException {
+ String[] launchPaths = System.getProperty("launch.classpath").split(File.pathSeparator);
+
+ // move away StepThree
+ File tempDir = File.createTempFile("temp", Long.toString(System.nanoTime()));
+ System.setProperty("launch.step.three", tempDir.getAbsolutePath());
+ tempDir.delete();
+ tempDir.mkdir();
+ File[] testClasses = new File(launchPaths[0]).listFiles();
+ for (int i = 0; i < testClasses.length; i++) {
+ File testClass = testClasses[i];
+ if (testClass.getPath().contains("StepThree")) {
+ File testClassMoved = new File(tempDir.getAbsolutePath() + "/" + testClass.getName());
+ testClass.renameTo(testClassMoved);
+ }
+ }
+
+ // launch StepTwo
+ URL[] launchURLs = new URL[launchPaths.length];
+ for (int i = 0; i < launchPaths.length; i++) {
+ launchURLs[i] = new File(launchPaths[i]).toURL();
+ }
+ URLClassLoader classLoader = new URLClassLoader(launchURLs, Object.class.getClassLoader());
+ Class<?> stepTwo = classLoader.loadClass("StepTwo");
+ Method main = stepTwo.getDeclaredMethod("main", String[].class);
+ main.invoke(null, (Object)(new String[]{}));
+ }
+}
diff --git a/test/files/run/t6240b/StepThree.scala b/test/files/run/t6240b/StepThree.scala
new file mode 100644
index 0000000000..210795d68f
--- /dev/null
+++ b/test/files/run/t6240b/StepThree.scala
@@ -0,0 +1,4 @@
+object StepThree extends App {
+ import scala.reflect.runtime.universe._
+ println(typeOf[StepThree.type])
+} \ No newline at end of file
diff --git a/test/files/run/t6240b/StepTwo.scala b/test/files/run/t6240b/StepTwo.scala
new file mode 100644
index 0000000000..88e46492e3
--- /dev/null
+++ b/test/files/run/t6240b/StepTwo.scala
@@ -0,0 +1,10 @@
+import java.io.File
+import java.net.URLClassLoader
+
+object StepTwo extends App {
+ val classes = new File(System.getProperty("launch.step.three"))
+ val cl = new URLClassLoader(Array(classes.toURI.toURL), getClass.getClassLoader)
+ val stepThree = cl.loadClass("StepThree")
+ val main = stepThree.getDeclaredMethod("main", classOf[Array[String]])
+ main.invoke(null, Array[String]())
+} \ No newline at end of file
diff --git a/test/files/run/t6240b/Test.scala b/test/files/run/t6240b/Test.scala
new file mode 100644
index 0000000000..05c3678cbe
--- /dev/null
+++ b/test/files/run/t6240b/Test.scala
@@ -0,0 +1,15 @@
+import java.io.File
+import scala.sys.process._
+
+object Test extends App {
+ def prop(key: String) = {
+ val value = System.getProperties.getProperty(key)
+ assert(value != null, key)
+ value
+ }
+ val testClassesDir = prop("partest.output")
+ assert(new File(testClassesDir).exists, testClassesDir)
+ val fullTestClassesClasspath = testClassesDir + prop("path.separator") + prop("java.class.path")
+ val javaBinary = if (new File(prop("javacmd")).isAbsolute) prop("javacmd") else prop("java.home") + "/bin/" + prop("javacmd")
+ List(javaBinary, "-cp", testClassesDir, "-Dlaunch.classpath=" + fullTestClassesClasspath, "StepOne").!
+} \ No newline at end of file
diff --git a/test/files/run/t6246.scala b/test/files/run/t6246.scala
index 28765e1adf..2db87aa6d2 100644
--- a/test/files/run/t6246.scala
+++ b/test/files/run/t6246.scala
@@ -1,5 +1,6 @@
import scala.reflect.{ClassTag, classTag}
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
def testValueClass(tag: ClassTag[_]) {
println(s"runtimeClass = ${tag.runtimeClass}, toString = ${tag.toString}")
@@ -23,4 +24,4 @@ object Test extends App {
testValueClass(ClassTag.Double)
testValueClass(ClassTag.Unit)
testValueClass(ClassTag.Boolean)
-} \ No newline at end of file
+}
diff --git a/test/files/run/t6253a.scala b/test/files/run/t6253a.scala
new file mode 100644
index 0000000000..efa3230df6
--- /dev/null
+++ b/test/files/run/t6253a.scala
@@ -0,0 +1,64 @@
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ var hashCount = 0
+
+ /**
+ * A key that produces lots of hash collisions, to exercise the part of the code that deals with those
+ */
+ case class Collision(value: Int) {
+
+ override def hashCode = {
+ // we do not check hash counts for Collision keys because ListSet.++ uses a mutable hashset internally,
+ // so when we have hash collisions, union will call key.hashCode.
+ // hashCount += 1
+ value / 5
+ }
+ }
+
+ /**
+ * A key that is identical to int other than that it counts hashCode invocations
+ */
+ case class HashCounter(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+ }
+
+ def testUnion[T](sizes: Seq[Int], offsets: Seq[Double], keyType: String, mkKey: Int => T) {
+ for {
+ i <- sizes
+ o <- offsets
+ } {
+ val e = HashSet.empty[T]
+ val j = (i * o).toInt
+ // create two sets of size i with overlap o
+ val a = e ++ (0 until i).map(mkKey)
+ require(a.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val b = e ++ (j until (i + j)).map(mkKey)
+ require(b.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val as = e ++ (0 until j).map(mkKey)
+ require(as.size == j, s"Building HashSet of size $j failed. Key type $keyType.")
+ val hashCount0 = hashCount
+ val u = a union b
+ require(hashCount == hashCount0, s"key.hashCode should not be called, but has been called ${hashCount - hashCount0} times. Key type $keyType.")
+ require(u == (a union scala.collection.mutable.HashSet(b.toSeq: _*)), s"Operation must still work for other sets!")
+ require(u.size == i + j, s"Expected size ${i+j}. Real size ${u.size}. Key type $keyType.")
+ for (x <- 0 until i + j)
+ require(u.contains(mkKey(x)), s"Key type $keyType. Set (0 until ${i + j}) should contain $x but does not.")
+ val a_as = a union as
+ val as_a = as union a
+ require((a_as eq a) || (a_as eq as), s"No structural sharing in a union as. Key type $keyType, a=(0 until $i) as=(0 until $j)")
+ require((as_a eq a) || (as_a eq as), s"No structural sharing in as union a. Key type $keyType, a=(0 until $i) as=(0 until $j)")
+ }
+ }
+
+ val sizes = Seq(1, 10, 100, 1000, 10000, 100000)
+ val offsets = Seq(0.0, 0.25, 0.5, 0.75, 1.0)
+ testUnion(sizes, offsets, "int", identity[Int])
+ testUnion(sizes, offsets, "hashcounter", HashCounter.apply)
+ testUnion(sizes, offsets, "collision", Collision.apply)
+}
diff --git a/test/files/run/t6253b.scala b/test/files/run/t6253b.scala
new file mode 100644
index 0000000000..9cbfefd49e
--- /dev/null
+++ b/test/files/run/t6253b.scala
@@ -0,0 +1,62 @@
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ var hashCount = 0
+
+ /**
+ * A key that produces lots of hash collisions, to exercise the part of the code that deals with those
+ */
+ case class Collision(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value / 5
+ }
+ }
+
+ /**
+ * A key that is identical to int other than that it counts hashCode invocations
+ */
+ case class HashCounter(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+ }
+
+ def testIntersect[T](sizes: Seq[Int], offsets: Seq[Double], keyType: String, mkKey: Int => T) {
+ for {
+ i <- sizes
+ o <- offsets
+ } {
+ val e = HashSet.empty[T]
+ val j = (i * o).toInt
+ // create two sets of size i with overlap o
+ val a = e ++ (0 until i).map(mkKey)
+ require(a.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val b = e ++ (j until (i + j)).map(mkKey)
+ require(b.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val as = e ++ (0 until j).map(mkKey)
+ require(as.size == j, s"Building HashSet of size $j failed. Key type $keyType.")
+ val hashCount0 = hashCount
+ val u = a intersect b
+ require(hashCount == hashCount0, s"key.hashCode should not be called, but has been called ${hashCount - hashCount0} times. Key type $keyType.")
+ require(u == (a intersect scala.collection.mutable.HashSet(b.toSeq: _*)), s"Operation must still work for other sets!")
+ require(u.size == i - j, s"Expected size ${i + j}. Real size ${u.size}. Key type $keyType.")
+ for (x <- j until i)
+ require(u.contains(mkKey(x)), s"Key type $keyType. Set (0 until ${i + j}) should contain $x but does not.")
+ val a_as = a intersect as
+ val as_a = as intersect a
+ require((a_as eq as) || (a_as eq a), s"No structural sharing in a intersect as. Key type $keyType, a=(0 until $i) as=(0 until $j)")
+ require((as_a eq as) || (as_a eq a), s"No structural sharing in as intersect a. Key type $keyType, a=(0 until $i) as=(0 until $j)")
+ }
+ }
+
+ val sizes = Seq(1, 10, 100, 1000, 10000, 100000)
+ val offsets = Seq(0.0, 0.25, 0.5, 0.75, 1.0)
+ testIntersect(sizes, offsets, "int", identity[Int])
+ testIntersect(sizes, offsets, "hashcounter", HashCounter.apply)
+ testIntersect(sizes, offsets, "collision", Collision.apply)
+}
diff --git a/test/files/run/t6253c.scala b/test/files/run/t6253c.scala
new file mode 100644
index 0000000000..71dfe1473e
--- /dev/null
+++ b/test/files/run/t6253c.scala
@@ -0,0 +1,63 @@
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ var hashCount = 0
+
+ /**
+ * A key that produces lots of hash collisions, to exercise the part of the code that deals with those
+ */
+ case class Collision(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value / 5
+ }
+ }
+
+ /**
+ * A key that is identical to int other than that it counts hashCode invocations
+ */
+ case class HashCounter(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+ }
+
+ def testDiff[T](sizes: Seq[Int], offsets: Seq[Double], keyType: String, mkKey: Int => T) {
+ for {
+ i <- sizes
+ o <- offsets
+ } {
+ val e = HashSet.empty[T]
+ val j = (i * o).toInt
+ // create two sets of size i with overlap o
+ val a = e ++ (0 until i).map(mkKey)
+ require(a.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val b = e ++ (j until (i + j)).map(mkKey)
+ require(b.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val as = e ++ (0 until j).map(mkKey)
+ require(as.size == j, s"Building HashSet of size $j failed. Key type $keyType.")
+ val hashCount0 = hashCount
+ val u = a diff b
+ require(hashCount == hashCount0, s"key.hashCode should not be called, but has been called ${hashCount - hashCount0} times. Key type $keyType.")
+ require(u == (a diff scala.collection.mutable.HashSet(b.toSeq: _*)), s"Operation must still work for other sets!")
+ require(u.size == j, s"Expected size $j. Real size ${u.size}. Key type $keyType.")
+ for (x <- 0 until j)
+ require(u.contains(mkKey(x)), s"Key type $keyType. Set (0 until ${i + j}) should contain $x but does not.")
+ require((as intersect b).isEmpty)
+ val b_as = b diff as
+ val as_b = as diff b
+ require((b_as eq b) || (b_as eq as), s"No structural sharing in b diff as. Key type $keyType, b=($j until ${i + j}) as=(0 until $j)")
+ require((as_b eq b) || (as_b eq as), s"No structural sharing in as diff b. Key type $keyType, b=($j until ${i + j}) as=(0 until $j)")
+ }
+ }
+
+ val sizes = Seq(1, 10, 100, 1000, 10000, 100000)
+ val offsets = Seq(0.0, 0.25, 0.5, 0.75, 1.0)
+ testDiff(sizes, offsets, "int", identity[Int])
+ testDiff(sizes, offsets, "hashCounter", HashCounter.apply)
+ testDiff(sizes, offsets, "collision", Collision.apply)
+}
diff --git a/test/files/run/t6259.scala b/test/files/run/t6259.scala
index 294c95e96b..b2c27df51f 100644
--- a/test/files/run/t6259.scala
+++ b/test/files/run/t6259.scala
@@ -37,9 +37,9 @@ object Early extends {
class DoubleTrouble[X](x: AnyRef)(implicit override val tt: TypeTag[X]) extends A[X]
object DoubleOk extends DoubleTrouble[String]({
- // Drops to this.getClass and is an issue
- object InnerTrouble extends A[String];
- InnerTrouble
+ // Drops to this.getClass and is an issue
+ object InnerTrouble extends A[String];
+ InnerTrouble
})
object Test extends App {
diff --git a/test/files/run/t6260-delambdafy.check b/test/files/run/t6260-delambdafy.check
new file mode 100644
index 0000000000..b2a7bed988
--- /dev/null
+++ b/test/files/run/t6260-delambdafy.check
@@ -0,0 +1,4 @@
+f(C@2e)
+
+Test$lambda$1$$apply
+apply
diff --git a/test/files/run/t6260-delambdafy.flags b/test/files/run/t6260-delambdafy.flags
new file mode 100644
index 0000000000..48b438ddf8
--- /dev/null
+++ b/test/files/run/t6260-delambdafy.flags
@@ -0,0 +1 @@
+-Ydelambdafy:method
diff --git a/test/files/run/t6260-delambdafy.scala b/test/files/run/t6260-delambdafy.scala
new file mode 100644
index 0000000000..056b1edd4e
--- /dev/null
+++ b/test/files/run/t6260-delambdafy.scala
@@ -0,0 +1,12 @@
+class C[A](private val a: Any) extends AnyVal
+
+object Test {
+ val f = (x: C[Any]) => {println(s"f($x)"); x}
+ def main(args: Array[String]) {
+ f(new C("."))
+ val methods = f.getClass.getDeclaredMethods.map(_.getName).sorted
+ println("")
+ println(methods.mkString("\n"))
+ }
+}
+
diff --git a/test/files/run/t6260b.scala b/test/files/run/t6260b.scala
new file mode 100644
index 0000000000..dd2cf4bc4e
--- /dev/null
+++ b/test/files/run/t6260b.scala
@@ -0,0 +1,13 @@
+class C[A](val a: A) extends AnyVal
+
+class DD {
+ def foo(c: C[String]) = ()
+ def bar[A <: String](c: C[A]) = ()
+ def baz[A](c: C[A]) = ()
+}
+
+object Test extends App {
+ classOf[DD].getMethod("foo", classOf[String])
+ classOf[DD].getMethod("bar", classOf[String])
+ classOf[DD].getMethod("baz", classOf[Object])
+}
diff --git a/test/files/run/t6260c.check b/test/files/run/t6260c.check
new file mode 100644
index 0000000000..1a57f2d741
--- /dev/null
+++ b/test/files/run/t6260c.check
@@ -0,0 +1,5 @@
+f(C@2e)
+
+Test$$anonfun$$apply
+apply
+g(C@2e)
diff --git a/test/files/run/t6260c.scala b/test/files/run/t6260c.scala
new file mode 100644
index 0000000000..845dc157b7
--- /dev/null
+++ b/test/files/run/t6260c.scala
@@ -0,0 +1,17 @@
+class C[A](private val a: Any) extends AnyVal
+
+object Test {
+ val f = (x: C[Any]) => {println(s"f($x)"); x}
+ trait T[A] {
+ def apply(a: A): A
+ }
+ val g = new T[C[Any]] { def apply(a: C[Any]) = { println(s"g($a)"); a } }
+ def main(args: Array[String]) {
+ f(new C("."))
+ val methods = f.getClass.getDeclaredMethods.map(_.getName).sorted
+ println("")
+ println(methods.mkString("\n"))
+ g.apply(new C("."))
+ }
+}
+
diff --git a/test/files/run/t6261.scala b/test/files/run/t6261.scala
index b4463256c9..bf6d640de3 100644
--- a/test/files/run/t6261.scala
+++ b/test/files/run/t6261.scala
@@ -2,12 +2,6 @@ import scala.collection.immutable._
object Test extends App {
- def test0() {
- val m=ListMap(1->2,3->4)
- if(m.tail ne m.tail)
- println("ListMap.tail uses a builder, so it is not O(1)")
- }
-
def test1() {
// test that a HashTrieMap with one leaf element is not created!
val x = HashMap.empty + (1->1) + (2->2)
@@ -92,7 +86,6 @@ object Test extends App {
// StructureTests.printStructure(z)
require(z.size == 2 && z.contains(a._1) && z.contains(c._1))
}
- test0()
test1()
test2()
test3()
diff --git a/test/files/run/t6273.check b/test/files/run/t6273.check
index c1c18daac2..bef0b227d2 100644
--- a/test/files/run/t6273.check
+++ b/test/files/run/t6273.check
@@ -1,19 +1,15 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> val y = 55
y: Int = 55
scala> val x = s"""
y = $y
"""
-x: String =
+x: String =
"
y = 55
"
scala>
-
-scala>
diff --git a/test/files/run/t6288.check b/test/files/run/t6288.check
index e940975e44..a032a10de6 100644
--- a/test/files/run/t6288.check
+++ b/test/files/run/t6288.check
@@ -1,8 +1,8 @@
[[syntax trees at end of patmat]] // newSource1.scala
[7]package [7]<empty> {
[7]object Case3 extends [13][106]scala.AnyRef {
- [13]def <init>(): [13]Case3.type = [13]{
- [13][13][13]Case3.super.<init>();
+ [106]def <init>(): [13]Case3.type = [106]{
+ [106][106][106]Case3.super.<init>();
[13]()
};
[21]def unapply([29]z: [32]<type: [32]scala.Any>): [21]Option[Int] = [56][52][52]scala.Some.apply[[52]Int]([58]-1);
@@ -24,8 +24,8 @@
}
};
[113]object Case4 extends [119][217]scala.AnyRef {
- [119]def <init>(): [119]Case4.type = [119]{
- [119][119][119]Case4.super.<init>();
+ [217]def <init>(): [119]Case4.type = [217]{
+ [217][217][217]Case4.super.<init>();
[119]()
};
[127]def unapplySeq([138]z: [141]<type: [141]scala.Any>): [127]Option[List[Int]] = [167]scala.None;
@@ -50,8 +50,8 @@
}
};
[224]object Case5 extends [230][312]scala.AnyRef {
- [230]def <init>(): [230]Case5.type = [230]{
- [230][230][230]Case5.super.<init>();
+ [312]def <init>(): [230]Case5.type = [312]{
+ [312][312][312]Case5.super.<init>();
[230]()
};
[238]def unapply([246]z: [249]<type: [249]scala.Any>): [238]Boolean = [265]true;
@@ -60,7 +60,7 @@
[273]case5()[293]{
[293]<synthetic> val o7: [293]Option[List[Int]] = [293][293]Case4.unapplySeq([293]x1);
[293]if ([293]o7.isEmpty.unary_!)
- [293]if ([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([195]0)))
+ [293]if ([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([293]0)))
[304][304]matchEnd4([304]())
else
[293][293]case6()
diff --git a/test/files/run/t6288b-jump-position.check b/test/files/run/t6288b-jump-position.check
index 83ba810958..ece88b18f0 100644
--- a/test/files/run/t6288b-jump-position.check
+++ b/test/files/run/t6288b-jump-position.check
@@ -65,9 +65,9 @@ object Case3 extends Object {
blocks: [1]
1:
- 1 THIS(Case3)
- 1 CALL_METHOD java.lang.Object.<init> (super())
- 1 RETURN(UNIT)
+ 12 THIS(Case3)
+ 12 CALL_METHOD java.lang.Object.<init> (super())
+ 12 RETURN(UNIT)
}
Exception handlers:
diff --git a/test/files/run/t6288b-jump-position.scala b/test/files/run/t6288b-jump-position.scala
index e22a1ab120..c5f3bbe788 100644
--- a/test/files/run/t6288b-jump-position.scala
+++ b/test/files/run/t6288b-jump-position.scala
@@ -1,6 +1,6 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
override def code =
"""object Case3 { // 01
| def unapply(z: Any): Option[Int] = Some(-1) // 02
@@ -15,8 +15,5 @@ object Test extends IcodeTest {
| }
|}""".stripMargin
- override def show() {
- val lines1 = collectIcode("")
- println(lines1 mkString "\n")
- }
+ override def show() = showIcode()
}
diff --git a/test/files/run/t6292.check b/test/files/run/t6292.check
new file mode 100644
index 0000000000..6232ba7519
--- /dev/null
+++ b/test/files/run/t6292.check
@@ -0,0 +1 @@
+warning: there were 7 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t6308.check b/test/files/run/t6308.check
new file mode 100644
index 0000000000..e2577db72a
--- /dev/null
+++ b/test/files/run/t6308.check
@@ -0,0 +1,16 @@
+- Unspecialized type args
+// Specialized
+f1 f1$mIc$sp
+f2 f2$mIc$sp
+f3 f3$mIc$sp
+f4 f4$mIc$sp
+f5 f5$mIc$sp
+
+// Unspecialized type args
+f4(Boolean) f4
+f4(String) f4
+
+// Ideally these would be specialized
+todo1 todo1
+todo2 todo2
+todo3 todo3
diff --git a/test/files/run/t6308.scala b/test/files/run/t6308.scala
new file mode 100644
index 0000000000..d23cd6e13e
--- /dev/null
+++ b/test/files/run/t6308.scala
@@ -0,0 +1,45 @@
+import scala.{specialized => sp}
+
+// NOTE: `{ val c = caller; print(""); c }` is used instead of a simple `caller`,
+// because we want to prevent tail-call optimization from eliding the stack-
+// frames we want to inspect.
+
+object Test {
+ def caller = new Exception().getStackTrace()(1).getMethodName
+ def f1[@sp(Int) A](a: A, b: Any) = { val c = caller; print(""); c }
+ def f2[@sp(Int) A, B](a: A, b: String) = { val c = caller; print(""); c }
+ def f3[B, @sp(Int) A](a: A, b: List[B]) = { val c = caller; print(""); c }
+ def f4[B, @sp(Int) A](a: A, b: List[(A, B)]) = { val c = caller; print(""); c }
+
+ def f5[@sp(Int) A, B <: Object](a: A, b: B) = { val c = caller; print(""); c }
+
+ // `uncurryTreeType` calls a TypeMap on the call to this method and we end up with new
+ // type parameter symbols, which are not found in `TypeEnv.includes(typeEnv(member), env)`
+ // in `specSym`. (One of `uncurry`'s tasks is to expand type aliases in signatures.)
+ type T = Object
+ def todo1[@sp(Int) A, B <: T](a: A, b: String) = { val c = caller; print(""); c }
+ def todo2[@sp(Int) A, B <: AnyRef](a: A, b: String) = { val c = caller; print(""); c }
+ def todo3[B <: List[A], @specialized(Int) A](a: A, b: B) = { val c = caller; print(""); c }
+
+ def main(args: Array[String]) {
+ val s = ""
+ val result =
+ s"""|- Unspecialized type args
+ |// Specialized
+ |f1 ${f1(1,"some ref")}
+ |f2 ${f2(1,"some ref")}
+ |f3 ${f3(1,List("some ref"))}
+ |f4 ${f4(1,Nil)}
+ |f5 ${f5(1,s)}
+ |
+ |// Unspecialized type args
+ |f4(Boolean) ${f4(Boolean,Nil)}
+ |f4(String) ${f4("",Nil)}
+ |
+ |// Ideally these would be specialized
+ |todo1 ${todo1(1,s)}
+ |todo2 ${todo2(1,s)}
+ |todo3 ${todo3(1,List(0))}""".stripMargin
+ println(result)
+ }
+}
diff --git a/test/files/run/t6309.check b/test/files/run/t6309.check
new file mode 100644
index 0000000000..7f8f011eb7
--- /dev/null
+++ b/test/files/run/t6309.check
@@ -0,0 +1 @@
+7
diff --git a/test/files/run/t6309.scala b/test/files/run/t6309.scala
new file mode 100644
index 0000000000..7bbca63c2a
--- /dev/null
+++ b/test/files/run/t6309.scala
@@ -0,0 +1,16 @@
+trait A {
+ def a: Int
+}
+
+object Test {
+ def f(a: Int) = new {
+ //private val b = a
+ private[this] val b = a // crashes, sorry scalac
+ } with A {
+ def a = b
+ }
+
+ def main(args: Array[String]) {
+ println(f(7).a)
+ }
+}
diff --git a/test/files/run/t6320.check b/test/files/run/t6320.check
index e56bacd223..013acc1c54 100644
--- a/test/files/run/t6320.check
+++ b/test/files/run/t6320.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> import scala.language.dynamics
import scala.language.dynamics
@@ -13,5 +11,3 @@ scala> new Dyn(Map("foo" -> 10)).foo[Int]
res0: Int = 10
scala>
-
-scala>
diff --git a/test/files/run/t6323b.scala b/test/files/run/t6323b.scala
index f530ac3ecc..50d0900c7f 100644
--- a/test/files/run/t6323b.scala
+++ b/test/files/run/t6323b.scala
@@ -10,7 +10,7 @@ object Test extends App {
val lookAtMe = m.reflect(Test("a",List(5)))
val value = u.weakTypeOf[Test]
val members = value.members
- val member = value.members.filter(_.name.encoded == "a")
+ val member = value.members.filter(_.name.encodedName == TermName("a"))
val aAccessor = lookAtMe.reflectMethod(member.head.asMethod)
val thisShouldBeA = aAccessor.apply()
println(thisShouldBeA)
diff --git a/test/files/run/t6327.flags b/test/files/run/t6327.flags
new file mode 100644
index 0000000000..ea7fc37e1a
--- /dev/null
+++ b/test/files/run/t6327.flags
@@ -0,0 +1 @@
+-Yrangepos:false
diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check
index 693263a5c2..5049426ab4 100644
--- a/test/files/run/t6329_repl.check
+++ b/test/files/run/t6329_repl.check
@@ -1,13 +1,35 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
+scala> import scala.reflect.classTag
+import scala.reflect.classTag
-scala> classManifest[List[_]]
+scala> classManifest[scala.List[_]]
warning: there were 1 deprecation warning(s); re-run with -deprecation for details
-res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[Any]
+res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
-scala> scala.reflect.classTag[List[_]]
+scala> classTag[scala.List[_]]
res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
+scala> classManifest[scala.collection.immutable.List[_]]
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+res2: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
+
+scala> classTag[scala.collection.immutable.List[_]]
+res3: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
+
+scala> classManifest[Predef.Set[_]]
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+res4: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set[<?>]
+
+scala> classTag[Predef.Set[_]]
+res5: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set
+
+scala> classManifest[scala.collection.immutable.Set[_]]
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+res6: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set[<?>]
+
+scala> classTag[scala.collection.immutable.Set[_]]
+res7: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set
+
scala>
diff --git a/test/files/run/t6329_repl.scala b/test/files/run/t6329_repl.scala
index add6d64962..f210d6512c 100644
--- a/test/files/run/t6329_repl.scala
+++ b/test/files/run/t6329_repl.scala
@@ -2,7 +2,14 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
- |classManifest[List[_]]
- |scala.reflect.classTag[List[_]]
- |""".stripMargin
+ |import scala.reflect.classTag
+ |classManifest[scala.List[_]]
+ |classTag[scala.List[_]]
+ |classManifest[scala.collection.immutable.List[_]]
+ |classTag[scala.collection.immutable.List[_]]
+ |classManifest[Predef.Set[_]]
+ |classTag[Predef.Set[_]]
+ |classManifest[scala.collection.immutable.Set[_]]
+ |classTag[scala.collection.immutable.Set[_]]
+ """.stripMargin
}
diff --git a/test/files/run/t6329_repl_bug.check b/test/files/run/t6329_repl_bug.check
index 8663184bde..44c41cfd03 100644
--- a/test/files/run/t6329_repl_bug.check
+++ b/test/files/run/t6329_repl_bug.check
@@ -1,11 +1,15 @@
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> import scala.reflect.runtime._
+import scala.reflect.runtime._
scala> classManifest[List[_]]
-warning: there were 1 deprecation warnings; re-run with -deprecation for details
-res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[Any]
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
scala> scala.reflect.classTag[List[_]]
res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
diff --git a/test/files/run/t6329_repl_bug.pending b/test/files/run/t6329_repl_bug.scala
index 9997d1771e..9997d1771e 100644
--- a/test/files/run/t6329_repl_bug.pending
+++ b/test/files/run/t6329_repl_bug.scala
diff --git a/test/files/run/t6329_vanilla.check b/test/files/run/t6329_vanilla.check
index 8282afaeba..ad8f4b5c77 100644
--- a/test/files/run/t6329_vanilla.check
+++ b/test/files/run/t6329_vanilla.check
@@ -1,2 +1,8 @@
-scala.collection.immutable.List[Any]
+scala.collection.immutable.List[<?>]
scala.collection.immutable.List
+scala.collection.immutable.List[<?>]
+scala.collection.immutable.List
+scala.collection.immutable.Set[<?>]
+scala.collection.immutable.Set
+scala.collection.immutable.Set[<?>]
+scala.collection.immutable.Set
diff --git a/test/files/run/t6329_vanilla.scala b/test/files/run/t6329_vanilla.scala
index a31cd5c72e..ec84f1f938 100644
--- a/test/files/run/t6329_vanilla.scala
+++ b/test/files/run/t6329_vanilla.scala
@@ -1,4 +1,13 @@
+import scala.reflect.classTag
+
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
- println(classManifest[List[_]])
- println(scala.reflect.classTag[List[_]])
-} \ No newline at end of file
+ println(classManifest[scala.List[_]])
+ println(classTag[scala.List[_]])
+ println(classManifest[scala.collection.immutable.List[_]])
+ println(classTag[scala.collection.immutable.List[_]])
+ println(classManifest[Predef.Set[_]])
+ println(classTag[Predef.Set[_]])
+ println(classManifest[scala.collection.immutable.Set[_]])
+ println(classTag[scala.collection.immutable.Set[_]])
+}
diff --git a/test/files/run/t6329_vanilla_bug.check b/test/files/run/t6329_vanilla_bug.check
index 8282afaeba..640d168a8a 100644
--- a/test/files/run/t6329_vanilla_bug.check
+++ b/test/files/run/t6329_vanilla_bug.check
@@ -1,2 +1,3 @@
-scala.collection.immutable.List[Any]
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+scala.collection.immutable.List[<?>]
scala.collection.immutable.List
diff --git a/test/files/run/t6329_vanilla_bug.pending b/test/files/run/t6329_vanilla_bug.scala
index 404f90bf6e..404f90bf6e 100644
--- a/test/files/run/t6329_vanilla_bug.pending
+++ b/test/files/run/t6329_vanilla_bug.scala
diff --git a/test/files/run/t6331.scala b/test/files/run/t6331.scala
index 4e43a7686e..d9d46f10ea 100644
--- a/test/files/run/t6331.scala
+++ b/test/files/run/t6331.scala
@@ -1,9 +1,4 @@
-import scala.tools.partest._
-import java.io._
-import scala.tools.nsc._
-import scala.tools.nsc.util.CommandLineParser
-import scala.tools.nsc.{Global, Settings, CompilerCommand}
-import scala.tools.nsc.reporters.ConsoleReporter
+import scala.tools.partest.DirectTest
// Test of Constant#equals, which must must account for floating point intricacies.
object Test extends DirectTest {
diff --git a/test/files/run/t6331b.scala b/test/files/run/t6331b.scala
index f966abea51..3a560ea64b 100644
--- a/test/files/run/t6331b.scala
+++ b/test/files/run/t6331b.scala
@@ -1,12 +1,5 @@
-import scala.tools.partest._
-import java.io._
-import scala.tools.nsc._
-import scala.tools.nsc.util.CommandLineParser
-import scala.tools.nsc.{Global, Settings, CompilerCommand}
-import scala.tools.nsc.reporters.ConsoleReporter
-
-import scala.tools.partest.trace
-import scala.util.control.Exception._
+import scala.tools.partest.Util.trace
+import scala.util.control.Exception.allCatch
object Test extends App {
diff --git a/test/files/run/t6355.check b/test/files/run/t6355.check
new file mode 100644
index 0000000000..ce74ab38a2
--- /dev/null
+++ b/test/files/run/t6355.check
@@ -0,0 +1,2 @@
+bippy(x: Int) called with x = 42
+bippy(x: String) called with x = "42"
diff --git a/test/files/run/t6355.scala b/test/files/run/t6355.scala
new file mode 100644
index 0000000000..f1921391a3
--- /dev/null
+++ b/test/files/run/t6355.scala
@@ -0,0 +1,17 @@
+import scala.language.dynamics
+
+class A extends Dynamic {
+ def applyDynamic(method: String): B = new B(method)
+}
+class B(method: String) {
+ def apply(x: Int) = s"$method(x: Int) called with x = $x"
+ def apply(x: String) = s"""$method(x: String) called with x = "$x""""
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val x = new A
+ println(x.bippy(42))
+ println(x.bippy("42"))
+ }
+}
diff --git a/test/files/run/t6379.check b/test/files/run/t6379.check
new file mode 100644
index 0000000000..3e5dfec623
--- /dev/null
+++ b/test/files/run/t6379.check
@@ -0,0 +1,14 @@
+compile-time
+uninitialized close: List(class IOException)
+initialized close: List(class IOException)
+uninitialized productElement: List(class IndexOutOfBoundsException)
+initialized productElement: List(class IndexOutOfBoundsException)
+uninitialized read: List(class IOException)
+initialized read: List(class IOException)
+runtime
+uninitialized close: List(class IOException)
+initialized close: List(class IOException)
+uninitialized productElement: List(class IndexOutOfBoundsException)
+initialized productElement: List(class IndexOutOfBoundsException)
+uninitialized read: List(class IOException)
+initialized read: List(class IOException)
diff --git a/test/files/run/t6379/Macros_1.scala b/test/files/run/t6379/Macros_1.scala
new file mode 100644
index 0000000000..4f3daf4978
--- /dev/null
+++ b/test/files/run/t6379/Macros_1.scala
@@ -0,0 +1,26 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+import java.io._
+
+object Macros {
+ def impl(c: Context) = {
+ var messages = List[String]()
+ def println(msg: String) = messages :+= msg
+
+ import c.universe._
+ def test(sym: MethodSymbol): Unit = {
+ println(s"uninitialized ${sym.name}: ${sym.exceptions}")
+ sym.info
+ println(s"initialized ${sym.name}: ${sym.exceptions}")
+ }
+
+ println("compile-time")
+ test(typeOf[Closeable].declaration(TermName("close")).asMethod)
+ test(typeOf[Product1[_]].declaration(TermName("productElement")).asMethod)
+ test(c.mirror.staticClass("Reader").info.decl(TermName("read")).asMethod)
+
+ q"..${messages.map(msg => q"println($msg)")}"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/t6379/Test_2.scala b/test/files/run/t6379/Test_2.scala
new file mode 100644
index 0000000000..8e9c994654
--- /dev/null
+++ b/test/files/run/t6379/Test_2.scala
@@ -0,0 +1,22 @@
+import java.io._
+import scala.reflect.runtime.universe._
+
+class Reader(fname: String) {
+ private val in = new BufferedReader(new FileReader(fname))
+ @throws[IOException]("if the file doesn't exist")
+ def read() = in.read()
+}
+
+object Test extends App {
+ def test(sym: MethodSymbol): Unit = {
+ println(s"uninitialized ${sym.name}: ${sym.exceptions}")
+ sym.info
+ println(s"initialized ${sym.name}: ${sym.exceptions}")
+ }
+
+ Macros.foo
+ println("runtime")
+ test(typeOf[Closeable].decl(TermName("close")).asMethod)
+ test(typeOf[Product1[_]].decl(TermName("productElement")).asMethod)
+ test(typeOf[Reader].decl(TermName("read")).asMethod)
+}
diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check
new file mode 100644
index 0000000000..4ed11d59ff
--- /dev/null
+++ b/test/files/run/t6381.check
@@ -0,0 +1,19 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> import scala.language.experimental.macros
+import scala.language.experimental.macros
+
+scala> def pos_impl(c: scala.reflect.macros.blackbox.Context): c.Expr[String] = {
+ import c.universe._
+ c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString)))
+}
+pos_impl: (c: scala.reflect.macros.blackbox.Context)c.Expr[String]
+
+scala> def pos: String = macro pos_impl
+defined term macro pos: String
+
+scala> pos
+res0: String = class scala.reflect.internal.util.RangePosition
+
+scala>
diff --git a/test/files/run/t6381.scala b/test/files/run/t6381.scala
new file mode 100644
index 0000000000..5a687c10c1
--- /dev/null
+++ b/test/files/run/t6381.scala
@@ -0,0 +1,15 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+ |import scala.language.experimental.macros
+ |def pos_impl(c: scala.reflect.macros.blackbox.Context): c.Expr[String] = {
+ | import c.universe._
+ | c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString)))
+ |}
+ |def pos: String = macro pos_impl
+ |pos
+ |""".stripMargin.trim
+
+ override def extraSettings: String = "-Yrangepos"
+}
diff --git a/test/files/run/t6385.scala b/test/files/run/t6385.scala
new file mode 100644
index 0000000000..24fc3cd768
--- /dev/null
+++ b/test/files/run/t6385.scala
@@ -0,0 +1,13 @@
+object Test {
+ def main(args: Array[String]) {
+ val y: AA[Int] = C(2)
+ val c: Int = y.x.y
+ assert(c == 2)
+ }
+}
+trait AA[T] extends Any {
+ def x: C[T]
+}
+case class C[T](val y: T) extends AnyVal with AA[T] {
+ def x = this
+}
diff --git a/test/files/run/t6392b.check b/test/files/run/t6392b.check
index b7872f0e08..9bb9b5694f 100644
--- a/test/files/run/t6392b.check
+++ b/test/files/run/t6392b.check
@@ -1 +1 @@
-ModuleDef(Modifiers(), newTermName("C")#MOD, Template(List(Select(Ident(scala#PK), newTypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR#PCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(newTypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(())))))))
+ModuleDef(Modifiers(), TermName("C")#MOD, Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), noSelfType, List(DefDef(Modifiers(), termNames.CONSTRUCTOR#PCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), typeNames.EMPTY), termNames.CONSTRUCTOR#PCTOR), List())), Literal(Constant(())))))))
diff --git a/test/files/run/t6392b.scala b/test/files/run/t6392b.scala
index f69a5aaf45..e43c1a2b03 100644
--- a/test/files/run/t6392b.scala
+++ b/test/files/run/t6392b.scala
@@ -5,5 +5,5 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val tb = cm.mkToolBox()
val c = tb.parse("object C")
- println(showRaw(tb.typeCheck(c), printKinds = true))
+ println(showRaw(tb.typecheck(c), printKinds = true))
} \ No newline at end of file
diff --git a/test/files/run/t6394a/Macros_1.scala b/test/files/run/t6394a/Macros_1.scala
index 3d39d3e40a..376d85ba67 100644
--- a/test/files/run/t6394a/Macros_1.scala
+++ b/test/files/run/t6394a/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl(c:Context): c.Expr[Any] = {
import c.universe._
- val selfTree = This(c.enclosingClass.symbol.asModule.moduleClass)
+ val selfTree = This(c.enclosingImpl.symbol.asModule.moduleClass)
c.Expr[AnyRef](selfTree)
}
diff --git a/test/files/run/t6394b/Macros_1.scala b/test/files/run/t6394b/Macros_1.scala
index 5d93e1cda8..1a747816e3 100644
--- a/test/files/run/t6394b/Macros_1.scala
+++ b/test/files/run/t6394b/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl(c:Context): c.Expr[Any] = {
import c.universe._
- val selfTree = This(tpnme.EMPTY)
+ val selfTree = This(typeNames.EMPTY)
c.Expr[AnyRef](selfTree)
}
diff --git a/test/files/run/t6406-regextract.check b/test/files/run/t6406-regextract.check
new file mode 100644
index 0000000000..88c5a52eb3
--- /dev/null
+++ b/test/files/run/t6406-regextract.check
@@ -0,0 +1,4 @@
+List(1, 3)
+List(1, 3)
+List(1, 3)
+Some(2011) Some(2011)
diff --git a/test/files/run/t6406-regextract.scala b/test/files/run/t6406-regextract.scala
new file mode 100644
index 0000000000..83679a5167
--- /dev/null
+++ b/test/files/run/t6406-regextract.scala
@@ -0,0 +1,30 @@
+
+object Test extends App {
+ import util.matching._
+ import Regex._
+
+ val r = "(\\d+)".r
+ val q = """(\d)""".r
+ val ns = List("1,2","x","3,4")
+ val u = r.unanchored
+
+ val is = ns collect { case u(x) => x } map { case r(x) => x }
+ println(is)
+ // Match from same pattern
+ val js = (ns map { u findFirstMatchIn _ }).flatten map { case r(x) => x }
+ println(js)
+ // Match not from same pattern
+ val ks = (ns map { q findFirstMatchIn _ }).flatten map { case r(x) => x }
+ println(ks)
+
+ val t = "Last modified 2011-07-15"
+ val p1 = """(\d\d\d\d)-(\d\d)-(\d\d)""".r
+ val y1: Option[String] = for {
+ p1(year, month, day) <- p1 findFirstIn t
+ } yield year
+ val y2: Option[String] = for {
+ p1(year, month, day) <- p1 findFirstMatchIn t
+ } yield year
+ println(s"$y1 $y2")
+
+}
diff --git a/test/files/run/t6411a.check b/test/files/run/t6411a.check
new file mode 100644
index 0000000000..9226146195
--- /dev/null
+++ b/test/files/run/t6411a.check
@@ -0,0 +1,96 @@
+meth = method yg_1
+as seen by Scala reflection: def yg_1[T](y: Y[T]): T
+as seen by Java reflection: public java.lang.Object a$.yg_1(java.lang.Object)
+result = 1
+meth = method yg_1
+as seen by Scala reflection: def yg_1[T](y: Y[T]): T
+as seen by Java reflection: public java.lang.Object a$.yg_1(java.lang.Object)
+result = 1
+meth = method yi_2
+as seen by Scala reflection: def yi_2(y: Y[Int]): Int
+as seen by Java reflection: public int a$.yi_2(java.lang.Integer)
+result = 2
+meth = method yi_2
+as seen by Scala reflection: def yi_2(y: Y[Int]): Int
+as seen by Java reflection: public int a$.yi_2(java.lang.Integer)
+result = class java.lang.IllegalArgumentException: argument type mismatch
+meth = method ys_3
+as seen by Scala reflection: def ys_3(y: Y[String]): String
+as seen by Java reflection: public java.lang.String a$.ys_3(java.lang.String)
+result = class java.lang.IllegalArgumentException: argument type mismatch
+meth = method ys_3
+as seen by Scala reflection: def ys_3(y: Y[String]): String
+as seen by Java reflection: public java.lang.String a$.ys_3(java.lang.String)
+result = 3
+meth = method ya_4
+as seen by Scala reflection: def ya_4(ys: Array[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.ya_4(Y[])
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method ya_4
+as seen by Scala reflection: def ya_4(ys: Array[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.ya_4(Y[])
+result = List(4)
+meth = method yl_5
+as seen by Scala reflection: def yl_5(ys: List[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.yl_5(scala.collection.immutable.List)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method yl_5
+as seen by Scala reflection: def yl_5(ys: List[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.yl_5(scala.collection.immutable.List)
+result = List(5)
+meth = method yni_7
+as seen by Scala reflection: def yni_7(y: => Y[Int]): Int
+as seen by Java reflection: public int a$.yni_7(scala.Function0)
+result = 7
+meth = method yns_8
+as seen by Scala reflection: def yns_8(y: => Y[String]): String
+as seen by Java reflection: public java.lang.String a$.yns_8(scala.Function0)
+result = 8
+meth = method zg_1
+as seen by Scala reflection: def zg_1[T](z: Z[T]): T
+as seen by Java reflection: public java.lang.Object a$.zg_1(Z)
+result = 1
+meth = method zg_1
+as seen by Scala reflection: def zg_1[T](z: Z[T]): T
+as seen by Java reflection: public java.lang.Object a$.zg_1(Z)
+result = 1
+meth = method zi_2
+as seen by Scala reflection: def zi_2(z: Z[Int]): Int
+as seen by Java reflection: public int a$.zi_2(Z)
+result = 2
+meth = method zi_2
+as seen by Scala reflection: def zi_2(z: Z[Int]): Int
+as seen by Java reflection: public int a$.zi_2(Z)
+result = class java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
+meth = method zs_3
+as seen by Scala reflection: def zs_3(z: Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zs_3(Z)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method zs_3
+as seen by Scala reflection: def zs_3(z: Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zs_3(Z)
+result = 3
+meth = method za_4
+as seen by Scala reflection: def za_4(zs: Array[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.za_4(Z[])
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method za_4
+as seen by Scala reflection: def za_4(zs: Array[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.za_4(Z[])
+result = List(4)
+meth = method zl_5
+as seen by Scala reflection: def zl_5(zs: List[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.zl_5(scala.collection.immutable.List)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method zl_5
+as seen by Scala reflection: def zl_5(zs: List[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.zl_5(scala.collection.immutable.List)
+result = List(5)
+meth = method zni_7
+as seen by Scala reflection: def zni_7(z: => Z[Int]): Int
+as seen by Java reflection: public int a$.zni_7(scala.Function0)
+result = 7
+meth = method zns_8
+as seen by Scala reflection: def zns_8(z: => Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zns_8(scala.Function0)
+result = 8
diff --git a/test/files/run/t6411a.scala b/test/files/run/t6411a.scala
new file mode 100644
index 0000000000..46c88d9294
--- /dev/null
+++ b/test/files/run/t6411a.scala
@@ -0,0 +1,81 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.language.reflectiveCalls
+
+class Y[T](val i: T) extends AnyVal {
+ override def toString = s"Y($i)"
+}
+class Z[T](val i: T) extends AnyRef {
+ override def toString = s"Z($i)"
+}
+
+object a {
+ def yg_1[T](y: Y[T]) = y.i
+ def yi_2(y: Y[Int]) = y.i
+ def ys_3(y: Y[String]) = y.i
+ def ya_4(ys: Array[Y[String]]) = ys.toList.map(_.i)
+ def yl_5(ys: List[Y[String]]) = ys.map(_.i)
+ def yv_6(ys: Y[String]*) = ys.toList.map(_.i)
+ def yni_7(y: => Y[Int]) = y.i
+ def yns_8(y: => Y[String]) = y.i
+
+ def zg_1[T](z: Z[T]) = z.i
+ def zi_2(z: Z[Int]) = z.i
+ def zs_3(z: Z[String]) = z.i
+ def za_4(zs: Array[Z[String]]) = zs.toList.map(_.i)
+ def zl_5(zs: List[Z[String]]) = zs.map(_.i)
+ def zv_6(zs: Z[String]*) = zs.toList.map(_.i)
+ def zni_7(z: => Z[Int]) = z.i
+ def zns_8(z: => Z[String]) = z.i
+}
+
+object Test extends App {
+ def test(methName: String, arg: Any) = {
+ val moduleA = cm.reflect(a)
+ val msym = moduleA.symbol.info.decl(TermName(methName)).asMethod
+ println(s"meth = $msym")
+ val mmirror = moduleA.reflectMethod(msym)
+ val mresult =
+ try { mmirror(arg) }
+ catch {
+ case ex: Exception =>
+ val ex1 = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ s"${ex1.getClass}: ${ex1.getMessage}"
+ }
+ println(s"as seen by Scala reflection: ${msym.asInstanceOf[scala.reflect.internal.Symbols#Symbol].defString}")
+ println(s"as seen by Java reflection: ${mmirror.asInstanceOf[{val jmeth: java.lang.reflect.Method}].jmeth}")
+ println(s"result = $mresult")
+ }
+
+ test("yg_1", new Y(1))
+ test("yg_1", new Y("1"))
+ test("yi_2", new Y(2))
+ test("yi_2", new Y("2"))
+ test("ys_3", new Y(3))
+ test("ys_3", new Y("3"))
+ test("ya_4", Array(new Y(4)))
+ test("ya_4", Array(new Y("4")))
+ test("yl_5", List(new Y(5)))
+ test("yl_5", List(new Y("5")))
+ // FIXME: disabled because of SI-7056
+ // test("yv_6", new Y(6))
+ // test("yv_6", new Y("6"))
+ test("yni_7", new Y(7))
+ test("yns_8", new Y("8"))
+
+ test("zg_1", new Z(1))
+ test("zg_1", new Z("1"))
+ test("zi_2", new Z(2))
+ test("zi_2", new Z("2"))
+ test("zs_3", new Z(3))
+ test("zs_3", new Z("3"))
+ test("za_4", Array(new Z(4)))
+ test("za_4", Array(new Z("4")))
+ test("zl_5", List(new Z(5)))
+ test("zl_5", List(new Z("5")))
+ // FIXME: disabled because of SI-7056
+ // test("zv_6", new Z(6))
+ // test("zv_6", new Z("6"))
+ test("zni_7", new Z(7))
+ test("zns_8", new Z("8"))
+} \ No newline at end of file
diff --git a/test/files/run/t6411b.check b/test/files/run/t6411b.check
new file mode 100644
index 0000000000..e20bed6d8d
--- /dev/null
+++ b/test/files/run/t6411b.check
@@ -0,0 +1 @@
+Bar(Foo(3))
diff --git a/test/files/run/t6411b.scala b/test/files/run/t6411b.scala
new file mode 100644
index 0000000000..b5c3bf8732
--- /dev/null
+++ b/test/files/run/t6411b.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+
+case class Foo(n: Int) extends AnyVal
+case class Bar(foo: Foo)
+
+object Test extends App {
+ val mirror = runtimeMirror(getClass.getClassLoader)
+ val cm = mirror.reflectClass(typeOf[Bar].typeSymbol.asClass)
+ val ctor = typeOf[Bar].decl(termNames.CONSTRUCTOR).asMethod
+ val ctorm = cm.reflectConstructor(ctor)
+ println(ctorm(Foo(3)))
+} \ No newline at end of file
diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check
index 178ea739f5..f8d5b3a8cd 100644
--- a/test/files/run/t6439.check
+++ b/test/files/run/t6439.check
@@ -1,13 +1,11 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> class A
defined class A
scala> object A // warn
-defined module A
+defined object A
warning: previously defined class A is not a companion to object A.
Companions must be defined together; you may wish to use :paste mode for this.
@@ -15,15 +13,15 @@ scala> trait B
defined trait B
scala> object B // warn
-defined module B
+defined object B
warning: previously defined trait B is not a companion to object B.
Companions must be defined together; you may wish to use :paste mode for this.
scala> object C
-defined module C
+defined object C
scala> object Bippy
-defined module Bippy
+defined object Bippy
scala> class C // warn
defined class C
@@ -40,13 +38,13 @@ scala> val D = 0 // no warn
D: Int = 0
scala> object E
-defined module E
+defined object E
scala> var E = 0 // no warn
E: Int = 0
scala> object F
-defined module F
+defined object F
scala> type F = Int // no warn
defined type alias F
@@ -58,9 +56,18 @@ scala> :power
** global._, definitions._ also imported **
** Try :help, :vals, power.<tab> **
-scala> intp("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols
+scala> object lookup {
+ import intp._
+ def apply(name: String): Symbol = types(name) orElse terms(name)
+ def types(name: String): Symbol = replScope lookup (TypeName(name)) orElse getClassIfDefined(name)
+ def terms(name: String): Symbol = replScope lookup (TermName(name)) orElse getModuleIfDefined(name)
+ def types[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol
+ def terms[T: global.TypeTag] : Symbol = typeOf[T].termSymbol
+ def apply[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol
+}
+defined object lookup
+
+scala> lookup("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols
res0: $r.intp.global.Symbol = type F
scala>
-
-scala>
diff --git a/test/files/run/t6439.scala b/test/files/run/t6439.scala
index 70a2dbafaf..53155a71a1 100644
--- a/test/files/run/t6439.scala
+++ b/test/files/run/t6439.scala
@@ -1,6 +1,7 @@
import scala.tools.partest.ReplTest
object Test extends ReplTest {
+
def code = """
class A
object A // warn
@@ -17,6 +18,15 @@ var E = 0 // no warn
object F
type F = Int // no warn
:power
-intp("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols
+object lookup {
+ import intp._
+ def apply(name: String): Symbol = types(name) orElse terms(name)
+ def types(name: String): Symbol = replScope lookup (TypeName(name)) orElse getClassIfDefined(name)
+ def terms(name: String): Symbol = replScope lookup (TermName(name)) orElse getModuleIfDefined(name)
+ def types[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol
+ def terms[T: global.TypeTag] : Symbol = typeOf[T].termSymbol
+ def apply[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol
+}
+lookup("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols
"""
}
diff --git a/test/files/run/t6440.check b/test/files/run/t6440.check
index 806279fb74..27d5d1380e 100644
--- a/test/files/run/t6440.check
+++ b/test/files/run/t6440.check
@@ -1,4 +1,4 @@
-pos: source-newSource1.scala,line-9,offset=109 bad symbolic reference. A signature in U.class refers to term pack1
-in package <root> which is not available.
-It may be completely missing from the current classpath, or the version on
-the classpath might be incompatible with the version used when compiling U.class. ERROR
+pos: source-newSource1.scala,line-9,offset=109 bad symbolic reference to <root>.pack1 encountered in class file 'U.class'.
+Cannot access term pack1 in package <root>. The current classpath may be
+missing a definition for <root>.pack1, or U.class may have been compiled against a version that's
+incompatible with the one found on the current classpath. ERROR
diff --git a/test/files/run/t6440b.check b/test/files/run/t6440b.check
index 9771ce5efb..0b642c2c35 100644
--- a/test/files/run/t6440b.check
+++ b/test/files/run/t6440b.check
@@ -1,4 +1,4 @@
-pos: NoPosition bad symbolic reference. A signature in U.class refers to type T
-in package pack1 which is not available.
-It may be completely missing from the current classpath, or the version on
-the classpath might be incompatible with the version used when compiling U.class. ERROR
+pos: NoPosition bad symbolic reference to pack1.T encountered in class file 'U.class'.
+Cannot access type T in package pack1. The current classpath may be
+missing a definition for pack1.T, or U.class may have been compiled against a version that's
+incompatible with the one found on the current classpath. ERROR
diff --git a/test/files/run/t6443.scala b/test/files/run/t6443.scala
index 67fe2cab22..3ab8c345fe 100644
--- a/test/files/run/t6443.scala
+++ b/test/files/run/t6443.scala
@@ -1,3 +1,5 @@
+import scala.language.existentials
+
class Base
class Derived extends Base
diff --git a/test/files/run/t6448.check b/test/files/run/t6448.check
new file mode 100644
index 0000000000..9401568319
--- /dev/null
+++ b/test/files/run/t6448.check
@@ -0,0 +1,32 @@
+
+=List.collect=
+f(1)
+f(2)
+List(1)
+
+=List.collectFirst=
+f(1)
+Some(1)
+
+=Option.collect=
+f(1)
+Some(1)
+
+=Option.collect=
+f(2)
+None
+
+=Stream.collect=
+f(1)
+f(2)
+List(1)
+
+=Stream.collectFirst=
+f(1)
+Some(1)
+
+=ParVector.collect=
+(ParVector(1),2)
+
+=ParArray.collect=
+(ParArray(1),2)
diff --git a/test/files/run/t6448.scala b/test/files/run/t6448.scala
new file mode 100644
index 0000000000..d0faaa9560
--- /dev/null
+++ b/test/files/run/t6448.scala
@@ -0,0 +1,61 @@
+// Tests to show that various `collect` functions avoid calling
+// both `PartialFunction#isDefinedAt` and `PartialFunction#apply`.
+//
+object Test {
+ def f(i: Int) = { println("f(" + i + ")"); true }
+ class Counter {
+ var count = 0
+ def apply(i: Int) = synchronized {count += 1; true}
+ }
+
+ def testing(label: String)(body: => Any) {
+ println(s"\n=$label=")
+ println(body)
+ }
+
+ def main(args: Array[String]) {
+ testing("List.collect")(List(1, 2) collect { case x if f(x) && x < 2 => x})
+ testing("List.collectFirst")(List(1, 2) collectFirst { case x if f(x) && x < 2 => x})
+ testing("Option.collect")(Some(1) collect { case x if f(x) && x < 2 => x})
+ testing("Option.collect")(Some(2) collect { case x if f(x) && x < 2 => x})
+ testing("Stream.collect")((Stream(1, 2).collect { case x if f(x) && x < 2 => x}).toList)
+ testing("Stream.collectFirst")(Stream.continually(1) collectFirst { case x if f(x) && x < 2 => x})
+
+ import collection.parallel.ParIterable
+ import collection.parallel.immutable.ParVector
+ import collection.parallel.mutable.ParArray
+ testing("ParVector.collect") {
+ val counter = new Counter()
+ (ParVector(1, 2) collect { case x if counter(x) && x < 2 => x}, counter.synchronized(counter.count))
+ }
+
+ testing("ParArray.collect") {
+ val counter = new Counter()
+ (ParArray(1, 2) collect { case x if counter(x) && x < 2 => x}, counter.synchronized(counter.count))
+ }
+
+ object PendingTests {
+ testing("Iterator.collect")((Iterator(1, 2) collect { case x if f(x) && x < 2 => x}).toList)
+
+ testing("List.view.collect")((List(1, 2).view collect { case x if f(x) && x < 2 => x}).force)
+
+ // This would do the trick in Future.collect, but I haven't added this yet as there is a tradeoff
+ // with extra allocations to consider.
+ //
+ // pf.lift(v) match {
+ // case Some(x) => p success x
+ // case None => fail(v)
+ // }
+ testing("Future.collect") {
+ import concurrent.ExecutionContext.Implicits.global
+ import concurrent.Await
+ import concurrent.duration.Duration
+ val result = concurrent.Future(1) collect { case x if f(x) => x}
+ Await.result(result, Duration.Inf)
+ }
+
+ // TODO Future.{onSuccess, onFailure, recoverWith, andThen}
+ }
+
+ }
+}
diff --git a/test/files/run/t6467.scala b/test/files/run/t6467.scala
new file mode 100644
index 0000000000..dc93b69fdc
--- /dev/null
+++ b/test/files/run/t6467.scala
@@ -0,0 +1,20 @@
+
+
+
+
+import collection._
+
+
+
+object Test extends App {
+
+ def compare(s1: String, s2: String) {
+ assert(s1 == s2, s1 + "\nvs.\n" + s2)
+ }
+
+ compare(List(1, 2, 3, 4).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234")
+ compare(List(1, 2, 3, 4).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234")
+ compare(Seq(0 until 100: _*).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString)
+ compare(Seq(0 until 100: _*).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString)
+
+} \ No newline at end of file
diff --git a/test/files/run/t6481.check b/test/files/run/t6481.check
index 7ec29631b1..df40722242 100644
--- a/test/files/run/t6481.check
+++ b/test/files/run/t6481.check
@@ -1,3 +1,4 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
delayed init
new foo(1, 2)
delayed init
diff --git a/test/files/run/t6488.check b/test/files/run/t6488.check
deleted file mode 100644
index 35821117c8..0000000000
--- a/test/files/run/t6488.check
+++ /dev/null
@@ -1 +0,0 @@
-Success
diff --git a/test/files/run/t6488.scala b/test/files/run/t6488.scala
index 487614ecfd..e234876fbe 100644
--- a/test/files/run/t6488.scala
+++ b/test/files/run/t6488.scala
@@ -1,11 +1,64 @@
-import sys.process._
+import scala.sys.process._
+import scala.util.Try
+import scala.util.Properties.{ javaHome, javaClassPath }
+import java.io.{ File, IOException }
+import java.util.concurrent.CountDownLatch
+import java.util.concurrent.TimeUnit._
+import java.util.concurrent.atomic._
+
object Test {
+ /*
// Program that prints "Success" if the command was successfully run then destroyed
// It will silently pass if the command "/bin/ls" does not exist
- // It will fail due to the uncatchable exception in t6488 race condition
+ // It will fail due to the uncatchable exception in t6488 race condition,
+ // i.e., if any uncaught exceptions on spawned threads are printed.
def main(args: Array[String]) {
try Process("/bin/ls").run(ProcessLogger { _ => () }).destroy
catch { case _ => () }
println("Success")
}
+ */
+
+ // Show that no uncaught exceptions are thrown on spawned I/O threads
+ // when the process is destroyed. The default handler will print
+ // stack traces in the failing case.
+ def main(args: Array[String]) {
+ if (args.nonEmpty && args(0) == "data")
+ data()
+ else
+ test() // args(0) == "jvm"
+ }
+
+ // fork the data spewer, wait for input, then destroy the process
+ def test() {
+ val f = new File(javaHome, "bin").listFiles.sorted filter (_.getName startsWith "java") find (_.canExecute) getOrElse {
+ // todo signal test runner that test is skipped
+ new File("/bin/ls") // innocuous
+ }
+ //Process(f.getAbsolutePath).run(ProcessLogger { _ => () }).destroy
+ val reading = new CountDownLatch(1)
+ val count = new AtomicInteger
+ def counted = count.get
+ val command = s"${f.getAbsolutePath} -classpath ${javaClassPath} Test data"
+ Try {
+ Process(command) run ProcessLogger { (s: String) =>
+ //Console println s"[[$s]]" // java help
+ count.getAndIncrement
+ reading.countDown
+ Thread.`yield`()
+ }
+ } foreach { (p: Process) =>
+ val ok = reading.await(10, SECONDS)
+ if (!ok) Console println "Timed out waiting for process output!"
+ p.destroy()
+ }
+ //Console println s"Read count $counted lines"
+ }
+
+ // spew something
+ def data() {
+ def filler = "." * 100
+ for (i <- 1 to 1000)
+ Console println s"Outputting data line $i $filler"
+ }
}
diff --git a/test/files/run/t6507.check b/test/files/run/t6507.check
new file mode 100644
index 0000000000..3536c42381
--- /dev/null
+++ b/test/files/run/t6507.check
@@ -0,0 +1,24 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> :silent
+Switched off result printing.
+
+scala> class A { override def toString() = { println("!"); "A" } }
+
+scala> val a = new A
+
+scala> var b: A = new A
+
+scala> b = new A
+
+scala> new A
+
+scala> :silent
+Switched on result printing.
+
+scala> res0
+!
+res1: A = A
+
+scala>
diff --git a/test/files/run/t6507.scala b/test/files/run/t6507.scala
new file mode 100644
index 0000000000..25f0a73e04
--- /dev/null
+++ b/test/files/run/t6507.scala
@@ -0,0 +1,14 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+:silent
+class A { override def toString() = { println("!"); "A" } }
+val a = new A
+var b: A = new A
+b = new A
+new A
+:silent
+res0
+"""
+}
diff --git a/test/files/run/t6548.check b/test/files/run/t6548.check
new file mode 100644
index 0000000000..5dfcb12e02
--- /dev/null
+++ b/test/files/run/t6548.check
@@ -0,0 +1,2 @@
+false
+List(JavaAnnotationWithNestedEnum_1(value = VALUE))
diff --git a/test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java b/test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java
new file mode 100644
index 0000000000..32004de537
--- /dev/null
+++ b/test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java
@@ -0,0 +1,17 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD,
+ ElementType.TYPE, ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface JavaAnnotationWithNestedEnum_1
+{
+ public Value value() default Value.VALUE;
+
+ public enum Value
+ {
+ VALUE;
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6548/Test_2.scala b/test/files/run/t6548/Test_2.scala
new file mode 100644
index 0000000000..cb5abd9c39
--- /dev/null
+++ b/test/files/run/t6548/Test_2.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+class Bean {
+ @JavaAnnotationWithNestedEnum_1(JavaAnnotationWithNestedEnum_1.Value.VALUE)
+ def value = 1
+}
+
+object Test extends App {
+ println(cm.staticClass("Bean").isCaseClass)
+ println(typeOf[Bean].decl(TermName("value")).annotations)
+}
diff --git a/test/files/run/t6549.check b/test/files/run/t6549.check
index bc78aac741..d5dfc5ebe8 100644
--- a/test/files/run/t6549.check
+++ b/test/files/run/t6549.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> case class `X"`(var xxx: Any)
defined class X$u0022
@@ -28,5 +26,3 @@ scala> val `"` = 0
": Int = 0
scala>
-
-scala>
diff --git a/test/files/run/t6554.check b/test/files/run/t6554.check
new file mode 100644
index 0000000000..6e0af7b474
--- /dev/null
+++ b/test/files/run/t6554.check
@@ -0,0 +1 @@
+public java.lang.Object Bar.minBy(java.lang.Object) / public java.lang.Object Bar.minBy(java.lang.Object)
diff --git a/test/files/run/t6554.scala b/test/files/run/t6554.scala
new file mode 100644
index 0000000000..5d29d16666
--- /dev/null
+++ b/test/files/run/t6554.scala
@@ -0,0 +1,11 @@
+trait Foo[A] {
+ def minBy[B](b: B): A = ???
+}
+
+class Bar extends Foo[Int]
+
+object Test extends App {
+ val sigs = classOf[Bar].getDeclaredMethods.map(m => s"${m.toString} / ${m.toGenericString}").sorted
+ println(sigs.mkString("\n"))
+}
+// Was public java.lang.Object Bar.minBy(java.lang.Object) / public <B> int Bar.minBy(B)
diff --git a/test/files/run/t6555.check b/test/files/run/t6555.check
index a18a8e8023..9ac115a13f 100644
--- a/test/files/run/t6555.check
+++ b/test/files/run/t6555.check
@@ -7,14 +7,14 @@ package <empty> {
};
private[this] val f: Int => Int = {
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction1$mcII$sp with Serializable {
- def <init>(): anonymous class $anonfun = {
+ def <init>(): <$anon: Int => Int> = {
$anonfun.super.<init>();
()
};
final def apply(param: Int): Int = $anonfun.this.apply$mcII$sp(param);
<specialized> def apply$mcII$sp(param: Int): Int = param
};
- (new anonymous class $anonfun(): Int => Int)
+ (new <$anon: Int => Int>(): Int => Int)
};
<stable> <accessor> def f(): Int => Int = Foo.this.f
}
diff --git a/test/files/run/t6555.scala b/test/files/run/t6555.scala
index b1a6137786..cc0e4d1bfa 100644
--- a/test/files/run/t6555.scala
+++ b/test/files/run/t6555.scala
@@ -3,7 +3,7 @@ import java.io.{Console => _, _}
object Test extends DirectTest {
- override def extraSettings: String = "-usejavacp -Xprint:specialize -d " + testOutput.path
+ override def extraSettings: String = "-usejavacp -Xprint:specialize -Ydelambdafy:inline -d " + testOutput.path
override def code = "class Foo { val f = (param: Int) => param } "
diff --git a/test/files/run/t657.scala b/test/files/run/t657.scala
index a9726092e7..e76b0292dd 100644
--- a/test/files/run/t657.scala
+++ b/test/files/run/t657.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ implicitConversions }
abstract class BaseList {
type Node <: NodeImpl;
implicit def convertNode(ni : NodeImpl) = ni.asInstanceOf[Node];
diff --git a/test/files/run/t6572/bar_1.scala b/test/files/run/t6572/bar_1.scala
deleted file mode 100644
index 5518ced7af..0000000000
--- a/test/files/run/t6572/bar_1.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-package bar
-
-abstract class IntBase[V] extends Base[Int, V]
-
-class DefaultIntBase[V <: IntProvider] extends IntBase[V] {
- override protected def hashCode(key: Int) = key
-}
-
-trait IntProvider {
- def int: Int
-}
-
-abstract class Base[@specialized K, V] {
-
- protected def hashCode(key: K) = key.hashCode
-
- def get(key: K): V = throw new RuntimeException
-
-} \ No newline at end of file
diff --git a/test/files/run/t6572/foo_2.scala b/test/files/run/t6572/foo_2.scala
deleted file mode 100644
index 465f0b7c3c..0000000000
--- a/test/files/run/t6572/foo_2.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-//package foo
-
-import bar._
-
-class FooProvider extends IntProvider {
- def int = 3
-}
-
-class Wrapper(users: DefaultIntBase[FooProvider]) {
- final def user(userId: Int) = users.get(userId)
-}
-
-object Test {
- def main(args: Array[String]) {
- new Wrapper(new DefaultIntBase)
- }
-} \ No newline at end of file
diff --git a/test/files/run/t6574b.check b/test/files/run/t6574b.check
new file mode 100644
index 0000000000..e10fa4f810
--- /dev/null
+++ b/test/files/run/t6574b.check
@@ -0,0 +1 @@
+List(5, 4, 3, 2, 1)
diff --git a/test/files/run/t6574b.scala b/test/files/run/t6574b.scala
new file mode 100644
index 0000000000..df329a31ca
--- /dev/null
+++ b/test/files/run/t6574b.scala
@@ -0,0 +1,7 @@
+object Test extends App {
+ implicit class AnyOps(val i: Int) extends AnyVal {
+ private def parentsOf(x: Int): List[Int] = if (x == 0) Nil else x :: parentsOf(x - 1)
+ def parents: List[Int] = parentsOf(i)
+ }
+ println((5).parents)
+}
diff --git a/test/files/run/t6591_1.check b/test/files/run/t6591_1.check
index b6cb6c286d..d1d448f283 100644
--- a/test/files/run/t6591_1.check
+++ b/test/files/run/t6591_1.check
@@ -1 +1 @@
-Block(List(ValDef(Modifiers(), newTermName("v"), Select(Ident(A), newTypeName("I")), Select(Ident(A), newTermName("impl")))), Ident(newTermName("v")))
+Block(List(ValDef(Modifiers(), TermName("v"), Select(Ident(A), TypeName("I")), Select(Ident(A), TermName("impl")))), Ident(TermName("v")))
diff --git a/test/files/run/t6591_2.check b/test/files/run/t6591_2.check
index b2d5797cbf..a2930b1749 100644
--- a/test/files/run/t6591_2.check
+++ b/test/files/run/t6591_2.check
@@ -1 +1 @@
-Block(List(ValDef(Modifiers(), newTermName("v"), SelectFromTypeTree(Ident(A), newTypeName("I")), Select(Apply(Select(New(Ident(A)), nme.CONSTRUCTOR), List()), newTermName("impl")))), Ident(newTermName("v")))
+Block(List(ValDef(Modifiers(), TermName("v"), SelectFromTypeTree(Ident(A), TypeName("I")), Select(Apply(Select(New(Ident(A)), termNames.CONSTRUCTOR), List()), TermName("impl")))), Ident(TermName("v")))
diff --git a/test/files/run/t6591_3.check b/test/files/run/t6591_3.check
index a7b594ba65..362aafd11c 100644
--- a/test/files/run/t6591_3.check
+++ b/test/files/run/t6591_3.check
@@ -1 +1 @@
-Block(List(ValDef(Modifiers(), newTermName("v"), Select(This(newTypeName("A")), newTypeName("I")), Apply(Select(New(Select(This(newTypeName("A")), newTypeName("I"))), nme.CONSTRUCTOR), List()))), Ident(newTermName("v")))
+Block(List(ValDef(Modifiers(), TermName("v"), Select(This(TypeName("A")), TypeName("I")), Apply(Select(New(Select(This(TypeName("A")), TypeName("I"))), termNames.CONSTRUCTOR), List()))), Ident(TermName("v")))
diff --git a/test/files/run/t6591_5.check b/test/files/run/t6591_5.check
index e0b6d06e6b..4ebc2236af 100644
--- a/test/files/run/t6591_5.check
+++ b/test/files/run/t6591_5.check
@@ -1 +1 @@
-Expr(Block(List(ValDef(Modifiers(), newTermName("v"), Select(Select(This(newTypeName("A")), newTermName("x")), newTypeName("I")), Select(Ident(scala.Predef), newTermName("$qmark$qmark$qmark")))), Ident(newTermName("v"))))
+Expr(Block(List(ValDef(Modifiers(), TermName("v"), Select(Select(This(TypeName("A")), TermName("x")), TypeName("I")), Select(Ident(scala.Predef), TermName("$qmark$qmark$qmark")))), Ident(TermName("v"))))
diff --git a/test/files/run/t6591_6.check b/test/files/run/t6591_6.check
index 0c4847b628..940e2026fe 100644
--- a/test/files/run/t6591_6.check
+++ b/test/files/run/t6591_6.check
@@ -1 +1 @@
-Expr(Block(List(ValDef(Modifiers(), newTermName("v"), Select(Select(Ident(newTermName("A")), newTermName("x")), newTypeName("I")), Select(Ident(scala.Predef), newTermName("$qmark$qmark$qmark")))), Ident(newTermName("v"))))
+Expr(Block(List(ValDef(Modifiers(), TermName("v"), Select(Select(Ident(TermName("A")), TermName("x")), TypeName("I")), Select(Ident(scala.Predef), TermName("$qmark$qmark$qmark")))), Ident(TermName("v"))))
diff --git a/test/files/run/t6591_7.scala b/test/files/run/t6591_7.scala
index b6c8d399a0..914842e613 100644
--- a/test/files/run/t6591_7.scala
+++ b/test/files/run/t6591_7.scala
@@ -1,5 +1,6 @@
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
+import internal._
object Test extends App {
locally {
@@ -13,10 +14,10 @@ object Test extends App {
// blocked by SI-7103, though it's not the focus of this test
// therefore I'm just commenting out the evaluation
// println(expr.eval)
- expr.tree.freeTerms foreach (ft => {
+ freeTerms(expr.tree) foreach (ft => {
// blocked by SI-7104, though it's not the focus of this test
- // therefore I'm just commenting out the call to typeSignature
- // println(s"name = ${ft.name}, sig = ${ft.typeSignature}, stable = ${ft.isStable}")
+ // therefore I'm just commenting out the call to info
+ // println(s"name = ${ft.name}, sig = ${ft.info}, stable = ${ft.isStable}")
println(s"name = ${ft.name}, stable = ${ft.isStable}")
})
}
diff --git a/test/files/run/t6608.check b/test/files/run/t6608.check
new file mode 100644
index 0000000000..15628b322e
--- /dev/null
+++ b/test/files/run/t6608.check
@@ -0,0 +1 @@
+(C$$yyy,true)
diff --git a/test/files/run/t6608.scala b/test/files/run/t6608.scala
new file mode 100644
index 0000000000..2ba979649b
--- /dev/null
+++ b/test/files/run/t6608.scala
@@ -0,0 +1,16 @@
+import reflect.runtime.universe
+
+class C {
+ private val yyy: Any = 1
+ @inline def foo = yyy
+}
+
+object Test extends App {
+ import universe._
+ val access = typeOf[C].decls
+ .toList
+ .filter(_.name.toString.endsWith("yyy"))
+ .map(x => (x.name, x.isPrivate))
+ println(access.head)
+}
+
diff --git a/test/files/run/t6611.scala b/test/files/run/t6611.scala
index 0947a48f90..c295368aea 100644
--- a/test/files/run/t6611.scala
+++ b/test/files/run/t6611.scala
@@ -7,55 +7,55 @@ object Test extends App {
locally {
val a = Array("1": Object)
- val a2 = Array[Object](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
locally {
val a = Array(true)
- val a2 = Array[Boolean](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
locally {
val a = Array(1: Short)
- val a2 = Array[Short](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
locally {
val a = Array(1: Byte)
- val a2 = Array[Byte](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
locally {
val a = Array(1)
- val a2 = Array[Int](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
locally {
val a = Array(1L)
- val a2 = Array[Long](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
locally {
val a = Array(1f)
- val a2 = Array[Float](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
locally {
val a = Array(1d)
- val a2 = Array[Double](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
locally {
val a = Array(())
- val a2 = Array[Unit](a: _*)
+ val a2 = Array(a: _*)
assert(a ne a2)
}
}
diff --git a/test/files/run/t6632.check b/test/files/run/t6632.check
index 1f084b1dac..26cf061b5f 100644
--- a/test/files/run/t6632.check
+++ b/test/files/run/t6632.check
@@ -1,3 +1,5 @@
java.lang.IndexOutOfBoundsException: -1
java.lang.IndexOutOfBoundsException: -2
java.lang.IndexOutOfBoundsException: -3
+java.lang.IndexOutOfBoundsException: -1
+java.lang.IndexOutOfBoundsException: 5
diff --git a/test/files/run/t6632.scala b/test/files/run/t6632.scala
index c1c8d4abe0..f338b73fa6 100644
--- a/test/files/run/t6632.scala
+++ b/test/files/run/t6632.scala
@@ -1,29 +1,22 @@
object Test extends App {
import collection.mutable.ListBuffer
-
+
def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
- val lb0 = newLB
+ def iiobe[A](f: => A) =
+ try { f }
+ catch { case ex: IndexOutOfBoundsException => println(ex) }
- try {
- lb0.insert(-1, 'x)
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
+ val lb0 = newLB
+ iiobe( lb0.insert(-1, 'x) )
val lb1 = newLB
-
- try {
- lb1.insertAll(-2, Array('x, 'y, 'z))
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
+ iiobe( lb1.insertAll(-2, Array('x, 'y, 'z)) )
val lb2 = newLB
+ iiobe( lb2.update(-3, 'u) )
- try {
- lb2.update(-3, 'u)
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
-} \ No newline at end of file
+ val lb3 = newLB
+ iiobe( lb3.updated(-1, 'u) )
+ iiobe( lb3.updated(5, 'u) )
+}
diff --git a/test/files/run/t6646.check b/test/files/run/t6646.check
index b0b7ad32f3..15715dae91 100644
--- a/test/files/run/t6646.check
+++ b/test/files/run/t6646.check
@@ -1,4 +1,4 @@
-Found NotNull
+Found NoNull
Found lower
Found 2
A single ident is always a pattern
diff --git a/test/files/run/t6646.scala b/test/files/run/t6646.scala
index 150b0df11e..a377ac274e 100644
--- a/test/files/run/t6646.scala
+++ b/test/files/run/t6646.scala
@@ -1,14 +1,14 @@
sealed trait ColumnOption
-case object NotNull extends ColumnOption
+case object NoNull extends ColumnOption
case object PrimaryKey extends ColumnOption
case object lower extends ColumnOption
object Test {
def main(args: Array[String]) {
- val l = List(PrimaryKey, NotNull, lower)
+ val l = List(PrimaryKey, NoNull, lower)
// withFilter must be generated in these
- for (option @ NotNull <- l) println("Found " + option)
+ for (option @ NoNull <- l) println("Found " + option)
for (option @ `lower` <- l) println("Found " + option)
for ((`lower`, i) <- l.zipWithIndex) println("Found " + i)
diff --git a/test/files/run/t6662/Macro_1.scala b/test/files/run/t6662/Macro_1.scala
index f373eaaf94..419859772d 100644
--- a/test/files/run/t6662/Macro_1.scala
+++ b/test/files/run/t6662/Macro_1.scala
@@ -1,5 +1,5 @@
import language.experimental.macros
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Demo {
def id[T](a: T): T = macro idImpl[T]
diff --git a/test/files/run/t6662/Test_2.scala b/test/files/run/t6662/Test_2.scala
index 03a80b655a..82ac54cb46 100644
--- a/test/files/run/t6662/Test_2.scala
+++ b/test/files/run/t6662/Test_2.scala
@@ -2,7 +2,7 @@
object Test {
def main(args: Array[String]) {
- val s = Demo id ()
+ val s = Demo id (())
println(s)
}
}
diff --git a/test/files/run/t6663.flags b/test/files/run/t6663.flags
new file mode 100644
index 0000000000..ea7fc37e1a
--- /dev/null
+++ b/test/files/run/t6663.flags
@@ -0,0 +1 @@
+-Yrangepos:false
diff --git a/test/files/run/t6669.scala b/test/files/run/t6669.scala
index b55718b12b..e18f2514a9 100644
--- a/test/files/run/t6669.scala
+++ b/test/files/run/t6669.scala
@@ -2,7 +2,7 @@ import java.io.{ByteArrayOutputStream, PrintStream}
object Test extends App {
val baos = new ByteArrayOutputStream()
- val ps = new PrintStream(baos)
+ val ps = new PrintStream(baos)
// first test with the default classpath
(scala.Console withOut ps) {
diff --git a/test/files/run/t6690.check b/test/files/run/t6690.check
new file mode 100644
index 0000000000..a92ddc0e51
--- /dev/null
+++ b/test/files/run/t6690.check
@@ -0,0 +1 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t6690.scala b/test/files/run/t6690.scala
index 43ede967a0..15b1817e87 100644
--- a/test/files/run/t6690.scala
+++ b/test/files/run/t6690.scala
@@ -1,5 +1,7 @@
import scala.collection.mutable
+import scala.language.{ reflectiveCalls }
+
object Test extends App {
def last0(ml: mutable.MutableList[Int]) =
ml.asInstanceOf[{def last0: mutable.LinkedList[Int]}].last0
diff --git a/test/files/run/t6719.check b/test/files/run/t6719.check
new file mode 100644
index 0000000000..6a452c185a
--- /dev/null
+++ b/test/files/run/t6719.check
@@ -0,0 +1 @@
+()
diff --git a/test/files/run/t6719.scala b/test/files/run/t6719.scala
new file mode 100644
index 0000000000..847929a95d
--- /dev/null
+++ b/test/files/run/t6719.scala
@@ -0,0 +1,8 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.{ToolBox, ToolBoxError}
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val tree = tb.parse("(); val res = 0")
+ println(tb.eval(tree))
+} \ No newline at end of file
diff --git a/test/files/run/t6731.flags b/test/files/run/t6731.flags
new file mode 100644
index 0000000000..ea7fc37e1a
--- /dev/null
+++ b/test/files/run/t6731.flags
@@ -0,0 +1 @@
+-Yrangepos:false
diff --git a/test/files/run/t6731.scala b/test/files/run/t6731.scala
index 89d212e91e..12357b935e 100644
--- a/test/files/run/t6731.scala
+++ b/test/files/run/t6731.scala
@@ -12,7 +12,7 @@ abstract class MonoDynamic extends Dynamic {
def applyDynamic(name: String)(args: Any*): String = show(this + "." + name + mkArgs(args: _*))
def applyDynamicNamed(name: String)(args: (String, Any)*): String = show(this + "." + name + mkArgs(args: _*))
- override def toString = this.getClass.getName split '.' last
+ override def toString = (this.getClass.getName split '.').last
}
object Mono extends MonoDynamic {
diff --git a/test/files/run/t6732.check b/test/files/run/t6732.check
new file mode 100644
index 0000000000..016c6e50c0
--- /dev/null
+++ b/test/files/run/t6732.check
@@ -0,0 +1,4 @@
+scala#PK: true, false, true, false
+scala#PKC: false, true, true, true
+scala.collection.immutable.List#MOD: true, false, false, false
+scala.collection.immutable.List#MODC: false, true, false, false
diff --git a/test/files/run/t6732.scala b/test/files/run/t6732.scala
new file mode 100644
index 0000000000..fdc1ab04e6
--- /dev/null
+++ b/test/files/run/t6732.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+import definitions._
+
+object Test extends App {
+ def test(sym: Symbol): Unit = {
+ println(s"${showRaw(sym, printKinds = true)}: ${sym.isModule}, ${sym.isModuleClass}, ${sym.isPackage}, ${sym.isPackageClass}")
+ }
+ test(ScalaPackage)
+ test(ScalaPackageClass)
+ test(ListModule)
+ test(ListModule.moduleClass)
+} \ No newline at end of file
diff --git a/test/files/run/t6733.check b/test/files/run/t6733.check
new file mode 100644
index 0000000000..aeb595fbfd
--- /dev/null
+++ b/test/files/run/t6733.check
@@ -0,0 +1,27 @@
+method $init$: isPrivateThis = false, isProtectedThis = false
+value pri1a: isPrivateThis = true, isProtectedThis = false
+method pri2a: isPrivateThis = true, isProtectedThis = false
+variable pri3a: isPrivateThis = true, isProtectedThis = false
+value pri4a: isPrivateThis = true, isProtectedThis = false
+lazy value pri4a: isPrivateThis = true, isProtectedThis = false
+type Pri5a: isPrivateThis = true, isProtectedThis = false
+class Pri6: isPrivateThis = true, isProtectedThis = false
+trait Pri7: isPrivateThis = true, isProtectedThis = false
+object Pri8: isPrivateThis = true, isProtectedThis = false
+value pro1a: isPrivateThis = false, isProtectedThis = true
+value pro1a: isPrivateThis = true, isProtectedThis = false
+value pro1b: isPrivateThis = false, isProtectedThis = true
+method pro2a: isPrivateThis = false, isProtectedThis = true
+method pro2b: isPrivateThis = false, isProtectedThis = true
+method pro3a: isPrivateThis = false, isProtectedThis = true
+method pro3a_=: isPrivateThis = false, isProtectedThis = true
+variable pro3a: isPrivateThis = true, isProtectedThis = false
+method pro3b: isPrivateThis = false, isProtectedThis = true
+method pro3b_=: isPrivateThis = false, isProtectedThis = true
+value pro4a: isPrivateThis = false, isProtectedThis = true
+lazy value pro4a: isPrivateThis = true, isProtectedThis = false
+type Pro5a: isPrivateThis = false, isProtectedThis = true
+type Pro5b: isPrivateThis = false, isProtectedThis = true
+class Pro6: isPrivateThis = false, isProtectedThis = true
+trait Pro7: isPrivateThis = false, isProtectedThis = true
+object Pro8: isPrivateThis = false, isProtectedThis = true
diff --git a/test/files/run/t6733.scala b/test/files/run/t6733.scala
new file mode 100644
index 0000000000..df1946a9d5
--- /dev/null
+++ b/test/files/run/t6733.scala
@@ -0,0 +1,35 @@
+import scala.reflect.runtime.universe._
+
+trait Foo {
+ private[this] val pri1a = 0
+ // private[this] val pri1b: Int
+ private[this] def pri2a = 1
+ // private[this] def pri2b: Int
+ private[this] var pri3a = 0
+ // private[this] var pri3b: Int
+ private[this] lazy val pri4a = 0
+ // private[this] lazy val pri4b: Int
+ private[this] type Pri5a = Int
+ // private[this] type Pri5b <: Int
+ private[this] class Pri6
+ private[this] trait Pri7
+ private[this] object Pri8
+
+ protected[this] val pro1a = 0
+ protected[this] val pro1b: Int
+ protected[this] def pro2a = 1
+ protected[this] def pro2b: Int
+ protected[this] var pro3a = 0
+ protected[this] var pro3b: Int
+ protected[this] lazy val pro4a = 0
+ // protected[this] lazy val pro4b: Int
+ protected[this] type Pro5a = Int
+ protected[this] type Pro5b <: Int
+ protected[this] class Pro6
+ protected[this] trait Pro7
+ protected[this] object Pro8
+}
+
+object Test extends App {
+ typeOf[Foo].decls.sorted.foreach(m => println(s"$m: isPrivateThis = ${m.isPrivateThis}, isProtectedThis = ${m.isProtectedThis}"))
+} \ No newline at end of file
diff --git a/test/files/run/t6745-2.scala b/test/files/run/t6745-2.scala
new file mode 100644
index 0000000000..5afa65d28a
--- /dev/null
+++ b/test/files/run/t6745-2.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc._
+import scala.tools.partest.CompilerTest
+import scala.collection.{ mutable, immutable, generic }
+
+object Test extends CompilerTest {
+ import global._
+ import rootMirror._
+ import definitions._
+ import global.analyzer.{Context, ImportInfo}
+
+ override def code = """
+package context {
+}
+ """
+
+ def check(source: String, unit: global.CompilationUnit) = {
+ val context: Context = global.analyzer.rootContext(unit)
+ val importInfo: ImportInfo = context.imports.head // Predef._
+ val importedSym = importInfo.importedSymbol(termNames.CONSTRUCTOR)
+ assert(importedSym == NoSymbol, importedSym) // was "constructor Predef"
+ }
+}
diff --git a/test/files/run/t6814.check b/test/files/run/t6814.check
new file mode 100644
index 0000000000..97ada77202
--- /dev/null
+++ b/test/files/run/t6814.check
@@ -0,0 +1,7 @@
+List[Int]
+scala.collection.immutable.List.type
+object java.lang.RuntimeException is not a value
+List[Int]
+List
+scala.collection.immutable.List.type
+scala.collection.immutable.List.type does not take parameters
diff --git a/test/files/run/t6814/Macros_1.scala b/test/files/run/t6814/Macros_1.scala
new file mode 100644
index 0000000000..0257f451d6
--- /dev/null
+++ b/test/files/run/t6814/Macros_1.scala
@@ -0,0 +1,24 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+
+ def test(tree: Tree, mode: c.TypecheckMode): String = {
+ try c.typecheck(tree, mode, silent = false).tpe.toString
+ catch { case c.TypecheckException(_, msg) => msg }
+ }
+
+ q"""
+ println(${test(q"List(1, 2)", c.TERMmode)})
+ println(${test(q"List", c.TERMmode)})
+ println(${test(q"RuntimeException", c.TERMmode)})
+ println(${test(tq"List[Int]", c.TYPEmode)})
+ println(${test(tq"List", c.TYPEmode)})
+ println(${test(q"List", c.TYPEmode)})
+ println(${test(q"List(1, 2)", c.TYPEmode)})
+ """
+ }
+ def foo: Unit = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent-b/Test_2.scala b/test/files/run/t6814/Test_2.scala
index 7dffc5107d..acfddae942 100644
--- a/test/files/run/macro-def-path-dependent-b/Test_2.scala
+++ b/test/files/run/t6814/Test_2.scala
@@ -1,3 +1,3 @@
object Test extends App {
- println("it works")
+ Macros.foo
} \ No newline at end of file
diff --git a/test/files/run/t6860.check b/test/files/run/t6860.check
new file mode 100644
index 0000000000..c96331f540
--- /dev/null
+++ b/test/files/run/t6860.check
@@ -0,0 +1,4 @@
+Bippy[String]
+Bippy[String]
+throws[Nothing]
+throws[RuntimeException]
diff --git a/test/files/run/t6860.scala b/test/files/run/t6860.scala
new file mode 100644
index 0000000000..c2f8db02c2
--- /dev/null
+++ b/test/files/run/t6860.scala
@@ -0,0 +1,20 @@
+class Bippy[T](val value: T) extends annotation.StaticAnnotation
+
+class A {
+ @Bippy("hi") def f1: Int = 1
+ @Bippy[String]("hi") def f2: Int = 2
+
+ @throws("what do I throw?") def f3 = throw new RuntimeException
+ @throws[RuntimeException]("that's good to know!") def f4 = throw new RuntimeException
+}
+
+object Test {
+ import scala.reflect.runtime.universe._
+
+ def main(args: Array[String]): Unit = {
+ val members = typeOf[A].decls.toList
+ val tpes = members flatMap (_.annotations) map (_.tree.tpe)
+
+ tpes.map(_.toString).sorted foreach println
+ }
+}
diff --git a/test/files/run/t6863.check b/test/files/run/t6863.check
new file mode 100644
index 0000000000..fea22b582f
--- /dev/null
+++ b/test/files/run/t6863.check
@@ -0,0 +1,13 @@
+t6863.scala:38: warning: comparing values of types Unit and Unit using `==' will always yield true
+ assert({ () => x}.apply == ())
+ ^
+t6863.scala:42: warning: comparing values of types Unit and Unit using `==' will always yield true
+ assert({ () => x}.apply == ())
+ ^
+t6863.scala:46: warning: comparing values of types Unit and Unit using `==' will always yield true
+ assert({ () => x}.apply == ())
+ ^
+t6863.scala:59: warning: comparing values of types Unit and Unit using `==' will always yield true
+ assert({ () => x }.apply == ())
+ ^
+warning: there were 4 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t6863.scala b/test/files/run/t6863.scala
index d77adb6af4..7210ebc01d 100644
--- a/test/files/run/t6863.scala
+++ b/test/files/run/t6863.scala
@@ -3,34 +3,34 @@ object Test {
def lazyVal() = {
// internally lazy vals become vars which are initialized with "_", so they need to be tested just like vars do
lazy val x = "42"
- assert({ () => x }.apply == "42")
+ assert({ () => x }.apply == "42")
}
def ident() = {
val y = "42"
var x = y
- assert({ () => x }.apply == "42")
+ assert({ () => x }.apply == "42")
}
def apply() = {
def y(x : Int) = x.toString
var x = y(42)
- assert({ () => x }.apply == "42")
+ assert({ () => x }.apply == "42")
}
def literal() = {
var x = "42"
- assert({ () => x }.apply == "42")
+ assert({ () => x }.apply == "42")
}
def `new`() = {
var x = new String("42")
- assert({ () => x }.apply == "42")
+ assert({ () => x }.apply == "42")
}
def select() = {
object Foo{val bar = "42"}
var x = Foo.bar
- assert({ () => x }.apply == "42")
+ assert({ () => x }.apply == "42")
}
def `throw`() = {
var x = if (true) "42" else throw new Exception("42")
- assert({ () => x }.apply == "42")
+ assert({ () => x }.apply == "42")
}
def assign() = {
var y = 1
@@ -51,7 +51,7 @@ object Test {
assert({ () => x }.apply == "42")
}
def tryCatch() = {
- var x = try { "42" } catch { case _ => "43" }
+ var x = try { "42" } catch { case _: Throwable => "43" }
assert({ () => x }.apply == "42")
}
def `if`() = {
@@ -59,7 +59,7 @@ object Test {
assert({ () => x }.apply == ())
}
def ifElse() = {
- var x = if(true) "42" else "43"
+ var x = if(true) "42" else "43"
assert({ () => x }.apply == "42")
}
def matchCase() = {
@@ -77,7 +77,7 @@ object Test {
assert({ () => x }.apply == "42")
}
def labelDef() = {
- var x = 100 match {
+ var x = 100 match {
case 100 => try "42" finally ()
}
assert({ () => x }.apply == "42")
@@ -85,8 +85,8 @@ object Test {
def nested() = {
var x = {
val y = 42
- if(true) try "42" catch {case _ => "43"}
- else "44"
+ if(true) try "42" catch {case _: Throwable => "43"}
+ else "44"
}
assert({ () => x }.apply == "42")
}
diff --git a/test/files/run/t6908.scala b/test/files/run/t6908.scala
new file mode 100644
index 0000000000..a641de96b9
--- /dev/null
+++ b/test/files/run/t6908.scala
@@ -0,0 +1,6 @@
+object Test {
+ def main(args: Array[String]) {
+ val set = collection.mutable.Set("1", null, "3").par
+ assert( set exists (_ eq null) )
+ }
+}
diff --git a/test/files/run/t6935.check b/test/files/run/t6935.check
new file mode 100644
index 0000000000..844ca54682
--- /dev/null
+++ b/test/files/run/t6935.check
@@ -0,0 +1 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t6935.scala b/test/files/run/t6935.scala
index dea2d7f2e2..fdaf02e5ce 100644
--- a/test/files/run/t6935.scala
+++ b/test/files/run/t6935.scala
@@ -1,14 +1,14 @@
object Test {
def main(args: Array[String]): Unit = {
- import java.io._
- val bytes = new ByteArrayOutputStream()
- val out = new ObjectOutputStream(bytes)
- out.writeObject(())
- out.close()
- val buf = bytes.toByteArray
- val in = new ObjectInputStream(new ByteArrayInputStream(buf))
- val unit = in.readObject()
- assert(unit == ())
+ import java.io._
+ val bytes = new ByteArrayOutputStream()
+ val out = new ObjectOutputStream(bytes)
+ out.writeObject(())
+ out.close()
+ val buf = bytes.toByteArray
+ val in = new ObjectInputStream(new ByteArrayInputStream(buf))
+ val unit = in.readObject()
+ assert(unit == ())
}
}
diff --git a/test/files/run/t6937.check b/test/files/run/t6937.check
index 9a1fa4cfaf..4729dc7006 100644
--- a/test/files/run/t6937.check
+++ b/test/files/run/t6937.check
@@ -1,9 +1,7 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
-scala> import scala.reflect.runtime.{universe => ru}
+scala> import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{universe=>ru}
scala> import scala.reflect.runtime.{currentMirror => cm}
@@ -22,5 +20,3 @@ scala> apiru.typeTag[A].in(cm)
res0: reflect.runtime.universe.TypeTag[A] = TypeTag[A]
scala>
-
-scala>
diff --git a/test/files/run/t6955.scala b/test/files/run/t6955.scala
index 2610acdec4..329af688e4 100644
--- a/test/files/run/t6955.scala
+++ b/test/files/run/t6955.scala
@@ -1,5 +1,6 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
+// this class should compile to code that uses switches (twice)
class Switches {
type Tag = Byte
@@ -10,7 +11,8 @@ class Switches {
case _ => 0
}
- def switchOkay(i: Byte): Int = i match { // notice type of i is Byte
+ // this worked before, should keep working
+ def switchOkay(i: Byte): Int = i match {
case 1 => 1
case 2 => 2
case 3 => 3
@@ -18,9 +20,15 @@ class Switches {
}
}
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
// ensure we get two switches out of this -- ignore the rest of the output for robustness
// exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file)
- override def show() = println(collectIcode("").filter(x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1).size)
+ override def show() = {
+ val expected = 2
+ val actual = (collectIcode() filter {
+ x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1
+ }).size
+ assert(actual == expected)
+ }
}
diff --git a/test/files/run/t6956.scala b/test/files/run/t6956.scala
index 4a6583ca45..3569adf483 100644
--- a/test/files/run/t6956.scala
+++ b/test/files/run/t6956.scala
@@ -1,4 +1,4 @@
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
class Switches {
private[this] final val ONE = 1
@@ -18,9 +18,14 @@ class Switches {
}
}
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
// ensure we get two switches out of this -- ignore the rest of the output for robustness
// exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file)
- override def show() = println(collectIcode("").filter(x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1).size)
+ override def show() = {
+ val expected = 2
+ val actual = (collectIcode() filter {
+ x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1
+ }).size
+ assert(actual == expected)
+ }
}
-
diff --git a/test/files/run/t6969.scala b/test/files/run/t6969.scala
index 8cfc28c1e5..c4561b4424 100644
--- a/test/files/run/t6969.scala
+++ b/test/files/run/t6969.scala
@@ -1,3 +1,7 @@
+
+
+import scala.language.{ reflectiveCalls }
+
object Test {
private type Clearable = { def clear(): Unit }
private def choke() = {
diff --git a/test/files/run/t6988.check b/test/files/run/t6988.check
new file mode 100644
index 0000000000..5db04832d6
--- /dev/null
+++ b/test/files/run/t6988.check
@@ -0,0 +1,2 @@
+#1 13
+#2 13
diff --git a/test/files/run/t6988.scala b/test/files/run/t6988.scala
new file mode 100644
index 0000000000..45dfe33461
--- /dev/null
+++ b/test/files/run/t6988.scala
@@ -0,0 +1,9 @@
+case class User()
+
+@SerialVersionUID(13l) case class IdentifyMessage1(userName: String, user: User, code: Int)
+@SerialVersionUID(10l + 3l) case class IdentifyMessage2(userName: String, user: User, code: Int)
+
+object Test extends App {
+ println("#1 " + java.io.ObjectStreamClass.lookup(IdentifyMessage1("hei", User(), 8).getClass).getSerialVersionUID)
+ println("#2 " + java.io.ObjectStreamClass.lookup(IdentifyMessage2("hei", User(), 8).getClass).getSerialVersionUID)
+}
diff --git a/test/files/run/t6989/Test_2.scala b/test/files/run/t6989/Test_2.scala
index e48e82422d..932a369f6c 100644
--- a/test/files/run/t6989/Test_2.scala
+++ b/test/files/run/t6989/Test_2.scala
@@ -11,20 +11,20 @@ import scala.reflect.runtime.universe._
package object foo {
def testAll(): Unit = {
test(typeOf[foo.PackagePrivateJavaClass].typeSymbol)
- test(typeOf[foo.PackagePrivateJavaClass].typeSymbol.companionSymbol)
+ test(typeOf[foo.PackagePrivateJavaClass].typeSymbol.companion)
test(typeOf[foo.JavaClass_1].typeSymbol)
- test(typeOf[foo.JavaClass_1].typeSymbol.companionSymbol)
+ test(typeOf[foo.JavaClass_1].typeSymbol.companion)
}
def test(sym: Symbol): Unit = {
printSymbolDetails(sym)
if (sym.isClass || sym.isModule) {
- sym.typeSignature.declarations.toList.sortBy(_.name.toString) foreach test
+ sym.info.decls.toList.sortBy(_.name.toString) foreach test
}
}
def printSymbolDetails(sym: Symbol): Unit = {
- def stableSignature(sym: Symbol) = sym.typeSignature match {
+ def stableSignature(sym: Symbol) = sym.info match {
case ClassInfoType(_, _, _) => "ClassInfoType(...)"
case tpe => tpe.toString
}
diff --git a/test/files/run/t6992.check b/test/files/run/t6992.check
new file mode 100644
index 0000000000..021f32ec95
--- /dev/null
+++ b/test/files/run/t6992.check
@@ -0,0 +1,4 @@
+Test.foo.T
+Int
+42
+42
diff --git a/test/files/run/t6992/Macros_1.scala b/test/files/run/t6992/Macros_1.scala
new file mode 100644
index 0000000000..f578f2b3c0
--- /dev/null
+++ b/test/files/run/t6992/Macros_1.scala
@@ -0,0 +1,75 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+object Macros {
+ def foo(name: String): Any = macro foo_impl
+ def foo_impl(c: Context)(name: c.Expr[String]) = {
+ import c.universe._
+
+ val Literal(Constant(lit: String)) = name.tree
+ val anon = newTypeName(c.fresh)
+
+ c.Expr(Block(
+ ClassDef(
+ Modifiers(Flag.FINAL), anon, Nil, Template(
+ Nil, noSelfType, List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))),
+ TypeDef(Modifiers(), TypeName(lit), Nil, TypeTree(typeOf[Int]))
+ )
+ )
+ ),
+ Apply(Select(New(Ident(anon)), termNames.CONSTRUCTOR), Nil)
+ ))
+ }
+
+ def bar(name: String): Any = macro bar_impl
+ def bar_impl(c: Context)(name: c.Expr[String]) = {
+ import c.universe._
+
+ val Literal(Constant(lit: String)) = name.tree
+ val anon = newTypeName(c.fresh)
+
+ c.Expr(Block(
+ ClassDef(
+ Modifiers(Flag.FINAL), anon, Nil, Template(
+ Nil, noSelfType, List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))),
+ DefDef(
+ Modifiers(), TermName(lit), Nil, Nil, TypeTree(),
+ c.literal(42).tree
+ )
+ )
+ )
+ ),
+ Apply(Select(New(Ident(anon)), termNames.CONSTRUCTOR), Nil)
+ ))
+ }
+
+ def baz(name: String): Any = macro baz_impl
+ def baz_impl(c: Context)(name: c.Expr[String]) = {
+ import c.universe._
+
+ val Literal(Constant(lit: String)) = name.tree
+ val anon = newTypeName(c.fresh)
+ val wrapper = newTypeName(c.fresh)
+
+ c.Expr(Block(
+ ClassDef(
+ Modifiers(), anon, Nil, Template(
+ Nil, emptyValDef, List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))),
+ DefDef(
+ Modifiers(), TermName(lit), Nil, Nil, TypeTree(),
+ c.literal(42).tree
+ )
+ )
+ )
+ ),
+ ClassDef(
+ Modifiers(Flag.FINAL), wrapper, Nil,
+ Template(Ident(anon) :: Nil, noSelfType, DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))) :: Nil)
+ ),
+ Apply(Select(New(Ident(wrapper)), termNames.CONSTRUCTOR), Nil)
+ ))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6992/Test_2.scala b/test/files/run/t6992/Test_2.scala
new file mode 100644
index 0000000000..2399bf81df
--- /dev/null
+++ b/test/files/run/t6992/Test_2.scala
@@ -0,0 +1,14 @@
+import scala.language.reflectiveCalls
+
+object Test extends App {
+ val foo = Macros.foo("T")
+ val ttpe = scala.reflect.runtime.universe.weakTypeOf[foo.T]
+ println(ttpe)
+ println(ttpe.typeSymbol.info)
+
+ val bar = Macros.bar("test")
+ println(bar.test)
+
+ val baz = Macros.baz("test")
+ println(baz.test)
+} \ No newline at end of file
diff --git a/test/files/run/t7008-scala-defined.flags b/test/files/run/t7008-scala-defined.flags
new file mode 100644
index 0000000000..49f2d2c4c8
--- /dev/null
+++ b/test/files/run/t7008-scala-defined.flags
@@ -0,0 +1 @@
+-Ybackend:GenASM
diff --git a/test/files/run/t7008-scala-defined/Impls_Macros_2.scala b/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
index 94fd99018e..330db8da75 100644
--- a/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
+++ b/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
@@ -1,11 +1,12 @@
import language.experimental.macros
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl(c: Context) = {
- val decls = c.typeOf[ScalaClassWithCheckedExceptions_1[_]].declarations.toList
+ import c.universe._
+ val decls = c.typeOf[ScalaClassWithCheckedExceptions_1[_]].decls.toList
val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL)
- c.universe.reify(println(c.literal(s).splice))
+ reify(println(c.Expr[String](Literal(Constant(s))).splice))
}
def foo = macro impl
diff --git a/test/files/run/t7008-scala-defined/Test_3.scala b/test/files/run/t7008-scala-defined/Test_3.scala
index 03bb79d311..ee7b9d9cde 100644
--- a/test/files/run/t7008-scala-defined/Test_3.scala
+++ b/test/files/run/t7008-scala-defined/Test_3.scala
@@ -4,6 +4,6 @@ object Test extends App {
Macros.foo
println("=============")
- val decls = typeOf[ScalaClassWithCheckedExceptions_1[_]].declarations.toList
+ val decls = typeOf[ScalaClassWithCheckedExceptions_1[_]].decls.toList
decls sortBy (_.name.toString) foreach (decl => println(s"${decl.name}: ${decl.annotations}"))
} \ No newline at end of file
diff --git a/test/files/run/t7008/Impls_Macros_2.scala b/test/files/run/t7008/Impls_Macros_2.scala
index 7a17314085..3c6fe116ce 100644
--- a/test/files/run/t7008/Impls_Macros_2.scala
+++ b/test/files/run/t7008/Impls_Macros_2.scala
@@ -1,11 +1,12 @@
import language.experimental.macros
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl(c: Context) = {
- val decls = c.typeOf[JavaClassWithCheckedExceptions_1[_]].declarations.toList
+ import c.universe._
+ val decls = c.typeOf[JavaClassWithCheckedExceptions_1[_]].decls.toList
val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL)
- c.universe.reify(println(c.literal(s).splice))
+ reify(println(c.Expr[String](Literal(Constant(s))).splice))
}
def foo = macro impl
diff --git a/test/files/run/t7008/Test_3.scala b/test/files/run/t7008/Test_3.scala
index b2961a829e..99db05e810 100644
--- a/test/files/run/t7008/Test_3.scala
+++ b/test/files/run/t7008/Test_3.scala
@@ -4,6 +4,6 @@ object Test extends App {
Macros.foo
println("=============")
- val decls = typeOf[JavaClassWithCheckedExceptions_1[_]].declarations.toList
+ val decls = typeOf[JavaClassWithCheckedExceptions_1[_]].decls.toList
decls sortBy (_.name.toString) foreach (decl => println(s"${decl.name}: ${decl.annotations}"))
} \ No newline at end of file
diff --git a/test/files/run/t7015.check b/test/files/run/t7015.check
new file mode 100644
index 0000000000..7651fe06b0
--- /dev/null
+++ b/test/files/run/t7015.check
@@ -0,0 +1,11 @@
+Method returns Null type: null
+Method takes non Null type: null
+call through method null
+call through bridge null
+fetch field: null
+fetch field on companion: null
+fetch local: null
+fetch array element: null
+method that takes object: null
+method that takes anyref: null
+method that takes any: null
diff --git a/test/files/run/t7015.scala b/test/files/run/t7015.scala
new file mode 100644
index 0000000000..37a73a9fc4
--- /dev/null
+++ b/test/files/run/t7015.scala
@@ -0,0 +1,49 @@
+object Test {
+ def main(args : Array[String]) : Unit = {
+ println(s"Method returns Null type: $f")
+ println(s"Method takes non Null type: ${g(null)}")
+
+ // pass things through the g function because it expects
+ // a string. If we haven't adapted properly then we'll
+ // get verify errors
+ val b = new B
+ println(s"call through method ${g(b.f(null))}")
+ println(s"call through bridge ${g((b: A).f(null))}")
+
+ println(s"fetch field: ${g(b.nullField)}")
+ println(s"fetch field on companion: ${g(B.nullCompanionField)}")
+
+ val x = f
+ println(s"fetch local: ${g(x)}")
+
+ val nulls = Array(f, f, f)
+ println(s"fetch array element: ${g(nulls(0))}")
+
+ println(s"method that takes object: ${q(f)}")
+ println(s"method that takes anyref: ${r(f)}")
+ println(s"method that takes any: ${s(f)}")
+ }
+
+ def f: Null = null
+
+ def g(x: String) = x
+
+ def q(x: java.lang.Object) = x
+ def r(x: AnyRef) = x
+ def s(x: Any) = x
+}
+
+abstract class A {
+ def f(x: String): String
+}
+
+class B extends A {
+ val nullField = null
+
+ // this forces a bridge method because the return type is different
+ override def f(x: String) : Null = null
+}
+
+object B {
+ val nullCompanionField = null
+} \ No newline at end of file
diff --git a/test/files/run/t7044.check b/test/files/run/t7044.check
new file mode 100644
index 0000000000..ab523873bf
--- /dev/null
+++ b/test/files/run/t7044.check
@@ -0,0 +1,14 @@
+compile-time
+uninitialized File: <no file>
+initialized File: <no file>
+uninitialized BitSet: <no file>
+initialized BitSet: <no file>
+uninitialized C: Test_2.scala
+initialized C: Test_2.scala
+runtime
+autoinitialized File: <no file> true
+autoinitialized File: <no file> true
+autoinitialized BitSet: <no file> true
+autoinitialized BitSet: <no file> true
+autoinitialized C: <no file> true
+autoinitialized C: <no file> true
diff --git a/test/files/run/t7044/Macros_1.scala b/test/files/run/t7044/Macros_1.scala
new file mode 100644
index 0000000000..3b3f8c3385
--- /dev/null
+++ b/test/files/run/t7044/Macros_1.scala
@@ -0,0 +1,26 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ var messages = List[String]()
+ def println(msg: String) = messages :+= msg
+
+ import c.universe._
+ def test(tpe: Type): Unit = {
+ val sym = tpe.typeSymbol
+ println(s"uninitialized ${sym.name}: ${sym.pos.source.file.name}")
+ internal.initialize(sym)
+ println(s"initialized ${sym.name}: ${sym.pos.source.file.name}")
+ }
+
+ println("compile-time")
+ test(typeOf[java.io.File])
+ test(typeOf[scala.collection.BitSet])
+ test(c.mirror.staticClass("C").toType)
+
+ q"..${messages.map(msg => q"println($msg)")}"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/t7044/Test_2.scala b/test/files/run/t7044/Test_2.scala
new file mode 100644
index 0000000000..8dfb349086
--- /dev/null
+++ b/test/files/run/t7044/Test_2.scala
@@ -0,0 +1,19 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+class C
+
+object Test extends App {
+ def test(tpe: Type): Unit = {
+ val sym = tpe.typeSymbol
+ println(s"autoinitialized ${sym.name}: ${sym.pos.source.file.name} ${sym.pos.source.file.sizeOption.nonEmpty}")
+ internal.initialize(sym)
+ println(s"autoinitialized ${sym.name}: ${sym.pos.source.file.name} ${sym.pos.source.file.sizeOption.nonEmpty}")
+ }
+
+ Macros.foo
+ println("runtime")
+ test(typeOf[java.io.File])
+ test(typeOf[scala.collection.BitSet])
+ test(typeOf[C])
+}
diff --git a/test/files/run/t7045.check b/test/files/run/t7045.check
new file mode 100644
index 0000000000..28134535c8
--- /dev/null
+++ b/test/files/run/t7045.check
@@ -0,0 +1,2 @@
+D with C
+D with C
diff --git a/test/files/run/t7045.scala b/test/files/run/t7045.scala
new file mode 100644
index 0000000000..5b31a8b779
--- /dev/null
+++ b/test/files/run/t7045.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+class C
+class D { self: C => }
+
+object Test extends App {
+ val d = cm.staticClass("D")
+ println(d.selfType)
+ d.info
+ println(d.selfType)
+} \ No newline at end of file
diff --git a/test/files/run/t7046.scala b/test/files/run/t7046.scala
index 647a15cd18..f15545f59f 100644
--- a/test/files/run/t7046.scala
+++ b/test/files/run/t7046.scala
@@ -8,6 +8,6 @@ class E extends C
object Test extends App {
val c = cm.staticClass("C")
println(c.knownDirectSubclasses)
- c.typeSignature
+ c.info
println(c.knownDirectSubclasses)
} \ No newline at end of file
diff --git a/test/files/run/t7047.check b/test/files/run/t7047.check
index e69de29bb2..32bd581094 100644
--- a/test/files/run/t7047.check
+++ b/test/files/run/t7047.check
@@ -0,0 +1,3 @@
+Test_2.scala:2: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ Macros.foo
+ ^
diff --git a/test/files/run/t7047/Impls_Macros_1.scala b/test/files/run/t7047/Impls_Macros_1.scala
index 2992e3efe4..787ea6cfe8 100644
--- a/test/files/run/t7047/Impls_Macros_1.scala
+++ b/test/files/run/t7047/Impls_Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
class Foo
@@ -12,7 +12,7 @@ object Macros {
} catch {
case _: Exception =>
}
- c.literalNull
+ c.Expr[Null](Literal(Constant(null)))
}
def foo = macro impl
diff --git a/test/files/run/t7064-old-style-supercalls.scala b/test/files/run/t7064-old-style-supercalls.scala
deleted file mode 100644
index cffa7b1888..0000000000
--- a/test/files/run/t7064-old-style-supercalls.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-import scala.reflect.runtime.universe._
-import Flag._
-import definitions._
-import scala.reflect.runtime.{currentMirror => cm}
-import scala.tools.reflect.ToolBox
-import scala.tools.reflect.Eval
-
-object Test extends App {
- val PARAMACCESSOR = (1L << 29).asInstanceOf[FlagSet]
-
- // these trees can be acquired by running the following incantation:
- // echo 'class C(val x: Int); class D extends C(2)' > foo.scala
- // ./scalac -Xprint:parser -Yshow-trees-stringified -Yshow-trees-compact foo.scala
-
- val c = ClassDef(
- Modifiers(), newTypeName("C"), List(),
- Template(
- List(Select(Ident(ScalaPackage), newTypeName("AnyRef"))),
- emptyValDef,
- List(
- ValDef(Modifiers(PARAMACCESSOR), newTermName("x"), Ident(newTypeName("Int")), EmptyTree),
- DefDef(
- Modifiers(),
- nme.CONSTRUCTOR,
- List(),
- List(List(ValDef(Modifiers(PARAM | PARAMACCESSOR), newTermName("x"), Ident(newTypeName("Int")), EmptyTree))),
- TypeTree(),
- Block(
- List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())),
- Literal(Constant(())))))))
- val d = ClassDef(
- Modifiers(), newTypeName("D"), List(),
- Template(
- List(Ident(newTypeName("C"))),
- emptyValDef,
- List(
- DefDef(
- Modifiers(),
- nme.CONSTRUCTOR,
- List(),
- List(List()),
- TypeTree(),
- Block(
- List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List(Literal(Constant(2))))),
- Literal(Constant(())))))))
- val result = Select(Apply(Select(New(Ident(newTypeName("D"))), nme.CONSTRUCTOR), List()), newTermName("x"))
- println(cm.mkToolBox().eval(Block(List(c, d), result)))
-} \ No newline at end of file
diff --git a/test/files/run/t7074.check b/test/files/run/t7074.check
deleted file mode 100644
index ab9cf11f16..0000000000
--- a/test/files/run/t7074.check
+++ /dev/null
@@ -1,9 +0,0 @@
-<a/>
-<a b="2" c="3" d="1"/>
-<a b="2" c="4" d="1" e="3" f="5"/>
-<a b="5" c="4" d="3" e="2" f="1"/>
-<a b="1" c="2" d="3" e="4" f="5"/>
-<a a:b="2" a:c="3" a:d="1"/>
-<a a:b="2" a:c="4" a:d="1" a:e="3" a:f="5"/>
-<a a:b="5" a:c="4" a:d="3" a:e="2" a:f="1"/>
-<a a:b="1" a:c="2" a:d="3" a:e="4" a:f="5"/>
diff --git a/test/files/run/t7074.scala b/test/files/run/t7074.scala
deleted file mode 100644
index 693a076a7a..0000000000
--- a/test/files/run/t7074.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-import scala.xml.Utility.sort
-
-object Test extends App {
- println(sort(<a/>))
- println(sort(<a d="1" b="2" c="3"/>))
- println(sort(<a d="1" b="2" e="3" c="4" f="5"/>))
- println(sort(<a f="1" e="2" d="3" c="4" b="5"/>))
- println(sort(<a b="1" c="2" d="3" e="4" f="5"/>))
-
- println(sort(<a a:d="1" a:b="2" a:c="3"/>))
- println(sort(<a a:d="1" a:b="2" a:e="3" a:c="4" a:f="5"/>))
- println(sort(<a a:f="1" a:e="2" a:d="3" a:c="4" a:b="5"/>))
- println(sort(<a a:b="1" a:c="2" a:d="3" a:e="4" a:f="5"/>))
-}
-
diff --git a/test/files/run/t7088.check b/test/files/run/t7088.check
new file mode 100644
index 0000000000..1191247b6d
--- /dev/null
+++ b/test/files/run/t7088.check
@@ -0,0 +1,2 @@
+1
+2
diff --git a/test/files/run/t7088.scala b/test/files/run/t7088.scala
new file mode 100644
index 0000000000..5f0114b940
--- /dev/null
+++ b/test/files/run/t7088.scala
@@ -0,0 +1,13 @@
+object Test {
+ type Tag[X] = {type Tag = X}
+ type TaggedArray[T] = Array[T] with Tag[Any]
+
+ def method[T: scala.reflect.ClassTag](a: TaggedArray[T], value: T) {
+ a.update(0, value)
+ a foreach println
+ }
+
+ def main(args: Array[String]): Unit = {
+ method(Array(1, 2).asInstanceOf[TaggedArray[Int]], 1)
+ }
+}
diff --git a/test/files/run/t7096.scala b/test/files/run/t7096.scala
index e9c0323c2e..e7a894fc23 100644
--- a/test/files/run/t7096.scala
+++ b/test/files/run/t7096.scala
@@ -1,5 +1,55 @@
+/*
+ * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
+ */
import scala.tools.partest._
import scala.tools.nsc._
+import scala.reflect.runtime.{universe => ru}
+import scala.language.implicitConversions
+
+// necessary to avoid bincompat with scala-partest compiled against the old compiler
+abstract class CompilerTest extends DirectTest {
+ def check(source: String, unit: global.CompilationUnit): Unit
+
+ lazy val global: Global = newCompiler()
+ lazy val units: List[global.CompilationUnit] = compilationUnits(global)(sources: _ *)
+ import global._
+ import definitions.{ compilerTypeFromTag }
+
+ override def extraSettings = "-usejavacp -d " + testOutput.path
+
+ def show() = (sources, units).zipped foreach check
+
+ // Override at least one of these...
+ def code = ""
+ def sources: List[String] = List(code)
+
+ // Utility functions
+ class MkType(sym: Symbol) {
+ def apply[M](implicit t: ru.TypeTag[M]): Type =
+ if (sym eq NoSymbol) NoType
+ else appliedType(sym, compilerTypeFromTag(t))
+ }
+ implicit def mkMkType(sym: Symbol) = new MkType(sym)
+
+ def allMembers(root: Symbol): List[Symbol] = {
+ def loop(seen: Set[Symbol], roots: List[Symbol]): List[Symbol] = {
+ val latest = roots flatMap (_.info.members) filterNot (seen contains _)
+ if (latest.isEmpty) seen.toList.sortWith(_ isLess _)
+ else loop(seen ++ latest, latest)
+ }
+ loop(Set(), List(root))
+ }
+
+ class SymsInPackage(pkgName: String) {
+ def pkg = rootMirror.getPackage(TermName(pkgName))
+ def classes = allMembers(pkg) filter (_.isClass)
+ def modules = allMembers(pkg) filter (_.isModule)
+ def symbols = classes ++ terms filterNot (_ eq NoSymbol)
+ def terms = allMembers(pkg) filter (s => s.isTerm && !s.isConstructor)
+ def tparams = classes flatMap (_.info.typeParams)
+ def tpes = symbols map (_.tpe) distinct
+ }
+}
object Test extends CompilerTest {
import global._
@@ -23,7 +73,7 @@ class Sub extends Base {
import syms._
def check(source: String, unit: global.CompilationUnit) {
- afterTyper {
+ exitingTyper {
terms.filter(_.name.toString == "foo").foreach(sym => {
val xParam = sym.tpe.paramss.flatten.head
val annot = sym.tpe.finalResultType.annotations.head
diff --git a/test/files/run/t7120.check b/test/files/run/t7120.check
new file mode 100644
index 0000000000..45a4fb75db
--- /dev/null
+++ b/test/files/run/t7120.check
@@ -0,0 +1 @@
+8
diff --git a/test/files/run/t7120/Base_1.scala b/test/files/run/t7120/Base_1.scala
new file mode 100644
index 0000000000..be07b4f34f
--- /dev/null
+++ b/test/files/run/t7120/Base_1.scala
@@ -0,0 +1,10 @@
+// This bug doesn't depend on separate compilation,
+// in the interests of minimizing the log output during
+// debugging this problem, I've split the compilation.
+
+case class Container( v: String )
+
+trait Base[ T <: AnyRef ] {
+ type UserType = T
+ protected def defect: PartialFunction[ UserType, String ]
+}
diff --git a/test/files/run/t7120/Derived_2.scala b/test/files/run/t7120/Derived_2.scala
new file mode 100644
index 0000000000..e0de629f82
--- /dev/null
+++ b/test/files/run/t7120/Derived_2.scala
@@ -0,0 +1,9 @@
+trait Derived extends Base[ Container ] {
+ protected def defect = { case c: Container => c.v.toString }
+}
+
+// Erasure was ignoring the prefix `Derived#7001.this` when erasing
+// A1, and consequently used `Object` rather than `Container`, which
+// was only seen because that signature clashed with the bridge method.
+//
+// applyOrElse[A1 <: Derived#7001.this.UserType#7318, B1 >: String](x1: A1)
diff --git a/test/files/run/t7120/Run_3.scala b/test/files/run/t7120/Run_3.scala
new file mode 100644
index 0000000000..95e7f994ff
--- /dev/null
+++ b/test/files/run/t7120/Run_3.scala
@@ -0,0 +1,3 @@
+object Test extends Derived with App {
+ println( defect( Container( "8" ) ) )
+}
diff --git a/test/files/run/t7120b.check b/test/files/run/t7120b.check
new file mode 100644
index 0000000000..aa2f5e7c9f
--- /dev/null
+++ b/test/files/run/t7120b.check
@@ -0,0 +1,2 @@
+public int C$D.foo(java.lang.String)
+public int C$D.foo(java.lang.String)
diff --git a/test/files/run/t7120b.scala b/test/files/run/t7120b.scala
new file mode 100644
index 0000000000..0be4eb70a7
--- /dev/null
+++ b/test/files/run/t7120b.scala
@@ -0,0 +1,30 @@
+
+import scala.language.higherKinds
+
+trait Base[A] { type B = A; }
+class C extends Base[String] {
+ class D {
+ def foo[B1 <: B](b: B1) = 0
+ }
+}
+
+trait BaseHK[M[_], A] { type B = M[A]; }
+object BaseHK { type Id[X] = X }
+class CHK extends BaseHK[BaseHK.Id, String] {
+ class D {
+ def foo[B1 <: B](b: B1) = 0
+ }
+}
+
+
+object Test extends App {
+ val c = new C
+ val d = new c.D()
+ val meth = d.getClass.getMethods.find(_.getName == "foo").get
+ println(meth)
+
+ val chk = new CHK
+ val dhk = new chk.D()
+ val methhk = d.getClass.getMethods.find(_.getName == "foo").get
+ println(methhk)
+}
diff --git a/test/files/run/t7151.check b/test/files/run/t7151.check
new file mode 100644
index 0000000000..d532d9589f
--- /dev/null
+++ b/test/files/run/t7151.check
@@ -0,0 +1,6 @@
+class Test$InnerObject$ isFinal = false
+class Test$InnerCase isFinal = true
+class Test$InnerNonCase isFinal = true
+class TopLevelObject$ isFinal = true
+class TopLevelCase isFinal = true
+class TopLevelNonCase isFinal = true
diff --git a/test/files/run/t7151.scala b/test/files/run/t7151.scala
new file mode 100644
index 0000000000..f6492ba43c
--- /dev/null
+++ b/test/files/run/t7151.scala
@@ -0,0 +1,24 @@
+import java.lang.reflect.Modifier.isFinal
+
+object Test {
+ object InnerObject
+ final case class InnerCase()
+ final class InnerNonCase()
+
+ def main(args: Array[String]) {
+ def checkFinal(clazz: Class[_]) =
+ println(s"${clazz} isFinal = ${isFinal(clazz.getModifiers())}")
+
+ checkFinal(InnerObject.getClass)
+ checkFinal(classOf[InnerCase])
+ checkFinal(classOf[InnerNonCase])
+
+ checkFinal(TopLevelObject.getClass)
+ checkFinal(classOf[TopLevelCase])
+ checkFinal(classOf[TopLevelNonCase])
+ }
+}
+
+object TopLevelObject
+final case class TopLevelCase()
+final case class TopLevelNonCase()
diff --git a/test/files/run/t7157.check b/test/files/run/t7157.check
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/test/files/run/t7157.check
@@ -0,0 +1 @@
+1
diff --git a/test/files/run/t7157/Impls_Macros_1.scala b/test/files/run/t7157/Impls_Macros_1.scala
new file mode 100644
index 0000000000..cc258b016a
--- /dev/null
+++ b/test/files/run/t7157/Impls_Macros_1.scala
@@ -0,0 +1,15 @@
+import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+object Macros {
+ object AImpl {
+ def a(ctx: Context)(args: ctx.Expr[Any]*): ctx.Expr[Unit] = {
+ import ctx.universe._
+ ctx.Expr[Unit](Apply(Ident(TermName("println")), List(Literal(Constant(1)))))
+ }
+ }
+
+ implicit class A(context: StringContext) {
+ def a(args: Any*): Unit = macro AImpl.a
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7157/Test_2.scala b/test/files/run/t7157/Test_2.scala
new file mode 100644
index 0000000000..cceb5ca177
--- /dev/null
+++ b/test/files/run/t7157/Test_2.scala
@@ -0,0 +1,5 @@
+import Macros._
+
+object Test extends App {
+ a""
+} \ No newline at end of file
diff --git a/test/files/run/t7171.check b/test/files/run/t7171.check
new file mode 100644
index 0000000000..d826f6cb94
--- /dev/null
+++ b/test/files/run/t7171.check
@@ -0,0 +1,3 @@
+t7171.scala:2: warning: The outer reference in this type test cannot be checked at run time.
+ final case class A()
+ ^
diff --git a/test/files/run/t7171.flags b/test/files/run/t7171.flags
new file mode 100644
index 0000000000..c02e5f2461
--- /dev/null
+++ b/test/files/run/t7171.flags
@@ -0,0 +1 @@
+-unchecked
diff --git a/test/files/run/t7171.scala b/test/files/run/t7171.scala
index 97585b9860..e0a1192228 100644
--- a/test/files/run/t7171.scala
+++ b/test/files/run/t7171.scala
@@ -16,7 +16,7 @@ object Test extends App {
val a1 = new t1.A()
val a2 = new t1.A()
assert(t1.foo(a1))
- // as noted in the unchecked warning (tested in the corresponding neg test),
+ // as noted in the unchecked warning (also tested in the corresponding neg test),
// the outer pointer isn't checked
assert(t1.foo(a2))
}
diff --git a/test/files/run/t7181.check b/test/files/run/t7181.check
new file mode 100644
index 0000000000..e4b8e30dfe
--- /dev/null
+++ b/test/files/run/t7181.check
@@ -0,0 +1,23 @@
+normal exit MainNormalExit
+finally MainNormalExit
+normal flow MainNormalExit
+
+return MainReturn
+finally MainReturn
+
+uncaught exception MainUncaughtException
+finally MainUncaughtException
+
+caught exception ExceptionNormalExit
+normal exit ExceptionNormalExit
+finally ExceptionNormalExit
+normal flow ExceptionNormalExit
+
+caught exception ExceptionReturn
+return ExceptionReturn
+finally ExceptionReturn
+
+caught exception ExceptionUncaughtException
+uncaught exception ExceptionUncaughtException
+finally ExceptionUncaughtException
+
diff --git a/test/files/run/t7181.scala b/test/files/run/t7181.scala
new file mode 100644
index 0000000000..489ec313f6
--- /dev/null
+++ b/test/files/run/t7181.scala
@@ -0,0 +1,78 @@
+sealed abstract class Action
+// exit the try body normally
+case object MainNormalExit extends Action
+// exit the try body with a 'return'
+case object MainReturn extends Action
+// exit the try body with an uncaught exception
+case object MainUncaughtException extends Action
+// exit the try body with a caught exception and exit the exception handler normally
+case object ExceptionNormalExit extends Action
+// exit the try body with a caught exception and exit the exception handler with a 'return'
+case object ExceptionReturn extends Action
+// exit the try body with a caught exception and exit the exception handler with an uncaught exception
+case object ExceptionUncaughtException extends Action
+
+case class UncaughtException(action: Action) extends RuntimeException
+case class CaughtException(action: Action) extends RuntimeException
+
+object Test extends App {
+ def test(action: Action, expectException: Boolean = false) {
+ var gotException = false
+ val result = try
+ driver(action)
+ catch {
+ case UncaughtException(a) =>
+ gotException = true
+ a
+ }
+ if (gotException) assert(expectException, "Got unexpected exception")
+ else assert(!expectException, "Did not get expected exception")
+
+ assert(result == action, s"Expected $action but got $result")
+ println()
+ }
+
+ def driver(action: Action): Action = {
+ val result = try {
+ action match {
+ case MainNormalExit =>
+ println(s"normal exit $action")
+ action
+ case MainReturn =>
+ println(s"return $action")
+ return action
+ case MainUncaughtException =>
+ println(s"uncaught exception $action")
+ throw UncaughtException(action)
+ case _ =>
+ println(s"caught exception $action")
+ throw CaughtException(action)
+ }
+ } catch {
+ case CaughtException(action) => action match {
+ case ExceptionNormalExit =>
+ println(s"normal exit $action")
+ action
+ case ExceptionReturn =>
+ println(s"return $action")
+ return action
+ case ExceptionUncaughtException =>
+ println(s"uncaught exception $action")
+ throw UncaughtException(action)
+ case _ =>
+ sys.error(s"unexpected $action in exception handler")
+ }
+ } finally {
+ println(s"finally $action")
+ }
+ println(s"normal flow $action")
+ result
+ }
+
+ test(MainNormalExit)
+ test(MainReturn)
+ test(MainUncaughtException, true)
+ test(ExceptionNormalExit)
+ test(ExceptionReturn)
+ test(ExceptionUncaughtException, true)
+}
diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check
index 455c1aa3b7..ebf85b731f 100644
--- a/test/files/run/t7185.check
+++ b/test/files/run/t7185.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> import scala.tools.reflect.ToolBox
import scala.tools.reflect.ToolBox
@@ -10,21 +8,21 @@ scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
scala> object O { def apply() = 0 }
-defined module O
+defined object O
scala> val ORef = reify { O }.tree
ORef: reflect.runtime.universe.Tree = $read.O
scala> val tree = Apply(Block(Nil, Block(Nil, ORef)), Nil)
-tree: reflect.runtime.universe.Apply =
+tree: reflect.runtime.universe.Apply =
{
{
$read.O
}
}()
-scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typeCheck(tree): Any}
-res0: Any =
+scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typecheck(tree): Any}
+res0: Any =
{
{
$read.O.apply()
diff --git a/test/files/run/t7185.scala b/test/files/run/t7185.scala
index d9d913e78a..62d64246bc 100644
--- a/test/files/run/t7185.scala
+++ b/test/files/run/t7185.scala
@@ -7,6 +7,6 @@ import scala.reflect.runtime.universe._
object O { def apply() = 0 }
val ORef = reify { O }.tree
val tree = Apply(Block(Nil, Block(Nil, ORef)), Nil)
-{val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typeCheck(tree): Any}
+{val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typecheck(tree): Any}
"""
}
diff --git a/test/files/run/t7198.check b/test/files/run/t7198.check
new file mode 100644
index 0000000000..6dad496f49
--- /dev/null
+++ b/test/files/run/t7198.check
@@ -0,0 +1,2 @@
+The quick brown fox jumped
+And ran away with the vixen.
diff --git a/test/files/run/t7198.scala b/test/files/run/t7198.scala
new file mode 100644
index 0000000000..26e1d8805a
--- /dev/null
+++ b/test/files/run/t7198.scala
@@ -0,0 +1,9 @@
+/* spew a few lines
+ * filter: Over the moon
+ */
+object Test extends App {
+ Console println "The quick brown fox jumped"
+ Console println "Over the moon"
+ Console println "And ran away with the vixen."
+ Console println "Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28)."
+}
diff --git a/test/files/run/t7214.scala b/test/files/run/t7214.scala
index ff1ea8082d..15c2c24fa0 100644
--- a/test/files/run/t7214.scala
+++ b/test/files/run/t7214.scala
@@ -25,7 +25,7 @@ class Crash {
def unapply(a: Alias): Option[Any] = None
}
(t: Any) match {
- case Extractor() =>
+ case Extractor(_) =>
case _ =>
}
diff --git a/test/files/run/t7223.check b/test/files/run/t7223.check
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/test/files/run/t7223.check
@@ -0,0 +1 @@
+0
diff --git a/test/files/run/t7223.scala b/test/files/run/t7223.scala
new file mode 100644
index 0000000000..a707e957df
--- /dev/null
+++ b/test/files/run/t7223.scala
@@ -0,0 +1,11 @@
+class D(val a: () => Int => () => Any) {
+ a()(0)()
+}
+
+object Crash extends D(() => {
+ (x: Int) => {() => { new { println(x.toString) } }}
+})
+
+object Test extends App {
+ Crash
+}
diff --git a/test/files/run/t7231.check b/test/files/run/t7231.check
new file mode 100644
index 0000000000..c1e4b6c175
--- /dev/null
+++ b/test/files/run/t7231.check
@@ -0,0 +1,2 @@
+null
+null
diff --git a/test/files/run/t7231.scala b/test/files/run/t7231.scala
new file mode 100644
index 0000000000..7d6bc81f3f
--- /dev/null
+++ b/test/files/run/t7231.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ val bar: Null = null
+
+ def foo(x: Array[Int]) = x
+ def baz(x: String) = x
+
+ // first line was failing
+ println(foo(bar))
+ // this line worked but good to have a double check
+ println(baz(bar))
+} \ No newline at end of file
diff --git a/test/files/run/t7240.check b/test/files/run/t7240.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t7240.check
+++ /dev/null
diff --git a/test/files/run/t7240/Macros_1.scala b/test/files/run/t7240/Macros_1.scala
index 6465e18760..b24b607d17 100644
--- a/test/files/run/t7240/Macros_1.scala
+++ b/test/files/run/t7240/Macros_1.scala
@@ -1,7 +1,7 @@
package bakery
import scala.language.experimental.macros
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
trait FailureCake {
implicit def liftAnyFails[T: Manifest]: Any = ???
@@ -34,14 +34,14 @@ object Bakery {
List(dslTrait("bakery.FailureCake")),
emptyValDef,
List(
- DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(),
- Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))),
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(),
+ Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))),
DefDef(Modifiers(), newTermName("main"), List(), List(List()), Ident(newTypeName("Any")), transformedBody))))
- def constructor = Apply(Select(New(Ident(newTypeName("eval"))), nme.CONSTRUCTOR), List())
+ def constructor = Apply(Select(New(Ident(newTypeName("eval"))), termNames.CONSTRUCTOR), List())
c.eval(c.Expr[Any](
- c.resetAllAttrs(Block(composeDSL(Literal(Constant(1))), constructor))))
+ c.untypecheck(Block(composeDSL(Literal(Constant(1))), constructor))))
c.Expr[Any](Literal(Constant(1)))
}
diff --git a/test/files/run/t7240/Test_2.scala b/test/files/run/t7240/Test_2.scala
index 2450bdabf9..5cc2cc7f78 100644
--- a/test/files/run/t7240/Test_2.scala
+++ b/test/files/run/t7240/Test_2.scala
@@ -1,3 +1,3 @@
object Test extends App {
- bakery.Bakery.failure
-} \ No newline at end of file
+ val v = bakery.Bakery.failure
+}
diff --git a/test/files/run/t7265.scala b/test/files/run/t7265.scala
deleted file mode 100644
index c556930303..0000000000
--- a/test/files/run/t7265.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-
-import scala.util.Properties._
-
-object Test extends App {
-
- setProp("java.specification.version", "1.7")
-
- assert( isJavaAtLeast("1.5"))
- assert( isJavaAtLeast("1.6"))
- assert( isJavaAtLeast("1.7"))
- assert(!isJavaAtLeast("1.8"))
- assert(!isJavaAtLeast("1.71"))
-
- failing(isJavaAtLeast("1.a"))
- failing(isJavaAtLeast("1"))
- failing(isJavaAtLeast(""))
- failing(isJavaAtLeast("."))
- failing(isJavaAtLeast(".5"))
- failing(isJavaAtLeast("1.7.1"))
-
- def failing(u: =>Unit) = try {
- u
- assert(false, "Expected Exception")
- } catch {
- case _: NumberFormatException =>
- }
-}
diff --git a/test/files/run/t7271.check b/test/files/run/t7271.check
index dcd828a307..f7a23018ca 100644
--- a/test/files/run/t7271.check
+++ b/test/files/run/t7271.check
@@ -1,12 +1,12 @@
[[syntax trees at end of parser]] // newSource1.scala
-[0:91]package [0:0]<empty> {
- [0:91]class C extends [8:91][91]scala.AnyRef {
+[6]package [6]<empty> {
+ [6]class C extends [8][91]scala.AnyRef {
[8]def <init>() = [8]{
- [8][8][8]super.<init>();
+ [NoPosition][NoPosition][NoPosition]super.<init>();
[8]()
};
- [16:44]def quote = [28:44]<28:44><28:44>[28]StringContext([30:34]"foo", [40:44]"baz").s([35:39]this);
- [51:85]def tripleQuote = [69:85]<69:85><69:85>[69]StringContext([71:75]"foo", [81:85]"baz").s([76:80]this)
+ [20]def quote = [28][28][28][28]StringContext([30]"foo", [40]"baz").s([35]this);
+ [55]def tripleQuote = [69][69][69][69]StringContext([71]"foo", [81]"baz").s([76]this)
}
}
diff --git a/test/files/run/t7271.scala b/test/files/run/t7271.scala
index 6fccf14d20..69d5ea377e 100644
--- a/test/files/run/t7271.scala
+++ b/test/files/run/t7271.scala
@@ -1,9 +1,9 @@
import scala.tools.partest._
-import java.io._
import scala.tools.nsc._
-import scala.tools.nsc.util.CommandLineParser
+import scala.tools.cmd.CommandLineParser
import scala.tools.nsc.{Global, Settings, CompilerCommand}
import scala.tools.nsc.reporters.ConsoleReporter
+import scala.reflect.internal.Positions
object Test extends DirectTest {
@@ -29,6 +29,6 @@ object Test extends DirectTest {
val settings = new Settings()
settings.Xprintpos.value = true
val command = new CompilerCommand((CommandLineParser tokenize extraSettings) ++ args.toList, settings)
- new Global(command.settings, new ConsoleReporter(settings)) with interactive.RangePositions
+ new Global(command.settings, new ConsoleReporter(settings)) with Positions
}
}
diff --git a/test/files/run/t7290.check b/test/files/run/t7290.check
new file mode 100644
index 0000000000..aff48abd4a
--- /dev/null
+++ b/test/files/run/t7290.check
@@ -0,0 +1,6 @@
+t7290.scala:4: warning: Pattern contains duplicate alternatives: 0
+ case 0 | 0 => 0
+ ^
+t7290.scala:5: warning: Pattern contains duplicate alternatives: 2, 3
+ case 2 | 2 | 2 | 3 | 2 | 3 => 0
+ ^
diff --git a/test/files/run/t7291b.check b/test/files/run/t7291.check
index c07ba986a3..c07ba986a3 100644
--- a/test/files/run/t7291b.check
+++ b/test/files/run/t7291.check
diff --git a/test/files/run/t7291a.scala b/test/files/run/t7291.scala
index 4b7c4a4184..ca44e96693 100644
--- a/test/files/run/t7291a.scala
+++ b/test/files/run/t7291.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ higherKinds, implicitConversions }
+
trait Fooable[T]
object Fooable {
implicit def conjure[T]: Fooable[T] = {
diff --git a/test/files/run/t7291a.check b/test/files/run/t7291a.check
deleted file mode 100644
index 126faa15b4..0000000000
--- a/test/files/run/t7291a.check
+++ /dev/null
@@ -1 +0,0 @@
-conjure
diff --git a/test/files/run/t7291a.flags b/test/files/run/t7291a.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t7291a.flags
+++ /dev/null
diff --git a/test/files/run/t7291b.flags b/test/files/run/t7291b.flags
deleted file mode 100644
index d564f2b1f8..0000000000
--- a/test/files/run/t7291b.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xdivergence211 \ No newline at end of file
diff --git a/test/files/run/t7291b.scala b/test/files/run/t7291b.scala
deleted file mode 100644
index 30c4261a81..0000000000
--- a/test/files/run/t7291b.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-trait Fooable[T]
-object Fooable {
- implicit def conjure[T]: Fooable[T] = {
- println("conjure")
- new Fooable[T]{}
- }
-
-}
-
-object Test {
- implicit def traversable[T, Coll[_] <: Traversable[_]](implicit
-elem: Fooable[T]): Fooable[Coll[T]] = {
- println("traversable")
- new Fooable[Coll[T]]{}
- }
- def main(args: Array[String]) {
- implicitly[Fooable[List[Any]]]
- }
-}
diff --git a/test/files/run/t7300.check b/test/files/run/t7300.check
new file mode 100644
index 0000000000..51993f072d
--- /dev/null
+++ b/test/files/run/t7300.check
@@ -0,0 +1,2 @@
+2
+2
diff --git a/test/files/run/t7300.scala b/test/files/run/t7300.scala
new file mode 100644
index 0000000000..ec841690df
--- /dev/null
+++ b/test/files/run/t7300.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ // single line comment in multi line comment
+ /*//*/ val x = 1 */*/
+ val x = 2
+ println(x)
+
+ // single line comment in nested multi line comment
+ /*/*//*/ val y = 1 */*/*/
+ val y = 2
+ println(y)
+}
diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check
index 966736915e..b7443aa0c4 100644
--- a/test/files/run/t7319.check
+++ b/test/files/run/t7319.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> class M[A]
defined class M
@@ -23,7 +21,7 @@ scala> convert(Some[Int](0))
--- because ---
argument expression's type is not compatible with formal parameter type;
found : Some[Int]
- required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
+ required: ?F[_$1] forSome { type _$1 <: ?F[_$2] forSome { type _$2 } }
convert(Some[Int](0))
^
<console>:12: error: type mismatch;
@@ -32,7 +30,14 @@ argument expression's type is not compatible with formal parameter type;
convert(Some[Int](0))
^
+scala> Range(1,2).toArray: Seq[_]
+<console>:11: error: polymorphic expression cannot be instantiated to expected type;
+ found : [B >: Int]Array[B]
+ required: Seq[_]
+ Range(1,2).toArray: Seq[_]
+ ^
+
scala> 0
-res1: Int = 0
+res2: Int = 0
scala>
diff --git a/test/files/run/t7319.scala b/test/files/run/t7319.scala
index 23ffeb977d..65a3ed922d 100644
--- a/test/files/run/t7319.scala
+++ b/test/files/run/t7319.scala
@@ -9,5 +9,6 @@ implicit def ma0[A](a: A): M[A] = null
implicit def ma1[A](a: A): M[A] = null
def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0
convert(Some[Int](0))
+Range(1,2).toArray: Seq[_]
0""" // before the fix, this line, and all that followed, re-issued the implicit ambiguity error.
}
diff --git a/test/files/run/t7326.scala b/test/files/run/t7326.scala
new file mode 100644
index 0000000000..ed9471ea8e
--- /dev/null
+++ b/test/files/run/t7326.scala
@@ -0,0 +1,64 @@
+import scala.collection.immutable.ListSet
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ def testCorrectness() {
+ // a key that has many hashCode collisions
+ case class Collision(i: Int) { override def hashCode = i / 5 }
+
+ def subsetTest[T](emptyA:Set[T], emptyB:Set[T], mkKey:Int => T, n:Int) {
+ val outside = mkKey(n + 1)
+ for(i <- 0 to n) {
+ val a = emptyA ++ (0 until i).map(mkKey)
+ // every set must be a subset of itself
+ require(a.subsetOf(a), "A set must be the subset of itself")
+ for(k <- 0 to i) {
+ // k <= i, so b is definitely a subset
+ val b = emptyB ++ (0 until k).map(mkKey)
+ // c has less elements than a, but contains a value that is not in a
+ // so it is not a subset, but that is not immediately obvious due to size
+ val c = b + outside
+ require(b.subsetOf(a), s"$b must be a subset of $a")
+ require(!c.subsetOf(a), s"$c must not be a subset of $a")
+ }
+ }
+ }
+
+ // test the HashSet/HashSet case
+ subsetTest(HashSet.empty[Int], HashSet.empty[Int], identity, 100)
+
+ // test the HashSet/other set case
+ subsetTest(HashSet.empty[Int], ListSet.empty[Int], identity, 100)
+
+ // test the HashSet/HashSet case for Collision keys
+ subsetTest(HashSet.empty[Collision], HashSet.empty[Collision], Collision, 100)
+
+ // test the HashSet/other set case for Collision keys
+ subsetTest(HashSet.empty[Collision], ListSet.empty[Collision], Collision, 100)
+ }
+
+ /**
+ * A main performance benefit of the new subsetOf is that we do not have to call hashCode during subsetOf
+ * since we already have the hash codes in the HashSet1 nodes.
+ */
+ def testNoHashCodeInvocationsDuringSubsetOf() = {
+ var count = 0
+
+ case class HashCodeCounter(i:Int) {
+ override def hashCode = {
+ count += 1
+ i
+ }
+ }
+
+ val a = HashSet.empty ++ (0 until 100).map(HashCodeCounter)
+ val b = HashSet.empty ++ (0 until 50).map(HashCodeCounter)
+ val count0 = count
+ val result = b.subsetOf(a)
+ require(count == count0, "key.hashCode must not be called during subsetOf of two HashSets")
+ result
+ }
+ testCorrectness()
+ testNoHashCodeInvocationsDuringSubsetOf()
+}
diff --git a/test/files/run/t7328.check b/test/files/run/t7328.check
new file mode 100644
index 0000000000..e386fe70d9
--- /dev/null
+++ b/test/files/run/t7328.check
@@ -0,0 +1,4 @@
+Foo
+Foo(3)
+Foo(3)
+Foo(5)
diff --git a/test/files/run/t7328.scala b/test/files/run/t7328.scala
new file mode 100644
index 0000000000..56956b489b
--- /dev/null
+++ b/test/files/run/t7328.scala
@@ -0,0 +1,18 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+case class Foo(x: Int) extends AnyVal
+case class Bar(foo: Foo)
+
+object Test extends App {
+ val foo = typeOf[Bar].decl(TermName("foo")).asMethod
+ println(foo.returnType) // Foo
+
+ val bar = Bar(Foo(3))
+ println(bar.foo) // Foo(3)
+
+ val im = cm.reflect(bar)
+ println(im.reflectField(foo).get) // incorrectly gives java.lang.Integer(3) not Foo(3)
+ im.reflectField(foo).set(Foo(5)) // java.lang.IllegalArgumentException: Can not set int field Bar.foo to Foo
+ println(im.reflectMethod(foo)()) // incorrectly gives java.lang.Integer(3) not Foo(3)
+} \ No newline at end of file
diff --git a/test/files/run/t7331b.check b/test/files/run/t7331b.check
index 7034a95a3f..413c93aaf7 100644
--- a/test/files/run/t7331b.check
+++ b/test/files/run/t7331b.check
@@ -1,3 +1,3 @@
-reflective compilation has failed:
+reflective compilation has failed:
')' expected but eof found.
diff --git a/test/files/run/t7331c.check b/test/files/run/t7331c.check
index af9f1b1ad9..a9dc6a7d0f 100644
--- a/test/files/run/t7331c.check
+++ b/test/files/run/t7331c.check
@@ -1,3 +1,3 @@
-ClassDef(Modifiers(), newTypeName("C"), List(), Template(List(Select(Ident(scala), newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))))))
+ClassDef(Modifiers(), TypeName("C"), List(), Template(List(Select(Ident(scala), TypeName("AnyRef"))), noSelfType, List(DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))))))
source-<toolbox>,line-1,offset=6
NoPosition
diff --git a/test/files/run/t7336.scala b/test/files/run/t7336.scala
index ace83f2c1f..21b0be5446 100644
--- a/test/files/run/t7336.scala
+++ b/test/files/run/t7336.scala
@@ -9,7 +9,7 @@ import scala.concurrent.duration.Duration
* resulting in a speedy OutOfMemoryError. Now, each array should be freed soon
* after it is created and the test should complete without problems.
*/
-object Test {
+object Test {
def main(args: Array[String]) {
def loop(i: Int, arraySize: Int): Future[Unit] = {
val array = new Array[Byte](arraySize)
diff --git a/test/files/run/t7337.check b/test/files/run/t7337.check
new file mode 100644
index 0000000000..dd2b31f23c
--- /dev/null
+++ b/test/files/run/t7337.check
@@ -0,0 +1 @@
+doesnotexist does not exist or is not a directory
diff --git a/test/files/run/t7337.scala b/test/files/run/t7337.scala
new file mode 100644
index 0000000000..9913f8ae45
--- /dev/null
+++ b/test/files/run/t7337.scala
@@ -0,0 +1,19 @@
+import scala.tools.partest._
+import scala.tools.nsc._
+import scala.tools.cmd.CommandLineParser
+
+object Test extends DirectTest {
+ override def code = "class C"
+ override def newCompiler(args: String*): Global = {
+ val settings = newSettings((CommandLineParser tokenize ("-d doesnotexist " + extraSettings)) ++ args.toList)
+ newCompiler(settings)
+ }
+
+ override def show() {
+ try {
+ newCompiler()
+ } catch {
+ case fe: FatalError => println(fe.getMessage)
+ }
+ }
+}
diff --git a/test/files/run/t7341.check b/test/files/run/t7341.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t7341.check
+++ /dev/null
diff --git a/test/files/run/t7341.scala b/test/files/run/t7341.scala
index dc526c6c19..ffea7f918b 100755
--- a/test/files/run/t7341.scala
+++ b/test/files/run/t7341.scala
@@ -4,7 +4,7 @@ object Obj {
def foo {
returning(() => cache = ())
}
-
+
def apply(): Any = {
cache
}
diff --git a/test/files/run/t7374.check b/test/files/run/t7374.check
new file mode 100644
index 0000000000..4efa6f7af3
--- /dev/null
+++ b/test/files/run/t7374.check
@@ -0,0 +1,3 @@
+List(2, 3)
+ParVector(1, 2, 3)
+List(1, 2)
diff --git a/test/files/run/t7374/Some.scala b/test/files/run/t7374/Some.scala
new file mode 100644
index 0000000000..3266a5642e
--- /dev/null
+++ b/test/files/run/t7374/Some.scala
@@ -0,0 +1,3 @@
+object SomeScala {
+ def list = List(1, 2, 3)
+}
diff --git a/test/files/run/t7374/Test.java b/test/files/run/t7374/Test.java
new file mode 100644
index 0000000000..02f86146ca
--- /dev/null
+++ b/test/files/run/t7374/Test.java
@@ -0,0 +1,7 @@
+public class Test {
+ public static void main(String[] args) {
+ System.out.println(SomeScala.list().tail());
+ System.out.println(SomeScala.list().par());
+ System.out.println(SomeScala.list().init());
+ }
+}
diff --git a/test/files/run/t7375b/Macros_1.scala b/test/files/run/t7375b/Macros_1.scala
index 70e79cc2b4..b6090e730b 100644
--- a/test/files/run/t7375b/Macros_1.scala
+++ b/test/files/run/t7375b/Macros_1.scala
@@ -1,5 +1,5 @@
import language.experimental.macros
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
class C1(val n: Int) extends AnyVal
class C2(val n: Int) extends AnyRef
@@ -11,7 +11,7 @@ object Macros {
def foo = macro impl
def impl(c: Context) = {
import c.universe._
- def test[T: c.TypeTag] = reify(println(c.literal(c.reifyRuntimeClass(c.typeOf[T]).toString).splice)).tree
+ def test[T: c.TypeTag] = reify(println(c.Expr[String](Literal(Constant(c.reifyRuntimeClass(c.typeOf[T]).toString))).splice)).tree
def tests = Block(List(test[C1], test[C2], test[F1], test[F2]), Literal(Constant(())))
c.Expr[Unit](tests)
}
diff --git a/test/files/run/t7398.scala b/test/files/run/t7398.scala
index 493c4dcf40..4b46850768 100644
--- a/test/files/run/t7398.scala
+++ b/test/files/run/t7398.scala
@@ -21,6 +21,6 @@ public interface Iterator<E> {
}
"""
- // We're only checking we can parse it.
+ // We're only checking we can compile it.
def check(source: String, unit: global.CompilationUnit): Unit = ()
}
diff --git a/test/files/run/t7406.check b/test/files/run/t7406.check
new file mode 100644
index 0000000000..f599e28b8a
--- /dev/null
+++ b/test/files/run/t7406.check
@@ -0,0 +1 @@
+10
diff --git a/test/files/run/t7406.scala b/test/files/run/t7406.scala
new file mode 100644
index 0000000000..a8b35c91c9
--- /dev/null
+++ b/test/files/run/t7406.scala
@@ -0,0 +1,14 @@
+class Arne[@specialized(Long) T](x: T) {
+ val regularVal = x
+ lazy val lazyVal = x
+
+ def apply(f: (T, T) => T): T = f(regularVal, lazyVal)
+}
+
+object Test {
+ val arne = new Arne(5L)
+ def f = arne(_ + _)
+ def main(args: Array[String]): Unit = {
+ println(f)
+ }
+}
diff --git a/test/files/run/t7407.check b/test/files/run/t7407.check
new file mode 100644
index 0000000000..e965047ad7
--- /dev/null
+++ b/test/files/run/t7407.check
@@ -0,0 +1 @@
+Hello
diff --git a/test/files/run/t7407.flags b/test/files/run/t7407.flags
new file mode 100644
index 0000000000..c8547a27dc
--- /dev/null
+++ b/test/files/run/t7407.flags
@@ -0,0 +1 @@
+-Ynooptimise -Ybackend:GenBCode
diff --git a/test/files/run/t7407.scala b/test/files/run/t7407.scala
new file mode 100644
index 0000000000..cf67602126
--- /dev/null
+++ b/test/files/run/t7407.scala
@@ -0,0 +1,11 @@
+// SI-7407
+object Test {
+
+ def main(args: Array[String]) { println(foo) }
+
+ def foo: String = {
+ try return "Hello" finally 10 match {case x => ()}
+ }
+
+}
+
diff --git a/test/files/run/t7407b.check b/test/files/run/t7407b.check
new file mode 100644
index 0000000000..f30294447b
--- /dev/null
+++ b/test/files/run/t7407b.check
@@ -0,0 +1,2 @@
+Hello
+abc
diff --git a/test/files/run/t7407b.flags b/test/files/run/t7407b.flags
new file mode 100644
index 0000000000..c8547a27dc
--- /dev/null
+++ b/test/files/run/t7407b.flags
@@ -0,0 +1 @@
+-Ynooptimise -Ybackend:GenBCode
diff --git a/test/files/run/t7407b.scala b/test/files/run/t7407b.scala
new file mode 100644
index 0000000000..b0c00878b5
--- /dev/null
+++ b/test/files/run/t7407b.scala
@@ -0,0 +1,20 @@
+object Test {
+
+ def main(args: Array[String]) {
+ println(foo(true))
+ println(foo(false))
+ }
+
+ def foo(b: Boolean): String = {
+ try {
+ if(b)
+ return "Hello"
+ else
+ "abc"
+ } finally {
+ 10 match {case x => ()}
+ }
+ }
+
+}
+
diff --git a/test/files/run/t7436.scala b/test/files/run/t7436.scala
new file mode 100644
index 0000000000..867a931e05
--- /dev/null
+++ b/test/files/run/t7436.scala
@@ -0,0 +1,9 @@
+class A(val p: Int*)
+
+class B(val p1: Int) extends A(p1)
+
+object Test {
+ def main(args: Array[String]) {
+ new B(1).p1 // threw java.lang.ClassCastException: scala.collection.mutable.WrappedArray$ofInt cannot be cast to java.lang.Integer
+ }
+}
diff --git a/test/files/run/t7439.check b/test/files/run/t7439.check
index ce9e8b52ff..9ea09f9c40 100644
--- a/test/files/run/t7439.check
+++ b/test/files/run/t7439.check
@@ -1 +1,2 @@
+Recompiling after deleting t7439-run.obj/A_1.class
pos: NoPosition Class A_1 not found - continuing with a stub. WARNING
diff --git a/test/files/run/t7439/Test_2.scala b/test/files/run/t7439/Test_2.scala
index e00e9d1b68..ce9b907145 100644
--- a/test/files/run/t7439/Test_2.scala
+++ b/test/files/run/t7439/Test_2.scala
@@ -23,6 +23,8 @@ object Test extends StoreReporterDirectTest {
val a1Class = new File(testOutput.path, "A_1.class")
assert(a1Class.exists)
assert(a1Class.delete())
+ // testIdent normalizes to separate names using '/' regardless of platform, drops all but last two parts
+ println(s"Recompiling after deleting ${a1Class.testIdent}")
// bad symbolic reference error expected (but no stack trace!)
compileCode(C)
diff --git a/test/files/run/t744.scala b/test/files/run/t744.scala
index d5e9f6df34..4895e9baa0 100644
--- a/test/files/run/t744.scala
+++ b/test/files/run/t744.scala
@@ -5,7 +5,7 @@ trait Linked {
}
}
object Test {
- class Test extends Linked {
+ class Test extends Linked {
trait FileImpl extends super.FileImpl {
// val x: int = 1
}
diff --git a/test/files/run/t7445.scala b/test/files/run/t7445.scala
new file mode 100644
index 0000000000..e4ffeb8e1a
--- /dev/null
+++ b/test/files/run/t7445.scala
@@ -0,0 +1,6 @@
+import scala.collection.immutable.ListMap
+
+object Test extends App {
+ val a = ListMap(1 -> 1, 2 -> 2, 3 -> 3, 4 -> 4, 5 -> 5);
+ require(a.tail == ListMap(2 -> 2, 3 -> 3, 4 -> 4, 5 -> 5));
+}
diff --git a/test/files/run/t7455/Test.scala b/test/files/run/t7455/Test.scala
index b23a724c78..2cda9225f4 100644
--- a/test/files/run/t7455/Test.scala
+++ b/test/files/run/t7455/Test.scala
@@ -21,7 +21,7 @@ object Test extends DirectTest {
for {
name <- Seq("Outer", "Outer$PrivateInner", "Outer$PrivateStaticInner", "Outer$PublicInner")
clazz = compiler.rootMirror.staticClass(name)
- constr <- clazz.info.member(nme.CONSTRUCTOR).alternatives
+ constr <- clazz.info.member(termNames.CONSTRUCTOR).alternatives
} {
println(constr.defString)
fullyInitializeSymbol(constr)
diff --git a/test/files/run/t7475b.check b/test/files/run/t7475b.check
new file mode 100644
index 0000000000..51993f072d
--- /dev/null
+++ b/test/files/run/t7475b.check
@@ -0,0 +1,2 @@
+2
+2
diff --git a/test/files/run/t7475b.scala b/test/files/run/t7475b.scala
new file mode 100644
index 0000000000..a205602b6d
--- /dev/null
+++ b/test/files/run/t7475b.scala
@@ -0,0 +1,11 @@
+trait A { private val x = 1 }
+trait B { val x = 2 }
+trait C1 extends B with A { println(x) }
+trait C2 extends A with B { println(x) }
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ new C1 { }
+ new C2 { }
+ }
+}
diff --git a/test/files/run/t7482a.check b/test/files/run/t7482a.check
new file mode 100644
index 0000000000..943538f352
--- /dev/null
+++ b/test/files/run/t7482a.check
@@ -0,0 +1,10 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5)
+v: java.util.ArrayList[String] = []
+
+scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5)
+v: java.util.ArrayList[String] = []
+
+scala>
diff --git a/test/files/run/t7482a.scala b/test/files/run/t7482a.scala
new file mode 100644
index 0000000000..d674558b98
--- /dev/null
+++ b/test/files/run/t7482a.scala
@@ -0,0 +1,8 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ override def code = """
+ val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5)
+ val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5)
+ """
+} \ No newline at end of file
diff --git a/test/files/run/t7507.scala b/test/files/run/t7507.scala
index 6c1959ddac..a5eab6248f 100644
--- a/test/files/run/t7507.scala
+++ b/test/files/run/t7507.scala
@@ -4,6 +4,10 @@ trait Cake extends Slice
trait Slice { self: Cake => // must have self type that extends `Slice`
private[this] val bippy = () // must be private[this]
locally(bippy)
+ class C1 {
+ locally(bippy)
+ locally(self.bippy)
+ }
}
// Originally reported bug:
diff --git a/test/files/run/t7510.check b/test/files/run/t7510.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t7510.check
+++ /dev/null
diff --git a/test/files/run/t7533.check b/test/files/run/t7533.check
new file mode 100644
index 0000000000..fa5b3edc8f
--- /dev/null
+++ b/test/files/run/t7533.check
@@ -0,0 +1,30 @@
+Testing Symbol.isAbstract...
+=======class C=======
+class C => true
+constructor C => false
+value x1 => true
+value x2 => false
+value x2 => false
+method y1 => true
+method y2 => false
+type T1 => true
+type T2 => false
+=======trait T=======
+trait T => true
+method $init$ => false
+value z1 => true
+value z2 => false
+value z2 => false
+method w1 => true
+method w2 => false
+type U1 => true
+type U2 => false
+=======class D=======
+class D => false
+constructor D => false
+value x1 => false
+value x1 => false
+method y1 => false
+=======object M=======
+object M => false
+constructor M => false
diff --git a/test/files/run/t7533.scala b/test/files/run/t7533.scala
new file mode 100644
index 0000000000..c7bd8e8d43
--- /dev/null
+++ b/test/files/run/t7533.scala
@@ -0,0 +1,38 @@
+import scala.reflect.runtime.universe._
+
+abstract class C {
+ val x1: Int
+ val x2: Int = 2
+ def y1: Int
+ def y2: Int = 2
+ type T1 <: Int
+ type T2 = Int
+}
+trait T {
+ val z1: Int
+ val z2: Int = 2
+ def w1: Int
+ def w2: Int = 2
+ type U1 <: Int
+ type U2 = Int
+}
+class D extends C {
+ val x1 = 3
+ def y1 = 3
+}
+object M
+
+object Test extends App {
+ println("Testing Symbol.isAbstract...")
+ def test[T: TypeTag] = {
+ val sym = typeOf[T].typeSymbol
+ println(s"=======$sym=======")
+ def printAbstract(sym: Symbol) = println(s"$sym => ${sym.isAbstract}")
+ printAbstract(sym)
+ sym.info.decls.sorted.foreach(printAbstract)
+ }
+ test[C]
+ test[T]
+ test[D]
+ test[M.type]
+} \ No newline at end of file
diff --git a/test/files/run/t7556/Test_2.scala b/test/files/run/t7556/Test_2.scala
index 31848738ef..a78c917ed8 100644
--- a/test/files/run/t7556/Test_2.scala
+++ b/test/files/run/t7556/Test_2.scala
@@ -5,7 +5,7 @@ object Test {
val mc = new MegaClass
val anns = mc.getClass.getAnnotations.map(_.annotationType.getName).toList.sorted
println(s"class annotations: $anns")
- val N = typeTag[MegaClass].tpe.declarations.size // was: error reading Scala signature of MegaClass: 65935
+ val N = typeTag[MegaClass].tpe.decls.size // was: error reading Scala signature of MegaClass: 65935
println(s"$N decls via runtime reflection")
}
}
diff --git a/test/files/run/t7569.check b/test/files/run/t7569.check
index aade96d233..98513c3ab2 100644
--- a/test/files/run/t7569.check
+++ b/test/files/run/t7569.check
@@ -1,8 +1,8 @@
source-newSource1.scala,line-3,offset=49 A.this.one
source-newSource1.scala,line-3,offset=49 A.this
-source-newSource1.scala,line-2,offset=41 A.super.<init>()
-source-newSource1.scala,line-2,offset=41 A.super.<init>
-source-newSource1.scala,line-2,offset=41 this
+source-newSource1.scala,line-4,offset=67 A.super.<init>()
+source-newSource1.scala,line-4,offset=67 A.super.<init>
+source-newSource1.scala,line-4,offset=67 this
source-newSource1.scala,line-3,offset=49 A.this.one
source-newSource1.scala,line-3,offset=49 A.this
RangePosition(newSource1.scala, 55, 57, 65) scala.Int.box(1).toString()
diff --git a/test/files/run/t7570a.check b/test/files/run/t7570a.check
new file mode 100644
index 0000000000..3cc58df837
--- /dev/null
+++ b/test/files/run/t7570a.check
@@ -0,0 +1 @@
+C
diff --git a/test/files/run/t7733/Test_2.scala b/test/files/run/t7570a.scala
index 28358574ec..b8b4ddeaf2 100644
--- a/test/files/run/t7733/Test_2.scala
+++ b/test/files/run/t7570a.scala
@@ -1,9 +1,11 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
+import definitions._
+import Flag._
object Test extends App {
val tb = cm.mkToolBox()
- val code = tb.parse("{ val x: test.Separate$$anonfun$1 = null; x }")
- println(tb.eval(code))
+ val csym = tb.define(q"""class C { override def toString = "C" }""")
+ println(tb.eval(q"new $csym"))
} \ No newline at end of file
diff --git a/test/files/run/t7570b.check b/test/files/run/t7570b.check
new file mode 100644
index 0000000000..0c28247025
--- /dev/null
+++ b/test/files/run/t7570b.check
@@ -0,0 +1 @@
+compilation failed: reflective toolbox has failed: cannot have free terms in a top-level definition
diff --git a/test/files/run/t7570b.scala b/test/files/run/t7570b.scala
new file mode 100644
index 0000000000..7d4ade5237
--- /dev/null
+++ b/test/files/run/t7570b.scala
@@ -0,0 +1,18 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.{ToolBox, ToolBoxError}
+import definitions._
+import Flag._
+import internal._
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val msg = internal.reificationSupport.newFreeTerm("msg", "C")
+ internal.reificationSupport.setInfo(msg, typeOf[String])
+ try {
+ val csym = tb.define(q"""class C { override def toString = $msg }""")
+ println(tb.eval(q"new $csym"))
+ } catch {
+ case ToolBoxError(message, _) => println(s"compilation failed: $message")
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7570c.check b/test/files/run/t7570c.check
new file mode 100644
index 0000000000..61e659d9e0
--- /dev/null
+++ b/test/files/run/t7570c.check
@@ -0,0 +1,2 @@
+(class C,true,false,false)
+(object D,false,true,false)
diff --git a/test/files/run/t7570c.scala b/test/files/run/t7570c.scala
new file mode 100644
index 0000000000..a5bdbffe18
--- /dev/null
+++ b/test/files/run/t7570c.scala
@@ -0,0 +1,13 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.{ToolBox, ToolBoxError}
+import definitions._
+import Flag._
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val csym = tb.define(q"""class C { override def toString = "C" }""")
+ println((csym, csym.isClass, csym.isModule, csym.isModuleClass))
+ val dsym = tb.define(q"""object D { override def toString = "D" }""".asInstanceOf[ModuleDef])
+ println((dsym, dsym.isClass, dsym.isModule, dsym.isModuleClass))
+} \ No newline at end of file
diff --git a/test/files/run/t7582-private-within.check b/test/files/run/t7582-private-within.check
new file mode 100644
index 0000000000..b2743ffa06
--- /dev/null
+++ b/test/files/run/t7582-private-within.check
@@ -0,0 +1,12 @@
+private[package pack] class JavaPackagePrivate
+private[package pack] module JavaPackagePrivate
+private[package pack] module class JavaPackagePrivate
+private[package pack] field field
+private[package pack] primary constructor <init>
+private[package pack] method meth
+private[package pack] field staticField
+private[package pack] method staticMeth
+private[package pack] method <clinit>
+private[package pack] field staticField
+private[package pack] method staticMeth
+private[package pack] method <clinit>
diff --git a/test/files/run/t7582-private-within/JavaPackagePrivate.java b/test/files/run/t7582-private-within/JavaPackagePrivate.java
new file mode 100644
index 0000000000..672d19b57e
--- /dev/null
+++ b/test/files/run/t7582-private-within/JavaPackagePrivate.java
@@ -0,0 +1,8 @@
+package pack;
+
+class JavaPackagePrivate {
+ int field = 0;
+ static int staticField = 0;
+ void meth() { }
+ static void staticMeth() { }
+}
diff --git a/test/files/run/t7582-private-within/Test.scala b/test/files/run/t7582-private-within/Test.scala
new file mode 100644
index 0000000000..3d581f063b
--- /dev/null
+++ b/test/files/run/t7582-private-within/Test.scala
@@ -0,0 +1,22 @@
+import scala.tools.partest.DirectTest
+
+// Testing that the `privateWithin` field is correctly populated on all
+// the related symbols (e.g. module class) under separate compilation.
+object Test extends DirectTest {
+ def code = ???
+
+ def show(): Unit = {
+ val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
+ val global = newCompiler("-usejavacp", "-cp", classpath, "-d", testOutput.path)
+ import global._
+ withRun(global) { _ =>
+ def check(sym: Symbol) = {
+ sym.initialize
+ println(f"${sym.accessString}%12s ${sym.accurateKindString} ${sym.name.decode}") // we want to see private[pack] for all of these.
+ }
+ val sym = rootMirror.getRequiredClass("pack.JavaPackagePrivate")
+ val syms = Seq(sym, sym.companionModule, sym.companionModule.moduleClass)
+ (syms ++ syms.flatMap(_.info.decls)).foreach(check)
+ }
+ }
+}
diff --git a/test/files/run/t7582.check b/test/files/run/t7582.check
new file mode 100644
index 0000000000..225fb1ace8
--- /dev/null
+++ b/test/files/run/t7582.check
@@ -0,0 +1,2 @@
+warning: there were 1 inliner warning(s); re-run with -Yinline-warnings for details
+2
diff --git a/test/files/run/t7582.flags b/test/files/run/t7582.flags
new file mode 100644
index 0000000000..1182725e86
--- /dev/null
+++ b/test/files/run/t7582.flags
@@ -0,0 +1 @@
+-optimize \ No newline at end of file
diff --git a/test/files/run/t7582/InlineHolder.scala b/test/files/run/t7582/InlineHolder.scala
new file mode 100644
index 0000000000..a18b9effaa
--- /dev/null
+++ b/test/files/run/t7582/InlineHolder.scala
@@ -0,0 +1,16 @@
+package p1 {
+ object InlineHolder {
+ @inline def inlinable = p1.PackageProtectedJava.protectedMethod() + 1
+ }
+}
+
+object O {
+ @noinline
+ def x = p1.InlineHolder.inlinable
+}
+
+object Test {
+ def main(args: Array[String]) {
+ println(O.x)
+ }
+}
diff --git a/test/files/run/t7582/PackageProtectedJava.java b/test/files/run/t7582/PackageProtectedJava.java
new file mode 100644
index 0000000000..b7ea2a7676
--- /dev/null
+++ b/test/files/run/t7582/PackageProtectedJava.java
@@ -0,0 +1,6 @@
+package p1;
+
+// public class, protected method
+public class PackageProtectedJava {
+ static final int protectedMethod() { return 1; }
+}
diff --git a/test/files/run/t7582b.check b/test/files/run/t7582b.check
new file mode 100644
index 0000000000..225fb1ace8
--- /dev/null
+++ b/test/files/run/t7582b.check
@@ -0,0 +1,2 @@
+warning: there were 1 inliner warning(s); re-run with -Yinline-warnings for details
+2
diff --git a/test/files/run/t7582b.flags b/test/files/run/t7582b.flags
new file mode 100644
index 0000000000..1182725e86
--- /dev/null
+++ b/test/files/run/t7582b.flags
@@ -0,0 +1 @@
+-optimize \ No newline at end of file
diff --git a/test/files/run/t7582b/InlineHolder.scala b/test/files/run/t7582b/InlineHolder.scala
new file mode 100644
index 0000000000..a18b9effaa
--- /dev/null
+++ b/test/files/run/t7582b/InlineHolder.scala
@@ -0,0 +1,16 @@
+package p1 {
+ object InlineHolder {
+ @inline def inlinable = p1.PackageProtectedJava.protectedMethod() + 1
+ }
+}
+
+object O {
+ @noinline
+ def x = p1.InlineHolder.inlinable
+}
+
+object Test {
+ def main(args: Array[String]) {
+ println(O.x)
+ }
+}
diff --git a/test/files/run/t7582b/PackageProtectedJava.java b/test/files/run/t7582b/PackageProtectedJava.java
new file mode 100644
index 0000000000..55a44b79f9
--- /dev/null
+++ b/test/files/run/t7582b/PackageProtectedJava.java
@@ -0,0 +1,6 @@
+package p1;
+
+// protected class, public method
+class PackageProtectedJava {
+ public static final int protectedMethod() { return 1; }
+}
diff --git a/test/files/run/t7584.check b/test/files/run/t7584.check
new file mode 100644
index 0000000000..9f53e5dde5
--- /dev/null
+++ b/test/files/run/t7584.check
@@ -0,0 +1,6 @@
+no calls
+call A
+a
+call B twice
+b
+b
diff --git a/test/files/run/t7584.flags b/test/files/run/t7584.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/run/t7584.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/run/t7584.scala b/test/files/run/t7584.scala
new file mode 100644
index 0000000000..6d7f4f7ebb
--- /dev/null
+++ b/test/files/run/t7584.scala
@@ -0,0 +1,14 @@
+// Test case added to show the behaviour of functions with
+// by-name parameters. The evaluation behaviour was already correct.
+//
+// We did flush out a spurious "pure expression does nothing in statement position"
+// warning, hence -Xfatal-warnings in the flags file.
+object Test extends App {
+ def foo(f: (=> Int, => Int) => Unit) = f({println("a"); 0}, {println("b"); 1})
+ println("no calls")
+ foo((a, b) => ())
+ println("call A")
+ foo((a, b) => a)
+ println("call B twice")
+ foo((a, b) => {b; b})
+}
diff --git a/test/files/run/t7584b.scala b/test/files/run/t7584b.scala
new file mode 100644
index 0000000000..fd560f0418
--- /dev/null
+++ b/test/files/run/t7584b.scala
@@ -0,0 +1,14 @@
+object Test extends App {
+ def fold[A, B](f: (A, => B) => B) = (b: B) => f(null.asInstanceOf[A], b)
+ def f[A, B](x: A, y: B): B = y
+ def bip[A, B] = fold[A, B]((x, y) => f(x, y))
+ def bop[A, B] = fold[A, B](f(_, _))
+
+ // these work:
+ fold[Int, Int]((x, y) => f(x, y))(0)
+ fold[Int, Int](f(_, _))(0)
+
+ // Used to throw a ClassCastException. Since the fix for SI-7899, these issue type errors.
+ // fold[Int, Int](f _)(0)
+ // fold[Int, Int](f)(0)
+}
diff --git a/test/files/run/t7617a/Macros_1.scala b/test/files/run/t7617a/Macros_1.scala
index f9772c83c0..77b18c20e2 100644
--- a/test/files/run/t7617a/Macros_1.scala
+++ b/test/files/run/t7617a/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
object Macros {
diff --git a/test/files/run/t7617b/Macros_1.scala b/test/files/run/t7617b/Macros_1.scala
index bc919935c9..90fcfda47d 100644
--- a/test/files/run/t7617b/Macros_1.scala
+++ b/test/files/run/t7617b/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
object Macros {
def impl(c: Context)(name: c.Expr[String])(value: c.Expr[Any]) = {
diff --git a/test/files/run/t7617b/Test_2.scala b/test/files/run/t7617b/Test_2.scala
index e27f650e80..e1d9acdc31 100644
--- a/test/files/run/t7617b/Test_2.scala
+++ b/test/files/run/t7617b/Test_2.scala
@@ -2,7 +2,7 @@ import scala.language.dynamics
import language.experimental.macros
class C extends Dynamic {
- def updateDynamic(name: String)(value: Any) = macro Macros.impl
+ def updateDynamic(name: String)(value: Any): Unit = macro Macros.impl
}
object Test extends App {
diff --git a/test/files/run/t7634.check b/test/files/run/t7634.check
new file mode 100644
index 0000000000..aea3b94da5
--- /dev/null
+++ b/test/files/run/t7634.check
@@ -0,0 +1,8 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+
+scala> .lines
+res1: List[String] = List(shello, world.)
+
+scala>
diff --git a/test/files/run/t7634.scala b/test/files/run/t7634.scala
new file mode 100644
index 0000000000..aeb6a5e671
--- /dev/null
+++ b/test/files/run/t7634.scala
@@ -0,0 +1,22 @@
+import java.io.File
+import scala.tools.partest.ReplTest
+import scala.util.Properties.propOrElse
+
+/**
+* filter out absolute path to java
+* filter: java
+*/
+object Test extends ReplTest {
+ def java = propOrElse("javacmd", "java")
+ def code = s""":sh $java -classpath $testOutput hello.Hello
+ |.lines""".stripMargin
+}
+
+package hello {
+ object Hello {
+ def main(a: Array[String]) {
+ System.out.println("shello, world.")
+ }
+ }
+}
+
diff --git a/test/files/run/t7657/Macros_1.scala b/test/files/run/t7657/Macros_1.scala
index b1e31aa2dd..a883f76bc3 100644
--- a/test/files/run/t7657/Macros_1.scala
+++ b/test/files/run/t7657/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
trait T { def t(): Unit }
diff --git a/test/files/run/t7700.check b/test/files/run/t7700.check
new file mode 100644
index 0000000000..ca8e686984
--- /dev/null
+++ b/test/files/run/t7700.check
@@ -0,0 +1,2 @@
+public abstract java.lang.Object C.bar(java.lang.Object)
+public abstract java.lang.Object C.foo(java.lang.Object)
diff --git a/test/files/run/t7700.scala b/test/files/run/t7700.scala
new file mode 100644
index 0000000000..76d16b808c
--- /dev/null
+++ b/test/files/run/t7700.scala
@@ -0,0 +1,17 @@
+import scala.annotation._
+
+trait C[@specialized U] {
+ @unspecialized
+ def foo(u: U): U
+ @unspecialized
+ def bar[A](u: U) = u
+}
+
+object Test extends App {
+ val declared = classOf[C[_]].getDeclaredMethods.sortBy(_.getName)
+ println(declared.mkString("\n"))
+ object CInt extends C[Int] { def foo(i: Int) = i }
+ object CAny extends C[Any] { def foo(a: Any) = a }
+ assert(CInt.foo(1) == 1)
+ assert(CAny.foo("") == "")
+}
diff --git a/test/files/run/t7711-script-args.check b/test/files/run/t7711-script-args.check
new file mode 100644
index 0000000000..d107590a8a
--- /dev/null
+++ b/test/files/run/t7711-script-args.check
@@ -0,0 +1,2 @@
+Hello, scripted test!
+What good news have you for me today?
diff --git a/test/files/run/t7711-script-args.scala b/test/files/run/t7711-script-args.scala
new file mode 100644
index 0000000000..02535aa954
--- /dev/null
+++ b/test/files/run/t7711-script-args.scala
@@ -0,0 +1,7 @@
+
+import scala.tools.partest.ScriptTest
+
+object Test extends ScriptTest {
+ override def extraSettings = s"${super.extraSettings} -Xlint"
+ override def argv = Seq("good", "news")
+}
diff --git a/test/files/run/t7711-script-args.script b/test/files/run/t7711-script-args.script
new file mode 100644
index 0000000000..19b7a74924
--- /dev/null
+++ b/test/files/run/t7711-script-args.script
@@ -0,0 +1,12 @@
+#!/bin/bash
+exec ${SCALA_HOME}/bin/scala "$0" "$@" 2>&1
+!#
+
+Console println s"Hello, scripted test!"
+Console println s"What ${args mkString " "} have you for me today?"
+
+//def unused = 88
+//newSource1.scala:8: warning: private method in <$anon: AnyRef> is never used
+//Console println s"Hello, $argv, are you still here?"
+//newSource1.scala:9: error: not found: value argv
+
diff --git a/test/files/run/t7715.check b/test/files/run/t7715.check
new file mode 100644
index 0000000000..592d7fe2ea
--- /dev/null
+++ b/test/files/run/t7715.check
@@ -0,0 +1,3 @@
+6
+4
+4
diff --git a/test/files/run/t7715.scala b/test/files/run/t7715.scala
new file mode 100644
index 0000000000..0ad3913016
--- /dev/null
+++ b/test/files/run/t7715.scala
@@ -0,0 +1,24 @@
+
+import PartialFunction.cond
+import util._
+
+object Test extends App {
+
+ object I { def unapply(x: String): Option[Int] = Try(x.toInt).toOption }
+ implicit class RX(val sc: StringContext) {
+ def rx = sc.parts.mkString("(.+)").r
+ }
+
+ Console println ("2 by 4" match {
+ case rx"${I(a)} by ${I(b)}" => a+b
+ case _ => -1
+ })
+ Console println ("2 by 4" match {
+ case rx"${_} by ${I(b)}" => b // pattern placeholder
+ case _ => -1
+ })
+ Console println ("2 by 4" match {
+ case rx"$_ by ${I(b)}" => b // is permitted this way, too
+ case _ => -1
+ })
+}
diff --git a/test/files/run/t7733/Separate_1.scala b/test/files/run/t7733/Separate_1.scala
deleted file mode 100644
index a326ecd53e..0000000000
--- a/test/files/run/t7733/Separate_1.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-package test
-
-class Separate {
- for (i <- 1 to 10) println(i)
-} \ No newline at end of file
diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check
new file mode 100644
index 0000000000..ad924f482c
--- /dev/null
+++ b/test/files/run/t7747-repl.check
@@ -0,0 +1,286 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> var x = 10
+x: Int = 10
+
+scala> var y = 11
+y: Int = 11
+
+scala> x = 12
+x: Int = 12
+
+scala> y = 13
+y: Int = 13
+
+scala> val z = x * y
+z: Int = 156
+
+scala> 2 ; 3
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 2 ;;
+ ^
+res0: Int = 3
+
+scala> { 2 ; 3 }
+<console>:8: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ { 2 ; 3 }
+ ^
+res1: Int = 3
+
+scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
+ 1 +
+ 2 +
+ 3 } ; bippy+88+11
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
+ ^
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
+ ^
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
+ ^
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
+ ^
+defined object Cow
+defined class Moo
+bippy: Int
+res2: Int = 105
+
+scala>
+
+scala> object Bovine { var x: List[_] = null } ; case class Ruminant(x: Int) ; bippy * bippy * bippy
+defined object Bovine
+defined class Ruminant
+res3: Int = 216
+
+scala> Bovine.x = List(Ruminant(5), Cow, new Moo)
+Bovine.x: List[Any] = List(Ruminant(5), Cow, Moooooo)
+
+scala> Bovine.x
+res4: List[Any] = List(Ruminant(5), Cow, Moooooo)
+
+scala>
+
+scala> (2)
+res5: Int = 2
+
+scala> (2 + 2)
+res6: Int = 4
+
+scala> ((2 + 2))
+res7: Int = 4
+
+scala> ((2 + 2))
+res8: Int = 4
+
+scala> ( (2 + 2))
+res9: Int = 4
+
+scala> ( (2 + 2 ) )
+res10: Int = 4
+
+scala> 5 ; ( (2 + 2 ) ) ; ((5))
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 5 ; ( (2 + 2 ) ) ;;
+ ^
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 5 ; ( (2 + 2 ) ) ;;
+ ^
+res11: Int = 5
+
+scala> (((2 + 2)), ((2 + 2)))
+res12: (Int, Int) = (4,4)
+
+scala> (((2 + 2)), ((2 + 2)), 2)
+res13: (Int, Int, Int) = (4,4,2)
+
+scala> (((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3)).mkString)
+res14: String = 4423
+
+scala>
+
+scala> 55 ; ((2 + 2)) ; (1, 2, 3)
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 55 ; ((2 + 2)) ;;
+ ^
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 55 ; ((2 + 2)) ;;
+ ^
+res15: (Int, Int, Int) = (1,2,3)
+
+scala> 55 ; (x: Int) => x + 1 ; () => ((5))
+<console>:8: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 55 ; (x: Int) => x + 1 ;;
+ ^
+res16: () => Int = <function0>
+
+scala>
+
+scala> () => 5
+res17: () => Int = <function0>
+
+scala> 55 ; () => 5
+<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 55 ;;
+ ^
+res18: () => Int = <function0>
+
+scala> () => { class X ; new X }
+res19: () => AnyRef = <function0>
+
+scala>
+
+scala> def foo(x: Int)(y: Int)(z: Int) = x+y+z
+foo: (x: Int)(y: Int)(z: Int)Int
+
+scala> foo(5)(10)(15)+foo(5)(10)(15)
+res20: Int = 60
+
+scala>
+
+scala> List(1) ++ List('a')
+res21: List[AnyVal] = List(1, a)
+
+scala>
+
+scala> 1 to 100 map (_ + 1)
+res22: scala.collection.immutable.IndexedSeq[Int] = Vector(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101)
+
+scala> val x1 = 1
+x1: Int = 1
+
+scala> val x2 = 2
+x2: Int = 2
+
+scala> val x3 = 3
+x3: Int = 3
+
+scala> case class BippyBungus()
+defined class BippyBungus
+
+scala> x1 + x2 + x3
+res23: Int = 6
+
+scala> :reset
+Resetting interpreter state.
+Forgetting this session history:
+
+var x = 10
+var y = 11
+x = 12
+y = 13
+val z = x * y
+2 ; 3
+{ 2 ; 3 }
+5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
+ 1 +
+ 2 +
+ 3 } ; bippy+88+11
+object Bovine { var x: List[_] = null } ; case class Ruminant(x: Int) ; bippy * bippy * bippy
+Bovine.x = List(Ruminant(5), Cow, new Moo)
+Bovine.x
+(2)
+(2 + 2)
+((2 + 2))
+ ((2 + 2))
+ ( (2 + 2))
+ ( (2 + 2 ) )
+5 ; ( (2 + 2 ) ) ; ((5))
+(((2 + 2)), ((2 + 2)))
+(((2 + 2)), ((2 + 2)), 2)
+(((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3)).mkString)
+55 ; ((2 + 2)) ; (1, 2, 3)
+55 ; (x: Int) => x + 1 ; () => ((5))
+() => 5
+55 ; () => 5
+() => { class X ; new X }
+def foo(x: Int)(y: Int)(z: Int) = x+y+z
+foo(5)(10)(15)+foo(5)(10)(15)
+List(1) ++ List('a')
+1 to 100 map (_ + 1)
+val x1 = 1
+val x2 = 2
+val x3 = 3
+case class BippyBungus()
+x1 + x2 + x3
+
+Forgetting all expression results and named terms: $intp, BippyBungus, Bovine, Cow, Ruminant, bippy, foo, x, x1, x2, x3, y, z
+Forgetting defined types: BippyBungus, Moo, Ruminant
+
+scala> x1 + x2 + x3
+<console>:8: error: not found: value x1
+ x1 + x2 + x3
+ ^
+<console>:8: error: not found: value x2
+ x1 + x2 + x3
+ ^
+<console>:8: error: not found: value x3
+ x1 + x2 + x3
+ ^
+
+scala> val x1 = 4
+x1: Int = 4
+
+scala> new BippyBungus
+<console>:8: error: not found: type BippyBungus
+ new BippyBungus
+ ^
+
+scala> class BippyBungus() { def f = 5 }
+defined class BippyBungus
+
+scala> { new BippyBungus ; x1 }
+res2: Int = 4
+
+scala> object x {class y { case object z } }
+defined object x
+
+scala> case class BippyBups()
+defined class BippyBups
+
+scala> case class PuppyPups()
+defined class PuppyPups
+
+scala> case class Bingo()
+defined class Bingo
+
+scala> List(BippyBups(), PuppyPups(), Bingo()) // show
+class $read extends Serializable {
+ def <init>() = {
+ super.<init>;
+ ()
+ };
+ class $iw extends Serializable {
+ def <init>() = {
+ super.<init>;
+ ()
+ };
+ import $line44.$read.$iw.$iw.BippyBups;
+ import $line44.$read.$iw.$iw.BippyBups;
+ import $line45.$read.$iw.$iw.PuppyPups;
+ import $line45.$read.$iw.$iw.PuppyPups;
+ import $line46.$read.$iw.$iw.Bingo;
+ import $line46.$read.$iw.$iw.Bingo;
+ class $iw extends Serializable {
+ def <init>() = {
+ super.<init>;
+ ()
+ };
+ val res3 = List(BippyBups, PuppyPups, Bingo)
+ };
+ val $iw = new $iw.<init>
+ };
+ val $iw = new $iw.<init>
+}
+object $read extends $read {
+ def <init>() = {
+ super.<init>;
+ ()
+ }
+}
+res3: List[Product with Serializable] = List(BippyBups(), PuppyPups(), Bingo())
+
+scala>
diff --git a/test/files/run/t7747-repl.scala b/test/files/run/t7747-repl.scala
new file mode 100644
index 0000000000..0e64210460
--- /dev/null
+++ b/test/files/run/t7747-repl.scala
@@ -0,0 +1,69 @@
+import scala.tools.partest.ReplTest
+import scala.tools.nsc.Settings
+
+object Test extends ReplTest {
+
+ override def transformSettings(s: Settings): Settings = {
+ s.Yreplclassbased.value = true
+ s
+ }
+
+ def code = """
+ |var x = 10
+ |var y = 11
+ |x = 12
+ |y = 13
+ |val z = x * y
+ |2 ; 3
+ |{ 2 ; 3 }
+ |5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
+ | 1 +
+ | 2 +
+ | 3 } ; bippy+88+11
+ |
+ |object Bovine { var x: List[_] = null } ; case class Ruminant(x: Int) ; bippy * bippy * bippy
+ |Bovine.x = List(Ruminant(5), Cow, new Moo)
+ |Bovine.x
+ |
+ |(2)
+ |(2 + 2)
+ |((2 + 2))
+ | ((2 + 2))
+ | ( (2 + 2))
+ | ( (2 + 2 ) )
+ |5 ; ( (2 + 2 ) ) ; ((5))
+ |(((2 + 2)), ((2 + 2)))
+ |(((2 + 2)), ((2 + 2)), 2)
+ |(((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3)).mkString)
+ |
+ |55 ; ((2 + 2)) ; (1, 2, 3)
+ |55 ; (x: Int) => x + 1 ; () => ((5))
+ |
+ |() => 5
+ |55 ; () => 5
+ |() => { class X ; new X }
+ |
+ |def foo(x: Int)(y: Int)(z: Int) = x+y+z
+ |foo(5)(10)(15)+foo(5)(10)(15)
+ |
+ |List(1) ++ List('a')
+ |
+ |1 to 100 map (_ + 1)
+ |val x1 = 1
+ |val x2 = 2
+ |val x3 = 3
+ |case class BippyBungus()
+ |x1 + x2 + x3
+ |:reset
+ |x1 + x2 + x3
+ |val x1 = 4
+ |new BippyBungus
+ |class BippyBungus() { def f = 5 }
+ |{ new BippyBungus ; x1 }
+ |object x {class y { case object z } }
+ |case class BippyBups()
+ |case class PuppyPups()
+ |case class Bingo()
+ |List(BippyBups(), PuppyPups(), Bingo()) // show
+ |""".stripMargin
+}
diff --git a/test/files/run/t7763.scala b/test/files/run/t7763.scala
new file mode 100644
index 0000000000..638077e64a
--- /dev/null
+++ b/test/files/run/t7763.scala
@@ -0,0 +1,20 @@
+object Test {
+ class A; class B
+ def main(args: Array[String]) {
+ def noExpectedType() {
+ a().asInstanceOf[B] // cast elided!
+ }
+ def withExpectedType(): B = {
+ a().asInstanceOf[B]
+ }
+ def test(a: => Any) = try {
+ a
+ sys.error("no CCE!")
+ } catch {case _: ClassCastException => }
+
+ test(noExpectedType())
+ test(withExpectedType())
+ }
+
+ def a(): Object = new A
+}
diff --git a/test/files/run/t7775.scala b/test/files/run/t7775.scala
index 5fb0327611..48b0d89974 100644
--- a/test/files/run/t7775.scala
+++ b/test/files/run/t7775.scala
@@ -1,4 +1,4 @@
-import scala.concurrent.{duration, future, Await, ExecutionContext}
+import scala.concurrent.{duration, Future, Await, ExecutionContext}
import scala.tools.nsc.Settings
import ExecutionContext.Implicits.global
@@ -8,7 +8,7 @@ import ExecutionContext.Implicits.global
object Test {
def main(args: Array[String]) {
val tries = 1000 // YMMV
- val compiler = future {
+ val compiler = Future {
for(_ <- 1 to tries) new Settings(_ => {})
}
for(i <- 1 to tries * 10) System.setProperty(s"foo$i", i.toString)
diff --git a/test/files/run/t7777.check b/test/files/run/t7777.check
new file mode 100644
index 0000000000..162ff2d2a2
--- /dev/null
+++ b/test/files/run/t7777.check
@@ -0,0 +1,7 @@
+foo(1, 2)
+bar(4, 5)
+foo(3)
+bar(7)
+apply(6)
+apply(9)
+foo(8)
diff --git a/test/files/run/t7777/Macros_1.scala b/test/files/run/t7777/Macros_1.scala
new file mode 100644
index 0000000000..1dc6d6740c
--- /dev/null
+++ b/test/files/run/t7777/Macros_1.scala
@@ -0,0 +1,17 @@
+import scala.language.experimental.macros
+import scala.language.dynamics
+import scala.reflect.macros.whitebox.Context
+
+class DynMacro extends Dynamic {
+ def applyDynamic(s: String)(xs: Any*): DynMacro =
+ macro DynMacro.applyDynamicMacro
+}
+
+object DynMacro extends DynMacro {
+ def applyDynamicMacro(c: Context)(s: c.Expr[String])(xs: c.Expr[Any]*): c.Expr[DynMacro] = {
+ import c.universe._
+ val Literal(Constant(n: String)) = s.tree
+ val args = xs.map(_.tree.toString).mkString("(", ", ", ")")
+ c.Expr(q"println(${ n + args }); ${c.prefix.tree}")
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7777/Test_2.scala b/test/files/run/t7777/Test_2.scala
new file mode 100644
index 0000000000..1fe8b63bab
--- /dev/null
+++ b/test/files/run/t7777/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ DynMacro.foo(1, 2) // prints "foo(1, 2)"
+ DynMacro.foo(3).bar(4, 5) // prints "bar(4, 5)", then "foo(3)"
+ DynMacro(6).bar(7) // prints "bar(7)", then "apply(6)"
+ DynMacro.foo(8)(9) // Fails!
+} \ No newline at end of file
diff --git a/test/files/run/t7791-script-linenums.check b/test/files/run/t7791-script-linenums.check
new file mode 100644
index 0000000000..b7d969564a
--- /dev/null
+++ b/test/files/run/t7791-script-linenums.check
@@ -0,0 +1 @@
+hello, scripted test
diff --git a/test/files/run/t7791-script-linenums.scala b/test/files/run/t7791-script-linenums.scala
new file mode 100644
index 0000000000..d89b8d4c63
--- /dev/null
+++ b/test/files/run/t7791-script-linenums.scala
@@ -0,0 +1,16 @@
+
+import scala.tools.partest.ScriptTest
+
+object Test extends ScriptTest {
+ object ExceptionLine {
+ def unapply(e: Exception) = Some(e.getStackTrace()(0).getLineNumber)
+ }
+ override def show() = {
+ import util._
+ Try(super.show()) match {
+ case Failure(ExceptionLine(7)) => ()
+ case Failure(e) => e.printStackTrace()
+ case Success(_) => Console println "Expected error"
+ }
+ }
+}
diff --git a/test/files/run/t7791-script-linenums.script b/test/files/run/t7791-script-linenums.script
new file mode 100644
index 0000000000..403dcc2d28
--- /dev/null
+++ b/test/files/run/t7791-script-linenums.script
@@ -0,0 +1,8 @@
+#!/bin/bash
+exec ${SCALA_HOME}/bin/scala "$0" "$@" 2>&1
+!#
+
+Console println s"hello, scripted test"
+
+throw new RuntimeException("failing") // line 7
+
diff --git a/test/files/run/t7801.check b/test/files/run/t7801.check
new file mode 100644
index 0000000000..d72060c684
--- /dev/null
+++ b/test/files/run/t7801.check
@@ -0,0 +1,11 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> val g: scala.reflect.internal.SymbolTable = null; import g.abort
+g: scala.reflect.internal.SymbolTable = null
+import g.abort
+
+scala> class C(val a: Any) extends AnyVal
+defined class C
+
+scala>
diff --git a/test/files/run/t7801.scala b/test/files/run/t7801.scala
new file mode 100644
index 0000000000..3a3cc97a51
--- /dev/null
+++ b/test/files/run/t7801.scala
@@ -0,0 +1,12 @@
+import scala.tools.partest.ReplTest
+
+// was crashing due to a subtle interaction of the Namer entering packages into
+// enclosing packages by mutating the scope in place without invalidating later
+// entries in the enclosing package class symbols type history.
+//
+// Sadly, I couldn't whittle the test case down further.
+object Test extends ReplTest {
+ override def code = """val g: scala.reflect.internal.SymbolTable = null; import g.abort
+ |class C(val a: Any) extends AnyVal""".stripMargin
+
+}
diff --git a/test/files/run/t7805-repl-i.check b/test/files/run/t7805-repl-i.check
new file mode 100644
index 0000000000..eecfff079a
--- /dev/null
+++ b/test/files/run/t7805-repl-i.check
@@ -0,0 +1,11 @@
+Loading t7805-repl-i.script...
+import util._
+
+Welcome to Scala
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> Console println Try(8)
+Success(8)
+
+scala>
diff --git a/test/files/run/t7805-repl-i.scala b/test/files/run/t7805-repl-i.scala
new file mode 100644
index 0000000000..208cb5da13
--- /dev/null
+++ b/test/files/run/t7805-repl-i.scala
@@ -0,0 +1,42 @@
+
+import scala.tools.partest.{ ReplTest, Welcoming }
+import scala.tools.nsc.{ GenericRunnerSettings, Settings }
+import scala.tools.nsc.settings.MutableSettings
+
+object Test extends ReplTest with HangingRepl with Welcoming {
+ def script = testPath changeExtension "script"
+ override def transformSettings(s: Settings) = s match {
+ case m: MutableSettings =>
+ val t = new GenericRunnerSettings(s.errorFn)
+ m copyInto t
+ t processArgumentString s"-i $script"
+ t
+ case _ => s
+ }
+ def code = "Console println Try(8)"
+}
+
+object Resulting {
+ import scala.concurrent._
+ import scala.concurrent.duration._
+ implicit class AwaitResult[A](val f: Future[A]) extends AnyVal {
+ def resultWithin(d: Duration): A = Await.result(f, d)
+ }
+}
+
+/** Test that hangs the REPL.
+ * Usually that is the "before" case.
+ */
+trait HangingRepl extends ReplTest {
+ import scala.language.postfixOps
+ import scala.util._
+ import scala.concurrent._
+ import scala.concurrent.duration._
+ import ExecutionContext.Implicits._
+ import Resulting._
+ def timeout = 120 seconds
+ def hanging[A](a: =>A): A = Future(a) resultWithin timeout
+ override def show() = Try(hanging(super.show())) recover {
+ case e => e.printStackTrace()
+ }
+}
diff --git a/test/files/run/t7805-repl-i.script b/test/files/run/t7805-repl-i.script
new file mode 100644
index 0000000000..eb2b8705f3
--- /dev/null
+++ b/test/files/run/t7805-repl-i.script
@@ -0,0 +1 @@
+import util._
diff --git a/test/files/run/t7817-tree-gen.check b/test/files/run/t7817-tree-gen.check
new file mode 100644
index 0000000000..4ed4b0d94a
--- /dev/null
+++ b/test/files/run/t7817-tree-gen.check
@@ -0,0 +1,104 @@
+
+
+Joint Compilation:
+
+ typer [ O] - O.this
+ pickler [ O] - O.this
+ refchecks [ O] - O.this
+ uncurry [ O] - O.this
+ specialize [ O] - O.this
+ explicitouter [ O] - O.this
+ erasure [ O] - O.this
+ posterasure [ O] - C.this.O()
+ flatten [ O] - C.this.O()
+ mixin [ O] - test.O()
+ cleanup [ O] - test.O()
+
+ typer [ P] - P.this
+ pickler [ P] - P.this
+ refchecks [ P] - P.this
+ uncurry [ P] - P.this
+ specialize [ P] - P.this
+ explicitouter [ P] - P.this
+ erasure [ P] - P.this
+ posterasure [ P] - D.this.P()
+ flatten [ P] - D.this.P()
+ mixin [ P] - P()
+ cleanup [ P] - P()
+
+ typer [ test2.PO] - PO.this
+ pickler [ test2.PO] - PO.this
+ refchecks [ test2.PO] - PO.this
+ uncurry [ test2.PO] - PO.this
+ specialize [ test2.PO] - PO.this
+ explicitouter [ test2.PO] - PO.this
+ erasure [ test2.PO] - PO.this
+ posterasure [ test2.PO] - test2.`package`.PO
+ flatten [ test2.PO] - test2.`package`.PO
+ mixin [ test2.PO] - test2.package$PO
+ cleanup [ test2.PO] - test2.package$PO
+
+ typer [ test2.bar] - `package`.this.bar
+ pickler [ test2.bar] - `package`.this.bar
+ refchecks [ test2.bar] - `package`.this.bar
+ uncurry [ test2.bar] - `package`.this.bar
+ specialize [ test2.bar] - `package`.this.bar
+ explicitouter [ test2.bar] - `package`.this.bar
+ erasure [ test2.bar] - `package`.this.bar
+ posterasure [ test2.bar] - test2.`package`.bar
+ flatten [ test2.bar] - test2.`package`.bar
+ mixin [ test2.bar] - test2.`package`.bar
+ cleanup [ test2.bar] - test2.`package`.bar
+
+
+
+Separate Compilation:
+
+ typer [ O] - O.this
+ pickler [ O] - O.this
+ refchecks [ O] - O.this
+ uncurry [ O] - O.this
+ specialize [ O] - O.this
+ explicitouter [ O] - O.this
+ erasure [ O] - O.this
+ posterasure [ O] - C.this.O()
+ flatten [ O] - C.this.O()
+ mixin [ O] - testSep.O()
+ cleanup [ O] - testSep.O()
+
+ typer [ P] - P.this
+ pickler [ P] - P.this
+ refchecks [ P] - P.this
+ uncurry [ P] - P.this
+ specialize [ P] - P.this
+ explicitouter [ P] - P.this
+ erasure [ P] - P.this
+ posterasure [ P] - DSep.this.P()
+ flatten [ P] - DSep.this.P()
+ mixin [ P] - P()
+ cleanup [ P] - P()
+
+ typer [ PO] - PO.this
+ pickler [ PO] - PO.this
+ refchecks [ PO] - PO.this
+ uncurry [ PO] - PO.this
+ specialize [ PO] - PO.this
+ explicitouter [ PO] - PO.this
+ erasure [ PO] - PO.this
+ posterasure [ PO] - test2.`package`.PO
+ flatten [ PO] - test2.`package`.PO
+ mixin [ PO] - test2.package$PO
+ cleanup [ PO] - test2.package$PO
+
+ typer [testSep2.bar] - `package`.this.bar
+ pickler [testSep2.bar] - `package`.this.bar
+ refchecks [testSep2.bar] - `package`.this.bar
+ uncurry [testSep2.bar] - `package`.this.bar
+ specialize [testSep2.bar] - `package`.this.bar
+ explicitouter [testSep2.bar] - `package`.this.bar
+ erasure [testSep2.bar] - `package`.this.bar
+ posterasure [testSep2.bar] - test2.`package`.bar
+ flatten [testSep2.bar] - test2.`package`.bar
+ mixin [testSep2.bar] - test2.`package`.bar
+ cleanup [testSep2.bar] - test2.`package`.bar
+
diff --git a/test/files/run/t7817-tree-gen.flags b/test/files/run/t7817-tree-gen.flags
new file mode 100644
index 0000000000..ce6e93b3da
--- /dev/null
+++ b/test/files/run/t7817-tree-gen.flags
@@ -0,0 +1 @@
+-Ynooptimise \ No newline at end of file
diff --git a/test/files/run/t7817-tree-gen.scala b/test/files/run/t7817-tree-gen.scala
new file mode 100644
index 0000000000..a8317fda6e
--- /dev/null
+++ b/test/files/run/t7817-tree-gen.scala
@@ -0,0 +1,65 @@
+import scala.tools.partest._
+
+// Testing that `mkAttributedRef` doesn't incude the package object test.`package`,
+// under joint and separate compilation.
+
+package testSep { class C { object O } }
+package testSep2 { object `package` { object PO; def bar = 0 } }
+class DSep { object P }
+
+object Test extends CompilerTest {
+ import global._
+ override def extraSettings = super.extraSettings + " -d " + testOutput.path
+ override def sources = List(
+ """
+ package test { class C { object O } }
+ class D { object P }
+ package test2 { object `package` { object PO; def bar = 0 } }
+ """
+ )
+ def check(source: String, unit: CompilationUnit) = enteringTyper {
+ def checkTree(msg: String, t: => Tree) = {
+ val run = currentRun
+ import run._
+ val phases = List(typerPhase, picklerPhase, refchecksPhase, uncurryPhase, specializePhase,
+ explicitouterPhase, erasurePhase, posterasurePhase, flattenPhase, mixinPhase, cleanupPhase)
+ for (phase <- phases) {
+ enteringPhase(phase) {
+ val error = t.exists(t => t.symbol == NoSymbol)
+ val errorStr = if (error) "!!!" else " - "
+ println(f"$phase%18s [$msg%12s] $errorStr $t")
+ }
+ }
+ println("")
+ }
+ import rootMirror._
+
+ println("\n\nJoint Compilation:\n")
+
+ {
+ val c = staticClass("test.C")
+ val o = c.info.decl(TermName("O"))
+ checkTree("O", gen.mkAttributedQualifier(o.moduleClass.thisType))
+ val d = staticClass("D")
+ val p = d.info.decl(TermName("P"))
+ checkTree("P", gen.mkAttributedQualifier(p.moduleClass.thisType))
+ val po = staticModule("test2.package").moduleClass.info.decl(TermName("PO"))
+ checkTree("test2.PO", gen.mkAttributedQualifier(po.moduleClass.thisType))
+ checkTree("test2.bar", gen.mkAttributedRef(po.owner.info.decl(TermName("bar"))))
+ }
+
+ println("\n\nSeparate Compilation:\n")
+
+ {
+ val c = typeOf[testSep.C].typeSymbol
+ val o = c.info.decl(TermName("O"))
+ checkTree("O", gen.mkAttributedQualifier(o.moduleClass.thisType))
+ val d = staticClass("DSep")
+ val p = d.info.decl(TermName("P"))
+ checkTree("P", gen.mkAttributedQualifier(p.moduleClass.thisType))
+ val po = staticModule("test2.package").moduleClass.info.decl(TermName("PO"))
+ checkTree("PO", gen.mkAttributedQualifier(po.moduleClass.thisType))
+ checkTree("testSep2.bar", gen.mkAttributedRef(po.owner.info.decl(TermName("bar"))))
+ }
+ }
+}
diff --git a/test/files/run/t7817.scala b/test/files/run/t7817.scala
new file mode 100644
index 0000000000..905b8aeb09
--- /dev/null
+++ b/test/files/run/t7817.scala
@@ -0,0 +1,31 @@
+import language.reflectiveCalls
+
+package test {
+ class C1 {
+ object O {
+ def struct(s: {def foo: Any}) = s.foo
+ }
+ }
+ trait T {
+ object O {
+ def struct(s: {def foo: Any}) = s.foo
+ }
+ }
+ object O1 extends T
+
+ object O2 {
+ object O {
+ def struct(s: {def foo: Any}) = s.foo
+ }
+ }
+}
+
+object Test extends App {
+ object fooable { def foo = "foo" }
+ def check(result: Any) = assert(result == "foo", result.toString)
+
+ val s = new test.C1
+ check(s.O.struct(fooable))
+ check(test.O1.O.struct(fooable))
+ check(test.O2.O.struct(fooable))
+}
diff --git a/test/files/run/t7843-jsr223-service.check b/test/files/run/t7843-jsr223-service.check
new file mode 100644
index 0000000000..a668df3567
--- /dev/null
+++ b/test/files/run/t7843-jsr223-service.check
@@ -0,0 +1,2 @@
+n: Object = 10
+12345678910
diff --git a/test/files/run/t7843-jsr223-service.scala b/test/files/run/t7843-jsr223-service.scala
new file mode 100644
index 0000000000..31112212ea
--- /dev/null
+++ b/test/files/run/t7843-jsr223-service.scala
@@ -0,0 +1,8 @@
+import scala.tools.nsc.interpreter.IMain
+
+object Test extends App {
+ val engine = new IMain.Factory getScriptEngine()
+ engine.asInstanceOf[IMain].settings.usejavacp.value = true
+ engine put ("n", 10)
+ engine eval "1 to n.asInstanceOf[Int] foreach print"
+}
diff --git a/test/files/run/t7852.flags b/test/files/run/t7852.flags
new file mode 100644
index 0000000000..f6262fd3e0
--- /dev/null
+++ b/test/files/run/t7852.flags
@@ -0,0 +1 @@
+-Ynooptimise
diff --git a/test/files/run/t7852.scala b/test/files/run/t7852.scala
new file mode 100644
index 0000000000..1679067510
--- /dev/null
+++ b/test/files/run/t7852.scala
@@ -0,0 +1,39 @@
+import scala.tools.partest.BytecodeTest
+import scala.tools.asm
+import scala.tools.asm.util._
+import scala.tools.nsc.util.stringFromWriter
+import scala.collection.JavaConverters._
+
+object Test extends BytecodeTest {
+ val nullChecks = Set(asm.Opcodes.IFNONNULL, asm.Opcodes.IFNULL)
+
+ def show: Unit = {
+ def test(methodName: String, expected: Int) {
+ val classNode = loadClassNode("Lean")
+ val methodNode = getMethod(classNode, methodName)
+ val got = countNullChecks(methodNode.instructions)
+ assert(got == expected, s"$methodName: expected $expected but got $got comparisons")
+ }
+ test("string", expected = 0)
+ test("module", expected = 0)
+ test("moduleIndirect", expected = 2)
+ }
+
+ def countNullChecks(insnList: asm.tree.InsnList): Int =
+ insnList.iterator.asScala.map(_.getOpcode).count(nullChecks)
+}
+
+class Lean {
+ def string {
+ "" == toString
+ }
+
+ def module {
+ Nil == (toString: Any)
+ }
+
+ def moduleIndirect {
+ val n: Nil.type = null
+ n == (toString: Any) // still need null checks here.
+ }
+}
diff --git a/test/files/run/t7859/A_1.scala b/test/files/run/t7859/A_1.scala
new file mode 100644
index 0000000000..74f0709d4d
--- /dev/null
+++ b/test/files/run/t7859/A_1.scala
@@ -0,0 +1,11 @@
+class A(private val x: Int) extends AnyVal
+
+object A {
+ val Const = new A(0)
+}
+
+class A1(protected val x: Int) extends AnyVal
+
+package p {
+ class A2(private[p] val x: Int) extends AnyVal
+}
diff --git a/test/files/run/t7859/B_2.scala b/test/files/run/t7859/B_2.scala
new file mode 100644
index 0000000000..6b23af3abb
--- /dev/null
+++ b/test/files/run/t7859/B_2.scala
@@ -0,0 +1,47 @@
+class B private (private val b: Int) extends AnyVal
+object B {
+ val Const = new B(0)
+}
+
+// These tests will require erasure to unbox the value class.
+// We need to test under joint and separate compilation to check
+// that the 'notPRIVATE' flag on the param accessor is pickled.
+//
+// See also SI-6601.
+object Test {
+ def main(args: Array[String]) {
+ unboxA
+ unboxA1
+ unboxA2
+ unboxB
+ }
+
+ def unboxA {
+ val o: Some[A] = Some(A.Const)
+ val a = o.get
+ def id(a: A): A = a
+ id(a)
+ }
+
+ def unboxA1 {
+ val o: Some[A1] = Some(new A1(0))
+ val a = o.get
+ def id(a: A1): A1 = a
+ id(a)
+ }
+
+ def unboxA2 {
+ import p.A2
+ val o: Some[A2] = Some(new A2(0))
+ val a = o.get
+ def id(a: A2): A2 = a
+ id(a)
+ }
+
+ def unboxB {
+ val o: Some[B] = Some(B.Const)
+ val b = o.get
+ def id(b: B): B = b
+ id(b)
+ }
+}
diff --git a/test/files/run/t7868.scala b/test/files/run/t7868.scala
new file mode 100644
index 0000000000..1f938adf31
--- /dev/null
+++ b/test/files/run/t7868.scala
@@ -0,0 +1,13 @@
+object A {
+ def unapply(n: Int): Option[Int] = Some(n)
+
+ def run = (0: Short) match {
+ case A(_) =>
+ case _ =>
+ }
+}
+
+
+object Test extends App {
+ A.run
+}
diff --git a/test/files/run/t7868b.check b/test/files/run/t7868b.check
new file mode 100644
index 0000000000..6577c4bc4e
--- /dev/null
+++ b/test/files/run/t7868b.check
@@ -0,0 +1,6 @@
+Expr[Int]({
+ val x = (0: Short): @unchecked match {
+ case A((x @ _)) => x
+ };
+ x
+})
diff --git a/test/files/run/t7868b.scala b/test/files/run/t7868b.scala
new file mode 100644
index 0000000000..759eeaf862
--- /dev/null
+++ b/test/files/run/t7868b.scala
@@ -0,0 +1,11 @@
+object A {
+ def unapply(n: Int): Option[Int] = Some(1)
+}
+
+object Test extends App {
+ import reflect.runtime.universe._
+ println(reify {
+ val A(x) = (0: Short)
+ x
+ })
+}
diff --git a/test/files/run/t7871.check b/test/files/run/t7871.check
new file mode 100644
index 0000000000..ce6efd812d
--- /dev/null
+++ b/test/files/run/t7871.check
@@ -0,0 +1 @@
+(SomeTree,SomeTree)
diff --git a/test/files/run/t7871/Macros_1.scala b/test/files/run/t7871/Macros_1.scala
new file mode 100644
index 0000000000..dca2508128
--- /dev/null
+++ b/test/files/run/t7871/Macros_1.scala
@@ -0,0 +1,27 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+trait Tree
+case object SomeTree extends Tree
+
+object NewQuasiquotes {
+ implicit class QuasiquoteInterpolation(c: StringContext) {
+ object nq {
+ def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl
+ }
+ }
+}
+
+object QuasiquoteMacros {
+ def unapplyImpl(c: Context)(t: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def unapply(t: Tree) = t match {
+ case SomeTree => Some((SomeTree, SomeTree))
+ case _ => None
+ }
+ }.unapply($t)
+ """
+ }
+}
diff --git a/test/files/run/t7871/Test_2.scala b/test/files/run/t7871/Test_2.scala
new file mode 100644
index 0000000000..3a0b68b568
--- /dev/null
+++ b/test/files/run/t7871/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import NewQuasiquotes._
+ SomeTree match {
+ case nq"$x + $y" => println((x, y))
+ }
+}
diff --git a/test/files/run/t7876.scala b/test/files/run/t7876.scala
new file mode 100644
index 0000000000..aeec8c8cce
--- /dev/null
+++ b/test/files/run/t7876.scala
@@ -0,0 +1,26 @@
+import scala.tools.partest._
+
+// Type constructors for FunctionN and TupleN should not be considered as function type / tuple types.
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp"
+
+ def code = ""
+
+ def show() {
+ val global = newCompiler()
+ new global.Run()
+ import global._, definitions._
+ val function0TC = FunctionClass(0).typeConstructor
+ val tuple1TC = TupleClass(1).typeConstructor
+ FunctionClass.seq.foreach { sym =>
+ val tc = sym.typeConstructor
+ assert(!isFunctionType(tc), s"$tc")
+ assert(!isFunctionTypeDirect(tc), s"$tc (direct)")
+ }
+ TupleClass.seq.foreach { sym =>
+ val tc = sym.typeConstructor
+ assert(!isTupleType(tc), s"$sym")
+ assert(!isTupleTypeDirect(tc), s"$tc (direct)")
+ }
+ }
+}
diff --git a/test/files/run/t7880.scala b/test/files/run/t7880.scala
new file mode 100644
index 0000000000..9fbc337f87
--- /dev/null
+++ b/test/files/run/t7880.scala
@@ -0,0 +1,7 @@
+object Test extends App {
+ // This should terminate in one way or another, but it shouldn't loop forever.
+ try {
+ val buffer = collection.mutable.ArrayBuffer.fill(Int.MaxValue / 2 + 1)(0)
+ buffer append 1
+ } catch { case _: OutOfMemoryError => }
+}
diff --git a/test/files/run/t7899-regression.check b/test/files/run/t7899-regression.check
new file mode 100644
index 0000000000..602b03a1d1
--- /dev/null
+++ b/test/files/run/t7899-regression.check
@@ -0,0 +1 @@
+warning: -Yinfer-by-name is deprecated: This flag is scheduled for removal in 2.12. If you have a case where you need this flag then please report a bug.
diff --git a/test/files/run/t7899-regression.flags b/test/files/run/t7899-regression.flags
new file mode 100644
index 0000000000..553a27eafd
--- /dev/null
+++ b/test/files/run/t7899-regression.flags
@@ -0,0 +1 @@
+-Yinfer-by-name -deprecation
diff --git a/test/files/run/t7899-regression.scala b/test/files/run/t7899-regression.scala
new file mode 100644
index 0000000000..67d38cdd1d
--- /dev/null
+++ b/test/files/run/t7899-regression.scala
@@ -0,0 +1,24 @@
+import language.higherKinds
+
+object Test {
+ trait Monad[M[_]] {
+ def foo[A](ma: M[A])(f: M[A] => Any) = f(ma)
+ }
+ implicit def function1Covariant[T]: Monad[({type l[a] = (T => a)})#l] =
+ new Monad[({type l[a] = (T => a)})#l] {}
+
+ def main(args: Array[String]) {
+ // inference of T = (=> Any) here was outlawed by SI-7899 / 8ed7099
+ // but this pattern is used in Scalaz in just a few places and caused
+ // a regression.
+ //
+ // Inference of a by-name type doesn't *always* lead to a ClassCastException,
+ // it only gets there if a method in generic code accepts a parameter of
+ // that type.
+ //
+ // We need to introduce the stricter inference rules gradually, probably
+ // with a warning.
+ val m = implicitly[Monad[({type f[+x] = (=> Any) => x})#f]]
+ assert(m.foo[Int]((x => 0))(f => f(???)) == 0)
+ }
+}
diff --git a/test/files/run/t7899.scala b/test/files/run/t7899.scala
new file mode 100644
index 0000000000..5879d4b9fe
--- /dev/null
+++ b/test/files/run/t7899.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ def id[A](a: => A): A = null.asInstanceOf[A]
+ def foo(f: (=> Int) => Int) = () => f(???)
+ foo(id)() // should be allowed and not throw ???
+}
diff --git a/test/files/run/t7932.check b/test/files/run/t7932.check
new file mode 100644
index 0000000000..13d64f1d3c
--- /dev/null
+++ b/test/files/run/t7932.check
@@ -0,0 +1,3 @@
+warning: there were 1 feature warning(s); re-run with -feature for details
+public Category<?> C.category()
+public Category<scala.Tuple2> C.category1()
diff --git a/test/files/run/t7932.scala b/test/files/run/t7932.scala
new file mode 100644
index 0000000000..8743abff88
--- /dev/null
+++ b/test/files/run/t7932.scala
@@ -0,0 +1,11 @@
+class Category[M[_, _]]
+trait M[F] {
+ type X[a, b] = F
+ def category: Category[X] = null
+ def category1: Category[Tuple2] = null
+}
+abstract class C extends M[Float]
+object Test extends App {
+ val ms = classOf[C].getMethods.filter(_.getName.startsWith("category"))
+ println(ms.map(_.toGenericString).sorted.mkString("\n"))
+}
diff --git a/test/files/run/t7933.check b/test/files/run/t7933.check
new file mode 100644
index 0000000000..317e9677c3
--- /dev/null
+++ b/test/files/run/t7933.check
@@ -0,0 +1,2 @@
+hello
+hello
diff --git a/test/files/run/t7933.scala b/test/files/run/t7933.scala
new file mode 100644
index 0000000000..b06dffcd80
--- /dev/null
+++ b/test/files/run/t7933.scala
@@ -0,0 +1,11 @@
+import scala.tools.nsc.interpreter.IMain
+
+object Test extends App {
+ val engine = new IMain.Factory getScriptEngine()
+ engine.asInstanceOf[IMain].settings.usejavacp.value = true
+ val res2 = engine.asInstanceOf[javax.script.Compilable]
+ res2 compile "8" eval()
+ val res5 = res2 compile """println("hello") ; 8"""
+ res5 eval()
+ res5 eval()
+}
diff --git a/test/files/run/t7974.check b/test/files/run/t7974.check
new file mode 100644
index 0000000000..0be496d8d0
--- /dev/null
+++ b/test/files/run/t7974.check
@@ -0,0 +1,104 @@
+public class Symbols {
+
+ // compiled from: Symbols.scala
+
+
+
+ // access flags 0x12
+ private final Lscala/Symbol; someSymbol3
+
+ // access flags 0xA
+ private static Lscala/Symbol; symbol$1
+
+ // access flags 0xA
+ private static Lscala/Symbol; symbol$2
+
+ // access flags 0xA
+ private static Lscala/Symbol; symbol$3
+
+ // access flags 0x9
+ public static <clinit>()V
+ L0
+ LINENUMBER 2 L0
+ GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$;
+ LDC "Symbolic1"
+ INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol;
+ PUTSTATIC Symbols.symbol$1 : Lscala/Symbol;
+ L1
+ LINENUMBER 3 L1
+ GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$;
+ LDC "Symbolic2"
+ INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol;
+ PUTSTATIC Symbols.symbol$2 : Lscala/Symbol;
+ L2
+ LINENUMBER 5 L2
+ GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$;
+ LDC "Symbolic3"
+ INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol;
+ PUTSTATIC Symbols.symbol$3 : Lscala/Symbol;
+ RETURN
+ MAXSTACK = 2
+ MAXLOCALS = 0
+
+ // access flags 0x1
+ public someSymbol1()Lscala/Symbol;
+ L0
+ LINENUMBER 2 L0
+ GETSTATIC Symbols.symbol$1 : Lscala/Symbol;
+ ARETURN
+ L1
+ LOCALVARIABLE this LSymbols; L0 L1 0
+ MAXSTACK = 1
+ MAXLOCALS = 1
+
+ // access flags 0x1
+ public someSymbol2()Lscala/Symbol;
+ L0
+ LINENUMBER 3 L0
+ GETSTATIC Symbols.symbol$2 : Lscala/Symbol;
+ ARETURN
+ L1
+ LOCALVARIABLE this LSymbols; L0 L1 0
+ MAXSTACK = 1
+ MAXLOCALS = 1
+
+ // access flags 0x1
+ public sameSymbol1()Lscala/Symbol;
+ L0
+ LINENUMBER 4 L0
+ GETSTATIC Symbols.symbol$1 : Lscala/Symbol;
+ ARETURN
+ L1
+ LOCALVARIABLE this LSymbols; L0 L1 0
+ MAXSTACK = 1
+ MAXLOCALS = 1
+
+ // access flags 0x1
+ public someSymbol3()Lscala/Symbol;
+ L0
+ LINENUMBER 5 L0
+ ALOAD 0
+ GETFIELD Symbols.someSymbol3 : Lscala/Symbol;
+ ARETURN
+ L1
+ LOCALVARIABLE this LSymbols; L0 L1 0
+ MAXSTACK = 1
+ MAXLOCALS = 1
+
+ // access flags 0x1
+ public <init>()V
+ L0
+ LINENUMBER 6 L0
+ ALOAD 0
+ INVOKESPECIAL java/lang/Object.<init> ()V
+ L1
+ LINENUMBER 5 L1
+ ALOAD 0
+ GETSTATIC Symbols.symbol$3 : Lscala/Symbol;
+ PUTFIELD Symbols.someSymbol3 : Lscala/Symbol;
+ RETURN
+ L2
+ LOCALVARIABLE this LSymbols; L0 L2 0
+ MAXSTACK = 2
+ MAXLOCALS = 1
+}
diff --git a/test/files/run/t7974.flags b/test/files/run/t7974.flags
new file mode 100644
index 0000000000..5fc2a03894
--- /dev/null
+++ b/test/files/run/t7974.flags
@@ -0,0 +1 @@
+-Xcheckinit:false
diff --git a/test/files/run/t7974/Symbols.scala b/test/files/run/t7974/Symbols.scala
new file mode 100644
index 0000000000..2363b724eb
--- /dev/null
+++ b/test/files/run/t7974/Symbols.scala
@@ -0,0 +1,6 @@
+class Symbols {
+ def someSymbol1 = 'Symbolic1
+ def someSymbol2 = 'Symbolic2
+ def sameSymbol1 = 'Symbolic1
+ val someSymbol3 = 'Symbolic3
+}
diff --git a/test/files/run/t7974/Test.scala b/test/files/run/t7974/Test.scala
new file mode 100644
index 0000000000..433d9061a7
--- /dev/null
+++ b/test/files/run/t7974/Test.scala
@@ -0,0 +1,20 @@
+import java.io.PrintWriter;
+
+import scala.tools.partest.BytecodeTest
+import scala.tools.asm.util._
+import scala.tools.nsc.util.stringFromWriter
+
+object Test extends BytecodeTest {
+ def show {
+ val classNode = loadClassNode("Symbols", skipDebugInfo = false)
+ val textifier = new Textifier
+ classNode.accept(new TraceClassVisitor(null, textifier, null))
+
+ val classString = stringFromWriter(w => textifier.print(w))
+ val result =
+ classString.split('\n')
+ .dropWhile(elem => elem != "public class Symbols {")
+ .filterNot(elem => elem.startsWith(" @Lscala/reflect/ScalaSignature") || elem.startsWith(" ATTRIBUTE ScalaSig"))
+ result foreach println
+ }
+}
diff --git a/test/files/run/t7985.scala b/test/files/run/t7985.scala
new file mode 100644
index 0000000000..5fe270f9c0
--- /dev/null
+++ b/test/files/run/t7985.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Array(1) match { case _: Array[scala.Int] => }
+}
diff --git a/test/files/run/t7985b.scala b/test/files/run/t7985b.scala
new file mode 100644
index 0000000000..aaf649eb28
--- /dev/null
+++ b/test/files/run/t7985b.scala
@@ -0,0 +1,5 @@
+class a { type X = Int }
+
+object Test extends App {
+ Array(1) match { case _: Array[a#X] => }
+}
diff --git a/test/files/run/t7992.scala b/test/files/run/t7992.scala
new file mode 100644
index 0000000000..fde231b961
--- /dev/null
+++ b/test/files/run/t7992.scala
@@ -0,0 +1,20 @@
+class C {
+ def foo: Int = 0
+}
+
+class D extends C {
+ override def foo: Int = {
+ val f = () => {
+ class C // comment this line to fix.
+ D.super.foo // no super accessor generated here!
+ // java.lang.VerifyError: (class: D$$anonfun$1, method: apply$mcI$sp signature: ()I) Illegal use of nonvirtual function call
+ }
+ f()
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ new D().foo
+ }
+}
diff --git a/test/files/run/t7992b.scala b/test/files/run/t7992b.scala
new file mode 100644
index 0000000000..6fe1f990d5
--- /dev/null
+++ b/test/files/run/t7992b.scala
@@ -0,0 +1,18 @@
+class C {
+ def foo: Int = 0
+}
+
+class E extends C {
+ override def foo: Int = {
+ (None: Option[Int]).getOrElse {
+ class C
+ E.super.foo
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ new E().foo
+ }
+}
diff --git a/test/files/run/t8002.scala b/test/files/run/t8002.scala
new file mode 100644
index 0000000000..f24a213dea
--- /dev/null
+++ b/test/files/run/t8002.scala
@@ -0,0 +1,19 @@
+object Test extends App {
+ val a: Any = {
+ class A private () { private def x = 0; A.y };
+ object A {
+ def a = new A().x
+ private def y = 0
+ }
+ A.a
+ }
+ def b: Any = {
+ object A {
+ def a = new A().x
+ private def y = 0
+ }
+ class A private () { private def x = 0; A.y };
+ A.a
+ }
+ b
+}
diff --git a/test/files/run/t8015-ffc.scala b/test/files/run/t8015-ffc.scala
new file mode 100644
index 0000000000..fe6781be42
--- /dev/null
+++ b/test/files/run/t8015-ffc.scala
@@ -0,0 +1,7 @@
+
+object Test extends App {
+ val ms = """This is a long multiline string
+ with \u000d\u000a CRLF embedded."""
+ assert(ms.lines.size == 3, s"lines.size ${ms.lines.size}")
+ assert(ms contains "\r\n CRLF", "no CRLF")
+}
diff --git a/test/files/run/t8017.flags b/test/files/run/t8017.flags
new file mode 100644
index 0000000000..48b438ddf8
--- /dev/null
+++ b/test/files/run/t8017.flags
@@ -0,0 +1 @@
+-Ydelambdafy:method
diff --git a/test/files/run/t8017/value-class-lambda.scala b/test/files/run/t8017/value-class-lambda.scala
new file mode 100644
index 0000000000..370023b194
--- /dev/null
+++ b/test/files/run/t8017/value-class-lambda.scala
@@ -0,0 +1,40 @@
+object Test {
+ def testC {
+ val f1 = (c: C) => c.value
+ val f2 = (x: Int) => new C(x)
+ val f3 = (c1: C) => (c2: C) => (c1, c2)
+ val r1 = f2(2)
+ val r2 = f2(2)
+ val r3 = f3(r1)(r2)
+ val result = f1(r3._2)
+ assert(result == 2)
+ }
+
+ def testD {
+ val f1 = (c: D) => c.value
+ val f2 = (x: String) => new D(x)
+ val f3 = (c1: D) => (c2: D) => (c1, c2)
+ val r1 = f2("2")
+ val r2 = f2("2")
+ val r3 = f3(r1)(r2)
+ val result = f1(r3._2)
+ assert(result == "2")
+ }
+
+ def testE {
+ val f1 = (c: E[Int]) => c.value
+ val f2 = (x: Int) => new E(x)
+ val f3 = (c1: E[Int]) => (c2: E[Int]) => (c1, c2)
+ val r1 = f2(2)
+ val r2 = f2(2)
+ val r3 = f3(r1)(r2)
+ val result = f1(r3._2)
+ assert(result == 2)
+ }
+
+ def main(args: Array[String]) {
+ testC
+ testD
+ testE
+ }
+}
diff --git a/test/files/run/t8017/value-class.scala b/test/files/run/t8017/value-class.scala
new file mode 100644
index 0000000000..821239305f
--- /dev/null
+++ b/test/files/run/t8017/value-class.scala
@@ -0,0 +1,3 @@
+class C(val value: Int) extends AnyVal
+class D(val value: String) extends AnyVal
+class E[A](val value: A) extends AnyVal
diff --git a/test/files/run/t8046.check b/test/files/run/t8046.check
new file mode 100644
index 0000000000..905b0b35ca
--- /dev/null
+++ b/test/files/run/t8046.check
@@ -0,0 +1,2 @@
+List(trait Op, trait Function1, class Object, class Any)
+BTS(T,Three.this.Op[Int],Int => Int,Object,Any)
diff --git a/test/files/run/t8046/Test.scala b/test/files/run/t8046/Test.scala
new file mode 100644
index 0000000000..f6b525d1b5
--- /dev/null
+++ b/test/files/run/t8046/Test.scala
@@ -0,0 +1,18 @@
+import scala.tools.partest._
+
+object Test extends DirectTest {
+ override def code = ""
+ override def extraSettings: String = "-usejavacp"
+
+ override def show() {
+ val c = newCompiler()
+ new c.Run
+ import c._
+
+ val f4 = typeOf[Three].member(newTermName("f4"))
+ val f4ParamInfo = f4.paramss.head.head.info
+ println(f4ParamInfo.baseClasses)
+ println(f4ParamInfo.baseTypeSeq)
+ }
+}
+
diff --git a/test/files/run/t8046/t8046c.scala b/test/files/run/t8046/t8046c.scala
new file mode 100644
index 0000000000..0b484da530
--- /dev/null
+++ b/test/files/run/t8046/t8046c.scala
@@ -0,0 +1,13 @@
+import language._
+
+trait One {
+ type Op[A]
+ type Alias[A] = Op[A]
+}
+
+trait Three extends One {
+ trait Op[A] extends (A => A)
+
+ def f4[T <: Alias[Int]](f: T) = 0
+}
+
diff --git a/test/files/run/t8047.check b/test/files/run/t8047.check
new file mode 100644
index 0000000000..a6b83a4a16
--- /dev/null
+++ b/test/files/run/t8047.check
@@ -0,0 +1,7 @@
+doWhile$1(){
+ 1;
+ if (true)
+ doWhile$1()
+ else
+ ()
+}
diff --git a/test/files/run/t8047.scala b/test/files/run/t8047.scala
new file mode 100644
index 0000000000..f5660541e8
--- /dev/null
+++ b/test/files/run/t8047.scala
@@ -0,0 +1,31 @@
+object Test extends App {
+ import scala.reflect.runtime.universe._
+ //
+ // x's owner is outer Test scope. Previosly the quasiquote expansion
+ // looked like:
+ //
+ // object Test {
+ // build.withFreshTermName("doWhile")(n =>
+ // LabelDef(n, List(),
+ // Block(
+ // List({ val x = 1; x }),
+ // If(Literal(Constant(true)), Apply(Ident(n), List()), Literal(Constant(())))))
+ // }
+ //
+ // Here the proper owner is anonymous function, not the Test. Hence
+ // symbol corruption. In new encoding this is represented as:
+ //
+ // object Test {
+ // {
+ // val n = build.freshTermName("doWhile")
+ // LabelDef(n, List(),
+ // Block(
+ // List({ val x = 1; x }),
+ // If(Literal(Constant(true)), Apply(Ident(n), List()), Literal(Constant(()))))
+ // }
+ // }
+ //
+ // Owner stays the same and life is good again.
+ //
+ println(q"do ${ val x = 1; x } while(true)")
+}
diff --git a/test/files/run/t8048a.check b/test/files/run/t8048a.check
new file mode 100644
index 0000000000..8fb9e26e84
--- /dev/null
+++ b/test/files/run/t8048a.check
@@ -0,0 +1 @@
+Some(2)
diff --git a/test/files/run/t8048a/Macros_1.scala b/test/files/run/t8048a/Macros_1.scala
new file mode 100644
index 0000000000..d13e851d90
--- /dev/null
+++ b/test/files/run/t8048a/Macros_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ q"if (true) Some(2) else None"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/t8048a/Test_2.scala b/test/files/run/t8048a/Test_2.scala
new file mode 100644
index 0000000000..4e1c8b16b0
--- /dev/null
+++ b/test/files/run/t8048a/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ val x: Option[Int] = Macros.foo
+ println(x)
+} \ No newline at end of file
diff --git a/test/files/run/t8048b.check b/test/files/run/t8048b.check
new file mode 100644
index 0000000000..083edaac24
--- /dev/null
+++ b/test/files/run/t8048b.check
@@ -0,0 +1,3 @@
+2
+2
+2
diff --git a/test/files/run/t8048b/Macros_1.scala b/test/files/run/t8048b/Macros_1.scala
new file mode 100644
index 0000000000..520a6fac06
--- /dev/null
+++ b/test/files/run/t8048b/Macros_1.scala
@@ -0,0 +1,37 @@
+// see the following discussions to understand what's being tested here:
+// * https://issues.scala-lang.org/browse/SI-6992
+// * https://issues.scala-lang.org/browse/SI-8048
+// * http://stackoverflow.com/questions/14370842/getting-a-structural-type-with-an-anonymous-classs-methods-from-a-macro
+// * http://stackoverflow.com/questions/18480707/method-cannot-be-accessed-in-macro-generated-class/18485004#18485004
+// * https://groups.google.com/forum/#!topic/scala-internals/eXQt-BPm4i8
+
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+object Macros {
+ def impl1(c: Context) = {
+ import c.universe._
+ q"""
+ trait Foo { def x = 2 }
+ new Foo {}
+ """
+ }
+ def foo1: Any = macro impl1
+
+ def impl2(c: Context) = {
+ import c.universe._
+ q"""
+ class Foo { def x = 2 }
+ new Foo
+ """
+ }
+ def foo2: Any = macro impl2
+
+ def impl3(c: Context) = {
+ import c.universe._
+ q"""
+ new { def x = 2 }
+ """
+ }
+ def foo3: Any = macro impl3
+} \ No newline at end of file
diff --git a/test/files/run/t8048b/Test_2.scala b/test/files/run/t8048b/Test_2.scala
new file mode 100644
index 0000000000..fb410dab7a
--- /dev/null
+++ b/test/files/run/t8048b/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ println(Macros.foo1.x)
+ println(Macros.foo2.x)
+ println(Macros.foo3.x)
+} \ No newline at end of file
diff --git a/test/files/run/t8091.check b/test/files/run/t8091.check
new file mode 100644
index 0000000000..4c4e91774f
--- /dev/null
+++ b/test/files/run/t8091.check
@@ -0,0 +1 @@
+b&#x00f6;rk b&#x00f6;rk
diff --git a/test/files/run/t8091.scala b/test/files/run/t8091.scala
new file mode 100644
index 0000000000..cd412d4c2a
--- /dev/null
+++ b/test/files/run/t8091.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ val result = "börk börk" flatMap (ch ⇒ if (ch > 127) f"&#x${ch}%04x;" else "" + ch)
+ println(result)
+} \ No newline at end of file
diff --git a/test/files/run/t8100.check b/test/files/run/t8100.check
new file mode 100644
index 0000000000..cdd927fd88
--- /dev/null
+++ b/test/files/run/t8100.check
@@ -0,0 +1 @@
+Success(0)
diff --git a/test/files/run/t8100.scala b/test/files/run/t8100.scala
new file mode 100644
index 0000000000..b9d0fe5003
--- /dev/null
+++ b/test/files/run/t8100.scala
@@ -0,0 +1,8 @@
+object Test {
+ import scala.util.Try
+
+ def main(args: Array[String]): Unit = {
+ def stream = Stream.from(0).take(100000).map(n => None)
+ println(Try(stream.flatten.length))
+ }
+}
diff --git a/test/files/run/t8104.check b/test/files/run/t8104.check
new file mode 100644
index 0000000000..40523a2868
--- /dev/null
+++ b/test/files/run/t8104.check
@@ -0,0 +1,2 @@
+WeakTypeTag[<refinement>.this.Repr]
+(Int, Int)
diff --git a/test/files/run/t8104/Macros_1.scala b/test/files/run/t8104/Macros_1.scala
new file mode 100644
index 0000000000..e135bd807b
--- /dev/null
+++ b/test/files/run/t8104/Macros_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.whitebox.Context
+
+object Macros {
+ def impl[T](c: Context)(implicit T: c.WeakTypeTag[T]) = {
+ import c.universe._
+ import definitions._
+ val fields = T.tpe.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+ val Repr = appliedType(TupleClass(fields.length).asType.toType, fields.map(_.info))
+ q"new Generic[$T]{ type Repr = $Repr }"
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t8104/Test_2.scala b/test/files/run/t8104/Test_2.scala
new file mode 100644
index 0000000000..08451dfb2a
--- /dev/null
+++ b/test/files/run/t8104/Test_2.scala
@@ -0,0 +1,19 @@
+trait Generic[T] { type Repr }
+object Generic {
+ type Aux[T, Repr0] = Generic[T] { type Repr = Repr0 }
+ import scala.language.experimental.macros
+ implicit def materializeGeneric[T, Repr]: Generic.Aux[T, Repr] = macro Macros.impl[T]
+}
+
+object Test extends App {
+ case class C(x: Int, y: Int)
+
+ import scala.reflect.runtime.universe._
+ def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: WeakTypeTag[Repr]) = {
+ println(tag)
+ println(tag.tpe.typeSymbol.info)
+ }
+ reprify(C(40, 2))
+
+ implicitly[Generic.Aux[C, (Int, Int)]]
+}
diff --git a/test/files/run/t8114.scala b/test/files/run/t8114.scala
deleted file mode 100644
index ecbca37d2a..0000000000
--- a/test/files/run/t8114.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-class AbstractTable[T] { type TableElementType }
-class Table[T] extends AbstractTable[T] { type TableElementType = T }
-
-class Query[E, U]
-class TableQuery[E <: AbstractTable[_]] extends Query[E, E#TableElementType]
-
-object Test extends App {
- object MyTable extends TableQuery[Table[Long]]
-
- def list[R](q: Query[_, R]): List[R] = Nil
- list/*[Long]*/(MyTable) collect { case x => x }
-
- // Generates a redundant bridge method (double definition error)
- // in 2.10.x due to (at least) the bug in erasure fixed in SI-7120
-}
diff --git a/test/files/run/t8133/A_1.scala b/test/files/run/t8133/A_1.scala
new file mode 100644
index 0000000000..a2836cdb3a
--- /dev/null
+++ b/test/files/run/t8133/A_1.scala
@@ -0,0 +1,5 @@
+// a.scala
+package object pkg {
+ class AnyOps(val x: Any) extends AnyVal
+ def AnyOps(x: Any) = new AnyOps(x)
+}
diff --git a/test/files/run/t8133/B_2.scala b/test/files/run/t8133/B_2.scala
new file mode 100644
index 0000000000..b80e10952d
--- /dev/null
+++ b/test/files/run/t8133/B_2.scala
@@ -0,0 +1,15 @@
+package pkg {
+ package object other
+ package other {
+ class Crash {
+ AnyOps(0)
+ ()
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ new pkg.other.Crash
+ }
+}
diff --git a/test/files/run/t8133b/A_1.scala b/test/files/run/t8133b/A_1.scala
new file mode 100644
index 0000000000..24bbfc118d
--- /dev/null
+++ b/test/files/run/t8133b/A_1.scala
@@ -0,0 +1,4 @@
+package object pkg {
+ def foo(x: Int): String = "a"
+ def foo(x: String): String = "b"
+}
diff --git a/test/files/run/t8133b/B_2.scala b/test/files/run/t8133b/B_2.scala
new file mode 100644
index 0000000000..865ca0c0b0
--- /dev/null
+++ b/test/files/run/t8133b/B_2.scala
@@ -0,0 +1,9 @@
+// b.scala
+package pkg {
+ package object other
+ package other { class Crash { foo("") } }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = new pkg.other.Crash
+}
diff --git a/test/files/run/t7064-old-style-supercalls.check b/test/files/run/t8153.check
index 0cfbf08886..0cfbf08886 100644
--- a/test/files/run/t7064-old-style-supercalls.check
+++ b/test/files/run/t8153.check
diff --git a/test/files/run/t8153.scala b/test/files/run/t8153.scala
new file mode 100644
index 0000000000..f9b223f974
--- /dev/null
+++ b/test/files/run/t8153.scala
@@ -0,0 +1,14 @@
+object Test {
+ def f() = {
+ val lb = scala.collection.mutable.ListBuffer[Int](1, 2)
+ val it = lb.iterator
+ if (it.hasNext) it.next
+ val xs = lb.toList
+ lb += 3
+ it.mkString
+ }
+
+ def main(args: Array[String]) {
+ println(f())
+ }
+}
diff --git a/test/files/run/t8177f.scala b/test/files/run/t8177f.scala
new file mode 100644
index 0000000000..f50a5d98d6
--- /dev/null
+++ b/test/files/run/t8177f.scala
@@ -0,0 +1,20 @@
+trait Thing { type A; var p: A = _ }
+class A[T](final val x: Thing { type A = T }) {
+ type Q = T
+
+ def x1: T = x.p
+ def x2: Q = x.p
+ def x3: x.A = x.p
+}
+// all result types should be inferred as Int
+class B extends A[Int](null) {
+ def y1 = x1
+ def y2 = x2
+ val y3 = x3 // before SI-8177, this lead to a signature that erased to java.lang.Object
+}
+
+
+object Test extends App {
+ val methods = classOf[B].getDeclaredMethods.sortBy(_.getName)
+ assert(methods.forall(_.toGenericString.startsWith("public int")))
+}
diff --git a/test/files/run/t8188.scala b/test/files/run/t8188.scala
new file mode 100644
index 0000000000..ec3a968e4a
--- /dev/null
+++ b/test/files/run/t8188.scala
@@ -0,0 +1,25 @@
+object Test {
+ def main(args: Array[String]) {
+ import java.io.ByteArrayInputStream
+ import java.io.ByteArrayOutputStream
+ import java.io.ObjectInputStream
+ import java.io.ObjectOutputStream
+ import scala.collection.concurrent.TrieMap
+
+ def ser[T](o: T): Array[Byte] = {
+ val baos = new ByteArrayOutputStream()
+ new ObjectOutputStream(baos).writeObject(o)
+ baos.toByteArray()
+ }
+
+ def deser[T](bs: Array[Byte]): T =
+ new ObjectInputStream(new ByteArrayInputStream(bs)).readObject().asInstanceOf[T]
+
+ def cloneViaSerialization[T](t: T): T = deser(ser(t))
+
+ val f = cloneViaSerialization(_: TrieMap[Int, Int])
+ val tm = TrieMap(1 -> 2)
+ assert( f(f(tm)) == tm )
+ assert( ser(tm).length == ser(f(tm)).length )
+ }
+}
diff --git a/test/files/run/t8190.check b/test/files/run/t8190.check
new file mode 100644
index 0000000000..d117bf3294
--- /dev/null
+++ b/test/files/run/t8190.check
@@ -0,0 +1,91 @@
+Annotation
+Constant
+Mirror
+Name
+TermName
+TypeName
+Position
+Scope
+MemberScope
+Symbol
+TermSymbol
+TypeSymbol
+MethodSymbol
+ModuleSymbol
+ClassSymbol
+FreeTermSymbol
+FreeTypeSymbol
+Type
+SingletonType
+ThisType
+SingleType
+SuperType
+ConstantType
+TypeRef
+CompoundType
+RefinedType
+ClassInfoType
+MethodType
+NullaryMethodType
+PolyType
+ExistentialType
+AnnotatedType
+TypeBounds
+BoundedWildcardType
+Tree
+TermTree
+TypTree
+SymTree
+NameTree
+RefTree
+DefTree
+MemberDef
+PackageDef
+ImplDef
+ClassDef
+ModuleDef
+ValOrDefDef
+ValDef
+DefDef
+TypeDef
+LabelDef
+ImportSelector
+Import
+Template
+Block
+CaseDef
+Alternative
+Star
+Bind
+UnApply
+Function
+Assign
+AssignOrNamedArg
+If
+Match
+Return
+Try
+Throw
+New
+Typed
+GenericApply
+TypeApply
+Apply
+Super
+This
+Select
+Ident
+ReferenceToBoxed
+Literal
+Annotated
+SingletonTypeTree
+SelectFromTypeTree
+CompoundTypeTree
+AppliedTypeTree
+TypeBoundsTree
+ExistentialTypeTree
+TypeTree
+Modifiers
+TreeCopier
+checking exhaustiveness in scala.reflect.api.Universe...
+uncovered type members: List()
diff --git a/test/files/run/t8190.scala b/test/files/run/t8190.scala
new file mode 100644
index 0000000000..17ff83c714
--- /dev/null
+++ b/test/files/run/t8190.scala
@@ -0,0 +1,210 @@
+import scala.reflect.runtime.universe._
+
+trait Overloads {
+ // makes sure noone erases to Any or AnyRef
+ def test(x: AnyRef) = "AnyRef"
+ def test(x: Annotation) = "Annotation"
+ def test(x: Constant) = "Constant"
+ def test(x: Mirror) = "Mirror"
+ def test(x: Name) = "Name"
+ def test(x: TermName) = "TermName"
+ def test(x: TypeName) = "TypeName"
+ def test(x: Position) = "Position"
+ def test(x: Scope) = "Scope"
+ def test(x: MemberScope) = "MemberScope"
+ def test(x: Symbol) = "Symbol"
+ def test(x: TermSymbol) = "TermSymbol"
+ def test(x: TypeSymbol) = "TypeSymbol"
+ def test(x: MethodSymbol) = "MethodSymbol"
+ def test(x: ModuleSymbol) = "ModuleSymbol"
+ def test(x: ClassSymbol) = "ClassSymbol"
+ def test(x: FreeTermSymbol) = "FreeTermSymbol"
+ def test(x: FreeTypeSymbol) = "FreeTypeSymbol"
+ def test(x: Type) = "Type"
+ def test(x: SingletonType) = "SingletonType"
+ def test(x: ThisType) = "ThisType"
+ def test(x: SingleType) = "SingleType"
+ def test(x: SuperType) = "SuperType"
+ def test(x: ConstantType) = "ConstantType"
+ def test(x: TypeRef) = "TypeRef"
+ def test(x: CompoundType) = "CompoundType"
+ def test(x: RefinedType) = "RefinedType"
+ def test(x: ClassInfoType) = "ClassInfoType"
+ def test(x: MethodType) = "MethodType"
+ def test(x: NullaryMethodType) = "NullaryMethodType"
+ def test(x: PolyType) = "PolyType"
+ def test(x: ExistentialType) = "ExistentialType"
+ def test(x: AnnotatedType) = "AnnotatedType"
+ def test(x: TypeBounds) = "TypeBounds"
+ def test(x: BoundedWildcardType) = "BoundedWildcardType"
+ def test(x: Tree) = "Tree"
+ def test(x: TermTree) = "TermTree"
+ def test(x: TypTree) = "TypTree"
+ def test(x: SymTree) = "SymTree"
+ def test(x: NameTree) = "NameTree"
+ def test(x: RefTree) = "RefTree"
+ def test(x: DefTree) = "DefTree"
+ def test(x: MemberDef) = "MemberDef"
+ def test(x: PackageDef) = "PackageDef"
+ def test(x: ImplDef) = "ImplDef"
+ def test(x: ClassDef) = "ClassDef"
+ def test(x: ModuleDef) = "ModuleDef"
+ def test(x: ValOrDefDef) = "ValOrDefDef"
+ def test(x: ValDef) = "ValDef"
+ def test(x: DefDef) = "DefDef"
+ def test(x: TypeDef) = "TypeDef"
+ def test(x: LabelDef) = "LabelDef"
+ def test(x: ImportSelector) = "ImportSelector"
+ def test(x: Import) = "Import"
+ def test(x: Template) = "Template"
+ def test(x: Block) = "Block"
+ def test(x: CaseDef) = "CaseDef"
+ def test(x: Alternative) = "Alternative"
+ def test(x: Star) = "Star"
+ def test(x: Bind) = "Bind"
+ def test(x: UnApply) = "UnApply"
+ def test(x: Function) = "Function"
+ def test(x: Assign) = "Assign"
+ def test(x: AssignOrNamedArg) = "AssignOrNamedArg"
+ def test(x: If) = "If"
+ def test(x: Match) = "Match"
+ def test(x: Return) = "Return"
+ def test(x: Try) = "Try"
+ def test(x: Throw) = "Throw"
+ def test(x: New) = "New"
+ def test(x: Typed) = "Typed"
+ def test(x: GenericApply) = "GenericApply"
+ def test(x: TypeApply) = "TypeApply"
+ def test(x: Apply) = "Apply"
+ def test(x: Super) = "Super"
+ def test(x: This) = "This"
+ def test(x: Select) = "Select"
+ def test(x: Ident) = "Ident"
+ def test(x: ReferenceToBoxed) = "ReferenceToBoxed"
+ def test(x: Literal) = "Literal"
+ def test(x: Annotated) = "Annotated"
+ def test(x: SingletonTypeTree) = "SingletonTypeTree"
+ def test(x: SelectFromTypeTree) = "SelectFromTypeTree"
+ def test(x: CompoundTypeTree) = "CompoundTypeTree"
+ def test(x: AppliedTypeTree) = "AppliedTypeTree"
+ def test(x: TypeBoundsTree) = "TypeBoundsTree"
+ def test(x: ExistentialTypeTree) = "ExistentialTypeTree"
+ def test(x: TypeTree) = "TypeTree"
+ def test(x: Modifiers) = "Modifiers"
+ def test(x: TreeCopier) = "TreeCopier"
+}
+
+object Test extends App with Overloads {
+ val buf = scala.collection.mutable.ListBuffer[String]()
+ def record(result: String): Unit = {
+ println(result)
+ buf += result
+ }
+ def check(): Unit = {
+ println("checking exhaustiveness in scala.reflect.api.Universe...")
+ var types = typeOf[scala.reflect.api.Universe].members.filter(sym => sym.isType && !sym.isClass).map(_.name.toString)
+ types = types.filter(_ != "ModifiersCreator") // type ModifiersCreator = ModifiersExtractor
+ types = types.filter(_ != "FlagSet") // type FlagSet
+ types = types.filter(_ != "RuntimeClass") // type RuntimeClass = java.lang.Class[_]
+ types = types.filter(_ != "JavaArgument") // deprecated
+ types = types.filter(_ != "LiteralArgument") // deprecated
+ types = types.filter(_ != "ArrayArgument") // deprecated
+ types = types.filter(_ != "NestedArgument") // deprecated
+ types = types.filter(_ != "Importer") // deprecated
+ types = types.filter(_ != "Internal") // internal
+ types = types.filter(_ != "Compat") // internal
+ types = types.filter(_ != "BuildApi") // deprecated
+ val diff = types.toList diff buf.toList
+ println("uncovered type members: " + diff)
+ }
+ record(test(null: Annotation))
+ record(test(null: Constant))
+ record(test(null: Mirror))
+ record(test(null: Name))
+ record(test(null: TermName))
+ record(test(null: TypeName))
+ record(test(null: Position))
+ record(test(null: Scope))
+ record(test(null: MemberScope))
+ record(test(null: Symbol))
+ record(test(null: TermSymbol))
+ record(test(null: TypeSymbol))
+ record(test(null: MethodSymbol))
+ record(test(null: ModuleSymbol))
+ record(test(null: ClassSymbol))
+ record(test(null: FreeTermSymbol))
+ record(test(null: FreeTypeSymbol))
+ record(test(null: Type))
+ record(test(null: SingletonType))
+ record(test(null: ThisType))
+ record(test(null: SingleType))
+ record(test(null: SuperType))
+ record(test(null: ConstantType))
+ record(test(null: TypeRef))
+ record(test(null: CompoundType))
+ record(test(null: RefinedType))
+ record(test(null: ClassInfoType))
+ record(test(null: MethodType))
+ record(test(null: NullaryMethodType))
+ record(test(null: PolyType))
+ record(test(null: ExistentialType))
+ record(test(null: AnnotatedType))
+ record(test(null: TypeBounds))
+ record(test(null: BoundedWildcardType))
+ record(test(null: Tree))
+ record(test(null: TermTree))
+ record(test(null: TypTree))
+ record(test(null: SymTree))
+ record(test(null: NameTree))
+ record(test(null: RefTree))
+ record(test(null: DefTree))
+ record(test(null: MemberDef))
+ record(test(null: PackageDef))
+ record(test(null: ImplDef))
+ record(test(null: ClassDef))
+ record(test(null: ModuleDef))
+ record(test(null: ValOrDefDef))
+ record(test(null: ValDef))
+ record(test(null: DefDef))
+ record(test(null: TypeDef))
+ record(test(null: LabelDef))
+ record(test(null: ImportSelector))
+ record(test(null: Import))
+ record(test(null: Template))
+ record(test(null: Block))
+ record(test(null: CaseDef))
+ record(test(null: Alternative))
+ record(test(null: Star))
+ record(test(null: Bind))
+ record(test(null: UnApply))
+ record(test(null: Function))
+ record(test(null: Assign))
+ record(test(null: AssignOrNamedArg))
+ record(test(null: If))
+ record(test(null: Match))
+ record(test(null: Return))
+ record(test(null: Try))
+ record(test(null: Throw))
+ record(test(null: New))
+ record(test(null: Typed))
+ record(test(null: GenericApply))
+ record(test(null: TypeApply))
+ record(test(null: Apply))
+ record(test(null: Super))
+ record(test(null: This))
+ record(test(null: Select))
+ record(test(null: Ident))
+ record(test(null: ReferenceToBoxed))
+ record(test(null: Literal))
+ record(test(null: Annotated))
+ record(test(null: SingletonTypeTree))
+ record(test(null: SelectFromTypeTree))
+ record(test(null: CompoundTypeTree))
+ record(test(null: AppliedTypeTree))
+ record(test(null: TypeBoundsTree))
+ record(test(null: ExistentialTypeTree))
+ record(test(null: TypeTree))
+ record(test(null: Modifiers))
+ record(test(null: TreeCopier))
+ check()
+} \ No newline at end of file
diff --git a/test/files/run/t8192.check b/test/files/run/t8192.check
new file mode 100644
index 0000000000..2423a7acbf
--- /dev/null
+++ b/test/files/run/t8192.check
@@ -0,0 +1,32 @@
+compile-time
+package scala
+primary constructor: NoSymbol
+object List
+primary constructor: def <init>(): scala.collection.immutable.List.type => true
+def <init>(): scala.collection.immutable.List.type => true
+trait Product1
+primary constructor: def $init$(): Unit => true
+class UninitializedFieldError
+primary constructor: def <init>(msg: String): UninitializedFieldError => true
+def <init>(msg: String): UninitializedFieldError => true
+def <init>(obj: Any): UninitializedFieldError => false
+class C
+primary constructor: def <init>(x: Int): C => true
+def <init>(x: Int): C => true
+def <init>(x: String): C => false
+runtime
+package scala
+primary constructor: NoSymbol
+object List
+primary constructor: def <init>(): scala.collection.immutable.List.type => true
+def <init>(): scala.collection.immutable.List.type => true
+trait Product1
+primary constructor: def $init$(): Unit => true
+class UninitializedFieldError
+primary constructor: def <init>(msg: String): UninitializedFieldError => true
+def <init>(msg: String): UninitializedFieldError => true
+def <init>(obj: Any): UninitializedFieldError => false
+class C
+primary constructor: def <init>(x: Int): C => true
+def <init>(x: Int): C => true
+def <init>(x: String): C => false
diff --git a/test/files/run/t8192/Macros_1.scala b/test/files/run/t8192/Macros_1.scala
new file mode 100644
index 0000000000..72fb2cf313
--- /dev/null
+++ b/test/files/run/t8192/Macros_1.scala
@@ -0,0 +1,45 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+import java.io._
+
+object Macros {
+ def impl(c: Context) = {
+ var messages = List[String]()
+ def println(msg: String) = messages :+= msg
+
+ import c.universe._
+ def test(sym: ClassSymbol): Unit = {
+ def fullyInitializeSymbol(sym: Symbol): Unit = {
+ val internal = c.universe.asInstanceOf[scala.reflect.internal.SymbolTable]
+ internal.definitions.fullyInitializeSymbol(sym.asInstanceOf[internal.Symbol])
+ }
+ def defString(sym: Symbol): String = {
+ val internal = c.universe.asInstanceOf[scala.reflect.internal.SymbolTable]
+ sym.asInstanceOf[internal.Symbol].defString
+ }
+ def showCtor(sym: Symbol): String = {
+ fullyInitializeSymbol(sym)
+ if (sym == NoSymbol) "NoSymbol"
+ else s"${defString(sym)} => ${sym.asMethod.isPrimaryConstructor}"
+ }
+ sym.info
+ println(sym.toString)
+ println(s"primary constructor: ${showCtor(sym.primaryConstructor)}")
+ val ctors = sym.info.members.filter(_.name == termNames.CONSTRUCTOR).map(sym => showCtor(sym))
+ ctors.toList.sorted.foreach(println)
+ }
+
+ println("compile-time")
+ // SI-8367 primaryConstructor for Java-defined classes is unstable, so I'm commenting this out
+ // test(typeOf[File].typeSymbol.asClass)
+ test(definitions.ScalaPackageClass)
+ test(definitions.ListModule.moduleClass.asClass)
+ test(typeOf[Product1[_]].typeSymbol.asClass)
+ test(typeOf[UninitializedFieldError].typeSymbol.asClass)
+ test(c.mirror.staticClass("C").asClass)
+
+ q"..${messages.map(msg => q"println($msg)")}"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/t8192/Test_2.scala b/test/files/run/t8192/Test_2.scala
new file mode 100644
index 0000000000..89302083ad
--- /dev/null
+++ b/test/files/run/t8192/Test_2.scala
@@ -0,0 +1,40 @@
+import java.io._
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+
+class C(x: Int) {
+ def this(x: String) = this(x.toInt)
+}
+
+object Test extends App {
+ def test(sym: ClassSymbol): Unit = {
+ def fullyInitializeSymbol(sym: Symbol): Unit = {
+ val internal = ru.asInstanceOf[scala.reflect.internal.SymbolTable]
+ internal.definitions.fullyInitializeSymbol(sym.asInstanceOf[internal.Symbol])
+ }
+ def defString(sym: Symbol): String = {
+ val internal = ru.asInstanceOf[scala.reflect.internal.SymbolTable]
+ sym.asInstanceOf[internal.Symbol].defString
+ }
+ def showCtor(sym: Symbol): String = {
+ fullyInitializeSymbol(sym)
+ if (sym == NoSymbol) "NoSymbol"
+ else s"${defString(sym)} => ${sym.asMethod.isPrimaryConstructor}"
+ }
+ sym.info
+ println(sym.toString)
+ println(s"primary constructor: ${showCtor(sym.primaryConstructor)}")
+ val ctors = sym.info.members.filter(_.name == termNames.CONSTRUCTOR).map(sym => showCtor(sym))
+ ctors.toList.sorted.foreach(println)
+ }
+
+ Macros.foo
+ println("runtime")
+ // SI-8367 primaryConstructor for Java-defined classes is unstable, so I'm commenting this out
+ // test(typeOf[File].typeSymbol.asClass)
+ test(definitions.ScalaPackageClass)
+ test(definitions.ListModule.moduleClass.asClass)
+ test(typeOf[Product1[_]].typeSymbol.asClass)
+ test(typeOf[UninitializedFieldError].typeSymbol.asClass)
+ test(typeOf[C].typeSymbol.asClass)
+}
diff --git a/test/files/run/t8196.check b/test/files/run/t8196.check
index 3286c15c91..b32f42cf07 100644
--- a/test/files/run/t8196.check
+++ b/test/files/run/t8196.check
@@ -1,3 +1,7 @@
+t8196.scala:26: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ form2.g1 // comment this line in order to make the test pass
+ ^
+warning: there were 2 feature warning(s); re-run with -feature for details
Scope{
final private val f1: Int
}
diff --git a/test/files/run/t8197.scala b/test/files/run/t8197.scala
new file mode 100644
index 0000000000..910a3ebc83
--- /dev/null
+++ b/test/files/run/t8197.scala
@@ -0,0 +1,16 @@
+// SI-8197, see also SI-4592 and SI-4728
+class A
+class B
+
+class Foo(val x: A = null) {
+ def this(bla: B*) {
+ this(new A)
+ }
+}
+
+object Test extends App {
+ // both constructors of `Foo` are applicable. Overloading resolution
+ // will eliminate the alternative that uses a default argument, therefore
+ // the vararg constructor is chosen.
+ assert((new Foo).x != null)
+}
diff --git a/test/files/run/t8197b.scala b/test/files/run/t8197b.scala
new file mode 100644
index 0000000000..8b3e0af0db
--- /dev/null
+++ b/test/files/run/t8197b.scala
@@ -0,0 +1,8 @@
+object O {
+ def foo[T](t: T) = 0
+ def foo(s: String)(implicit i: DummyImplicit = null) = 1
+}
+
+object Test extends App {
+ assert(O.foo("") == 1)
+}
diff --git a/test/files/run/t8199.scala b/test/files/run/t8199.scala
new file mode 100644
index 0000000000..50994159ed
--- /dev/null
+++ b/test/files/run/t8199.scala
@@ -0,0 +1,105 @@
+class reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname {
+object obj0
+object obj01
+object obj012
+object obj0123
+object obj01234
+object obj012345
+object obj0123456
+object obj01234567
+object obj012345678
+object obj0123456789
+object obj01234567890
+class cls0
+class cls01
+class cls012
+class cls0123
+class cls01234
+class cls012345
+class cls0123456
+class cls01234567
+class cls012345678
+class cls0123456789
+class cls01234567890
+trait trt0 { def x = Test.checkCallerImplClassName() }
+trait trt01 { def x = Test.checkCallerImplClassName() }
+trait trt012 { def x = Test.checkCallerImplClassName() }
+trait trt0123 { def x = Test.checkCallerImplClassName() }
+trait trt01234 { def x = Test.checkCallerImplClassName() }
+trait trt012345 { def x = Test.checkCallerImplClassName() }
+trait trt0123456 { def x = Test.checkCallerImplClassName() }
+trait trt01234567 { def x = Test.checkCallerImplClassName() }
+trait trt012345678 { def x = Test.checkCallerImplClassName() }
+trait trt0123456789 { def x = Test.checkCallerImplClassName() }
+trait trt01234567890 { def x = Test.checkCallerImplClassName() }
+}
+
+object Test extends App {
+ def check(c: Class[_]) {
+ checkClassName(c.getName)
+ }
+ def checkClassName(name: String) {
+ val defaultMaxClassFileLength = 255
+ assert((name + ".class").length <= defaultMaxClassFileLength, name)
+ }
+ def checkCallerImplClassName() {
+ val name = Thread.currentThread.getStackTrace.apply(2).getClassName
+ assert(name.contains("$class"))
+ Test.checkClassName(name)
+ }
+
+ val c = new reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname
+ import c._
+
+ check(obj0.getClass)
+ check(obj01.getClass)
+ check(obj012.getClass)
+ check(obj0123.getClass)
+ check(obj01234.getClass)
+ check(obj012345.getClass)
+ check(obj0123456.getClass)
+ check(obj01234567.getClass)
+ check(obj012345678.getClass)
+ check(obj0123456789.getClass)
+ check(obj01234567890.getClass)
+
+ check(classOf[cls0])
+ check(classOf[cls01])
+ check(classOf[cls012])
+ check(classOf[cls0123])
+ check(classOf[cls01234])
+ check(classOf[cls012345])
+ check(classOf[cls0123456])
+ check(classOf[cls01234567])
+ check(classOf[cls012345678])
+ check(classOf[cls0123456789])
+ check(classOf[cls01234567890])
+
+ // interface facets
+ check(classOf[trt0])
+ check(classOf[trt01])
+ check(classOf[trt012])
+ check(classOf[trt0123])
+ check(classOf[trt01234])
+ check(classOf[trt012345])
+ check(classOf[trt0123456])
+ check(classOf[trt01234567])
+ check(classOf[trt012345678])
+ check(classOf[trt0123456789])
+ check(classOf[trt01234567890])
+
+ // impl classes are harder to find the names of to test!
+ (new trt0 {}).x
+ (new trt01 {}).x
+ (new trt012 {}).x
+ (new trt0123 {}).x
+ (new trt01234 {}).x
+ (new trt012345 {}).x
+ (new trt0123456 {}).x
+ (new trt01234567 {}).x
+ (new trt012345678 {}).x
+ (new trt0123456789 {}).x
+ (new trt01234567890 {}).x
+}
+
+// filename too long: reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname$obj012345$.class
diff --git a/test/files/run/t8233-bcode.flags b/test/files/run/t8233-bcode.flags
new file mode 100644
index 0000000000..c30091d3de
--- /dev/null
+++ b/test/files/run/t8233-bcode.flags
@@ -0,0 +1 @@
+-Ybackend:GenBCode
diff --git a/test/files/run/t8233-bcode.scala b/test/files/run/t8233-bcode.scala
new file mode 100644
index 0000000000..72d013e553
--- /dev/null
+++ b/test/files/run/t8233-bcode.scala
@@ -0,0 +1,31 @@
+object Test {
+ def bar(s: String) = s;
+ val o: Option[Null] = None
+ def nullReference {
+ val a: Null = o.get
+ bar(a) // Was: VerifyError under GenICode
+ }
+
+ def literal {
+ val a: Null = null
+ bar(a)
+ }
+
+ /** Check SI-8330 for details */
+ def expectedUnitInABranch(b: Boolean): Boolean = {
+ if (b) {
+ val x = 12
+ ()
+ } else {
+ // here expected type is (unboxed) Unit
+ null
+ }
+ true
+ }
+
+ def main(args: Array[String]): Unit = {
+ try { nullReference } catch { case _: NoSuchElementException => }
+ literal
+ expectedUnitInABranch(true)
+ }
+}
diff --git a/test/files/run/t8233.scala b/test/files/run/t8233.scala
new file mode 100644
index 0000000000..97a98a2e21
--- /dev/null
+++ b/test/files/run/t8233.scala
@@ -0,0 +1,31 @@
+object Test {
+ def bar(s: String) = s;
+ val o: Option[Null] = None
+ def nullReference {
+ val a: Null = o.get
+ bar(a) // Was: VerifyError under GenICode
+ }
+
+ def literal {
+ val a: Null = null
+ bar(a)
+ }
+
+ /** Check SI-8330 for details */
+ def expectedUnitInABranch(b: Boolean): Boolean = {
+ if (b) {
+ val x = 12
+ ()
+ } else {
+ // here expected type is (unboxed) Unit
+ null
+ }
+ true
+ }
+
+ def main(args: Array[String]): Unit = {
+ try { nullReference } catch { case _: NoSuchElementException => }
+ literal
+ expectedUnitInABranch(true) // Was: VerifyError under GenICode
+ }
+}
diff --git a/test/files/run/t8245.scala b/test/files/run/t8245.scala
new file mode 100644
index 0000000000..d44defbb9e
--- /dev/null
+++ b/test/files/run/t8245.scala
@@ -0,0 +1,14 @@
+object Test {
+ def foo(o: Option[Int]): Int = {
+ lazy val i: Int = {
+ def local: Int = {if ("".isEmpty) return 42; -42}
+ assert(local == 42)
+ o.getOrElse(return -1)
+ }
+ i + 1
+ }
+
+ def main(args: Array[String]) {
+ assert(foo(None) == -1)
+ }
+}
diff --git a/test/files/run/t8266-octal-interp.check b/test/files/run/t8266-octal-interp.check
new file mode 100644
index 0000000000..66ecafddc2
--- /dev/null
+++ b/test/files/run/t8266-octal-interp.check
@@ -0,0 +1,30 @@
+t8266-octal-interp.scala:4: warning: Octal escape literals are deprecated, use \b instead.
+ f"a\10c",
+ ^
+t8266-octal-interp.scala:5: warning: Octal escape literals are deprecated, use \t instead.
+ f"a\11c",
+ ^
+t8266-octal-interp.scala:6: warning: Octal escape literals are deprecated, use \n instead.
+ f"a\12c",
+ ^
+t8266-octal-interp.scala:7: warning: Octal escape literals are deprecated, use \r instead.
+ f"a\15c",
+ ^
+t8266-octal-interp.scala:8: warning: Octal escape literals are deprecated, use ${'"'} or a triple-quoted literal """with embedded " or \u0022""" instead.
+ f"a\42c",
+ ^
+t8266-octal-interp.scala:9: warning: Octal escape literals are deprecated, use \\ instead.
+ f"a\134c",
+ ^
+t8266-octal-interp.scala:10: warning: Octal escape literals are deprecated, use \u0069 instead.
+ f"a\15151515c"
+ ^
+ac
+a c
+a
+c
+a
+c
+a"c
+a\c
+ai51515c
diff --git a/test/files/run/t8266-octal-interp.flags b/test/files/run/t8266-octal-interp.flags
new file mode 100644
index 0000000000..dcc59ebe32
--- /dev/null
+++ b/test/files/run/t8266-octal-interp.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/test/files/run/t8266-octal-interp.scala b/test/files/run/t8266-octal-interp.scala
new file mode 100644
index 0000000000..f85ae0367d
--- /dev/null
+++ b/test/files/run/t8266-octal-interp.scala
@@ -0,0 +1,16 @@
+
+trait X {
+ def f = Seq(
+ f"a\10c",
+ f"a\11c",
+ f"a\12c",
+ f"a\15c",
+ f"a\42c",
+ f"a\134c",
+ f"a\15151515c"
+ )
+}
+
+object Test extends App with X {
+ f foreach println
+}
diff --git a/test/files/run/t8280.check b/test/files/run/t8280.check
new file mode 100644
index 0000000000..ed392841c7
--- /dev/null
+++ b/test/files/run/t8280.check
@@ -0,0 +1,9 @@
+Int
+Int
+Int
+Int
+Int
+Int
+Int
+Int
+Int
diff --git a/test/files/run/t8280.scala b/test/files/run/t8280.scala
new file mode 100644
index 0000000000..0734d63b6e
--- /dev/null
+++ b/test/files/run/t8280.scala
@@ -0,0 +1,82 @@
+import scala.language.implicitConversions
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ Moop1.ob1
+ Moop1.ob2
+ Moop1.ob3
+ Moop2.ob1
+ Moop2.ob2
+ Moop2.ob3
+ Moop3.ob1
+ Moop3.ob2
+ Moop3.ob3
+ }
+}
+
+// int object vs.
+object Moop1 {
+ object ob1 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
+// int def vs.
+object Moop2 {
+ object ob1 {
+ implicit def f1(x: Int): String = "Int"
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit def f1(x: Int): String = "Int"
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit def f1(x: Int): String = "Int"
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
+// int val vs.
+object Moop3 {
+ object ob1 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
diff --git a/test/files/run/t8321.check b/test/files/run/t8321.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/files/run/t8321.check
@@ -0,0 +1 @@
+2
diff --git a/test/files/run/t8321/Macros_1.scala b/test/files/run/t8321/Macros_1.scala
new file mode 100644
index 0000000000..70e44fc761
--- /dev/null
+++ b/test/files/run/t8321/Macros_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Bundle(val c: Context) {
+ import c.universe._
+ def impl = q"new { val x = 2 }"
+}
+
+object Macros {
+ def foo: Any = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/run/t8321/Test_2.scala b/test/files/run/t8321/Test_2.scala
new file mode 100644
index 0000000000..82ec32384e
--- /dev/null
+++ b/test/files/run/t8321/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ println(Macros.foo.x)
+} \ No newline at end of file
diff --git a/test/files/run/t8346.check b/test/files/run/t8346.check
new file mode 100644
index 0000000000..1ba5c31abe
--- /dev/null
+++ b/test/files/run/t8346.check
@@ -0,0 +1,6 @@
+BitSet: List(invariant, invariant, invariant, invariant)
+HashSet: List(covariant (true), covariant (true), covariant (true), covariant (true))
+ListSet: List(covariant (true), covariant (true), covariant (true), covariant (true))
+SortedSet: List(invariant, invariant, invariant, invariant)
+TreeSet: List(invariant, invariant, invariant, invariant)
+ValueSet: invariant
diff --git a/test/files/run/t8346.scala b/test/files/run/t8346.scala
new file mode 100644
index 0000000000..5f3df84174
--- /dev/null
+++ b/test/files/run/t8346.scala
@@ -0,0 +1,34 @@
+object Test extends App {
+ import reflect.ClassTag
+
+ object SomeEnum extends Enumeration {
+ val one, two, three, four = Value
+ }
+
+ def sctor[A <: Set[Int]](f: Int => A)(implicit A: ClassTag[A])
+ : (String, Int => Set[Int]) =
+ (A.runtimeClass.getSimpleName, f)
+
+ val inits: Seq[(String, Int => Set[Int])] = {
+ import collection.immutable.{Seq => _, _}
+ Seq(sctor(BitSet(_)),
+ sctor(HashSet(_)),
+ sctor(ListSet(_)),
+ sctor(SortedSet(_)),
+ sctor(TreeSet(_)))
+ }
+
+ def sVarInfo[A](sa: Set[A]): String = {
+ val saa = sa.toSet[Any]
+ if (sa eq saa) s"""covariant (${(saa + "hi") contains "hi"})"""
+ else "invariant"
+ }
+
+ inits foreach {case (name, singleton) =>
+ print(s"${name}: ")
+ val one = singleton(1)
+ println(Seq(2,3,4).scanLeft(one)(_ + _) map sVarInfo toList)
+ }
+
+ println(s"ValueSet: ${sVarInfo(SomeEnum.values)}")
+}
diff --git a/test/files/run/t8395.scala b/test/files/run/t8395.scala
new file mode 100644
index 0000000000..2570550619
--- /dev/null
+++ b/test/files/run/t8395.scala
@@ -0,0 +1,9 @@
+ object Test {
+ def baz(x: Object) = {
+ val s @ (_s: String) = x
+ x
+ }
+ def main(args: Array[String]) {
+ assert(baz("1") == "1")
+ }
+}
diff --git a/test/files/run/t8425.check b/test/files/run/t8425.check
new file mode 100644
index 0000000000..8379fa0a74
--- /dev/null
+++ b/test/files/run/t8425.check
@@ -0,0 +1 @@
+List(fresh$macro$1, $macro$2)
diff --git a/test/files/run/t8425/Macros_1.scala b/test/files/run/t8425/Macros_1.scala
new file mode 100644
index 0000000000..71a96518e8
--- /dev/null
+++ b/test/files/run/t8425/Macros_1.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def foo: Unit = macro impl
+ def impl(c: Context) = {
+ import c.universe._
+ val test1 = c.freshName()
+ val test2 = c.freshName("$")
+ q"println(List($test1, $test2))"
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent-c/Test_2.scala b/test/files/run/t8425/Test_2.scala
index 7dffc5107d..acfddae942 100644
--- a/test/files/run/macro-def-path-dependent-c/Test_2.scala
+++ b/test/files/run/t8425/Test_2.scala
@@ -1,3 +1,3 @@
object Test extends App {
- println("it works")
+ Macros.foo
} \ No newline at end of file
diff --git a/test/files/run/t8428.scala b/test/files/run/t8428.scala
new file mode 100644
index 0000000000..7da1207b7b
--- /dev/null
+++ b/test/files/run/t8428.scala
@@ -0,0 +1,12 @@
+object Test extends App {
+ val xs = List.tabulate(4)(List(_))
+ val i = xs.map(_.iterator).reduce { (a,b) =>
+ a.hasNext
+ a ++ b
+ }
+
+ val r1 = i.toList
+ val r2 = xs.flatten.toList
+
+ assert(r1 == r2, r1)
+}
diff --git a/test/files/run/t8437.check b/test/files/run/t8437.check
new file mode 100644
index 0000000000..fd3c81a4d7
--- /dev/null
+++ b/test/files/run/t8437.check
@@ -0,0 +1,2 @@
+5
+5
diff --git a/test/files/run/t8437/Macros_1.scala b/test/files/run/t8437/Macros_1.scala
new file mode 100644
index 0000000000..6286ea2a8c
--- /dev/null
+++ b/test/files/run/t8437/Macros_1.scala
@@ -0,0 +1,18 @@
+import scala.language.experimental.macros
+import scala.reflect.macros._
+
+abstract class AbstractBundle(val c: blackbox.Context) {
+ import c.Expr
+ import c.universe._
+ def foo: Expr[Int] = Expr[Int](q"5")
+}
+
+class ConcreteBundle(override val c: blackbox.Context) extends AbstractBundle(c) {
+ import c.Expr
+ val bar: Expr[Int] = foo
+}
+
+object InvokeBundle {
+ def foo: Int = macro ConcreteBundle.foo // nope
+ def bar: Int = macro ConcreteBundle.bar // yep
+} \ No newline at end of file
diff --git a/test/files/run/t8437/Test_2.scala b/test/files/run/t8437/Test_2.scala
new file mode 100644
index 0000000000..47bb84ad0e
--- /dev/null
+++ b/test/files/run/t8437/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ println(InvokeBundle.foo)
+ println(InvokeBundle.bar)
+} \ No newline at end of file
diff --git a/test/files/run/t8549.check b/test/files/run/t8549.check
new file mode 100644
index 0000000000..a92ddc0e51
--- /dev/null
+++ b/test/files/run/t8549.check
@@ -0,0 +1 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t8549.scala b/test/files/run/t8549.scala
new file mode 100644
index 0000000000..d3355208fa
--- /dev/null
+++ b/test/files/run/t8549.scala
@@ -0,0 +1,186 @@
+import javax.xml.bind.DatatypeConverter._
+import scala.reflect.io.File
+
+// This test is self-modifying when run as follows:
+//
+// (export V=v2.10.4
+// scalac-hash $V test/files/run/t8549.scala
+// scala-hash $V -Doverwrite.source=test/files/run/t8549.scala Test
+// )
+//
+// Use this to re-establish a baseline for serialization compatibility.
+object Test extends App {
+ val overwrite: Option[File] = sys.props.get("overwrite.source").map(s => new File(new java.io.File(s)))
+
+ def serialize(o: AnyRef): String = {
+ val bos = new java.io.ByteArrayOutputStream()
+ val out = new java.io.ObjectOutputStream(bos)
+ out.writeObject(o)
+ out.flush()
+ printBase64Binary(bos.toByteArray())
+ }
+
+ def amend(file: File)(f: String => String) {
+ file.writeAll(f(file.slurp))
+ }
+ def quote(s: String) = List("\"", s, "\"").mkString
+
+ def patch(file: File, line: Int, prevResult: String, result: String) {
+ amend(file) {
+ content =>
+ content.lines.toList.zipWithIndex.map {
+ case (content, i) if i == line - 1 =>
+ val newContent = content.replaceAllLiterally(quote(prevResult), quote(result))
+ if (newContent != content)
+ println(s"- $content\n+ $newContent\n")
+ newContent
+ case (content, _) => content
+ }.mkString("\n")
+ }
+ }
+
+ def updateComment(file: File) {
+ val timestamp = {
+ import java.text.SimpleDateFormat
+ val sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss")
+ sdf.format(new java.util.Date)
+ }
+ val newComment = s" // Generated on $timestamp with Scala ${scala.util.Properties.versionString})"
+ amend(file) {
+ content =>
+ content.lines.toList.map {
+ f => f.replaceAll("""^ +// Generated on.*""", newComment)
+ }.mkString("\n")
+ }
+ }
+
+ def deserialize(string: String): AnyRef = {
+ val bis = new java.io.ByteArrayInputStream(parseBase64Binary(string))
+ val in = new java.io.ObjectInputStream(bis)
+ in.readObject()
+ }
+
+ def checkRoundTrip[T <: AnyRef](instance: T)(f: T => AnyRef) {
+ val result = serialize(instance)
+ val reconstituted = deserialize(result).asInstanceOf[T]
+ assert(f(instance) == f(reconstituted), (f(instance), f(reconstituted)))
+ }
+
+ def check[T <: AnyRef](instance: => T)(prevResult: String, f: T => AnyRef = (x: T) => x) {
+ val result = serialize(instance)
+ overwrite match {
+ case Some(f) =>
+ val lineNumberOfLiteralString = Thread.currentThread.getStackTrace.apply(2).getLineNumber
+ patch(f, lineNumberOfLiteralString, prevResult, result)
+ case None =>
+ checkRoundTrip(instance)(f)
+ assert(f(deserialize(prevResult).asInstanceOf[T]) == f(instance), s"$instance != f(deserialize(prevResult))")
+ assert(prevResult == result, s"instance = $instance : ${instance.getClass}\n serialization unstable: ${prevResult}\n found: ${result}")
+ }
+ }
+
+ // Generated on 20140505-14:47:14 with Scala version 2.11.1-20140505-142300-e8562571d2)
+ overwrite.foreach(updateComment)
+
+ check(List(1, 2, 3))( "rO0ABXNyADJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAABAwAAeHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADc3IALHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3RTZXJpYWxpemVFbmQkilxjW/dTC20CAAB4cHg=")
+ check(Nil)( "rO0ABXNyADJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAABAwAAeHBzcgAsc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuTGlzdFNlcmlhbGl6ZUVuZCSKXGNb91MLbQIAAHhweA==")
+
+ // TODO SI-8576 unstable under -Xcheckinit
+ // check(Vector(1))( "rO0ABXNyACFzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5WZWN0b3Lkd3dcHq6PXAIAC0kABWRlcHRoWgAFZGlydHlJAAhlbmRJbmRleEkABWZvY3VzSQAKc3RhcnRJbmRleFsACGRpc3BsYXkwdAATW0xqYXZhL2xhbmcvT2JqZWN0O1sACGRpc3BsYXkxcQB+AAFbAAhkaXNwbGF5MnEAfgABWwAIZGlzcGxheTNxAH4AAVsACGRpc3BsYXk0cQB+AAFbAAhkaXNwbGF5NXEAfgABeHAAAAABAAAAAAEAAAAAAAAAAHVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAACBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcA==")
+ // check(Vector())( "rO0ABXNyACFzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5WZWN0b3Lkd3dcHq6PXAIAC0kABWRlcHRoWgAFZGlydHlJAAhlbmRJbmRleEkABWZvY3VzSQAKc3RhcnRJbmRleFsACGRpc3BsYXkwdAATW0xqYXZhL2xhbmcvT2JqZWN0O1sACGRpc3BsYXkxcQB+AAFbAAhkaXNwbGF5MnEAfgABWwAIZGlzcGxheTNxAH4AAVsACGRpc3BsYXk0cQB+AAFbAAhkaXNwbGF5NXEAfgABeHAAAAAAAAAAAAAAAAAAAAAAAHBwcHBwcA==")
+
+ import collection.{ mutable, immutable }
+
+ class C
+ check(reflect.classTag[C])("rO0ABXNyAB5zY2FsYS5yZWZsZWN0LkNsYXNzVGFnJCRhbm9uJDG7ePPrmQBkhgIAAUwAD3J1bnRpbWVDbGFzczEkMXQAEUxqYXZhL2xhbmcvQ2xhc3M7eHB2cgAGVGVzdCRDAAAAAAAAAAAAAAB4cA==")
+ check(reflect.classTag[Int])("rO0ABXNyACVzY2FsYS5yZWZsZWN0Lk1hbmlmZXN0RmFjdG9yeSQkYW5vbiQ5zfmiSVNjtVICAAB4cgAcc2NhbGEucmVmbGVjdC5BbnlWYWxNYW5pZmVzdAAAAAAAAAABAgABTAAIdG9TdHJpbmd0ABJMamF2YS9sYW5nL1N0cmluZzt4cHQAA0ludA==")
+ check(reflect.classTag[String])("rO0ABXNyAB5zY2FsYS5yZWZsZWN0LkNsYXNzVGFnJCRhbm9uJDG7ePPrmQBkhgIAAUwAD3J1bnRpbWVDbGFzczEkMXQAEUxqYXZhL2xhbmcvQ2xhc3M7eHB2cgAQamF2YS5sYW5nLlN0cmluZ6DwpDh6O7NCAgAAeHA=")
+ check(reflect.classTag[Object])("rO0ABXNyACVzY2FsYS5yZWZsZWN0Lk1hbmlmZXN0RmFjdG9yeSQkYW5vbiQymPrtq/Ci1gsCAAB4cgAtc2NhbGEucmVmbGVjdC5NYW5pZmVzdEZhY3RvcnkkUGhhbnRvbU1hbmlmZXN0rzigP7KRh/kCAAFMAAh0b1N0cmluZ3QAEkxqYXZhL2xhbmcvU3RyaW5nO3hyAC9zY2FsYS5yZWZsZWN0Lk1hbmlmZXN0RmFjdG9yeSRDbGFzc1R5cGVNYW5pZmVzdFq6NWvfTgYFAgADTAAGcHJlZml4dAAOTHNjYWxhL09wdGlvbjtMAAxydW50aW1lQ2xhc3N0ABFMamF2YS9sYW5nL0NsYXNzO0wADXR5cGVBcmd1bWVudHN0ACFMc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvTGlzdDt4cHNyAAtzY2FsYS5Ob25lJEZQJPZTypSsAgAAeHIADHNjYWxhLk9wdGlvbv5pN/3bDmZ0AgAAeHB2cgAQamF2YS5sYW5nLk9iamVjdAAAAAAAAAAAAAAAeHBzcgAyc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuTGlzdCRTZXJpYWxpemF0aW9uUHJveHkAAAAAAAAAAQMAAHhwc3IALHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3RTZXJpYWxpemVFbmQkilxjW/dTC20CAAB4cHh0AAZPYmplY3Q=")
+
+ // TODO SI-8576 unstable under -Xcheckinit
+ // check(Enum)( "rO0ABXNyAApUZXN0JEVudW0ketCIyQ8C23MCAAJMAAJWMXQAGUxzY2FsYS9FbnVtZXJhdGlvbiRWYWx1ZTtMAAJWMnQAF0xzY2FsYS9FbnVtZXJhdGlvbiRWYWw7eHIAEXNjYWxhLkVudW1lcmF0aW9udaDN3ZgOWY4CAAhJAAZuZXh0SWRJABtzY2FsYSRFbnVtZXJhdGlvbiQkYm90dG9tSWRJABhzY2FsYSRFbnVtZXJhdGlvbiQkdG9wSWRMABRWYWx1ZU9yZGVyaW5nJG1vZHVsZXQAIkxzY2FsYS9FbnVtZXJhdGlvbiRWYWx1ZU9yZGVyaW5nJDtMAA9WYWx1ZVNldCRtb2R1bGV0AB1Mc2NhbGEvRW51bWVyYXRpb24kVmFsdWVTZXQkO0wACG5leHROYW1ldAAbTHNjYWxhL2NvbGxlY3Rpb24vSXRlcmF0b3I7TAAXc2NhbGEkRW51bWVyYXRpb24kJG5tYXB0AB5Mc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL01hcDtMABdzY2FsYSRFbnVtZXJhdGlvbiQkdm1hcHEAfgAHeHAAAAArAAAAAAAAACtwcHBzcgAgc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLkhhc2hNYXAAAAAAAAAAAQMAAHhwdw0AAALuAAAAAAAAAAQAeHNxAH4ACXcNAAAC7gAAAAEAAAAEAHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAAqc3IAFXNjYWxhLkVudW1lcmF0aW9uJFZhbM9pZ6/J/O1PAgACSQAYc2NhbGEkRW51bWVyYXRpb24kVmFsJCRpTAAEbmFtZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hyABdzY2FsYS5FbnVtZXJhdGlvbiRWYWx1ZWJpfC/tIR1RAgACTAAGJG91dGVydAATTHNjYWxhL0VudW1lcmF0aW9uO0wAHHNjYWxhJEVudW1lcmF0aW9uJCRvdXRlckVudW1xAH4AEnhwcQB+AAhxAH4ACAAAACpweHNyABFUZXN0JEVudW0kJGFub24kMVlIjlmE1sXaAgAAeHEAfgARcQB+AAhxAH4ACHEAfgAT")
+ // check(Enum.V1)( "rO0ABXNyABFUZXN0JEVudW0kJGFub24kMVlIjlmE1sXaAgAAeHIAF3NjYWxhLkVudW1lcmF0aW9uJFZhbHVlYml8L+0hHVECAAJMAAYkb3V0ZXJ0ABNMc2NhbGEvRW51bWVyYXRpb247TAAcc2NhbGEkRW51bWVyYXRpb24kJG91dGVyRW51bXEAfgACeHBzcgAKVGVzdCRFbnVtJHrQiMkPAttzAgACTAACVjF0ABlMc2NhbGEvRW51bWVyYXRpb24kVmFsdWU7TAACVjJ0ABdMc2NhbGEvRW51bWVyYXRpb24kVmFsO3hyABFzY2FsYS5FbnVtZXJhdGlvbnWgzd2YDlmOAgAISQAGbmV4dElkSQAbc2NhbGEkRW51bWVyYXRpb24kJGJvdHRvbUlkSQAYc2NhbGEkRW51bWVyYXRpb24kJHRvcElkTAAUVmFsdWVPcmRlcmluZyRtb2R1bGV0ACJMc2NhbGEvRW51bWVyYXRpb24kVmFsdWVPcmRlcmluZyQ7TAAPVmFsdWVTZXQkbW9kdWxldAAdTHNjYWxhL0VudW1lcmF0aW9uJFZhbHVlU2V0JDtMAAhuZXh0TmFtZXQAG0xzY2FsYS9jb2xsZWN0aW9uL0l0ZXJhdG9yO0wAF3NjYWxhJEVudW1lcmF0aW9uJCRubWFwdAAeTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9NYXA7TAAXc2NhbGEkRW51bWVyYXRpb24kJHZtYXBxAH4AC3hwAAAAKwAAAAAAAAArcHBwc3IAIHNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5IYXNoTWFwAAAAAAAAAAEDAAB4cHcNAAAC7gAAAAAAAAAEAHhzcQB+AA13DQAAAu4AAAABAAAABABzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAKnNyABVzY2FsYS5FbnVtZXJhdGlvbiRWYWzPaWevyfztTwIAAkkAGHNjYWxhJEVudW1lcmF0aW9uJFZhbCQkaUwABG5hbWV0ABJMamF2YS9sYW5nL1N0cmluZzt4cQB+AAFxAH4ADHEAfgAMAAAAKnB4cQB+AANxAH4AFXEAfgAM")
+ // check(Enum.V2)( "rO0ABXNyABVzY2FsYS5FbnVtZXJhdGlvbiRWYWzPaWevyfztTwIAAkkAGHNjYWxhJEVudW1lcmF0aW9uJFZhbCQkaUwABG5hbWV0ABJMamF2YS9sYW5nL1N0cmluZzt4cgAXc2NhbGEuRW51bWVyYXRpb24kVmFsdWViaXwv7SEdUQIAAkwABiRvdXRlcnQAE0xzY2FsYS9FbnVtZXJhdGlvbjtMABxzY2FsYSRFbnVtZXJhdGlvbiQkb3V0ZXJFbnVtcQB+AAN4cHNyAApUZXN0JEVudW0ketCIyQ8C23MCAAJMAAJWMXQAGUxzY2FsYS9FbnVtZXJhdGlvbiRWYWx1ZTtMAAJWMnQAF0xzY2FsYS9FbnVtZXJhdGlvbiRWYWw7eHIAEXNjYWxhLkVudW1lcmF0aW9udaDN3ZgOWY4CAAhJAAZuZXh0SWRJABtzY2FsYSRFbnVtZXJhdGlvbiQkYm90dG9tSWRJABhzY2FsYSRFbnVtZXJhdGlvbiQkdG9wSWRMABRWYWx1ZU9yZGVyaW5nJG1vZHVsZXQAIkxzY2FsYS9FbnVtZXJhdGlvbiRWYWx1ZU9yZGVyaW5nJDtMAA9WYWx1ZVNldCRtb2R1bGV0AB1Mc2NhbGEvRW51bWVyYXRpb24kVmFsdWVTZXQkO0wACG5leHROYW1ldAAbTHNjYWxhL2NvbGxlY3Rpb24vSXRlcmF0b3I7TAAXc2NhbGEkRW51bWVyYXRpb24kJG5tYXB0AB5Mc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL01hcDtMABdzY2FsYSRFbnVtZXJhdGlvbiQkdm1hcHEAfgAMeHAAAAArAAAAAAAAACtwcHBzcgAgc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLkhhc2hNYXAAAAAAAAAAAQMAAHhwdw0AAALuAAAAAAAAAAQAeHNxAH4ADncNAAAC7gAAAAEAAAAEAHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAAqcQB+AAR4c3IAEVRlc3QkRW51bSQkYW5vbiQxWUiOWYTWxdoCAAB4cQB+AAJxAH4ADXEAfgANcQB+AARxAH4ADQAAACpw")
+
+ // IndexedSeqLike#Elements
+ // TODO SI-8576 throws scala.UnitializedFieldError under -Xcheckinit
+ // check(new immutable.Range(0, 1, 1).iterator)("rO0ABXNyAChzY2FsYS5jb2xsZWN0aW9uLkluZGV4ZWRTZXFMaWtlJEVsZW1lbnRzGF+1cBwmcx0CAANJAANlbmRJAAVpbmRleEwABiRvdXRlcnQAIUxzY2FsYS9jb2xsZWN0aW9uL0luZGV4ZWRTZXFMaWtlO3hwAAAAAQAAAABzcgAgc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuUmFuZ2Vpu6NUqxUyDQIAB0kAA2VuZFoAB2lzRW1wdHlJAAtsYXN0RWxlbWVudEkAEG51bVJhbmdlRWxlbWVudHNJAAVzdGFydEkABHN0ZXBJAA90ZXJtaW5hbEVsZW1lbnR4cAAAAAEAAAAAAAAAAAEAAAAAAAAAAQAAAAE="
+ // , _.toList)
+
+ // check(new collection.concurrent.TrieMap[Any, Any]())( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmNvbmN1cnJlbnQuVHJpZU1hcKckxpgOIYHPAwAETAALZXF1YWxpdHlvYmp0ABJMc2NhbGEvbWF0aC9FcXVpdjtMAApoYXNoaW5nb2JqdAAcTHNjYWxhL3V0aWwvaGFzaGluZy9IYXNoaW5nO0wABHJvb3R0ABJMamF2YS9sYW5nL09iamVjdDtMAAtyb290dXBkYXRlcnQAOUxqYXZhL3V0aWwvY29uY3VycmVudC9hdG9taWMvQXRvbWljUmVmZXJlbmNlRmllbGRVcGRhdGVyO3hwc3IAMnNjYWxhLmNvbGxlY3Rpb24uY29uY3VycmVudC5UcmllTWFwJE1hbmdsZWRIYXNoaW5nhTBoJQ/mgb0CAAB4cHNyABhzY2FsYS5tYXRoLkVxdWl2JCRhbm9uJDLBbyx4dy/qGwIAAHhwc3IANHNjYWxhLmNvbGxlY3Rpb24uY29uY3VycmVudC5UcmllTWFwU2VyaWFsaXphdGlvbkVuZCSbjdgbbGCt2gIAAHhweA==")
+ // not sure why this one needs stable serialization.
+
+ // TODO SI-8576 unstable under -Xcheckinit
+ check(collection.convert.Wrappers)( "rO0ABXNyACJzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkrrSziizavIECABJMABhEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADZMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJERpY3Rpb25hcnlXcmFwcGVyJDtMABZJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA0THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRJdGVyYWJsZVdyYXBwZXIkO0wAFkl0ZXJhdG9yV3JhcHBlciRtb2R1bGV0ADRMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEl0ZXJhdG9yV3JhcHBlciQ7TAAZSkNvbGxlY3Rpb25XcmFwcGVyJG1vZHVsZXQAN0xzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkNvbGxlY3Rpb25XcmFwcGVyJDtMABxKQ29uY3VycmVudE1hcFdyYXBwZXIkbW9kdWxldAA6THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKQ29uY3VycmVudE1hcFdyYXBwZXIkO0wAGUpEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADdMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpEaWN0aW9uYXJ5V3JhcHBlciQ7TAAaSkVudW1lcmF0aW9uV3JhcHBlciRtb2R1bGV0ADhMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpFbnVtZXJhdGlvbldyYXBwZXIkO0wAF0pJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKSXRlcmFibGVXcmFwcGVyJDtMABdKSXRlcmF0b3JXcmFwcGVyJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkl0ZXJhdG9yV3JhcHBlciQ7TAATSkxpc3RXcmFwcGVyJG1vZHVsZXQAMUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkxpc3RXcmFwcGVyJDtMABJKTWFwV3JhcHBlciRtb2R1bGV0ADBMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpNYXBXcmFwcGVyJDtMABlKUHJvcGVydGllc1dyYXBwZXIkbW9kdWxldAA3THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKUHJvcGVydGllc1dyYXBwZXIkO0wAEkpTZXRXcmFwcGVyJG1vZHVsZXQAMExzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSlNldFdyYXBwZXIkO0wAG011dGFibGVCdWZmZXJXcmFwcGVyJG1vZHVsZXQAOUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZUJ1ZmZlcldyYXBwZXIkO0wAGE11dGFibGVNYXBXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZU1hcFdyYXBwZXIkO0wAGE11dGFibGVTZXFXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNlcVdyYXBwZXIkO0wAGE11dGFibGVTZXRXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNldFdyYXBwZXIkO0wAEVNlcVdyYXBwZXIkbW9kdWxldAAvTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRTZXFXcmFwcGVyJDt4cHBwcHBwcHBwcHBwcHBwcHBwcA==")
+
+ check(immutable.BitSet(1, 2, 3))( "rO0ABXNyAClzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5CaXRTZXQkQml0U2V0MR9dg8JGRI8UAgABSgAFZWxlbXN4cgAhc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuQml0U2V0Flz5Ms3qxsoCAAB4cAAAAAAAAAAO")
+ check(immutable.HashMap())( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoTWFwJFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAB4")
+ check(immutable.HashMap(1 -> 2))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoTWFwJFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAFzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJ4")
+ check(immutable.HashMap(1 -> 2, 3 -> 4))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoTWFwJFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAJzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADc3EAfgACAAAABHg=")
+ // TODO provoke HashMapCollision1
+
+ check(immutable.HashSet())( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAB4")
+ check(immutable.HashSet(1))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAFzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXg=")
+ check(immutable.HashSet(1, 2))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAJzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJ4")
+ check(immutable.HashSet(1, 2, 3))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADeA==")
+ // TODO provoke HashSetCollision1
+
+ check(immutable.ListMap())( "rO0ABXNyADBzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0TWFwJEVtcHR5TGlzdE1hcCSNalsvpBZeDgIAAHhyACJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0TWFwBC1gfIkUSKsCAAB4cA==")
+ check(immutable.ListMap(1 -> 2))( "rO0ABXNyACdzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0TWFwJE5vZGWmciM1Yav+8gIAA0wABiRvdXRlcnQAJExzY2FsYS9jb2xsZWN0aW9uL2ltbXV0YWJsZS9MaXN0TWFwO0wAA2tleXQAEkxqYXZhL2xhbmcvT2JqZWN0O0wABXZhbHVlcQB+AAJ4cgAic2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuTGlzdE1hcAQtYHyJFEirAgAAeHBzcgAwc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuTGlzdE1hcCRFbXB0eUxpc3RNYXAkjWpbL6QWXg4CAAB4cQB+AANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABwAAAAI=")
+ check(immutable.Queue())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5RdWV1ZZY146W3qSuhAgACTAACaW50ACFMc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvTGlzdDtMAANvdXRxAH4AAXhwc3IAMnNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3QkU2VyaWFsaXphdGlvblByb3h5AAAAAAAAAAEDAAB4cHNyACxzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0U2VyaWFsaXplRW5kJIpcY1v3UwttAgAAeHB4cQB+AAQ=")
+ check(immutable.Queue(1, 2, 3))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5RdWV1ZZY146W3qSuhAgACTAACaW50ACFMc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvTGlzdDtMAANvdXRxAH4AAXhwc3IAMnNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3QkU2VyaWFsaXphdGlvblByb3h5AAAAAAAAAAEDAAB4cHNyACxzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0U2VyaWFsaXplRW5kJIpcY1v3UwttAgAAeHB4c3EAfgADc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+AAgAAAACc3EAfgAIAAAAA3EAfgAGeA==")
+
+ // TODO SI-8576 throws scala.UnitializedFieldError under -Xcheckinit
+ // check(new immutable.Range(0, 1, 1))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5SYW5nZWm7o1SrFTINAgAHSQADZW5kWgAHaXNFbXB0eUkAC2xhc3RFbGVtZW50SQAQbnVtUmFuZ2VFbGVtZW50c0kABXN0YXJ0SQAEc3RlcEkAD3Rlcm1pbmFsRWxlbWVudHhwAAAAAQAAAAAAAAAAAQAAAAAAAAABAAAAAQ==")
+
+ check(immutable.Set())( "rO0ABXNyAChzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkRW1wdHlTZXQk8Hk3TFN0uDYCAAB4cA==")
+ check(immutable.Set(1))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0MREd3c4yqtWTAgABTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDt4cHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAAB")
+ check(immutable.Set(1, 2))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0MqaV02sZQzV0AgACTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgABeHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAwAAAAI=")
+ check(immutable.Set(1, 2, 3))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0M84syT0560SgAgADTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgABTAAFZWxlbTNxAH4AAXhwc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+AAMAAAACc3EAfgADAAAAAw==")
+ check(immutable.Set(1, 2, 3, 4))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0NM26psRRbei1AgAETAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgABTAAFZWxlbTNxAH4AAUwABWVsZW00cQB+AAF4cHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABc3EAfgADAAAAAnNxAH4AAwAAAANzcQB+AAMAAAAE")
+ check(immutable.Set(1, 2, 3, 4, 5))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAVzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAABXNxAH4AAgAAAAFzcQB+AAIAAAACc3EAfgACAAAAA3NxAH4AAgAAAAR4")
+
+ check(immutable.Stack(1, 2, 3))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TdGFjaxtt3qEbMvq+AgABTAAFZWxlbXN0ACFMc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvTGlzdDt4cHNyADJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAABAwAAeHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABQAAAAJzcQB+AAUAAAADc3IALHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3RTZXJpYWxpemVFbmQkilxjW/dTC20CAAB4cHg=")
+
+ // TODO SI-8576 Uninitialized field: IndexedSeqLike.scala: 56
+ // check(immutable.Stream(1, 2, 3))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TdHJlYW0kQ29uc/ekjBXM3TlFAgADTAACaGR0ABJMamF2YS9sYW5nL09iamVjdDtMAAV0bEdlbnQAEUxzY2FsYS9GdW5jdGlvbjA7TAAFdGxWYWx0ACNMc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvU3RyZWFtO3hyACFzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TdHJlYW0552RDntM42gIAAHhwc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcgAtc2NhbGEuY29sbGVjdGlvbi5JdGVyYXRvciQkYW5vbmZ1biR0b1N0cmVhbSQxRWR4We0SX0UCAAFMAAYkb3V0ZXJ0ABtMc2NhbGEvY29sbGVjdGlvbi9JdGVyYXRvcjt4cHNyAChzY2FsYS5jb2xsZWN0aW9uLkluZGV4ZWRTZXFMaWtlJEVsZW1lbnRzGF+1cBwmcx0CAANJAANlbmRJAAVpbmRleEwABiRvdXRlcnQAIUxzY2FsYS9jb2xsZWN0aW9uL0luZGV4ZWRTZXFMaWtlO3hwAAAAAwAAAAFzcgArc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLldyYXBwZWRBcnJheSRvZkludMmRLBcI15VjAgABWwAFYXJyYXl0AAJbSXhwdXIAAltJTbpgJnbqsqUCAAB4cAAAAAMAAAABAAAAAgAAAANw")
+
+ check(immutable.TreeSet[Int]())( "rO0ABXNyACJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5UcmVlU2V0sRdVIDjbWAsCAAJMAAhvcmRlcmluZ3QAFUxzY2FsYS9tYXRoL09yZGVyaW5nO0wABHRyZWV0AC5Mc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQkC4BMdr1Z51wCAAB4cHA=")
+
+ // TODO SI-8576 unstable under -Xcheckinit
+ // check(immutable.TreeSet(1, 2, 3))( "rO0ABXNyACJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5UcmVlU2V0sRdVIDjbWAsCAAJMAAhvcmRlcmluZ3QAFUxzY2FsYS9tYXRoL09yZGVyaW5nO0wABHRyZWV0AC5Mc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQkC4BMdr1Z51wCAAB4cHNyADFzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5SZWRCbGFja1RyZWUkQmxhY2tUcmVlzRxnCKenVAECAAB4cgAsc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWVrqCSyHJbsMgIABUkABWNvdW50TAADa2V5dAASTGphdmEvbGFuZy9PYmplY3Q7TAAEbGVmdHEAfgACTAAFcmlnaHRxAH4AAkwABXZhbHVlcQB+AAh4cAAAAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAnNxAH4ABgAAAAFzcQB+AAoAAAABcHBzcgAXc2NhbGEucnVudGltZS5Cb3hlZFVuaXR0pn1HHezLmgIAAHhwc3EAfgAGAAAAAXNxAH4ACgAAAANwcHEAfgAQcQB+ABA=")
+
+ // TODO SI-8576 Uninitialized field under -Xcheckinit
+ // check(mutable.ArrayBuffer(1, 2, 3))( "rO0ABXNyACRzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuQXJyYXlCdWZmZXIVOLBTg4KOcwIAA0kAC2luaXRpYWxTaXplSQAFc2l6ZTBbAAVhcnJheXQAE1tMamF2YS9sYW5nL09iamVjdDt4cAAAABAAAAADdXIAE1tMamF2YS5sYW5nLk9iamVjdDuQzlifEHMpbAIAAHhwAAAAEHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABc3EAfgAFAAAAAnNxAH4ABQAAAANwcHBwcHBwcHBwcHBw")
+ // TODO SI-8576 Uninitialized field under -Xcheckinit
+ // check(mutable.ArraySeq(1, 2, 3))( "rO0ABXNyACFzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuQXJyYXlTZXEVPD3SKEkOcwIAAkkABmxlbmd0aFsABWFycmF5dAATW0xqYXZhL2xhbmcvT2JqZWN0O3hwAAAAA3VyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABQAAAAJzcQB+AAUAAAAD")
+ check(mutable.ArrayStack(1, 2, 3))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuQXJyYXlTdGFja3bdxXbcnLBeAgACSQAqc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJEFycmF5U3RhY2skJGluZGV4WwAqc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJEFycmF5U3RhY2skJHRhYmxldAATW0xqYXZhL2xhbmcvT2JqZWN0O3hwAAAAA3VyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAA3NxAH4ABQAAAAJzcQB+AAUAAAAB")
+ check(mutable.DoubleLinkedList(1, 2, 3))( "rO0ABXNyAClzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuRG91YmxlTGlua2VkTGlzdI73LKsKRr1RAgADTAAEZWxlbXQAEkxqYXZhL2xhbmcvT2JqZWN0O0wABG5leHR0AB5Mc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL1NlcTtMAARwcmV2cQB+AAJ4cHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABc3EAfgAAc3EAfgAEAAAAAnNxAH4AAHNxAH4ABAAAAANzcQB+AABwcQB+AAtxAH4ACXEAfgAHcQB+AANw")
+
+ check(mutable.HashMap())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAAAAAAABAB4")
+ check(mutable.HashMap(1 -> 1))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAABAAAABABzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXEAfgAEeA==")
+ check(mutable.HashSet(1, 2, 3))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaFNldAAAAAAAAAABAwAAeHB3DQAAAcIAAAADAAAABQBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADeA==")
+ // TODO SI-8576 Uninitialized field under -Xcheckinit
+ // check(new mutable.History())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGlzdG9yeUhuXxDIFJrsAgACSQAKbWF4SGlzdG9yeUwAA2xvZ3QAIExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUXVldWU7eHAAAAPoc3IAHnNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5RdWV1ZbjMURVfOuHHAgAAeHIAJHNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5NdXRhYmxlTGlzdFJpnjJ+gFbAAgADSQADbGVuTAAGZmlyc3QwdAAlTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9MaW5rZWRMaXN0O0wABWxhc3QwcQB+AAV4cAAAAABzcgAjc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLkxpbmtlZExpc3Sak+nGCZHaUQIAAkwABGVsZW10ABJMamF2YS9sYW5nL09iamVjdDtMAARuZXh0dAAeTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9TZXE7eHBwcQB+AApxAH4ACg==")
+ check(mutable.LinkedHashMap(1 -> 2))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuTGlua2VkSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAABAAAABABzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJ4")
+ check(mutable.LinkedHashSet(1, 2, 3))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuTGlua2VkSGFzaFNldAAAAAAAAAABAwAAeHB3DQAAAu4AAAADAAAABABzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADeA==")
+ check(mutable.LinkedList(1, 2, 3))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuTGlua2VkTGlzdJqT6cYJkdpRAgACTAAEZWxlbXQAEkxqYXZhL2xhbmcvT2JqZWN0O0wABG5leHR0AB5Mc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL1NlcTt4cHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABc3EAfgAAc3EAfgAEAAAAAnNxAH4AAHNxAH4ABAAAAANzcQB+AABwcQB+AAs=")
+
+ // TODO SI-8576 unstable under -Xcheckinit
+ // check(mutable.ListBuffer(1, 2, 3))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuTGlzdEJ1ZmZlci9y9I7QyWzGAwAEWgAIZXhwb3J0ZWRJAANsZW5MAAVsYXN0MHQAKUxzY2FsYS9jb2xsZWN0aW9uL2ltbXV0YWJsZS8kY29sb24kY29sb247TAAqc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJExpc3RCdWZmZXIkJHN0YXJ0dAAhTHNjYWxhL2NvbGxlY3Rpb24vaW1tdXRhYmxlL0xpc3Q7eHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABAAAAAJzcQB+AAQAAAADc3IALHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3RTZXJpYWxpemVFbmQkilxjW/dTC20CAAB4cHcFAAAAAAN4")
+ check(new mutable.StringBuilder(new java.lang.StringBuilder("123")))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuU3RyaW5nQnVpbGRlcomvqgGv1tTxAgABTAAKdW5kZXJseWluZ3QAGUxqYXZhL2xhbmcvU3RyaW5nQnVpbGRlcjt4cHNyABdqYXZhLmxhbmcuU3RyaW5nQnVpbGRlcjzV+xRaTGrLAwAAeHB3BAAAAAN1cgACW0OwJmaw4l2ErAIAAHhwAAAAEwAxADIAMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeA==")
+ check(mutable.UnrolledBuffer[Int]())( "rO0ABXNyACdzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVW5yb2xsZWRCdWZmZXIAAAAAAAAAAQMAAUwAA3RhZ3QAGExzY2FsYS9yZWZsZWN0L0NsYXNzVGFnO3hwc3IAJXNjYWxhLnJlZmxlY3QuTWFuaWZlc3RGYWN0b3J5JCRhbm9uJDnN+aJJU2O1UgIAAHhyABxzY2FsYS5yZWZsZWN0LkFueVZhbE1hbmlmZXN0AAAAAAAAAAECAAFMAAh0b1N0cmluZ3QAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAADSW50dwQAAAAAeA==")
+
+ import collection.parallel
+ check(parallel.immutable.ParHashMap(1 -> 2))( "rO0ABXNyAC5zY2FsYS5jb2xsZWN0aW9uLnBhcmFsbGVsLmltbXV0YWJsZS5QYXJIYXNoTWFwAAAAAAAAAAECAANMAA9TY2FuTGVhZiRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2NhbkxlYWYkO0wAD1NjYW5Ob2RlJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL3BhcmFsbGVsL1Bhckl0ZXJhYmxlTGlrZSRTY2FuTm9kZSQ7TAAEdHJpZXQAJExzY2FsYS9jb2xsZWN0aW9uL2ltbXV0YWJsZS9IYXNoTWFwO3hwcHBzcgA1c2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuSGFzaE1hcCRTZXJpYWxpemF0aW9uUHJveHkAAAAAAAAAAgMAAHhwdwQAAAABc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+AAcAAAACeA==")
+ check(parallel.immutable.ParHashSet(1, 2, 3))( "rO0ABXNyAC5zY2FsYS5jb2xsZWN0aW9uLnBhcmFsbGVsLmltbXV0YWJsZS5QYXJIYXNoU2V0AAAAAAAAAAECAANMAA9TY2FuTGVhZiRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2NhbkxlYWYkO0wAD1NjYW5Ob2RlJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL3BhcmFsbGVsL1Bhckl0ZXJhYmxlTGlrZSRTY2FuTm9kZSQ7TAAEdHJpZXQAJExzY2FsYS9jb2xsZWN0aW9uL2ltbXV0YWJsZS9IYXNoU2V0O3hwcHBzcgA1c2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuSGFzaFNldCRTZXJpYWxpemF0aW9uUHJveHkAAAAAAAAAAgMAAHhwdwQAAAADc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+AAcAAAACc3EAfgAHAAAAA3g=")
+ // TODO SI-8576 Uninitialized field under -Xcheckinit
+ // check(new parallel.immutable.ParRange(new Range(0, 1, 2)))( "rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLnBhcmFsbGVsLmltbXV0YWJsZS5QYXJSYW5nZQAAAAAAAAABAgAETAAXUGFyUmFuZ2VJdGVyYXRvciRtb2R1bGV0AEBMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9pbW11dGFibGUvUGFyUmFuZ2UkUGFyUmFuZ2VJdGVyYXRvciQ7TAAPU2NhbkxlYWYkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vcGFyYWxsZWwvUGFySXRlcmFibGVMaWtlJFNjYW5MZWFmJDtMAA9TY2FuTm9kZSRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2Nhbk5vZGUkO0wABXJhbmdldAAiTHNjYWxhL2NvbGxlY3Rpb24vaW1tdXRhYmxlL1JhbmdlO3hwcHBwc3IAIHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLlJhbmdlabujVKsVMg0CAAdJAANlbmRaAAdpc0VtcHR5SQALbGFzdEVsZW1lbnRJABBudW1SYW5nZUVsZW1lbnRzSQAFc3RhcnRJAARzdGVwSQAPdGVybWluYWxFbGVtZW50eHAAAAABAAAAAAAAAAABAAAAAAAAAAIAAAAC")
+ // TODO SI-8576 unstable under -Xcheckinit
+ // check(parallel.mutable.ParArray(1, 2, 3))( "rO0ABXNyACpzY2FsYS5jb2xsZWN0aW9uLnBhcmFsbGVsLm11dGFibGUuUGFyQXJyYXkAAAAAAAAAAQMABEwAF1BhckFycmF5SXRlcmF0b3IkbW9kdWxldAA+THNjYWxhL2NvbGxlY3Rpb24vcGFyYWxsZWwvbXV0YWJsZS9QYXJBcnJheSRQYXJBcnJheUl0ZXJhdG9yJDtMAA9TY2FuTGVhZiRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2NhbkxlYWYkO0wAD1NjYW5Ob2RlJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL3BhcmFsbGVsL1Bhckl0ZXJhYmxlTGlrZSRTY2FuTm9kZSQ7TAAIYXJyYXlzZXF0ACNMc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL0FycmF5U2VxO3hwcHBwc3IAMXNjYWxhLmNvbGxlY3Rpb24ucGFyYWxsZWwubXV0YWJsZS5FeHBvc2VkQXJyYXlTZXGx2OTefAodSQIAAkkABmxlbmd0aFsABWFycmF5dAATW0xqYXZhL2xhbmcvT2JqZWN0O3hyACFzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuQXJyYXlTZXEVPD3SKEkOcwIAAkkABmxlbmd0aFsABWFycmF5cQB+AAd4cAAAAAN1cgATW0xqYXZhLmxhbmcuT2JqZWN0O5DOWJ8QcylsAgAAeHAAAAADcHBwAAAAA3VxAH4ACgAAABBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ADQAAAAJzcQB+AA0AAAADcHBwcHBwcHBwcHBwcHg=")
+ check(parallel.mutable.ParHashMap(1 -> 2))( "rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLnBhcmFsbGVsLm11dGFibGUuUGFySGFzaE1hcAAAAAAAAAABAwACTAAPU2NhbkxlYWYkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vcGFyYWxsZWwvUGFySXRlcmFibGVMaWtlJFNjYW5MZWFmJDtMAA9TY2FuTm9kZSRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2Nhbk5vZGUkO3hwcHB3DQAAAu4AAAABAAAABAFzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABAAAAAJ4")
+ check(parallel.mutable.ParHashSet(1, 2, 3))( "rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLnBhcmFsbGVsLm11dGFibGUuUGFySGFzaFNldAAAAAAAAAABAwACTAAPU2NhbkxlYWYkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vcGFyYWxsZWwvUGFySXRlcmFibGVMaWtlJFNjYW5MZWFmJDtMAA9TY2FuTm9kZSRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2Nhbk5vZGUkO3hwcHB3DQAAAcIAAAADAAAAGwFzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABAAAAAJzcQB+AAQAAAADeA==")
+
+ check("...".r)("rO0ABXNyABlzY2FsYS51dGlsLm1hdGNoaW5nLlJlZ2V44u3Vap7wIb8CAAJMAAdwYXR0ZXJudAAZTGphdmEvdXRpbC9yZWdleC9QYXR0ZXJuO0wAJXNjYWxhJHV0aWwkbWF0Y2hpbmckUmVnZXgkJGdyb3VwTmFtZXN0ABZMc2NhbGEvY29sbGVjdGlvbi9TZXE7eHBzcgAXamF2YS51dGlsLnJlZ2V4LlBhdHRlcm5GZ9VrbkkCDQIAAkkABWZsYWdzTAAHcGF0dGVybnQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwAAAAAHQAAy4uLnNyADJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAABAwAAeHBzcgAsc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuTGlzdFNlcmlhbGl6ZUVuZCSKXGNb91MLbQIAAHhweA==",
+ r => (r.toString))
+}
diff --git a/test/files/run/t8549b.scala b/test/files/run/t8549b.scala
new file mode 100644
index 0000000000..1e1bf2c0bc
--- /dev/null
+++ b/test/files/run/t8549b.scala
@@ -0,0 +1,16 @@
+
+@SerialVersionUID(42)
+class C
+
+@SerialVersionUID(43 - 1)
+class D
+
+
+object Test extends App {
+ def checkId(cls: Class[_]) {
+ val id = cls.getDeclaredField("serialVersionUID").get(null)
+ assert(id == 42, (cls, id))
+ }
+ checkId(classOf[C])
+ checkId(classOf[D])
+}
diff --git a/test/files/run/t8570.flags b/test/files/run/t8570.flags
new file mode 100644
index 0000000000..3d1ee4760a
--- /dev/null
+++ b/test/files/run/t8570.flags
@@ -0,0 +1 @@
+-Xcheckinit
diff --git a/test/files/run/t8570.scala b/test/files/run/t8570.scala
new file mode 100644
index 0000000000..bbe83e9080
--- /dev/null
+++ b/test/files/run/t8570.scala
@@ -0,0 +1,10 @@
+trait Trait40_1 {
+ val value37_2 = ()
+ def run = { value37_2 }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ (new Trait40_1 {}).run
+ }
+}
diff --git a/test/files/run/t8570a.check b/test/files/run/t8570a.check
new file mode 100644
index 0000000000..6a452c185a
--- /dev/null
+++ b/test/files/run/t8570a.check
@@ -0,0 +1 @@
+()
diff --git a/test/files/run/t8570a.flags b/test/files/run/t8570a.flags
new file mode 100644
index 0000000000..3d1ee4760a
--- /dev/null
+++ b/test/files/run/t8570a.flags
@@ -0,0 +1 @@
+-Xcheckinit
diff --git a/test/files/run/t8570a.scala b/test/files/run/t8570a.scala
new file mode 100644
index 0000000000..ef116e2a8a
--- /dev/null
+++ b/test/files/run/t8570a.scala
@@ -0,0 +1,14 @@
+trait Trait40_1 {
+ val value37_2 = ()
+ def run = { value37_2 }
+}
+
+trait T1 extends Trait40_1 {
+ override val value37_2 = ()
+}
+
+object Test {
+ def main(args: Array[String]) {
+ println((new T1 {}).run)
+ }
+}
diff --git a/test/files/run/t8574.scala b/test/files/run/t8574.scala
new file mode 100644
index 0000000000..8c23ada482
--- /dev/null
+++ b/test/files/run/t8574.scala
@@ -0,0 +1,27 @@
+import annotation._
+
+@SerialVersionUID(42) @strictfp class Foo[@specialized(Int) T] extends Serializable {
+ def foo(t: T) = t
+}
+
+object Test extends App {
+ def checkUID(cls: Class[_], expected: Long) = {
+ val actual = java.io.ObjectStreamClass.lookup(cls).getSerialVersionUID
+ assert(actual == expected, s"$actual != expected for ${cls}")
+ }
+ def checkStrictFp(cls: Class[_]) = {
+ import java.lang.reflect._
+ for (m <- cls.getDeclaredMethods) {
+ val isStrict = Modifier.isStrict(m.getModifiers)
+ assert(isStrict, cls)
+ }
+ }
+ def check(x: AnyRef) {
+ checkUID(x.getClass, 42)
+ checkStrictFp(x.getClass)
+ }
+
+ check(new Foo[String])
+ check(new Foo[Int])
+}
+
diff --git a/test/files/run/t8601-closure-elim.flags b/test/files/run/t8601-closure-elim.flags
new file mode 100644
index 0000000000..49d036a887
--- /dev/null
+++ b/test/files/run/t8601-closure-elim.flags
@@ -0,0 +1 @@
+-optimize
diff --git a/test/files/run/t8601-closure-elim.scala b/test/files/run/t8601-closure-elim.scala
new file mode 100644
index 0000000000..2c5b03af77
--- /dev/null
+++ b/test/files/run/t8601-closure-elim.scala
@@ -0,0 +1,26 @@
+import scala.tools.partest.BytecodeTest
+import scala.tools.asm
+import scala.tools.asm.util._
+import scala.collection.JavaConverters._
+
+object Test extends BytecodeTest {
+ val nullChecks = Set(asm.Opcodes.NEW)
+
+ def show: Unit = {
+ def test(methodName: String) {
+ val classNode = loadClassNode("Foo")
+ val methodNode = getMethod(classNode, "b")
+ val ops = methodNode.instructions.iterator.asScala.map(_.getOpcode).toList
+ assert(!ops.contains(asm.Opcodes.NEW), ops)// should be allocation free if the closure is eliminiated
+ }
+ test("b")
+ }
+}
+
+class Foo {
+ @inline final def a(x: Int => Int) = x(1)
+ final def b {
+ val delta = 0
+ a(x => delta + 1)
+ }
+}
diff --git a/test/files/run/t8601.flags b/test/files/run/t8601.flags
new file mode 100644
index 0000000000..1182725e86
--- /dev/null
+++ b/test/files/run/t8601.flags
@@ -0,0 +1 @@
+-optimize \ No newline at end of file
diff --git a/test/files/run/t8601.scala b/test/files/run/t8601.scala
new file mode 100644
index 0000000000..e1afc23cc4
--- /dev/null
+++ b/test/files/run/t8601.scala
@@ -0,0 +1,15 @@
+object Test {
+ def idiv(x: Int): Unit = x / 0
+ def ldiv(x: Long): Unit = x / 0
+ def irem(x: Int): Unit = x % 0
+ def lrem(x: Long): Unit = x % 0
+
+ def check(x: => Any) = try { x; sys.error("failed to throw divide by zero!") } catch { case _: ArithmeticException => }
+
+ def main(args: Array[String]) {
+ check(idiv(1))
+ check(ldiv(1L))
+ check(irem(1))
+ check(lrem(1L))
+ }
+}
diff --git a/test/files/run/t8601b.flags b/test/files/run/t8601b.flags
new file mode 100644
index 0000000000..1182725e86
--- /dev/null
+++ b/test/files/run/t8601b.flags
@@ -0,0 +1 @@
+-optimize \ No newline at end of file
diff --git a/test/files/run/t8601b.scala b/test/files/run/t8601b.scala
new file mode 100644
index 0000000000..9c37ce33d6
--- /dev/null
+++ b/test/files/run/t8601b.scala
@@ -0,0 +1,14 @@
+object Test {
+ def len(x: Array[String]): Unit = x.length
+ def load(x: Array[String]): Unit = x(0)
+ def newarray(i: Int): Unit = new Array[Int](i)
+
+ def check(x: => Any) = try { x; sys.error("failed to throw NPE!") } catch { case _: NullPointerException => }
+ def checkNegSize(x: => Any) = try { x; sys.error("failed to throw NegativeArraySizeException!") } catch { case _: NegativeArraySizeException => }
+
+ def main(args: Array[String]) {
+ check(len(null)) // bug: did not NPE
+ check(load(null))
+ checkNegSize(newarray(-1))
+ }
+}
diff --git a/test/files/run/t8601c.flags b/test/files/run/t8601c.flags
new file mode 100644
index 0000000000..1182725e86
--- /dev/null
+++ b/test/files/run/t8601c.flags
@@ -0,0 +1 @@
+-optimize \ No newline at end of file
diff --git a/test/files/run/t8601c.scala b/test/files/run/t8601c.scala
new file mode 100644
index 0000000000..c487d6825e
--- /dev/null
+++ b/test/files/run/t8601c.scala
@@ -0,0 +1,12 @@
+object Test {
+ def loadField(x: scala.runtime.IntRef): Unit = x.elem
+ def storeField(x: scala.runtime.IntRef): Unit = x.elem = 42
+
+ def check(x: => Any) = try { x; sys.error("failed to throw NPE!") } catch { case _: NullPointerException => }
+
+ def main(args: Array[String]) {
+ check(loadField(null)) // bug: did not NPE under -Ydead-code
+ check(storeField(null))
+
+ }
+}
diff --git a/test/files/run/t8601d.flags b/test/files/run/t8601d.flags
new file mode 100644
index 0000000000..1182725e86
--- /dev/null
+++ b/test/files/run/t8601d.flags
@@ -0,0 +1 @@
+-optimize \ No newline at end of file
diff --git a/test/files/run/t8601d.scala b/test/files/run/t8601d.scala
new file mode 100644
index 0000000000..ac89963d67
--- /dev/null
+++ b/test/files/run/t8601d.scala
@@ -0,0 +1,8 @@
+object Test {
+ def monitor(x: AnyRef): Unit = {x.synchronized(()); ()}
+ def check(x: => Any) = try { x; sys.error("failed to throw NPE") } catch { case _: NullPointerException => }
+
+ def main(args: Array[String]) {
+ check(monitor(null))
+ }
+}
diff --git a/test/files/run/t8601e.flags b/test/files/run/t8601e.flags
new file mode 100644
index 0000000000..49d036a887
--- /dev/null
+++ b/test/files/run/t8601e.flags
@@ -0,0 +1 @@
+-optimize
diff --git a/test/files/run/t8601e/StaticInit.class b/test/files/run/t8601e/StaticInit.class
new file mode 100644
index 0000000000..99a0e2a643
--- /dev/null
+++ b/test/files/run/t8601e/StaticInit.class
Binary files differ
diff --git a/test/files/run/t8601e/StaticInit.java b/test/files/run/t8601e/StaticInit.java
new file mode 100644
index 0000000000..7543ed98b8
--- /dev/null
+++ b/test/files/run/t8601e/StaticInit.java
@@ -0,0 +1,8 @@
+public class StaticInit {
+ static {
+ if ("".isEmpty()) {
+ throw new RuntimeException();
+ }
+ }
+ public static int fld = 42;
+}
diff --git a/test/files/run/t8601e/Test.scala b/test/files/run/t8601e/Test.scala
new file mode 100644
index 0000000000..838114f6a7
--- /dev/null
+++ b/test/files/run/t8601e/Test.scala
@@ -0,0 +1,12 @@
+class C {
+ def foo: Unit = {StaticInit.fld}
+}
+
+object Test extends App {
+ try {
+ new C().foo
+ sys.error("StaticInit.<clinit> was not run!")
+ } catch {
+ case t: ExceptionInInitializerError =>
+ }
+}
diff --git a/test/files/run/t8607.scala b/test/files/run/t8607.scala
new file mode 100644
index 0000000000..1b8ef9bbd0
--- /dev/null
+++ b/test/files/run/t8607.scala
@@ -0,0 +1,36 @@
+package p1 {
+ private[p1] trait B extends Any {
+ def a: Any = ""
+ }
+
+ class C(val value: Int) extends AnyVal with B {
+ // def b = ""
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ val c = new p1.C(42)
+ c.a
+ /*
+ new p1.C.<init>(
+ c.$asInstanceOf[scala.this.Int]()
+ ).a();
+
+
+ new p1.C.<init>(
+ new p1.C.<init>(
+ c.$asInstanceOf[scala.this.Int]()
+ ).$asInstanceOf[ErasedValueType(class C, scala.this.Int)]()
+ .$asInstanceOf[scala.this.Int]()
+ ).a();
+
+ new p1.C.<init>(
+ new p1.C.<init>(c)
+ .$asInstanceOf[scala.this.Int]()
+ .$asInstanceOf[scala.this.Int]()
+ ).a();
+
+ */
+ }
+}
diff --git a/test/files/run/exoticnames.check b/test/files/run/t8637.check
index e69de29bb2..e69de29bb2 100644
--- a/test/files/run/exoticnames.check
+++ b/test/files/run/t8637.check
diff --git a/test/files/run/t8637.scala b/test/files/run/t8637.scala
new file mode 100644
index 0000000000..99c8d4c413
--- /dev/null
+++ b/test/files/run/t8637.scala
@@ -0,0 +1,9 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.currentMirror
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val tb = currentMirror.mkToolBox()
+ tb.compile(q"true > true")
+ tb.typecheck(q"true > true")
+} \ No newline at end of file
diff --git a/test/files/run/t874.scala b/test/files/run/t874.scala
index 41d124f728..b077859ef3 100644
--- a/test/files/run/t874.scala
+++ b/test/files/run/t874.scala
@@ -1,3 +1,5 @@
+
+import scala.language.{ reflectiveCalls }
object Test {
abstract class Base {
val U: {
@@ -5,7 +7,7 @@ object Test {
}
U("xyz")(2)
}
- class Mix extends Base {
+ class Mix extends Base {
case class U[A](x1: A)(x2: Int) {
Console.println("U created with "+x1+" and "+x2)
}
diff --git a/test/files/run/t920.scala b/test/files/run/t920.scala
index 1e12e6ba87..6a7f122d55 100644
--- a/test/files/run/t920.scala
+++ b/test/files/run/t920.scala
@@ -7,7 +7,7 @@ object Test {
trait Foo extends Test.Foo0 {
def foo : B.this.type = B.this;
}
- class baz extends Baz with Foo {
+ class baz extends Baz with Foo {
override def toString = "baz"
}
Console.println(new baz);
diff --git a/test/files/run/tailcalls.check b/test/files/run/tailcalls.check
index f123bc8f25..7607921856 100644
--- a/test/files/run/tailcalls.check
+++ b/test/files/run/tailcalls.check
@@ -1,3 +1,4 @@
+#partest !avian
test Object .f was successful
test Final .f was successful
test Class .f raised exception java.lang.StackOverflowError
@@ -51,3 +52,57 @@ test TailCall.b2 was successful
test FancyTailCalls.tcTryLocal was successful
test FancyTailCalls.differentInstance was successful
test PolyObject.tramp was successful
+#partest avian
+test Object .f was successful
+test Final .f was successful
+test Class .f was successful
+test SubClass .f was successful
+test Sealed .f was successful
+test SubSealed.f was successful
+
+test O .f was successful
+test c .f was successful
+test O.O .f was successful
+test O.c .f was successful
+test c.O .f was successful
+test c.c .f was successful
+test O.O.O .f was successful
+test O.O.c .f was successful
+test O.c.O .f was successful
+test O.c.c .f was successful
+test c.O.O .f was successful
+test c.O.c .f was successful
+test c.c.O .f was successful
+test c.c.c .f was successful
+test O.O.O.O.f was successful
+test O.O.O.c.f was successful
+test O.O.c.O.f was successful
+test O.O.c.c.f was successful
+test O.c.O.O.f was successful
+test O.c.O.c.f was successful
+test O.c.c.O.f was successful
+test O.c.c.c.f was successful
+test c.O.O.O.f was successful
+test c.O.O.c.f was successful
+test c.O.c.O.f was successful
+test c.O.c.c.f was successful
+test c.c.O.O.f was successful
+test c.c.O.c.f was successful
+test c.c.c.O.f was successful
+test c.c.c.c.f was successful
+
+test TailCall.f1 was successful
+test TailCall.f2 was successful
+test TailCall.f3 was successful
+test TailCall.g1 was successful
+test TailCall.g2 was successful
+test TailCall.g3 was successful
+test TailCall.h1 was successful
+
+test NonTailCall.f1 0 1 2 was successful
+test NonTailCall.f2
+test TailCall.b1 was successful
+test TailCall.b2 was successful
+test FancyTailCalls.tcTryLocal was successful
+test FancyTailCalls.differentInstance was successful
+test PolyObject.tramp was successful
diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala
index 04a1a8ba19..1653b14de9 100644
--- a/test/files/run/tailcalls.scala
+++ b/test/files/run/tailcalls.scala
@@ -169,7 +169,7 @@ class TailCall[S](s: S) {
aux[T](x, y);
}
final def g3[T](x: Int, y: Int, zs: List[T]): Int = {
- def aux[U](n: Int, v: Int, ls: List[Pair[T,U]]): Int =
+ def aux[U](n: Int, v: Int, ls: List[Tuple2[T,U]]): Int =
if (n == 0) v else aux(n - 1, v - 1, ls);
aux(x, y, Nil);
}
@@ -194,10 +194,10 @@ object FancyTailCalls {
}
object PolyObject extends App {
- def tramp[A](x: Int): Int =
+ def tramp[A](x: Int): Int =
if (x > 0)
tramp[A](x - 1)
- else
+ else
0
}
@@ -233,7 +233,7 @@ class NonTailCall {
if (n == 0) 0
else f2(n - 1)
}
-
+
}
//############################################################################
@@ -273,7 +273,7 @@ object Test {
}
println
}
-
+
def check_overflow(name: String, closure: => Int) {
print("test " + name)
try {
@@ -295,7 +295,7 @@ object Test {
while (!stop) {
try {
calibrator.f(n, n);
- if (n >= Int.MaxValue / 2) error("calibration failure");
+ if (n >= Int.MaxValue / 2) sys.error("calibration failure");
n = 2 * n;
} catch {
case exception: compat.Platform.StackOverflowError => stop = true
@@ -307,7 +307,7 @@ object Test {
def main(args: Array[String]) {
// compute min and max iteration number
val min = 16;
- val max = calibrate;
+ val max = if (scala.tools.partest.utils.Properties.isAvian) 10000 else calibrate
// test tail calls in different contexts
val Final = new Final()
@@ -367,7 +367,7 @@ object Test {
check_success("TailCall.g3", TailCall.g3(max, max, Nil), 0)
check_success("TailCall.h1", TailCall.h1(max, max ), 0)
println
-
+
val NonTailCall = new NonTailCall
check_success("NonTailCall.f1", NonTailCall.f1(2), 0)
check_overflow("NonTailCall.f2", NonTailCall.f2(max))
@@ -382,17 +382,30 @@ object Test {
}
// testing explicit tailcalls.
-
+
import scala.util.control.TailCalls._
def isEven(xs: List[Int]): TailRec[Boolean] =
if (xs.isEmpty) done(true) else tailcall(isOdd(xs.tail))
def isOdd(xs: List[Int]): TailRec[Boolean] =
- if (xs.isEmpty) done(false) else tailcall(isEven(xs.tail))
+ if (xs.isEmpty) done(false) else tailcall(isEven(xs.tail))
+
+ def fib(n: Int): TailRec[Int] =
+ if (n < 2) done(n) else for {
+ x <- tailcall(fib(n - 1))
+ y <- tailcall(fib(n - 2))
+ } yield (x + y)
+
+ def rec(n: Int): TailRec[Int] =
+ if (n == 1) done(n) else for {
+ x <- tailcall(rec(n - 1))
+ } yield x
assert(isEven((1 to 100000).toList).result)
-
+ //assert(fib(40).result == 102334155) // Commented out, as it takes a long time
+ assert(rec(100000).result == 1)
+
}
//############################################################################
diff --git a/test/files/run/takeAndDrop.scala b/test/files/run/takeAndDrop.scala
index 6e87838e11..8d2dff0bfa 100644
--- a/test/files/run/takeAndDrop.scala
+++ b/test/files/run/takeAndDrop.scala
@@ -1,9 +1,9 @@
-object Test {
+object Test {
def main(args: Array[String]): Unit = {
val range = 1 to 10
val target = (3 to 8).toList
val confirm = (xs: Seq[Int]) => assert(xs.toList == target, xs)
-
+
confirm(range drop 2 dropRight 2)
confirm(range drop 1 dropRight 1 drop 1 dropRight 1)
confirm(range take 8 drop 2)
diff --git a/test/files/run/tcpoly_monads.scala b/test/files/run/tcpoly_monads.scala
index cffbcc963b..978f889590 100644
--- a/test/files/run/tcpoly_monads.scala
+++ b/test/files/run/tcpoly_monads.scala
@@ -1,18 +1,21 @@
+
+import scala.language.{ higherKinds, implicitConversions }
+
trait Monads {
/**
* class Monad m where
* (>>=) :: m a -> (a -> m b) -> m b
* return :: a -> m a
*
- * MonadTC encodes the above Haskell type class,
+ * MonadTC encodes the above Haskell type class,
* an instance of MonadTC corresponds to a method dictionary.
* (see http://lampwww.epfl.ch/~odersky/talks/wg2.8-boston06.pdf)
*
* Note that the identity (`this') of the method dictionary does not really correspond
- * to the instance of m[x] (`self') that is `wrapped': e.g., unit does not use `self' (which
+ * to the instance of m[x] (`self') that is `wrapped': e.g., unit does not use `self' (which
* corresponds to the argument of the implicit conversion that encodes an instance of this type class)
*/
- trait MonadTC[m[x], a] {
+ trait MonadTC[m[x], a] {
def unit[a](orig: a): m[a]
// >>='s first argument comes from the implicit definition constructing this "method dictionary"
@@ -27,7 +30,7 @@ trait Monads {
*/
trait OptionMonad extends Monads {
// this implicit method encodes the Monad type class instance for Option
- implicit def OptionInstOfMonad[a](self: Option[a]): MonadTC[Option, a]
+ implicit def OptionInstOfMonad[a](self: Option[a]): MonadTC[Option, a]
= new MonadTC[Option, a] {
def unit[a](orig: a) = Some(orig)
def >>=[b](fun: a => Option[b]): Option[b] = self match {
diff --git a/test/files/run/tcpoly_overriding.scala b/test/files/run/tcpoly_overriding.scala
index 86ba89f530..32174ad8bf 100644
--- a/test/files/run/tcpoly_overriding.scala
+++ b/test/files/run/tcpoly_overriding.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ higherKinds }
+
abstract class A[t[x]] {
def b: t[Int]
}
diff --git a/test/files/run/tcpoly_parseridioms.check b/test/files/run/tcpoly_parseridioms.check
index 5fff2efb15..8bd0a086d6 100644
--- a/test/files/run/tcpoly_parseridioms.check
+++ b/test/files/run/tcpoly_parseridioms.check
@@ -1 +1,21 @@
+tcpoly_parseridioms.scala:18: warning: match may not be exhaustive.
+It would fail on the following input: ParseResult()
+ case Success(next, x) => b(next) match {
+ ^
+tcpoly_parseridioms.scala:17: warning: match may not be exhaustive.
+It would fail on the following input: ParseResult()
+ def apply(in: Input): ParseResult[Tuple2[T, U]] = a(in) match {
+ ^
+tcpoly_parseridioms.scala:30: warning: match may not be exhaustive.
+It would fail on the following input: ParseResult()
+ case Failure(_, _) => b(in) match {
+ ^
+tcpoly_parseridioms.scala:28: warning: match may not be exhaustive.
+It would fail on the following input: ParseResult()
+ def apply(in: Input): ParseResult[T] = a(in) match {
+ ^
+tcpoly_parseridioms.scala:39: warning: match may not be exhaustive.
+It would fail on the following input: ParseResult()
+ def apply(in: Input): ParseResult[U] = a(in) match {
+ ^
Success(List(),Plus(1,2))
diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala
index 634240e44d..d22f68b558 100644
--- a/test/files/run/tcpoly_parseridioms.scala
+++ b/test/files/run/tcpoly_parseridioms.scala
@@ -1,22 +1,25 @@
+
+import scala.language.{ higherKinds, implicitConversions, postfixOps }
+
trait Parsers {
type Input = List[Char]
-
+
sealed class ParseResult[+t](val next: Input)
- case class Success[+t](override val next: Input, result: t) extends ParseResult[t](next)
+ case class Success[+t](override val next: Input, result: t) extends ParseResult[t](next)
case class Failure(override val next: Input, msg: String) extends ParseResult[Nothing](next)
-
+
abstract class Parser[+t] {
def apply(in: Input): ParseResult[t]
}
// sequence
- def sq[T, U](a: => Parser[T], b: => Parser[U]): Parser[Pair[T, U]] = new Parser[Pair[T, U]] {
- def apply(in: Input): ParseResult[Pair[T, U]] = a(in) match {
+ def sq[T, U](a: => Parser[T], b: => Parser[U]): Parser[Tuple2[T, U]] = new Parser[Tuple2[T, U]] {
+ def apply(in: Input): ParseResult[Tuple2[T, U]] = a(in) match {
case Success(next, x) => b(next) match {
- case Success(next2, y) => Success(next2, Pair(x,y))
+ case Success(next2, y) => Success(next2, (x,y))
case Failure(_, msg) => Failure(in, msg)
}
- case Failure(_, msg) => Failure(in, msg)
+ case Failure(_, msg) => Failure(in, msg)
}
}
@@ -38,20 +41,20 @@ trait Parsers {
case Failure(n, msg) => Failure(n, msg)
}
}
-
+
def accept[T](c: Char, r: T): Parser[T] = new Parser[T] {
def apply(in: Input) = in match {
case c2 :: n if c2 == c => Success(n, r)
case n => Failure(n, "expected "+c+" at the head of "+n)
}
}
-
- def apply_++[s, tt](fun: Parser[s => tt], arg: Parser[s]): Parser[tt] = lift[Pair[s=>tt, s], tt]({case Pair(f, a) => f(a)})(sq(fun, arg))
-
+
+ def apply_++[s, tt](fun: Parser[s => tt], arg: Parser[s]): Parser[tt] = lift[Tuple2[s=>tt, s], tt]({case (f, a) => f(a)})(sq(fun, arg))
+
def success[u](v: u): Parser[u] = new Parser[u] {
def apply(in: Input) = Success(in, v)
}
-
+
}
trait Idioms {
@@ -61,21 +64,21 @@ trait Idioms {
def pureMethod[a](name: String, x: a): idi[a] = pure(x) // hack for Mirrors: allow passing of method names
}
- class IdiomaticTarget[idi[x], idiom <: Idiom[idi], s](i: idiom, tgt: s) {
+ class IdiomaticTarget[idi[x], idiom <: Idiom[idi], s](i: idiom, tgt: s) {
def dot [t](fun: s => t, name: String) = new IdiomaticApp2[idi, idiom, t](i, i.liftedApply(i.pureMethod(name, fun))(i.pure(tgt)))
} // TODO: `.` --> java.lang.ClassFormatError: Illegal method name "." in class Idioms$Id$
- class IdiomaticFunction[idi[x], idiom <: Idiom[idi], s, t](i: idiom, fun: s => t) {
+ class IdiomaticFunction[idi[x], idiom <: Idiom[idi], s, t](i: idiom, fun: s => t) {
def <| (a: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(i.pure(fun))(a))
}
class IdiomaticApp[idi[x], idiom <: Idiom[idi], x](i: idiom, a: idi[x]) {
// where x <: s=>t -- TODO can this be expressed without generalised constraints?
def <> [s, t](b: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(a.asInstanceOf[idi[s=>t]])(b))
-
+
def |> : idi[x] = a
}
-
+
class IdiomaticApp2[idi[x], idiom <: Idiom[idi], x](i: idiom, a: idi[x]) extends IdiomaticApp[idi, idiom, x](i, a) {
def <| [s, t](b: idi[s]) = <>[s,t](b)
}
@@ -86,22 +89,22 @@ trait ParserIdioms extends Parsers with Idioms {
def liftedApply[s, t](fun: Parser[s => t])(arg: Parser[s]): Parser[t] = apply_++(fun, arg)
def pure[a](x: a): Parser[a] = success(x)
}
-
- implicit def parserIdiomFun[s, t](fun: s=>t): IdiomaticFunction[Parser, ParserIdiom.type, s, t] =
+
+ implicit def parserIdiomFun[s, t](fun: s=>t): IdiomaticFunction[Parser, ParserIdiom.type, s, t] =
new IdiomaticFunction[Parser, ParserIdiom.type, s, t](ParserIdiom, fun)
- implicit def parserIdiomTgt[s](tgt: s): IdiomaticTarget[Parser, ParserIdiom.type, s] =
+ implicit def parserIdiomTgt[s](tgt: s): IdiomaticTarget[Parser, ParserIdiom.type, s] =
new IdiomaticTarget[Parser, ParserIdiom.type, s](ParserIdiom, tgt)
-
+
trait Expr
case class Plus(a: Int, b: Int) extends Expr
-
+
def num = or(accept('0', 0), or(accept('1', 1),accept('2', 2)))
-
- // TODO: how can parserIdiom(curry2(_)) be omitted?
+
+ // TODO: how can parserIdiom(curry2(_)) be omitted?
def expr: Parser[Expr] = parserIdiomFun(curry2(Plus)) <| num <> num |>
-
+
implicit def curry2[s,t,u](fun: (s, t)=>u)(a: s)(b: t) = fun(a, b)
- implicit def curry3[r,s,t,u](fun: (r,s, t)=>u)(a: r)(b: s)(c: t) = fun(a, b, c)
+ implicit def curry3[r,s,t,u](fun: (r,s, t)=>u)(a: r)(b: s)(c: t) = fun(a, b, c)
}
object Test extends ParserIdioms with App {
diff --git a/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala
index 5b3bc7b746..4e00e72658 100644
--- a/test/files/run/test-cpp.scala
+++ b/test/files/run/test-cpp.scala
@@ -3,25 +3,25 @@
* in the copy-propagation performed before ClosureElimination.
*
* In the general case, the local variable 'l' is connected through
- * a alias chain with other local variables and at the end of the
+ * an alias chain with other local variables and at the end of the
* alias chain there may be a Value, call it 'v'.
*
* If 'v' is cheaper to access (it is a Deref(This) or Const(_)), then
- * replace the instruction to load it from the cheaper place.
+ * replace the instruction to load it from the cheaper place.
* Otherwise, we use the local variable at the end of the alias chain
* instead of 'l'.
*/
-import scala.tools.partest.IcodeTest
+import scala.tools.partest.IcodeComparison
-object Test extends IcodeTest {
+object Test extends IcodeComparison {
override def printIcodeAfterPhase = "dce"
}
import scala.util.Random._
-/**
- * The example in the bug report (Issue-5321): an alias chain which store
+/**
+ * The example in the bug report (Issue-5321): an alias chain which store
* an Unknown. Should remove local variable 'y'.
*/
object TestBugReport {
@@ -42,20 +42,20 @@ object TestSetterInline {
}
-/**
+/**
* The access of the local variable 'y' should be replaced by the
* constant.
- */
+ */
object TestAliasChainConstat {
def main(args: Array[String]): Unit = {
val x = 2
val y = x
- println(y)
+ println(y)
}
}
-/**
+/**
* At the end of the alias chain we have a reference to 'this'.
* The local variables should be all discarded and replace by a
* direct reference to this
@@ -72,7 +72,7 @@ class TestAliasChainDerefThis {
/**
* At the end of the alias chain, there is the value of a field.
* The use of variable 'y' should be replaced by 'x', not by an access
- * to the field 'f' since it is more costly.
+ * to the field 'f' since it is more costly.
*/
object TestAliasChainDerefField {
def f = nextInt
@@ -86,7 +86,7 @@ object TestAliasChainDerefField {
/**
- * The first time 'println' is called, 'x' is replaced by 'y'
+ * The first time 'println' is called, 'x' is replaced by 'y'
* and the second time, 'y' is replaced by 'x'. But none of them
* can be removed.
*/
diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala
index d672ccb9cb..ce28086c25 100644
--- a/test/files/run/toolbox_console_reporter.scala
+++ b/test/files/run/toolbox_console_reporter.scala
@@ -4,10 +4,10 @@ import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.{ToolBox, mkConsoleFrontEnd}
object Test extends App {
- val oldErr = Console.err;
- val baos = new java.io.ByteArrayOutputStream();
- Console.setErr(new java.io.PrintStream(baos));
- try {
+ //val oldErr = Console.err;
+ val baos = new java.io.ByteArrayOutputStream()
+ val errs = new java.io.PrintStream(baos)
+ (Console withErr errs) {
val toolbox = cm.mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation")
toolbox.eval(reify{
object Utils {
@@ -18,12 +18,11 @@ object Test extends App {
Utils.foo
}.tree)
println("============compiler console=============")
+ errs.flush()
println(baos.toString);
println("=========================================")
println("============compiler messages============")
toolbox.frontEnd.infos.foreach(println(_))
println("=========================================")
- } finally {
- Console.setErr(oldErr);
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/toolbox_current_run_compiles.scala b/test/files/run/toolbox_current_run_compiles.scala
index b48c998e64..6ec7074643 100644
--- a/test/files/run/toolbox_current_run_compiles.scala
+++ b/test/files/run/toolbox_current_run_compiles.scala
@@ -1,5 +1,5 @@
package pkg {
- import scala.reflect.macros.Context
+ import scala.reflect.macros.blackbox.Context
import scala.language.experimental.macros
object Macros {
@@ -9,7 +9,7 @@ package pkg {
val g = c.universe.asInstanceOf[scala.tools.nsc.Global]
c.Expr[Boolean](Literal(Constant(g.currentRun.compiles(sym.asInstanceOf[g.Symbol]))))
}
- def compiles[T] = macro impl[T]
+ def compiles[T]: Boolean = macro impl[T]
}
}
diff --git a/test/files/run/toolbox_parse_package.check b/test/files/run/toolbox_parse_package.check
new file mode 100644
index 0000000000..46465980a0
--- /dev/null
+++ b/test/files/run/toolbox_parse_package.check
@@ -0,0 +1,8 @@
+package foo {
+ object bar extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ }
+ }
+}
diff --git a/test/files/run/toolbox_parse_package.scala b/test/files/run/toolbox_parse_package.scala
new file mode 100644
index 0000000000..62412a50d7
--- /dev/null
+++ b/test/files/run/toolbox_parse_package.scala
@@ -0,0 +1,9 @@
+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 = cm.mkToolBox()
+ println(toolbox.parse("package foo { object bar }"))
+} \ No newline at end of file
diff --git a/test/files/run/toolbox_rangepos.check b/test/files/run/toolbox_rangepos.check
deleted file mode 100644
index b536d3fde1..0000000000
--- a/test/files/run/toolbox_rangepos.check
+++ /dev/null
@@ -1 +0,0 @@
-RangePosition(<toolbox>, 0, 2, 5)
diff --git a/test/files/run/toolbox_rangepos.scala b/test/files/run/toolbox_rangepos.scala
deleted file mode 100644
index 41fe6daa03..0000000000
--- a/test/files/run/toolbox_rangepos.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-import scala.reflect.runtime.{currentMirror => cm}
-import scala.tools.reflect.ToolBox
-
-object Test extends App {
- val toolbox = cm.mkToolBox(options = "-Yrangepos")
- val tree = toolbox.parse("2 + 2")
- println(tree.pos)
-}
diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.check b/test/files/run/toolbox_typecheck_implicitsdisabled.check
index db64e118ca..009ba651fe 100644
--- a/test/files/run/toolbox_typecheck_implicitsdisabled.check
+++ b/test/files/run/toolbox_typecheck_implicitsdisabled.check
@@ -1,5 +1,5 @@
{
import scala.Predef._;
- scala.Predef.any2ArrowAssoc[Int](1).->[Int](2)
+ scala.Predef.ArrowAssoc[Int](1).->[Int](2)
}
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 8a3d433142..3fabdb33b6 100644
--- a/test/files/run/toolbox_typecheck_implicitsdisabled.scala
+++ b/test/files/run/toolbox_typecheck_implicitsdisabled.scala
@@ -7,18 +7,18 @@ object Test extends App {
val toolbox = cm.mkToolBox()
val tree1 = Block(List(
- Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))),
- Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2))))
+ Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(termNames.WILDCARD, -1, null, -1)))),
+ Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
)
- val ttree1 = toolbox.typeCheck(tree1, withImplicitViewsDisabled = false)
+ val ttree1 = toolbox.typecheck(tree1, withImplicitViewsDisabled = false)
println(ttree1)
try {
val tree2 = Block(List(
- Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))),
- Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2))))
+ Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(termNames.WILDCARD, -1, null, -1)))),
+ Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
)
- val ttree2 = toolbox.typeCheck(tree2, withImplicitViewsDisabled = true)
+ val ttree2 = toolbox.typecheck(tree2, withImplicitViewsDisabled = true)
println(ttree2)
} catch {
case ex: Throwable =>
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check
index 688f37927c..62de375826 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled.check
+++ b/test/files/run/toolbox_typecheck_macrosdisabled.check
@@ -1,8 +1,8 @@
-{
+({
val $u: ru.type = ru;
val $m: $u.Mirror = ru.runtimeMirror({
final class $anon extends scala.AnyRef {
- def <init>(): anonymous class $anon = {
+ def <init>(): <$anon: AnyRef> = {
$anon.super.<init>();
()
};
@@ -32,10 +32,10 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.ConstantType.apply($u.Constant.apply(2))
+ $u.internal.reificationSupport.ConstantType($u.Constant.apply(2))
}
};
new $typecreator2()
}))
-}
+}: ru.Expr[Int])
ru.reify[Int](2)
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala
index 51eb63f294..5466cb7765 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled.scala
+++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala
@@ -2,6 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
+import internal._
// Note: If you're looking at this test and you don't know why, you may
// have accidentally changed the way type tags reify. If so, validate
@@ -10,16 +11,16 @@ import scala.tools.reflect.ToolBox
object Test extends App {
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", scala.reflect.runtime.universe)
- build.setTypeSignature(ru, rutpe)
+ val rusym = reificationSupport.selectTerm(rupkg, "universe")
+ val NullaryMethodType(rutpe) = rusym.info
+ val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe)
+ reificationSupport.setInfo(ru, rutpe)
- val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2))))
- val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false)
+ val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
+ val ttree1 = toolbox.typecheck(tree1, withMacrosDisabled = false)
println(ttree1)
- val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2))))
- val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true)
+ val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
+ val ttree2 = toolbox.typecheck(tree2, withMacrosDisabled = true)
println(ttree2)
}
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check
index e7011d1ae2..86f89504d1 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled2.check
+++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check
@@ -1,8 +1,8 @@
-{
+({
val $u: ru.type = ru;
val $m: $u.Mirror = ru.runtimeMirror({
final class $anon extends scala.AnyRef {
- def <init>(): anonymous class $anon = {
+ def <init>(): <$anon: AnyRef> = {
$anon.super.<init>();
()
};
@@ -19,7 +19,7 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.build.Ident($m.staticModule("scala.Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ $u.Apply.apply($u.Select.apply($u.internal.reificationSupport.mkIdent($m.staticModule("scala.Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
}
};
new $treecreator1()
@@ -32,10 +32,10 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
+ $u.internal.reificationSupport.TypeRef($u.internal.reificationSupport.ThisType($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor))
}
};
new $typecreator2()
}))
-}
+}: ru.Expr[Array[Int]])
ru.reify[Array[Int]](scala.Array.apply(2))
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala
index 74fd09d9fd..606d3d40cb 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala
+++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala
@@ -2,6 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
+import internal._
// Note: If you're looking at this test and you don't know why, you may
// have accidentally changed the way type tags reify. If so, validate
@@ -10,16 +11,16 @@ import scala.tools.reflect.ToolBox
object Test extends App {
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", scala.reflect.runtime.universe)
- build.setTypeSignature(ru, rutpe)
+ val rusym = reificationSupport.selectTerm(rupkg, "universe")
+ val NullaryMethodType(rutpe) = rusym.info
+ val ru = reificationSupport.newFreeTerm("ru", scala.reflect.runtime.universe)
+ reificationSupport.setInfo(ru, rutpe)
- val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
- val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false)
+ val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
+ val ttree1 = toolbox.typecheck(tree1, withMacrosDisabled = false)
println(ttree1)
- val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
- val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true)
+ val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
+ val ttree2 = toolbox.typecheck(tree2, withMacrosDisabled = true)
println(ttree2)
}
diff --git a/test/files/run/tpeCache-tyconCache.check b/test/files/run/tpeCache-tyconCache.check
new file mode 100644
index 0000000000..a892f5477a
--- /dev/null
+++ b/test/files/run/tpeCache-tyconCache.check
@@ -0,0 +1,19 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> :power
+** Power User mode enabled - BEEP WHIR GYVE **
+** :phase has been set to 'typer'. **
+** scala.tools.nsc._ has been imported **
+** global._, definitions._ also imported **
+** Try :help, :vals, power.<tab> **
+
+scala>
+
+scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor
+res0: Boolean = true
+
+scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor
+res1: Boolean = true
+
+scala>
diff --git a/test/files/run/tpeCache-tyconCache.scala b/test/files/run/tpeCache-tyconCache.scala
new file mode 100644
index 0000000000..f907167a33
--- /dev/null
+++ b/test/files/run/tpeCache-tyconCache.scala
@@ -0,0 +1,10 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ override def code = """
+:power
+
+AnyRefClass.tpe eq AnyRefClass.typeConstructor
+AnyRefClass.tpe eq AnyRefClass.typeConstructor
+ """.trim
+}
diff --git a/test/files/run/trait-renaming/A_1.scala b/test/files/run/trait-renaming/A_1.scala
index 2c3d4f566f..d0fab7bfc3 100644
--- a/test/files/run/trait-renaming/A_1.scala
+++ b/test/files/run/trait-renaming/A_1.scala
@@ -9,7 +9,7 @@ package bippy {
}
new B with C { }
}
-
+
def g = Class.forName("bippy.A$B$1$class")
}
}
diff --git a/test/files/run/transform.scala b/test/files/run/transform.scala
index 5cc1c49d6f..d73155ceec 100644
--- a/test/files/run/transform.scala
+++ b/test/files/run/transform.scala
@@ -1,6 +1,6 @@
object Test {
- val x = 1 to 10 toBuffer
-
+ val x = (1 to 10).toBuffer
+
def main(args: Array[String]): Unit = {
x transform (_ * 2)
assert(x.sum == (1 to 10).sum * 2)
diff --git a/test/files/run/transpose.scala b/test/files/run/transpose.scala
index 3bea74b365..2761a24ff5 100644
--- a/test/files/run/transpose.scala
+++ b/test/files/run/transpose.scala
@@ -1,8 +1,8 @@
object Test {
- def wrap[T >: Null](body: => T) =
+ def wrap[T >: Null](body: => T) =
try body
catch { case _: IllegalArgumentException => null }
-
+
def main(args: Array[String]): Unit = {
assert(wrap(Nil.transpose) == Nil)
assert(wrap(List(List(1, 2), List(1)).transpose) == null)
diff --git a/test/files/run/triemap-hash.scala b/test/files/run/triemap-hash.scala
index 7f19997da0..f9913816d4 100644
--- a/test/files/run/triemap-hash.scala
+++ b/test/files/run/triemap-hash.scala
@@ -6,41 +6,41 @@ import util.hashing.Hashing
object Test {
-
+
def main(args: Array[String]) {
hashing()
equality()
}
-
+
def hashing() {
import collection._
-
+
val tm = new concurrent.TrieMap[String, String](Hashing.fromFunction(x => x.length + x(0).toInt), Equiv.universal)
tm.put("a", "b")
tm.put("c", "d")
-
+
assert(tm("a") == "b")
assert(tm("c") == "d")
-
+
for (i <- 0 until 1000) tm(i.toString) = i.toString
for (i <- 0 until 1000) assert(tm(i.toString) == i.toString)
}
-
+
def equality() {
import collection._
-
+
val tm = new concurrent.TrieMap[String, String](Hashing.fromFunction(x => x(0).toInt), Equiv.fromFunction(_(0) == _(0)))
tm.put("a", "b")
tm.put("a1", "d")
tm.put("b", "c")
-
+
assert(tm("a") == "d", tm)
assert(tm("b") == "c", tm)
-
+
for (i <- 0 until 1000) tm(i.toString) = i.toString
assert(tm.size == 12, tm)
assert(tm("0") == "0", tm)
for (i <- 1 to 9) assert(tm(i.toString) == i.toString + "99", tm)
}
-
+
}
diff --git a/test/files/run/triple-quoted-expr.scala b/test/files/run/triple-quoted-expr.scala
index 0b30946de2..6d91ac5888 100644
--- a/test/files/run/triple-quoted-expr.scala
+++ b/test/files/run/triple-quoted-expr.scala
@@ -1,18 +1,18 @@
class A {
def f1 = {
val x = 5
-
+
"""
hi"""
}
def f2 = {
val x = 5
-
+
"""hi"""
- }
+ }
def f3 = {
val x = 5
-
+
"\nhi"
}
}
diff --git a/test/files/run/try-2.check b/test/files/run/try-2.check
index 6c4a024c93..987d3462df 100644
--- a/test/files/run/try-2.check
+++ b/test/files/run/try-2.check
@@ -1,3 +1,6 @@
+try-2.scala:41: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 10;
+ ^
exception happened
Nothin
diff --git a/test/files/run/try-2.scala b/test/files/run/try-2.scala
index 677f0b48eb..b55977ba8b 100644
--- a/test/files/run/try-2.scala
+++ b/test/files/run/try-2.scala
@@ -7,47 +7,47 @@
object Test {
- def tryAllUnit: Unit =
+ def tryAllUnit: Unit =
try {
throw new Error();
}
catch {
- case _ => Console.println("exception happened\n");
+ case _: Throwable => Console.println("exception happened\n");
}
- def tryUnitAll: Unit =
+ def tryUnitAll: Unit =
try {
Console.println("Nothin");
} catch {
- case _ => error("Bad, bad, lama!");
+ case _: Throwable => sys.error("Bad, bad, lama!");
}
- def tryAllAll: Unit =
+ def tryAllAll: Unit =
try {
throw new Error();
} catch {
- case _ => error("Bad, bad, lama!");
+ case _: Throwable => sys.error("Bad, bad, lama!");
}
- def tryUnitUnit: Unit =
+ def tryUnitUnit: Unit =
try {
Console.println("Nothin");
} catch {
- case _ => Console.println("Nothin");
+ case _: Throwable => Console.println("Nothin");
}
- def tryIntUnit: Unit =
+ def tryIntUnit: Unit =
try {
10;
} catch {
- case _ => Console.println("Huh?");
+ case _: Throwable => Console.println("Huh?");
}
def execute(f: => Unit) = try {
f;
} catch {
- case _ => ();
+ case _: Throwable => ();
}
@@ -55,7 +55,7 @@ object Test {
execute(tryAllUnit);
execute(tryUnitAll);
execute(tryAllAll);
- execute(tryUnitUnit);
+ execute(tryUnitUnit);
execute(tryIntUnit);
}
}
diff --git a/test/files/run/try-catch-unify.scala b/test/files/run/try-catch-unify.scala
index 8cb14d060e..151e549e5f 100644
--- a/test/files/run/try-catch-unify.scala
+++ b/test/files/run/try-catch-unify.scala
@@ -9,7 +9,7 @@ object Test {
try {
catching(classOf[NumberFormatException]) withTry (sys.error("O NOES"))
} catch {
- case t => println(t.getMessage)
+ case t: Throwable => println(t.getMessage)
}
println(nonFatalCatch withTry ("Hi".toDouble))
}
diff --git a/test/files/run/try.check b/test/files/run/try.check
index 3983e26060..f742ccb0df 100644
--- a/test/files/run/try.check
+++ b/test/files/run/try.check
@@ -1,3 +1,6 @@
+try.scala:65: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ 1+1;
+ ^
1 + 1 = 2
1 + 1 = 2
1 + 1 = 2
diff --git a/test/files/run/try.scala b/test/files/run/try.scala
index ad3d606246..a4fdfd796b 100644
--- a/test/files/run/try.scala
+++ b/test/files/run/try.scala
@@ -17,8 +17,8 @@ object Test extends AnyRef with App {
Console.println(
(try { x } catch {
case _: Error => 1;
- })
- +
+ })
+ +
(try { x } catch {
case _: Error => 1;
})
@@ -45,7 +45,7 @@ object Test extends AnyRef with App {
instance = try {
"" //new String();
} catch {
- case _ =>
+ case _: Throwable =>
val cs = "aaa";
if (cs.length() > 0) {
"" //new String();
@@ -61,17 +61,17 @@ object Test extends AnyRef with App {
Console.print("1 + 1 = ");
try {
if (true)
- error("exit");
+ sys.error("exit");
1+1;
()
} catch {
- case _ =>
+ case _: Throwable =>
Console.println("2");
- error("for good");
+ sys.error("for good");
}
Console.println("a");
} catch {
- case _ => ();
+ case _: Throwable => ();
}
class A {
@@ -95,7 +95,7 @@ object Test extends AnyRef with App {
try {
null
} catch {
- case _ => null
+ case _: Throwable => null
}
new AnyRef {
@@ -116,7 +116,7 @@ object Test extends AnyRef with App {
}
*/
-
+
try1;
try2;
try3;
diff --git a/test/files/run/tuple-match.scala b/test/files/run/tuple-match.scala
index 57ba9cf6e1..fcaefbff5b 100644
--- a/test/files/run/tuple-match.scala
+++ b/test/files/run/tuple-match.scala
@@ -1,7 +1,7 @@
object Test {
val FOUR = (-1, -2, -3, "bingo donkey vegas")
val THREE = (-1, -2, -3)
-
+
def f(x: Any) = x match {
case FOUR => "FOUR"
case (_, _, 3, _) => "4, #3"
@@ -13,7 +13,7 @@ object Test {
case (_, 2) => "2, #2"
case _ => "default"
}
-
+
def main(args: Array[String]): Unit = {
println(f((1, 2, 3, 4)))
println(f((1, 2, 30, 4)))
diff --git a/test/files/run/tuple-zipped.scala b/test/files/run/tuple-zipped.scala
index b197183844..37ac52977f 100644
--- a/test/files/run/tuple-zipped.scala
+++ b/test/files/run/tuple-zipped.scala
@@ -1,3 +1,6 @@
+
+import scala.language.postfixOps
+
object Test {
val xs1 = List.range(1, 100)
val xs2 = xs1.view
@@ -8,32 +11,31 @@ object Test {
val as1 = 1 to 100 toArray
val as2 = as1.view
val as3 = as1 take 10
-
+
def xss1 = List[Seq[Int]](xs1, xs2, xs3, ss1, ss2, ss3, as1, as2, as3)
def xss2 = List[Seq[Int]](xs1, xs2, xs3, ss3, as1, as2, as3) // no infinities
def xss3 = List[Seq[Int]](xs2, xs3, ss3, as1) // representative sampling
-
+
def main(args: Array[String]): Unit = {
for (cc1 <- xss1 ; cc2 <- xss2) {
val sum1 = (cc1, cc2).zipped map { case (x, y) => x + y } sum
val sum2 = (cc1, cc2).zipped map (_ + _) sum
-
+
assert(sum1 == sum2)
}
-
+
for (cc1 <- xss1 ; cc2 <- xss2 ; cc3 <- xss3) {
val sum1 = (cc1, cc2, cc3).zipped map { case (x, y, z) => x + y + z } sum
val sum2 = (cc1, cc2, cc3).zipped map (_ + _ + _) sum
-
+
assert(sum1 == sum2)
}
-
+
assert((ss1, ss1).zipped exists ((x, y) => true))
assert((ss1, ss1, ss1).zipped exists ((x, y, z) => true))
-
+
assert(!(ss1, ss2, 1 to 3).zipped.exists(_ + _ + _ > 100000))
assert((1 to 3, ss1, ss2).zipped.forall(_ + _ + _ > 0))
assert((ss1, 1 to 3, ss2).zipped.map(_ + _ + _).size == 3)
}
}
-
diff --git a/test/files/run/tuples.scala b/test/files/run/tuples.scala
index 4854e36c96..a4ea9ddbcc 100644
--- a/test/files/run/tuples.scala
+++ b/test/files/run/tuples.scala
@@ -6,6 +6,7 @@ object Test extends App {
Console.println(xyz)
xyz match {
case (1, "abc", true) => Console.println("OK")
+ case _ => ???
}
def func(x: Int, y: String, z: Double) {
Console.println("x = " + x + "; y = " + y + "; z = " + z);
diff --git a/test/files/run/type-currying.scala b/test/files/run/type-currying.scala
index f9764c64f0..e10f8fc9f1 100644
--- a/test/files/run/type-currying.scala
+++ b/test/files/run/type-currying.scala
@@ -1,3 +1,6 @@
+
+
+import scala.language.{ higherKinds, reflectiveCalls }
import scala.collection.{ mutable, immutable, generic }
import generic.CanBuildFrom
@@ -33,10 +36,10 @@ object Test {
val immutableBippy = Partial[immutable.HashMap].values[Int]
def make[T](xs: T*) = immutableBippy[T] ++ xs.zipWithIndex
-
+
val n0 = Partial[immutable.HashMap][String][Int] ++ Seq(("a", 1))
val n1 = Partial.apply[immutable.HashMap].apply[String].apply[Int] ++ Seq(("a", 1))
-
+
def main(args: Array[String]): Unit = {
println(mutableBippy)
make('a' to 'z': _*).toList.sorted foreach println
diff --git a/test/files/run/typealias_overriding.scala b/test/files/run/typealias_overriding.scala
index 8a2d1312ab..4b6a0037ec 100644
--- a/test/files/run/typealias_overriding.scala
+++ b/test/files/run/typealias_overriding.scala
@@ -1,21 +1,21 @@
// this bug (http://scala-webapps.epfl.ch/bugtracking/bugs/displayItem.do?id=1065)
-// was caused by Uncurry not normalizing all the types
+// was caused by Uncurry not normalizing all the types
// (more specifically the argument/return types of an anonymous Function)
object Test extends App {
trait AddRemove {
type TNode <: NodeImpl;
trait NodeImpl;
-
+
object removing {
type TNode = AddRemove.this.TNode;
def printNode(node: TNode, f: TNode => String) = Console.println(f(node))
}
}
-
+
class Linked extends AddRemove {
type TNode = Node // can also directly write `class Node extends super.NodeImpl' -- doesn't change the bug
class Node extends super.NodeImpl { override def toString = "LinkedNode" }
-
+
removing.printNode(new Node, (x: removing.TNode) => x.toString) // make inference explicit, doesn't affect the bug
}
diff --git a/test/files/run/typecheck/Macros_1.scala b/test/files/run/typecheck/Macros_1.scala
index 850a611ab1..ee1c8da763 100644
--- a/test/files/run/typecheck/Macros_1.scala
+++ b/test/files/run/typecheck/Macros_1.scala
@@ -1,16 +1,11 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox._
import scala.language.experimental.macros
object Macros {
def impl(c: Context) = {
import c.universe._
- val classDef = ClassDef(
- Modifiers(), newTypeName("C"), List(),
- Template(
- List(Select(Ident(newTermName("scala")), newTypeName("AnyRef"))), emptyValDef,
- List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))))))
- c.typeCheck(classDef)
- c.Expr[Any](Literal(Constant(())))
+ c.typecheck(q"class C")
+ q"()"
}
def foo: Any = macro impl
diff --git a/test/files/run/typecheck/Test_2.scala b/test/files/run/typecheck/Test_2.scala
index 0a3279e23e..01bf5198cc 100644
--- a/test/files/run/typecheck/Test_2.scala
+++ b/test/files/run/typecheck/Test_2.scala
@@ -6,10 +6,5 @@ object Test extends App {
Macros.foo
val tb = cm.mkToolBox()
- val classDef = ClassDef(
- Modifiers(), newTypeName("C"), List(),
- Template(
- List(Select(Ident(newTermName("scala")), newTypeName("AnyRef"))), emptyValDef,
- List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))))))
- tb.typeCheck(classDef)
+ tb.typecheck(q"class C")
} \ No newline at end of file
diff --git a/test/files/run/typed-annotated/Macros_1.scala b/test/files/run/typed-annotated/Macros_1.scala
index dd18c63d90..4f0660dc45 100644
--- a/test/files/run/typed-annotated/Macros_1.scala
+++ b/test/files/run/typed-annotated/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
class ann extends scala.annotation.StaticAnnotation
@@ -6,8 +6,8 @@ class ann extends scala.annotation.StaticAnnotation
object Macros {
def impl(c: Context) = {
import c.universe._
- // val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), nme.CONSTRUCTOR), List()), Ident(newTypeName("Int")))
- val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), nme.CONSTRUCTOR), List()), TypeTree(weakTypeOf[Int]))
+ // val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), termNames.CONSTRUCTOR), List()), Ident(newTypeName("Int")))
+ val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), termNames.CONSTRUCTOR), List()), TypeTree(weakTypeOf[Int]))
c.Expr[Unit](Block(
List(ValDef(Modifiers(), newTermName("x"), tpt, Literal(Constant(42)))),
Apply(Ident(newTermName("println")), List(Ident(newTermName("x"))))))
diff --git a/test/files/run/typetags_symbolof_x.check b/test/files/run/typetags_symbolof_x.check
new file mode 100644
index 0000000000..fd0e069bca
--- /dev/null
+++ b/test/files/run/typetags_symbolof_x.check
@@ -0,0 +1,6 @@
+class Int
+object C
+type T
+type Id
+class Nothing
+class Null
diff --git a/test/files/run/typetags_symbolof_x.scala b/test/files/run/typetags_symbolof_x.scala
new file mode 100644
index 0000000000..333c4e7da4
--- /dev/null
+++ b/test/files/run/typetags_symbolof_x.scala
@@ -0,0 +1,15 @@
+import scala.reflect.runtime.universe._
+
+class C
+object C
+
+object Test extends App {
+ type T = Int
+ type Id[X] = X
+ println(symbolOf[Int])
+ println(symbolOf[C.type])
+ println(symbolOf[T])
+ println(symbolOf[Id[_]])
+ println(symbolOf[Nothing])
+ println(symbolOf[Null])
+}
diff --git a/test/files/run/typetags_without_scala_reflect_manifest_lookup.check b/test/files/run/typetags_without_scala_reflect_manifest_lookup.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/typetags_without_scala_reflect_manifest_lookup.check
+++ /dev/null
diff --git a/test/files/run/unapply.check b/test/files/run/unapply.check
new file mode 100644
index 0000000000..847e3b381e
--- /dev/null
+++ b/test/files/run/unapply.check
@@ -0,0 +1,3 @@
+unapply.scala:57: warning: comparing values of types Null and Null using `==' will always yield true
+ assert(doMatch2(b) == null)
+ ^
diff --git a/test/files/run/unapply.scala b/test/files/run/unapply.scala
index 90dd4fae73..0c5a70e768 100644
--- a/test/files/run/unapply.scala
+++ b/test/files/run/unapply.scala
@@ -22,7 +22,7 @@ object Faa {
def unapply(x: Any): Option[String] = if(x.isInstanceOf[Bar]) Some(x.asInstanceOf[Bar].name) else None
}
object FaaPrecise {
- def unapply(x: Bar): Option[String] = Some(x.name)
+ def unapply(x: Bar): Option[String] = Some(x.name)
}
object FaaPreciseSome {
def unapply(x: Bar) = Some(x.name) // return type Some[String]
@@ -108,14 +108,14 @@ object Test1256 {
class Sync {
def unapply(scrut: Any): Boolean = false
}
-
+
class Buffer {
val Get = new Sync
val jp: PartialFunction[Any, Any] = {
case Get() =>
}
}
-
+
def run() {
assert(!(new Buffer).jp.isDefinedAt(42))
}
diff --git a/test/files/run/unittest_collection.check b/test/files/run/unittest_collection.check
new file mode 100644
index 0000000000..844ca54682
--- /dev/null
+++ b/test/files/run/unittest_collection.check
@@ -0,0 +1 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/unittest_collection.scala b/test/files/run/unittest_collection.scala
index 3639b496b3..822e2b0c98 100644
--- a/test/files/run/unittest_collection.scala
+++ b/test/files/run/unittest_collection.scala
@@ -12,7 +12,7 @@ object Test {
}
def test(x: Buffer[String]) {
- // testing method +=
+ // testing method +=
x += "one"
assert(x(0) == "one", "retrieving 'one'")
assert(x.length == 1, "length A")
@@ -25,10 +25,10 @@ object Test {
assert(x.length == 1, "length C")
- try { x(1); sys.error("no exception for removed element") }
+ try { x(1); sys.error("no exception for removed element") }
catch { case i:IndexOutOfBoundsException => }
- try { x.remove(1); sys.error("no exception for removed element") }
+ try { x.remove(1); sys.error("no exception for removed element") }
catch { case i:IndexOutOfBoundsException => }
x += "two2"
diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala
deleted file mode 100644
index 2cadb9b1df..0000000000
--- a/test/files/run/unittest_io.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-object Test {
-
- def main(args: Array[String]) {
- UTF8Tests.run()
- SourceTest.run()
- }
-
- object UTF8Tests {
- def decode(ch: Int) = new String(Array(ch), 0, 1).getBytes("UTF-8")
-
- def run() {
- assert(new String( decode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char])))
- assert(new String( decode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char])))
- assert(new String( decode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char])))
- assert(new String(decode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char],
- 0xDF02.asInstanceOf[Char])))
- // a client
- val test = "{\"a\":\"\\u0022\"}"
- val expected = "a" -> "\""
-
- val parsed = scala.util.parsing.json.JSON.parseFull(test)
- val result = parsed == Some(Map(expected))
- if(result)
- assert(result)
- else {
- Console.println(parsed); assert(result)
- }
- }
- }
-
- object SourceTest {
- def run() {
- val s = "Here is a test string"
- val f = io.Source.fromBytes(s.getBytes("utf-8"))
- val b = new collection.mutable.ArrayBuffer[Char]()
- f.copyToBuffer(b)
- assert(s == new String(b.toArray))
- }
- }
-}
diff --git a/test/files/run/unittest_iterator.scala b/test/files/run/unittest_iterator.scala
index 89ccdb9d58..21dc64c3c5 100644
--- a/test/files/run/unittest_iterator.scala
+++ b/test/files/run/unittest_iterator.scala
@@ -1,5 +1,5 @@
// Some iterator grouped/sliding unit tests
-object Test {
+object Test {
def it = (1 to 10).iterator
def assertThat[T](expectedLength: Int, expectedLast: Seq[T])(it: Iterator[Seq[T]]) {
val xs = it.toList
@@ -7,15 +7,15 @@ object Test {
assert(xs.size == expectedLength, fail("expected length " + expectedLength))
assert(xs.last == expectedLast, fail("expected last " + expectedLast))
}
-
+
def main(args: Array[String]): Unit = {
val itSum = it.toStream.sum
for (i <- it) {
// sum of the groups == sum of the original
val thisSum = ((it grouped i) map (_.sum)).toStream.sum
- assert(thisSum == itSum, thisSum + " != " + itSum)
+ assert(thisSum == itSum, thisSum + " != " + itSum)
}
-
+
// grouped
assertThat(4, List(10)) { it grouped 3 }
assertThat(3, List(7, 8, 9)) { it grouped 3 withPartial false }
@@ -32,11 +32,11 @@ object Test {
assertThat(1, (1 to 8).toList) { it.sliding(8, 8) withPartial false }
assertThat(2, List(9, 10, -1, -1, -1)) { it.sliding(5, 8) withPadding -1 }
assertThat(1, (1 to 5).toList) { it.sliding(5, 8) withPartial false }
-
+
// larger step than window
assertThat(5, List(9)) { it.sliding(1, 2) }
assertThat(3, List(9, 10)) { it.sliding(2, 4) }
-
+
// make sure it throws past the end
val thrown = try {
val it = List(1,2,3).sliding(2)
diff --git a/test/files/run/unreachable.scala b/test/files/run/unreachable.scala
new file mode 100644
index 0000000000..bb907c92bf
--- /dev/null
+++ b/test/files/run/unreachable.scala
@@ -0,0 +1,128 @@
+import scala.util.Random.nextInt
+import scala.sys.error
+
+object Test extends App {
+ def unreachableNormalExit: Int = {
+ return 42
+ 0
+ }
+
+ def unreachableIf: Int = {
+ return 42
+ if (nextInt % 2 == 0)
+ 0
+ else
+ 1
+ }
+
+ def unreachableIfBranches: Int = {
+ if (nextInt % 2 == 0)
+ return 42
+ else
+ return 42
+
+ return 0
+ }
+
+ def unreachableOneLegIf: Int = {
+ if (nextInt % 2 == 0)
+ return 42
+
+ return 42
+ }
+
+ def unreachableLeftBranch: Int = {
+ val result = if (nextInt % 2 == 0)
+ return 42
+ else
+ 42
+
+ return result
+ }
+
+ def unreachableRightBranch: Int = {
+ val result = if (nextInt % 2 == 0)
+ 42
+ else
+ return 42
+
+ return result
+ }
+
+ def unreachableTryCatchFinally: Int = {
+ return 42
+ try {
+ return 0
+ } catch {
+ case x: Throwable => return 1
+ } finally {
+ return 2
+ }
+ return 3
+ }
+
+ def unreachableAfterTry: Int = {
+ try {
+ return 42
+ } catch {
+ case x: Throwable => return 2
+ }
+ return 3
+ }
+
+ def unreachableAfterCatch: Int = {
+ try {
+ error("haha")
+ } catch {
+ case x: Throwable => return 42
+ }
+ return 3
+ }
+
+ def unreachableAfterFinally: Int = {
+ try {
+ return 1
+ } catch {
+ case x: Throwable => return 2
+ } finally {
+ return 42
+ }
+ return 3
+ }
+
+ def unreachableSwitch: Int = {
+ return 42
+ val x = nextInt % 2
+ x match {
+ case 0 => return 0
+ case 1 => return 1
+ case -1 => return 2
+ }
+ 3
+ }
+
+ def unreachableAfterSwitch: Int = {
+ val x = nextInt % 2
+ x match {
+ case 0 => return 42
+ case 1 => return 41 + x
+ case -1 => return 43 + x
+ }
+ 2
+ }
+
+ def check(f: Int) = assert(f == 42, s"Expected 42 but got $f")
+
+ check(unreachableNormalExit)
+ check(unreachableIf)
+ check(unreachableIfBranches)
+ check(unreachableOneLegIf)
+ check(unreachableLeftBranch)
+ check(unreachableRightBranch)
+ check(unreachableTryCatchFinally)
+ check(unreachableAfterTry)
+ check(unreachableAfterCatch)
+ check(unreachableAfterFinally)
+ check(unreachableSwitch)
+ check(unreachableAfterSwitch)
+}
diff --git a/test/files/run/value-class-extractor-2.check b/test/files/run/value-class-extractor-2.check
new file mode 100644
index 0000000000..5903b996b6
--- /dev/null
+++ b/test/files/run/value-class-extractor-2.check
@@ -0,0 +1,8 @@
+String
+List
+Int
+Something else
+String
+List
+Int
+Something else
diff --git a/test/files/run/value-class-extractor-2.scala b/test/files/run/value-class-extractor-2.scala
new file mode 100644
index 0000000000..d776c35eda
--- /dev/null
+++ b/test/files/run/value-class-extractor-2.scala
@@ -0,0 +1,108 @@
+final class Opt[+A >: Null](val value: A) extends AnyVal {
+ def get: A = value
+ def isEmpty = value == null
+}
+object Opt {
+ final val None = new Opt[Null](null)
+ def apply[A >: Null](value: A): Opt[A] = if (value == null) None else new Opt[A](value)
+}
+
+object ValueOpt {
+ // public java.lang.String unapply(java.lang.Object);
+ // 0: aload_1
+ // 1: instanceof #16 // class java/lang/String
+ // 4: ifeq 21
+ // 7: getstatic #21 // Field Opt$.MODULE$:LOpt$;
+ // 10: astore_2
+ // 11: ldc #23 // String String
+ // 13: checkcast #16 // class java/lang/String
+ // 16: astore 5
+ // 18: goto 71
+ // 21: aload_1
+ // 22: instanceof #25 // class scala/collection/immutable/List
+ // 25: ifeq 42
+ // 28: getstatic #21 // Field Opt$.MODULE$:LOpt$;
+ // 31: astore_3
+ // 32: ldc #27 // String List
+ // 34: checkcast #16 // class java/lang/String
+ // 37: astore 5
+ // 39: goto 71
+ // 42: aload_1
+ // 43: instanceof #29 // class java/lang/Integer
+ // 46: ifeq 64
+ // 49: getstatic #21 // Field Opt$.MODULE$:LOpt$;
+ // 52: astore 4
+ // 54: ldc #31 // String Int
+ // 56: checkcast #16 // class java/lang/String
+ // 59: astore 5
+ // 61: goto 71
+ // 64: getstatic #21 // Field Opt$.MODULE$:LOpt$;
+ // 67: pop
+ // 68: aconst_null
+ // 69: astore 5
+ // 71: aload 5
+ // 73: areturn
+ def unapply(x: Any): Opt[String] = x match {
+ case _: String => Opt("String")
+ case _: List[_] => Opt("List")
+ case _: Int => Opt("Int")
+ case _ => Opt.None
+ }
+}
+object RegularOpt {
+ // public scala.Option<java.lang.String> unapply(java.lang.Object);
+ // 0: aload_1
+ // 1: instanceof #16 // class java/lang/String
+ // 4: ifeq 20
+ // 7: new #18 // class scala/Some
+ // 10: dup
+ // 11: ldc #20 // String String
+ // 13: invokespecial #23 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 16: astore_2
+ // 17: goto 64
+ // 20: aload_1
+ // 21: instanceof #25 // class scala/collection/immutable/List
+ // 24: ifeq 40
+ // 27: new #18 // class scala/Some
+ // 30: dup
+ // 31: ldc #27 // String List
+ // 33: invokespecial #23 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 36: astore_2
+ // 37: goto 64
+ // 40: aload_1
+ // 41: instanceof #29 // class java/lang/Integer
+ // 44: ifeq 60
+ // 47: new #18 // class scala/Some
+ // 50: dup
+ // 51: ldc #31 // String Int
+ // 53: invokespecial #23 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 56: astore_2
+ // 57: goto 64
+ // 60: getstatic #36 // Field scala/None$.MODULE$:Lscala/None$;
+ // 63: astore_2
+ // 64: aload_2
+ // 65: areturn
+ def unapply(x: Any): Option[String] = x match {
+ case _: String => Some("String")
+ case _: List[_] => Some("List")
+ case _: Int => Some("Int")
+ case _ => None
+ }
+}
+
+object Test {
+ def f(x: Any) = x match {
+ case ValueOpt(s) => s
+ case _ => "Something else"
+ }
+ def g(x: Any) = x match {
+ case RegularOpt(s) => s
+ case _ => "Something else"
+ }
+ val xs = List("abc", Nil, 5, Test)
+
+ def main(args: Array[String]): Unit = {
+ xs map f foreach println
+ xs map g foreach println
+ }
+}
diff --git a/test/files/run/value-class-extractor-seq.check b/test/files/run/value-class-extractor-seq.check
new file mode 100644
index 0000000000..84552a7aa5
--- /dev/null
+++ b/test/files/run/value-class-extractor-seq.check
@@ -0,0 +1,3 @@
+Bip(1, 2, 3)
+Bip(1, 2, c @ Array(3, 4, 5): _*)
+class [I
diff --git a/test/files/run/value-class-extractor-seq.scala b/test/files/run/value-class-extractor-seq.scala
new file mode 100644
index 0000000000..f17a5314f2
--- /dev/null
+++ b/test/files/run/value-class-extractor-seq.scala
@@ -0,0 +1,59 @@
+import scala.runtime.ScalaRunTime.stringOf
+
+final class ArrayOpt[T](val xs: Array[T]) extends AnyVal {
+ def isEmpty = xs == null
+ def get = xs
+}
+
+object Bip {
+ def mkInts(xs: Array[Short]) = xs map (_.toInt)
+ def unapplySeq(x: Any): ArrayOpt[Int] = x match {
+ case xs: Array[Int] => new ArrayOpt(xs)
+ case xs: Array[Short] => new ArrayOpt(mkInts(xs))
+ case _ => new ArrayOpt(null)
+ }
+ // public int[] unapplySeq(java.lang.Object);
+ // 0: aload_1
+ // 1: astore_2
+ // 2: aload_2
+ // 3: instanceof #52 // class "[I"
+ // 6: ifeq 20
+ // 9: aload_2
+ // 10: checkcast #52 // class "[I"
+ // 13: astore_3
+ // 14: aload_3
+ // 15: astore 4
+ // 17: goto 47
+ // 20: aload_2
+ // 21: instanceof #58 // class "[S"
+ // 24: ifeq 44
+ // 27: aload_2
+ // 28: checkcast #58 // class "[S"
+ // 31: astore 5
+ // 33: aload_0
+ // 34: aload 5
+ // 36: invokevirtual #60 // Method mkInts:([S)[I
+ // 39: astore 4
+ // 41: goto 47
+ // 44: aconst_null
+ // 45: astore 4
+ // 47: aload 4
+ // 49: areturn
+}
+
+object Test {
+ def f(x: Any) = x match {
+ case Bip(a, b, c) => s"Bip($a, $b, $c)"
+ case Bip(a, b, c @ _*) => s"Bip($a, $b, c @ ${stringOf(c)}: _*)"
+ case _ => "" + x.getClass
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f(Array[Int](1,2,3)))
+ println(f(Array[Int](1,2,3,4,5)))
+ println(f(Array[Int](1)))
+ }
+ // Bip(1, 2, 3)
+ // Bip(1, 2, c @ [I@782be20e: _*)
+ // class [I
+}
diff --git a/test/files/run/value-class-extractor.check b/test/files/run/value-class-extractor.check
new file mode 100644
index 0000000000..e16447118c
--- /dev/null
+++ b/test/files/run/value-class-extractor.check
@@ -0,0 +1,9 @@
+'a'
+'b'
+'c'
+NoChar
+Some(a)
+Some(b)
+Some(c)
+None
+9
diff --git a/test/files/run/value-class-extractor.scala b/test/files/run/value-class-extractor.scala
new file mode 100644
index 0000000000..3eaffa0c23
--- /dev/null
+++ b/test/files/run/value-class-extractor.scala
@@ -0,0 +1,91 @@
+final class NonNullChar(val get: Char) extends AnyVal {
+ def isEmpty = get == 0.toChar
+ override def toString = if (isEmpty) "NoChar" else s"'$get'"
+}
+object NonNullChar {
+ @inline final val None = new NonNullChar(0.toChar)
+}
+
+final class SomeProduct extends Product3[String, Int, List[String]] {
+ def canEqual(x: Any) = x.isInstanceOf[SomeProduct]
+ def _1 = "abc"
+ def _2 = 5
+ def _3 = List("bippy")
+ def isEmpty = false
+ def get = this
+}
+object SomeProduct {
+ def unapply(x: SomeProduct) = x
+}
+
+object Test {
+ def prod(x: SomeProduct): Int = x match {
+ case SomeProduct(x, y, z) => x.length + y + z.length
+ case _ => -1
+ }
+
+ def f(x: Char): NonNullChar = x match {
+ case 'a' => new NonNullChar('a')
+ case 'b' => new NonNullChar('b')
+ case 'c' => new NonNullChar('c')
+ case _ => NonNullChar.None
+ }
+ // public char f(char);
+ // 0: iload_1
+ // 1: tableswitch { // 97 to 99
+ // 97: 47
+ // 98: 42
+ // 99: 37
+ // default: 28
+ // }
+ // 28: getstatic #19 // Field NonNullChar$.MODULE$:LNonNullChar$;
+ // 31: invokevirtual #23 // Method NonNullChar$.None:()C
+ // 34: goto 49
+ // 37: bipush 99
+ // 39: goto 49
+ // 42: bipush 98
+ // 44: goto 49
+ // 47: bipush 97
+ // 49: ireturn
+ def g(x: Char): Option[Char] = x match {
+ case 'a' => Some('a')
+ case 'b' => Some('b')
+ case 'c' => Some('c')
+ case _ => None
+ }
+ // public scala.Option<java.lang.Object> g(char);
+ // 0: iload_1
+ // 1: tableswitch { // 97 to 99
+ // 97: 64
+ // 98: 49
+ // 99: 34
+ // default: 28
+ // }
+ // 28: getstatic #33 // Field scala/None$.MODULE$:Lscala/None$;
+ // 31: goto 76
+ // 34: new #35 // class scala/Some
+ // 37: dup
+ // 38: bipush 99
+ // 40: invokestatic #41 // Method scala/runtime/BoxesRunTime.boxToCharacter:(C)Ljava/lang/Character;
+ // 43: invokespecial #44 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 46: goto 76
+ // 49: new #35 // class scala/Some
+ // 52: dup
+ // 53: bipush 98
+ // 55: invokestatic #41 // Method scala/runtime/BoxesRunTime.boxToCharacter:(C)Ljava/lang/Character;
+ // 58: invokespecial #44 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 61: goto 76
+ // 64: new #35 // class scala/Some
+ // 67: dup
+ // 68: bipush 97
+ // 70: invokestatic #41 // Method scala/runtime/BoxesRunTime.boxToCharacter:(C)Ljava/lang/Character;
+ // 73: invokespecial #44 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 76: areturn
+ def main(args: Array[String]): Unit = {
+ "abcd" foreach (ch => println(f(ch)))
+ "abcd" foreach (ch => println(g(ch)))
+ println(prod(new SomeProduct))
+ }
+}
+
+
diff --git a/test/files/run/value-class-partial-func-depmet.scala b/test/files/run/value-class-partial-func-depmet.scala
new file mode 100644
index 0000000000..12ff64ed36
--- /dev/null
+++ b/test/files/run/value-class-partial-func-depmet.scala
@@ -0,0 +1,24 @@
+class C
+class A { class C }
+
+object Test {
+ def main(args: Array[String]) {
+ val a = new A
+
+ new VC("").foo(a)
+ }
+}
+
+class VC(val a: Any) extends AnyVal {
+ def foo(a: A) = {
+ val pf: PartialFunction[a.C, Any] = { case x => x }
+ (pf: PartialFunction[Null, Any]).isDefinedAt(null)
+ }
+}
+
+// 2.11.0-M6
+// test/files/run/value-class-partial-func-depmet.scala:14: error: overriding method applyOrElse in trait PartialFunction of type [A1 <: a.C, B1 >: Any](x: A1, default: A1 => B1)B1;
+// method applyOrElse has incompatible type
+// val pf: PartialFunction[a.C, Any] = { case x => x }
+// ^
+// one error found
diff --git a/test/files/run/valueclasses-classmanifest-basic.scala b/test/files/run/valueclasses-classmanifest-basic.scala
index c2aa08ef86..50addda359 100644
--- a/test/files/run/valueclasses-classmanifest-basic.scala
+++ b/test/files/run/valueclasses-classmanifest-basic.scala
@@ -1,5 +1,6 @@
class Foo(val x: Int) extends AnyVal
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
println(classManifest[Foo])
-} \ No newline at end of file
+}
diff --git a/test/files/run/valueclasses-classmanifest-existential.scala b/test/files/run/valueclasses-classmanifest-existential.scala
index 11999df678..6bcd7cf942 100644
--- a/test/files/run/valueclasses-classmanifest-existential.scala
+++ b/test/files/run/valueclasses-classmanifest-existential.scala
@@ -1,5 +1,6 @@
class Foo[T](val x: T) extends AnyVal
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
println(classManifest[Foo[_]])
-} \ No newline at end of file
+}
diff --git a/test/files/run/valueclasses-classmanifest-generic.scala b/test/files/run/valueclasses-classmanifest-generic.scala
index 280152dc1d..5efcaed959 100644
--- a/test/files/run/valueclasses-classmanifest-generic.scala
+++ b/test/files/run/valueclasses-classmanifest-generic.scala
@@ -1,5 +1,6 @@
class Foo[T](val x: T) extends AnyVal
+@deprecated("Suppress warnings", since="2.11")
object Test extends App {
println(classManifest[Foo[String]])
-} \ No newline at end of file
+}
diff --git a/test/files/run/var-arity-class-symbol.scala b/test/files/run/var-arity-class-symbol.scala
new file mode 100644
index 0000000000..29fe960eb3
--- /dev/null
+++ b/test/files/run/var-arity-class-symbol.scala
@@ -0,0 +1,19 @@
+import scala.reflect.runtime.universe._, definitions._
+object Test extends App {
+ // Tuples
+ assert(TupleClass.seq.size == 22)
+ assert(TupleClass(0) == NoSymbol)
+ assert(TupleClass(23) == NoSymbol)
+ assert((1 to 22).forall { i => TupleClass(i).name.toString == s"Tuple$i" })
+ // Functions
+ assert(FunctionClass.seq.size == 23)
+ assert(FunctionClass(-1) == NoSymbol)
+ assert(FunctionClass(23) == NoSymbol)
+ assert((0 to 22).forall { i => FunctionClass(i).name.toString == s"Function$i" })
+ // Products
+ assert(ProductClass.seq.size == 23)
+ assert(ProductClass(-1) == NoSymbol)
+ assert(ProductClass(0) == UnitClass)
+ assert(ProductClass(23) == NoSymbol)
+ assert((1 to 22).forall { i => ProductClass(i).name.toString == s"Product$i" })
+}
diff --git a/test/files/run/vector1.scala b/test/files/run/vector1.scala
index b37cfe82e8..d536183961 100644
--- a/test/files/run/vector1.scala
+++ b/test/files/run/vector1.scala
@@ -9,7 +9,7 @@ import scala.collection.mutable.Builder
object Test {
-
+
def vector(label: String, n: Int): Vector[String] = {
val a = new VectorBuilder[String]
for (i <- 0 until n)
@@ -67,7 +67,7 @@ object Test {
def test1() = {
println("===== test1 =====")
-
+
val N = 150000
val a = vector("a", N)
val b = vectorForward("b", N)
@@ -81,33 +81,33 @@ object Test {
println("===== test2 =====")
var a: Vector[String] = Vector.empty
-
+
val rand = new java.util.Random
-
+
val N = 150000
var min = N/2//rand.nextInt(N)
var max = min
-
+
val chunkLimit = 11
-
+
def nextChunkSize = 3 //rand.nextInt(chunkLimit)
-
+
def seqBack() = for (i <- 0 until Math.min(nextChunkSize, N-max)) { a = a :+ ("a"+max); max += 1 }
def seqFront() = for (i <- 0 until Math.min(nextChunkSize, min)) { min -= 1; a = ("a"+min) +: a }
-
+
try {
-
+
while (min > 0 || max < N) {
seqFront()
seqBack()
}
} catch {
- case ex =>
+ case ex: Throwable =>
//println("----------------")
//a.debug
throw ex
}
-
+
assertVector(a, "a", 0, N)
}
@@ -122,14 +122,14 @@ object Test {
val pos = scala.util.Random.shuffle(scala.collection.mutable.WrappedArray.make[Int](Array.tabulate[Int](N)(i => i)))
var b = a
-
+
{
var i = 0
while (i < N) {
b = b.updated(pos(i), "b"+(pos(i)))
i += 1
}
-
+
assertVector(b, "b", 0, N)
}
diff --git a/test/files/run/verify-ctor.scala b/test/files/run/verify-ctor.scala
index 17e4f71be5..528d038a8e 100644
--- a/test/files/run/verify-ctor.scala
+++ b/test/files/run/verify-ctor.scala
@@ -1,6 +1,6 @@
class Foo(val str: String) {
def this(arr: Array[Char]) = this({
- if (arr.length == 0) exit(1)
+ if (arr.length == 0) sys.exit(1)
new String(arr)
})
}
diff --git a/test/files/run/view-headoption.scala b/test/files/run/view-headoption.scala
index 629b974c19..659c7e6b82 100644
--- a/test/files/run/view-headoption.scala
+++ b/test/files/run/view-headoption.scala
@@ -2,13 +2,13 @@ object Test {
val failer = () => { println("fail") ; None }
val succeeder = () => { println("success") ; Some(5) }
val fs = List(failer, succeeder, failer, failer, succeeder, failer, failer, failer, succeeder)
-
+
def f0 = fs.view flatMap (f => f())
def f1 = f0.headOption
def f2 = f0.head
def f3 = f0.lastOption
def f4 = f0.last
-
+
def main(args: Array[String]): Unit = {
println("f1: " + f1)
println("f2: " + f2)
diff --git a/test/files/run/view-iterator-stream.scala b/test/files/run/view-iterator-stream.scala
index f91407f92c..0e0c42d7d3 100644
--- a/test/files/run/view-iterator-stream.scala
+++ b/test/files/run/view-iterator-stream.scala
@@ -1,3 +1,6 @@
+
+import scala.language.postfixOps
+
import scala.collection.{ mutable, immutable, generic }
import collection.TraversableView
@@ -18,7 +21,7 @@ object Test {
}
def and(g: Perturber): Perturber =
new Perturber(this.labels ++ g.labels, f andThen g.f)
-
+
override def toString = labels mkString " -> "
}
object Perturber {
@@ -39,14 +42,14 @@ object Test {
"slice(%d, %d)".format(from, until),
_.toTraversable.slice(from, until)
)
-
+
val fns = List[Perturber](toV, toI, toS, toIS)
def tds(n: Int): Perturber = p(drop(n), take(n / 2), slice(1, n / 4))
def dts(n: Int): Perturber = p(take(n), drop(n / 2), slice(1, n / 4))
def sdt(n: Int): Perturber = p(slice(n, n * 2), drop(n / 2), take(n / 4))
def std(n: Int): Perturber = p(slice(n, n * 2), take(n / 2), drop(n / 4))
-
+
val transforms = (fns.permutations map (xs => p(xs take 3: _*))).toList.distinct
def mkOps(n: Int) = List[Perturber](tds(n), dts(n), sdt(n), std(n))
def runOps(n: Int) = {
@@ -60,7 +63,7 @@ object Test {
}
()
}
-
+
def main(args: Array[String]): Unit = {
runOps(20)
}
diff --git a/test/files/run/viewtest.scala b/test/files/run/viewtest.scala
index bb2c28d68a..581958e9a6 100755
--- a/test/files/run/viewtest.scala
+++ b/test/files/run/viewtest.scala
@@ -25,8 +25,8 @@ object Test extends App {
2.8 regression: CCE when zipping list projection with stream
Reported by: szeiger Owned by: odersky
Priority: normal Component: Standard Library
-Keywords: collections, zip Cc:
-Fixed in version:
+Keywords: collections, zip Cc:
+Fixed in version:
Description
Welcome to Scala version 2.8.0.r18784-b20090925021043 (Java HotSpot(TM) Client VM, Java 1.6.0_11).
diff --git a/test/files/run/virtpatmat_alts.check b/test/files/run/virtpatmat_alts.check
index 7a4ad0a741..f39e292fef 100644
--- a/test/files/run/virtpatmat_alts.check
+++ b/test/files/run/virtpatmat_alts.check
@@ -1 +1,7 @@
+virtpatmat_alts.scala:5: warning: match may not be exhaustive.
+ (true, true) match {
+ ^
+virtpatmat_alts.scala:9: warning: match may not be exhaustive.
+ List(5) match {
+ ^
OK 5
diff --git a/test/files/run/virtpatmat_alts.flags b/test/files/run/virtpatmat_alts.flags
deleted file mode 100644
index 3f5a3100e4..0000000000
--- a/test/files/run/virtpatmat_alts.flags
+++ /dev/null
@@ -1 +0,0 @@
- -Xexperimental
diff --git a/test/files/run/virtpatmat_alts.scala b/test/files/run/virtpatmat_alts.scala
index b7717524e2..d1dfa8a4a1 100644
--- a/test/files/run/virtpatmat_alts.scala
+++ b/test/files/run/virtpatmat_alts.scala
@@ -1,3 +1,6 @@
+/*
+ * filter: It would fail on the following input
+ */
object Test extends App {
(true, true) match {
case (true, true) | (false, false) => 1
@@ -9,4 +12,4 @@ object Test extends App {
case 7 :: Nil => println("FAILED")
case Nil => println("FAILED")
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/virtpatmat_apply.scala b/test/files/run/virtpatmat_apply.scala
index 34cb80e449..b8776f4afb 100644
--- a/test/files/run/virtpatmat_apply.scala
+++ b/test/files/run/virtpatmat_apply.scala
@@ -1,5 +1,5 @@
object Test extends App {
- List(1, 2, 3) match {
+ List(1, 2, 3) match {
case Nil => println("FAIL")
case x :: y :: xs if xs.length == 2 => println("FAIL")
case x :: y :: xs if xs.length == 1 => println("OK "+ y)
diff --git a/test/files/run/virtpatmat_casting.scala b/test/files/run/virtpatmat_casting.scala
index d970abae90..a36daec6fb 100644
--- a/test/files/run/virtpatmat_casting.scala
+++ b/test/files/run/virtpatmat_casting.scala
@@ -1,8 +1,9 @@
object Test extends App {
- println(List(1,2,3) match {
- case Nil => List(0)
-// since the :: extractor's argument must be a ::, there has to be a cast before its unapply is invoked
+ println(List(1,2,3) match {
+ case Nil => List(0)
+// since the :: extractor's argument must be a ::, there has to be a cast before its unapply is invoked
case x :: y :: z :: a :: xs => xs ++ List(x)
case x :: y :: z :: xs => xs ++ List(x)
+ case _ => List(0)
})
}
diff --git a/test/files/run/virtpatmat_literal.scala b/test/files/run/virtpatmat_literal.scala
index 5bd6b30791..9a68d296b5 100644
--- a/test/files/run/virtpatmat_literal.scala
+++ b/test/files/run/virtpatmat_literal.scala
@@ -1,22 +1,22 @@
object Test extends App {
val a = 1
- 1 match {
- case 2 => println("FAILED")
- case 1 => println("OK")
- case `a` => println("FAILED")
+ 1 match {
+ case 2 => println("FAILED")
+ case 1 => println("OK")
+ case `a` => println("FAILED")
}
val one = 1
- 1 match {
- case 2 => println("FAILED")
- case `one` => println("OK")
- case 1 => println("FAILED")
+ 1 match {
+ case 2 => println("FAILED")
+ case `one` => println("OK")
+ case 1 => println("FAILED")
}
- 1 match {
- case 2 => println("FAILED")
- case Test.one => println("OK")
- case 1 => println("FAILED")
+ 1 match {
+ case 2 => println("FAILED")
+ case Test.one => println("OK")
+ case 1 => println("FAILED")
}
} \ No newline at end of file
diff --git a/test/files/run/virtpatmat_nested_lists.check b/test/files/run/virtpatmat_nested_lists.check
index d8263ee986..ddf68eeedd 100644
--- a/test/files/run/virtpatmat_nested_lists.check
+++ b/test/files/run/virtpatmat_nested_lists.check
@@ -1 +1,4 @@
-2 \ No newline at end of file
+virtpatmat_nested_lists.scala:5: warning: match may not be exhaustive.
+ List(List(1), List(2)) match { case x :: (y :: Nil) :: Nil => println(y) }
+ ^
+2
diff --git a/test/files/run/virtpatmat_nested_lists.flags b/test/files/run/virtpatmat_nested_lists.flags
deleted file mode 100644
index 3f5a3100e4..0000000000
--- a/test/files/run/virtpatmat_nested_lists.flags
+++ /dev/null
@@ -1 +0,0 @@
- -Xexperimental
diff --git a/test/files/run/virtpatmat_nested_lists.scala b/test/files/run/virtpatmat_nested_lists.scala
index fef74cea15..d1aa68ea93 100644
--- a/test/files/run/virtpatmat_nested_lists.scala
+++ b/test/files/run/virtpatmat_nested_lists.scala
@@ -1,3 +1,6 @@
+/*
+ * filter: It would fail on the following input
+ */
object Test extends App {
List(List(1), List(2)) match { case x :: (y :: Nil) :: Nil => println(y) }
}
diff --git a/test/files/run/virtpatmat_opt_sharing.check b/test/files/run/virtpatmat_opt_sharing.check
index d00491fd7e..78ec61f19d 100644
--- a/test/files/run/virtpatmat_opt_sharing.check
+++ b/test/files/run/virtpatmat_opt_sharing.check
@@ -1 +1,4 @@
+virtpatmat_opt_sharing.scala:7: warning: match may not be exhaustive.
+ List(1, 3, 4, 7) match {
+ ^
1
diff --git a/test/files/run/virtpatmat_opt_sharing.flags b/test/files/run/virtpatmat_opt_sharing.flags
deleted file mode 100644
index 3f5a3100e4..0000000000
--- a/test/files/run/virtpatmat_opt_sharing.flags
+++ /dev/null
@@ -1 +0,0 @@
- -Xexperimental
diff --git a/test/files/run/virtpatmat_opt_sharing.scala b/test/files/run/virtpatmat_opt_sharing.scala
index 119e3050ea..d2c42cab48 100644
--- a/test/files/run/virtpatmat_opt_sharing.scala
+++ b/test/files/run/virtpatmat_opt_sharing.scala
@@ -1,3 +1,6 @@
+/*
+ * filter: It would fail on the following input
+ */
object Test extends App {
virtMatch()
def virtMatch() = {
@@ -7,4 +10,4 @@ object Test extends App {
case 1 :: 3 :: 4 :: 7 :: x => println(1)
}
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/virtpatmat_staging.flags b/test/files/run/virtpatmat_staging.flags
index 48fd867160..0a22f7c729 100644
--- a/test/files/run/virtpatmat_staging.flags
+++ b/test/files/run/virtpatmat_staging.flags
@@ -1 +1,2 @@
+-Yrangepos:false
-Xexperimental
diff --git a/test/files/run/virtpatmat_staging.scala b/test/files/run/virtpatmat_staging.scala
index c17b45043b..d444829b02 100644
--- a/test/files/run/virtpatmat_staging.scala
+++ b/test/files/run/virtpatmat_staging.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ higherKinds, implicitConversions }
+
trait Intf {
type Rep[+T]
type M[+T] = Rep[Maybe[T]]
@@ -9,7 +12,7 @@ trait Intf {
def zero: M[Nothing]
def one[T](x: Rep[T]): M[T]
- def guard[T](cond: Rep[Boolean], then: => Rep[T]): M[T]
+ def guard[T](cond: Rep[Boolean], dann: => Rep[T]): M[T]
def isSuccess[T, U](x: Rep[T])(f: Rep[T] => M[U]): Rep[Boolean] // used for isDefinedAt
}
@@ -33,7 +36,7 @@ trait Impl extends Intf {
def runOrElse[T, U](in: Rep[T])(matcher: Rep[T] => M[U]): Rep[U] = ("runOrElse("+ in +", ?" + matcher("?") + ")")
def zero: M[Nothing] = "zero"
def one[T](x: Rep[T]): M[T] = "one("+x.toString+")"
- def guard[T](cond: Rep[Boolean], then: => Rep[T]): M[T] = "guard("+cond+","+then+")"
+ def guard[T](cond: Rep[Boolean], dann: => Rep[T]): M[T] = s"guard($cond,$dann)"
def isSuccess[T, U](x: Rep[T])(f: Rep[T] => M[U]): Rep[Boolean] = ("isSuccess("+x+", ?" + f("?") + ")")
}
diff --git a/test/files/run/virtpatmat_stringinterp.scala b/test/files/run/virtpatmat_stringinterp.scala
index 213712f17a..c6c951e6e5 100644
--- a/test/files/run/virtpatmat_stringinterp.scala
+++ b/test/files/run/virtpatmat_stringinterp.scala
@@ -1,3 +1,6 @@
+
+import scala.language.{ implicitConversions }
+
object Test extends App {
case class Node(x: Int)
@@ -10,4 +13,4 @@ object Test extends App {
val x: Node = Node(0)
x match { case xml"""<foo arg=$a/>""" => println(a) }
-} \ No newline at end of file
+}
diff --git a/test/files/run/virtpatmat_switch.scala b/test/files/run/virtpatmat_switch.scala
index 1329c19d0f..2f2e210d9e 100644
--- a/test/files/run/virtpatmat_switch.scala
+++ b/test/files/run/virtpatmat_switch.scala
@@ -4,11 +4,11 @@ object Test extends App {
case 1 => "one"
case _ => "many"
}
-
+
println(intSwitch(0))
println(intSwitch(1))
println(intSwitch(10))
-
+
def charSwitch(x: Char) = x match {
case 'a' => "got a"
case 'b' => "got b"
@@ -20,15 +20,15 @@ object Test extends App {
case 'b' => "got b"
case _ => "got some letter"
}
-
+
println(charSwitch('a'))
println(byteSwitch('b'))
println(charSwitch('z'))
-
+
def implicitDefault(x: Int) = x match {
case 0 => 0
}
-
+
try {
implicitDefault(5)
} catch {
diff --git a/test/files/run/virtpatmat_try.scala b/test/files/run/virtpatmat_try.scala
index 46e67cb72e..dab2c89227 100644
--- a/test/files/run/virtpatmat_try.scala
+++ b/test/files/run/virtpatmat_try.scala
@@ -8,7 +8,7 @@ object Test extends App {
} catch { // this should emit a "catch-switch"
case y: A => println(y.x)
case (_ : A | _ : B) => println("B")
- case _ => println("other")
+ case _: Throwable => println("other")
}
try {
@@ -17,7 +17,7 @@ object Test extends App {
// case A(x) => println(x)
case y: A => println(y.x)
case x@((_ : A) | (_ : B)) => println(x)
- case _ => println("other")
+ case _: Throwable => println("other")
}
def simpleTry {
@@ -34,7 +34,7 @@ object Test extends App {
}
def wildcardTry {
- try { bla } catch { case _ => bla }
+ try { bla } catch { case _: Throwable => bla }
}
def tryPlusFinally {
@@ -44,4 +44,4 @@ object Test extends App {
def catchAndPassToLambda {
try { bla } catch { case ex: Exception => val f = () => ex }
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/virtpatmat_typed.check b/test/files/run/virtpatmat_typed.check
index cec2740d18..b304fa5ffc 100644
--- a/test/files/run/virtpatmat_typed.check
+++ b/test/files/run/virtpatmat_typed.check
@@ -1 +1,4 @@
+virtpatmat_typed.scala:5: warning: unreachable code
+ case x: String => println("FAILED")
+ ^
OK foo
diff --git a/test/files/run/virtpatmat_typed.scala b/test/files/run/virtpatmat_typed.scala
index a9863cc48a..cdd6d3c749 100644
--- a/test/files/run/virtpatmat_typed.scala
+++ b/test/files/run/virtpatmat_typed.scala
@@ -1,7 +1,7 @@
object Test extends App {
- ("foo": Any) match {
- case x: Int => println("FAILED")
- case x: String => println("OK "+ x)
- case x: String => println("FAILED")
+ ("foo": Any) match {
+ case x: Int => println("FAILED")
+ case x: String => println("OK "+ x)
+ case x: String => println("FAILED")
}
} \ No newline at end of file
diff --git a/test/files/run/virtpatmat_unapply.scala b/test/files/run/virtpatmat_unapply.scala
index 6d7b4dbe68..a6e71f3963 100644
--- a/test/files/run/virtpatmat_unapply.scala
+++ b/test/files/run/virtpatmat_unapply.scala
@@ -6,12 +6,12 @@ object IntList {
}
object Test extends App {
- IntList(1, IntList(2, NilIL)) match {
+ IntList(1, IntList(2, NilIL)) match {
case IntList(a1, IntList(a2, IntList(a3, y))) => println(a1 + a2 + a3)
case IntList(x, y) => println(x)
}
- IntList(1, IntList(2, IntList(3, NilIL))) match {
+ IntList(1, IntList(2, IntList(3, NilIL))) match {
case IntList(a1, IntList(a2, IntList(a3, y))) => println(a1 + a2 + a3)
case IntList(x, y) => println(x)
}
@@ -20,12 +20,12 @@ object Test extends App {
// ((x1: IntList) => IntList.unapply(x1).flatMap(((x4: (Int, IntList)) => IntList.unapply(x4._2).flatMap(((x5: (Int, IntList)) => IntList.unapply(x5._2).flatMap(((x6: (Int, IntList)) => implicitly[Predef.MatchingStrategy[Option]].success(Predef.println(x4._1.+(x5._1).+(x6._1))))))))).orElse(IntList.unapply(x1).flatMap(((x7: (Int, IntList)) => implicitly[scala.Predef.MatchingStrategy[Option]].success(Predef.println(x7._1))))).orElse(implicitly[scala.Predef.MatchingStrategy[Option]].fail))(IntList.apply(1, IntList.apply(2, IntList.apply(3, null))))
/*
- ((x1: IntList) =>
- IntList.this.unapply(x1).flatMap[Int](((x4: (Int, IntList)) =>
- IntList.this.unapply(x4._2).flatMap[Int](((x5: (Int, IntList)) =>
- IntList.this.unapply(x5._2).flatMap[Int](((x6: (Int, IntList)) =>
+ ((x1: IntList) =>
+ IntList.this.unapply(x1).flatMap[Int](((x4: (Int, IntList)) =>
+ IntList.this.unapply(x4._2).flatMap[Int](((x5: (Int, IntList)) =>
+ IntList.this.unapply(x5._2).flatMap[Int](((x6: (Int, IntList)) =>
Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).success[Int](x6._1))))))).orElse[Int](
- IntList.this.unapply(x1).flatMap[Int](((x7: (Int, IntList)) =>
+ IntList.this.unapply(x1).flatMap[Int](((x7: (Int, IntList)) =>
Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).success[Int](x7._1)))).orElse[Int](
Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).fail)
).apply(IntList.apply(1, null))
diff --git a/test/files/run/withIndex.scala b/test/files/run/withIndex.scala
index 910b1f1f9e..ebf1941c95 100644
--- a/test/files/run/withIndex.scala
+++ b/test/files/run/withIndex.scala
@@ -11,7 +11,7 @@ object Test {
Console.println(str.zipWithIndex.toList)
assert {
ary.zipWithIndex match {
- case _: Array[Pair[_,_]] => true
+ case _: Array[Tuple2[_,_]] => true
case _ => false
}
}
diff --git a/test/files/run/xml-attribute.check b/test/files/run/xml-attribute.check
deleted file mode 100644
index 3cfe3779fc..0000000000
--- a/test/files/run/xml-attribute.check
+++ /dev/null
@@ -1,12 +0,0 @@
-<t/>
-<t/>
-<t/>
-<t/>
-<t/>
-<t b="1" d="2"/>
-<t b="1" d="2"/>
-<t b="1" d="2"/>
-<t a="1" d="2"/>
-<t b="1" d="2"/>
-<t a="1" b="2" c="3"/>
-<t g="1" e="2" p:a="3" f:e="4" mgruhu:ji="5"/>
diff --git a/test/files/run/xml-attribute.scala b/test/files/run/xml-attribute.scala
deleted file mode 100644
index eb3956c41b..0000000000
--- a/test/files/run/xml-attribute.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-import xml.Node
-
-object Test {
- def main(args: Array[String]): Unit = {
- val noAttr = <t/>
- val attrNull = <t a={ null: String }/>
- val attrNone = <t a={ None: Option[Seq[Node]] }/>
- val preAttrNull = <t p:a={ null: String }/>
- val preAttrNone = <t p:a={ None: Option[Seq[Node]] }/>
- assert(noAttr == attrNull)
- assert(noAttr == attrNone)
- assert(noAttr == preAttrNull)
- assert(noAttr == preAttrNone)
-
- println(noAttr)
- println(attrNull)
- println(attrNone)
- println(preAttrNull)
- println(preAttrNone)
-
- val xml1 = <t b="1" d="2"/>
- val xml2 = <t a={ null: String } p:a={ null: String } b="1" c={ null: String } d="2"/>
- val xml3 = <t b="1" c={ null: String } d="2" a={ null: String } p:a={ null: String }/>
- assert(xml1 == xml2)
- assert(xml1 == xml3)
-
- println(xml1)
- println(xml2)
- println(xml3)
-
- // Check if attribute order is retained
- println(<t a="1" d="2"/>)
- println(<t b="1" d="2"/>)
- println(<t a="1" b="2" c="3"/>)
- println(<t g="1" e="2" p:a="3" f:e="4" mgruhu:ji="5"/>)
- }
-}
diff --git a/test/files/run/xml-loop-bug.scala b/test/files/run/xml-loop-bug.scala
deleted file mode 100644
index 67637674b2..0000000000
--- a/test/files/run/xml-loop-bug.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-object Test {
- def main(args: Array[String]): Unit = {
- val sink = new java.io.PrintStream(new java.io.ByteArrayOutputStream())
- Console setOut sink
- Console setErr sink
- scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString("<!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> "), true).document.docElem
- }
-}