summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/disabled/presentation/doc.check (renamed from test/files/presentation/doc.check)0
-rwxr-xr-xtest/disabled/presentation/doc/doc.scala (renamed from test/files/presentation/doc/doc.scala)0
-rwxr-xr-xtest/disabled/presentation/doc/src/Class.scala (renamed from test/files/presentation/doc/src/Class.scala)0
-rwxr-xr-xtest/disabled/presentation/doc/src/p/Base.scala (renamed from test/files/presentation/doc/src/p/Base.scala)0
-rwxr-xr-xtest/disabled/presentation/doc/src/p/Derived.scala (renamed from test/files/presentation/doc/src/p/Derived.scala)0
-rw-r--r--test/disabled/run/reflection-sync-subtypes.check0
-rw-r--r--test/disabled/run/reflection-sync-subtypes.scala20
-rw-r--r--test/disabled/run/t4602.scala (renamed from test/files/disabled/run/t4602.scala)0
-rw-r--r--test/files/continuations-run/t5472.check12
-rw-r--r--test/files/jvm/deprecation.check2
-rw-r--r--test/files/neg/accesses.check6
-rw-r--r--test/files/neg/accesses2.check4
-rw-r--r--test/files/neg/accesses2.scala11
-rw-r--r--test/files/neg/any-vs-anyref.check18
-rw-r--r--test/files/neg/anyval-anyref-parent.check4
-rw-r--r--test/files/neg/applydynamic_sip.check17
-rw-r--r--test/files/neg/checksensible.check17
-rw-r--r--test/files/neg/classmanifests_new_deprecations.check4
-rw-r--r--test/files/neg/divergent-implicit.check20
-rw-r--r--test/files/neg/for-comprehension-old.check8
-rw-r--r--test/files/neg/forgot-interpolator.check30
-rw-r--r--test/files/neg/forgot-interpolator.scala58
-rw-r--r--test/files/neg/found-req-variance.check20
-rw-r--r--test/files/neg/gadts2-strict.check6
-rw-r--r--test/files/neg/gadts2-strict.flags1
-rw-r--r--test/files/neg/gadts2-strict.scala26
-rw-r--r--test/files/neg/gadts2.check6
-rw-r--r--test/files/neg/gadts2.flags1
-rw-r--r--test/files/neg/gadts2.scala12
-rw-r--r--test/files/neg/lazyvals.check4
-rw-r--r--test/files/neg/macro-basic-mamdmi.check4
-rw-r--r--test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala9
-rw-r--r--test/files/neg/macro-bundle-abstract.check4
-rw-r--r--test/files/neg/macro-bundle-abstract.scala12
-rw-r--r--test/files/neg/macro-bundle-class.check4
-rw-r--r--test/files/neg/macro-bundle-class.scala11
-rw-r--r--test/files/neg/macro-bundle-nonmacro.check4
-rw-r--r--test/files/neg/macro-bundle-nonmacro.scala9
-rw-r--r--test/files/neg/macro-bundle-object.check8
-rw-r--r--test/files/neg/macro-bundle-object.scala12
-rw-r--r--test/files/neg/macro-bundle-polymorphic.check10
-rw-r--r--test/files/neg/macro-bundle-polymorphic.scala13
-rw-r--r--test/files/neg/macro-bundle-trait.check4
-rw-r--r--test/files/neg/macro-bundle-trait.scala12
-rw-r--r--test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala2
-rw-r--r--test/files/neg/macro-invalidimpl.check2
-rw-r--r--test/files/neg/macro-invalidimpl/Impls_1.scala3
-rw-r--r--test/files/neg/macro-invalidret.check2
-rw-r--r--test/files/neg/macro-invalidshape/Macros_Test_2.scala2
-rw-r--r--test/files/neg/macro-invalidsig-params-badtype.check1
-rw-r--r--test/files/neg/macro-invalidsig.check11
-rw-r--r--test/files/neg/macro-invalidsig/Impls_1.scala22
-rw-r--r--test/files/neg/macro-invalidusage-badbounds/Impls_1.scala2
-rw-r--r--test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala3
-rw-r--r--test/files/neg/macro-invalidusage-presuper/Impls_1.scala2
-rw-r--r--test/files/neg/macro-override-method-overrides-macro/Impls_1.scala3
-rw-r--r--test/files/neg/macro-quasiquotes.check3
-rw-r--r--test/files/neg/macro-without-xmacros-a/Impls_1.scala6
-rw-r--r--test/files/neg/macro-without-xmacros-b/Impls_1.scala6
-rw-r--r--test/files/neg/multi-array.check2
-rw-r--r--test/files/neg/names-defaults-neg.check18
-rw-r--r--test/files/neg/nested-annotation.check2
-rw-r--r--test/files/neg/newpat_unreachable.check8
-rw-r--r--test/files/neg/no-implicit-to-anyref.check2
-rw-r--r--test/files/neg/no-predef.check2
-rw-r--r--test/files/neg/package-ob-case.check5
-rw-r--r--test/files/neg/parser-errors.check16
-rw-r--r--test/files/neg/parser-errors.scala5
-rw-r--r--test/files/neg/parser-import-errors.check28
-rw-r--r--test/files/neg/parser-import-errors.scala49
-rw-r--r--test/files/neg/pat_unreachable.check5
-rw-r--r--test/files/neg/primitive-sigs-1.check2
-rw-r--r--test/files/neg/protected-constructors.check4
-rw-r--r--test/files/neg/quasiquotes-syntax-error-position.check4
-rw-r--r--test/files/neg/reflection-names-neg.check5
-rw-r--r--test/files/neg/run-gadts-strict.check21
-rw-r--r--test/files/neg/run-gadts-strict.flags1
-rw-r--r--test/files/neg/run-gadts-strict.scala18
-rw-r--r--test/files/neg/saito.check2
-rw-r--r--test/files/neg/sammy_restrictions.check49
-rw-r--r--test/files/neg/sammy_restrictions.flags1
-rw-r--r--test/files/neg/sammy_restrictions.scala45
-rw-r--r--test/files/neg/sammy_wrong_arity.check52
-rw-r--r--test/files/neg/sammy_wrong_arity.flags1
-rw-r--r--test/files/neg/sammy_wrong_arity.scala22
-rw-r--r--test/files/neg/sensitive.check2
-rw-r--r--test/files/neg/stringinterpolation_macro-neg.check2
-rw-r--r--test/files/neg/t0209.check2
-rw-r--r--test/files/neg/t0259.check4
-rw-r--r--test/files/neg/t0418.check5
-rw-r--r--test/files/neg/t1038.check2
-rw-r--r--test/files/neg/t1623.check2
-rw-r--r--test/files/neg/t1705.check2
-rw-r--r--test/files/neg/t2462b.check5
-rw-r--r--test/files/neg/t2462b.flags1
-rw-r--r--test/files/neg/t2462b.scala3
-rw-r--r--test/files/neg/t2462c.check7
-rw-r--r--test/files/neg/t2462c.flags1
-rw-r--r--test/files/neg/t2462c.scala25
-rw-r--r--test/files/neg/t2775.check2
-rw-r--r--test/files/neg/t3346b.check4
-rw-r--r--test/files/neg/t3346b.scala15
-rw-r--r--test/files/neg/t3346c.check4
-rw-r--r--test/files/neg/t3346c.scala61
-rw-r--r--test/files/neg/t3346i.check7
-rw-r--r--test/files/neg/t3346i.scala30
-rw-r--r--test/files/neg/t3453.check8
-rw-r--r--test/files/neg/t3653.check6
-rw-r--r--test/files/neg/t3692-new.check2
-rw-r--r--test/files/neg/t3971.check21
-rw-r--r--test/files/neg/t3971.scala12
-rw-r--r--test/files/neg/t3977.check2
-rw-r--r--test/files/neg/t4163.check7
-rw-r--r--test/files/neg/t418.check5
-rw-r--r--test/files/neg/t4417.check2
-rw-r--r--test/files/neg/t4515.check12
-rw-r--r--test/files/neg/t4727.check2
-rw-r--r--test/files/neg/t4818.check2
-rw-r--r--test/files/neg/t4851.check12
-rw-r--r--test/files/neg/t4987.check2
-rw-r--r--test/files/neg/t512.check5
-rw-r--r--test/files/neg/t5120.check4
-rw-r--r--test/files/neg/t5189.check4
-rw-r--r--test/files/neg/t5426.check8
-rw-r--r--test/files/neg/t545.check5
-rw-r--r--test/files/neg/t556.check5
-rw-r--r--test/files/neg/t5572.check7
-rw-r--r--test/files/neg/t5578.check5
-rw-r--r--test/files/neg/t5663-badwarneq.check5
-rw-r--r--test/files/neg/t5666.check24
-rw-r--r--test/files/neg/t5689.check1
-rw-r--r--test/files/neg/t5761.check7
-rw-r--r--test/files/neg/t5803.check2
-rw-r--r--test/files/neg/t5845.check7
-rw-r--r--test/files/neg/t588.check10
-rw-r--r--test/files/neg/t5903a.check5
-rw-r--r--test/files/neg/t5903b.check5
-rw-r--r--test/files/neg/t5903c.check5
-rw-r--r--test/files/neg/t5903d.check5
-rw-r--r--test/files/neg/t6048.check5
-rw-r--r--test/files/neg/t6074.check2
-rw-r--r--test/files/neg/t6120.check20
-rw-r--r--test/files/neg/t6120.flags1
-rw-r--r--test/files/neg/t6120.scala7
-rw-r--r--test/files/neg/t6123-explaintypes-macros.check1
-rw-r--r--test/files/neg/t6443c.check4
-rw-r--r--test/files/neg/t6601.check2
-rw-r--r--test/files/neg/t663.check6
-rw-r--r--test/files/neg/t6667b.check4
-rw-r--r--test/files/neg/t6680a.check11
-rw-r--r--test/files/neg/t6680a.scala18
-rw-r--r--test/files/neg/t6680b.flags1
-rw-r--r--test/files/neg/t6680c.check6
-rw-r--r--test/files/neg/t6680c.flags1
-rw-r--r--test/files/neg/t6829.check26
-rw-r--r--test/files/neg/t7020.check8
-rw-r--r--test/files/neg/t7157/Impls_Macros_1.scala24
-rw-r--r--test/files/neg/t7239.check4
-rw-r--r--test/files/neg/t7239.scala12
-rw-r--r--test/files/neg/t7385.check9
-rw-r--r--test/files/neg/t7473.check8
-rw-r--r--test/files/neg/t7473.scala4
-rw-r--r--test/files/neg/t7519-b.check6
-rw-r--r--test/files/neg/t7519-b/Mac_1.scala14
-rw-r--r--test/files/neg/t7519-b/Use_2.scala8
-rw-r--r--test/files/neg/t7519.check8
-rw-r--r--test/files/neg/t7629-view-bounds-deprecation.check11
-rw-r--r--test/files/neg/t7629-view-bounds-deprecation.flags1
-rw-r--r--test/files/neg/t7629-view-bounds-deprecation.scala4
-rw-r--r--test/files/neg/t771.check2
-rw-r--r--test/files/neg/t7721.check8
-rw-r--r--test/files/neg/t7756b.check5
-rw-r--r--test/files/neg/t7783.check18
-rw-r--r--test/files/neg/t7783.flags1
-rw-r--r--test/files/neg/t7783.scala15
-rw-r--r--test/files/neg/t7848-interp-warn.check9
-rw-r--r--test/files/neg/t7848-interp-warn.scala5
-rw-r--r--test/files/neg/t7859.check19
-rw-r--r--test/files/neg/t7859/A_1.scala5
-rw-r--r--test/files/neg/t7859/B_2.scala9
-rw-r--r--test/files/neg/t7870.check4
-rw-r--r--test/files/neg/t7870.scala3
-rw-r--r--test/files/neg/t7877.check7
-rw-r--r--test/files/neg/t7877.scala13
-rw-r--r--test/files/neg/t7886.check6
-rw-r--r--test/files/neg/t7886.scala22
-rw-r--r--test/files/neg/t7895.check4
-rw-r--r--test/files/neg/t7895.scala6
-rw-r--r--test/files/neg/t7895b.check7
-rw-r--r--test/files/neg/t7895b.scala5
-rw-r--r--test/files/neg/t7895c.check13
-rw-r--r--test/files/neg/t7895c.scala3
-rw-r--r--test/files/neg/t7899.check6
-rw-r--r--test/files/neg/t7899.scala7
-rw-r--r--test/files/neg/t997.check5
-rw-r--r--test/files/neg/typeerror.check7
-rw-r--r--test/files/neg/unreachablechar.check5
-rw-r--r--test/files/neg/valueclasses-doubledefs.check4
-rw-r--r--test/files/neg/valueclasses-pavlov.check4
-rw-r--r--test/files/neg/valueclasses.check43
-rw-r--r--test/files/neg/valueclasses.scala13
-rw-r--r--test/files/neg/warn-unused-privates.check5
-rw-r--r--test/files/neg/xmltruncated6.check2
-rw-r--r--test/files/pos/annotated-treecopy/Impls_Macros_1.scala6
-rw-r--r--test/files/pos/gadts2.scala2
-rw-r--r--test/files/pos/pattern-typing.scala29
-rw-r--r--test/files/pos/sammy_poly.flags1
-rw-r--r--test/files/pos/sammy_poly.scala7
-rw-r--r--test/files/pos/sammy_scope.flags1
-rw-r--r--test/files/pos/sammy_scope.scala8
-rw-r--r--test/files/pos/sammy_single.flags1
-rw-r--r--test/files/pos/sammy_single.scala9
-rw-r--r--test/files/pos/sammy_twice.flags1
-rw-r--r--test/files/pos/sammy_twice.scala9
-rw-r--r--test/files/pos/t5692a/Macros_1.scala2
-rw-r--r--test/files/pos/t5692b/Macros_1.scala2
-rw-r--r--test/files/pos/t5845.check0
-rw-r--r--test/files/pos/t5845.scala (renamed from test/files/neg/t5845.scala)0
-rw-r--r--test/files/pos/t6221.scala8
-rw-r--r--test/files/pos/t7461/Macros_1.scala2
-rw-r--r--test/files/pos/t7584.scala11
-rw-r--r--test/files/pos/t7649.scala2
-rw-r--r--test/files/pos/t7688.scala7
-rw-r--r--test/files/pos/t7815.scala30
-rw-r--r--test/files/pos/t7854.scala5
-rw-r--r--test/files/pos/t7902.scala17
-rw-r--r--test/files/res/t687.check6
-rw-r--r--test/files/run/constrained-types.check9
-rw-r--r--test/files/run/existential-rangepos.check6
-rw-r--r--test/files/run/future-flatmap-exec-count.check6
-rw-r--r--test/files/run/future-flatmap-exec-count.scala61
-rw-r--r--test/files/run/global-showdef.scala2
-rw-r--r--test/files/run/macro-abort-fresh.check2
-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.scala31
-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-bundle.flags)0
-rw-r--r--test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala26
-rw-r--r--test/files/run/macro-bundle-toplevel/Test_2.scala (renamed from test/files/run/macro-bundle/Test_2.scala)3
-rw-r--r--test/files/run/macro-bundle.check3
-rw-r--r--test/files/run/macro-bundle/Impls_Macros_1.scala13
-rw-r--r--test/files/run/macro-divergence-spurious/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-enclosures/Impls_Macros_1.scala17
-rw-r--r--test/files/run/macro-expand-tparams-bounds/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-prefix/Impls_1.scala15
-rw-r--r--test/files/run/macro-impl-default-params/Impls_Macros_1.scala13
-rw-r--r--test/files/run/macro-impl-rename-context/Impls_Macros_1.scala5
-rw-r--r--test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala2
-rw-r--r--test/files/run/macro-openmacros/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi.check3
-rw-r--r--test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-settings/Impls_Macros_1.scala7
-rw-r--r--test/files/run/macro-sip19-revised/Impls_Macros_1.scala3
-rw-r--r--test/files/run/macro-sip19/Impls_Macros_1.scala3
-rw-r--r--test/files/run/macro-system-properties.check2
-rw-r--r--test/files/run/macro-system-properties.scala2
-rw-r--r--test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala18
-rw-r--r--test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala5
-rw-r--r--test/files/run/macro-vampire-false-warning.check2
-rw-r--r--test/files/run/macro-vampire-false-warning.flags1
-rw-r--r--test/files/run/macro-vampire-false-warning/Macros_1.scala52
-rw-r--r--test/files/run/macro-vampire-false-warning/Test_2.scala6
-rw-r--r--test/files/run/patmatnew.scala2
-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/private-inline.check6
-rw-r--r--test/files/run/private-override.check1
-rw-r--r--test/files/run/private-override.scala17
-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-sync-potpourri.check0
-rw-r--r--test/files/run/reflection-sync-potpourri.scala32
-rw-r--r--test/files/run/repl-power.check13
-rw-r--r--test/files/run/repl-power.scala2
-rw-r--r--test/files/run/repl-reset.check6
-rw-r--r--test/files/run/repl-term-macros.check6
-rw-r--r--test/files/run/repl-term-macros.scala6
-rw-r--r--test/files/run/sammy_java8.flags1
-rw-r--r--test/files/run/sammy_java8.scala34
-rw-r--r--test/files/run/showraw_mods.check2
-rw-r--r--test/files/run/t2106.check3
-rw-r--r--test/files/run/t3346a.check1
-rw-r--r--test/files/run/t3346a.scala11
-rw-r--r--test/files/run/t3346b.check0
-rw-r--r--test/files/run/t3346c.check0
-rw-r--r--test/files/run/t3346d.check0
-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/t4542.check3
-rw-r--r--test/files/run/t4742.flags1
-rw-r--r--test/files/run/t4742.scala7
-rw-r--r--test/files/run/t5064.check8
-rw-r--r--test/files/run/t5385.check16
-rw-r--r--test/files/run/t5603.check26
-rw-r--r--test/files/run/t5894.scala2
-rw-r--r--test/files/run/t5923a/Macros_1.scala2
-rw-r--r--test/files/run/t5940.scala4
-rw-r--r--test/files/run/t6199-toolbox.scala2
-rw-r--r--test/files/run/t6240-universe-code-gen.check0
-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/t6288.check6
-rw-r--r--test/files/run/t6381.check6
-rw-r--r--test/files/run/t6381.scala6
-rw-r--r--test/files/run/t6392b.check2
-rw-r--r--test/files/run/t6768.check12
-rw-r--r--test/files/run/t6768.scala12
-rw-r--r--test/files/run/t7008-scala-defined/Impls_Macros_2.scala3
-rw-r--r--test/files/run/t7008/Impls_Macros_2.scala3
-rw-r--r--test/files/run/t7045.check2
-rw-r--r--test/files/run/t7045.scala12
-rw-r--r--test/files/run/t7047/Impls_Macros_1.scala2
-rw-r--r--test/files/run/t7271.check2
-rw-r--r--test/files/run/t7331c.check2
-rw-r--r--test/files/run/t7375b/Macros_1.scala2
-rw-r--r--test/files/run/t7398.scala8
-rw-r--r--test/files/run/t7584b.scala14
-rw-r--r--test/files/run/t7825.scala34
-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/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/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/toolbox_parse_package.check8
-rw-r--r--test/files/run/toolbox_parse_package.scala9
-rw-r--r--test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala2
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala54
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala24
-rw-r--r--test/files/scalacheck/quasiquotes/ErrorProps.scala5
-rw-r--r--test/files/scalacheck/quasiquotes/TermConstructionProps.scala19
-rw-r--r--test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala29
-rw-r--r--test/junit/scala/tools/nsc/symtab/StdNamesTest.scala8
-rw-r--r--test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala2
-rw-r--r--test/pending/neg/t6680a.scala13
-rw-r--r--test/pending/neg/t6680b.check6
-rw-r--r--test/pending/neg/t6680b.scala10
-rw-r--r--test/pending/neg/t6680c.scala17
-rw-r--r--test/pending/t7629-view-bounds-removal.check9
-rw-r--r--test/pending/t7629-view-bounds-removal.flags1
-rw-r--r--test/pending/t7629-view-bounds-removal.scala4
-rw-r--r--test/scaladoc/run/SI-4676.scala3
-rw-r--r--test/scaladoc/run/t7876.check1
-rw-r--r--test/scaladoc/run/t7876.scala19
-rw-r--r--test/scaladoc/run/t7876b.check3
-rw-r--r--test/scaladoc/run/t7876b.scala24
374 files changed, 2935 insertions, 656 deletions
diff --git a/test/files/presentation/doc.check b/test/disabled/presentation/doc.check
index 5a3ff13151..5a3ff13151 100644
--- a/test/files/presentation/doc.check
+++ b/test/disabled/presentation/doc.check
diff --git a/test/files/presentation/doc/doc.scala b/test/disabled/presentation/doc/doc.scala
index f2233f1828..f2233f1828 100755
--- a/test/files/presentation/doc/doc.scala
+++ b/test/disabled/presentation/doc/doc.scala
diff --git a/test/files/presentation/doc/src/Class.scala b/test/disabled/presentation/doc/src/Class.scala
index a974bd6f5c..a974bd6f5c 100755
--- a/test/files/presentation/doc/src/Class.scala
+++ b/test/disabled/presentation/doc/src/Class.scala
diff --git a/test/files/presentation/doc/src/p/Base.scala b/test/disabled/presentation/doc/src/p/Base.scala
index d91632b6f6..d91632b6f6 100755
--- a/test/files/presentation/doc/src/p/Base.scala
+++ b/test/disabled/presentation/doc/src/p/Base.scala
diff --git a/test/files/presentation/doc/src/p/Derived.scala b/test/disabled/presentation/doc/src/p/Derived.scala
index 1a9c9a26d1..1a9c9a26d1 100755
--- a/test/files/presentation/doc/src/p/Derived.scala
+++ b/test/disabled/presentation/doc/src/p/Derived.scala
diff --git a/test/disabled/run/reflection-sync-subtypes.check b/test/disabled/run/reflection-sync-subtypes.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/disabled/run/reflection-sync-subtypes.check
diff --git a/test/disabled/run/reflection-sync-subtypes.scala b/test/disabled/run/reflection-sync-subtypes.scala
new file mode 100644
index 0000000000..7f75a464ac
--- /dev/null
+++ b/test/disabled/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/disabled/run/t4602.scala b/test/disabled/run/t4602.scala
index 655c350497..655c350497 100644
--- a/test/files/disabled/run/t4602.scala
+++ b/test/disabled/run/t4602.scala
diff --git a/test/files/continuations-run/t5472.check b/test/files/continuations-run/t5472.check
index 1af7767f6d..2468b6b27d 100644
--- a/test/files/continuations-run/t5472.check
+++ b/test/files/continuations-run/t5472.check
@@ -5,7 +5,17 @@ t5472.scala:12: warning: expression case4(){
case5()
} is cps-transformed unexpectedly
(location, accessors) <- new ContinuationizedParallelIterable(map)
- ^
+ ^
+t5472.scala:12: warning: expression case5(){
+ matchEnd3(false)
+} is cps-transformed unexpectedly
+ (location, accessors) <- new ContinuationizedParallelIterable(map)
+ ^
+t5472.scala:12: warning: expression matchEnd3(x: Boolean){
+ x
+} is cps-transformed unexpectedly
+ (location, accessors) <- new ContinuationizedParallelIterable(map)
+ ^
t5472.scala:12: warning: expression matchEnd3(x: Int){
x
} is cps-transformed unexpectedly
diff --git a/test/files/jvm/deprecation.check b/test/files/jvm/deprecation.check
index e263e4909d..d116778d3f 100644
--- a/test/files/jvm/deprecation.check
+++ b/test/files/jvm/deprecation.check
@@ -1,3 +1,3 @@
-warning: there were 5 deprecation warning(s); re-run with -deprecation for details
+warning: there were 4 deprecation warning(s); re-run with -deprecation for details
Note: deprecation/Use_2.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
diff --git a/test/files/neg/accesses.check b/test/files/neg/accesses.check
index db58af12ce..5a5e03233e 100644
--- a/test/files/neg/accesses.check
+++ b/test/files/neg/accesses.check
@@ -1,7 +1,3 @@
-accesses.scala:23: error: overriding method f2 in class A of type ()Unit;
- method f2 has weaker access privileges; it should not be private
- private def f2(): Unit = ()
- ^
accesses.scala:24: error: overriding method f3 in class A of type ()Unit;
method f3 has weaker access privileges; it should be at least protected
private[p2] def f3(): Unit = ()
@@ -14,4 +10,4 @@ accesses.scala:26: error: overriding method f5 in class A of type ()Unit;
method f5 has weaker access privileges; it should be at least protected[p1]
protected[p2] def f5(): Unit
^
-four errors found
+three errors found
diff --git a/test/files/neg/accesses2.check b/test/files/neg/accesses2.check
new file mode 100644
index 0000000000..554a7b4c81
--- /dev/null
+++ b/test/files/neg/accesses2.check
@@ -0,0 +1,4 @@
+accesses2.scala:5: error: class B1 needs to be abstract, since method f2 in class A of type ()Int is not defined
+ class B1 extends A {
+ ^
+one error found
diff --git a/test/files/neg/accesses2.scala b/test/files/neg/accesses2.scala
new file mode 100644
index 0000000000..c7640f84b5
--- /dev/null
+++ b/test/files/neg/accesses2.scala
@@ -0,0 +1,11 @@
+package p2 {
+ abstract class A {
+ private[p2] def f2(): Int
+ }
+ class B1 extends A {
+ private def f2(): Int = 1
+ }
+ abstract class B2 extends A {
+ private def f2(): Int = 1
+ }
+}
diff --git a/test/files/neg/any-vs-anyref.check b/test/files/neg/any-vs-anyref.check
index 63c4853130..7378f0495f 100644
--- a/test/files/neg/any-vs-anyref.check
+++ b/test/files/neg/any-vs-anyref.check
@@ -36,12 +36,28 @@ Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x)
^
+any-vs-anyref.scala:10: error: type mismatch;
+ found : Quux with Product
+ required: AnyRef
+Note that the parents of this type (Quux, Product) extend Any, not AnyRef.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x)
+ ^
any-vs-anyref.scala:11: error: value eq is not a member of Quux with Product{def f: Int}
Note that the parents of this type (Quux, Product) extend Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x)
^
+any-vs-anyref.scala:11: error: type mismatch;
+ found : Quux with Product{def f: Int}
+ required: AnyRef
+Note that the parents of this type (Quux, Product) extend Any, not AnyRef.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x)
+ ^
any-vs-anyref.scala:12: error: type mismatch;
found : Quux with Product{def eq(other: String): Boolean}
required: AnyRef
@@ -61,4 +77,4 @@ any-vs-anyref.scala:27: error: type mismatch;
required: Quux{def g(x: Int): Int}
f(new Quux { def g(x: String) = x })
^
-9 errors found
+11 errors found
diff --git a/test/files/neg/anyval-anyref-parent.check b/test/files/neg/anyval-anyref-parent.check
index 8c2aa36583..8a00fb394d 100644
--- a/test/files/neg/anyval-anyref-parent.check
+++ b/test/files/neg/anyval-anyref-parent.check
@@ -4,9 +4,9 @@ trait Foo2 extends AnyVal // fail
anyval-anyref-parent.scala:5: error: Any does not have a constructor
class Bar1 extends Any // fail
^
-anyval-anyref-parent.scala:6: error: value class needs to have exactly one public val parameter
+anyval-anyref-parent.scala:6: error: value class parameter must be a val and not be private[this]
class Bar2(x: Int) extends AnyVal // fail
- ^
+ ^
anyval-anyref-parent.scala:10: error: illegal inheritance; superclass Any
is not a subclass of the superclass Object
of the mixin trait Immutable
diff --git a/test/files/neg/applydynamic_sip.check b/test/files/neg/applydynamic_sip.check
index dcf97b29fc..f28f26c147 100644
--- a/test/files/neg/applydynamic_sip.check
+++ b/test/files/neg/applydynamic_sip.check
@@ -4,9 +4,18 @@ applydynamic_sip.scala:7: error: applyDynamic does not support passing a vararg
applydynamic_sip.scala:8: error: applyDynamicNamed does not support passing a vararg parameter
qual.sel(arg = a, a2: _*)
^
+applydynamic_sip.scala:8: error: not found: value arg
+ qual.sel(arg = a, a2: _*)
+ ^
applydynamic_sip.scala:9: error: applyDynamicNamed does not support passing a vararg parameter
qual.sel(arg, arg2 = "a2", a2: _*)
^
+applydynamic_sip.scala:9: error: not found: value arg
+ qual.sel(arg, arg2 = "a2", a2: _*)
+ ^
+applydynamic_sip.scala:9: error: not found: value arg2
+ qual.sel(arg, arg2 = "a2", a2: _*)
+ ^
applydynamic_sip.scala:18: error: type mismatch;
found : String("sel")
required: Int
@@ -28,6 +37,9 @@ error after rewriting to Test.this.bad1.applyDynamicNamed("sel")
possible cause: maybe a wrong Dynamic method signature?
bad1.sel(a = 1)
^
+applydynamic_sip.scala:20: error: reassignment to val
+ bad1.sel(a = 1)
+ ^
applydynamic_sip.scala:21: error: type mismatch;
found : String("sel")
required: Int
@@ -50,9 +62,12 @@ error after rewriting to Test.this.bad2.applyDynamicNamed("sel")
possible cause: maybe a wrong Dynamic method signature?
bad2.sel(a = 1)
^
+applydynamic_sip.scala:31: error: reassignment to val
+ bad2.sel(a = 1)
+ ^
applydynamic_sip.scala:32: error: Int does not take parameters
error after rewriting to Test.this.bad2.updateDynamic("sel")
possible cause: maybe a wrong Dynamic method signature?
bad2.sel = 1
^
-11 errors found
+16 errors found
diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check
index e5f1a38d96..ef3aee5ee4 100644
--- a/test/files/neg/checksensible.check
+++ b/test/files/neg/checksensible.check
@@ -28,6 +28,9 @@ checksensible.scala:27: warning: comparing values of types Int and Unit using `=
checksensible.scala:29: warning: comparing values of types Int and String using `==' will always yield false
1 == "abc"
^
+checksensible.scala:29: warning: Int and String are unrelated: they will most likely never compare equal
+ 1 == "abc"
+ ^
checksensible.scala:33: warning: comparing values of types Some[Int] and Int using `==' will always yield false
Some(1) == 1 // as above
^
@@ -61,12 +64,18 @@ checksensible.scala:51: warning: comparing values of types Int and Unit using `!
checksensible.scala:52: warning: comparing values of types Int and Symbol using `!=' will always yield true
(1 != 'sym)
^
+checksensible.scala:52: warning: Int and Symbol are unrelated: they will most likely always compare unequal
+ (1 != 'sym)
+ ^
checksensible.scala:58: warning: comparing a fresh object using `==' will always yield false
((x: Int) => x + 1) == null
^
checksensible.scala:59: warning: comparing a fresh object using `==' will always yield false
Bep == ((_: Int) + 1)
^
+checksensible.scala:59: warning: Bep.type and Int => Int are unrelated: they will most likely never compare equal
+ Bep == ((_: Int) + 1)
+ ^
checksensible.scala:61: warning: comparing a fresh object using `==' will always yield false
new Object == new Object
^
@@ -82,6 +91,9 @@ checksensible.scala:66: warning: comparing values of types Int and Null using `=
checksensible.scala:71: warning: comparing values of types Bip and Bop using `==' will always yield false
(x1 == x2)
^
+checksensible.scala:71: warning: Bip and Bop are unrelated: they will most likely never compare equal
+ (x1 == x2)
+ ^
checksensible.scala:81: warning: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false
c3 == z1
^
@@ -94,9 +106,12 @@ checksensible.scala:83: warning: comparing values of types EqEqRefTest.this.Z1 a
checksensible.scala:84: warning: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true
c3 != "abc"
^
+checksensible.scala:84: warning: EqEqRefTest.this.C3 and String are unrelated: they will most likely always compare unequal
+ c3 != "abc"
+ ^
checksensible.scala:95: warning: comparing values of types Unit and Int using `!=' will always yield true
while ((c = in.read) != -1)
^
error: No warnings can be incurred under -Xfatal-warnings.
-33 warnings found
+38 warnings found
one error found
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check
index 39b6bf216c..fd1e2728c3 100644
--- a/test/files/neg/classmanifests_new_deprecations.check
+++ b/test/files/neg/classmanifests_new_deprecations.check
@@ -1,6 +1,6 @@
classmanifests_new_deprecations.scala:2: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
def cm1[T: ClassManifest] = ???
- ^
+ ^
classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
def cm2[T](implicit evidence$1: ClassManifest[T]) = ???
^
@@ -9,7 +9,7 @@ classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object P
^
classmanifests_new_deprecations.scala:6: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
def rcm1[T: scala.reflect.ClassManifest] = ???
- ^
+ ^
classmanifests_new_deprecations.scala:7: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ???
^
diff --git a/test/files/neg/divergent-implicit.check b/test/files/neg/divergent-implicit.check
index b5c607cf59..60d876409f 100644
--- a/test/files/neg/divergent-implicit.check
+++ b/test/files/neg/divergent-implicit.check
@@ -3,16 +3,14 @@ divergent-implicit.scala:4: error: type mismatch;
required: String
val x1: String = 1
^
-divergent-implicit.scala:5: error: diverging implicit expansion for type Int => String
-starting with method cast in object Test1
- val x2: String = cast[Int, String](1)
- ^
-divergent-implicit.scala:14: error: diverging implicit expansion for type Test2.Baz => Test2.Bar
-starting with method baz2bar in object Test2
+divergent-implicit.scala:14: error: type mismatch;
+ found : Test2.Foo
+ required: Test2.Bar
val x: Bar = new Foo
- ^
-divergent-implicit.scala:15: error: diverging implicit expansion for type Test2.Foo => Test2.Bar
-starting with method foo2bar in object Test2
+ ^
+divergent-implicit.scala:15: error: type mismatch;
+ found : Test2.Baz
+ required: Test2.Bar
val y: Bar = new Baz
- ^
-four errors found
+ ^
+three errors found
diff --git a/test/files/neg/for-comprehension-old.check b/test/files/neg/for-comprehension-old.check
index fc04beca53..1ecaf12af4 100644
--- a/test/files/neg/for-comprehension-old.check
+++ b/test/files/neg/for-comprehension-old.check
@@ -1,15 +1,15 @@
for-comprehension-old.scala:3: warning: val keyword in for comprehension is deprecated
for (x <- 1 to 5 ; val y = x) yield x+y // fail
- ^
+ ^
for-comprehension-old.scala:5: warning: val keyword in for comprehension is deprecated
for (val x <- 1 to 5 ; val y = x) yield x+y // fail
- ^
+ ^
for-comprehension-old.scala:8: warning: val keyword in for comprehension is deprecated
for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // fail
- ^
+ ^
for-comprehension-old.scala:10: warning: val keyword in for comprehension is deprecated
for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail
- ^
+ ^
for-comprehension-old.scala:4: error: val in for comprehension must be followed by assignment
for (val x <- 1 to 5 ; y = x) yield x+y // fail
^
diff --git a/test/files/neg/forgot-interpolator.check b/test/files/neg/forgot-interpolator.check
index a96431841f..157cbb4802 100644
--- a/test/files/neg/forgot-interpolator.check
+++ b/test/files/neg/forgot-interpolator.check
@@ -1,24 +1,30 @@
forgot-interpolator.scala:4: warning: `$bippy` looks like an interpolated identifier! Did you forget the interpolator?
- def f = "Put the $bippy in the $bippy!" // warn
+ def f = "Put the $bippy in the $bippy!" // warn 1
^
forgot-interpolator.scala:14: warning: That looks like an interpolated expression! Did you forget the interpolator?
- def f = """Put the ${println("bippy")} in the bippy!""" // warn
+ def f = """Put the ${println("bippy")} in the bippy!""" // warn 2
^
forgot-interpolator.scala:30: warning: `$beppo` looks like an interpolated identifier! Did you forget the interpolator?
- def f = "$beppo was a marx bros who saw dollars." // warn
+ def f = "$beppo was a marx bros who saw dollars." // warn 3
^
forgot-interpolator.scala:34: warning: `$aleppo` looks like an interpolated identifier! Did you forget the interpolator?
- def f = "$aleppo is a pepper and a city." // warn
+ def f = "$aleppo is a pepper and a city." // warn 4
^
-forgot-interpolator.scala:40: warning: `$bar` looks like an interpolated identifier! Did you forget the interpolator?
- def f = "$bar is private, shall we warn just in case?" // warn
+forgot-interpolator.scala:42: warning: `$bar` looks like an interpolated identifier! Did you forget the interpolator?
+ def f = "$bar is private, shall we warn just in case?" // warn 5
^
-forgot-interpolator.scala:45: warning: `$hippo` looks like an interpolated identifier! Did you forget the interpolator?
- def h = "$hippo takes an implicit" // warn
+forgot-interpolator.scala:47: warning: `$hippo` looks like an interpolated identifier! Did you forget the interpolator?
+ def h = "$hippo takes an implicit" // warn 6
^
-forgot-interpolator.scala:37: warning: private method in class Bar is never used
- private def bar = 8
- ^
+forgot-interpolator.scala:88: warning: `$groucho` looks like an interpolated identifier! Did you forget the interpolator?
+ def f2 = "I salute $groucho" // warn 7
+ ^
+forgot-interpolator.scala:89: warning: `$dingo` looks like an interpolated identifier! Did you forget the interpolator?
+ def f3 = "I even salute $dingo" // warn 8
+ ^
+forgot-interpolator.scala:90: warning: `$calico` looks like an interpolated identifier! Did you forget the interpolator?
+ def f4 = "I also salute $calico" // warn 9
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-7 warnings found
+9 warnings found
one error found
diff --git a/test/files/neg/forgot-interpolator.scala b/test/files/neg/forgot-interpolator.scala
index 5067f1dce9..34a7c7aef4 100644
--- a/test/files/neg/forgot-interpolator.scala
+++ b/test/files/neg/forgot-interpolator.scala
@@ -1,7 +1,7 @@
class A {
val bippy = 123
- def f = "Put the $bippy in the $bippy!" // warn
+ def f = "Put the $bippy in the $bippy!" // warn 1
}
class B {
@@ -11,7 +11,7 @@ class B {
}
class C {
- def f = """Put the ${println("bippy")} in the bippy!""" // warn
+ def f = """Put the ${println("bippy")} in the bippy!""" // warn 2
}
package object test {
@@ -27,21 +27,67 @@ package test {
def beppo(i: Int) = 8 * i
def beppo = 8
class Dah extends Doo {
- def f = "$beppo was a marx bros who saw dollars." // warn
+ def f = "$beppo was a marx bros who saw dollars." // warn 3
}
}
class E {
- def f = "$aleppo is a pepper and a city." // warn
+ def f = "$aleppo is a pepper and a city." // warn 4
+ def k = s"Just an interpolation of $aleppo" // no warn
}
class Bar {
private def bar = 8
+ if (bar > 8) ??? // use it to avoid extra warning
}
class Baz extends Bar {
- def f = "$bar is private, shall we warn just in case?" // warn
+ def f = "$bar is private, shall we warn just in case?" // warn 5
}
class G {
def g = "$greppo takes an arg" // no warn
def z = "$zappos takes an arg too" // no warn
- def h = "$hippo takes an implicit" // warn
+ def h = "$hippo takes an implicit" // warn 6
+ }
+ class J {
+ def j = 8
+ class J2 {
+ def j(i: Int) = 2 * i
+ def jj = "shadowed $j" // no warn
+ }
+ }
+ import annotation._
+ @implicitNotFound("No Z in ${A}") // no warn
+ class Z[A]
+}
+
+
+package inf1 {
+ import scala.annotation.implicitNotFound
+
+ @implicitNotFound(msg = "Cannot construct a collection of type ${To} with elements of type ${Elem} based on a collection of type ${From}.") // no warn
+ trait CannotBuildFrom[-From, -Elem, +To]
+}
+
+package inf2 {
+ @scala.annotation.implicitNotFound(msg = "Cannot construct a collection of type ${To} with elements of type ${Elem} based on a collection of type ${From}.") // no warn
+ trait CannotBuildFrom[-From, -Elem, +To]
+}
+
+package inf3 {
+ @scala.annotation.implicitNotFound("Cannot construct a collection of type ${To} with elements of type ${Elem} based on a collection of type ${From}.") // no warn
+ trait CannotBuildFrom[-From, -Elem, +To]
+}
+
+package curry {
+ class A {
+ def bunko()(x: Int): Int = 5
+ def groucho(): Int = 5
+ def dingo()()()()()(): Int = 5 // kind of nuts this can be evaluated with just 'dingo', but okay
+ def calico[T1, T2]()()(): Int = 5 // even nutsier
+ def palomino[T1, T2]()(y: Int = 5)(): Int = 5 // even nutsier
+
+ def f1 = "I was picked up by the $bunko squad" // no warn
+ def f2 = "I salute $groucho" // warn 7
+ def f3 = "I even salute $dingo" // warn 8
+ def f4 = "I also salute $calico" // warn 9
+ def f5 = "I draw the line at $palomino" // no warn
}
}
diff --git a/test/files/neg/found-req-variance.check b/test/files/neg/found-req-variance.check
index 55a01012a9..cc26458ac5 100644
--- a/test/files/neg/found-req-variance.check
+++ b/test/files/neg/found-req-variance.check
@@ -4,56 +4,56 @@ found-req-variance.scala:22: error: type mismatch;
Note: B <: A, but class Inv is invariant in type T.
You may wish to define T as +T instead. (SLS 4.5)
def f2 = Set[Inv[A]]() + new Inv[B]
- ^
+ ^
found-req-variance.scala:23: error: type mismatch;
found : Inv[C]
required: Inv[A]
Note: C <: A, but class Inv is invariant in type T.
You may wish to define T as +T instead. (SLS 4.5)
def f3 = Set[Inv[A]]() + new Inv[C]
- ^
+ ^
found-req-variance.scala:24: error: type mismatch;
found : Inv[A]
required: Inv[B]
Note: A >: B, but class Inv is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
def f4 = Set[Inv[B]]() + new Inv[A]
- ^
+ ^
found-req-variance.scala:26: error: type mismatch;
found : Inv[C]
required: Inv[B]
Note: C <: B, but class Inv is invariant in type T.
You may wish to define T as +T instead. (SLS 4.5)
def f6 = Set[Inv[B]]() + new Inv[C]
- ^
+ ^
found-req-variance.scala:27: error: type mismatch;
found : Inv[A]
required: Inv[C]
Note: A >: C, but class Inv is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
def f7 = Set[Inv[C]]() + new Inv[A]
- ^
+ ^
found-req-variance.scala:28: error: type mismatch;
found : Inv[B]
required: Inv[C]
Note: B >: C, but class Inv is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
def f8 = Set[Inv[C]]() + new Inv[B]
- ^
+ ^
found-req-variance.scala:34: error: type mismatch;
found : MultiInv[A]
required: Multi[A,B,C]
Note: A >: B (and MultiInv[A] <: Multi[A,A,C]), but class Multi is invariant in type Inv.
You may wish to define Inv as -Inv instead. (SLS 4.5)
def g4 = Set[Multi[A, B, C]]() + new MultiInv[A]
- ^
+ ^
found-req-variance.scala:36: error: type mismatch;
found : MultiInv[C]
required: Multi[A,B,C]
Note: C <: B (and MultiInv[C] <: Multi[A,C,C]), but class Multi is invariant in type Inv.
You may wish to define Inv as +Inv instead. (SLS 4.5)
def g6 = Set[Multi[A, B, C]]() + new MultiInv[C]
- ^
+ ^
found-req-variance.scala:47: error: type mismatch;
found : FF1[A,A]
required: FF1[B,B]
@@ -160,7 +160,7 @@ found-req-variance.scala:94: error: type mismatch;
Note: Int <: AnyVal (and Misc.MyData <: Misc.Data[Int]), but class Data is invariant in type A.
You may wish to define A as +A instead. (SLS 4.5)
def f1 = Set[Data[AnyVal]]() + new MyData
- ^
+ ^
found-req-variance.scala:100: error: type mismatch;
found : Set[String]
required: Set[CharSequence]
@@ -174,7 +174,7 @@ found-req-variance.scala:104: error: type mismatch;
Note: String <: Object, but class Trippy is invariant in type T2.
You may wish to define T2 as +T2 instead. (SLS 4.5)
def g1 = Set[Trippy[AnyRef, AnyRef, AnyRef]]() + new Trippy[String, String, String]
- ^
+ ^
found-req-variance.scala:105: error: type mismatch;
found : scala.collection.immutable.Map[AnyRef,String]
required: Map[String,String]
diff --git a/test/files/neg/gadts2-strict.check b/test/files/neg/gadts2-strict.check
new file mode 100644
index 0000000000..960b35ed2f
--- /dev/null
+++ b/test/files/neg/gadts2-strict.check
@@ -0,0 +1,6 @@
+gadts2-strict.scala:14: error: type mismatch;
+ found : Test.MyDouble
+ required: a
+ case NumTerm(n) => c.x = MyDouble(1.0)
+ ^
+one error found
diff --git a/test/files/neg/gadts2-strict.flags b/test/files/neg/gadts2-strict.flags
new file mode 100644
index 0000000000..19243266d1
--- /dev/null
+++ b/test/files/neg/gadts2-strict.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/test/files/neg/gadts2-strict.scala b/test/files/neg/gadts2-strict.scala
new file mode 100644
index 0000000000..54978b7712
--- /dev/null
+++ b/test/files/neg/gadts2-strict.scala
@@ -0,0 +1,26 @@
+// A copy of pos/gadts2, which must fail under -Xstrict-inference.
+object Test {
+
+ abstract class Number
+ case class MyInt(n: Int) extends Number
+ case class MyDouble(d: Double) extends Number
+
+ trait Term[a]
+ case class Cell[a](var x: a) extends Term[a]
+ final case class NumTerm(val n: Number) extends Term[Number]
+
+ def f[a](t: Term[a], c: Cell[a]) {
+ t match {
+ case NumTerm(n) => c.x = MyDouble(1.0)
+ }
+ }
+
+ val x: Term[Number] = NumTerm(MyInt(5))
+
+ def main(args: Array[String]) {
+ val cell = Cell[Number](MyInt(6))
+ Console.println(cell)
+ f[Number](new NumTerm(MyInt(5)), cell)
+ Console.println(cell)
+ }
+}
diff --git a/test/files/neg/gadts2.check b/test/files/neg/gadts2.check
new file mode 100644
index 0000000000..dc21f3f52c
--- /dev/null
+++ b/test/files/neg/gadts2.check
@@ -0,0 +1,6 @@
+gadts2.scala:7: error: type mismatch;
+ found : String("abc")
+ required: B
+ (s1: Super[Any]) match { case Sub(f) => f("abc") }
+ ^
+one error found
diff --git a/test/files/neg/gadts2.flags b/test/files/neg/gadts2.flags
new file mode 100644
index 0000000000..19243266d1
--- /dev/null
+++ b/test/files/neg/gadts2.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/test/files/neg/gadts2.scala b/test/files/neg/gadts2.scala
new file mode 100644
index 0000000000..156944b8d9
--- /dev/null
+++ b/test/files/neg/gadts2.scala
@@ -0,0 +1,12 @@
+trait Super[+A]
+case class Sub[B](f: B => B) extends Super[B]
+
+object Test extends App {
+ val s1 = Sub((x: Int) => x)
+
+ (s1: Super[Any]) match { case Sub(f) => f("abc") }
+}
+// java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
+// at scala.runtime.BoxesRunTime.unboxToInt(BoxesRunTime.java:105)
+// at Test$$anonfun$1.apply(a.scala:5)
+// at Test$.delayedEndpoint$Test$1(a.scala:7)
diff --git a/test/files/neg/lazyvals.check b/test/files/neg/lazyvals.check
index 1ae8b13d92..c4daf9d842 100644
--- a/test/files/neg/lazyvals.check
+++ b/test/files/neg/lazyvals.check
@@ -7,9 +7,9 @@ lazyvals.scala:9: error: lazy not allowed here. Only vals can be lazy
lazyvals.scala:12: error: lazy not allowed here. Only vals can be lazy
lazy def q: Double = 0.0
^
-lazyvals.scala:15: error: lazy values may not be abstract
+lazyvals.scala:15: error: '=' expected but ';' found.
lazy val t;
- ^
+ ^
lazyvals.scala:20: error: lazy not allowed here. Only vals can be lazy
lazy trait T {}
^
diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check
index 621d318ceb..61df5131cc 100644
--- a/test/files/neg/macro-basic-mamdmi.check
+++ b/test/files/neg/macro-basic-mamdmi.check
@@ -1,5 +1,5 @@
-Impls_Macros_Test_1.scala:36: error: macro implementation not found: foo
+Impls_Macros_Test_1.scala:33: error: macro implementation not found: quux
(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
println(foo(2) + Macros.bar(2) * new Macros().quux(4))
- ^
+ ^
one error found
diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
index f9e0ca5077..97780ef503 100644
--- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
+++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
@@ -3,20 +3,17 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
- c.Expr[Int](body)
+ c.Expr[Int](q"$x + 1")
}
def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
- c.Expr[Int](body)
+ c.Expr[Int](q"$x + 2")
}
def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
- c.Expr[Int](body)
+ c.Expr[Int](q"$x + 3")
}
}
diff --git a/test/files/neg/macro-bundle-abstract.check b/test/files/neg/macro-bundle-abstract.check
new file mode 100644
index 0000000000..4b07adcc95
--- /dev/null
+++ b/test/files/neg/macro-bundle-abstract.check
@@ -0,0 +1,4 @@
+macro-bundle-abstract.scala:5: error: class Bundle$Bundle needs to be abstract, since method deferred in trait Bundle of type => Int is not defined
+trait Bundle extends Macro {
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-abstract.scala b/test/files/neg/macro-bundle-abstract.scala
new file mode 100644
index 0000000000..2b302045da
--- /dev/null
+++ b/test/files/neg/macro-bundle-abstract.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+trait Bundle extends Macro {
+ def deferred: Int
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-class.check b/test/files/neg/macro-bundle-class.check
new file mode 100644
index 0000000000..92695390ab
--- /dev/null
+++ b/test/files/neg/macro-bundle-class.check
@@ -0,0 +1,4 @@
+macro-bundle-class.scala:10: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-class.scala b/test/files/neg/macro-bundle-class.scala
new file mode 100644
index 0000000000..4b92cdd40f
--- /dev/null
+++ b/test/files/neg/macro-bundle-class.scala
@@ -0,0 +1,11 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+class Bundle(val c: Context) extends Macro {
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-nonmacro.check b/test/files/neg/macro-bundle-nonmacro.check
new file mode 100644
index 0000000000..5a265b5724
--- /dev/null
+++ b/test/files/neg/macro-bundle-nonmacro.check
@@ -0,0 +1,4 @@
+macro-bundle-nonmacro.scala:8: error: not found: value Bundle
+ def foo = Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-nonmacro.scala b/test/files/neg/macro-bundle-nonmacro.scala
new file mode 100644
index 0000000000..c7d99f4582
--- /dev/null
+++ b/test/files/neg/macro-bundle-nonmacro.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+
+trait Bundle {
+ def impl = ???
+}
+
+object Macros {
+ def foo = Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-object.check b/test/files/neg/macro-bundle-object.check
new file mode 100644
index 0000000000..8c19271b51
--- /dev/null
+++ b/test/files/neg/macro-bundle-object.check
@@ -0,0 +1,8 @@
+macro-bundle-object.scala:11: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
+ found : : Nothing
+number of parameter sections differ
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-object.scala b/test/files/neg/macro-bundle-object.scala
new file mode 100644
index 0000000000..98c4238a62
--- /dev/null
+++ b/test/files/neg/macro-bundle-object.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+object Bundle extends Macro {
+ val c: Context = ???
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-polymorphic.check b/test/files/neg/macro-bundle-polymorphic.check
new file mode 100644
index 0000000000..204bd30bca
--- /dev/null
+++ b/test/files/neg/macro-bundle-polymorphic.check
@@ -0,0 +1,10 @@
+macro-bundle-polymorphic.scala:10: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle.impl
+ ^
+macro-bundle-polymorphic.scala:11: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle[Int].impl
+ ^
+macro-bundle-polymorphic.scala:12: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle[Int, Nothing].impl
+ ^
+three errors found
diff --git a/test/files/neg/macro-bundle-polymorphic.scala b/test/files/neg/macro-bundle-polymorphic.scala
new file mode 100644
index 0000000000..0468d841bd
--- /dev/null
+++ b/test/files/neg/macro-bundle-polymorphic.scala
@@ -0,0 +1,13 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+trait Bundle[T] extends Macro {
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+ def foo = macro Bundle[Int].impl
+ def foo = macro Bundle[Int, Nothing].impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-trait.check b/test/files/neg/macro-bundle-trait.check
new file mode 100644
index 0000000000..972788c577
--- /dev/null
+++ b/test/files/neg/macro-bundle-trait.check
@@ -0,0 +1,4 @@
+macro-bundle-trait.scala:11: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-trait.scala b/test/files/neg/macro-bundle-trait.scala
new file mode 100644
index 0000000000..ddc87f6db3
--- /dev/null
+++ b/test/files/neg/macro-bundle-trait.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+trait Bundle extends Macro {
+ val c: Context = ???
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala b/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala
index 59acaede65..3983f590dc 100644
--- a/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala
+++ b/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala
@@ -15,7 +15,7 @@ object Complex {
val recur = c.inferImplicitValue(trecur, silent = true)
if (recur == EmptyTree) c.abort(c.enclosingPosition, s"couldn't synthesize $trecur")
}
- c.literalNull
+ c.Expr[Null](q"null")
}
implicit object ComplexString extends Complex[String]
diff --git a/test/files/neg/macro-invalidimpl.check b/test/files/neg/macro-invalidimpl.check
index aaf4f88fc2..e39cc8105b 100644
--- a/test/files/neg/macro-invalidimpl.check
+++ b/test/files/neg/macro-invalidimpl.check
@@ -32,12 +32,14 @@ match expected type ?
^
Macros_Test_2.scala:31: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Unit]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context)(): c.Expr[Unit]
number of parameter sections differ
def foo1 = macro Impls6.fooEmpty
^
Macros_Test_2.scala:32: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(): c.Expr[Unit]
+ or : (c: scala.reflect.macros.Context)(): c.Tree
found : (c: scala.reflect.macros.Context): c.Expr[Unit]
number of parameter sections differ
def bar1() = macro Impls6.fooNullary
diff --git a/test/files/neg/macro-invalidimpl/Impls_1.scala b/test/files/neg/macro-invalidimpl/Impls_1.scala
index cf78ecc65a..9f48ab7ad9 100644
--- a/test/files/neg/macro-invalidimpl/Impls_1.scala
+++ b/test/files/neg/macro-invalidimpl/Impls_1.scala
@@ -22,8 +22,7 @@ object Impls5 {
object Impls6 {
def fooNullary(c: Context) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"""Predef.println("it works")""")
}
def fooEmpty(c: Context)() = fooNullary(c)
diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check
index 8c6ed4eb45..6cf62c292b 100644
--- a/test/files/neg/macro-invalidret.check
+++ b/test/files/neg/macro-invalidret.check
@@ -1,11 +1,13 @@
Macros_Test_2.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context): Int
type mismatch for return type: Int does not conform to c.Expr[Any]
def foo1 = macro Impls.foo1
^
Macros_Test_2.scala:3: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context): reflect.runtime.universe.Literal
type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any]
def foo2 = macro Impls.foo2
diff --git a/test/files/neg/macro-invalidshape/Macros_Test_2.scala b/test/files/neg/macro-invalidshape/Macros_Test_2.scala
index cf37e14d8e..819844b9f1 100644
--- a/test/files/neg/macro-invalidshape/Macros_Test_2.scala
+++ b/test/files/neg/macro-invalidshape/Macros_Test_2.scala
@@ -3,7 +3,7 @@ object Macros {
def foo2(x: Any) = macro Impls.foo(null)(null)
def foo3(x: Any) = macro {2; Impls.foo}
{
- def impl(c: scala.reflect.macros.Context) = c.literalUnit
+ def impl(c: scala.reflect.macros.Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo = macro impl
foo
}
diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check
index 3cc1c9abf1..86aa08291f 100644
--- a/test/files/neg/macro-invalidsig-params-badtype.check
+++ b/test/files/neg/macro-invalidsig-params-badtype.check
@@ -1,5 +1,6 @@
Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(x: Int): Nothing
type mismatch for parameter x: c.Expr[Int] does not conform to Int
def foo(x: Int) = macro Impls.foo
diff --git a/test/files/neg/macro-invalidsig.check b/test/files/neg/macro-invalidsig.check
index cbdaf51081..732380d4b3 100644
--- a/test/files/neg/macro-invalidsig.check
+++ b/test/files/neg/macro-invalidsig.check
@@ -1,65 +1,76 @@
Macros_Test_2.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context)(implicit evidence$2: Numeric[U]): c.universe.Literal
macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo[U] = macro Impls1.foo[U]
^
Macros_Test_2.scala:6: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : : Nothing
number of parameter sections differ
def foo = macro Impls2.foo
^
Macros_Test_2.scala:10: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.api.Universe): Nothing
type mismatch for parameter c: scala.reflect.macros.Context does not conform to scala.reflect.api.Universe
def foo = macro Impls3.foo
^
Macros_Test_2.scala:14: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (cs: scala.reflect.macros.Context*): Nothing
types incompatible for parameter cs: corresponding is not a vararg parameter
def foo = macro Impls4.foo
^
Macros_Test_2.scala:18: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Any]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context): Nothing
number of parameter sections differ
def foo(x: Any) = macro Impls5.foo
^
Macros_Test_2.scala:22: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Unit]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(implicit x: c.Expr[Int]): c.Expr[Unit]
macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo[U](x: Int) = macro Impls6.foo[T, U]
^
Macros_Test_2.scala:26: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing
parameter lists have different length, found extra parameter y: c.Expr[Int]
def foo(x: Int) = macro Impls7.foo
^
Macros_Test_2.scala:30: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(x: c.universe.Symbol): Nothing
type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Symbol
def foo(x: Int) = macro Impls8.foo
^
Macros_Test_2.scala:34: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree, y: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(xs: c.Expr[Int]*): Nothing
parameter lists have different length, required extra parameter y: c.Expr[Int]
def foo(x: Int, y: Int) = macro Impls9.foo
^
Macros_Test_2.scala:38: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree, y: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing
parameter names differ: x != y
def foo(x: Int, y: Int) = macro Impls10.foo
^
Macros_Test_2.scala:42: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context)(U: c.universe.Type): Nothing
number of parameter sections differ
def foo[U] = macro Impls11.foo[U]
diff --git a/test/files/neg/macro-invalidsig/Impls_1.scala b/test/files/neg/macro-invalidsig/Impls_1.scala
index e7d6c18f8d..d16ed26386 100644
--- a/test/files/neg/macro-invalidsig/Impls_1.scala
+++ b/test/files/neg/macro-invalidsig/Impls_1.scala
@@ -2,10 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.Context
object Impls1 {
- def foo[U: c.WeakTypeTag: Numeric](c: Context) = {
- import c.universe._
- Literal(Constant(42))
- }
+ def foo[U: c.WeakTypeTag: Numeric](c: Context) = { import c.universe._; q"42" }
}
object Impls2 {
@@ -28,12 +25,11 @@ object Impls6 {
def foo[T, U: c.WeakTypeTag](c: Context)(implicit x: c.Expr[Int]) = {
import c.{prefix => prefix}
import c.universe._
- val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo_targs...")))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[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("U is: " + ${implicitly[c.WeakTypeTag[U]].tpe.toString})
+ """)
}
}
@@ -71,18 +67,20 @@ object Impls14 {
object Impls15 {
def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Context)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ import c.universe._
println(implicitly[c.WeakTypeTag[T]])
println(implicitly[c.WeakTypeTag[U]])
println(V)
- c.literalUnit
+ c.Expr[Unit](q"()")
}
}
object Impls16 {
def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Context)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ import c.universe._
println(implicitly[c.WeakTypeTag[T]])
println(implicitly[c.WeakTypeTag[U]])
println(V)
- c.literalUnit
+ c.Expr[Unit](q"()")
}
} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala
index 6ee71a3628..74c163596a 100644
--- a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala
+++ b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala
@@ -1,5 +1,5 @@
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[U <: String](c: Ctx) = c.literalUnit
+ def foo[U <: String](c: Ctx) = { import c.universe._; c.Expr[Unit](q"()") }
}
diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
index 498bd4f18d..11b6a8c3b0 100644
--- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
+++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
@@ -3,7 +3,6 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"""println("it works")""")
}
} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidusage-presuper/Impls_1.scala b/test/files/neg/macro-invalidusage-presuper/Impls_1.scala
index b39a037c47..c4b57233c9 100644
--- a/test/files/neg/macro-invalidusage-presuper/Impls_1.scala
+++ b/test/files/neg/macro-invalidusage-presuper/Impls_1.scala
@@ -1,5 +1,5 @@
import scala.reflect.macros.Context
object Impls {
- def impl(c: Context) = c.literalUnit
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
} \ No newline at end of file
diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
index 69ef57d18d..64a9299ee6 100644
--- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
+++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
@@ -4,8 +4,7 @@ object Impls {
def impl(c: Ctx)(tag: String, x: c.Expr[_]) = {
import c.{prefix => prefix}
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"println($tag, ${prefix.toString}, $x)")
}
def fooBString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBString", x)
diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check
index 96ef75dd32..d000bb5316 100644
--- a/test/files/neg/macro-quasiquotes.check
+++ b/test/files/neg/macro-quasiquotes.check
@@ -1,6 +1,7 @@
Macros_1.scala:14: error: macro implementation has wrong shape:
required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any]
- found : (x: Impls.this.c.universe.Block): Impls.this.c.universe.Tree
+ or : (x: Impls.this.c.Tree): Impls.this.c.Tree
+ found : (x: Impls.this.c.universe.Block): Impls.this.c.Tree
type mismatch for parameter x: Impls.this.c.Expr[Int] does not conform to Impls.this.c.universe.Block
def m3(x: Int) = macro Impls.impl3
^
diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala
index c6677c4fde..868616aace 100644
--- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala
+++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala
@@ -3,16 +3,16 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
+ c.Expr(q"$x + 1")
}
def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
+ c.Expr(q"$x + 2")
}
def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))))
+ c.Expr(q"$x + 3")
}
} \ No newline at end of file
diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala
index c6677c4fde..868616aace 100644
--- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala
+++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala
@@ -3,16 +3,16 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
+ c.Expr(q"$x + 1")
}
def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
+ c.Expr(q"$x + 2")
}
def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))))
+ c.Expr(q"$x + 3")
}
} \ No newline at end of file
diff --git a/test/files/neg/multi-array.check b/test/files/neg/multi-array.check
index 6bdeb34c9e..511caa126f 100644
--- a/test/files/neg/multi-array.check
+++ b/test/files/neg/multi-array.check
@@ -1,4 +1,4 @@
multi-array.scala:7: error: too many arguments for constructor Array: (_length: Int)Array[T]
val a: Array[Int] = new Array(10, 10)
- ^
+ ^
one error found
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check
index 4966779cc3..880ddc4327 100644
--- a/test/files/neg/names-defaults-neg.check
+++ b/test/files/neg/names-defaults-neg.check
@@ -7,6 +7,11 @@ names-defaults-neg.scala:5: error: type mismatch;
required: Int
test1(b = 2, a = "#")
^
+names-defaults-neg.scala:5: error: type mismatch;
+ found : Int(2)
+ required: String
+ test1(b = 2, a = "#")
+ ^
names-defaults-neg.scala:8: error: positional after named argument.
test1(b = "(*", 23)
^
@@ -97,7 +102,7 @@ names-defaults-neg.scala:82: error: type mismatch;
required: String
Error occurred in an application involving default arguments.
new A2[String]()
- ^
+ ^
names-defaults-neg.scala:86: error: module extending its companion class cannot use default constructor arguments
object C extends C()
^
@@ -122,6 +127,12 @@ names-defaults-neg.scala:131: error: reference to var2 is ambiguous; it is both
names-defaults-neg.scala:134: error: missing parameter type for expanded function ((x$1) => a = x$1)
val taf2: Int => Unit = testAnnFun(a = _, b = get("+"))
^
+names-defaults-neg.scala:134: error: not found: value a
+ val taf2: Int => Unit = testAnnFun(a = _, b = get("+"))
+ ^
+names-defaults-neg.scala:134: error: not found: value get
+ val taf2: Int => Unit = testAnnFun(a = _, b = get("+"))
+ ^
names-defaults-neg.scala:135: error: parameter 'a' is already specified at parameter position 1
val taf3 = testAnnFun(b = _: String, a = get(8))
^
@@ -131,6 +142,9 @@ names-defaults-neg.scala:136: error: missing parameter type for expanded functio
names-defaults-neg.scala:136: error: missing parameter type for expanded function ((x$4) => b = x$4)
val taf4: (Int, String) => Unit = testAnnFun(_, b = _)
^
+names-defaults-neg.scala:136: error: not found: value b
+ val taf4: (Int, String) => Unit = testAnnFun(_, b = _)
+ ^
names-defaults-neg.scala:144: error: variable definition needs type because 'x' is used as a named argument in its body.
def t3 { var x = t.f(x = 1) }
^
@@ -168,4 +182,4 @@ names-defaults-neg.scala:180: error: reference to x is ambiguous; it is both a m
class u18 { var x: Int = u.f(x = 1) }
^
four warnings found
-42 errors found
+46 errors found
diff --git a/test/files/neg/nested-annotation.check b/test/files/neg/nested-annotation.check
index c077d35a29..ca263943fe 100644
--- a/test/files/neg/nested-annotation.check
+++ b/test/files/neg/nested-annotation.check
@@ -5,6 +5,6 @@ class ComplexAnnotation(val value: Annotation) extends ClassfileAnnotation
^
nested-annotation.scala:8: error: nested classfile annotations must be defined in java; found: inline
@ComplexAnnotation(new inline) def bippy(): Int = 1
- ^
+ ^
one warning found
one error found
diff --git a/test/files/neg/newpat_unreachable.check b/test/files/neg/newpat_unreachable.check
index a928e3853a..4463e2f1a4 100644
--- a/test/files/neg/newpat_unreachable.check
+++ b/test/files/neg/newpat_unreachable.check
@@ -13,6 +13,9 @@ If you intended to match against value d in class A, you must use backticks, lik
newpat_unreachable.scala:9: warning: unreachable code due to variable pattern 'b' on line 6
case _ => println("matched neither")
^
+newpat_unreachable.scala:7: warning: unreachable code
+ case c => println("matched c")
+ ^
newpat_unreachable.scala:22: warning: patterns after a variable pattern cannot match (SLS 8.1.1)
If you intended to match against parameter b of method g, you must use backticks, like: case `b` =>
case b => 1
@@ -24,6 +27,9 @@ If you intended to match against parameter c of method h, you must use backticks
newpat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22
case _ => 3
^
+newpat_unreachable.scala:23: warning: unreachable code
+ case c => 2
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-7 warnings found
+9 warnings found
one error found
diff --git a/test/files/neg/no-implicit-to-anyref.check b/test/files/neg/no-implicit-to-anyref.check
index 5ab5fd12a1..fe417ad8b0 100644
--- a/test/files/neg/no-implicit-to-anyref.check
+++ b/test/files/neg/no-implicit-to-anyref.check
@@ -18,5 +18,5 @@ Note that AV extends Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
new AV(0): AnyRef
- ^
+ ^
four errors found
diff --git a/test/files/neg/no-predef.check b/test/files/neg/no-predef.check
index fc538892ef..a63d8c5ba5 100644
--- a/test/files/neg/no-predef.check
+++ b/test/files/neg/no-predef.check
@@ -7,7 +7,7 @@ no-predef.scala:3: error: type mismatch;
found : java.lang.Long
required: scala.Long
def f2 = new java.lang.Long(5) : Long
- ^
+ ^
no-predef.scala:4: error: value map is not a member of String
def f3 = "abc" map (_ + 1)
^
diff --git a/test/files/neg/package-ob-case.check b/test/files/neg/package-ob-case.check
index 063a120db1..9b0ede1c6d 100644
--- a/test/files/neg/package-ob-case.check
+++ b/test/files/neg/package-ob-case.check
@@ -2,6 +2,9 @@ package-ob-case.scala:3: warning: it is not recommended to define classes/object
If possible, define class X in package foo instead.
case class X(z: Int) { }
^
+package-ob-case.scala:3: warning: class X should be placed directly in package foo instead of package object foo. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954.
+ case class X(z: Int) { }
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-one warning found
+two warnings found
one error found
diff --git a/test/files/neg/parser-errors.check b/test/files/neg/parser-errors.check
deleted file mode 100644
index 0ab3331c0c..0000000000
--- a/test/files/neg/parser-errors.check
+++ /dev/null
@@ -1,16 +0,0 @@
-parser-errors.scala:1: error: lazy values may not be abstract
-abstract class A1 { lazy val foo: Int }
- ^
-parser-errors.scala:2: error: pattern definition may not be abstract
-abstract class A2 { val Some(x) }
- ^
-parser-errors.scala:3: error: an explicit type is required for default initialization
-abstract class A3 { var x = _ }
- ^
-parser-errors.scala:4: error: only vars are eligible for default initialization
-abstract class A4 { val x: Int = _ }
- ^
-parser-errors.scala:5: error: pattern definition is ineligible for default initialization
-abstract class A5 { var Some(x) = _ }
- ^
-5 errors found
diff --git a/test/files/neg/parser-errors.scala b/test/files/neg/parser-errors.scala
deleted file mode 100644
index 7b1a290629..0000000000
--- a/test/files/neg/parser-errors.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-abstract class A1 { lazy val foo: Int }
-abstract class A2 { val Some(x) }
-abstract class A3 { var x = _ }
-abstract class A4 { val x: Int = _ }
-abstract class A5 { var Some(x) = _ }
diff --git a/test/files/neg/parser-import-errors.check b/test/files/neg/parser-import-errors.check
deleted file mode 100644
index e211c275a6..0000000000
--- a/test/files/neg/parser-import-errors.check
+++ /dev/null
@@ -1,28 +0,0 @@
-parser-import-errors.scala:12: error: not found: type B1
- new B1
- ^
-parser-import-errors.scala:13: error: not found: type C1
- new C1
- ^
-parser-import-errors.scala:19: error: object X1 is not a member of package p1
- import p1.{ A1 => X1, X1 => A1 }
- ^
-parser-import-errors.scala:21: error: not found: type A1
- new A1
- ^
-parser-import-errors.scala:22: error: not found: type B1
- new B1
- ^
-parser-import-errors.scala:23: error: not found: type C1
- new C1
- ^
-parser-import-errors.scala:33: error: not found: type C1
- new C1
- ^
-parser-import-errors.scala:38: error: A1 appears twice as a target of a renaming
- import p1.{ A1, B1 => A1 }
- ^
-parser-import-errors.scala:45: error: object Z1 is not a member of package p1
- import p1.{ Z1, B1 => Z1 }
- ^
-9 errors found
diff --git a/test/files/neg/parser-import-errors.scala b/test/files/neg/parser-import-errors.scala
deleted file mode 100644
index 010bb95a1e..0000000000
--- a/test/files/neg/parser-import-errors.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-package p1 {
- class A1
- class B1
- class C1
-}
-
-package p2 {
- import p1.{ A1, B1 => Q1, C1 => _ }
-
- class X {
- new A1
- new B1
- new C1
- new Q1
- }
-}
-
-package p3 {
- import p1.{ A1 => X1, X1 => A1 }
- class X {
- new A1
- new B1
- new C1
- new X1
- }
-}
-
-package p4 {
- import p1.{ A1 => B1, B1 => A1 }
- class X {
- new A1
- new B1
- new C1
- }
-}
-
-package p5 {
- import p1.{ A1, B1 => A1 }
- class X {
- new A1
- }
-}
-
-package p6 {
- import p1.{ Z1, B1 => Z1 }
- class X {
- new Z1
- }
-}
diff --git a/test/files/neg/pat_unreachable.check b/test/files/neg/pat_unreachable.check
index b4c0e7e104..374ee4e9cf 100644
--- a/test/files/neg/pat_unreachable.check
+++ b/test/files/neg/pat_unreachable.check
@@ -9,6 +9,9 @@ If you intended to match against parameter c of method contrivedExample, you mus
pat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22
case _ => println("matched neither")
^
+pat_unreachable.scala:23: warning: unreachable code
+ case c => println("matched c")
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-three warnings found
+four warnings found
one error found
diff --git a/test/files/neg/primitive-sigs-1.check b/test/files/neg/primitive-sigs-1.check
index d0619fa1d3..77dc457a49 100644
--- a/test/files/neg/primitive-sigs-1.check
+++ b/test/files/neg/primitive-sigs-1.check
@@ -2,5 +2,5 @@ B.scala:3: error: type mismatch;
found : Bippy
required: AC[Integer]
J.f(new Bippy())
- ^
+ ^
one error found
diff --git a/test/files/neg/protected-constructors.check b/test/files/neg/protected-constructors.check
index b636d076e4..f44d7db9b9 100644
--- a/test/files/neg/protected-constructors.check
+++ b/test/files/neg/protected-constructors.check
@@ -1,12 +1,12 @@
protected-constructors.scala:17: error: too many arguments for constructor Foo1: ()dingus.Foo1
val foo1 = new Foo1("abc")
- ^
+ ^
protected-constructors.scala:18: error: constructor Foo2 in class Foo2 cannot be accessed in object P
Access to protected constructor Foo2 not permitted because
enclosing object P in package hungus is not a subclass of
class Foo2 in package dingus where target is defined
val foo2 = new Foo2("abc")
- ^
+ ^
protected-constructors.scala:19: error: class Foo3 in object Ding cannot be accessed in object dingus.Ding
Access to protected class Foo3 not permitted because
enclosing object P in package hungus is not a subclass of
diff --git a/test/files/neg/quasiquotes-syntax-error-position.check b/test/files/neg/quasiquotes-syntax-error-position.check
index 3bd813b1bb..25e5b8d75a 100644
--- a/test/files/neg/quasiquotes-syntax-error-position.check
+++ b/test/files/neg/quasiquotes-syntax-error-position.check
@@ -10,9 +10,9 @@ quasiquotes-syntax-error-position.scala:7: error: '}' expected but end of quote
quasiquotes-syntax-error-position.scala:8: error: '.' expected but splicee found.
q"import $t $t"
^
-quasiquotes-syntax-error-position.scala:9: error: illegal start of definition
+quasiquotes-syntax-error-position.scala:9: error: '{' expected but end of quote found.
q"package p"
- ^
+ ^
quasiquotes-syntax-error-position.scala:10: error: ';' expected but '@' found.
q"foo@$a"
^
diff --git a/test/files/neg/reflection-names-neg.check b/test/files/neg/reflection-names-neg.check
index a56a19e7fd..f941ec8dc1 100644
--- a/test/files/neg/reflection-names-neg.check
+++ b/test/files/neg/reflection-names-neg.check
@@ -7,4 +7,7 @@ Note that implicit conversions are not applicable because they are ambiguous:
are possible conversion functions from String("abc") to reflect.runtime.universe.Name
val x2 = ("abc": Name) drop 1 // error
^
-one error found
+reflection-names-neg.scala:5: error: value drop is not a member of reflect.runtime.universe.Name
+ val x2 = ("abc": Name) drop 1 // error
+ ^
+two errors found
diff --git a/test/files/neg/run-gadts-strict.check b/test/files/neg/run-gadts-strict.check
new file mode 100644
index 0000000000..b4d36c4629
--- /dev/null
+++ b/test/files/neg/run-gadts-strict.check
@@ -0,0 +1,21 @@
+run-gadts-strict.scala:12: error: type mismatch;
+ found : n.type (with underlying type Int)
+ required: T
+ case Lit(n) => n
+ ^
+run-gadts-strict.scala:13: error: type mismatch;
+ found : Int
+ required: T
+ case Succ(u) => eval(u) + 1
+ ^
+run-gadts-strict.scala:14: error: type mismatch;
+ found : Boolean
+ required: T
+ case IsZero(u) => eval(u) == 0
+ ^
+run-gadts-strict.scala:15: error: type mismatch;
+ found : T(in class If)
+ required: T(in method eval)
+ case If(c, u1, u2) => eval(if (eval(c)) u1 else u2)
+ ^
+four errors found
diff --git a/test/files/neg/run-gadts-strict.flags b/test/files/neg/run-gadts-strict.flags
new file mode 100644
index 0000000000..19243266d1
--- /dev/null
+++ b/test/files/neg/run-gadts-strict.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/test/files/neg/run-gadts-strict.scala b/test/files/neg/run-gadts-strict.scala
new file mode 100644
index 0000000000..041d10d4bd
--- /dev/null
+++ b/test/files/neg/run-gadts-strict.scala
@@ -0,0 +1,18 @@
+// A copy of run/gadts.scala, which must fail under -Xstrict-inference.
+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],
+ t2: Term[T]) extends Term[T]
+
+object Test extends App {
+ def eval[T](t: Term[T]): T = t match {
+ case Lit(n) => n
+ case Succ(u) => eval(u) + 1
+ case IsZero(u) => eval(u) == 0
+ case If(c, u1, u2) => eval(if (eval(c)) u1 else u2)
+ }
+ println(eval(If(IsZero(Lit(1)), Lit(41), Succ(Lit(41)))))
+}
diff --git a/test/files/neg/saito.check b/test/files/neg/saito.check
index f78b300b4c..061a45b76e 100644
--- a/test/files/neg/saito.check
+++ b/test/files/neg/saito.check
@@ -1,4 +1,4 @@
saito.scala:10: error: class A cannot be instantiated because it does not conform to its self-type A with B
val a: A = new A; // should not be allowed
- ^
+ ^
one error found
diff --git a/test/files/neg/sammy_restrictions.check b/test/files/neg/sammy_restrictions.check
new file mode 100644
index 0000000000..8cc49f9aa9
--- /dev/null
+++ b/test/files/neg/sammy_restrictions.check
@@ -0,0 +1,49 @@
+sammy_restrictions.scala:31: error: type mismatch;
+ found : () => Int
+ required: NoAbstract
+ (() => 0) : NoAbstract
+ ^
+sammy_restrictions.scala:32: error: type mismatch;
+ found : Int => Int
+ required: TwoAbstract
+ ((x: Int) => 0): TwoAbstract
+ ^
+sammy_restrictions.scala:34: error: class type required but DerivedOneAbstract with OneAbstract found
+ ((x: Int) => 0): NonClassType // "class type required". I think we should avoid SAM translation here.
+ ^
+sammy_restrictions.scala:35: error: type mismatch;
+ found : Int => Int
+ required: NoEmptyConstructor
+ ((x: Int) => 0): NoEmptyConstructor
+ ^
+sammy_restrictions.scala:37: error: type mismatch;
+ found : Int => Int
+ required: OneEmptySecondaryConstructor
+ ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call.
+ ^
+sammy_restrictions.scala:38: error: type mismatch;
+ found : Int => Int
+ required: MultipleConstructorLists
+ ((x: Int) => 0): MultipleConstructorLists
+ ^
+sammy_restrictions.scala:39: error: type mismatch;
+ found : Int => Int
+ required: MultipleMethodLists
+ ((x: Int) => 0): MultipleMethodLists
+ ^
+sammy_restrictions.scala:40: error: type mismatch;
+ found : Int => Int
+ required: ImplicitConstructorParam
+ ((x: Int) => 0): ImplicitConstructorParam
+ ^
+sammy_restrictions.scala:41: error: type mismatch;
+ found : Int => Int
+ required: ImplicitMethodParam
+ ((x: Int) => 0): ImplicitMethodParam
+ ^
+sammy_restrictions.scala:44: error: type mismatch;
+ found : Int => Int
+ required: PolyMethod
+ ((x: Int) => 0): PolyMethod
+ ^
+10 errors found
diff --git a/test/files/neg/sammy_restrictions.flags b/test/files/neg/sammy_restrictions.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/neg/sammy_restrictions.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/test/files/neg/sammy_restrictions.scala b/test/files/neg/sammy_restrictions.scala
new file mode 100644
index 0000000000..5f1a04cd20
--- /dev/null
+++ b/test/files/neg/sammy_restrictions.scala
@@ -0,0 +1,45 @@
+class NoAbstract
+
+class TwoAbstract { def ap(a: Int): Int; def pa(a: Int): Int }
+
+class Base // check that the super class constructor isn't considered.
+class NoEmptyConstructor(a: Int) extends Base { def this(a: String) = this(0); def ap(a: Int): Int }
+
+class OneEmptyConstructor() { def this(a: Int) = this(); def ap(a: Int): Int }
+
+class OneEmptySecondaryConstructor(a: Int) { def this() = this(0); def ap(a: Int): Int }
+
+class MultipleConstructorLists()() { def ap(a: Int): Int }
+
+class MultipleMethodLists()() { def ap(a: Int)(): Int }
+
+class ImplicitConstructorParam()(implicit a: String) { def ap(a: Int): Int }
+
+class ImplicitMethodParam() { def ap(a: Int)(implicit b: String): Int }
+
+class PolyClass[T] { def ap(a: T): T }
+
+class PolyMethod { def ap[T](a: T): T }
+
+class OneAbstract { def ap(a: Any): Any }
+class DerivedOneAbstract extends OneAbstract
+
+object Test {
+ implicit val s: String = ""
+ type NonClassType = DerivedOneAbstract with OneAbstract
+
+ (() => 0) : NoAbstract
+ ((x: Int) => 0): TwoAbstract
+ ((x: Int) => 0): DerivedOneAbstract // okay
+ ((x: Int) => 0): NonClassType // "class type required". I think we should avoid SAM translation here.
+ ((x: Int) => 0): NoEmptyConstructor
+ ((x: Int) => 0): OneEmptyConstructor // okay
+ ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call.
+ ((x: Int) => 0): MultipleConstructorLists
+ ((x: Int) => 0): MultipleMethodLists
+ ((x: Int) => 0): ImplicitConstructorParam
+ ((x: Int) => 0): ImplicitMethodParam
+
+ ((x: Int) => 0): PolyClass[Int] // okay
+ ((x: Int) => 0): PolyMethod
+}
diff --git a/test/files/neg/sammy_wrong_arity.check b/test/files/neg/sammy_wrong_arity.check
new file mode 100644
index 0000000000..af547a201d
--- /dev/null
+++ b/test/files/neg/sammy_wrong_arity.check
@@ -0,0 +1,52 @@
+sammy_wrong_arity.scala:6: error: type mismatch;
+ found : () => Int
+ required: T1
+ (() => 0): T1
+ ^
+sammy_wrong_arity.scala:7: error: type mismatch;
+ found : Any => Int
+ required: T2
+ ((x: Any) => 0): T2
+ ^
+sammy_wrong_arity.scala:9: error: type mismatch;
+ found : Any => Int
+ required: T0
+ ((x: Any) => 0): T0
+ ^
+sammy_wrong_arity.scala:10: error: type mismatch;
+ found : Any => Int
+ required: T2
+ ((x: Any) => 0): T2
+ ^
+sammy_wrong_arity.scala:12: error: type mismatch;
+ found : (Any, Any) => Int
+ required: T0
+ ((x: Any, y: Any) => 0): T0
+ ^
+sammy_wrong_arity.scala:13: error: type mismatch;
+ found : (Any, Any) => Int
+ required: T1
+ ((x: Any, y: Any) => 0): T1
+ ^
+sammy_wrong_arity.scala:15: error: missing parameter type
+ ((x) => 0): T2
+ ^
+sammy_wrong_arity.scala:17: error: missing parameter type
+ ((x) => 0): T0
+ ^
+sammy_wrong_arity.scala:18: error: missing parameter type
+ ((x) => 0): T2
+ ^
+sammy_wrong_arity.scala:20: error: missing parameter type
+ ((x, y) => 0): T0
+ ^
+sammy_wrong_arity.scala:20: error: missing parameter type
+ ((x, y) => 0): T0
+ ^
+sammy_wrong_arity.scala:21: error: missing parameter type
+ ((x, y) => 0): T1
+ ^
+sammy_wrong_arity.scala:21: error: missing parameter type
+ ((x, y) => 0): T1
+ ^
+13 errors found
diff --git a/test/files/neg/sammy_wrong_arity.flags b/test/files/neg/sammy_wrong_arity.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/neg/sammy_wrong_arity.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/test/files/neg/sammy_wrong_arity.scala b/test/files/neg/sammy_wrong_arity.scala
new file mode 100644
index 0000000000..d03d266a0b
--- /dev/null
+++ b/test/files/neg/sammy_wrong_arity.scala
@@ -0,0 +1,22 @@
+trait T0 { def ap(): Int }
+trait T1 { def ap(a: Any): Int }
+trait T2 { def ap(a: Any, b: Any): Int }
+
+class Test {
+ (() => 0): T1
+ ((x: Any) => 0): T2
+
+ ((x: Any) => 0): T0
+ ((x: Any) => 0): T2
+
+ ((x: Any, y: Any) => 0): T0
+ ((x: Any, y: Any) => 0): T1
+
+ ((x) => 0): T2
+
+ ((x) => 0): T0
+ ((x) => 0): T2
+
+ ((x, y) => 0): T0
+ ((x, y) => 0): T1
+}
diff --git a/test/files/neg/sensitive.check b/test/files/neg/sensitive.check
index 9270e639c3..32d988ec97 100644
--- a/test/files/neg/sensitive.check
+++ b/test/files/neg/sensitive.check
@@ -1,4 +1,4 @@
sensitive.scala:17: error: constructor Sensitive in class Sensitive cannot be accessed in object Attacker
val y = new Sensitive()
- ^
+ ^
one error found
diff --git a/test/files/neg/stringinterpolation_macro-neg.check b/test/files/neg/stringinterpolation_macro-neg.check
index fa4f2c9472..457f497f2f 100644
--- a/test/files/neg/stringinterpolation_macro-neg.check
+++ b/test/files/neg/stringinterpolation_macro-neg.check
@@ -1,6 +1,6 @@
stringinterpolation_macro-neg.scala:8: error: too few parts
new StringContext().f()
- ^
+ ^
stringinterpolation_macro-neg.scala:9: error: too few arguments for interpolated string
new StringContext("", " is ", "%2d years old").f(s)
^
diff --git a/test/files/neg/t0209.check b/test/files/neg/t0209.check
index 4ba5fef4e9..1904e58e7a 100644
--- a/test/files/neg/t0209.check
+++ b/test/files/neg/t0209.check
@@ -2,5 +2,5 @@ t0209.scala:15: error: type mismatch;
found : C
required: _1.type where val _1: A
(new B: A).f(new C)
- ^
+ ^
one error found
diff --git a/test/files/neg/t0259.check b/test/files/neg/t0259.check
index 24e35e6176..8c15d98419 100644
--- a/test/files/neg/t0259.check
+++ b/test/files/neg/t0259.check
@@ -1,6 +1,6 @@
t0259.scala:4: error: double definition:
-constructor TestCase3:(groups: String*)test.TestCase3 and
-constructor TestCase3:(groups: (String, Int)*)test.TestCase3 at line 3
+constructor TestCase3: (groups: (String, Int)*)test.TestCase3 at line 3 and
+constructor TestCase3: (groups: String*)test.TestCase3 at line 4
have same type after erasure: (groups: Seq)test.TestCase3
def this( groups: String*) = this()
^
diff --git a/test/files/neg/t0418.check b/test/files/neg/t0418.check
index 4e9ad2f9ae..b95f8e4e1b 100644
--- a/test/files/neg/t0418.check
+++ b/test/files/neg/t0418.check
@@ -1,7 +1,4 @@
t0418.scala:2: error: not found: value Foo12340771
null match { case Foo12340771.Bar(x) => x }
^
-t0418.scala:2: error: not found: value x
- null match { case Foo12340771.Bar(x) => x }
- ^
-two errors found
+one error found
diff --git a/test/files/neg/t1038.check b/test/files/neg/t1038.check
index c74d8b338f..b191b89ad1 100644
--- a/test/files/neg/t1038.check
+++ b/test/files/neg/t1038.check
@@ -1,5 +1,5 @@
t1038.scala:4: error: not enough arguments for constructor X: (x: Int)X.
Unspecified value parameter x.
val a = new X
- ^
+ ^
one error found
diff --git a/test/files/neg/t1623.check b/test/files/neg/t1623.check
index e30db5cddd..251039ad30 100644
--- a/test/files/neg/t1623.check
+++ b/test/files/neg/t1623.check
@@ -1,4 +1,4 @@
t1623.scala:11: error: class BImpl cannot be instantiated because it does not conform to its self-type test.BImpl with test.A
val b = new BImpl
- ^
+ ^
one error found
diff --git a/test/files/neg/t1705.check b/test/files/neg/t1705.check
index 12f5c27de6..7f75bd0fb5 100644
--- a/test/files/neg/t1705.check
+++ b/test/files/neg/t1705.check
@@ -1,6 +1,6 @@
t1705.scala:9: error: can't existentially abstract over parameterized type this.T[Z]
val c = new C{
- ^
+ ^
t1705.scala:14: error: can't existentially abstract over parameterized type C[String]
val x1 = {
^
diff --git a/test/files/neg/t2462b.check b/test/files/neg/t2462b.check
index bc0d9aa469..b3b8007a93 100644
--- a/test/files/neg/t2462b.check
+++ b/test/files/neg/t2462b.check
@@ -6,9 +6,6 @@ t2462b.scala:9: warning: Invalid implicitNotFound message for trait Meh2 in pack
The type parameter Elem referenced in the message of the @implicitNotFound annotation is not defined by trait Meh2.
trait Meh2[-From, +To]
^
-t2462b.scala:12: error: overriding method x in class thankyoupartest of type => Int;
- method x needs `override' modifier
-class testmustfail extends thankyoupartest { def x = 43 }
- ^
+error: No warnings can be incurred under -Xfatal-warnings.
two warnings found
one error found
diff --git a/test/files/neg/t2462b.flags b/test/files/neg/t2462b.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t2462b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t2462b.scala b/test/files/neg/t2462b.scala
index 7a1389cc8e..576db4bd3f 100644
--- a/test/files/neg/t2462b.scala
+++ b/test/files/neg/t2462b.scala
@@ -7,6 +7,3 @@ trait Meh[-From, +To]
@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.")
trait Meh2[-From, +To]
-
-class thankyoupartest { def x = 42 }
-class testmustfail extends thankyoupartest { def x = 43 }
diff --git a/test/files/neg/t2462c.check b/test/files/neg/t2462c.check
new file mode 100644
index 0000000000..edeead55d6
--- /dev/null
+++ b/test/files/neg/t2462c.check
@@ -0,0 +1,7 @@
+t2462c.scala:18: error: No C of X$Y
+ f[X$Y]
+ ^
+t2462c.scala:24: error: No C of Foo[Int]
+ f[Foo[Int]]
+ ^
+two errors found
diff --git a/test/files/neg/t2462c.flags b/test/files/neg/t2462c.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t2462c.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t2462c.scala b/test/files/neg/t2462c.scala
new file mode 100644
index 0000000000..acf04afba9
--- /dev/null
+++ b/test/files/neg/t2462c.scala
@@ -0,0 +1,25 @@
+
+import annotation._
+
+@implicitNotFound("No C of ${ A }")
+class C[A]
+
+trait X$Y
+/* using the $$ separator for expanded names is unwise
+trait X$$Y
+trait X$$$Y
+trait X$$$$Y
+ */
+
+trait Foo[A]
+
+class Test {
+ def f[A: C] = ???
+ f[X$Y]
+/* using the $$ separator for expanded names is unwise
+ f[X$$Y]
+ f[X$$$Y]
+ f[X$$$$Y]
+ */
+ f[Foo[Int]]
+}
diff --git a/test/files/neg/t2775.check b/test/files/neg/t2775.check
index 2c901665d6..934a970f2e 100644
--- a/test/files/neg/t2775.check
+++ b/test/files/neg/t2775.check
@@ -1,4 +1,4 @@
t2775.scala:1: error: cannot find class tag for element type B.this.T
trait B[S] { type T = S; val c = new Array[T](1) }
- ^
+ ^
one error found
diff --git a/test/files/neg/t3346b.check b/test/files/neg/t3346b.check
new file mode 100644
index 0000000000..bcde6d90e4
--- /dev/null
+++ b/test/files/neg/t3346b.check
@@ -0,0 +1,4 @@
+t3346b.scala:14: error: could not find implicit value for evidence parameter of type TC[Any]
+ val y = foo(1)
+ ^
+one error found
diff --git a/test/files/neg/t3346b.scala b/test/files/neg/t3346b.scala
new file mode 100644
index 0000000000..8ea8970298
--- /dev/null
+++ b/test/files/neg/t3346b.scala
@@ -0,0 +1,15 @@
+import scala.language.implicitConversions
+
+trait T[X]
+trait U[X]
+trait TC[M[_]]
+
+object Test extends App {
+ def foo[M[_]: TC, A](ma: M[A]) = ()
+ implicit val TCofT: TC[T] = new TC[T] {}
+ implicit def any2T[A](a: A): T[A] = new T[A] {}
+ implicit def any2U[A](a: A): U[A] = new U[A] {}
+
+ val x = foo[T, Int](1)
+ val y = foo(1)
+} \ No newline at end of file
diff --git a/test/files/neg/t3346c.check b/test/files/neg/t3346c.check
new file mode 100644
index 0000000000..575379d009
--- /dev/null
+++ b/test/files/neg/t3346c.check
@@ -0,0 +1,4 @@
+t3346c.scala:60: error: value bar is not a member of Either[Int,String]
+ eii.bar
+ ^
+one error found
diff --git a/test/files/neg/t3346c.scala b/test/files/neg/t3346c.scala
new file mode 100644
index 0000000000..a5ac166b2d
--- /dev/null
+++ b/test/files/neg/t3346c.scala
@@ -0,0 +1,61 @@
+object Test extends App {
+ //
+ // An attempt to workaround SI-2712, foiled by SI-3346
+ //
+ trait TC[M[_]]
+
+ type EitherInt[A] = Either[Int, A]
+
+ implicit object EitherTC extends TC[EitherInt]
+
+ def foo[M[_]: TC, A](ma: M[A]) = ()
+
+ val eii: Either[Int, String] = Right("")
+
+ foo[EitherInt, String](eii)
+
+ // This one needs SI-2712 Higher Order Unification
+ //foo(eii) // not inferred
+
+ // A workaround is to provide a set of implicit conversions that take values
+ // based on type constructors of various shapes, and search for the
+ // type class instances.
+ //
+ // This is the approach taken by scalaz7.
+
+ trait TCValue[M[_], A] {
+ implicit def self: M[A]
+ def M: TC[M]
+
+ // instead of `foo(eii)`, we'll try `eii.foo`
+ def foo[M[_], A] = ()
+ }
+
+
+ implicit def ToTCValue[M[_], A](ma: M[A])(implicit M0: TC[M]) = new TCValue[M, A] {
+ implicit val M = M0
+ val self = ma
+ }
+ implicit def ToTCValueBin1[M[_, _], A, B](ma: M[A, B])(implicit M0: TC[({type λ[α]=M[A, α]})#λ]): TCValue[({type λ[α] = M[A, α]})#λ, B] = new TCValue[({type λ[α]=M[A, α]})#λ, B] {
+ implicit val M = M0
+ val self = ma
+ }
+ implicit def ToTCValueBin2[M[_, _], A, B](ma: M[A, B])(implicit M0: TC[({type λ[α]=M[α, B]})#λ]): TCValue[({type λ[α]=M[α, B]})#λ, A] = new TCValue[({type λ[α]=M[α, B]})#λ, A] {
+ implicit val M = M0
+ val self = ma
+ }
+
+
+ ToTCValueBin1(eii).foo
+
+ // as expected, could not find implicit parameter
+ // ToTCValueBin2(eii).bar
+
+ // error: implicit conversions are not applicable because they are ambiguous, both method ToTCValueBin1 ... and method ToTCValueBin2
+ // annoying!!
+ // https://issues.scala-lang.org/browse/SI-3346
+ //
+ // Works if we remove ToTCValueBin2
+ //
+ eii.bar
+}
diff --git a/test/files/neg/t3346i.check b/test/files/neg/t3346i.check
new file mode 100644
index 0000000000..cc17ab7ce4
--- /dev/null
+++ b/test/files/neg/t3346i.check
@@ -0,0 +1,7 @@
+t3346i.scala:28: error: value a is not a member of Test.A[T]
+ (new A).a
+ ^
+t3346i.scala:29: error: value a is not a member of Test.A[Nothing]
+ (new A[Nothing]).a
+ ^
+two errors found
diff --git a/test/files/neg/t3346i.scala b/test/files/neg/t3346i.scala
new file mode 100644
index 0000000000..9ad2544537
--- /dev/null
+++ b/test/files/neg/t3346i.scala
@@ -0,0 +1,30 @@
+import scala.language.implicitConversions
+
+// the classes involved
+case class Z[U](a: U)
+case class Intermediate[T, U](t: T, u: U)
+class Implicit1[T](b: Implicit2[T])
+class Implicit2[T](c: Implicit3[T])
+class Implicit3[T](/* and so on */)
+
+object Test extends App {
+ // the base conversion
+ implicit def convertToZ[T](a: A[T])(implicit b: Implicit1[T]): Z[A[T]] = Z(a)
+
+ // and the implicit chaining, don't you just love it? :D
+ // implicit1, with one alternative
+ implicit def implicit1[T <: Intermediate[_, _]](implicit b: Implicit2[T]) = new Implicit1[T](b)
+ // implicit2, with two alternatives
+ implicit def implicit2alt1[T <: Intermediate[_ <: String, _]](implicit c: Implicit3[T]) = new Implicit2[T](c)
+ implicit def implicit2alt2[T <: Intermediate[_ <: Double, _]](implicit c: Implicit3[T]) = new Implicit2[T](c)
+ // implicit3, with two alternatives
+ implicit def implicit3alt1[T <: Intermediate[_, _ <: Int]] = new Implicit3[T]()
+ implicit def implicit3alt2[T <: Intermediate[_ <: Double, _ <: AnyRef],X] = new Implicit3[T]()
+
+ // and our targets
+ /** conversion here, with constraints */
+ class A[T]()
+
+ (new A).a
+ (new A[Nothing]).a
+}
diff --git a/test/files/neg/t3453.check b/test/files/neg/t3453.check
index 2472e8b212..52c948128c 100644
--- a/test/files/neg/t3453.check
+++ b/test/files/neg/t3453.check
@@ -2,20 +2,20 @@ t3453.scala:18: error: type mismatch;
found : A
required: B
new A
- ^
+ ^
t3453.scala:36: error: type mismatch;
found : A
required: B
new A
- ^
+ ^
t3453.scala:50: error: type mismatch;
found : A
required: B
new A
- ^
+ ^
t3453.scala:64: error: type mismatch;
found : A
required: B
new A
- ^
+ ^
four errors found
diff --git a/test/files/neg/t3653.check b/test/files/neg/t3653.check
index ac6e2ca9dc..ad68e29fb4 100644
--- a/test/files/neg/t3653.check
+++ b/test/files/neg/t3653.check
@@ -1,7 +1,7 @@
t3653.scala:3: error: double definition:
-method x:(implicit x: Int)Int and
-method x:(i: Int)Int at line 2
-have same type after erasure: (x: Int)Int
+def x(i: Int): Int at line 2 and
+def x(implicit x: Int): Int at line 3
+have same type after erasure: (i: Int)Int
def x(implicit x: Int) = 5
^
one error found
diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check
index 358eaed41e..9b96449930 100644
--- a/test/files/neg/t3692-new.check
+++ b/test/files/neg/t3692-new.check
@@ -9,7 +9,7 @@ t3692-new.scala:16: warning: non-variable type argument Int in type pattern Map[
^
t3692-new.scala:15: warning: unreachable code
case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
- ^
+ ^
t3692-new.scala:4: warning: Tester has a main method with parameter type Array[String], but Tester will not be a runnable program.
Reason: main method must have exact signature (Array[String])Unit
object Tester {
diff --git a/test/files/neg/t3971.check b/test/files/neg/t3971.check
new file mode 100644
index 0000000000..8685119876
--- /dev/null
+++ b/test/files/neg/t3971.check
@@ -0,0 +1,21 @@
+t3971.scala:6: error: type mismatch;
+ found : Int
+ required: String
+ f(g("abc")("def")) // g returns Int, needs String
+ ^
+t3971.scala:7: error: type mismatch;
+ found : Int(5)
+ required: String
+ f(5)
+ ^
+t3971.scala:8: error: type mismatch;
+ found : Int
+ required: String
+ f(h("abc"))
+ ^
+t3971.scala:11: error: type mismatch;
+ found : Boolean
+ required: String
+ ({"ab".reverse; "ba".equals})(0): String
+ ^
+four errors found
diff --git a/test/files/neg/t3971.scala b/test/files/neg/t3971.scala
new file mode 100644
index 0000000000..35f64fde0c
--- /dev/null
+++ b/test/files/neg/t3971.scala
@@ -0,0 +1,12 @@
+class A {
+ def f(x: String) = x
+ def g(x: String)(y: String): Int = x.length + y.length
+ def h(x: String) = x.length
+
+ f(g("abc")("def")) // g returns Int, needs String
+ f(5)
+ f(h("abc"))
+
+ // a perverse piece of code from a perverse coder
+ ({"ab".reverse; "ba".equals})(0): String
+}
diff --git a/test/files/neg/t3977.check b/test/files/neg/t3977.check
index 4242059463..72335a0926 100644
--- a/test/files/neg/t3977.check
+++ b/test/files/neg/t3977.check
@@ -1,4 +1,4 @@
t3977.scala:12: error: could not find implicit value for parameter w: False#If[E]
new NoNull
- ^
+ ^
one error found
diff --git a/test/files/neg/t4163.check b/test/files/neg/t4163.check
index a09a522e3a..47bc78d31c 100644
--- a/test/files/neg/t4163.check
+++ b/test/files/neg/t4163.check
@@ -1,4 +1,7 @@
-t4163.scala:4: error: for comprehension must start with generator: '<-' expected but '=' found.
+t4163.scala:4: error: '<-' expected but '=' found.
x = 3
^
-one error found
+t4163.scala:5: error: illegal start of simple expression
+ y <- 0 to 100
+^
+two errors found
diff --git a/test/files/neg/t418.check b/test/files/neg/t418.check
index 1489547823..1b99717b82 100644
--- a/test/files/neg/t418.check
+++ b/test/files/neg/t418.check
@@ -1,7 +1,4 @@
t418.scala:2: error: not found: value Foo12340771
null match { case Foo12340771.Bar(x) => x }
^
-t418.scala:2: error: not found: value x
- null match { case Foo12340771.Bar(x) => x }
- ^
-two errors found
+one error found
diff --git a/test/files/neg/t4417.check b/test/files/neg/t4417.check
index dfc9feca24..dbd0f1df46 100644
--- a/test/files/neg/t4417.check
+++ b/test/files/neg/t4417.check
@@ -3,5 +3,5 @@ t4417.scala:11: error: constructor Pixel$mcD$sp in class Pixel$mcD$sp cannot be
enclosing object Pixel is not a subclass of
class Pixel$mcD$sp where target is defined
def apply(v: Double): Pixel1d = new Pixel1d(v)
- ^
+ ^
one error found
diff --git a/test/files/neg/t4515.check b/test/files/neg/t4515.check
index 64e7cc1ca7..708fcfbd29 100644
--- a/test/files/neg/t4515.check
+++ b/test/files/neg/t4515.check
@@ -3,4 +3,14 @@ t4515.scala:37: error: type mismatch;
required: _$2
handler.onEvent(target, ctx.getEvent, node, ctx)
^
-one error found
+t4515.scala:37: error: type mismatch;
+ found : Main.DerivedPushNode[_$1] where type _$1
+ required: Main.PushNode[_$2]
+ handler.onEvent(target, ctx.getEvent, node, ctx)
+ ^
+t4515.scala:37: error: type mismatch;
+ found : Main.PushEventContext[_$1] where type _$1
+ required: Main.PushEventContext[_$2]
+ handler.onEvent(target, ctx.getEvent, node, ctx)
+ ^
+three errors found
diff --git a/test/files/neg/t4727.check b/test/files/neg/t4727.check
index 55d4d01b97..a17cdde044 100644
--- a/test/files/neg/t4727.check
+++ b/test/files/neg/t4727.check
@@ -1,5 +1,5 @@
t4727.scala:5: error: an expression of type Null is ineligible for implicit conversion
Error occurred in an application involving default arguments.
new C[Int]
- ^
+ ^
one error found
diff --git a/test/files/neg/t4818.check b/test/files/neg/t4818.check
index a5e15e456b..8a2c024b30 100644
--- a/test/files/neg/t4818.check
+++ b/test/files/neg/t4818.check
@@ -1,6 +1,6 @@
t4818.scala:4: error: type mismatch;
found : Int(5)
- required: Nothing
+ required: A
def f(x: Any) = x match { case Fn(f) => f(5) }
^
one error found
diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check
index 6d0f424e82..4f2919807e 100644
--- a/test/files/neg/t4851.check
+++ b/test/files/neg/t4851.check
@@ -3,19 +3,19 @@ S.scala:2: warning: Adapting argument list by inserting (): leaky (Object-receiv
given arguments: <none>
after adaptation: new J((): Unit)
val x1 = new J
- ^
+ ^
S.scala:3: warning: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous.
signature: J(x: Any): J
given arguments: <none>
after adaptation: new J((): Unit)
val x2 = new J()
- ^
+ ^
S.scala:4: warning: Adapting argument list by creating a 5-tuple: this may not be what you want.
signature: J(x: Any): J
given arguments: 1, 2, 3, 4, 5
after adaptation: new J((1, 2, 3, 4, 5): (Int, Int, Int, Int, Int))
val x3 = new J(1, 2, 3, 4, 5)
- ^
+ ^
S.scala:6: warning: Adapting argument list by creating a 3-tuple: this may not be what you want.
signature: Some.apply[A](x: A): Some[A]
given arguments: 1, 2, 3
@@ -27,19 +27,19 @@ S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not b
given arguments: 1, 2, 3
after adaptation: new Some((1, 2, 3): (Int, Int, Int))
val y2 = new Some(1, 2, 3)
- ^
+ ^
S.scala:9: warning: Adapting argument list by inserting (): this is unlikely to be what you want.
signature: J2[T](x: T): J2[T]
given arguments: <none>
after adaptation: new J2((): Unit)
val z1 = new J2
- ^
+ ^
S.scala:10: warning: Adapting argument list by inserting (): this is unlikely to be what you want.
signature: J2[T](x: T): J2[T]
given arguments: <none>
after adaptation: new J2((): Unit)
val z2 = new J2()
- ^
+ ^
S.scala:14: warning: Adapting argument list by creating a 3-tuple: this may not be what you want.
signature: Test.anyId(a: Any): Any
given arguments: 1, 2, 3
diff --git a/test/files/neg/t4987.check b/test/files/neg/t4987.check
index ee058f0ac1..8d7344d27b 100644
--- a/test/files/neg/t4987.check
+++ b/test/files/neg/t4987.check
@@ -1,4 +1,4 @@
t4987.scala:2: error: constructor Foo2 in class Foo2 cannot be accessed in object Bar2
object Bar2 { new Foo2(0, 0) }
- ^
+ ^
one error found
diff --git a/test/files/neg/t512.check b/test/files/neg/t512.check
index 814e65e405..051e5ee19f 100644
--- a/test/files/neg/t512.check
+++ b/test/files/neg/t512.check
@@ -1,4 +1,7 @@
t512.scala:3: error: not found: value something
val xxx = something ||
^
-one error found
+t512.scala:4: error: not found: value something_else
+ something_else;
+ ^
+two errors found
diff --git a/test/files/neg/t5120.check b/test/files/neg/t5120.check
index fc65ca16a5..34d4ebde31 100644
--- a/test/files/neg/t5120.check
+++ b/test/files/neg/t5120.check
@@ -2,11 +2,11 @@ t5120.scala:11: error: type mismatch;
found : Object
required: _1
List(str, other) foreach (_.x1 = new AnyRef)
- ^
+ ^
t5120.scala:25: error: type mismatch;
found : Thread
required: h.T
(which expands to) _2
List(str, num).foreach(h => h.f1 = new Thread())
- ^
+ ^
two errors found
diff --git a/test/files/neg/t5189.check b/test/files/neg/t5189.check
index 7762f465dc..aecc1d11c4 100644
--- a/test/files/neg/t5189.check
+++ b/test/files/neg/t5189.check
@@ -1,6 +1,6 @@
t5189.scala:3: error: type mismatch;
- found : Nothing => Any
+ found : T => U
required: Any => Any
def f(x: Any): Any => Any = x match { case Foo(bar) => bar }
^
-one error found \ No newline at end of file
+one error found
diff --git a/test/files/neg/t5426.check b/test/files/neg/t5426.check
index 98f3ddaaae..c042cdcec3 100644
--- a/test/files/neg/t5426.check
+++ b/test/files/neg/t5426.check
@@ -4,12 +4,18 @@ t5426.scala:2: warning: comparing values of types Some[Int] and Int using `==' w
t5426.scala:3: warning: comparing values of types Int and Some[Int] using `==' will always yield false
def f2 = 5 == Some(5)
^
+t5426.scala:3: warning: Int and Some[Int] are unrelated: they will most likely never compare equal
+ def f2 = 5 == Some(5)
+ ^
t5426.scala:8: warning: comparing values of types Int and Some[Int] using `==' will always yield false
(x1 == x2)
^
+t5426.scala:8: warning: Int and Some[Int] are unrelated: they will most likely never compare equal
+ (x1 == x2)
+ ^
t5426.scala:9: warning: comparing values of types Some[Int] and Int using `==' will always yield false
(x2 == x1)
^
error: No warnings can be incurred under -Xfatal-warnings.
-four warnings found
+6 warnings found
one error found
diff --git a/test/files/neg/t545.check b/test/files/neg/t545.check
index 8ebbf9bdf6..aae575fa96 100644
--- a/test/files/neg/t545.check
+++ b/test/files/neg/t545.check
@@ -1,7 +1,4 @@
t545.scala:4: error: value blah is not a member of Test.Foo
val x = foo.blah match {
^
-t545.scala:5: error: recursive value x needs type
- case List(x) => x
- ^
-two errors found
+one error found
diff --git a/test/files/neg/t556.check b/test/files/neg/t556.check
index 5135dc92ef..30cc296b35 100644
--- a/test/files/neg/t556.check
+++ b/test/files/neg/t556.check
@@ -1,4 +1,7 @@
t556.scala:3: error: missing parameter type
def g:Int = f((x,y)=>x)
^
-one error found
+t556.scala:3: error: missing parameter type
+ def g:Int = f((x,y)=>x)
+ ^
+two errors found
diff --git a/test/files/neg/t5572.check b/test/files/neg/t5572.check
index 7b1e290861..3c9adf41cd 100644
--- a/test/files/neg/t5572.check
+++ b/test/files/neg/t5572.check
@@ -3,9 +3,14 @@ t5572.scala:16: error: type mismatch;
required: A
Z.transf(a, b) match {
^
+t5572.scala:16: error: type mismatch;
+ found : A
+ required: B
+ Z.transf(a, b) match {
+ ^
t5572.scala:18: error: type mismatch;
found : A
required: B
run(sth, b)
^
-two errors found
+three errors found
diff --git a/test/files/neg/t5578.check b/test/files/neg/t5578.check
index d803adb223..56123d2e0f 100644
--- a/test/files/neg/t5578.check
+++ b/test/files/neg/t5578.check
@@ -1,4 +1,7 @@
-t5578.scala:33: error: No Manifest available for T.
+t5578.scala:33: error: type mismatch;
+ found : NumericOpsExp.this.Plus[T]
+ required: NumericOpsExp.this.Rep[T]
+ (which expands to) NumericOpsExp.this.Exp[T]
def plus[T: Numeric](x: Rep[T], y: Rep[T]): Rep[T] = Plus[T](x,y)
^
one error found
diff --git a/test/files/neg/t5663-badwarneq.check b/test/files/neg/t5663-badwarneq.check
index 732e4f44d0..4b7795585b 100644
--- a/test/files/neg/t5663-badwarneq.check
+++ b/test/files/neg/t5663-badwarneq.check
@@ -25,6 +25,9 @@ t5663-badwarneq.scala:72: warning: ValueClass1 and Int are unrelated: they will
t5663-badwarneq.scala:74: warning: comparing values of types Int and ValueClass1 using `==' will always yield false
println(5 == new ValueClass1(5)) // bad
^
+t5663-badwarneq.scala:74: warning: Int and ValueClass1 are unrelated: they will never compare equal
+ println(5 == new ValueClass1(5)) // bad
+ ^
t5663-badwarneq.scala:78: warning: ValueClass2[String] and String are unrelated: they will never compare equal
println(new ValueClass2("abc") == "abc") // bad
^
@@ -38,5 +41,5 @@ t5663-badwarneq.scala:82: warning: comparing values of types ValueClass3 and Int
println(ValueClass3(5) == 5) // bad
^
error: No warnings can be incurred under -Xfatal-warnings.
-13 warnings found
+14 warnings found
one error found
diff --git a/test/files/neg/t5666.check b/test/files/neg/t5666.check
index da6b9d73e7..1c714796ba 100644
--- a/test/files/neg/t5666.check
+++ b/test/files/neg/t5666.check
@@ -1,37 +1,37 @@
t5666.scala:2: error: class Any is abstract; cannot be instantiated
new Any
- ^
+ ^
t5666.scala:3: error: class AnyVal is abstract; cannot be instantiated
new AnyVal
- ^
+ ^
t5666.scala:4: error: class Double is abstract; cannot be instantiated
new Double
- ^
+ ^
t5666.scala:5: error: class Float is abstract; cannot be instantiated
new Float
- ^
+ ^
t5666.scala:6: error: class Long is abstract; cannot be instantiated
new Long
- ^
+ ^
t5666.scala:7: error: class Int is abstract; cannot be instantiated
new Int
- ^
+ ^
t5666.scala:8: error: class Char is abstract; cannot be instantiated
new Char
- ^
+ ^
t5666.scala:9: error: class Short is abstract; cannot be instantiated
new Short
- ^
+ ^
t5666.scala:10: error: class Byte is abstract; cannot be instantiated
new Byte
- ^
+ ^
t5666.scala:11: error: class Boolean is abstract; cannot be instantiated
new Boolean
- ^
+ ^
t5666.scala:12: error: class Unit is abstract; cannot be instantiated
new Unit
- ^
+ ^
t5666.scala:13: error: class Nothing is abstract; cannot be instantiated
new Nothing
- ^
+ ^
12 errors found
diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check
index ad9b79cdcb..8cf0534e77 100644
--- a/test/files/neg/t5689.check
+++ b/test/files/neg/t5689.check
@@ -1,5 +1,6 @@
t5689.scala:4: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[String]
+ or : (c: scala.reflect.macros.Context)(i: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[Int]
type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String]
def returnsString(i: Double): String = macro returnsIntImpl
diff --git a/test/files/neg/t5761.check b/test/files/neg/t5761.check
index 8086af2fcf..2d66af26f6 100644
--- a/test/files/neg/t5761.check
+++ b/test/files/neg/t5761.check
@@ -5,7 +5,7 @@ Unspecified value parameter x.
t5761.scala:8: error: not enough arguments for constructor D: (x: Int)D[Int].
Unspecified value parameter x.
println(new D[Int]()) // no crash
- ^
+ ^
t5761.scala:9: error: not enough arguments for constructor D: (x: Int)D[Int].
Unspecified value parameter x.
println(new D[Int]{}) // crash
@@ -13,4 +13,7 @@ Unspecified value parameter x.
t5761.scala:13: error: not found: type Tread
new Tread("sth") { }.run()
^
-four errors found
+t5761.scala:13: error: value run is not a member of AnyRef
+ new Tread("sth") { }.run()
+ ^
+5 errors found
diff --git a/test/files/neg/t5803.check b/test/files/neg/t5803.check
index c4f901e511..6a2de2e1df 100644
--- a/test/files/neg/t5803.check
+++ b/test/files/neg/t5803.check
@@ -1,4 +1,4 @@
t5803.scala:3: error: could not find implicit value for parameter ev: Nothing
new Foo(): String
- ^
+ ^
one error found
diff --git a/test/files/neg/t5845.check b/test/files/neg/t5845.check
deleted file mode 100644
index 8c6100d6de..0000000000
--- a/test/files/neg/t5845.check
+++ /dev/null
@@ -1,7 +0,0 @@
-t5845.scala:9: error: value +++ is not a member of Int
- println(5 +++ 5)
- ^
-t5845.scala:15: error: value +++ is not a member of Int
- println(5 +++ 5)
- ^
-two errors found
diff --git a/test/files/neg/t588.check b/test/files/neg/t588.check
index f8b5516fdc..ff08f77a6f 100644
--- a/test/files/neg/t588.check
+++ b/test/files/neg/t588.check
@@ -1,13 +1,13 @@
t588.scala:3: error: double definition:
-method visit:(f: Int => String)Boolean and
-method visit:(f: Int => Unit)Boolean at line 2
+def visit(f: Int => Unit): Boolean at line 2 and
+def visit(f: Int => String): Boolean at line 3
have same type after erasure: (f: Function1)Boolean
def visit(f: Int => String): Boolean
^
t588.scala:10: error: double definition:
-method f:(brac: Test.this.TypeB)Unit and
-method f:(node: Test.this.TypeA)Unit at line 9
-have same type after erasure: (brac: Test#TraitA)Unit
+def f(node: Test.this.TypeA): Unit at line 9 and
+def f(brac: Test.this.TypeB): Unit at line 10
+have same type after erasure: (node: Test#TraitA)Unit
def f(brac : TypeB) : Unit;
^
two errors found
diff --git a/test/files/neg/t5903a.check b/test/files/neg/t5903a.check
index cbdcfd1bdd..2e5cc87167 100644
--- a/test/files/neg/t5903a.check
+++ b/test/files/neg/t5903a.check
@@ -1,7 +1,4 @@
Test_2.scala:4: error: wrong number of patterns for <$anon: AnyRef> offering (SomeTree.type, SomeTree.type): expected 2, found 3
case nq"$x + $y + $z" => println((x, y))
^
-Test_2.scala:4: error: not found: value x
- case nq"$x + $y + $z" => println((x, y))
- ^
-two errors found
+one error found
diff --git a/test/files/neg/t5903b.check b/test/files/neg/t5903b.check
index faeb73ad03..e7637d3edb 100644
--- a/test/files/neg/t5903b.check
+++ b/test/files/neg/t5903b.check
@@ -3,7 +3,4 @@ Test_2.scala:4: error: type mismatch;
required: String
case t"$x" => println(x)
^
-Test_2.scala:4: error: not found: value x
- case t"$x" => println(x)
- ^
-two errors found
+one error found
diff --git a/test/files/neg/t5903c.check b/test/files/neg/t5903c.check
index c9476edd11..05bd775d30 100644
--- a/test/files/neg/t5903c.check
+++ b/test/files/neg/t5903c.check
@@ -1,7 +1,4 @@
Test_2.scala:4: error: String is not supported
case t"$x" => println(x)
^
-Test_2.scala:4: error: not found: value x
- case t"$x" => println(x)
- ^
-two errors found
+one error found
diff --git a/test/files/neg/t5903d.check b/test/files/neg/t5903d.check
index d5d3fdcc28..9b8526b7f5 100644
--- a/test/files/neg/t5903d.check
+++ b/test/files/neg/t5903d.check
@@ -1,7 +1,4 @@
Test_2.scala:4: error: extractor macros can only expand into extractor calls
case t"$x" => println(x)
^
-Test_2.scala:4: error: not found: value x
- case t"$x" => println(x)
- ^
-two errors found
+one error found
diff --git a/test/files/neg/t6048.check b/test/files/neg/t6048.check
index 5e11d24fde..f8eddf5471 100644
--- a/test/files/neg/t6048.check
+++ b/test/files/neg/t6048.check
@@ -10,6 +10,9 @@ t6048.scala:13: warning: patterns after a variable pattern cannot match (SLS 8.1
t6048.scala:14: warning: unreachable code due to variable pattern on line 13
case 5 if true => x // unreachable
^
+t6048.scala:14: warning: unreachable code
+ case 5 if true => x // unreachable
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-four warnings found
+5 warnings found
one error found
diff --git a/test/files/neg/t6074.check b/test/files/neg/t6074.check
index 6abf5e2906..38670e5b3d 100644
--- a/test/files/neg/t6074.check
+++ b/test/files/neg/t6074.check
@@ -1,4 +1,4 @@
t6074.scala:5: error: constructor A in class A cannot be accessed in object T
def t = new A()
- ^
+ ^
one error found
diff --git a/test/files/neg/t6120.check b/test/files/neg/t6120.check
new file mode 100644
index 0000000000..a7d17e29cf
--- /dev/null
+++ b/test/files/neg/t6120.check
@@ -0,0 +1,20 @@
+t6120.scala:5: warning: postfix operator bippy should be enabled
+by making the implicit value scala.language.postfixOps visible.
+This can be achieved by adding the import clause 'import scala.language.postfixOps'
+or by setting the compiler option -language:postfixOps.
+See the Scala docs for value scala.language.postfixOps for a discussion
+why the feature should be explicitly enabled.
+ def f = null == null bippy
+ ^
+t6120.scala:5: warning: method bippy in class BooleanOps is deprecated: bobo
+ def f = null == null bippy
+ ^
+t6120.scala:5: warning: comparing values of types Null and Null using `==' will always yield true
+ def f = null == null bippy
+ ^
+t6120.scala:6: warning: method bippy in class BooleanOps is deprecated: bobo
+ def g = true.bippy
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/test/files/neg/t6120.flags b/test/files/neg/t6120.flags
new file mode 100644
index 0000000000..04d7c7d417
--- /dev/null
+++ b/test/files/neg/t6120.flags
@@ -0,0 +1 @@
+-feature -deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t6120.scala b/test/files/neg/t6120.scala
new file mode 100644
index 0000000000..425f09db47
--- /dev/null
+++ b/test/files/neg/t6120.scala
@@ -0,0 +1,7 @@
+class A {
+ implicit class BooleanOps(val b: Boolean) {
+ @deprecated("bobo", "2.11.0") def bippy() = 5
+ }
+ def f = null == null bippy
+ def g = true.bippy
+}
diff --git a/test/files/neg/t6123-explaintypes-macros.check b/test/files/neg/t6123-explaintypes-macros.check
index ebcb8069d5..43f8371326 100644
--- a/test/files/neg/t6123-explaintypes-macros.check
+++ b/test/files/neg/t6123-explaintypes-macros.check
@@ -2,6 +2,7 @@ c.universe.Expr[Any]* <: c.universe.Expr[String]*?
false
BadMac_2.scala:6: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit]
+ or : (c: scala.reflect.macros.Context)(format: c.Tree, params: Tree*): c.Tree
found : (c: scala.reflect.macros.Context)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit]
type mismatch for parameter params: c.Expr[Any]* does not conform to c.Expr[String]*
def printf(format: String, params: Any*): Unit = macro printf_impl
diff --git a/test/files/neg/t6443c.check b/test/files/neg/t6443c.check
index 7cf8d23f4b..7b7f419f6c 100644
--- a/test/files/neg/t6443c.check
+++ b/test/files/neg/t6443c.check
@@ -1,6 +1,6 @@
t6443c.scala:16: error: double definition:
-method foo:(d: B.D)(a: Any)(d2: d.type)Unit and
-method foo:(d: B.D)(a: Any, d2: d.type)Unit at line 11
+def foo(d: B.D)(a: Any,d2: d.type): Unit at line 11 and
+def foo(d: B.D)(a: Any)(d2: d.type): Unit at line 16
have same type after erasure: (d: B.D, a: Object, d2: B.D)Unit
def foo(d: D)(a: Any)(d2: d.type): Unit = ()
^
diff --git a/test/files/neg/t6601.check b/test/files/neg/t6601.check
index b05c67ad9a..1410e1b11a 100644
--- a/test/files/neg/t6601.check
+++ b/test/files/neg/t6601.check
@@ -1,4 +1,4 @@
AccessPrivateConstructor_2.scala:2: error: constructor PrivateConstructor in class PrivateConstructor cannot be accessed in class AccessPrivateConstructor
new PrivateConstructor("") // Scalac should forbid accessing to the private constructor!
- ^
+ ^
one error found
diff --git a/test/files/neg/t663.check b/test/files/neg/t663.check
index 40161fb3e3..633e27ee12 100644
--- a/test/files/neg/t663.check
+++ b/test/files/neg/t663.check
@@ -1,7 +1,7 @@
t663.scala:11: error: name clash between defined and inherited member:
-method asMatch:(m: Test.this.Node)Any and
-method asMatch:(node: Test.this.Matchable)Any in trait MatchableImpl
-have same type after erasure: (m: test.Test#NodeImpl)Object
+def asMatch(node: Test.this.Matchable): Any in trait MatchableImpl and
+def asMatch(m: Test.this.Node): Any at line 11
+have same type after erasure: (node: test.Test#NodeImpl)Object
def asMatch(m : Node) : Any = {
^
one error found
diff --git a/test/files/neg/t6667b.check b/test/files/neg/t6667b.check
index a8705fa1c2..99cea9a47c 100644
--- a/test/files/neg/t6667b.check
+++ b/test/files/neg/t6667b.check
@@ -3,11 +3,11 @@ t6667b.scala:16: error: ambiguous implicit values:
and value b of type Test.Box
match expected type Test.Box
new Test()
- ^
+ ^
t6667b.scala:19: error: ambiguous implicit values:
both value a in object Test of type => Test.Box
and value b of type Test.Box
match expected type Test.Box
new Test()
- ^
+ ^
two errors found
diff --git a/test/files/neg/t6680a.check b/test/files/neg/t6680a.check
new file mode 100644
index 0000000000..03e4df10c1
--- /dev/null
+++ b/test/files/neg/t6680a.check
@@ -0,0 +1,11 @@
+t6680a.scala:10: error: type mismatch;
+ found : String("abc")
+ required: A
+ y.x = "abc"
+ ^
+t6680a.scala:17: error: type mismatch;
+ found : String("")
+ required: A
+ case class C[A](f:A=>A);def f(x:Any)=x match { case C(f)=>f("") };f(C[Int](x=>x))
+ ^
+two errors found
diff --git a/test/files/neg/t6680a.scala b/test/files/neg/t6680a.scala
new file mode 100644
index 0000000000..93b796438f
--- /dev/null
+++ b/test/files/neg/t6680a.scala
@@ -0,0 +1,18 @@
+case class Cell[A](var x: A)
+object Test {
+ def f1(x: Any) = x match { case y @ Cell(_) => y } // Inferred type is Cell[Any]
+ def f2(x: Cell[_]) = x match { case y @ Cell(_) => y } // Inferred type is Cell[_]
+ def f3[A](x: Cell[A]) = x match { case y @ Cell(_) => y } // Inferred type is Cell[A]
+
+ def main(args: Array[String]): Unit = {
+ val x = new Cell(1)
+ val y = f1(x)
+ y.x = "abc"
+ println(x.x + 1)
+ }
+}
+
+// The tweetable variation
+object Tweet {
+ case class C[A](f:A=>A);def f(x:Any)=x match { case C(f)=>f("") };f(C[Int](x=>x))
+}
diff --git a/test/files/neg/t6680b.flags b/test/files/neg/t6680b.flags
new file mode 100644
index 0000000000..a02d83efad
--- /dev/null
+++ b/test/files/neg/t6680b.flags
@@ -0,0 +1 @@
+-Xstrict-inference
diff --git a/test/files/neg/t6680c.check b/test/files/neg/t6680c.check
new file mode 100644
index 0000000000..7a749de1f2
--- /dev/null
+++ b/test/files/neg/t6680c.check
@@ -0,0 +1,6 @@
+t6680c.scala:15: error: type mismatch;
+ found : String("a string!")
+ required: S
+ res match { case Unfold(s, f) => f("a string!") }
+ ^
+one error found
diff --git a/test/files/neg/t6680c.flags b/test/files/neg/t6680c.flags
new file mode 100644
index 0000000000..a02d83efad
--- /dev/null
+++ b/test/files/neg/t6680c.flags
@@ -0,0 +1 @@
+-Xstrict-inference
diff --git a/test/files/neg/t6829.check b/test/files/neg/t6829.check
index 7c3c66e0f2..a0b43e3b52 100644
--- a/test/files/neg/t6829.check
+++ b/test/files/neg/t6829.check
@@ -16,15 +16,35 @@ t6829.scala:49: error: not found: value nextState
val (s,a,s2) = (state,actions(agent),nextState)
^
t6829.scala:50: error: type mismatch;
- found : s.type (with underlying type Any)
+ found : s.type (with underlying type T1)
required: _53.State where val _53: G
val r = rewards(agent).r(s,a,s2)
^
+t6829.scala:50: error: type mismatch;
+ found : a.type (with underlying type T2)
+ required: _53.Action where val _53: G
+ val r = rewards(agent).r(s,a,s2)
+ ^
+t6829.scala:50: error: type mismatch;
+ found : s2.type (with underlying type T3)
+ required: _53.State where val _53: G
+ val r = rewards(agent).r(s,a,s2)
+ ^
t6829.scala:51: error: type mismatch;
- found : s.type (with underlying type Any)
+ found : s.type (with underlying type T1)
required: _50.State
agent.learn(s,a,s2,r): G#Agent
^
+t6829.scala:51: error: type mismatch;
+ found : a.type (with underlying type T2)
+ required: _50.Action
+ agent.learn(s,a,s2,r): G#Agent
+ ^
+t6829.scala:51: error: type mismatch;
+ found : s2.type (with underlying type T3)
+ required: _50.State
+ agent.learn(s,a,s2,r): G#Agent
+ ^
t6829.scala:53: error: not found: value nextState
Error occurred in an application involving default arguments.
copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory)
@@ -33,4 +53,4 @@ t6829.scala:53: error: not found: value currentHistory
Error occurred in an application involving default arguments.
copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory)
^
-9 errors found
+13 errors found
diff --git a/test/files/neg/t7020.check b/test/files/neg/t7020.check
index f9600ca7fc..76390b243d 100644
--- a/test/files/neg/t7020.check
+++ b/test/files/neg/t7020.check
@@ -1,17 +1,17 @@
t7020.scala:3: warning: match may not be exhaustive.
-It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(_, _)
List(5) match {
^
t7020.scala:10: warning: match may not be exhaustive.
-It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(_, _)
List(5) match {
^
t7020.scala:17: warning: match may not be exhaustive.
-It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(_, _)
List(5) match {
^
t7020.scala:24: warning: match may not be exhaustive.
-It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(_, _)
List(5) match {
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/t7157/Impls_Macros_1.scala b/test/files/neg/t7157/Impls_Macros_1.scala
index 09f423fbab..9069d26e6e 100644
--- a/test/files/neg/t7157/Impls_Macros_1.scala
+++ b/test/files/neg/t7157/Impls_Macros_1.scala
@@ -2,30 +2,30 @@ import scala.reflect.macros.Context
import language.experimental.macros
object Macros {
- def impl1_0_0(c: Context)() = c.literalUnit
- def impl1_1_1(c: Context)(x: c.Expr[Int]) = c.literalUnit
- def impl1_2_2(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = c.literalUnit
+ def impl1_0_0(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl1_1_1(c: Context)(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl1_2_2(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
def m1_0_0() = macro impl1_0_0
def m1_1_1(x: Int) = macro impl1_1_1
def m1_2_2(x: Int, y: Int) = macro impl1_2_2
- def impl1_0_inf(c: Context)(x: c.Expr[Int]*) = c.literalUnit
- def impl1_1_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int]*) = c.literalUnit
- def impl1_2_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = c.literalUnit
+ def impl1_0_inf(c: Context)(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl1_1_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl1_2_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
def m1_0_inf(x: Int*) = macro impl1_0_inf
def m1_1_inf(x: Int, y: Int*) = macro impl1_1_inf
def m1_2_inf(x: Int, y: Int, z: Int*) = macro impl1_2_inf
- def impl2_0_0(c: Context)()() = c.literalUnit
- def impl2_1_1(c: Context)()(x: c.Expr[Int]) = c.literalUnit
- def impl2_2_2(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]) = c.literalUnit
+ def impl2_0_0(c: Context)()() = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl2_1_1(c: Context)()(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl2_2_2(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
def m2_0_0()() = macro impl2_0_0
def m2_1_1()(x: Int) = macro impl2_1_1
def m2_2_2()(x: Int, y: Int) = macro impl2_2_2
- def impl2_0_inf(c: Context)()(x: c.Expr[Int]*) = c.literalUnit
- def impl2_1_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]*) = c.literalUnit
- def impl2_2_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = c.literalUnit
+ def impl2_0_inf(c: Context)()(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl2_1_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl2_2_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
def m2_0_inf()(x: Int*) = macro impl2_0_inf
def m2_1_inf()(x: Int, y: Int*) = macro impl2_1_inf
def m2_2_inf()(x: Int, y: Int, z: Int*) = macro impl2_2_inf
diff --git a/test/files/neg/t7239.check b/test/files/neg/t7239.check
new file mode 100644
index 0000000000..80b14f8fc6
--- /dev/null
+++ b/test/files/neg/t7239.check
@@ -0,0 +1,4 @@
+t7239.scala:10: error: not found: value foBar
+ fooBar = foBar.toInt
+ ^
+one error found
diff --git a/test/files/neg/t7239.scala b/test/files/neg/t7239.scala
new file mode 100644
index 0000000000..f62cac0a49
--- /dev/null
+++ b/test/files/neg/t7239.scala
@@ -0,0 +1,12 @@
+class Foo {
+ def toInt = 12
+}
+case class Bar( fooBar : Int )
+
+// spurious "erroneous or inaccessible type" error in 2.10.1
+class Test {
+ var fooBar : Foo = null
+ def build = Bar(
+ fooBar = foBar.toInt
+ )
+}
diff --git a/test/files/neg/t7385.check b/test/files/neg/t7385.check
index c196ec0b4f..70d3c3fb61 100644
--- a/test/files/neg/t7385.check
+++ b/test/files/neg/t7385.check
@@ -1,7 +1,10 @@
-t7385.scala:2: error: parenthesized conditional expression expected
+t7385.scala:2: error: '(' expected but identifier found.
do { println("bippy") } while i<10
^
-t7385.scala:6: error: parenthesized conditional expression expected
+t7385.scala:6: error: '(' expected but identifier found.
while i<10 { () }
^
-two errors found
+t7385.scala:7: error: illegal start of simple expression
+}
+^
+three errors found
diff --git a/test/files/neg/t7473.check b/test/files/neg/t7473.check
index c686466a44..bc8c29d463 100644
--- a/test/files/neg/t7473.check
+++ b/test/files/neg/t7473.check
@@ -1,7 +1,7 @@
-t7473.scala:5: error: for comprehension must start with generator: '<-' expected but '=' found.
- for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found.
- ^
-t7473.scala:8: error: for comprehension must start with generator: '<-' expected but '=' found.
+t7473.scala:6: error: '<-' expected but '=' found.
(for (x = Option(i); if x == j) yield 42) toList
^
+t7473.scala:6: error: illegal start of simple expression
+ (for (x = Option(i); if x == j) yield 42) toList
+ ^
two errors found
diff --git a/test/files/neg/t7473.scala b/test/files/neg/t7473.scala
index 1eb9e6cb7a..593231d5f2 100644
--- a/test/files/neg/t7473.scala
+++ b/test/files/neg/t7473.scala
@@ -1,9 +1,7 @@
object Foo {
val i,j = 3
-
- for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found.
-
+ //for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found.
// evil postfix!
(for (x = Option(i); if x == j) yield 42) toList
}
diff --git a/test/files/neg/t7519-b.check b/test/files/neg/t7519-b.check
new file mode 100644
index 0000000000..08d819eeec
--- /dev/null
+++ b/test/files/neg/t7519-b.check
@@ -0,0 +1,6 @@
+Use_2.scala:6: error: type mismatch;
+ found : String
+ required: Q
+ val x: Q = ex.Mac.mac("asdf")
+ ^
+one error found
diff --git a/test/files/neg/t7519-b/Mac_1.scala b/test/files/neg/t7519-b/Mac_1.scala
new file mode 100644
index 0000000000..55b583d24b
--- /dev/null
+++ b/test/files/neg/t7519-b/Mac_1.scala
@@ -0,0 +1,14 @@
+// get expected error message without package declaration
+package ex
+
+import scala.language.experimental.macros
+import scala.reflect.macros._
+
+object IW {
+ def foo(a: String): String = ???
+}
+object Mac {
+ def mac(s: String): String = macro macImpl
+ def macImpl(c: Context)(s: c.Expr[String]): c.Expr[String] =
+ c.universe.reify(IW.foo(s.splice))
+}
diff --git a/test/files/neg/t7519-b/Use_2.scala b/test/files/neg/t7519-b/Use_2.scala
new file mode 100644
index 0000000000..413e40e25e
--- /dev/null
+++ b/test/files/neg/t7519-b/Use_2.scala
@@ -0,0 +1,8 @@
+trait Q
+trait K
+
+object Use {
+ implicit def cd[T](p: T)(implicit ev: T => K): Q = ???
+ val x: Q = ex.Mac.mac("asdf")
+}
+
diff --git a/test/files/neg/t7519.check b/test/files/neg/t7519.check
index 164d67f595..df54abaa3e 100644
--- a/test/files/neg/t7519.check
+++ b/test/files/neg/t7519.check
@@ -1,7 +1,11 @@
-t7519.scala:5: error: could not find implicit value for parameter nada: Nothing
+t7519.scala:5: error: type mismatch;
+ found : Int(0)
+ required: String
locally(0 : String) // was: "value conversion is not a member of C.this.C"
^
-t7519.scala:15: error: could not find implicit value for parameter nada: Nothing
+t7519.scala:15: error: type mismatch;
+ found : Int(0)
+ required: String
locally(0 : String) // was: "value conversion is not a member of U"
^
two errors found
diff --git a/test/files/neg/t7629-view-bounds-deprecation.check b/test/files/neg/t7629-view-bounds-deprecation.check
new file mode 100644
index 0000000000..ed77c15c54
--- /dev/null
+++ b/test/files/neg/t7629-view-bounds-deprecation.check
@@ -0,0 +1,11 @@
+t7629-view-bounds-deprecation.scala:2: warning: View bounds are deprecated. Use an implicit parameter instead.
+Example: Instead of `def f[A <% Int](a: A)` use `def f[A](a: A)(implicit ev: A => Int)`.
+ def f[A <% Int](a: A) = null
+ ^
+t7629-view-bounds-deprecation.scala:3: warning: View bounds are deprecated. Use an implicit parameter instead.
+Example: Instead of `def f[A <% Int](a: A)` use `def f[A](a: A)(implicit ev: A => Int)`.
+ def g[C, B <: C, A <% B : Numeric](a: A) = null
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/test/files/neg/t7629-view-bounds-deprecation.flags b/test/files/neg/t7629-view-bounds-deprecation.flags
new file mode 100644
index 0000000000..43a25d4ccc
--- /dev/null
+++ b/test/files/neg/t7629-view-bounds-deprecation.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings -Xfuture
diff --git a/test/files/neg/t7629-view-bounds-deprecation.scala b/test/files/neg/t7629-view-bounds-deprecation.scala
new file mode 100644
index 0000000000..a6ede1fcc3
--- /dev/null
+++ b/test/files/neg/t7629-view-bounds-deprecation.scala
@@ -0,0 +1,4 @@
+object Test {
+ def f[A <% Int](a: A) = null
+ def g[C, B <: C, A <% B : Numeric](a: A) = null
+}
diff --git a/test/files/neg/t771.check b/test/files/neg/t771.check
index 51b0c97f8c..c0d1e002f8 100644
--- a/test/files/neg/t771.check
+++ b/test/files/neg/t771.check
@@ -1,4 +1,4 @@
t771.scala:4: error: trait Iterator is abstract; cannot be instantiated
def c[A](it:java.util.Iterator[A]) = new scala.Iterator[A]
- ^
+ ^
one error found
diff --git a/test/files/neg/t7721.check b/test/files/neg/t7721.check
index e056b9a293..ade1ca3b20 100644
--- a/test/files/neg/t7721.check
+++ b/test/files/neg/t7721.check
@@ -7,6 +7,9 @@ t7721.scala:15: warning: abstract type pattern A.this.Foo is unchecked since it
t7721.scala:19: warning: abstract type pattern A.this.Foo is unchecked since it is eliminated by erasure
case x: Foo with Bar => x.bippy + x.barry
^
+t7721.scala:19: warning: abstract type pattern A.this.Bar is unchecked since it is eliminated by erasure
+ case x: Foo with Bar => x.bippy + x.barry
+ ^
t7721.scala:39: warning: abstract type pattern B.this.Foo is unchecked since it is eliminated by erasure
case x: Foo with Concrete => x.bippy + x.dingo + x.conco
^
@@ -16,6 +19,9 @@ t7721.scala:43: warning: abstract type pattern B.this.Foo is unchecked since it
t7721.scala:47: warning: abstract type pattern B.this.Foo is unchecked since it is eliminated by erasure
case x: Foo with Bar with Concrete => x.bippy + x.barry + x.dingo + x.conco + x.bongo
^
+t7721.scala:47: warning: abstract type pattern B.this.Bar is unchecked since it is eliminated by erasure
+ case x: Foo with Bar with Concrete => x.bippy + x.barry + x.dingo + x.conco + x.bongo
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-6 warnings found
+8 warnings found
one error found
diff --git a/test/files/neg/t7756b.check b/test/files/neg/t7756b.check
index 2817a7e230..e764783241 100644
--- a/test/files/neg/t7756b.check
+++ b/test/files/neg/t7756b.check
@@ -1,6 +1,9 @@
t7756b.scala:3: warning: comparing values of types Int and String using `==' will always yield false
case _ => 0 == ""
^
+t7756b.scala:3: warning: Int and String are unrelated: they will most likely never compare equal
+ case _ => 0 == ""
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-one warning found
+two warnings found
one error found
diff --git a/test/files/neg/t7783.check b/test/files/neg/t7783.check
new file mode 100644
index 0000000000..647cfee121
--- /dev/null
+++ b/test/files/neg/t7783.check
@@ -0,0 +1,18 @@
+t7783.scala:1: warning: type D in object O is deprecated:
+object O { class C; @deprecated("", "") type D = C; def foo: Seq[D] = Nil }
+ ^
+t7783.scala:11: warning: type D in object O is deprecated:
+ type T = O.D
+ ^
+t7783.scala:12: warning: type D in object O is deprecated:
+ locally(null: O.D)
+ ^
+t7783.scala:13: warning: type D in object O is deprecated:
+ val x: O.D = null
+ ^
+t7783.scala:14: warning: type D in object O is deprecated:
+ locally(null.asInstanceOf[O.D])
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+5 warnings found
+one error found
diff --git a/test/files/neg/t7783.flags b/test/files/neg/t7783.flags
new file mode 100644
index 0000000000..d1b831ea87
--- /dev/null
+++ b/test/files/neg/t7783.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7783.scala b/test/files/neg/t7783.scala
new file mode 100644
index 0000000000..995b644a09
--- /dev/null
+++ b/test/files/neg/t7783.scala
@@ -0,0 +1,15 @@
+object O { class C; @deprecated("", "") type D = C; def foo: Seq[D] = Nil }
+
+object NoWarn {
+ O.foo // nowarn
+ O.foo +: Nil // nowarn
+ def bar(a: Any, b: Any) = () // nowarn
+ bar(b = O.foo, a = ()) // nowarn
+}
+
+object Warn {
+ type T = O.D
+ locally(null: O.D)
+ val x: O.D = null
+ locally(null.asInstanceOf[O.D])
+}
diff --git a/test/files/neg/t7848-interp-warn.check b/test/files/neg/t7848-interp-warn.check
index cbdc9f4c27..b7df6d8ce2 100644
--- a/test/files/neg/t7848-interp-warn.check
+++ b/test/files/neg/t7848-interp-warn.check
@@ -1,9 +1,12 @@
-t7848-interp-warn.scala:7: warning: `$foo` looks like an interpolated identifier! Did you forget the interpolator?
+t7848-interp-warn.scala:8: warning: `$foo` looks like an interpolated identifier! Did you forget the interpolator?
"An important $foo message!"
^
-t7848-interp-warn.scala:11: warning: That looks like an interpolated expression! Did you forget the interpolator?
+t7848-interp-warn.scala:12: warning: That looks like an interpolated expression! Did you forget the interpolator?
"A doubly important ${foo * 2} message!"
^
+t7848-interp-warn.scala:16: warning: `$bar` looks like an interpolated identifier! Did you forget the interpolator?
+ def j = s"Try using '${ "something like $bar" }' instead." // warn
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-two warnings found
+three warnings found
one error found
diff --git a/test/files/neg/t7848-interp-warn.scala b/test/files/neg/t7848-interp-warn.scala
index bb3eeff60c..3887aff8de 100644
--- a/test/files/neg/t7848-interp-warn.scala
+++ b/test/files/neg/t7848-interp-warn.scala
@@ -2,6 +2,7 @@
package test
object Test {
+ def bar = "bar"
def f = {
val foo = "bar"
"An important $foo message!"
@@ -10,4 +11,8 @@ object Test {
val foo = "bar"
"A doubly important ${foo * 2} message!"
}
+ def h = s"Try using '$$bar' instead." // no warn
+ def i = s"Try using '${ "$bar" }' instead." // no warn on space test
+ def j = s"Try using '${ "something like $bar" }' instead." // warn
+ def k = f"Try using '$bar' instead." // no warn on other std interps
}
diff --git a/test/files/neg/t7859.check b/test/files/neg/t7859.check
new file mode 100644
index 0000000000..5789e2a122
--- /dev/null
+++ b/test/files/neg/t7859.check
@@ -0,0 +1,19 @@
+B_2.scala:6: error: not found: value x
+ new p1.A(x).x
+ ^
+B_2.scala:6: error: value x in class A cannot be accessed in p1.A
+ new p1.A(x).x
+ ^
+B_2.scala:7: error: not found: value x
+ new B(x).x
+ ^
+B_2.scala:7: error: value x is not a member of B
+ new B(x).x
+ ^
+B_2.scala:8: error: not found: value x
+ new C(x).x
+ ^
+B_2.scala:8: error: value x in class C cannot be accessed in C
+ new C(x).x
+ ^
+6 errors found
diff --git a/test/files/neg/t7859/A_1.scala b/test/files/neg/t7859/A_1.scala
new file mode 100644
index 0000000000..e5b32d1c96
--- /dev/null
+++ b/test/files/neg/t7859/A_1.scala
@@ -0,0 +1,5 @@
+package p1 {
+ class A(private[p1] val x: Any) extends AnyVal
+}
+class B(private val x: Any) extends AnyVal
+
diff --git a/test/files/neg/t7859/B_2.scala b/test/files/neg/t7859/B_2.scala
new file mode 100644
index 0000000000..2e0556bc7b
--- /dev/null
+++ b/test/files/neg/t7859/B_2.scala
@@ -0,0 +1,9 @@
+class C(private val x: Any) extends AnyVal
+
+// Checking that makeNotPrivate(paramAccessor) doesn't make this visible during typer.
+// The output is identical with/without `extends AnyVal`.
+object Test {
+ new p1.A(x).x
+ new B(x).x
+ new C(x).x
+}
diff --git a/test/files/neg/t7870.check b/test/files/neg/t7870.check
new file mode 100644
index 0000000000..d9db911ac1
--- /dev/null
+++ b/test/files/neg/t7870.check
@@ -0,0 +1,4 @@
+t7870.scala:1: error: in class C, multiple overloaded alternatives of constructor C define default arguments.
+class C(a: Int = 0, b: Any) {
+ ^
+one error found
diff --git a/test/files/neg/t7870.scala b/test/files/neg/t7870.scala
new file mode 100644
index 0000000000..5d48d43b3a
--- /dev/null
+++ b/test/files/neg/t7870.scala
@@ -0,0 +1,3 @@
+class C(a: Int = 0, b: Any) {
+ def this(a: Int = 0) = this(???, ???)
+}
diff --git a/test/files/neg/t7877.check b/test/files/neg/t7877.check
new file mode 100644
index 0000000000..7f7f832463
--- /dev/null
+++ b/test/files/neg/t7877.check
@@ -0,0 +1,7 @@
+t7877.scala:6: error: not found: value Y
+ case Y() => () // not allowed
+ ^
+t7877.scala:7: error: OnNext[Any] does not take parameters
+ case OnNext[Any]() => () // should *not* be allowed, but was.
+ ^
+two errors found
diff --git a/test/files/neg/t7877.scala b/test/files/neg/t7877.scala
new file mode 100644
index 0000000000..52e167f3b8
--- /dev/null
+++ b/test/files/neg/t7877.scala
@@ -0,0 +1,13 @@
+class Test {
+ val X: OnNext[Any] = null
+ def Y: OnNext[Any] = null
+ (null: Any) match {
+ case X() => () // allowed
+ case Y() => () // not allowed
+ case OnNext[Any]() => () // should *not* be allowed, but was.
+ }
+}
+
+class OnNext[+T] {
+ def unapply(x: Any) = false
+}
diff --git a/test/files/neg/t7886.check b/test/files/neg/t7886.check
new file mode 100644
index 0000000000..338eee9708
--- /dev/null
+++ b/test/files/neg/t7886.check
@@ -0,0 +1,6 @@
+t7886.scala:10: error: type mismatch;
+ found : Contra[A]
+ required: Contra[Any]
+ case Unravel(m, msg) => g(m)
+ ^
+one error found
diff --git a/test/files/neg/t7886.scala b/test/files/neg/t7886.scala
new file mode 100644
index 0000000000..55d80a0a43
--- /dev/null
+++ b/test/files/neg/t7886.scala
@@ -0,0 +1,22 @@
+trait Covariant[+A]
+trait Contra[-A] { def accept(p: A): Unit }
+trait Invariant[A] extends Covariant[A] with Contra[A]
+
+case class Unravel[A](m: Contra[A], msg: A)
+
+object Test extends Covariant[Any] {
+ def g(m: Contra[Any]): Unit = m accept 5
+ def f(x: Any): Unit = x match {
+ case Unravel(m, msg) => g(m)
+ case _ =>
+ }
+ def main(args: Array[String]) {
+ f(Unravel[String](new Contra[String] { def accept(x: String) = x.length }, ""))
+ }
+}
+// java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+// at Test$$anon$1.accept(a.scala:18)
+// at Test$.g(a.scala:13)
+// at Test$.f(a.scala:15)
+// at Test$.main(a.scala:18)
+// at Test.main(a.scala)
diff --git a/test/files/neg/t7895.check b/test/files/neg/t7895.check
new file mode 100644
index 0000000000..1a58e24b77
--- /dev/null
+++ b/test/files/neg/t7895.check
@@ -0,0 +1,4 @@
+t7895.scala:4: error: not found: value Goop
+ case Goop(a, b, c) => Tuple2(a, b)
+ ^
+one error found
diff --git a/test/files/neg/t7895.scala b/test/files/neg/t7895.scala
new file mode 100644
index 0000000000..87a586a82d
--- /dev/null
+++ b/test/files/neg/t7895.scala
@@ -0,0 +1,6 @@
+class A {
+ (null: Any) match {
+ // We don't want "symbol not found errors" for `a` and `b` in the case body.
+ case Goop(a, b, c) => Tuple2(a, b)
+ }
+}
diff --git a/test/files/neg/t7895b.check b/test/files/neg/t7895b.check
new file mode 100644
index 0000000000..87ea72704e
--- /dev/null
+++ b/test/files/neg/t7895b.check
@@ -0,0 +1,7 @@
+t7895b.scala:4: error: not found: value a
+ foo(a, b)
+ ^
+t7895b.scala:4: error: not found: value b
+ foo(a, b)
+ ^
+two errors found
diff --git a/test/files/neg/t7895b.scala b/test/files/neg/t7895b.scala
new file mode 100644
index 0000000000..1603027446
--- /dev/null
+++ b/test/files/neg/t7895b.scala
@@ -0,0 +1,5 @@
+object Test {
+ def foo(a: Any*) = ()
+
+ foo(a, b)
+}
diff --git a/test/files/neg/t7895c.check b/test/files/neg/t7895c.check
new file mode 100644
index 0000000000..d4745b1f4b
--- /dev/null
+++ b/test/files/neg/t7895c.check
@@ -0,0 +1,13 @@
+t7895c.scala:2: error: not found: value bong
+ def booboo = bong + booble + bippity - bazingo
+ ^
+t7895c.scala:2: error: not found: value booble
+ def booboo = bong + booble + bippity - bazingo
+ ^
+t7895c.scala:2: error: not found: value bippity
+ def booboo = bong + booble + bippity - bazingo
+ ^
+t7895c.scala:2: error: not found: value bazingo
+ def booboo = bong + booble + bippity - bazingo
+ ^
+four errors found
diff --git a/test/files/neg/t7895c.scala b/test/files/neg/t7895c.scala
new file mode 100644
index 0000000000..53d2a8672e
--- /dev/null
+++ b/test/files/neg/t7895c.scala
@@ -0,0 +1,3 @@
+class A {
+ def booboo = bong + booble + bippity - bazingo
+}
diff --git a/test/files/neg/t7899.check b/test/files/neg/t7899.check
new file mode 100644
index 0000000000..febfe76b8a
--- /dev/null
+++ b/test/files/neg/t7899.check
@@ -0,0 +1,6 @@
+t7899.scala:5: error: type mismatch;
+ found : Int => Int
+ required: (=> Int) => ?
+ foo(identity)()
+ ^
+one error found
diff --git a/test/files/neg/t7899.scala b/test/files/neg/t7899.scala
new file mode 100644
index 0000000000..f2dea3ab1f
--- /dev/null
+++ b/test/files/neg/t7899.scala
@@ -0,0 +1,7 @@
+object Test {
+ def foo[B](f: (=> Int) => B): () => B = () => f(0)
+
+ def main(args: Array[String]) {
+ foo(identity)()
+ }
+}
diff --git a/test/files/neg/t997.check b/test/files/neg/t997.check
index be1e92c369..8c41060ba2 100644
--- a/test/files/neg/t997.check
+++ b/test/files/neg/t997.check
@@ -4,7 +4,4 @@ t997.scala:13: error: wrong number of patterns for object Foo offering (String,
t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3
"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
^
-t997.scala:13: error: not found: value a
-"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
- ^
-three errors found
+two errors found
diff --git a/test/files/neg/typeerror.check b/test/files/neg/typeerror.check
index 3ce11dad8a..f117e702f0 100644
--- a/test/files/neg/typeerror.check
+++ b/test/files/neg/typeerror.check
@@ -3,4 +3,9 @@ typeerror.scala:6: error: type mismatch;
required: scala.Long
else add2(x.head, y.head) :: add(x.tail, y.tail)
^
-one error found
+typeerror.scala:6: error: type mismatch;
+ found : Long(in method add)
+ required: scala.Long
+ else add2(x.head, y.head) :: add(x.tail, y.tail)
+ ^
+two errors found
diff --git a/test/files/neg/unreachablechar.check b/test/files/neg/unreachablechar.check
index 121f12a0c7..a621196c56 100644
--- a/test/files/neg/unreachablechar.check
+++ b/test/files/neg/unreachablechar.check
@@ -4,6 +4,9 @@ unreachablechar.scala:4: warning: patterns after a variable pattern cannot match
unreachablechar.scala:5: warning: unreachable code due to variable pattern on line 4
case 'f' => println("not stuff?");
^
+unreachablechar.scala:5: warning: unreachable code
+ case 'f' => println("not stuff?");
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-two warnings found
+three warnings found
one error found
diff --git a/test/files/neg/valueclasses-doubledefs.check b/test/files/neg/valueclasses-doubledefs.check
index 556d7a0900..ec513aca6b 100644
--- a/test/files/neg/valueclasses-doubledefs.check
+++ b/test/files/neg/valueclasses-doubledefs.check
@@ -1,6 +1,6 @@
valueclasses-doubledefs.scala:5: error: double definition:
-method apply:(x: Meter)String and
-method apply:(x: Double)String at line 4
+def apply(x: Double): String at line 4 and
+def apply(x: Meter): String at line 5
have same type after erasure: (x: Double)String
def apply(x: Meter) = x.toString
^
diff --git a/test/files/neg/valueclasses-pavlov.check b/test/files/neg/valueclasses-pavlov.check
index 031589edad..17102a0c68 100644
--- a/test/files/neg/valueclasses-pavlov.check
+++ b/test/files/neg/valueclasses-pavlov.check
@@ -1,6 +1,6 @@
valueclasses-pavlov.scala:8: error: double definition:
-method foo:(x: Box2)String and
-method foo:(x: String)String at line 7
+def foo(x: String): String at line 7 and
+def foo(x: Box2): String at line 8
have same type after erasure: (x: String)String
def foo(x: Box2) = "foo(Box2): ok"
^
diff --git a/test/files/neg/valueclasses.check b/test/files/neg/valueclasses.check
index 3b82a8358c..35d38aae60 100644
--- a/test/files/neg/valueclasses.check
+++ b/test/files/neg/valueclasses.check
@@ -4,40 +4,43 @@ trait T extends AnyVal // fail
valueclasses.scala:6: error: value class may not be a member of another class
class Bar(x: Int) extends AnyVal // fail
^
+valueclasses.scala:6: error: value class parameter must be a val and not be private[this]
+ class Bar(x: Int) extends AnyVal // fail
+ ^
valueclasses.scala:8: error: value class may not be a local class
class Baz(x: Int) extends AnyVal // fail
^
-valueclasses.scala:12: error: value class needs to have exactly one public val parameter
+valueclasses.scala:8: error: value class parameter must be a val and not be private[this]
+ class Baz(x: Int) extends AnyVal // fail
+ ^
+valueclasses.scala:12: error: value class needs to have exactly one val parameter
class V1 extends AnyVal // fail
^
-valueclasses.scala:14: error: value class needs to have a publicly accessible val parameter
-class V2(private[test] val x: Int) extends AnyVal // fail
- ^
-valueclasses.scala:15: error: value class needs to have a publicly accessible val parameter
-class V3(protected[test] val x: Int) extends AnyVal // fail
- ^
-valueclasses.scala:16: error: value class needs to have a publicly accessible val parameter
-class V4(protected val x: Int) extends AnyVal // fail
- ^
-valueclasses.scala:17: error: value class needs to have a publicly accessible val parameter
-class V5(private val x: Int) extends AnyVal // fail
- ^
-valueclasses.scala:19: error: value class needs to have exactly one public val parameter
+valueclasses.scala:19: error: value class needs to have exactly one val parameter
class V6(val x: Int, val y: String) extends AnyVal // fail
^
-valueclasses.scala:20: error: field definition is not allowed in value class
+valueclasses.scala:20: error: value class needs to have exactly one val parameter
class V7(val x: Int, private[this] val y: String) extends AnyVal // fail
- ^
-valueclasses.scala:21: error: value class needs to have exactly one public val parameter
-class V8(var x: Int) extends AnyVal // fail
^
+valueclasses.scala:21: error: value class parameter must not be a var
+class V8(var x: Int) extends AnyVal // fail
+ ^
valueclasses.scala:24: error: field definition is not allowed in value class
val y = x // fail
^
valueclasses.scala:29: error: type parameter of value class may not be specialized
class V12[@specialized T, U](val x: (T, U)) extends AnyVal // fail
^
-valueclasses.scala:31: error: value class needs to have exactly one public val parameter
+valueclasses.scala:31: error: value class parameter must be a val and not be private[this]
class V13(x: Int) extends AnyVal // fail
+ ^
+valueclasses.scala:33: error: value class parameter must be a val and not be private[this]
+class V14(private[this] val x: Int) extends AnyVal // fail
+ ^
+valueclasses.scala:34: error: value class parameter must not be protected[this]
+class V15(protected[this] val x: Int) extends AnyVal // fail
+ ^
+valueclasses.scala:36: error: value class needs to have exactly one val parameter
+class V16()(val a: Any) extends AnyVal // fail, was allowed 2.10.x
^
-14 errors found
+15 errors found
diff --git a/test/files/neg/valueclasses.scala b/test/files/neg/valueclasses.scala
index 7cac94ab11..06fde40a70 100644
--- a/test/files/neg/valueclasses.scala
+++ b/test/files/neg/valueclasses.scala
@@ -11,10 +11,10 @@ class Foo {
class V1 extends AnyVal // fail
-class V2(private[test] val x: Int) extends AnyVal // fail
-class V3(protected[test] val x: Int) extends AnyVal // fail
-class V4(protected val x: Int) extends AnyVal // fail
-class V5(private val x: Int) extends AnyVal // fail
+class V2(private[test] val x: Int) extends AnyVal // okay, wasn't allowed in 2.10.x
+class V3(protected[test] val x: Int) extends AnyVal // okay, wasn't allowed in 2.10.x
+class V4(protected val x: Int) extends AnyVal // okay, wasn't allowed in 2.10.x
+class V5(private val x: Int) extends AnyVal // okay, wasn't allowed in 2.10.x
class V6(val x: Int, val y: String) extends AnyVal // fail
class V7(val x: Int, private[this] val y: String) extends AnyVal // fail
@@ -29,3 +29,8 @@ class V11[T](val x: List[T]) extends AnyVal // ok
class V12[@specialized T, U](val x: (T, U)) extends AnyVal // fail
class V13(x: Int) extends AnyVal // fail
+
+class V14(private[this] val x: Int) extends AnyVal // fail
+class V15(protected[this] val x: Int) extends AnyVal // fail
+
+class V16()(val a: Any) extends AnyVal // fail, was allowed 2.10.x
diff --git a/test/files/neg/warn-unused-privates.check b/test/files/neg/warn-unused-privates.check
index 9c41a33e8f..d012869c93 100644
--- a/test/files/neg/warn-unused-privates.check
+++ b/test/files/neg/warn-unused-privates.check
@@ -16,6 +16,9 @@ warn-unused-privates.scala:35: warning: private val in class Boppy is never used
warn-unused-privates.scala:42: warning: private var in trait Accessors is never used
private var v1: Int = 0 // warn
^
+warn-unused-privates.scala:42: warning: private setter in trait Accessors is never used
+ private var v1: Int = 0 // warn
+ ^
warn-unused-privates.scala:43: warning: private setter in trait Accessors is never used
private var v2: Int = 0 // warn, never set
^
@@ -59,5 +62,5 @@ warn-unused-privates.scala:102: warning: local type OtherThing is never used
type OtherThing = String // warn
^
error: No warnings can be incurred under -Xfatal-warnings.
-20 warnings found
+21 warnings found
one error found
diff --git a/test/files/neg/xmltruncated6.check b/test/files/neg/xmltruncated6.check
index 6123114560..f638f2f090 100644
--- a/test/files/neg/xmltruncated6.check
+++ b/test/files/neg/xmltruncated6.check
@@ -1,4 +1,4 @@
-xmltruncated6.scala:2: error: ';' expected but eof found.
+xmltruncated6.scala:2: error: in XML literal: expected end of Scala block
val stuff = <a>{ "no closing brace"
^
one error found
diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
index ecf8916c46..9b7af0c3b8 100644
--- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
+++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
@@ -38,10 +38,10 @@ object Macros {
val reifiedExpr = c.Expr[scala.reflect.runtime.universe.Expr[T => U]](reifiedTree)
val template =
c.universe.reify(new (T => U) with TypedFunction {
- override def toString = c.literal(tp+" => "+ttag.tpe+" { "+b1.toString+" } ").splice // DEBUG
+ override def toString = c.Expr[String](q"""${tp+" => "+ttag.tpe+" { "+b1.toString+" } "}""").splice // DEBUG
def tree = reifiedExpr.splice.tree
- val typeIn = c.literal(tp.toString).splice
- val typeOut = c.literal(ttag.tpe.toString).splice
+ val typeIn = c.Expr[String](q"${tp.toString}").splice
+ val typeOut = c.Expr[String](q"${ttag.tpe.toString}").splice
def apply(_arg: T): U = c.Expr[U](b1)(ttag.asInstanceOf[c.WeakTypeTag[U]]).splice
})
val untyped = c.resetLocalAttrs(template.tree)
diff --git a/test/files/pos/gadts2.scala b/test/files/pos/gadts2.scala
index fc2a7e4333..d77c8a7ba4 100644
--- a/test/files/pos/gadts2.scala
+++ b/test/files/pos/gadts2.scala
@@ -4,7 +4,7 @@ object Test {
case class MyInt(n: Int) extends Number
case class MyDouble(d: Double) extends Number
- trait Term[+a]
+ trait Term[a]
case class Cell[a](var x: a) extends Term[a]
final case class NumTerm(val n: Number) extends Term[Number]
diff --git a/test/files/pos/pattern-typing.scala b/test/files/pos/pattern-typing.scala
new file mode 100644
index 0000000000..7286cc38af
--- /dev/null
+++ b/test/files/pos/pattern-typing.scala
@@ -0,0 +1,29 @@
+import scala.language.higherKinds
+
+trait Bound[B]
+
+package p1 {
+ case class Sub[B <: Bound[B]](p: B)
+ object Test {
+ def g[A](x: Bound[A]) = ()
+ def f(x: Any) = x match { case Sub(p) => g(p) }
+ }
+}
+
+package p2 {
+ trait Traversable[+A] { def head: A = ??? }
+ trait Seq[+A] extends Traversable[A] { def length: Int = ??? }
+
+ case class SubHK[B <: Bound[B], CC[X] <: Traversable[X]](xs: CC[B])
+ class MyBound extends Bound[MyBound]
+ class MySeq extends Seq[MyBound]
+
+ object Test {
+ def g[B](x: Bound[B]) = ()
+
+ def f1(x: Any) = x match { case SubHK(xs) => xs }
+ def f2[B <: Bound[B], CC[X] <: Traversable[X]](sub: SubHK[B, CC]): CC[B] = sub match { case SubHK(xs) => xs }
+ def f3 = g(f1(SubHK(new MySeq)).head)
+ def f4 = g(f2(SubHK(new MySeq)).head)
+ }
+}
diff --git a/test/files/pos/sammy_poly.flags b/test/files/pos/sammy_poly.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/pos/sammy_poly.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/test/files/pos/sammy_poly.scala b/test/files/pos/sammy_poly.scala
new file mode 100644
index 0000000000..c629be7166
--- /dev/null
+++ b/test/files/pos/sammy_poly.scala
@@ -0,0 +1,7 @@
+// test synthesizeSAMFunction where the sam type is not fully defined
+class T {
+ trait F[T, U] { def apply(x: T): U }
+ // NOTE: the f(x) desugaring for now assumes the single abstract method is called 'apply'
+ def app[T, U](x: T)(f: F[T, U]): U = f(x)
+ app(1)(x => List(x))
+} \ No newline at end of file
diff --git a/test/files/pos/sammy_scope.flags b/test/files/pos/sammy_scope.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/pos/sammy_scope.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/test/files/pos/sammy_scope.scala b/test/files/pos/sammy_scope.scala
new file mode 100644
index 0000000000..8f1fe7058e
--- /dev/null
+++ b/test/files/pos/sammy_scope.scala
@@ -0,0 +1,8 @@
+// test synthesizeSAMFunction: scope hygiene
+abstract class SamFun[T1, R] { self =>
+ def apply(v1: T1): R
+
+ // this should type check, as the apply ref is equivalent to self.apply
+ // it shouldn't resolve to the sam's apply that's synthesized (that wouldn't type check, hence the pos test)
+ def compose[A](g: SamFun[A, T1]): SamFun[A, R] = { x => apply(g(x)) }
+} \ No newline at end of file
diff --git a/test/files/pos/sammy_single.flags b/test/files/pos/sammy_single.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/pos/sammy_single.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/test/files/pos/sammy_single.scala b/test/files/pos/sammy_single.scala
new file mode 100644
index 0000000000..7a3d272983
--- /dev/null
+++ b/test/files/pos/sammy_single.scala
@@ -0,0 +1,9 @@
+// test that dependent types work
+// TODO: def apply(x: String): x.type does NOT work yet
+object Test {
+ val s: String = ""
+
+ trait T { def apply(x: s.type): s.type }
+
+ val preservedResult: s.type = ((x => x): T)(s)
+} \ No newline at end of file
diff --git a/test/files/pos/sammy_twice.flags b/test/files/pos/sammy_twice.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/pos/sammy_twice.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/test/files/pos/sammy_twice.scala b/test/files/pos/sammy_twice.scala
new file mode 100644
index 0000000000..c91f5b9fd2
--- /dev/null
+++ b/test/files/pos/sammy_twice.scala
@@ -0,0 +1,9 @@
+// test repeated synthesizeSAMFunction where the sam type is not fully defined
+// the naive implementation would enter the same apply$body in the same scope twice
+trait F[T, U] { def apply(x: T): U }
+
+class C {
+ def app[T, U](x: T)(f: F[T, U]): U = f(x)
+ app(1)(x => List(x))
+ app(2)(x => List(x))
+} \ No newline at end of file
diff --git a/test/files/pos/t5692a/Macros_1.scala b/test/files/pos/t5692a/Macros_1.scala
index 06b5a3de36..e530713bb0 100644
--- a/test/files/pos/t5692a/Macros_1.scala
+++ b/test/files/pos/t5692a/Macros_1.scala
@@ -1,6 +1,6 @@
import scala.reflect.macros.Context
object Macros {
- def impl[T](c: Context) = c.literalUnit
+ def impl[T](c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo[T] = macro impl[T]
} \ No newline at end of file
diff --git a/test/files/pos/t5692b/Macros_1.scala b/test/files/pos/t5692b/Macros_1.scala
index b28d19f903..45c672cfce 100644
--- a/test/files/pos/t5692b/Macros_1.scala
+++ b/test/files/pos/t5692b/Macros_1.scala
@@ -1,6 +1,6 @@
import scala.reflect.macros.Context
object Macros {
- def impl[T, U](c: Context) = c.literalUnit
+ def impl[T, U](c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo[T, U] = macro impl[T, U]
} \ No newline at end of file
diff --git a/test/files/pos/t5845.check b/test/files/pos/t5845.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/t5845.check
diff --git a/test/files/neg/t5845.scala b/test/files/pos/t5845.scala
index 823c722c14..823c722c14 100644
--- a/test/files/neg/t5845.scala
+++ b/test/files/pos/t5845.scala
diff --git a/test/files/pos/t6221.scala b/test/files/pos/t6221.scala
index dd7776f596..34f02859f3 100644
--- a/test/files/pos/t6221.scala
+++ b/test/files/pos/t6221.scala
@@ -7,23 +7,27 @@ class MyCollection[A] {
class OtherFunc[-A, +B] {}
object Test {
- implicit def functionToMyFunc[A, B](f: A => B): MyFunc[A, B] = new MyFunc
+ implicit def functionToMyFunc[A, B](f: A => B): MyFunc[A, B] = new MyFunc // = new MyFunc[A,Nothing]();
- implicit def otherFuncToMyFunc[A, B](f: OtherFunc[A, B]): MyFunc[A, B] = new MyFunc
+ implicit def otherFuncToMyFunc[A, B](f: OtherFunc[A, B]): MyFunc[A, B] = new MyFunc // = new MyFunc[A,Nothing]();
def main(args: Array[String]) {
val col = new MyCollection[Int]
// Doesn't compile: error: missing parameter type for expanded function ((x$1) => x$1.toString)
println(col.map(_.toString))
+ // scala.this.Predef.println(col.map[String](Test.this.functionToMyFunc[Int, String](((x$1: Int) => x$1.toString()))));
// Doesn't compile: error: missing parameter type
println(col.map(x => x.toString))
+ // scala.this.Predef.println(col.map[String](Test.this.functionToMyFunc[Int, String](((x: Int) => x.toString()))));
// Does compile
println(col.map((x: Int) => x.toString))
+ // scala.this.Predef.println(col.map[String](Test.this.functionToMyFunc[Int, String](((x: Int) => x.toString()))));
// Does compile (even though type params of OtherFunc not given)
println(col.map(new OtherFunc))
+ // scala.this.Predef.println(col.map[Nothing](Test.this.otherFuncToMyFunc[Any, Nothing](new OtherFunc[Any,Nothing]())))
}
} \ No newline at end of file
diff --git a/test/files/pos/t7461/Macros_1.scala b/test/files/pos/t7461/Macros_1.scala
index 353dec66d7..8621650f77 100644
--- a/test/files/pos/t7461/Macros_1.scala
+++ b/test/files/pos/t7461/Macros_1.scala
@@ -6,7 +6,7 @@ object Macros {
import c.universe._
val wut = c.typeCheck(Select(Literal(Constant(10)), newTermName("$minus")), silent = true)
// println(showRaw(wut, printIds = true, printTypes = true))
- c.literalUnit
+ c.Expr[Unit](q"()")
}
def foo = macro impl
diff --git a/test/files/pos/t7584.scala b/test/files/pos/t7584.scala
deleted file mode 100644
index 52d127ecb9..0000000000
--- a/test/files/pos/t7584.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-object Test {
- def fold[A, B](f: (A, => B) => B) = ???
- def f[A, B](x: A, y: B): B = ???
- 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))
- fold[Int, Int](f)
-}
-
diff --git a/test/files/pos/t7649.scala b/test/files/pos/t7649.scala
index a1b02f63f1..ff3c626fca 100644
--- a/test/files/pos/t7649.scala
+++ b/test/files/pos/t7649.scala
@@ -4,7 +4,7 @@ object Test {
reify {
// The lookup of the implicit WeakTypeTag[Any]
// was triggering an unpositioned tree.
- c.Expr[Any](Literal(Constant(0))).splice
+ c.Expr[Any](q"0").splice
}
import scala.reflect.ClassTag
diff --git a/test/files/pos/t7688.scala b/test/files/pos/t7688.scala
new file mode 100644
index 0000000000..5a846b97e9
--- /dev/null
+++ b/test/files/pos/t7688.scala
@@ -0,0 +1,7 @@
+import scala.reflect.macros._
+
+class A[C <: Context with Singleton](position: C#Position)
+
+object A {
+ def apply(c: Context)(in: c.Tree): A[c.type] = new A(in.pos)
+}
diff --git a/test/files/pos/t7815.scala b/test/files/pos/t7815.scala
new file mode 100644
index 0000000000..12a434c5b0
--- /dev/null
+++ b/test/files/pos/t7815.scala
@@ -0,0 +1,30 @@
+import language.higherKinds
+
+trait Foo[A <: AnyRef] {
+ type Repr
+ def f(a: A): Repr
+ def g(a: A): Option[Repr]
+
+ type M[X]
+ def m(a: A): M[a.type]
+
+ type Id[X] = X
+ def n(a: A): Id[(Repr, M[a.type])]
+
+}
+
+object Foo {
+ type Aux[A <: AnyRef, B] = Foo[A] { type Repr = B; type M[X] = Int }
+
+}
+
+object Main extends App {
+ def mapWithFoo[A <: AnyRef, B](as: List[A])(implicit foo: Foo.Aux[A, B]) = {
+ // Should be Eta expandable because the result type of `f` is not
+ // dependant on the value, it is just `B`.
+ as map foo.f
+ as map foo.g
+ as map foo.m
+ as map foo.n
+ }
+}
diff --git a/test/files/pos/t7854.scala b/test/files/pos/t7854.scala
deleted file mode 100644
index d4de7dfe38..0000000000
--- a/test/files/pos/t7854.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-class A {
- var f: Int => Unit = _ => ()
-
- f = null
-}
diff --git a/test/files/pos/t7902.scala b/test/files/pos/t7902.scala
new file mode 100644
index 0000000000..47c525c179
--- /dev/null
+++ b/test/files/pos/t7902.scala
@@ -0,0 +1,17 @@
+import scala.language.higherKinds
+
+object Bug {
+ class Tag[W[M1[X1]]]
+
+ def ofType[W[M2[X2]]]: Tag[W] = ???
+ type InSeq [M3[X3]] = Some[M3[Any]]
+
+ // fail
+ val x = ofType[InSeq]
+
+ // okay
+ val y: Any = ofType[InSeq]
+ object T {
+ val z = ofType[InSeq]
+ }
+}
diff --git a/test/files/res/t687.check b/test/files/res/t687.check
index b741b262b9..5f72c98636 100644
--- a/test/files/res/t687.check
+++ b/test/files/res/t687.check
@@ -1,8 +1,8 @@
nsc>
nsc> t687/QueryB.scala:3: error: name clash between defined and inherited member:
-method equals:(o: Object)Boolean and
-method equals:(x$1: Any)Boolean in class Any
-have same type after erasure: (o: Object)Boolean
+def equals(x$1: Any): Boolean in class Any and
+override def equals(o: Object): Boolean at line 3
+have same type after erasure: (x$1: Object)Boolean
override def equals(o : Object) = false;
^
diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check
index f022aac1b2..d965d8a2ff 100644
--- a/test/files/run/constrained-types.check
+++ b/test/files/run/constrained-types.check
@@ -138,6 +138,15 @@ 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
^
+<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/existential-rangepos.check b/test/files/run/existential-rangepos.check
index f426c6471f..1212b60bae 100644
--- a/test/files/run/existential-rangepos.check
+++ b/test/files/run/existential-rangepos.check
@@ -1,13 +1,13 @@
[[syntax trees at end of patmat]] // newSource1.scala
[0:76]package [0:0]<empty> {
- [15/0:76]abstract class A[[17:18]T[17:18]] extends [20:76][76]scala.AnyRef {
+ [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]()
};
- [28:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null;
+ [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;
- [58:74]<stable> <accessor> def bar: [58]Set[_ <: T]
+ [54:74]<stable> <accessor> def bar: [58]Set[_ <: T]
}
}
diff --git a/test/files/run/future-flatmap-exec-count.check b/test/files/run/future-flatmap-exec-count.check
new file mode 100644
index 0000000000..dd9dce64ed
--- /dev/null
+++ b/test/files/run/future-flatmap-exec-count.check
@@ -0,0 +1,6 @@
+mapping
+execute()
+flatmapping
+execute()
+recovering
+execute()
diff --git a/test/files/run/future-flatmap-exec-count.scala b/test/files/run/future-flatmap-exec-count.scala
new file mode 100644
index 0000000000..86c37be938
--- /dev/null
+++ b/test/files/run/future-flatmap-exec-count.scala
@@ -0,0 +1,61 @@
+import scala.concurrent._
+import java.util.concurrent.atomic.AtomicInteger
+
+object Test {
+ def main(args: Array[String]) {
+ test()
+ }
+
+ def test() = {
+ def await(f: Future[Any]) =
+ Await.result(f, duration.Duration.Inf)
+
+ val ec = new TestExecutionContext(ExecutionContext.Implicits.global)
+
+ {
+ val p = Promise[Int]()
+ val fp = p.future
+ println("mapping")
+ val mapped = fp.map(x => x)(ec)
+ p.success(0)
+ await(mapped)
+ }
+
+ {
+ println("flatmapping")
+ val p = Promise[Int]()
+ val fp = p.future
+ val flatMapped = fp.flatMap({ (x: Int) =>
+ Future.successful(2 * x)
+ })(ec)
+ p.success(0)
+ await(flatMapped)
+ }
+
+ {
+ println("recovering")
+ val recovered = Future.failed(new Throwable()).recoverWith {
+ case _ => Future.successful(2)
+ }(ec)
+ await(recovered)
+ }
+ }
+
+ class TestExecutionContext(delegate: ExecutionContext) extends ExecutionContext {
+ def execute(runnable: Runnable): Unit = ???
+
+ def reportFailure(t: Throwable): Unit = ???
+
+ override def prepare(): ExecutionContext = {
+ val preparedDelegate = delegate.prepare()
+ return new ExecutionContext {
+ def execute(runnable: Runnable): Unit = {
+ println("execute()")
+ preparedDelegate.execute(runnable)
+ }
+
+ def reportFailure(t: Throwable): Unit = ???
+ }
+ }
+ }
+}
diff --git a/test/files/run/global-showdef.scala b/test/files/run/global-showdef.scala
index 0dbaba979d..c3ace590ed 100644
--- a/test/files/run/global-showdef.scala
+++ b/test/files/run/global-showdef.scala
@@ -54,7 +54,7 @@ object Bippy {
val run = new compiler.Run()
run.compileSources(List(src))
}
- (output split "\\n").toList
+ output.linesIterator.toList
}
def showClass(name: String) = lines("-Yshow:typer", "-Xshow-class", name)
def showObject(name: String) = lines("-Yshow:typer", "-Xshow-object", name)
diff --git a/test/files/run/macro-abort-fresh.check b/test/files/run/macro-abort-fresh.check
index 87491f6e48..9fddee57d4 100644
--- a/test/files/run/macro-abort-fresh.check
+++ b/test/files/run/macro-abort-fresh.check
@@ -1,4 +1,4 @@
-$1$
+fresh$1
qwe1
qwe2
reflective compilation has failed:
diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check
new file mode 100644
index 0000000000..c11c48dc55
--- /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.Macro
+import scala.reflect.macros.Macro
+
+scala> trait Bar extends Macro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar = macro Bar.impl
+defined trait Bar
+defined term macro bar: Unit
+
+scala> bar
+
+scala> trait Foo extends Macro { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
+defined trait Foo
+
+scala> def foo = 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..3171aaacc2
--- /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.Macro
+trait Bar extends Macro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar = macro Bar.impl
+bar
+trait Foo extends Macro { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
+def foo = macro Foo.impl
+foo
+ """
+} \ No newline at end of file
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..e81fd0dbd6
--- /dev/null
+++ b/test/files/run/macro-bundle-static/Impls_Macros_1.scala
@@ -0,0 +1,31 @@
+import scala.reflect.macros.Context
+import scala.reflect.macros.Macro
+import scala.language.experimental.macros
+
+object Enclosing {
+ trait Impl extends Macro {
+ 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 {
+ trait Impl extends Macro {
+ 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..72160f6ec2
--- /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{val c = ???}.weird)
+ println(pkg.Macros.mono)
+ println(pkg.Macros.poly[Int])
+ println(new pkg.Enclosing.Impl{val c = ???}.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-bundle.flags b/test/files/run/macro-bundle-toplevel.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-bundle.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..8c7df2cdc5
--- /dev/null
+++ b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
@@ -0,0 +1,26 @@
+import scala.reflect.macros.Context
+import scala.reflect.macros.Macro
+
+trait Impl extends Macro {
+ 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 {
+ trait Impl extends Macro {
+ 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/Test_2.scala b/test/files/run/macro-bundle-toplevel/Test_2.scala
index 428f809f9d..139cc5bef2 100644
--- a/test/files/run/macro-bundle/Test_2.scala
+++ b/test/files/run/macro-bundle-toplevel/Test_2.scala
@@ -2,4 +2,7 @@ object Test extends App {
println(Macros.mono)
println(Macros.poly[Int])
println(new Impl{val c = ???}.weird)
+ println(pkg.Macros.mono)
+ println(pkg.Macros.poly[Int])
+ println(new pkg.Impl{val c = ???}.weird)
} \ No newline at end of file
diff --git a/test/files/run/macro-bundle.check b/test/files/run/macro-bundle.check
deleted file mode 100644
index 2107454960..0000000000
--- a/test/files/run/macro-bundle.check
+++ /dev/null
@@ -1,3 +0,0 @@
-()
-Int
-()
diff --git a/test/files/run/macro-bundle/Impls_Macros_1.scala b/test/files/run/macro-bundle/Impls_Macros_1.scala
deleted file mode 100644
index 3f651c9a43..0000000000
--- a/test/files/run/macro-bundle/Impls_Macros_1.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-import scala.reflect.macros.Context
-import scala.reflect.macros.Macro
-
-trait Impl extends Macro {
- def mono = c.literalUnit
- def poly[T: c.WeakTypeTag] = c.literal(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-divergence-spurious/Impls_Macros_1.scala b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
index bc4a9fded7..53511ebc72 100644
--- a/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
+++ b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
@@ -15,7 +15,7 @@ object Complex {
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-enclosures/Impls_Macros_1.scala b/test/files/run/macro-enclosures/Impls_Macros_1.scala
index cd54028676..68f1920cdd 100644
--- a/test/files/run/macro-enclosures/Impls_Macros_1.scala
+++ b/test/files/run/macro-enclosures/Impls_Macros_1.scala
@@ -1,13 +1,16 @@
import scala.reflect.macros.Context
object Macros {
- def impl(c: Context) = c.universe.reify {
- println("enclosingPackage = " + c.literal(c.enclosingPackage.toString).splice)
- println("enclosingClass = " + c.literal(c.enclosingClass.toString).splice)
- println("enclosingImpl = " + c.literal(c.enclosingImpl.toString).splice)
- println("enclosingTemplate = " + c.literal(c.enclosingTemplate.toString).splice)
- println("enclosingMethod = " + c.literal(c.enclosingMethod.toString).splice)
- println("enclosingDef = " + c.literal(c.enclosingDef.toString).splice)
+ def impl(c: Context) = {
+ import c.universe._
+ reify {
+ println("enclosingPackage = " + c.Expr[String](Literal(Constant(c.enclosingPackage.toString))).splice)
+ println("enclosingClass = " + c.Expr[String](Literal(Constant(c.enclosingClass.toString))).splice)
+ println("enclosingImpl = " + c.Expr[String](Literal(Constant(c.enclosingImpl.toString))).splice)
+ println("enclosingTemplate = " + c.Expr[String](Literal(Constant(c.enclosingTemplate.toString))).splice)
+ println("enclosingMethod = " + c.Expr[String](Literal(Constant(c.enclosingMethod.toString))).splice)
+ println("enclosingDef = " + c.Expr[String](Literal(Constant(c.enclosingDef.toString))).splice)
+ }
}
def foo = macro impl
diff --git a/test/files/run/macro-expand-tparams-bounds/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala
index f9103aaf8f..d63f034e9b 100644
--- a/test/files/run/macro-expand-tparams-bounds/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala
@@ -1,12 +1,12 @@
import scala.reflect.macros.Context
object Impls1 {
- def foo[U <: String](c: Context): c.Expr[Unit] = c.literalUnit
+ def foo[U <: String](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"()") }
}
class C
class D extends C
object Impls2 {
- def foo[U <: C](c: Context): c.Expr[Unit] = c.literalUnit
+ def foo[U <: C](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"()") }
}
diff --git a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
index e92396d1b4..a98c4abe78 100644
--- a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
@@ -5,8 +5,7 @@ object Impls1 {
def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString))))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"println(${U.toString})")
}
}
@@ -16,18 +15,18 @@ object Impls2 {
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](body)
+ 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(Block(List(
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))),
- Literal(Constant(()))))
+ c.Expr(q"""
+ println(${T.toString})
+ println(${implicitly[c.WeakTypeTag[U]].toString})
+ println(${V.toString})
+ """)
}
}
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 95d746980e..043675ec00 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
@@ -6,13 +6,12 @@ object Impls {
import c.{prefix => prefix}
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo_targs...")))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("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-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala
index 738c88bbc8..5f3bbac719 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
@@ -3,10 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = {
import unconventionalName.universe._
- val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), TermName("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-impl-tparam-only-in-impl/Impls_1.scala b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala
index 9b8dafaa97..24eacb36de 100644
--- 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
@@ -1,5 +1,5 @@
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[U <: String](c: Ctx): c.Expr[Unit] = c.literalUnit
+ def foo[U <: String](c: Ctx): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"()") }
}
diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala
index 50a1782431..884d7f8825 100644
--- a/test/files/run/macro-openmacros/Impls_Macros_1.scala
+++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala
@@ -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")), TermName("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-reflective-mamd-normal-mi.check b/test/files/run/macro-reflective-mamd-normal-mi.check
index ac4213d6e9..f77196b2db 100644
--- a/test/files/run/macro-reflective-mamd-normal-mi.check
+++ b/test/files/run/macro-reflective-mamd-normal-mi.check
@@ -1 +1,2 @@
-43 \ No newline at end of file
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+43
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..f454fc430a 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
@@ -2,9 +2,9 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]) = {
+ import c.universe._
val x1 = c.Expr[Int](c.resetAllAttrs(x.tree))
-// was: c.literal(x1.splice)
- c.literal(c.eval(x1))
+ c.Expr[Int](Literal(Constant(c.eval(x1))))
}
}
diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala
index 83d80a5bff..9257784cf2 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
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 8d7d3b5d3d..1b914ac797 100644
--- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
@@ -11,7 +11,8 @@ object Macros {
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 4c165ed1b8..95e19c4fd1 100644
--- a/test/files/run/macro-sip19/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19/Impls_Macros_1.scala
@@ -7,7 +7,8 @@ object Macros {
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-system-properties.check b/test/files/run/macro-system-properties.check
index ff96a34426..c61fe7f2cf 100644
--- a/test/files/run/macro-system-properties.check
+++ b/test/files/run/macro-system-properties.check
@@ -8,7 +8,7 @@ import reflect.macros.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 impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
def grab() = macro impl
}
defined object GrabContext
diff --git a/test/files/run/macro-system-properties.scala b/test/files/run/macro-system-properties.scala
index e182defc81..9dcd044dbd 100644
--- a/test/files/run/macro-system-properties.scala
+++ b/test/files/run/macro-system-properties.scala
@@ -7,7 +7,7 @@ object Test extends ReplTest {
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 impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
def grab() = macro impl
}
object Test { class C(implicit a: Any) { GrabContext.grab } }
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 dbeb7efbc0..cd37c269b5 100644
--- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
@@ -6,7 +6,7 @@ object Macros {
val tree1 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false)
- c.literal(ttree1.toString)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_implicits_enabled = macro impl_with_implicits_enabled
@@ -17,10 +17,10 @@ object Macros {
try {
val tree2 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
val ttree2 = c.typeCheck(tree2, withImplicitViewsDisabled = true)
- c.literal(ttree2.toString)
+ 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/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
index ff535fea8d..2532cfd2b9 100644
--- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
@@ -7,7 +7,7 @@ object Macros {
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.literal(ttree1.toString)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_macros_enabled = macro impl_with_macros_enabled
@@ -23,7 +23,7 @@ object Macros {
val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
- c.literal(ttree2.toString)
+ 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/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
index a96e0c53b6..7b22793df9 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
@@ -7,7 +7,7 @@ object Macros {
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.literal(ttree1.toString)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_macros_enabled = macro impl_with_macros_enabled
@@ -23,7 +23,7 @@ object Macros {
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.literal(ttree2.toString)
+ 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..6695a297ea 100644
--- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
@@ -2,14 +2,20 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.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..85877b3f13 100644
--- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
@@ -2,7 +2,10 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.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.check b/test/files/run/macro-vampire-false-warning.check
new file mode 100644
index 0000000000..4792e70f33
--- /dev/null
+++ b/test/files/run/macro-vampire-false-warning.check
@@ -0,0 +1,2 @@
+2
+3
diff --git a/test/files/run/macro-vampire-false-warning.flags b/test/files/run/macro-vampire-false-warning.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/run/macro-vampire-false-warning.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ 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
new file mode 100644
index 0000000000..2d384fbb85
--- /dev/null
+++ b/test/files/run/macro-vampire-false-warning/Macros_1.scala
@@ -0,0 +1,52 @@
+// As per http://meta.plasm.us/posts/2013/08/31/feeding-our-vampires/
+
+import scala.annotation.StaticAnnotation
+import scala.reflect.macros.Context
+import scala.language.experimental.macros
+
+class body(tree: Any) extends StaticAnnotation
+
+object Macros {
+ def selFieldImpl(c: Context) = {
+ import c.universe._
+ val field = c.macroApplication.symbol
+ val bodyAnn = field.annotations.filter(_.tpe <:< typeOf[body]).head
+ c.Expr[Any](bodyAnn.scalaArgs.head)
+ }
+
+ def mkObjectImpl(c: Context)(xs: c.Expr[Any]*) = {
+ import c.universe._
+ import Flag._
+ // val kvps = xs.toList map { case q"${_}(${Literal(Constant(name: String))}).->[${_}]($value)" => name -> value }
+ val kvps = xs.map(_.tree).toList map { case Apply(TypeApply(Select(Apply(_, List(Literal(Constant(name: String)))), _), _), List(value)) => name -> value }
+ // val fields = kvps map { case (k, v) => q"@body($v) def ${TermName(k)} = macro Macros.selFieldImpl" }
+ val fields = kvps map { case (k, v) => DefDef(
+ Modifiers(MACRO, tpnme.EMPTY, List(Apply(Select(New(Ident(TypeName("body"))), nme.CONSTRUCTOR), List(v)))),
+ TermName(k), Nil, Nil, TypeTree(), Select(Ident(TermName("Macros")), TermName("selFieldImpl"))) }
+ // q"import scala.language.experimental.macros; class Workaround { ..$fields }; new Workaround{}"
+ c.Expr[Any](Block(
+ List(
+ Import(Select(Select(Ident(TermName("scala")), TermName("language")), TermName("experimental")), List(ImportSelector(TermName("macros"), 51, TermName("macros"), 51))),
+ ClassDef(
+ NoMods, TypeName("Workaround"), Nil,
+ Template(
+ List(Select(Ident(TermName("scala")), TypeName("AnyRef"))), noSelfType,
+ DefDef(
+ NoMods, nme.CONSTRUCTOR, Nil, List(Nil), TypeTree(),
+ Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(()))))
+ +: fields)),
+ ClassDef(
+ Modifiers(FINAL), TypeName("$anon"), Nil,
+ Template(
+ 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(TypeName("$anon"))), nme.CONSTRUCTOR), List())))
+ }
+}
+
+object mkObject {
+ def apply(xs: Any*) = macro Macros.mkObjectImpl
+}
diff --git a/test/files/run/macro-vampire-false-warning/Test_2.scala b/test/files/run/macro-vampire-false-warning/Test_2.scala
new file mode 100644
index 0000000000..6e44b68635
--- /dev/null
+++ b/test/files/run/macro-vampire-false-warning/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ val foo = mkObject("x" -> "2", "y" -> 3)
+ println(foo.x)
+ println(foo.y)
+ // println(foo.z) => will result in a compilation error
+} \ No newline at end of file
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index 35b733d080..b212e10f8d 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -114,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)
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/private-inline.check b/test/files/run/private-inline.check
index 3e44989521..e71aec2fcf 100644
--- a/test/files/run/private-inline.check
+++ b/test/files/run/private-inline.check
@@ -1,7 +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-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/private-override.scala b/test/files/run/private-override.scala
new file mode 100644
index 0000000000..0a3f57f97c
--- /dev/null
+++ b/test/files/run/private-override.scala
@@ -0,0 +1,17 @@
+package test.p1.p2 {
+ abstract class A {
+ private[p2] def f2(): Int = 1
+ }
+ abstract class Other extends A {
+ // It's a private method - not a private[p2] method. Not a failed
+ // "weaker access privileges" override, a different namespace.
+ private def f2(): Int = super.f2() + 2
+ def go() = f2()
+ }
+}
+
+object Test extends test.p1.p2.Other {
+ def main(args: Array[String]): Unit = {
+ println(go())
+ }
+}
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-sync-potpourri.check b/test/files/run/reflection-sync-potpourri.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/reflection-sync-potpourri.check
diff --git a/test/files/run/reflection-sync-potpourri.scala b/test/files/run/reflection-sync-potpourri.scala
new file mode 100644
index 0000000000..0ad5f2ab66
--- /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.typeSignature
+ 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 == "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/repl-power.check b/test/files/run/repl-power.check
index d6a0d8c931..e56901e0f2 100644
--- a/test/files/run/repl-power.check
+++ b/test/files/run/repl-power.check
@@ -11,7 +11,8 @@ 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
@@ -20,14 +21,10 @@ 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 c6e147977a..ed95c7b8ff 100644
--- a/test/files/run/repl-reset.check
+++ b/test/files/run/repl-reset.check
@@ -33,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
diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check
index 2a143a1777..63bafe401b 100644
--- a/test/files/run/repl-term-macros.check
+++ b/test/files/run/repl-term-macros.check
@@ -9,7 +9,7 @@ import language.experimental.macros
scala>
-scala> def impl1(c: Context) = c.literalUnit
+scala> def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
impl1: (c: scala.reflect.macros.Context)c.Expr[Unit]
scala> def foo1 = macro impl1
@@ -19,7 +19,7 @@ scala> foo1
scala>
-scala> def impl2(c: Context)() = c.literalUnit
+scala> def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
impl2: (c: scala.reflect.macros.Context)()c.Expr[Unit]
scala> def foo2() = macro impl2
@@ -29,7 +29,7 @@ scala> foo2()
scala>
-scala> def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = c.literalUnit
+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.Context)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit]
scala> def foo3(x: Int)(y: Int) = macro impl3
diff --git a/test/files/run/repl-term-macros.scala b/test/files/run/repl-term-macros.scala
index f826259be9..125e397b22 100644
--- a/test/files/run/repl-term-macros.scala
+++ b/test/files/run/repl-term-macros.scala
@@ -5,15 +5,15 @@ object Test extends ReplTest {
import scala.reflect.macros.Context
import language.experimental.macros
-def impl1(c: Context) = c.literalUnit
+def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo1 = macro impl1
foo1
-def impl2(c: Context)() = c.literalUnit
+def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
def foo2() = macro impl2
foo2()
-def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = c.literalUnit
+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) = macro impl3
foo3(2)(3)
"""
diff --git a/test/files/run/sammy_java8.flags b/test/files/run/sammy_java8.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/run/sammy_java8.flags
@@ -0,0 +1 @@
+-Xexperimental
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/showraw_mods.check b/test/files/run/showraw_mods.check
index 3ec868542d..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), TypeName("C"), List(), Template(List(Ident(TypeName("AnyRef"))), emptyValDef, 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(())))
+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/t2106.check b/test/files/run/t2106.check
index b14e9d1c41..f8f625ff46 100644
--- a/test/files/run/t2106.check
+++ b/test/files/run/t2106.check
@@ -1,3 +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/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/t3346b.check b/test/files/run/t3346b.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/t3346b.check
diff --git a/test/files/run/t3346c.check b/test/files/run/t3346c.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/t3346c.check
diff --git a/test/files/run/t3346d.check b/test/files/run/t3346d.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/t3346d.check
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/t4542.check b/test/files/run/t4542.check
index 5a8108dcbc..a53f31a3c7 100644
--- a/test/files/run/t4542.check
+++ b/test/files/run/t4542.check
@@ -9,9 +9,6 @@ defined class Foo
scala> val f = new Foo
<console>:8: warning: class Foo is deprecated: foooo
val f = new Foo
- ^
-<console>:8: warning: class Foo is deprecated: foooo
- val f = new Foo
^
f: Foo = Bippy
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/t5064.check b/test/files/run/t5064.check
index 7b92e40c35..61ccfd16e7 100644
--- a/test/files/run/t5064.check
+++ b/test/files/run/t5064.check
@@ -1,19 +1,19 @@
[53] T5064.super.<init>()
[53] T5064.super.<init>
[53] this
-[20/16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1}))
+[16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1}))
[16:20] immutable.this.List.apply
<16:20> immutable.this.List
<16:20> immutable.this
-[20/16:23] scala.this.Predef.wrapIntArray(Array[Int]{1})
+[16:23] scala.this.Predef.wrapIntArray(Array[Int]{1})
[20] scala.this.Predef.wrapIntArray
[20] scala.this.Predef
[20] scala.this
-[29/26:32] collection.this.Seq.apply(scala.this.Predef.wrapIntArray(Array[Int]{1}))
+[26:32] collection.this.Seq.apply(scala.this.Predef.wrapIntArray(Array[Int]{1}))
[26:29] collection.this.Seq.apply
<26:29> collection.this.Seq
<26:29> collection.this
-[29/26:32] scala.this.Predef.wrapIntArray(Array[Int]{1})
+[26:32] scala.this.Predef.wrapIntArray(Array[Int]{1})
[29] scala.this.Predef.wrapIntArray
[29] scala.this.Predef
[29] scala.this
diff --git a/test/files/run/t5385.check b/test/files/run/t5385.check
index f56464facd..1df74fcfb5 100644
--- a/test/files/run/t5385.check
+++ b/test/files/run/t5385.check
@@ -1,8 +1,8 @@
-[6/0:9] class Azz
-[6/0:9] class Bzz
-[6/0:9] class Czz
-[6/0:9] class Dzz
-[6/0:11] class Ezz
-[6/0:11] class Fzz
-[6/0:13] class Gzz
-[6/0:13] class Hzz
+[0:9] class Azz
+[0:9] class Bzz
+[0:9] class Czz
+[0:9] class Dzz
+[0:11] class Ezz
+[0:11] class Fzz
+[0:13] class Gzz
+[0:13] class Hzz
diff --git a/test/files/run/t5603.check b/test/files/run/t5603.check
index 46fcdd4470..188f39ff82 100644
--- a/test/files/run/t5603.check
+++ b/test/files/run/t5603.check
@@ -1,29 +1,29 @@
[[syntax trees at end of parser]] // newSource1.scala
[0:241]package [0:0]<empty> {
- [6/0:82]abstract trait Greeting extends [15:82][83]scala.AnyRef {
+ [0:82]abstract trait Greeting extends [15:82][83]scala.AnyRef {
[15]def $init$() = [15]{
[15]()
};
- [27:39]val name: [33:39]String;
- [50:76]val msg = [71/56:76][71/56:72][56:71]"How are you, ".$plus([72:76]name)
+ [23:39]val name: [33:39]String;
+ [46:76]val msg = [56:76][56:72][56:71]"How are you, ".$plus([72:76]name)
};
- [93/87:209]class C extends [94:209][151:159]Greeting {
- [123:139]val nameElse = _;
+ [87:209]class C extends [94:209][151:159]Greeting {
+ [119:139]val nameElse = _;
[95:101]<paramaccessor> private[this] val i: [98:101]Int = _;
- <123:139>def <init>([95]i: [98]Int) = <123:139>{
- <123:139>val nameElse = <134:139>"Bob";
- [X][X][X]super.<init>();
+ <119:139>def <init>([95]i: [98]Int) = <119:139>{
+ <119:139>val nameElse = <134:139>"Bob";
+ [NoPosition][NoPosition][NoPosition]super.<init>();
[94]()
};
- [172:184]val name = [179:184]"avc";
- [198/191:203][191:198]println([199:202]msg)
+ [168:184]val name = [179:184]"avc";
+ [191:203][191:198]println([199:202]msg)
};
- [222/215:241]object Test extends [227:241][235:238]App {
+ [215:241]object Test extends [227:241][235:238]App {
[227]def <init>() = [227]{
- [X][X][X]super.<init>();
+ [NoPosition][NoPosition][NoPosition]super.<init>();
[227]()
};
- [X]<empty>
+ [NoPosition]<empty>
}
}
diff --git a/test/files/run/t5894.scala b/test/files/run/t5894.scala
index abeec32365..5deda34489 100644
--- a/test/files/run/t5894.scala
+++ b/test/files/run/t5894.scala
@@ -4,7 +4,7 @@ class Test
object Test {
def foo = macro fooImpl
- def fooImpl(c: reflect.macros.Context) = c.literalUnit
+ def fooImpl(c: reflect.macros.Context) = { import c.universe._; c.Expr[Unit](q"()") }
def main(args: Array[String]) {
try {
diff --git a/test/files/run/t5923a/Macros_1.scala b/test/files/run/t5923a/Macros_1.scala
index 97076eb102..741379cf34 100644
--- a/test/files/run/t5923a/Macros_1.scala
+++ b/test/files/run/t5923a/Macros_1.scala
@@ -46,7 +46,7 @@ object Macros {
if (sym.isParameter && !sym.isSkolem) TypeTag.Nothing.asInstanceOf[TypeTag[T]]
else ttag0
}
- reify(C[T](c.literal(weakTypeOf[T].toString).splice))
+ reify(C[T](c.Expr[String](Literal(Constant(weakTypeOf[T].toString))).splice))
}
}
} \ No newline at end of file
diff --git a/test/files/run/t5940.scala b/test/files/run/t5940.scala
index 147ff38256..9c8f702c68 100644
--- a/test/files/run/t5940.scala
+++ b/test/files/run/t5940.scala
@@ -7,12 +7,12 @@ object Test extends DirectTest {
import scala.reflect.macros.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 impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo = macro impl
}
"""
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/t6240-universe-code-gen.check b/test/files/run/t6240-universe-code-gen.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/t6240-universe-code-gen.check
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..84691639bd
--- /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.typeSignature)}
+ |${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/t6288.check b/test/files/run/t6288.check
index 0da03c0439..a032a10de6 100644
--- a/test/files/run/t6288.check
+++ b/test/files/run/t6288.check
@@ -18,7 +18,7 @@
[64]case6(){
[64][64]matchEnd4([64]throw [64][64][64]new [64]MatchError([64]x1))
};
- [64]matchEnd4(x: [X]Unit){
+ [64]matchEnd4(x: [NoPosition]Unit){
[64]x
}
}
@@ -44,7 +44,7 @@
[175]case6(){
[175][175]matchEnd4([175]throw [175][175][175]new [175]MatchError([175]x1))
};
- [175]matchEnd4(x: [X]Unit){
+ [175]matchEnd4(x: [NoPosition]Unit){
[175]x
}
}
@@ -70,7 +70,7 @@
[273]case6(){
[273][273]matchEnd4([273]throw [273][273][273]new [273]MatchError([273]x1))
};
- [273]matchEnd4(x: [X]Unit){
+ [273]matchEnd4(x: [NoPosition]Unit){
[273]x
}
}
diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check
index 5070b67e46..c9d4713aa8 100644
--- a/test/files/run/t6381.check
+++ b/test/files/run/t6381.check
@@ -4,8 +4,10 @@ Type :help for more information.
scala> import language.experimental.macros
import language.experimental.macros
-scala> def pos_impl(c: reflect.macros.Context): c.Expr[String] =
- c.literal(c.enclosingPosition.getClass.toString)
+scala> def pos_impl(c: reflect.macros.Context): c.Expr[String] = {
+ import c.universe._
+ c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString)))
+}
pos_impl: (c: scala.reflect.macros.Context)c.Expr[String]
scala> def pos = macro pos_impl
diff --git a/test/files/run/t6381.scala b/test/files/run/t6381.scala
index 859ec3cb30..4c2a40fe87 100644
--- a/test/files/run/t6381.scala
+++ b/test/files/run/t6381.scala
@@ -3,8 +3,10 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
|import language.experimental.macros
- |def pos_impl(c: reflect.macros.Context): c.Expr[String] =
- | c.literal(c.enclosingPosition.getClass.toString)
+ |def pos_impl(c: reflect.macros.Context): c.Expr[String] = {
+ | import c.universe._
+ | c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString)))
+ |}
|def pos = macro pos_impl
|pos
|""".stripMargin.trim
diff --git a/test/files/run/t6392b.check b/test/files/run/t6392b.check
index 1ccfced1c6..c2cc103373 100644
--- a/test/files/run/t6392b.check
+++ b/test/files/run/t6392b.check
@@ -1 +1 @@
-ModuleDef(Modifiers(), TermName("C")#MOD, Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR#PCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("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(), nme.CONSTRUCTOR#PCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(())))))))
diff --git a/test/files/run/t6768.check b/test/files/run/t6768.check
deleted file mode 100644
index 64df4568ec..0000000000
--- a/test/files/run/t6768.check
+++ /dev/null
@@ -1,12 +0,0 @@
-[[syntax trees at end of typer]] // newSource1.scala
-[1:58]package [1:1]<empty> {
- [7/1:58]class A extends [9:58][58]scala.AnyRef {
- [58]def <init>(): [9]A = [58]{
- [58][58][58]A.super.<init>();
- [9]()
- };
- [17/13:31]def f1: [17]Some[String] = [26/22:31][22:26][22:26]scala.Some.apply[[22]String]([27:30]"a");
- [38/34:56]def f2: [38]Some[String] = [47/43:56][47:51][47:51]new [47:51]<type: [47:51]scala.Some>([52:55]"b")
- }
-}
-
diff --git a/test/files/run/t6768.scala b/test/files/run/t6768.scala
deleted file mode 100644
index 11470a0ef8..0000000000
--- a/test/files/run/t6768.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-import scala.tools.partest._
-
-object Test extends DirectTest {
- override def extraSettings: String = "-usejavacp -Xprint:typer -Yrangepos -Xprint-pos -d " + testOutput.path
- override def show() = Console.withErr(System.out)(compile())
-
- override def code = """
-class A {
- def f1 = Some("a")
- def f2 = new Some("b")
-}"""
-}
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..477829f200 100644
--- a/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
+++ b/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
@@ -3,9 +3,10 @@ import scala.reflect.macros.Context
object Macros {
def impl(c: Context) = {
+ import c.universe._
val decls = c.typeOf[ScalaClassWithCheckedExceptions_1[_]].declarations.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/Impls_Macros_2.scala b/test/files/run/t7008/Impls_Macros_2.scala
index 7a17314085..63c3f9d696 100644
--- a/test/files/run/t7008/Impls_Macros_2.scala
+++ b/test/files/run/t7008/Impls_Macros_2.scala
@@ -3,9 +3,10 @@ import scala.reflect.macros.Context
object Macros {
def impl(c: Context) = {
+ import c.universe._
val decls = c.typeOf[JavaClassWithCheckedExceptions_1[_]].declarations.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/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..f41baca05e
--- /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.typeSignature
+ println(d.selfType)
+} \ No newline at end of file
diff --git a/test/files/run/t7047/Impls_Macros_1.scala b/test/files/run/t7047/Impls_Macros_1.scala
index 2992e3efe4..a5d55c3a42 100644
--- a/test/files/run/t7047/Impls_Macros_1.scala
+++ b/test/files/run/t7047/Impls_Macros_1.scala
@@ -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/t7271.check b/test/files/run/t7271.check
index 86b5230fd7..f7a23018ca 100644
--- a/test/files/run/t7271.check
+++ b/test/files/run/t7271.check
@@ -2,7 +2,7 @@
[6]package [6]<empty> {
[6]class C extends [8][91]scala.AnyRef {
[8]def <init>() = [8]{
- [X][X][X]super.<init>();
+ [NoPosition][NoPosition][NoPosition]super.<init>();
[8]()
};
[20]def quote = [28][28][28][28]StringContext([30]"foo", [40]"baz").s([35]this);
diff --git a/test/files/run/t7331c.check b/test/files/run/t7331c.check
index fd3ac1d9ef..b35d831f83 100644
--- a/test/files/run/t7331c.check
+++ b/test/files/run/t7331c.check
@@ -1,3 +1,3 @@
-ClassDef(Modifiers(), TypeName("C"), List(), Template(List(Select(Ident(scala), TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))))))
+ClassDef(Modifiers(), TypeName("C"), List(), Template(List(Select(Ident(scala), TypeName("AnyRef"))), noSelfType, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))))))
source-<toolbox>,line-1,offset=6
NoPosition
diff --git a/test/files/run/t7375b/Macros_1.scala b/test/files/run/t7375b/Macros_1.scala
index 70e79cc2b4..7a307805db 100644
--- a/test/files/run/t7375b/Macros_1.scala
+++ b/test/files/run/t7375b/Macros_1.scala
@@ -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 dd59697b71..4b46850768 100644
--- a/test/files/run/t7398.scala
+++ b/test/files/run/t7398.scala
@@ -3,11 +3,9 @@ import scala.tools.partest._
object Test extends CompilerTest {
import global._
- // This way we auto-pass on non-java8 since there's nothing to check
- override lazy val units: List[CompilationUnit] = testUnderJavaAtLeast("1.8") {
+ override lazy val units: List[CompilationUnit] = {
+ // This test itself does not depend on JDK8.
javaCompilationUnits(global)(defaultMethodSource)
- } otherwise {
- Nil
}
private def defaultMethodSource = """
@@ -23,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/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/t7825.scala b/test/files/run/t7825.scala
new file mode 100644
index 0000000000..65ca06fdfc
--- /dev/null
+++ b/test/files/run/t7825.scala
@@ -0,0 +1,34 @@
+import scala.tools.partest._
+
+object Test extends CompilerTest {
+ import global._
+
+ override lazy val units: List[CompilationUnit] = {
+ // We can test this on JDK6.
+ javaCompilationUnits(global)(defaultMethodSource) ++ compilationUnits(global)(scalaExtendsDefault)
+ }
+
+ private def defaultMethodSource = """
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ default void remove() {
+ throw new UnsupportedOperationException("remove");
+ }
+}
+ """
+
+ private def scalaExtendsDefault = """
+object Test {
+ object X extends Iterator[String] {
+ def hasNext = true
+ def next = "!"
+ }
+}
+ """
+
+ // We're only checking we that the Scala compilation unit passes refchecks
+ // No further checks are needed here.
+ def check(source: String, unit: global.CompilationUnit): Unit = {
+ }
+}
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/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..778068deb3
--- /dev/null
+++ b/test/files/run/t7871/Macros_1.scala
@@ -0,0 +1,27 @@
+import scala.reflect.macros.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) = 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/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/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/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala
index 23b6a5fbdb..4118d92076 100644
--- a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala
+++ b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala
@@ -257,7 +257,7 @@ trait ArbitraryTreesAndNames {
/* These are marker types that allow to write tests that
* depend specificly on Trees that are terms or types.
- * They are transperantly tranformed to trees through
+ * They are transparently tranformed to trees through
* implicit conversions and liftables for quasiquotes.
*/
diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
index 153e23d947..e8ddb4b72a 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
@@ -13,6 +13,7 @@ object DefinitionConstructionProps
with TraitConstruction
with TypeDefConstruction
with ValDefConstruction
+ with PackageConstruction
trait ClassConstruction { self: QuasiquoteProperties =>
val anyRef = ScalaDot(TypeName("AnyRef"))
@@ -39,7 +40,9 @@ trait ClassConstruction { self: QuasiquoteProperties =>
assertEqAst(q"class Foo extends ..$parents", "class Foo")
}
- property("splice term name into class") = forAll { (name: TypeName) =>
+ property("splice term name into class") = forAll { (rname: TypeName) =>
+ // add prefix to avoid failure in case rname is keyword
+ val name = TypeName("prefix$" + rname)
eqAst(q"class $name", "class " + name.toString)
}
@@ -290,4 +293,53 @@ trait MethodConstruction { self: QuasiquoteProperties =>
val a = q"new Foo(a)(b)"
assertEqAst(q"@$a def foo", "@Foo(a)(b) def foo")
}
+}
+
+trait PackageConstruction { self: QuasiquoteProperties =>
+ property("splice select into package name") = test {
+ val name = q"foo.bar"
+ assertEqAst(q"package $name { }", "package foo.bar { }")
+ }
+
+ property("splce name into package name") = test{
+ val name = TermName("bippy")
+ assertEqAst(q"package $name { }", "package bippy { }")
+ }
+
+ property("splice members into package body") = test {
+ val members = q"class C" :: q"object O" :: Nil
+ assertEqAst(q"package foo { ..$members }", "package foo { class C; object O }")
+ }
+
+ property("splice illegal members into package body") = test {
+ val f = q"def f"
+ assertThrows[IllegalArgumentException] { q"package foo { $f }" }
+ val v = q"val v = 0"
+ assertThrows[IllegalArgumentException] { q"package foo { $v }" }
+ val expr = q"x + 1"
+ assertThrows[IllegalArgumentException] { q"package foo { $expr }" }
+ }
+
+ property("splice name into package object") = test {
+ val foo = TermName("foo")
+ assertEqAst(q"package object $foo", "package object foo")
+ }
+
+ property("splice parents into package object") = test {
+ val parents = tq"a" :: tq"b" :: Nil
+ assertEqAst(q"package object foo extends ..$parents",
+ "package object foo extends a with b")
+ }
+
+ property("splice members into package object") = test {
+ val members = q"def foo" :: q"val x = 1" :: Nil
+ assertEqAst(q"package object foo { ..$members }",
+ "package object foo { def foo; val x = 1 }")
+ }
+
+ property("splice early def into package object") = test {
+ val edefs = q"val x = 1" :: q"type I = Int" :: Nil
+ assertEqAst(q"package object foo extends { ..$edefs } with Any",
+ "package object foo extends { val x = 1; type I = Int } with Any")
+ }
} \ No newline at end of file
diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
index fdfbfe871c..993ef899b0 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
@@ -13,6 +13,7 @@ object DefinitionDeconstructionProps
with ObjectDeconstruction
with ModsDeconstruction
with ValVarDeconstruction
+ with PackageDeconstruction
trait TraitDeconstruction { self: QuasiquoteProperties =>
property("exhaustive trait matcher") = test {
@@ -144,4 +145,27 @@ trait ValVarDeconstruction { self: QuasiquoteProperties =>
matches("var x = 1")
assertThrows[MatchError] { matches("val x = 1") }
}
+}
+
+trait PackageDeconstruction { self: QuasiquoteProperties =>
+ property("exhaustive package matcher") = test {
+ def matches(line: String) { val q"package $name { ..$body }" = parse(line) }
+ matches("package foo { }")
+ matches("package foo { class C }")
+ matches("package foo.bar { }")
+ matches("package bippy.bongo { object A; object B }")
+ matches("package bippy { package bongo { object O } }")
+ }
+
+ property("exhaustive package object matcher") = test {
+ def matches(line: String) {
+ val q"package object $name extends { ..$early } with ..$parents { $self => ..$body }" = parse(line)
+ }
+ matches("package object foo")
+ matches("package object foo { def baz }")
+ matches("package object foo { self => }")
+ matches("package object foo extends mammy with daddy { def baz }")
+ matches("package object foo extends { val early = 1 } with daddy")
+ assertThrows[MatchError] { matches("object foo") }
+ }
} \ No newline at end of file
diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala
index b9e69e0e88..b0a7641577 100644
--- a/test/files/scalacheck/quasiquotes/ErrorProps.scala
+++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala
@@ -41,10 +41,7 @@ object ErrorProps extends QuasiquoteProperties("errors") {
property("@..$first @$rest def foo") = fails(
"Can't extract with .. here",
"""
- val a = annot("a")
- val b = annot("b")
- val c = annot("c")
- val q"@..$first @$rest def foo" = q"@$a @$b @$c def foo"
+ q"@a @b @c def foo" match { case q"@..$first @$rest def foo" => }
""")
property("only literal string arguments") = fails(
diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
index 753ad1aa59..f68656d0f7 100644
--- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
@@ -7,7 +7,6 @@ import scala.reflect.runtime.universe._
import Flag._
object TermConstructionProps extends QuasiquoteProperties("term construction") {
-
property("splice single tree return tree itself") = forAll { (t: Tree) =>
q"$t" ≈ t
}
@@ -191,4 +190,22 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
val assignx = q"x = 1"
assertEqAst(q"f($assignx)", "f(x = 1)")
}
+
+ property("fresh names are regenerated at each evaluation") = test {
+ def plusOne = q"{ _ + 1 }"
+ assert(!(plusOne ≈ plusOne))
+ def whileTrue = q"while(true) false"
+ assert(!(whileTrue ≈ whileTrue))
+ def withEvidence = q"def foo[T: X]"
+ assert(!(withEvidence ≈ withEvidence))
+ }
+
+ property("make sure inference doesn't infer any") = test {
+ val l1 = List(q"foo")
+ val l2 = List(q"bar")
+ val baz = q"baz"
+ assert(q"f(..${l1 ++ l2})" ≈ q"f(foo, bar)")
+ assert(q"f(..${l1 ++ l2}, $baz)" ≈ q"f(foo, bar, baz)")
+ assert(q"f(${if (true) q"a" else q"b"})" ≈ q"f(a)")
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
index 22d4b1ce4f..f37e4d9975 100644
--- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
@@ -8,9 +8,8 @@ import Flag._
object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction") {
property("f(..x) = f") = test {
- assertThrows[MatchError] {
- val q"f(..$argss)" = q"f"
- }
+ val q"f(..$args)" = q"f"
+ assert(args ≈ Nil)
}
property("f(x)") = forAll { (x: Tree) =>
@@ -88,7 +87,7 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
matches("new foo with bar")
matches("new foo with bar { body }")
matches("new { anonymous }")
- matches("new { val early = 1} with Parent[Int] { body }")
+ matches("new { val early = 1 } with Parent[Int] { body }")
matches("new Foo { selfie => }")
}
@@ -111,4 +110,26 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
assert(left ≈ q"foo(bar)")
assert(value ≈ q"baz")
}
+
+ property("deconstruct while loop") = test {
+ val q"while($cond) $body" = parse("while(cond) body")
+ assert(cond ≈ q"cond")
+ assert(body ≈ q"body")
+ }
+
+ property("deconstruct do while loop") = test {
+ val q"do $body while($cond)" = parse("do body while(cond)")
+ assert(cond ≈ q"cond")
+ assert(body ≈ q"body")
+ }
+
+ property("deconstruct anonymous function with placeholders") = test {
+ val q"{ $f(_) }" = q"{ foo(_) }"
+ assert(f ≈ q"foo")
+ val q"{ _.$member }" = q"{ _.foo }"
+ assert(member ≈ TermName("foo"))
+ val q"{ _ + $x }" = q"{ _ + x }"
+ assert(x ≈ q"x")
+ val q"{ _ * _ }" = q"{ _ * _ }"
+ }
}
diff --git a/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala b/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala
index 05e69978c6..4a39cf9d48 100644
--- a/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala
+++ b/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala
@@ -28,8 +28,8 @@ class StdNamesTest {
test(TermName("Tuple2"), TermName("Tuple2$mcII" + SPECIALIZED_SUFFIX))
test(TermName("foo"), TermName("foo$mIcD" + SPECIALIZED_SUFFIX))
test(TermName("foo"), TermName("foo$mIc" + SPECIALIZED_SUFFIX))
- test(TermName("T1"), TermName(s"T1$SPECIALIZED_SUFFIX"))
- test(TermName(""), SPECIALIZED_SUFFIX)
+ test(nme.EMPTY, TermName(s"T1$SPECIALIZED_SUFFIX"))
+ test(nme.EMPTY, SPECIALIZED_SUFFIX)
}
@Test
@@ -40,7 +40,7 @@ class StdNamesTest {
test((TermName("Tuple2"), "II", ""), TermName("Tuple2$mcII" + SPECIALIZED_SUFFIX))
test((TermName("foo"), "D", "I"), TermName("foo$mIcD" + SPECIALIZED_SUFFIX))
test((TermName("foo"), "", "I"), TermName("foo$mIc" + SPECIALIZED_SUFFIX))
- test((TermName("T1"), "", ""), TermName(s"T1$SPECIALIZED_SUFFIX"))
- test((TermName(""), "", ""), SPECIALIZED_SUFFIX)
+ test((nme.EMPTY, "T1", ""), TermName(s"T1$SPECIALIZED_SUFFIX"))
+ test((nme.EMPTY, "", ""), SPECIALIZED_SUFFIX)
}
}
diff --git a/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala b/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
index 285e87e3b2..a3699a4eeb 100644
--- a/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
+++ b/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
@@ -85,5 +85,7 @@ class SymbolTableForUnitTesting extends SymbolTable {
}
lazy val treeInfo: scala.reflect.internal.TreeInfo{val global: SymbolTableForUnitTesting.this.type} = ???
+ val currentFreshNameCreator = new reflect.internal.util.FreshNameCreator
+
phase = SomePhase
}
diff --git a/test/pending/neg/t6680a.scala b/test/pending/neg/t6680a.scala
deleted file mode 100644
index 745334b1cd..0000000000
--- a/test/pending/neg/t6680a.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-case class Cell[A](var x: A)
-object Test {
- def f1(x: Any) = x match { case y @ Cell(_) => y } // Inferred type is Cell[Any]
- // def f2(x: Cell[_]) = x match { case y @ Cell(_) => y } // Inferred type is Cell[_]
- // def f3[A](x: Cell[A]) = x match { case y @ Cell(_) => y } // Inferred type is Cell[A]
-
- def main(args: Array[String]): Unit = {
- // val x = new Cell(1)
- // val y = f1(x)
- // y.x = "abc"
- // println(x.x + 1)
- }
-} \ No newline at end of file
diff --git a/test/pending/neg/t6680b.check b/test/pending/neg/t6680b.check
deleted file mode 100644
index a16812d91d..0000000000
--- a/test/pending/neg/t6680b.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t6680b.scala:8: error: type mismatch;
- found : String("not what you\'d expect")
- required: ?Hidden1 where type ?Hidden1 (this is a GADT skolem)
- case Concrete(f) => f("not what you'd expect")
- ^
-one error found
diff --git a/test/pending/neg/t6680b.scala b/test/pending/neg/t6680b.scala
deleted file mode 100644
index e9f6468315..0000000000
--- a/test/pending/neg/t6680b.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-trait Super[+A]
-// `Hidden` must occur in both variance positions (covariant/contravariant) for the sneakiness to work
-// this way type inference will infer Any for `Hidden` and `A` in the pattern below
-case class Concrete[Hidden, +A](havoc: Hidden => Hidden) extends Super[A]
-
-object Test extends App {
- (Concrete((x: Int) => x): Super[Any]) match {
- case Concrete(f) => f("not what you'd expect")
- }
-} \ No newline at end of file
diff --git a/test/pending/neg/t6680c.scala b/test/pending/neg/t6680c.scala
deleted file mode 100644
index f69663a71b..0000000000
--- a/test/pending/neg/t6680c.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-package s
-
-trait Stream[+A]
-case class Unfold[S,+A](s: S, f: S => Option[(A,S)]) extends Stream[A]
-
-object Stream {
- def fromList[A](a: List[A]): Stream[A] =
- Unfold(a, (l:List[A]) => l.headOption.map((_,l.tail)))
-}
-
-object Test {
- def main(args: Array[String]): Unit = {
- val res = Stream.fromList(List(1,2,3,4))
-
- res match { case Unfold(s, f) => f("a string!") }
- }
-}
diff --git a/test/pending/t7629-view-bounds-removal.check b/test/pending/t7629-view-bounds-removal.check
new file mode 100644
index 0000000000..dc52105eaf
--- /dev/null
+++ b/test/pending/t7629-view-bounds-removal.check
@@ -0,0 +1,9 @@
+t7629-view-bounds-removal.scala:2: error: View bounds have been removed. Use an implicit parameter instead.
+Example: Instead of `def f[A <% Int](a: A)` use `def f[A](a: A)(implicit ev: A => Int)`.
+ def f[A <% Int](a: A) = null
+ ^
+t7629-view-bounds-removal.scala:3: error: View bounds have been removed. Use an implicit parameter instead.
+Example: Instead of `def f[A <% Int](a: A)` use `def f[A](a: A)(implicit ev: A => Int)`.
+ def g[C, B <: C, A <% B : Numeric](a: A) = null
+ ^
+two errors found
diff --git a/test/pending/t7629-view-bounds-removal.flags b/test/pending/t7629-view-bounds-removal.flags
new file mode 100644
index 0000000000..29f4ede37a
--- /dev/null
+++ b/test/pending/t7629-view-bounds-removal.flags
@@ -0,0 +1 @@
+-Xfuture
diff --git a/test/pending/t7629-view-bounds-removal.scala b/test/pending/t7629-view-bounds-removal.scala
new file mode 100644
index 0000000000..a6ede1fcc3
--- /dev/null
+++ b/test/pending/t7629-view-bounds-removal.scala
@@ -0,0 +1,4 @@
+object Test {
+ def f[A <% Int](a: A) = null
+ def g[C, B <: C, A <% B : Numeric](a: A) = null
+}
diff --git a/test/scaladoc/run/SI-4676.scala b/test/scaladoc/run/SI-4676.scala
index b83a59a472..99b3c5568a 100644
--- a/test/scaladoc/run/SI-4676.scala
+++ b/test/scaladoc/run/SI-4676.scala
@@ -21,6 +21,7 @@ object Test extends ScaladocModelTest {
// check correct expansion of the use case signature
val x = rootPackage._class("SI_4676")._method("x")
- assert(x.valueParams(0)(0).resultType.name == "(String, String)", "parameter ss of method x has type (String, String")
+ val resultType = x.valueParams(0)(0).resultType.name
+ assert(resultType == "SS", s"parameter ss of method x has type $resultType, expected SS!")
}
} \ No newline at end of file
diff --git a/test/scaladoc/run/t7876.check b/test/scaladoc/run/t7876.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/t7876.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/t7876.scala b/test/scaladoc/run/t7876.scala
new file mode 100644
index 0000000000..63c63f8a0c
--- /dev/null
+++ b/test/scaladoc/run/t7876.scala
@@ -0,0 +1,19 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ import language.higherKinds
+ trait T[M[_]]
+ class C extends T[Function0]
+ class D extends T[Tuple1]
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ import access._
+ // did not crash
+ }
+}
diff --git a/test/scaladoc/run/t7876b.check b/test/scaladoc/run/t7876b.check
new file mode 100644
index 0000000000..21aaf3b295
--- /dev/null
+++ b/test/scaladoc/run/t7876b.check
@@ -0,0 +1,3 @@
+foo: FInt
+foo: TInt
+Done.
diff --git a/test/scaladoc/run/t7876b.scala b/test/scaladoc/run/t7876b.scala
new file mode 100644
index 0000000000..4d5b8c22cf
--- /dev/null
+++ b/test/scaladoc/run/t7876b.scala
@@ -0,0 +1,24 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+// Don't dealias just to print a Function or Tuple type.
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ class Test {
+ type FInt = Function0[Int]
+ type TInt = Tuple1[Int]
+ def foo: FInt
+ def bar: TInt
+ }
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ import access._
+ List("foo", "bar").foreach { name =>
+ println("foo: " + rootPackage._class("Test")._method(name).resultType.name)
+ }
+ }
+}