aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/neg
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/neg')
-rw-r--r--tests/untried/neg/abstract-class-2.check5
-rw-r--r--tests/untried/neg/abstract-class-2.scala14
-rw-r--r--tests/untried/neg/abstract-class-error.check5
-rw-r--r--tests/untried/neg/abstract-class-error/J.java4
-rw-r--r--tests/untried/neg/abstract-class-error/S.scala4
-rw-r--r--tests/untried/neg/abstract-concrete-methods.check5
-rw-r--r--tests/untried/neg/abstract-concrete-methods.scala10
-rw-r--r--tests/untried/neg/abstract-explaintypes.check15
-rw-r--r--tests/untried/neg/abstract-explaintypes.flags1
-rw-r--r--tests/untried/neg/abstract-explaintypes.scala11
-rw-r--r--tests/untried/neg/abstract-inaccessible.check15
-rw-r--r--tests/untried/neg/abstract-inaccessible.flags1
-rw-r--r--tests/untried/neg/abstract-inaccessible.scala9
-rw-r--r--tests/untried/neg/abstract-report.check24
-rw-r--r--tests/untried/neg/abstract-report.scala1
-rw-r--r--tests/untried/neg/abstract-report2.check103
-rw-r--r--tests/untried/neg/abstract-report2.scala15
-rw-r--r--tests/untried/neg/abstract-vars.check21
-rw-r--r--tests/untried/neg/abstract-vars.scala29
-rw-r--r--tests/untried/neg/abstract.check11
-rw-r--r--tests/untried/neg/abstract.scala11
-rw-r--r--tests/untried/neg/abstraction-from-volatile-type-error.check4
-rw-r--r--tests/untried/neg/abstraction-from-volatile-type-error.scala11
-rw-r--r--tests/untried/neg/accesses.check17
-rw-r--r--tests/untried/neg/accesses.scala27
-rw-r--r--tests/untried/neg/accesses2.check12
-rw-r--r--tests/untried/neg/accesses2.scala11
-rw-r--r--tests/untried/neg/ambiguous-float-dots2.check7
-rw-r--r--tests/untried/neg/ambiguous-float-dots2.scala13
-rw-r--r--tests/untried/neg/annot-nonconst.check18
-rw-r--r--tests/untried/neg/annot-nonconst.scala8
-rw-r--r--tests/untried/neg/any-vs-anyref.check80
-rw-r--r--tests/untried/neg/any-vs-anyref.scala29
-rw-r--r--tests/untried/neg/anytrait.check7
-rw-r--r--tests/untried/neg/anytrait.scala10
-rw-r--r--tests/untried/neg/anyval-anyref-parent.check23
-rw-r--r--tests/untried/neg/anyval-anyref-parent.scala12
-rw-r--r--tests/untried/neg/applydynamic_sip.check73
-rw-r--r--tests/untried/neg/applydynamic_sip.flags1
-rw-r--r--tests/untried/neg/applydynamic_sip.scala33
-rw-r--r--tests/untried/neg/bad-advice.check6
-rw-r--r--tests/untried/neg/bad-advice.flags1
-rw-r--r--tests/untried/neg/bad-advice.scala6
-rw-r--r--tests/untried/neg/badtok-1.check7
-rw-r--r--tests/untried/neg/badtok-1.scala2
-rw-r--r--tests/untried/neg/badtok-2.check4
-rw-r--r--tests/untried/neg/badtok-2.scala3
-rw-r--r--tests/untried/neg/badtok-3.check4
-rw-r--r--tests/untried/neg/badtok-3.scala2
-rw-r--r--tests/untried/neg/case-collision.check12
-rw-r--r--tests/untried/neg/case-collision.flags1
-rw-r--r--tests/untried/neg/case-collision.scala11
-rw-r--r--tests/untried/neg/case-collision2.check12
-rw-r--r--tests/untried/neg/case-collision2.flags1
-rw-r--r--tests/untried/neg/case-collision2.scala12
-rw-r--r--tests/untried/neg/caseinherit.check10
-rw-r--r--tests/untried/neg/caseinherit.scala13
-rw-r--r--tests/untried/neg/catch-all.check12
-rw-r--r--tests/untried/neg/catch-all.flags1
-rw-r--r--tests/untried/neg/catch-all.scala31
-rw-r--r--tests/untried/neg/check-dead.check15
-rw-r--r--tests/untried/neg/check-dead.flags1
-rw-r--r--tests/untried/neg/check-dead.scala37
-rw-r--r--tests/untried/neg/checksensible.check102
-rw-r--r--tests/untried/neg/checksensible.flags1
-rw-r--r--tests/untried/neg/checksensible.scala100
-rw-r--r--tests/untried/neg/checksensibleUnit.check7
-rw-r--r--tests/untried/neg/checksensibleUnit.scala5
-rw-r--r--tests/untried/neg/choices.check2
-rw-r--r--tests/untried/neg/choices.flags1
-rw-r--r--tests/untried/neg/choices.scala5
-rw-r--r--tests/untried/neg/class-of-double-targs.check4
-rw-r--r--tests/untried/neg/class-of-double-targs.scala3
-rw-r--r--tests/untried/neg/classmanifests_new_deprecations.check27
-rw-r--r--tests/untried/neg/classmanifests_new_deprecations.flags1
-rw-r--r--tests/untried/neg/classmanifests_new_deprecations.scala37
-rw-r--r--tests/untried/neg/classtags_contextbound_a.check4
-rw-r--r--tests/untried/neg/classtags_contextbound_a.scala4
-rw-r--r--tests/untried/neg/classtags_contextbound_b.check4
-rw-r--r--tests/untried/neg/classtags_contextbound_b.scala7
-rw-r--r--tests/untried/neg/classtags_contextbound_c.check4
-rw-r--r--tests/untried/neg/classtags_contextbound_c.scala7
-rw-r--r--tests/untried/neg/classtags_dont_use_typetags.check4
-rw-r--r--tests/untried/neg/classtags_dont_use_typetags.scala5
-rw-r--r--tests/untried/neg/compile-time-only-a.check79
-rw-r--r--tests/untried/neg/compile-time-only-a.scala76
-rw-r--r--tests/untried/neg/compile-time-only-b.check13
-rw-r--r--tests/untried/neg/compile-time-only-b.scala15
-rw-r--r--tests/untried/neg/constrs.check18
-rw-r--r--tests/untried/neg/constrs.scala19
-rw-r--r--tests/untried/neg/constructor-init-order.check9
-rw-r--r--tests/untried/neg/constructor-init-order.flags1
-rw-r--r--tests/untried/neg/constructor-init-order.scala23
-rw-r--r--tests/untried/neg/constructor-prefix-error.check4
-rw-r--r--tests/untried/neg/constructor-prefix-error.scala7
-rw-r--r--tests/untried/neg/cycle-bounds.check4
-rw-r--r--tests/untried/neg/cycle-bounds.flags1
-rw-r--r--tests/untried/neg/cycle-bounds.scala5
-rw-r--r--tests/untried/neg/cyclics-import.check6
-rw-r--r--tests/untried/neg/cyclics-import.scala17
-rw-r--r--tests/untried/neg/cyclics.check10
-rw-r--r--tests/untried/neg/cyclics.scala6
-rw-r--r--tests/untried/neg/dbldef.check12
-rw-r--r--tests/untried/neg/dbldef.scala1
-rw-r--r--tests/untried/neg/deadline-inf-illegal.check15
-rw-r--r--tests/untried/neg/deadline-inf-illegal.scala8
-rw-r--r--tests/untried/neg/delayed-init-ref.check16
-rw-r--r--tests/untried/neg/delayed-init-ref.flags1
-rw-r--r--tests/untried/neg/delayed-init-ref.scala42
-rw-r--r--tests/untried/neg/depmet_1.check10
-rw-r--r--tests/untried/neg/depmet_1.scala5
-rw-r--r--tests/untried/neg/divergent-implicit.check16
-rw-r--r--tests/untried/neg/divergent-implicit.scala16
-rw-r--r--tests/untried/neg/dotless-targs.check4
-rw-r--r--tests/untried/neg/dotless-targs.scala5
-rw-r--r--tests/untried/neg/error_dependentMethodTpeConversionToFunction.check4
-rw-r--r--tests/untried/neg/error_dependentMethodTpeConversionToFunction.scala5
-rw-r--r--tests/untried/neg/error_tooManyArgsPattern.check4
-rw-r--r--tests/untried/neg/error_tooManyArgsPattern.scala5
-rw-r--r--tests/untried/neg/eta-expand-star-deprecation.check4
-rw-r--r--tests/untried/neg/eta-expand-star-deprecation.flags1
-rw-r--r--tests/untried/neg/eta-expand-star-deprecation.scala8
-rw-r--r--tests/untried/neg/eta-expand-star.check4
-rw-r--r--tests/untried/neg/eta-expand-star.scala8
-rw-r--r--tests/untried/neg/exhausting.check27
-rw-r--r--tests/untried/neg/exhausting.flags1
-rw-r--r--tests/untried/neg/exhausting.scala61
-rw-r--r--tests/untried/neg/faculty.check4
-rw-r--r--tests/untried/neg/faculty.scala5
-rw-r--r--tests/untried/neg/finitary-error.check4
-rw-r--r--tests/untried/neg/finitary-error.scala3
-rw-r--r--tests/untried/neg/for-comprehension-old.check26
-rw-r--r--tests/untried/neg/for-comprehension-old.flags1
-rw-r--r--tests/untried/neg/for-comprehension-old.scala11
-rw-r--r--tests/untried/neg/forgot-interpolator.check27
-rw-r--r--tests/untried/neg/forgot-interpolator.flags1
-rw-r--r--tests/untried/neg/forgot-interpolator.scala93
-rw-r--r--tests/untried/neg/forward.check10
-rw-r--r--tests/untried/neg/forward.scala24
-rw-r--r--tests/untried/neg/found-req-variance.check185
-rw-r--r--tests/untried/neg/found-req-variance.scala106
-rw-r--r--tests/untried/neg/gadts1.check9
-rw-r--r--tests/untried/neg/gadts1.scala33
-rw-r--r--tests/untried/neg/gadts2-strict.check6
-rw-r--r--tests/untried/neg/gadts2-strict.flags1
-rw-r--r--tests/untried/neg/gadts2-strict.scala26
-rw-r--r--tests/untried/neg/gadts2.check6
-rw-r--r--tests/untried/neg/gadts2.flags1
-rw-r--r--tests/untried/neg/gadts2.scala12
-rw-r--r--tests/untried/neg/higherkind_novalue.check7
-rw-r--r--tests/untried/neg/higherkind_novalue.scala4
-rw-r--r--tests/untried/neg/hk-bad-bounds.check4
-rw-r--r--tests/untried/neg/hk-bad-bounds.scala5
-rw-r--r--tests/untried/neg/illegal-stmt-start.check4
-rw-r--r--tests/untried/neg/illegal-stmt-start.scala5
-rw-r--r--tests/untried/neg/imp2.check7
-rw-r--r--tests/untried/neg/imp2.scala19
-rw-r--r--tests/untried/neg/implicit-shadow.check11
-rw-r--r--tests/untried/neg/implicit-shadow.flags1
-rw-r--r--tests/untried/neg/implicit-shadow.scala13
-rw-r--r--tests/untried/neg/implicits.check14
-rw-r--r--tests/untried/neg/implicits.scala74
-rw-r--r--tests/untried/neg/import-precedence.check19
-rw-r--r--tests/untried/neg/import-precedence.scala68
-rw-r--r--tests/untried/neg/infix-op-positions.check7
-rw-r--r--tests/untried/neg/infix-op-positions.scala4
-rw-r--r--tests/untried/neg/interop_abstypetags_arenot_classmanifests.check4
-rw-r--r--tests/untried/neg/interop_abstypetags_arenot_classmanifests.scala11
-rw-r--r--tests/untried/neg/interop_abstypetags_arenot_classtags.check4
-rw-r--r--tests/untried/neg/interop_abstypetags_arenot_classtags.scala12
-rw-r--r--tests/untried/neg/interop_abstypetags_arenot_manifests.check4
-rw-r--r--tests/untried/neg/interop_abstypetags_arenot_manifests.scala11
-rw-r--r--tests/untried/neg/interop_classmanifests_arenot_typetags.check4
-rw-r--r--tests/untried/neg/interop_classmanifests_arenot_typetags.scala11
-rw-r--r--tests/untried/neg/interop_classtags_arenot_manifests.check4
-rw-r--r--tests/untried/neg/interop_classtags_arenot_manifests.scala11
-rw-r--r--tests/untried/neg/interop_typetags_arenot_classmanifests.check4
-rw-r--r--tests/untried/neg/interop_typetags_arenot_classmanifests.scala11
-rw-r--r--tests/untried/neg/interop_typetags_arenot_classtags.check4
-rw-r--r--tests/untried/neg/interop_typetags_arenot_classtags.scala12
-rw-r--r--tests/untried/neg/interop_typetags_without_classtags_arenot_manifests.check6
-rw-r--r--tests/untried/neg/interop_typetags_without_classtags_arenot_manifests.scala12
-rw-r--r--tests/untried/neg/java-access-neg.check16
-rw-r--r--tests/untried/neg/java-access-neg/J.java15
-rw-r--r--tests/untried/neg/java-access-neg/S2.scala61
-rw-r--r--tests/untried/neg/lazy-override.check9
-rw-r--r--tests/untried/neg/lazy-override.scala19
-rw-r--r--tests/untried/neg/lazyvals.check25
-rw-r--r--tests/untried/neg/lazyvals.scala46
-rw-r--r--tests/untried/neg/literate_existentials.check4
-rw-r--r--tests/untried/neg/literate_existentials.scala224
-rw-r--r--tests/untried/neg/logImplicits.check19
-rw-r--r--tests/untried/neg/logImplicits.flags1
-rw-r--r--tests/untried/neg/logImplicits.scala25
-rw-r--r--tests/untried/neg/lubs.check21
-rw-r--r--tests/untried/neg/lubs.scala26
-rw-r--r--tests/untried/neg/macro-abort.check4
-rw-r--r--tests/untried/neg/macro-abort/Macros_1.scala9
-rw-r--r--tests/untried/neg/macro-abort/Test_2.scala3
-rw-r--r--tests/untried/neg/macro-basic-mamdmi.check5
-rw-r--r--tests/untried/neg/macro-basic-mamdmi.flags1
-rw-r--r--tests/untried/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala34
-rw-r--r--tests/untried/neg/macro-blackbox-dynamic-materialization.check4
-rw-r--r--tests/untried/neg/macro-blackbox-dynamic-materialization/Macros_1.scala25
-rw-r--r--tests/untried/neg/macro-blackbox-dynamic-materialization/Test_2.scala4
-rw-r--r--tests/untried/neg/macro-blackbox-extractor.check4
-rw-r--r--tests/untried/neg/macro-blackbox-extractor/Macros_1.scala21
-rw-r--r--tests/untried/neg/macro-blackbox-extractor/Test_2.scala5
-rw-r--r--tests/untried/neg/macro-blackbox-fundep-materialization.check8
-rw-r--r--tests/untried/neg/macro-blackbox-fundep-materialization.flags1
-rw-r--r--tests/untried/neg/macro-blackbox-fundep-materialization/Macros_1.scala39
-rw-r--r--tests/untried/neg/macro-blackbox-fundep-materialization/Test_2.scala12
-rw-r--r--tests/untried/neg/macro-blackbox-structural.check4
-rw-r--r--tests/untried/neg/macro-blackbox-structural/Impls_Macros_1.scala15
-rw-r--r--tests/untried/neg/macro-blackbox-structural/Test_2.scala5
-rw-r--r--tests/untried/neg/macro-bundle-abstract.check4
-rw-r--r--tests/untried/neg/macro-bundle-abstract.scala11
-rw-r--r--tests/untried/neg/macro-bundle-ambiguous.check5
-rw-r--r--tests/untried/neg/macro-bundle-ambiguous.scala14
-rw-r--r--tests/untried/neg/macro-bundle-need-qualifier.check4
-rw-r--r--tests/untried/neg/macro-bundle-need-qualifier.scala11
-rw-r--r--tests/untried/neg/macro-bundle-noncontext.check4
-rw-r--r--tests/untried/neg/macro-bundle-noncontext.scala9
-rw-r--r--tests/untried/neg/macro-bundle-nonpublic-c.check4
-rw-r--r--tests/untried/neg/macro-bundle-nonpublic-c.scala11
-rw-r--r--tests/untried/neg/macro-bundle-nonpublic-impl.check4
-rw-r--r--tests/untried/neg/macro-bundle-nonpublic-impl.scala11
-rw-r--r--tests/untried/neg/macro-bundle-nonstatic.check13
-rw-r--r--tests/untried/neg/macro-bundle-nonstatic.scala36
-rw-r--r--tests/untried/neg/macro-bundle-object.check8
-rw-r--r--tests/untried/neg/macro-bundle-object.scala11
-rw-r--r--tests/untried/neg/macro-bundle-overloaded.check4
-rw-r--r--tests/untried/neg/macro-bundle-overloaded.scala12
-rw-r--r--tests/untried/neg/macro-bundle-polymorphic.check19
-rw-r--r--tests/untried/neg/macro-bundle-polymorphic.scala43
-rw-r--r--tests/untried/neg/macro-bundle-priority-bundle.check8
-rw-r--r--tests/untried/neg/macro-bundle-priority-bundle.scala14
-rw-r--r--tests/untried/neg/macro-bundle-priority-nonbundle.check8
-rw-r--r--tests/untried/neg/macro-bundle-priority-nonbundle.scala14
-rw-r--r--tests/untried/neg/macro-bundle-trait.check4
-rw-r--r--tests/untried/neg/macro-bundle-trait.scala11
-rw-r--r--tests/untried/neg/macro-bundle-whitebox-use-raw.check17
-rw-r--r--tests/untried/neg/macro-bundle-whitebox-use-raw/Macros_1.scala108
-rw-r--r--tests/untried/neg/macro-bundle-whitebox-use-raw/Test_2.scala19
-rw-r--r--tests/untried/neg/macro-bundle-whitebox-use-refined.check17
-rw-r--r--tests/untried/neg/macro-bundle-whitebox-use-refined/Macros_1.scala108
-rw-r--r--tests/untried/neg/macro-bundle-whitebox-use-refined/Test_2.scala19
-rw-r--r--tests/untried/neg/macro-bundle-wrongcontext-a.check4
-rw-r--r--tests/untried/neg/macro-bundle-wrongcontext-a.scala13
-rw-r--r--tests/untried/neg/macro-bundle-wrongcontext-b.check4
-rw-r--r--tests/untried/neg/macro-bundle-wrongcontext-b.scala11
-rw-r--r--tests/untried/neg/macro-cyclic.check4
-rw-r--r--tests/untried/neg/macro-cyclic.flags1
-rw-r--r--tests/untried/neg/macro-cyclic/Impls_Macros_1.scala25
-rw-r--r--tests/untried/neg/macro-deprecate-idents.check67
-rw-r--r--tests/untried/neg/macro-deprecate-idents.flags1
-rw-r--r--tests/untried/neg/macro-deprecate-idents.scala56
-rw-r--r--tests/untried/neg/macro-divergence-controlled.check4
-rw-r--r--tests/untried/neg/macro-divergence-controlled/Impls_Macros_1.scala23
-rw-r--r--tests/untried/neg/macro-divergence-controlled/Test_2.scala3
-rw-r--r--tests/untried/neg/macro-exception.check7
-rw-r--r--tests/untried/neg/macro-exception/Macros_1.scala9
-rw-r--r--tests/untried/neg/macro-exception/Test_2.scala3
-rw-r--r--tests/untried/neg/macro-false-deprecation-warning.check4
-rw-r--r--tests/untried/neg/macro-false-deprecation-warning.flags1
-rw-r--r--tests/untried/neg/macro-false-deprecation-warning/Impls_Macros_1.scala15
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-a.check7
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-a/Macros_2.flags1
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-a/Macros_2.scala7
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-a/Plugin_1.scala35
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-a/Test_3.scala4
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-a/scalac-plugin.xml4
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-b.check7
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-b.flags1
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-b/Macros_2.flags1
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-b/Macros_2.scala7
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-b/Plugin_1.scala35
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-b/Test_3.scala4
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-b/scalac-plugin.xml4
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-c.check4
-rw-r--r--tests/untried/neg/macro-incompatible-macro-engine-c.scala3
-rw-r--r--tests/untried/neg/macro-invalidimpl.check53
-rw-r--r--tests/untried/neg/macro-invalidimpl.flags1
-rw-r--r--tests/untried/neg/macro-invalidimpl/Impls_1.scala39
-rw-r--r--tests/untried/neg/macro-invalidimpl/Macros_Test_2.scala55
-rw-r--r--tests/untried/neg/macro-invalidret.check35
-rw-r--r--tests/untried/neg/macro-invalidret.flags3
-rw-r--r--tests/untried/neg/macro-invalidret/Impls_1.scala10
-rw-r--r--tests/untried/neg/macro-invalidret/Macros_Test_2.scala18
-rw-r--r--tests/untried/neg/macro-invalidshape.check20
-rw-r--r--tests/untried/neg/macro-invalidshape.flags1
-rw-r--r--tests/untried/neg/macro-invalidshape/Impls_1.scala5
-rw-r--r--tests/untried/neg/macro-invalidshape/Macros_Test_2.scala17
-rw-r--r--tests/untried/neg/macro-invalidsig-params-badtype.check8
-rw-r--r--tests/untried/neg/macro-invalidsig-params-badtype.flags1
-rw-r--r--tests/untried/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala9
-rw-r--r--tests/untried/neg/macro-invalidsig.check85
-rw-r--r--tests/untried/neg/macro-invalidsig.flags1
-rw-r--r--tests/untried/neg/macro-invalidsig/Impls_1.scala86
-rw-r--r--tests/untried/neg/macro-invalidsig/Macros_Test_2.scala83
-rw-r--r--tests/untried/neg/macro-invalidusage-badargs.check18
-rw-r--r--tests/untried/neg/macro-invalidusage-badargs.flags1
-rw-r--r--tests/untried/neg/macro-invalidusage-badargs/Impls_1.scala5
-rw-r--r--tests/untried/neg/macro-invalidusage-badargs/Macros_Test_2.scala10
-rw-r--r--tests/untried/neg/macro-invalidusage-badbounds.check4
-rw-r--r--tests/untried/neg/macro-invalidusage-badbounds.flags1
-rw-r--r--tests/untried/neg/macro-invalidusage-badbounds/Impls_1.scala5
-rw-r--r--tests/untried/neg/macro-invalidusage-badbounds/Macros_Test_2.scala8
-rw-r--r--tests/untried/neg/macro-invalidusage-badtargs.check18
-rw-r--r--tests/untried/neg/macro-invalidusage-badtargs.flags1
-rw-r--r--tests/untried/neg/macro-invalidusage-badtargs/Impls_1.scala5
-rw-r--r--tests/untried/neg/macro-invalidusage-badtargs/Macros_Test_2.scala18
-rw-r--r--tests/untried/neg/macro-invalidusage-methodvaluesyntax.check4
-rw-r--r--tests/untried/neg/macro-invalidusage-methodvaluesyntax.flags1
-rw-r--r--tests/untried/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala8
-rw-r--r--tests/untried/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala8
-rw-r--r--tests/untried/neg/macro-invalidusage-nontypeable.check4
-rw-r--r--tests/untried/neg/macro-invalidusage-nontypeable.flags1
-rw-r--r--tests/untried/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala13
-rw-r--r--tests/untried/neg/macro-invalidusage-nontypeable/Test_2.scala3
-rw-r--r--tests/untried/neg/macro-invalidusage-presuper.check4
-rw-r--r--tests/untried/neg/macro-invalidusage-presuper.flags1
-rw-r--r--tests/untried/neg/macro-invalidusage-presuper/Impls_1.scala5
-rw-r--r--tests/untried/neg/macro-invalidusage-presuper/Macros_Test_2.scala3
-rw-r--r--tests/untried/neg/macro-noexpand.check4
-rw-r--r--tests/untried/neg/macro-noexpand.flags1
-rw-r--r--tests/untried/neg/macro-noexpand/Impls_1.scala5
-rw-r--r--tests/untried/neg/macro-noexpand/Macros_Test_2.scala8
-rw-r--r--tests/untried/neg/macro-nontypeablebody.check4
-rw-r--r--tests/untried/neg/macro-nontypeablebody.flags1
-rw-r--r--tests/untried/neg/macro-nontypeablebody/Impls_1.scala5
-rw-r--r--tests/untried/neg/macro-nontypeablebody/Macros_Test_2.scala8
-rw-r--r--tests/untried/neg/macro-override-macro-overrides-abstract-method-a.check5
-rw-r--r--tests/untried/neg/macro-override-macro-overrides-abstract-method-a.flags1
-rw-r--r--tests/untried/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala13
-rw-r--r--tests/untried/neg/macro-override-macro-overrides-abstract-method-a/Test_2.scala4
-rw-r--r--tests/untried/neg/macro-override-macro-overrides-abstract-method-b.check11
-rw-r--r--tests/untried/neg/macro-override-macro-overrides-abstract-method-b.flags1
-rw-r--r--tests/untried/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala8
-rw-r--r--tests/untried/neg/macro-override-macro-overrides-abstract-method-b/Test_2.scala6
-rw-r--r--tests/untried/neg/macro-override-method-overrides-macro.check5
-rw-r--r--tests/untried/neg/macro-override-method-overrides-macro.flags1
-rw-r--r--tests/untried/neg/macro-override-method-overrides-macro/Impls_1.scala14
-rw-r--r--tests/untried/neg/macro-override-method-overrides-macro/Macros_Test_2.scala15
-rw-r--r--tests/untried/neg/macro-qmarkqmarkqmark.check13
-rw-r--r--tests/untried/neg/macro-qmarkqmarkqmark.scala13
-rw-r--r--tests/untried/neg/macro-quasiquotes.check8
-rw-r--r--tests/untried/neg/macro-quasiquotes/Macros_1.scala15
-rw-r--r--tests/untried/neg/macro-quasiquotes/Test_2.scala5
-rw-r--r--tests/untried/neg/macro-reify-splice-splice.check7
-rw-r--r--tests/untried/neg/macro-reify-splice-splice.flags1
-rw-r--r--tests/untried/neg/macro-reify-splice-splice/Macros_1.scala11
-rw-r--r--tests/untried/neg/macro-reify-splice-splice/Test_2.scala3
-rw-r--r--tests/untried/neg/macro-reify-typetag-hktypeparams-notags.check7
-rw-r--r--tests/untried/neg/macro-reify-typetag-hktypeparams-notags/Test.scala9
-rw-r--r--tests/untried/neg/macro-reify-typetag-typeparams-notags.check7
-rw-r--r--tests/untried/neg/macro-reify-typetag-typeparams-notags/Test.scala9
-rw-r--r--tests/untried/neg/macro-reify-typetag-useabstypetag.check7
-rw-r--r--tests/untried/neg/macro-reify-typetag-useabstypetag/Test.scala9
-rw-r--r--tests/untried/neg/macro-without-xmacros-a.check17
-rw-r--r--tests/untried/neg/macro-without-xmacros-a/Impls_1.scala18
-rw-r--r--tests/untried/neg/macro-without-xmacros-a/Macros_2.scala12
-rw-r--r--tests/untried/neg/macro-without-xmacros-a/Test_3.scala4
-rw-r--r--tests/untried/neg/macro-without-xmacros-b.check17
-rw-r--r--tests/untried/neg/macro-without-xmacros-b/Impls_1.scala18
-rw-r--r--tests/untried/neg/macro-without-xmacros-b/Macros_2.scala10
-rw-r--r--tests/untried/neg/macro-without-xmacros-b/Test_3.scala4
-rw-r--r--tests/untried/neg/main1.check28
-rw-r--r--tests/untried/neg/main1.flags1
-rw-r--r--tests/untried/neg/main1.scala45
-rw-r--r--tests/untried/neg/migration28.check7
-rw-r--r--tests/untried/neg/migration28.flags1
-rw-r--r--tests/untried/neg/migration28.scala9
-rw-r--r--tests/untried/neg/missing-param-type-tuple.check31
-rw-r--r--tests/untried/neg/missing-param-type-tuple.scala8
-rw-r--r--tests/untried/neg/mixins.check6
-rw-r--r--tests/untried/neg/mixins.scala9
-rw-r--r--tests/untried/neg/multi-array.check4
-rw-r--r--tests/untried/neg/multi-array.flags1
-rw-r--r--tests/untried/neg/multi-array.scala14
-rw-r--r--tests/untried/neg/name-lookup-stable.check11
-rw-r--r--tests/untried/neg/name-lookup-stable.scala20
-rw-r--r--tests/untried/neg/names-defaults-neg-ref.check16
-rw-r--r--tests/untried/neg/names-defaults-neg-ref.scala26
-rw-r--r--tests/untried/neg/names-defaults-neg-warn.check9
-rw-r--r--tests/untried/neg/names-defaults-neg-warn.flags1
-rw-r--r--tests/untried/neg/names-defaults-neg-warn.scala14
-rw-r--r--tests/untried/neg/names-defaults-neg.check185
-rw-r--r--tests/untried/neg/names-defaults-neg.flags1
-rw-r--r--tests/untried/neg/names-defaults-neg.scala184
-rw-r--r--tests/untried/neg/nested-annotation.check10
-rw-r--r--tests/untried/neg/nested-annotation.scala9
-rw-r--r--tests/untried/neg/nested-fn-print.check20
-rw-r--r--tests/untried/neg/nested-fn-print.scala11
-rw-r--r--tests/untried/neg/newpat_unreachable.check35
-rw-r--r--tests/untried/neg/newpat_unreachable.flags1
-rw-r--r--tests/untried/neg/newpat_unreachable.scala29
-rw-r--r--tests/untried/neg/no-implicit-to-anyref-any-val.check34
-rw-r--r--tests/untried/neg/no-implicit-to-anyref-any-val.scala33
-rw-r--r--tests/untried/neg/no-predef.check14
-rw-r--r--tests/untried/neg/no-predef.flags1
-rw-r--r--tests/untried/neg/no-predef.scala5
-rw-r--r--tests/untried/neg/noMember1.check5
-rw-r--r--tests/untried/neg/noMember1.scala3
-rw-r--r--tests/untried/neg/noMember2.check5
-rw-r--r--tests/untried/neg/noMember2.scala3
-rw-r--r--tests/untried/neg/nonlocal-warning.check9
-rw-r--r--tests/untried/neg/nonlocal-warning.flags1
-rw-r--r--tests/untried/neg/nonlocal-warning.scala18
-rw-r--r--tests/untried/neg/nopredefs.check4
-rw-r--r--tests/untried/neg/nopredefs.scala6
-rw-r--r--tests/untried/neg/not-a-legal-formal-parameter-tuple.check19
-rw-r--r--tests/untried/neg/not-a-legal-formal-parameter-tuple.scala5
-rw-r--r--tests/untried/neg/not-possible-cause.check9
-rw-r--r--tests/untried/neg/not-possible-cause.scala3
-rw-r--r--tests/untried/neg/null-unsoundness.check5
-rw-r--r--tests/untried/neg/null-unsoundness.scala14
-rw-r--r--tests/untried/neg/nullary-override.check6
-rw-r--r--tests/untried/neg/nullary-override.flags1
-rw-r--r--tests/untried/neg/nullary-override.scala3
-rw-r--r--tests/untried/neg/object-not-a-value.check4
-rw-r--r--tests/untried/neg/object-not-a-value.scala7
-rw-r--r--tests/untried/neg/overload-msg.check13
-rw-r--r--tests/untried/neg/overload-msg.scala4
-rw-r--r--tests/untried/neg/overload.check7
-rw-r--r--tests/untried/neg/overload.scala11
-rw-r--r--tests/untried/neg/overloaded-implicit.check9
-rw-r--r--tests/untried/neg/overloaded-implicit.flags1
-rw-r--r--tests/untried/neg/overloaded-implicit.scala17
-rw-r--r--tests/untried/neg/overloaded-unapply.check14
-rw-r--r--tests/untried/neg/overloaded-unapply.scala24
-rw-r--r--tests/untried/neg/override-object-flag.check5
-rw-r--r--tests/untried/neg/override-object-flag.scala3
-rw-r--r--tests/untried/neg/override-object-no.check23
-rw-r--r--tests/untried/neg/override-object-no.flags1
-rw-r--r--tests/untried/neg/override-object-no.scala45
-rw-r--r--tests/untried/neg/override.check5
-rwxr-xr-xtests/untried/neg/override.scala15
-rw-r--r--tests/untried/neg/parent-inherited-twice-error.check7
-rw-r--r--tests/untried/neg/parent-inherited-twice-error.scala2
-rw-r--r--tests/untried/neg/parstar.check7
-rw-r--r--tests/untried/neg/parstar.scala10
-rw-r--r--tests/untried/neg/pat_unreachable.check17
-rw-r--r--tests/untried/neg/pat_unreachable.flags1
-rw-r--r--tests/untried/neg/pat_unreachable.scala26
-rw-r--r--tests/untried/neg/patmat-classtag-compound.check6
-rw-r--r--tests/untried/neg/patmat-classtag-compound.flags1
-rw-r--r--tests/untried/neg/patmat-classtag-compound.scala17
-rw-r--r--tests/untried/neg/patmat-type-check.check46
-rw-r--r--tests/untried/neg/patmat-type-check.scala31
-rw-r--r--tests/untried/neg/patmatexhaust.check42
-rw-r--r--tests/untried/neg/patmatexhaust.flags1
-rw-r--r--tests/untried/neg/patmatexhaust.scala131
-rw-r--r--tests/untried/neg/patternalts.check4
-rw-r--r--tests/untried/neg/patternalts.scala5
-rw-r--r--tests/untried/neg/permanent-blindness.check12
-rw-r--r--tests/untried/neg/permanent-blindness.flags1
-rw-r--r--tests/untried/neg/permanent-blindness.scala22
-rw-r--r--tests/untried/neg/predef-masking.check4
-rw-r--r--tests/untried/neg/predef-masking.scala21
-rw-r--r--tests/untried/neg/primitive-sigs-1.check6
-rw-r--r--tests/untried/neg/primitive-sigs-1/A.scala9
-rw-r--r--tests/untried/neg/primitive-sigs-1/B.scala5
-rw-r--r--tests/untried/neg/primitive-sigs-1/J.java8
-rw-r--r--tests/untried/neg/protected-constructors.check22
-rw-r--r--tests/untried/neg/protected-constructors.scala21
-rw-r--r--tests/untried/neg/protected-static-fail.check16
-rw-r--r--tests/untried/neg/protected-static-fail/J.java7
-rw-r--r--tests/untried/neg/protected-static-fail/S.scala10
-rw-r--r--tests/untried/neg/protected-static-fail/S0.scala9
-rw-r--r--tests/untried/neg/qualifying-class-error-1.check4
-rw-r--r--tests/untried/neg/qualifying-class-error-1.scala2
-rw-r--r--tests/untried/neg/qualifying-class-error-2.check4
-rw-r--r--tests/untried/neg/qualifying-class-error-2.scala11
-rw-r--r--tests/untried/neg/quasiquotes-syntax-error-position.check47
-rw-r--r--tests/untried/neg/quasiquotes-syntax-error-position.scala21
-rw-r--r--tests/untried/neg/quasiquotes-unliftable-not-found.check4
-rw-r--r--tests/untried/neg/quasiquotes-unliftable-not-found.scala5
-rw-r--r--tests/untried/neg/raw-types-stubs.check11
-rw-r--r--tests/untried/neg/raw-types-stubs/M_1.java3
-rw-r--r--tests/untried/neg/raw-types-stubs/Raw_2.java4
-rw-r--r--tests/untried/neg/raw-types-stubs/S_3.scala1
-rw-r--r--tests/untried/neg/reassignment.check13
-rw-r--r--tests/untried/neg/reassignment.scala7
-rw-r--r--tests/untried/neg/reflection-names-neg.check13
-rw-r--r--tests/untried/neg/reflection-names-neg.scala6
-rw-r--r--tests/untried/neg/reify_ann2b.check4
-rw-r--r--tests/untried/neg/reify_ann2b.scala28
-rw-r--r--tests/untried/neg/reify_metalevel_breach_+0_refers_to_1.check7
-rw-r--r--tests/untried/neg/reify_metalevel_breach_+0_refers_to_1.scala16
-rw-r--r--tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_a.check7
-rw-r--r--tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_a.scala14
-rw-r--r--tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_b.check7
-rw-r--r--tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_b.scala18
-rw-r--r--tests/untried/neg/reify_metalevel_breach_-1_refers_to_1.check7
-rw-r--r--tests/untried/neg/reify_metalevel_breach_-1_refers_to_1.scala16
-rw-r--r--tests/untried/neg/reify_nested_inner_refers_to_local.check7
-rw-r--r--tests/untried/neg/reify_nested_inner_refers_to_local.scala15
-rw-r--r--tests/untried/neg/run-gadts-strict.check21
-rw-r--r--tests/untried/neg/run-gadts-strict.flags1
-rw-r--r--tests/untried/neg/run-gadts-strict.scala18
-rw-r--r--tests/untried/neg/sabin2.check6
-rw-r--r--tests/untried/neg/sabin2.scala23
-rw-r--r--tests/untried/neg/saferJavaConversions.check6
-rw-r--r--tests/untried/neg/saferJavaConversions.scala20
-rw-r--r--tests/untried/neg/saito.check4
-rw-r--r--tests/untried/neg/saito.scala14
-rw-r--r--tests/untried/neg/sammy_restrictions.check49
-rw-r--r--tests/untried/neg/sammy_restrictions.flags1
-rw-r--r--tests/untried/neg/sammy_restrictions.scala45
-rw-r--r--tests/untried/neg/sammy_wrong_arity.check52
-rw-r--r--tests/untried/neg/sammy_wrong_arity.flags1
-rw-r--r--tests/untried/neg/sammy_wrong_arity.scala22
-rw-r--r--tests/untried/neg/scopes.check26
-rw-r--r--tests/untried/neg/scopes.scala18
-rw-r--r--tests/untried/neg/sealed-final-neg.check4
-rw-r--r--tests/untried/neg/sealed-final-neg.flags1
-rw-r--r--tests/untried/neg/sealed-final-neg.scala41
-rw-r--r--tests/untried/neg/sealed-java-enums.check7
-rw-r--r--tests/untried/neg/sealed-java-enums.flags1
-rw-r--r--tests/untried/neg/sealed-java-enums.scala10
-rw-r--r--tests/untried/neg/sensitive.check4
-rw-r--r--tests/untried/neg/sensitive.scala18
-rw-r--r--tests/untried/neg/sensitive2.check10
-rw-r--r--tests/untried/neg/sensitive2.scala8
-rw-r--r--tests/untried/neg/serialversionuid-not-const.check10
-rw-r--r--tests/untried/neg/serialversionuid-not-const.scala16
-rw-r--r--tests/untried/neg/spec-overrides.check7
-rw-r--r--tests/untried/neg/spec-overrides.scala26
-rw-r--r--tests/untried/neg/specification-scopes.check12
-rw-r--r--tests/untried/neg/specification-scopes/P_1.scala6
-rw-r--r--tests/untried/neg/specification-scopes/P_2.scala21
-rw-r--r--tests/untried/neg/stmt-expr-discard.check9
-rw-r--r--tests/untried/neg/stmt-expr-discard.flags1
-rw-r--r--tests/untried/neg/stmt-expr-discard.scala5
-rw-r--r--tests/untried/neg/stringinterpolation_macro-neg.check172
-rw-r--r--tests/untried/neg/stringinterpolation_macro-neg.scala76
-rw-r--r--tests/untried/neg/structural.check28
-rw-r--r--tests/untried/neg/structural.scala54
-rw-r--r--tests/untried/neg/suggest-similar.check10
-rw-r--r--tests/untried/neg/suggest-similar.scala11
-rw-r--r--tests/untried/neg/super-cast-or-test.check7
-rw-r--r--tests/untried/neg/super-cast-or-test.scala3
-rw-r--r--tests/untried/neg/switch.check9
-rw-r--r--tests/untried/neg/switch.flags1
-rw-r--r--tests/untried/neg/switch.scala66
-rw-r--r--tests/untried/neg/t0003.check6
-rw-r--r--tests/untried/neg/t0003.scala3
-rw-r--r--tests/untried/neg/t0015.check6
-rw-r--r--tests/untried/neg/t0015.scala25
-rw-r--r--tests/untried/neg/t0117.check4
-rw-r--r--tests/untried/neg/t0117.scala5
-rw-r--r--tests/untried/neg/t0152.check6
-rw-r--r--tests/untried/neg/t0152.scala13
-rw-r--r--tests/untried/neg/t0204.check4
-rw-r--r--tests/untried/neg/t0204.scala5
-rw-r--r--tests/untried/neg/t0207.check7
-rw-r--r--tests/untried/neg/t0207.scala4
-rw-r--r--tests/untried/neg/t0209.check6
-rw-r--r--tests/untried/neg/t0209.scala17
-rw-r--r--tests/untried/neg/t0214.check4
-rw-r--r--tests/untried/neg/t0214.scala4
-rw-r--r--tests/untried/neg/t0218.check4
-rw-r--r--tests/untried/neg/t0218.scala12
-rw-r--r--tests/untried/neg/t0226.check10
-rw-r--r--tests/untried/neg/t0226.scala9
-rw-r--r--tests/untried/neg/t0259.check7
-rw-r--r--tests/untried/neg/t0259.scala6
-rw-r--r--tests/untried/neg/t0345.check4
-rw-r--r--tests/untried/neg/t0345.scala15
-rw-r--r--tests/untried/neg/t0351.check4
-rw-r--r--tests/untried/neg/t0351.scala3
-rw-r--r--tests/untried/neg/t0418.check4
-rw-r--r--tests/untried/neg/t0418.scala3
-rw-r--r--tests/untried/neg/t0503.check7
-rw-r--r--tests/untried/neg/t0503.scala3
-rw-r--r--tests/untried/neg/t0513.check7
-rw-r--r--tests/untried/neg/t0513.scala6
-rw-r--r--tests/untried/neg/t0528neg.check4
-rw-r--r--tests/untried/neg/t0528neg.scala15
-rw-r--r--tests/untried/neg/t0565.check4
-rw-r--r--tests/untried/neg/t0565.scala22
-rw-r--r--tests/untried/neg/t0590.check6
-rw-r--r--tests/untried/neg/t0590.scala3
-rw-r--r--tests/untried/neg/t0606.check4
-rw-r--r--tests/untried/neg/t0606.scala6
-rw-r--r--tests/untried/neg/t0673.check4
-rw-r--r--tests/untried/neg/t0673/JavaClass.java3
-rw-r--r--tests/untried/neg/t0673/Test.scala3
-rw-r--r--tests/untried/neg/t0699.check10
-rw-r--r--tests/untried/neg/t0699/A.scala4
-rw-r--r--tests/untried/neg/t0699/B.scala5
-rw-r--r--tests/untried/neg/t0764.check7
-rw-r--r--tests/untried/neg/t0764.scala45
-rw-r--r--tests/untried/neg/t0764b.check47
-rw-r--r--tests/untried/neg/t0764b.scala63
-rw-r--r--tests/untried/neg/t0816.check4
-rw-r--r--tests/untried/neg/t0816.scala12
-rw-r--r--tests/untried/neg/t0842.check4
-rw-r--r--tests/untried/neg/t0842.scala1
-rw-r--r--tests/untried/neg/t0899.check10
-rw-r--r--tests/untried/neg/t0899.scala13
-rw-r--r--tests/untried/neg/t0903.check7
-rw-r--r--tests/untried/neg/t0903.scala5
-rw-r--r--tests/untried/neg/t1009.check4
-rw-r--r--tests/untried/neg/t1009.scala3
-rw-r--r--tests/untried/neg/t1010.check6
-rw-r--r--tests/untried/neg/t1010.scala15
-rw-r--r--tests/untried/neg/t1033.check4
-rw-r--r--tests/untried/neg/t1033.scala13
-rw-r--r--tests/untried/neg/t1038.check5
-rw-r--r--tests/untried/neg/t1038.scala8
-rw-r--r--tests/untried/neg/t1041.check6
-rw-r--r--tests/untried/neg/t1041.scala6
-rw-r--r--tests/untried/neg/t1049.check4
-rw-r--r--tests/untried/neg/t1049.scala9
-rw-r--r--tests/untried/neg/t1106.check7
-rw-r--r--tests/untried/neg/t1106.scala5
-rw-r--r--tests/untried/neg/t1112.check4
-rw-r--r--tests/untried/neg/t1112.scala14
-rw-r--r--tests/untried/neg/t112706A.check6
-rw-r--r--tests/untried/neg/t112706A.scala8
-rw-r--r--tests/untried/neg/t1163.check7
-rw-r--r--tests/untried/neg/t1163.scala2
-rw-r--r--tests/untried/neg/t1168.check4
-rw-r--r--tests/untried/neg/t1168.scala7
-rw-r--r--tests/untried/neg/t1181.check10
-rw-r--r--tests/untried/neg/t1181.scala12
-rw-r--r--tests/untried/neg/t1183.check17
-rw-r--r--tests/untried/neg/t1183.scala34
-rw-r--r--tests/untried/neg/t1215.check4
-rw-r--r--tests/untried/neg/t1215.scala3
-rw-r--r--tests/untried/neg/t1224.check4
-rw-r--r--tests/untried/neg/t1224.flags1
-rw-r--r--tests/untried/neg/t1224.scala5
-rw-r--r--tests/untried/neg/t1241.check4
-rw-r--r--tests/untried/neg/t1241.scala8
-rw-r--r--tests/untried/neg/t1275.check6
-rw-r--r--tests/untried/neg/t1275.scala15
-rw-r--r--tests/untried/neg/t1286.check5
-rw-r--r--tests/untried/neg/t1286/a.scala3
-rw-r--r--tests/untried/neg/t1286/b.scala3
-rw-r--r--tests/untried/neg/t1355.check4
-rw-r--r--tests/untried/neg/t1355.scala1
-rw-r--r--tests/untried/neg/t1364.check5
-rw-r--r--tests/untried/neg/t1364.scala15
-rw-r--r--tests/untried/neg/t1371.check4
-rw-r--r--tests/untried/neg/t1371.scala2
-rw-r--r--tests/untried/neg/t1422.check7
-rw-r--r--tests/untried/neg/t1422.scala1
-rw-r--r--tests/untried/neg/t1431.check4
-rw-r--r--tests/untried/neg/t1431.scala10
-rw-r--r--tests/untried/neg/t1432.check8
-rw-r--r--tests/untried/neg/t1432.scala14
-rw-r--r--tests/untried/neg/t1477.check5
-rw-r--r--tests/untried/neg/t1477.scala25
-rw-r--r--tests/untried/neg/t1503.check8
-rw-r--r--tests/untried/neg/t1503.flags1
-rw-r--r--tests/untried/neg/t1503.scala8
-rw-r--r--tests/untried/neg/t1523.check4
-rw-r--r--tests/untried/neg/t1523.scala5
-rw-r--r--tests/untried/neg/t1548.check4
-rw-r--r--tests/untried/neg/t1548/J.java12
-rw-r--r--tests/untried/neg/t1548/S.scala3
-rw-r--r--tests/untried/neg/t1623.check4
-rw-r--r--tests/untried/neg/t1623.scala12
-rw-r--r--tests/untried/neg/t1672b.check16
-rw-r--r--tests/untried/neg/t1672b.scala52
-rw-r--r--tests/untried/neg/t1701.check4
-rw-r--r--tests/untried/neg/t1701.scala1
-rw-r--r--tests/untried/neg/t1705.check7
-rw-r--r--tests/untried/neg/t1705.scala35
-rw-r--r--tests/untried/neg/t1838.check7
-rw-r--r--tests/untried/neg/t1838.scala7
-rw-r--r--tests/untried/neg/t1845.check6
-rw-r--r--tests/untried/neg/t1845.scala10
-rw-r--r--tests/untried/neg/t1872.check8
-rw-r--r--tests/untried/neg/t1872.scala4
-rw-r--r--tests/untried/neg/t1878.check7
-rw-r--r--tests/untried/neg/t1878.scala17
-rw-r--r--tests/untried/neg/t1909-object.check4
-rw-r--r--tests/untried/neg/t1909-object.flags1
-rw-r--r--tests/untried/neg/t1909-object.scala12
-rw-r--r--tests/untried/neg/t1909b.check4
-rw-r--r--tests/untried/neg/t1909b.scala7
-rw-r--r--tests/untried/neg/t1960.check4
-rw-r--r--tests/untried/neg/t1960.scala5
-rw-r--r--tests/untried/neg/t1980.check12
-rw-r--r--tests/untried/neg/t1980.flags1
-rw-r--r--tests/untried/neg/t1980.scala9
-rw-r--r--tests/untried/neg/t200.check5
-rw-r--r--tests/untried/neg/t200.scala8
-rw-r--r--tests/untried/neg/t2031.check6
-rw-r--r--tests/untried/neg/t2031.scala9
-rw-r--r--tests/untried/neg/t2066.check21
-rw-r--r--tests/untried/neg/t2066.scala70
-rw-r--r--tests/untried/neg/t2066b.check5
-rw-r--r--tests/untried/neg/t2066b.scala16
-rw-r--r--tests/untried/neg/t2070.check6
-rw-r--r--tests/untried/neg/t2070.scala10
-rw-r--r--tests/untried/neg/t2078.check4
-rw-r--r--tests/untried/neg/t2078.scala9
-rw-r--r--tests/untried/neg/t2102.check6
-rw-r--r--tests/untried/neg/t2102.scala3
-rw-r--r--tests/untried/neg/t2139.check6
-rw-r--r--tests/untried/neg/t2139.scala15
-rw-r--r--tests/untried/neg/t2144.check4
-rw-r--r--tests/untried/neg/t2144.scala3
-rw-r--r--tests/untried/neg/t2148.check4
-rw-r--r--tests/untried/neg/t2148.scala10
-rw-r--r--tests/untried/neg/t2180.check6
-rw-r--r--tests/untried/neg/t2180.scala9
-rw-r--r--tests/untried/neg/t2206.check5
-rw-r--r--tests/untried/neg/t2206.scala15
-rw-r--r--tests/untried/neg/t2208.check4
-rw-r--r--tests/untried/neg/t2208.scala8
-rw-r--r--tests/untried/neg/t2213.check25
-rw-r--r--tests/untried/neg/t2213.scala11
-rw-r--r--tests/untried/neg/t2275a.check13
-rw-r--r--tests/untried/neg/t2275a.scala7
-rw-r--r--tests/untried/neg/t2275b.check10
-rw-r--r--tests/untried/neg/t2275b.scala3
-rw-r--r--tests/untried/neg/t2296a.check5
-rw-r--r--tests/untried/neg/t2296a/J.java7
-rw-r--r--tests/untried/neg/t2296a/S.scala18
-rw-r--r--tests/untried/neg/t2296b.check5
-rw-r--r--tests/untried/neg/t2296b/J_1.java7
-rw-r--r--tests/untried/neg/t2296b/S_2.scala18
-rw-r--r--tests/untried/neg/t2316.check7
-rw-r--r--tests/untried/neg/t2316.scala43
-rw-r--r--tests/untried/neg/t2336.check4
-rwxr-xr-xtests/untried/neg/t2336.scala7
-rw-r--r--tests/untried/neg/t2388.check4
-rw-r--r--tests/untried/neg/t2388.scala4
-rw-r--r--tests/untried/neg/t2405.check8
-rw-r--r--tests/untried/neg/t2405.scala10
-rw-r--r--tests/untried/neg/t2416.check10
-rw-r--r--tests/untried/neg/t2416.scala14
-rw-r--r--tests/untried/neg/t2421b.check4
-rw-r--r--tests/untried/neg/t2421b.scala17
-rw-r--r--tests/untried/neg/t2441.check4
-rw-r--r--tests/untried/neg/t2441.scala15
-rw-r--r--tests/untried/neg/t2442.check11
-rw-r--r--tests/untried/neg/t2442.flags1
-rw-r--r--tests/untried/neg/t2442/MyEnum.java3
-rw-r--r--tests/untried/neg/t2442/MySecondEnum.java6
-rw-r--r--tests/untried/neg/t2442/t2442.scala15
-rw-r--r--tests/untried/neg/t2462a.check4
-rw-r--r--tests/untried/neg/t2462a.scala3
-rw-r--r--tests/untried/neg/t2462b.check11
-rw-r--r--tests/untried/neg/t2462b.flags1
-rw-r--r--tests/untried/neg/t2462b.scala9
-rw-r--r--tests/untried/neg/t2462c.check7
-rw-r--r--tests/untried/neg/t2462c.flags1
-rw-r--r--tests/untried/neg/t2462c.scala25
-rw-r--r--tests/untried/neg/t2488.check31
-rw-r--r--tests/untried/neg/t2488.scala12
-rw-r--r--tests/untried/neg/t2494.check4
-rwxr-xr-xtests/untried/neg/t2494.scala1
-rw-r--r--tests/untried/neg/t2641.check7
-rw-r--r--tests/untried/neg/t2641.scala30
-rw-r--r--tests/untried/neg/t276.check5
-rw-r--r--tests/untried/neg/t276.scala7
-rw-r--r--tests/untried/neg/t2773.check7
-rwxr-xr-xtests/untried/neg/t2773.scala8
-rw-r--r--tests/untried/neg/t2775.check4
-rw-r--r--tests/untried/neg/t2775.scala1
-rw-r--r--tests/untried/neg/t2779.check5
-rwxr-xr-xtests/untried/neg/t2779.scala25
-rw-r--r--tests/untried/neg/t278.check11
-rw-r--r--tests/untried/neg/t278.scala6
-rw-r--r--tests/untried/neg/t2796.check9
-rw-r--r--tests/untried/neg/t2796.flags1
-rw-r--r--tests/untried/neg/t2796.scala27
-rw-r--r--tests/untried/neg/t2801.check6
-rw-r--r--tests/untried/neg/t2801.scala3
-rw-r--r--tests/untried/neg/t284.check6
-rw-r--r--tests/untried/neg/t284.flags1
-rw-r--r--tests/untried/neg/t284.scala5
-rw-r--r--tests/untried/neg/t2870.check9
-rwxr-xr-xtests/untried/neg/t2870.scala9
-rw-r--r--tests/untried/neg/t2910.check16
-rw-r--r--tests/untried/neg/t2910.scala39
-rw-r--r--tests/untried/neg/t2918.check10
-rwxr-xr-xtests/untried/neg/t2918.scala3
-rw-r--r--tests/untried/neg/t2968.check10
-rw-r--r--tests/untried/neg/t2968.scala26
-rw-r--r--tests/untried/neg/t2968b.check4
-rw-r--r--tests/untried/neg/t2968b.scala7
-rw-r--r--tests/untried/neg/t2973.check4
-rw-r--r--tests/untried/neg/t2973.scala1
-rw-r--r--tests/untried/neg/t3006.check6
-rwxr-xr-xtests/untried/neg/t3006.scala10
-rw-r--r--tests/untried/neg/t3015.check6
-rw-r--r--tests/untried/neg/t3015.scala8
-rw-r--r--tests/untried/neg/t3098.check7
-rw-r--r--tests/untried/neg/t3098.flags1
-rw-r--r--tests/untried/neg/t3098/a.scala6
-rw-r--r--tests/untried/neg/t3098/b.scala8
-rw-r--r--tests/untried/neg/t3118.check7
-rw-r--r--tests/untried/neg/t3118.scala8
-rw-r--r--tests/untried/neg/t3160ambiguous.check7
-rw-r--r--tests/untried/neg/t3160ambiguous.scala15
-rw-r--r--tests/untried/neg/t3189.check4
-rw-r--r--tests/untried/neg/t3189.scala3
-rw-r--r--tests/untried/neg/t3209.check4
-rw-r--r--tests/untried/neg/t3209.scala2
-rw-r--r--tests/untried/neg/t3222.check13
-rw-r--r--tests/untried/neg/t3222.scala9
-rw-r--r--tests/untried/neg/t3224.check26
-rwxr-xr-xtests/untried/neg/t3224.scala50
-rw-r--r--tests/untried/neg/t3234.check6
-rw-r--r--tests/untried/neg/t3234.flags1
-rw-r--r--tests/untried/neg/t3234.scala19
-rw-r--r--tests/untried/neg/t3240.check4
-rw-r--r--tests/untried/neg/t3240.scala8
-rw-r--r--tests/untried/neg/t3275.check4
-rw-r--r--tests/untried/neg/t3275.scala3
-rw-r--r--tests/untried/neg/t3346b.check4
-rw-r--r--tests/untried/neg/t3346b.scala15
-rw-r--r--tests/untried/neg/t3346c.check4
-rw-r--r--tests/untried/neg/t3346c.scala61
-rw-r--r--tests/untried/neg/t3346i.check7
-rw-r--r--tests/untried/neg/t3346i.scala30
-rw-r--r--tests/untried/neg/t3392.check4
-rw-r--r--tests/untried/neg/t3392.scala11
-rw-r--r--tests/untried/neg/t3399.check4
-rw-r--r--tests/untried/neg/t3399.scala24
-rw-r--r--tests/untried/neg/t3403.check4
-rw-r--r--tests/untried/neg/t3403.scala2
-rw-r--r--tests/untried/neg/t343.check4
-rw-r--r--tests/untried/neg/t343.scala14
-rw-r--r--tests/untried/neg/t3453.check21
-rw-r--r--tests/untried/neg/t3453.scala66
-rw-r--r--tests/untried/neg/t3481.check29
-rw-r--r--tests/untried/neg/t3481.scala28
-rw-r--r--tests/untried/neg/t3507-old.check4
-rw-r--r--tests/untried/neg/t3507-old.scala15
-rw-r--r--tests/untried/neg/t3604.check7
-rw-r--r--tests/untried/neg/t3604.scala6
-rw-r--r--tests/untried/neg/t3614.check4
-rw-r--r--tests/untried/neg/t3614.scala3
-rw-r--r--tests/untried/neg/t3649.check10
-rw-r--r--tests/untried/neg/t3649.scala2
-rw-r--r--tests/untried/neg/t3653.check7
-rw-r--r--tests/untried/neg/t3653.scala4
-rw-r--r--tests/untried/neg/t3663.check4
-rw-r--r--tests/untried/neg/t3663/PackageProtected.java5
-rw-r--r--tests/untried/neg/t3663/main.scala14
-rw-r--r--tests/untried/neg/t3683a.check7
-rw-r--r--tests/untried/neg/t3683a.flags1
-rw-r--r--tests/untried/neg/t3683a.scala20
-rw-r--r--tests/untried/neg/t3683b.check8
-rw-r--r--tests/untried/neg/t3683b.scala21
-rw-r--r--tests/untried/neg/t3691.check16
-rw-r--r--tests/untried/neg/t3691.scala11
-rw-r--r--tests/untried/neg/t3692-new.check19
-rw-r--r--tests/untried/neg/t3692-new.flags1
-rw-r--r--tests/untried/neg/t3692-new.scala20
-rw-r--r--tests/untried/neg/t3714-neg.check13
-rw-r--r--tests/untried/neg/t3714-neg.scala41
-rw-r--r--tests/untried/neg/t3736.check16
-rw-r--r--tests/untried/neg/t3736.scala34
-rw-r--r--tests/untried/neg/t3757.check4
-rw-r--r--tests/untried/neg/t3757/A.java5
-rw-r--r--tests/untried/neg/t3757/B.scala5
-rw-r--r--tests/untried/neg/t3761-overload-byname.check13
-rw-r--r--tests/untried/neg/t3761-overload-byname.scala13
-rw-r--r--tests/untried/neg/t3769.check7
-rw-r--r--tests/untried/neg/t3769.scala3
-rw-r--r--tests/untried/neg/t3776.check4
-rw-r--r--tests/untried/neg/t3776.scala10
-rw-r--r--tests/untried/neg/t3816.check7
-rw-r--r--tests/untried/neg/t3816.scala42
-rw-r--r--tests/untried/neg/t3836.check13
-rw-r--r--tests/untried/neg/t3836.scala28
-rw-r--r--tests/untried/neg/t3854.check5
-rw-r--r--tests/untried/neg/t3854.scala15
-rw-r--r--tests/untried/neg/t3871.check7
-rw-r--r--tests/untried/neg/t3871.scala11
-rw-r--r--tests/untried/neg/t3871b.check97
-rw-r--r--tests/untried/neg/t3871b.scala127
-rw-r--r--tests/untried/neg/t3873.check6
-rw-r--r--tests/untried/neg/t3873.scala12
-rw-r--r--tests/untried/neg/t3909.check4
-rw-r--r--tests/untried/neg/t3909.scala12
-rw-r--r--tests/untried/neg/t391.check13
-rw-r--r--tests/untried/neg/t391.scala6
-rw-r--r--tests/untried/neg/t3913.check4
-rw-r--r--tests/untried/neg/t3913.scala8
-rw-r--r--tests/untried/neg/t3934.check13
-rw-r--r--tests/untried/neg/t3934.scala23
-rw-r--r--tests/untried/neg/t3971.check21
-rw-r--r--tests/untried/neg/t3971.scala12
-rw-r--r--tests/untried/neg/t3977.check4
-rw-r--r--tests/untried/neg/t3977.scala13
-rw-r--r--tests/untried/neg/t3987.check7
-rw-r--r--tests/untried/neg/t3987.scala13
-rw-r--r--tests/untried/neg/t3995.check6
-rw-r--r--tests/untried/neg/t3995.scala32
-rw-r--r--tests/untried/neg/t4044.check14
-rw-r--r--tests/untried/neg/t4044.scala16
-rw-r--r--tests/untried/neg/t4064.check4
-rw-r--r--tests/untried/neg/t4064.scala5
-rw-r--r--tests/untried/neg/t4069.check16
-rw-r--r--tests/untried/neg/t4069.scala10
-rw-r--r--tests/untried/neg/t4079.check4
-rw-r--r--tests/untried/neg/t4079/t4079_1.scala33
-rw-r--r--tests/untried/neg/t4079/t4079_2.scala3
-rw-r--r--tests/untried/neg/t409.check4
-rw-r--r--tests/untried/neg/t409.scala18
-rw-r--r--tests/untried/neg/t4091.check4
-rw-r--r--tests/untried/neg/t4091.scala2
-rw-r--r--tests/untried/neg/t4098.check13
-rw-r--r--tests/untried/neg/t4098.scala22
-rw-r--r--tests/untried/neg/t412.check5
-rw-r--r--tests/untried/neg/t412.scala31
-rw-r--r--tests/untried/neg/t4134.check4
-rw-r--r--tests/untried/neg/t4134.scala30
-rw-r--r--tests/untried/neg/t4137.check9
-rw-r--r--tests/untried/neg/t4137.scala11
-rw-r--r--tests/untried/neg/t414.check12
-rw-r--r--tests/untried/neg/t414.scala10
-rw-r--r--tests/untried/neg/t4158.check7
-rw-r--r--tests/untried/neg/t4158.scala4
-rw-r--r--tests/untried/neg/t4163.check7
-rw-r--r--tests/untried/neg/t4163.scala8
-rw-r--r--tests/untried/neg/t4166.check4
-rw-r--r--tests/untried/neg/t4166.scala11
-rw-r--r--tests/untried/neg/t4174.check4
-rw-r--r--tests/untried/neg/t4174.scala9
-rw-r--r--tests/untried/neg/t418.check4
-rw-r--r--tests/untried/neg/t418.scala3
-rw-r--r--tests/untried/neg/t4196.check4
-rw-r--r--tests/untried/neg/t4196.scala6
-rw-r--r--tests/untried/neg/t421.check4
-rw-r--r--tests/untried/neg/t421.scala8
-rw-r--r--tests/untried/neg/t4217.check4
-rw-r--r--tests/untried/neg/t4217.scala3
-rw-r--r--tests/untried/neg/t4221.check6
-rw-r--r--tests/untried/neg/t4221.scala10
-rw-r--r--tests/untried/neg/t425.check4
-rw-r--r--tests/untried/neg/t425.scala11
-rw-r--r--tests/untried/neg/t4270.check4
-rw-r--r--tests/untried/neg/t4270.scala6
-rw-r--r--tests/untried/neg/t4271.check10
-rw-r--r--tests/untried/neg/t4271.scala12
-rw-r--r--tests/untried/neg/t4283b.check4
-rw-r--r--tests/untried/neg/t4283b/AbstractFoo.java5
-rw-r--r--tests/untried/neg/t4283b/ScalaBipp.scala5
-rw-r--r--tests/untried/neg/t4283b/Test.scala3
-rw-r--r--tests/untried/neg/t4302.check6
-rw-r--r--tests/untried/neg/t4302.flags1
-rw-r--r--tests/untried/neg/t4302.scala3
-rw-r--r--tests/untried/neg/t4417.check7
-rw-r--r--tests/untried/neg/t4417.scala17
-rw-r--r--tests/untried/neg/t4419.check4
-rw-r--r--tests/untried/neg/t4419.scala3
-rw-r--r--tests/untried/neg/t4425.check13
-rw-r--r--tests/untried/neg/t4425.flags1
-rw-r--r--tests/untried/neg/t4425.scala14
-rw-r--r--tests/untried/neg/t4425b.check49
-rw-r--r--tests/untried/neg/t4425b.scala38
-rw-r--r--tests/untried/neg/t4431.check7
-rw-r--r--tests/untried/neg/t4431.scala16
-rw-r--r--tests/untried/neg/t4440.check15
-rw-r--r--tests/untried/neg/t4440.flags1
-rw-r--r--tests/untried/neg/t4440.scala19
-rw-r--r--tests/untried/neg/t4457_1.check7
-rw-r--r--tests/untried/neg/t4457_1.scala33
-rw-r--r--tests/untried/neg/t4457_2.check13
-rw-r--r--tests/untried/neg/t4457_2.scala33
-rw-r--r--tests/untried/neg/t4460a.check4
-rw-r--r--tests/untried/neg/t4460a.scala7
-rw-r--r--tests/untried/neg/t4460b.check4
-rw-r--r--tests/untried/neg/t4460b.scala9
-rw-r--r--tests/untried/neg/t4460c.check7
-rw-r--r--tests/untried/neg/t4460c.scala7
-rw-r--r--tests/untried/neg/t4515.check16
-rw-r--r--tests/untried/neg/t4515.scala41
-rw-r--r--tests/untried/neg/t452.check6
-rw-r--r--tests/untried/neg/t452.scala8
-rw-r--r--tests/untried/neg/t4541.check7
-rw-r--r--tests/untried/neg/t4541.scala16
-rw-r--r--tests/untried/neg/t4541b.check7
-rw-r--r--tests/untried/neg/t4541b.scala16
-rw-r--r--tests/untried/neg/t4568.check4
-rw-r--r--tests/untried/neg/t4568.scala13
-rw-r--r--tests/untried/neg/t4584.check7
-rw-r--r--tests/untried/neg/t4584.scala1
-rw-r--r--tests/untried/neg/t464-neg.check16
-rw-r--r--tests/untried/neg/t464-neg.scala12
-rw-r--r--tests/untried/neg/t4691_exhaust_extractor.check15
-rw-r--r--tests/untried/neg/t4691_exhaust_extractor.flags1
-rw-r--r--tests/untried/neg/t4691_exhaust_extractor.scala33
-rw-r--r--tests/untried/neg/t4727.check5
-rw-r--r--tests/untried/neg/t4727.scala7
-rw-r--r--tests/untried/neg/t4728.check7
-rw-r--r--tests/untried/neg/t4728.scala11
-rw-r--r--tests/untried/neg/t473.check4
-rw-r--r--tests/untried/neg/t473.scala3
-rw-r--r--tests/untried/neg/t4749.check34
-rw-r--r--tests/untried/neg/t4749.flags1
-rw-r--r--tests/untried/neg/t4749.scala44
-rw-r--r--tests/untried/neg/t4762.check9
-rw-r--r--tests/untried/neg/t4762.flags1
-rw-r--r--tests/untried/neg/t4762.scala51
-rw-r--r--tests/untried/neg/t4818.check6
-rw-r--r--tests/untried/neg/t4818.scala7
-rw-r--r--tests/untried/neg/t4831.check7
-rw-r--r--tests/untried/neg/t4831.scala11
-rw-r--r--tests/untried/neg/t4842.check7
-rw-r--r--tests/untried/neg/t4842.scala7
-rw-r--r--tests/untried/neg/t4851.check51
-rw-r--r--tests/untried/neg/t4851.flags1
-rw-r--r--tests/untried/neg/t4851/J.java15
-rw-r--r--tests/untried/neg/t4851/J2.java11
-rw-r--r--tests/untried/neg/t4851/S.scala28
-rw-r--r--tests/untried/neg/t4877.check22
-rw-r--r--tests/untried/neg/t4877.flags1
-rw-r--r--tests/untried/neg/t4877.scala22
-rw-r--r--tests/untried/neg/t4879.check13
-rw-r--r--tests/untried/neg/t4879.scala15
-rw-r--r--tests/untried/neg/t4882.check4
-rw-r--r--tests/untried/neg/t4882.scala3
-rw-r--r--tests/untried/neg/t4928.check5
-rw-r--r--tests/untried/neg/t4928.scala4
-rw-r--r--tests/untried/neg/t4987.check4
-rw-r--r--tests/untried/neg/t4987.scala2
-rw-r--r--tests/untried/neg/t4989.check7
-rw-r--r--tests/untried/neg/t4989.scala68
-rw-r--r--tests/untried/neg/t500.check4
-rw-r--r--tests/untried/neg/t500.scala22
-rw-r--r--tests/untried/neg/t501.check4
-rw-r--r--tests/untried/neg/t501.scala18
-rw-r--r--tests/untried/neg/t5031.check5
-rw-r--r--tests/untried/neg/t5031/Id.scala4
-rw-r--r--tests/untried/neg/t5031/package.scala3
-rw-r--r--tests/untried/neg/t5031b.check5
-rw-r--r--tests/untried/neg/t5031b/a.scala3
-rw-r--r--tests/untried/neg/t5031b/b.scala3
-rw-r--r--tests/untried/neg/t5044.check9
-rw-r--r--tests/untried/neg/t5044.scala9
-rw-r--r--tests/untried/neg/t5060.check7
-rw-r--r--tests/untried/neg/t5060.scala19
-rw-r--r--tests/untried/neg/t5063.check4
-rw-r--r--tests/untried/neg/t5063.scala3
-rw-r--r--tests/untried/neg/t5067.check6
-rw-r--r--tests/untried/neg/t5067.scala4
-rw-r--r--tests/untried/neg/t5078.check13
-rw-r--r--tests/untried/neg/t5078.scala11
-rw-r--r--tests/untried/neg/t5093.check10
-rw-r--r--tests/untried/neg/t5093.scala3
-rw-r--r--tests/untried/neg/t510.check4
-rw-r--r--tests/untried/neg/t510.scala26
-rw-r--r--tests/untried/neg/t5106.check11
-rw-r--r--tests/untried/neg/t5106.scala5
-rw-r--r--tests/untried/neg/t512.check7
-rw-r--r--tests/untried/neg/t512.scala5
-rw-r--r--tests/untried/neg/t5120.check12
-rw-r--r--tests/untried/neg/t5120.scala29
-rw-r--r--tests/untried/neg/t5148.check5
-rw-r--r--tests/untried/neg/t5148.scala4
-rw-r--r--tests/untried/neg/t515.check6
-rw-r--r--tests/untried/neg/t515.scala8
-rw-r--r--tests/untried/neg/t5152.check11
-rw-r--r--tests/untried/neg/t5152.scala17
-rw-r--r--tests/untried/neg/t5182.check7
-rw-r--r--tests/untried/neg/t5182.flags1
-rw-r--r--tests/untried/neg/t5182.scala5
-rw-r--r--tests/untried/neg/t5189.check6
-rw-r--r--tests/untried/neg/t5189.scala5
-rw-r--r--tests/untried/neg/t5189_inferred.check6
-rw-r--r--tests/untried/neg/t5189_inferred.scala8
-rw-r--r--tests/untried/neg/t5189b.check11
-rw-r--r--tests/untried/neg/t5189b.scala80
-rw-r--r--tests/untried/neg/t520.check4
-rw-r--r--tests/untried/neg/t520.scala9
-rw-r--r--tests/untried/neg/t521.check15
-rw-r--r--tests/untried/neg/t521.scala17
-rw-r--r--tests/untried/neg/t5318.check5
-rw-r--r--tests/untried/neg/t5318.scala8
-rw-r--r--tests/untried/neg/t5318b.check5
-rw-r--r--tests/untried/neg/t5318b.scala8
-rw-r--r--tests/untried/neg/t5318c.check5
-rw-r--r--tests/untried/neg/t5318c.scala14
-rw-r--r--tests/untried/neg/t5340.check6
-rw-r--r--tests/untried/neg/t5340.scala29
-rw-r--r--tests/untried/neg/t5352.check13
-rw-r--r--tests/untried/neg/t5352.flags1
-rw-r--r--tests/untried/neg/t5352.scala15
-rw-r--r--tests/untried/neg/t5354.check7
-rw-r--r--tests/untried/neg/t5354.scala15
-rw-r--r--tests/untried/neg/t5357.check4
-rw-r--r--tests/untried/neg/t5357.scala9
-rw-r--r--tests/untried/neg/t5358.check7
-rw-r--r--tests/untried/neg/t5358.scala4
-rw-r--r--tests/untried/neg/t5361.check4
-rw-r--r--tests/untried/neg/t5361.scala3
-rw-r--r--tests/untried/neg/t5376.check11
-rw-r--r--tests/untried/neg/t5376.scala24
-rw-r--r--tests/untried/neg/t5378.check31
-rw-r--r--tests/untried/neg/t5378.scala54
-rw-r--r--tests/untried/neg/t5390.check4
-rw-r--r--tests/untried/neg/t5390.scala10
-rw-r--r--tests/untried/neg/t5390b.check4
-rw-r--r--tests/untried/neg/t5390b.scala10
-rw-r--r--tests/untried/neg/t5390c.check4
-rw-r--r--tests/untried/neg/t5390c.scala10
-rw-r--r--tests/untried/neg/t5390d.check4
-rw-r--r--tests/untried/neg/t5390d.scala10
-rw-r--r--tests/untried/neg/t5426.check15
-rw-r--r--tests/untried/neg/t5426.flags1
-rw-r--r--tests/untried/neg/t5426.scala10
-rw-r--r--tests/untried/neg/t5429.check142
-rw-r--r--tests/untried/neg/t5429.scala93
-rw-r--r--tests/untried/neg/t5440.check7
-rw-r--r--tests/untried/neg/t5440.flags1
-rw-r--r--tests/untried/neg/t5440.scala7
-rw-r--r--tests/untried/neg/t545.check4
-rw-r--r--tests/untried/neg/t545.scala9
-rw-r--r--tests/untried/neg/t5452-new.check8
-rw-r--r--tests/untried/neg/t5452-new.scala31
-rw-r--r--tests/untried/neg/t5452-old.check8
-rw-r--r--tests/untried/neg/t5452-old.scala29
-rw-r--r--tests/untried/neg/t5455.check4
-rw-r--r--tests/untried/neg/t5455.scala16
-rw-r--r--tests/untried/neg/t5493.check4
-rw-r--r--tests/untried/neg/t5493.scala3
-rw-r--r--tests/untried/neg/t5497.check4
-rw-r--r--tests/untried/neg/t5497.scala5
-rw-r--r--tests/untried/neg/t550.check7
-rw-r--r--tests/untried/neg/t550.scala9
-rw-r--r--tests/untried/neg/t5510.check19
-rw-r--r--tests/untried/neg/t5510.scala7
-rw-r--r--tests/untried/neg/t5529.check7
-rw-r--r--tests/untried/neg/t5529.scala13
-rw-r--r--tests/untried/neg/t5543.check10
-rw-r--r--tests/untried/neg/t5543.scala19
-rw-r--r--tests/untried/neg/t5544.check4
-rw-r--r--tests/untried/neg/t5544/Api_1.scala8
-rw-r--r--tests/untried/neg/t5544/Test_2.scala3
-rw-r--r--tests/untried/neg/t5553_1.check54
-rw-r--r--tests/untried/neg/t5553_1.scala34
-rw-r--r--tests/untried/neg/t5553_2.check50
-rw-r--r--tests/untried/neg/t5553_2.scala59
-rw-r--r--tests/untried/neg/t5554.check67
-rw-r--r--tests/untried/neg/t5554.scala39
-rw-r--r--tests/untried/neg/t556.check7
-rw-r--r--tests/untried/neg/t556.scala4
-rw-r--r--tests/untried/neg/t5564.check4
-rw-r--r--tests/untried/neg/t5564.scala9
-rw-r--r--tests/untried/neg/t5572.check16
-rw-r--r--tests/untried/neg/t5572.scala23
-rw-r--r--tests/untried/neg/t5578.check7
-rw-r--r--tests/untried/neg/t5578.scala39
-rw-r--r--tests/untried/neg/t558.check4
-rw-r--r--tests/untried/neg/t558.scala19
-rw-r--r--tests/untried/neg/t5580a.check6
-rw-r--r--tests/untried/neg/t5580a.scala11
-rw-r--r--tests/untried/neg/t5580b.check6
-rw-r--r--tests/untried/neg/t5580b.scala13
-rw-r--r--tests/untried/neg/t5617.check8
-rw-r--r--tests/untried/neg/t5617.scala14
-rw-r--r--tests/untried/neg/t562.check4
-rw-r--r--tests/untried/neg/t562.scala11
-rw-r--r--tests/untried/neg/t563.check4
-rw-r--r--tests/untried/neg/t563.scala7
-rw-r--r--tests/untried/neg/t565.check5
-rw-r--r--tests/untried/neg/t565.scala3
-rw-r--r--tests/untried/neg/t5663-badwarneq.check42
-rw-r--r--tests/untried/neg/t5663-badwarneq.flags1
-rw-r--r--tests/untried/neg/t5663-badwarneq.scala94
-rw-r--r--tests/untried/neg/t5666.check37
-rw-r--r--tests/untried/neg/t5666.scala14
-rw-r--r--tests/untried/neg/t5675.check2
-rw-r--r--tests/untried/neg/t5675.flags1
-rw-r--r--tests/untried/neg/t5675.scala7
-rw-r--r--tests/untried/neg/t5683.check16
-rw-r--r--tests/untried/neg/t5683.scala23
-rw-r--r--tests/untried/neg/t5687.check8
-rw-r--r--tests/untried/neg/t5687.scala55
-rw-r--r--tests/untried/neg/t5689.check8
-rw-r--r--tests/untried/neg/t5689.flags1
-rw-r--r--tests/untried/neg/t5689.scala6
-rw-r--r--tests/untried/neg/t5696.check19
-rw-r--r--tests/untried/neg/t5696.scala47
-rw-r--r--tests/untried/neg/t5702-neg-bad-and-wild.check28
-rw-r--r--tests/untried/neg/t5702-neg-bad-and-wild.scala29
-rw-r--r--tests/untried/neg/t5702-neg-bad-brace.check10
-rw-r--r--tests/untried/neg/t5702-neg-bad-brace.scala17
-rw-r--r--tests/untried/neg/t5702-neg-bad-xbrace.check7
-rw-r--r--tests/untried/neg/t5702-neg-bad-xbrace.scala31
-rw-r--r--tests/untried/neg/t5702-neg-ugly-xbrace.check19
-rw-r--r--tests/untried/neg/t5702-neg-ugly-xbrace.scala14
-rw-r--r--tests/untried/neg/t5728.check4
-rw-r--r--tests/untried/neg/t5728.scala7
-rw-r--r--tests/untried/neg/t5735.check6
-rw-r--r--tests/untried/neg/t5735.scala7
-rw-r--r--tests/untried/neg/t5753.check5
-rw-r--r--tests/untried/neg/t5753.flags1
-rw-r--r--tests/untried/neg/t5753/Impls_Macros_1.scala6
-rw-r--r--tests/untried/neg/t5753/Test_2.scala11
-rw-r--r--tests/untried/neg/t576.check4
-rw-r--r--tests/untried/neg/t576.scala20
-rw-r--r--tests/untried/neg/t5761.check19
-rw-r--r--tests/untried/neg/t5761.scala16
-rw-r--r--tests/untried/neg/t5762.check15
-rw-r--r--tests/untried/neg/t5762.flags1
-rw-r--r--tests/untried/neg/t5762.scala24
-rw-r--r--tests/untried/neg/t5799.check4
-rw-r--r--tests/untried/neg/t5799.scala8
-rw-r--r--tests/untried/neg/t5801.check22
-rw-r--r--tests/untried/neg/t5801.scala16
-rw-r--r--tests/untried/neg/t5803.check4
-rw-r--r--tests/untried/neg/t5803.scala4
-rw-r--r--tests/untried/neg/t5821.check4
-rw-r--r--tests/untried/neg/t5821.scala8
-rw-r--r--tests/untried/neg/t5830.check9
-rw-r--r--tests/untried/neg/t5830.flags1
-rw-r--r--tests/untried/neg/t5830.scala9
-rw-r--r--tests/untried/neg/t5839.check6
-rw-r--r--tests/untried/neg/t5839.scala7
-rw-r--r--tests/untried/neg/t585.check4
-rw-r--r--tests/untried/neg/t585.scala4
-rw-r--r--tests/untried/neg/t5856.check31
-rw-r--r--tests/untried/neg/t5856.scala11
-rw-r--r--tests/untried/neg/t5878.check13
-rw-r--r--tests/untried/neg/t5878.scala6
-rw-r--r--tests/untried/neg/t588.check13
-rw-r--r--tests/untried/neg/t588.scala15
-rw-r--r--tests/untried/neg/t5882.check9
-rw-r--r--tests/untried/neg/t5882.scala6
-rw-r--r--tests/untried/neg/t5892.check17
-rw-r--r--tests/untried/neg/t5892.scala25
-rw-r--r--tests/untried/neg/t5903a.check4
-rw-r--r--tests/untried/neg/t5903a/Macros_1.scala28
-rw-r--r--tests/untried/neg/t5903a/Test_2.scala6
-rw-r--r--tests/untried/neg/t5903b.check6
-rw-r--r--tests/untried/neg/t5903b/Macros_1.scala23
-rw-r--r--tests/untried/neg/t5903b/Test_2.scala6
-rw-r--r--tests/untried/neg/t5903c.check4
-rw-r--r--tests/untried/neg/t5903c/Macros_1.scala26
-rw-r--r--tests/untried/neg/t5903c/Test_2.scala6
-rw-r--r--tests/untried/neg/t5903d.check4
-rw-r--r--tests/untried/neg/t5903d/Macros_1.scala23
-rw-r--r--tests/untried/neg/t5903d/Test_2.scala6
-rw-r--r--tests/untried/neg/t5903e.check4
-rw-r--r--tests/untried/neg/t5903e/Macros_1.scala25
-rw-r--r--tests/untried/neg/t5903e/Test_2.scala6
-rw-r--r--tests/untried/neg/t591.check5
-rw-r--r--tests/untried/neg/t591.scala41
-rw-r--r--tests/untried/neg/t593.check4
-rw-r--r--tests/untried/neg/t593.scala2
-rw-r--r--tests/untried/neg/t5956.check7
-rw-r--r--tests/untried/neg/t5956.flags1
-rw-r--r--tests/untried/neg/t5956.scala2
-rw-r--r--tests/untried/neg/t5969.check7
-rw-r--r--tests/untried/neg/t5969.scala11
-rw-r--r--tests/untried/neg/t6011.check12
-rw-r--r--tests/untried/neg/t6011.flags1
-rw-r--r--tests/untried/neg/t6011.scala23
-rw-r--r--tests/untried/neg/t6013.check7
-rw-r--r--tests/untried/neg/t6013/Abstract.java7
-rw-r--r--tests/untried/neg/t6013/Base.java10
-rw-r--r--tests/untried/neg/t6013/DerivedScala.scala7
-rw-r--r--tests/untried/neg/t6040.check9
-rw-r--r--tests/untried/neg/t6040.scala1
-rw-r--r--tests/untried/neg/t6042.check4
-rw-r--r--tests/untried/neg/t6042.scala8
-rw-r--r--tests/untried/neg/t6048.check18
-rw-r--r--tests/untried/neg/t6048.flags1
-rw-r--r--tests/untried/neg/t6048.scala22
-rw-r--r--tests/untried/neg/t6074.check4
-rw-r--r--tests/untried/neg/t6074.scala6
-rw-r--r--tests/untried/neg/t608.check6
-rw-r--r--tests/untried/neg/t608.scala17
-rw-r--r--tests/untried/neg/t6082.check13
-rw-r--r--tests/untried/neg/t6082.scala2
-rw-r--r--tests/untried/neg/t6083.check10
-rw-r--r--tests/untried/neg/t6083.scala7
-rw-r--r--tests/untried/neg/t6120.check20
-rw-r--r--tests/untried/neg/t6120.flags1
-rw-r--r--tests/untried/neg/t6120.scala7
-rw-r--r--tests/untried/neg/t6123-explaintypes-macros.check10
-rw-r--r--tests/untried/neg/t6123-explaintypes-macros/BadMac_2.flags1
-rw-r--r--tests/untried/neg/t6123-explaintypes-macros/BadMac_2.scala8
-rw-r--r--tests/untried/neg/t6123-explaintypes-macros/Macros.flags1
-rw-r--r--tests/untried/neg/t6123-explaintypes-macros/Macros.scala10
-rw-r--r--tests/untried/neg/t6138.check7
-rw-r--r--tests/untried/neg/t6138.scala5
-rw-r--r--tests/untried/neg/t6162-inheritance.check18
-rw-r--r--tests/untried/neg/t6162-inheritance.flags1
-rw-r--r--tests/untried/neg/t6162-inheritance/defn.scala10
-rw-r--r--tests/untried/neg/t6162-inheritance/usage.scala10
-rw-r--r--tests/untried/neg/t6162-overriding.check9
-rw-r--r--tests/untried/neg/t6162-overriding.flags1
-rw-r--r--tests/untried/neg/t6162-overriding.scala17
-rw-r--r--tests/untried/neg/t6214.check4
-rw-r--r--tests/untried/neg/t6214.scala7
-rw-r--r--tests/untried/neg/t6227.check4
-rw-r--r--tests/untried/neg/t6227.scala6
-rw-r--r--tests/untried/neg/t6258.check16
-rw-r--r--tests/untried/neg/t6258.scala25
-rw-r--r--tests/untried/neg/t6260-named.check13
-rw-r--r--tests/untried/neg/t6260-named.scala15
-rw-r--r--tests/untried/neg/t6260c.check7
-rw-r--r--tests/untried/neg/t6260c.scala4
-rw-r--r--tests/untried/neg/t6263.check9
-rw-r--r--tests/untried/neg/t6263.scala6
-rw-r--r--tests/untried/neg/t6264.check6
-rw-r--r--tests/untried/neg/t6264.flags1
-rw-r--r--tests/untried/neg/t6264.scala6
-rw-r--r--tests/untried/neg/t6276.check21
-rw-r--r--tests/untried/neg/t6276.flags1
-rw-r--r--tests/untried/neg/t6276.scala44
-rw-r--r--tests/untried/neg/t6283.check4
-rw-r--r--tests/untried/neg/t6283.scala1
-rw-r--r--tests/untried/neg/t6289.check10
-rw-r--r--tests/untried/neg/t6289.flags1
-rw-r--r--tests/untried/neg/t6289/J.java5
-rw-r--r--tests/untried/neg/t6289/SUT_5.scala5
-rw-r--r--tests/untried/neg/t630.check5
-rw-r--r--tests/untried/neg/t630.scala23
-rw-r--r--tests/untried/neg/t631.check4
-rw-r--r--tests/untried/neg/t631.scala3
-rw-r--r--tests/untried/neg/t6323a.check15
-rw-r--r--tests/untried/neg/t6323a.flags1
-rw-r--r--tests/untried/neg/t6323a.scala21
-rw-r--r--tests/untried/neg/t633.check4
-rw-r--r--tests/untried/neg/t633.scala8
-rw-r--r--tests/untried/neg/t6335.check9
-rw-r--r--tests/untried/neg/t6335.scala7
-rw-r--r--tests/untried/neg/t6336.check7
-rw-r--r--tests/untried/neg/t6336.scala12
-rw-r--r--tests/untried/neg/t6337.check7
-rw-r--r--tests/untried/neg/t6337.scala21
-rw-r--r--tests/untried/neg/t6340.check10
-rw-r--r--tests/untried/neg/t6340.scala21
-rw-r--r--tests/untried/neg/t6355a.check7
-rw-r--r--tests/untried/neg/t6355a.scala19
-rw-r--r--tests/untried/neg/t6355b.check11
-rw-r--r--tests/untried/neg/t6355b.scala17
-rw-r--r--tests/untried/neg/t6357.check4
-rw-r--r--tests/untried/neg/t6357.scala6
-rw-r--r--tests/untried/neg/t6359.check9
-rw-r--r--tests/untried/neg/t6359.scala8
-rw-r--r--tests/untried/neg/t6375.check27
-rw-r--r--tests/untried/neg/t6375.flags1
-rw-r--r--tests/untried/neg/t6375.scala67
-rw-r--r--tests/untried/neg/t639.check7
-rw-r--r--tests/untried/neg/t639.scala6
-rw-r--r--tests/untried/neg/t6406-regextract.check6
-rw-r--r--tests/untried/neg/t6406-regextract.flags1
-rw-r--r--tests/untried/neg/t6406-regextract.scala5
-rw-r--r--tests/untried/neg/t6436.check10
-rw-r--r--tests/untried/neg/t6436.scala9
-rw-r--r--tests/untried/neg/t6436b.check10
-rw-r--r--tests/untried/neg/t6436b.scala9
-rw-r--r--tests/untried/neg/t6443c.check7
-rw-r--r--tests/untried/neg/t6443c.scala21
-rwxr-xr-xtests/untried/neg/t6446-additional.check39
-rw-r--r--tests/untried/neg/t6446-additional/ploogin_1.scala31
-rw-r--r--tests/untried/neg/t6446-additional/sample_2.flags1
-rw-r--r--tests/untried/neg/t6446-additional/sample_2.scala6
-rw-r--r--tests/untried/neg/t6446-additional/scalac-plugin.xml4
-rwxr-xr-xtests/untried/neg/t6446-list.check1
-rw-r--r--tests/untried/neg/t6446-list/ploogin_1.scala31
-rw-r--r--tests/untried/neg/t6446-list/sample_2.flags1
-rw-r--r--tests/untried/neg/t6446-list/sample_2.scala6
-rw-r--r--tests/untried/neg/t6446-list/scalac-plugin.xml4
-rwxr-xr-xtests/untried/neg/t6446-missing.check38
-rw-r--r--tests/untried/neg/t6446-missing/sample_2.flags1
-rw-r--r--tests/untried/neg/t6446-missing/sample_2.scala6
-rw-r--r--tests/untried/neg/t6446-missing/scalac-plugin.xml4
-rw-r--r--tests/untried/neg/t6446-show-phases.check37
-rw-r--r--tests/untried/neg/t6446-show-phases.flags1
-rw-r--r--tests/untried/neg/t6446-show-phases.scala3
-rw-r--r--tests/untried/neg/t6455.check4
-rw-r--r--tests/untried/neg/t6455.flags1
-rw-r--r--tests/untried/neg/t6455.scala6
-rw-r--r--tests/untried/neg/t6483.check9
-rw-r--r--tests/untried/neg/t6483.scala24
-rw-r--r--tests/untried/neg/t649.check4
-rw-r--r--tests/untried/neg/t649.scala4
-rw-r--r--tests/untried/neg/t650.check4
-rw-r--r--tests/untried/neg/t650.scala4
-rw-r--r--tests/untried/neg/t6526.check16
-rw-r--r--tests/untried/neg/t6526.scala41
-rw-r--r--tests/untried/neg/t6534.check10
-rw-r--r--tests/untried/neg/t6534.flags1
-rw-r--r--tests/untried/neg/t6534.scala10
-rw-r--r--tests/untried/neg/t6535.check6
-rw-r--r--tests/untried/neg/t6535.scala15
-rw-r--r--tests/untried/neg/t6539.check16
-rw-r--r--tests/untried/neg/t6539/Macro_1.scala10
-rw-r--r--tests/untried/neg/t6539/Test_2.scala12
-rw-r--r--tests/untried/neg/t6558.check10
-rw-r--r--tests/untried/neg/t6558.scala12
-rw-r--r--tests/untried/neg/t6558b.check7
-rw-r--r--tests/untried/neg/t6558b.scala15
-rw-r--r--tests/untried/neg/t6563.check4
-rw-r--r--tests/untried/neg/t6563.scala8
-rw-r--r--tests/untried/neg/t6566a.check4
-rw-r--r--tests/untried/neg/t6566a.scala17
-rw-r--r--tests/untried/neg/t6566b.check4
-rw-r--r--tests/untried/neg/t6566b.scala19
-rw-r--r--tests/untried/neg/t6567.check9
-rw-r--r--tests/untried/neg/t6567.flags1
-rw-r--r--tests/untried/neg/t6567.scala11
-rw-r--r--tests/untried/neg/t6574.check7
-rw-r--r--tests/untried/neg/t6574.scala10
-rw-r--r--tests/untried/neg/t6597.check4
-rw-r--r--tests/untried/neg/t6597.scala5
-rw-r--r--tests/untried/neg/t6601.check4
-rw-r--r--tests/untried/neg/t6601/AccessPrivateConstructor_2.scala3
-rw-r--r--tests/untried/neg/t6601/PrivateConstructor_1.scala1
-rw-r--r--tests/untried/neg/t663.check7
-rw-r--r--tests/untried/neg/t663.scala18
-rw-r--r--tests/untried/neg/t664.check7
-rw-r--r--tests/untried/neg/t664.scala7
-rw-r--r--tests/untried/neg/t6663.check6
-rw-r--r--tests/untried/neg/t6663.scala19
-rw-r--r--tests/untried/neg/t6666.check37
-rw-r--r--tests/untried/neg/t6666.flags1
-rw-r--r--tests/untried/neg/t6666.scala121
-rw-r--r--tests/untried/neg/t6666b.check7
-rw-r--r--tests/untried/neg/t6666b.scala27
-rw-r--r--tests/untried/neg/t6666c.check10
-rw-r--r--tests/untried/neg/t6666c.flags1
-rw-r--r--tests/untried/neg/t6666c.scala8
-rw-r--r--tests/untried/neg/t6666d.check4
-rw-r--r--tests/untried/neg/t6666d.scala18
-rw-r--r--tests/untried/neg/t6666e.check4
-rw-r--r--tests/untried/neg/t6666e.scala9
-rw-r--r--tests/untried/neg/t6667.check13
-rw-r--r--tests/untried/neg/t6667.scala10
-rw-r--r--tests/untried/neg/t6667b.check13
-rw-r--r--tests/untried/neg/t6667b.scala25
-rw-r--r--tests/untried/neg/t667.check4
-rw-r--r--tests/untried/neg/t667.scala10
-rw-r--r--tests/untried/neg/t6675.check6
-rw-r--r--tests/untried/neg/t6675.flags1
-rw-r--r--tests/untried/neg/t6675.scala13
-rw-r--r--tests/untried/neg/t6675b.check37
-rw-r--r--tests/untried/neg/t6675b.flags1
-rw-r--r--tests/untried/neg/t6675b.scala40
-rw-r--r--tests/untried/neg/t668.check4
-rw-r--r--tests/untried/neg/t668.scala1
-rw-r--r--tests/untried/neg/t6680a.check11
-rw-r--r--tests/untried/neg/t6680a.flags1
-rw-r--r--tests/untried/neg/t6680a.scala18
-rw-r--r--tests/untried/neg/t6728.check4
-rw-r--r--tests/untried/neg/t6728.scala5
-rw-r--r--tests/untried/neg/t6758.check28
-rw-r--r--tests/untried/neg/t6758.scala43
-rw-r--r--tests/untried/neg/t677.check6
-rw-r--r--tests/untried/neg/t677.scala3
-rw-r--r--tests/untried/neg/t6771b.check6
-rw-r--r--tests/untried/neg/t6771b.scala16
-rw-r--r--tests/untried/neg/t6788.check5
-rw-r--r--tests/untried/neg/t6788.scala7
-rw-r--r--tests/untried/neg/t6795.check4
-rw-r--r--tests/untried/neg/t6795.scala3
-rw-r--r--tests/untried/neg/t6815.check5
-rw-r--r--tests/untried/neg/t6815.scala17
-rw-r--r--tests/untried/neg/t6829.check56
-rw-r--r--tests/untried/neg/t6829.scala64
-rw-r--r--tests/untried/neg/t6844.check6
-rw-r--r--tests/untried/neg/t6844.scala5
-rw-r--r--tests/untried/neg/t6889.check7
-rw-r--r--tests/untried/neg/t6889.scala18
-rw-r--r--tests/untried/neg/t6902.check12
-rw-r--r--tests/untried/neg/t6902.flags1
-rw-r--r--tests/untried/neg/t6902.scala23
-rw-r--r--tests/untried/neg/t691.check4
-rw-r--r--tests/untried/neg/t691.scala29
-rw-r--r--tests/untried/neg/t6912.check4
-rw-r--r--tests/untried/neg/t6912.scala9
-rw-r--r--tests/untried/neg/t692.check19
-rw-r--r--tests/untried/neg/t692.scala20
-rw-r--r--tests/untried/neg/t6920.check6
-rw-r--r--tests/untried/neg/t6920.scala10
-rw-r--r--tests/untried/neg/t6928.check7
-rw-r--r--tests/untried/neg/t6928.scala10
-rw-r--r--tests/untried/neg/t693.check4
-rw-r--r--tests/untried/neg/t693.scala5
-rw-r--r--tests/untried/neg/t6931.check10
-rw-r--r--tests/untried/neg/t6931/Macros_1.scala15
-rw-r--r--tests/untried/neg/t6931/Test_2.scala4
-rw-r--r--tests/untried/neg/t6952.check13
-rw-r--r--tests/untried/neg/t6952.scala4
-rw-r--r--tests/untried/neg/t696.check9
-rw-r--r--tests/untried/neg/t696.scala7
-rw-r--r--tests/untried/neg/t6963a.check7
-rw-r--r--tests/untried/neg/t6963a.flags1
-rw-r--r--tests/untried/neg/t6963a.scala5
-rw-r--r--tests/untried/neg/t700.check4
-rw-r--r--tests/untried/neg/t700.scala10
-rw-r--r--tests/untried/neg/t7007.check7
-rw-r--r--tests/untried/neg/t7007.scala14
-rw-r--r--tests/untried/neg/t7020.check19
-rw-r--r--tests/untried/neg/t7020.flags1
-rw-r--r--tests/untried/neg/t7020.scala30
-rw-r--r--tests/untried/neg/t708.check5
-rw-r--r--tests/untried/neg/t708.scala12
-rw-r--r--tests/untried/neg/t7110.check6
-rw-r--r--tests/untried/neg/t7110.flags1
-rw-r--r--tests/untried/neg/t7110.scala6
-rw-r--r--tests/untried/neg/t712.check5
-rw-r--r--tests/untried/neg/t712.scala19
-rw-r--r--tests/untried/neg/t715.check4
-rw-r--r--tests/untried/neg/t715.scala15
-rw-r--r--tests/untried/neg/t7157.check73
-rw-r--r--tests/untried/neg/t7157/Impls_Macros_1.scala32
-rw-r--r--tests/untried/neg/t7157/Test_2.scala63
-rw-r--r--tests/untried/neg/t7171.check6
-rw-r--r--tests/untried/neg/t7171.flags1
-rw-r--r--tests/untried/neg/t7171.scala11
-rw-r--r--tests/untried/neg/t7171b.check6
-rw-r--r--tests/untried/neg/t7171b.flags1
-rw-r--r--tests/untried/neg/t7171b.scala15
-rw-r--r--tests/untried/neg/t7214neg.check4
-rw-r--r--tests/untried/neg/t7214neg.scala57
-rw-r--r--tests/untried/neg/t7235.check4
-rw-r--r--tests/untried/neg/t7235.scala14
-rw-r--r--tests/untried/neg/t7238.check6
-rw-r--r--tests/untried/neg/t7238.scala7
-rw-r--r--tests/untried/neg/t7239.check4
-rw-r--r--tests/untried/neg/t7239.scala12
-rw-r--r--tests/untried/neg/t7251.check4
-rw-r--r--tests/untried/neg/t7251/A_1.scala10
-rw-r--r--tests/untried/neg/t7251/B_2.scala7
-rw-r--r--tests/untried/neg/t7259.check7
-rw-r--r--tests/untried/neg/t7259.scala9
-rw-r--r--tests/untried/neg/t7285.check15
-rw-r--r--tests/untried/neg/t7285.flags1
-rw-r--r--tests/untried/neg/t7285.scala55
-rw-r--r--tests/untried/neg/t7289.check4
-rw-r--r--tests/untried/neg/t7289.scala39
-rw-r--r--tests/untried/neg/t7289_status_quo.check22
-rw-r--r--tests/untried/neg/t7289_status_quo.scala23
-rw-r--r--tests/untried/neg/t729.check6
-rw-r--r--tests/untried/neg/t729.scala23
-rw-r--r--tests/untried/neg/t7290.check12
-rw-r--r--tests/untried/neg/t7290.flags1
-rw-r--r--tests/untried/neg/t7290.scala10
-rw-r--r--tests/untried/neg/t7292-deprecation.check12
-rw-r--r--tests/untried/neg/t7292-deprecation.flags1
-rw-r--r--tests/untried/neg/t7292-deprecation.scala5
-rw-r--r--tests/untried/neg/t7292-removal.check10
-rw-r--r--tests/untried/neg/t7292-removal.flags1
-rw-r--r--tests/untried/neg/t7292-removal.scala5
-rw-r--r--tests/untried/neg/t7294.check6
-rw-r--r--tests/untried/neg/t7294.flags1
-rw-r--r--tests/untried/neg/t7294.scala5
-rw-r--r--tests/untried/neg/t7294b.check6
-rw-r--r--tests/untried/neg/t7294b.flags1
-rw-r--r--tests/untried/neg/t7294b.scala1
-rw-r--r--tests/untried/neg/t7299.check7
-rw-r--r--tests/untried/neg/t7299.scala6
-rw-r--r--tests/untried/neg/t7324.check4
-rw-r--r--tests/untried/neg/t7324.scala57
-rw-r--r--tests/untried/neg/t7325.check19
-rw-r--r--tests/untried/neg/t7325.scala25
-rw-r--r--tests/untried/neg/t7330.check5
-rw-r--r--tests/untried/neg/t7330.scala5
-rw-r--r--tests/untried/neg/t7369.check15
-rw-r--r--tests/untried/neg/t7369.flags1
-rw-r--r--tests/untried/neg/t7369.scala43
-rw-r--r--tests/untried/neg/t7385.check10
-rw-r--r--tests/untried/neg/t7385.scala7
-rw-r--r--tests/untried/neg/t7388.check4
-rw-r--r--tests/untried/neg/t7388.scala1
-rw-r--r--tests/untried/neg/t742.check6
-rw-r--r--tests/untried/neg/t742.scala8
-rw-r--r--tests/untried/neg/t7473.check7
-rw-r--r--tests/untried/neg/t7473.scala7
-rw-r--r--tests/untried/neg/t7475c.check7
-rw-r--r--tests/untried/neg/t7475c.scala9
-rw-r--r--tests/untried/neg/t7475d.check7
-rw-r--r--tests/untried/neg/t7475e.check4
-rw-r--r--tests/untried/neg/t7475e.scala12
-rw-r--r--tests/untried/neg/t7475f.check10
-rw-r--r--tests/untried/neg/t7475f.scala28
-rw-r--r--tests/untried/neg/t7494-after-terminal.check2
-rw-r--r--tests/untried/neg/t7494-after-terminal/ThePlugin.scala31
-rw-r--r--tests/untried/neg/t7494-after-terminal/sample_2.flags1
-rw-r--r--tests/untried/neg/t7494-after-terminal/sample_2.scala6
-rw-r--r--tests/untried/neg/t7494-after-terminal/scalac-plugin.xml5
-rw-r--r--tests/untried/neg/t7494-before-parser.check2
-rw-r--r--tests/untried/neg/t7494-before-parser/ThePlugin.scala32
-rw-r--r--tests/untried/neg/t7494-before-parser/sample_2.flags1
-rw-r--r--tests/untried/neg/t7494-before-parser/sample_2.scala6
-rw-r--r--tests/untried/neg/t7494-before-parser/scalac-plugin.xml5
-rw-r--r--tests/untried/neg/t7494-multi-right-after.check1
-rw-r--r--tests/untried/neg/t7494-multi-right-after/ThePlugin.scala31
-rw-r--r--tests/untried/neg/t7494-multi-right-after/sample_2.flags1
-rw-r--r--tests/untried/neg/t7494-multi-right-after/sample_2.scala6
-rw-r--r--tests/untried/neg/t7494-multi-right-after/scalac-plugin.xml5
-rw-r--r--tests/untried/neg/t7494-no-options.check40
-rw-r--r--tests/untried/neg/t7494-no-options/ploogin_1.scala31
-rw-r--r--tests/untried/neg/t7494-no-options/sample_2.flags1
-rw-r--r--tests/untried/neg/t7494-no-options/sample_2.scala6
-rw-r--r--tests/untried/neg/t7494-no-options/scalac-plugin.xml4
-rw-r--r--tests/untried/neg/t7494-right-after-before.check1
-rw-r--r--tests/untried/neg/t7494-right-after-before/ThePlugin.scala31
-rw-r--r--tests/untried/neg/t7494-right-after-before/sample_2.flags1
-rw-r--r--tests/untried/neg/t7494-right-after-before/sample_2.scala6
-rw-r--r--tests/untried/neg/t7494-right-after-before/scalac-plugin.xml5
-rw-r--r--tests/untried/neg/t7494-right-after-terminal.check2
-rw-r--r--tests/untried/neg/t7494-right-after-terminal/ThePlugin.scala32
-rw-r--r--tests/untried/neg/t7494-right-after-terminal/sample_2.flags1
-rw-r--r--tests/untried/neg/t7494-right-after-terminal/sample_2.scala6
-rw-r--r--tests/untried/neg/t7494-right-after-terminal/scalac-plugin.xml5
-rw-r--r--tests/untried/neg/t750.check15
-rw-r--r--tests/untried/neg/t750/AO_1.java5
-rw-r--r--tests/untried/neg/t750/Test_2.scala6
-rw-r--r--tests/untried/neg/t7501.check7
-rw-r--r--tests/untried/neg/t7501/t7501_1.scala12
-rw-r--r--tests/untried/neg/t7501/t7501_2.scala5
-rw-r--r--tests/untried/neg/t7507.check4
-rw-r--r--tests/untried/neg/t7507.scala7
-rw-r--r--tests/untried/neg/t7509.check12
-rw-r--r--tests/untried/neg/t7509.scala4
-rw-r--r--tests/untried/neg/t750b.check15
-rw-r--r--tests/untried/neg/t750b/AO.java5
-rw-r--r--tests/untried/neg/t750b/Test.scala6
-rw-r--r--tests/untried/neg/t7519-b.check6
-rw-r--r--tests/untried/neg/t7519-b/Mac_1.scala14
-rw-r--r--tests/untried/neg/t7519-b/Use_2.scala10
-rw-r--r--tests/untried/neg/t7519.check11
-rw-r--r--tests/untried/neg/t7519.scala18
-rw-r--r--tests/untried/neg/t752.check6
-rw-r--r--tests/untried/neg/t752.scala8
-rw-r--r--tests/untried/neg/t7605-deprecation.check15
-rw-r--r--tests/untried/neg/t7605-deprecation.flags1
-rw-r--r--tests/untried/neg/t7605-deprecation.scala8
-rw-r--r--tests/untried/neg/t7622-cyclic-dependency.check1
-rw-r--r--tests/untried/neg/t7622-cyclic-dependency/ThePlugin.scala40
-rw-r--r--tests/untried/neg/t7622-cyclic-dependency/sample_2.flags1
-rw-r--r--tests/untried/neg/t7622-cyclic-dependency/sample_2.scala6
-rw-r--r--tests/untried/neg/t7622-cyclic-dependency/scalac-plugin.xml5
-rw-r--r--tests/untried/neg/t7622-missing-dependency.check2
-rw-r--r--tests/untried/neg/t7622-missing-dependency/ThePlugin.scala33
-rw-r--r--tests/untried/neg/t7622-missing-dependency/sample_2.flags1
-rw-r--r--tests/untried/neg/t7622-missing-dependency/sample_2.scala6
-rw-r--r--tests/untried/neg/t7622-missing-dependency/scalac-plugin.xml5
-rw-r--r--tests/untried/neg/t7622-missing-required.check2
-rw-r--r--tests/untried/neg/t7622-missing-required.flags1
-rw-r--r--tests/untried/neg/t7622-missing-required.scala4
-rw-r--r--tests/untried/neg/t7622-multi-followers.check1
-rw-r--r--tests/untried/neg/t7622-multi-followers/ThePlugin.scala44
-rw-r--r--tests/untried/neg/t7622-multi-followers/sample_2.flags1
-rw-r--r--tests/untried/neg/t7622-multi-followers/sample_2.scala6
-rw-r--r--tests/untried/neg/t7622-multi-followers/scalac-plugin.xml5
-rw-r--r--tests/untried/neg/t7629-view-bounds-deprecation.check11
-rw-r--r--tests/untried/neg/t7629-view-bounds-deprecation.flags1
-rw-r--r--tests/untried/neg/t7629-view-bounds-deprecation.scala4
-rw-r--r--tests/untried/neg/t7636.check10
-rw-r--r--tests/untried/neg/t7636.scala7
-rw-r--r--tests/untried/neg/t765.check4
-rw-r--r--tests/untried/neg/t765.scala7
-rw-r--r--tests/untried/neg/t766.check4
-rw-r--r--tests/untried/neg/t766.scala9
-rw-r--r--tests/untried/neg/t7669.check7
-rw-r--r--tests/untried/neg/t7669.flags1
-rw-r--r--tests/untried/neg/t7669.scala13
-rw-r--r--tests/untried/neg/t771.check4
-rwxr-xr-xtests/untried/neg/t771.scala5
-rw-r--r--tests/untried/neg/t7715.check13
-rw-r--r--tests/untried/neg/t7715.scala18
-rw-r--r--tests/untried/neg/t7721.check27
-rw-r--r--tests/untried/neg/t7721.flags1
-rw-r--r--tests/untried/neg/t7721.scala140
-rw-r--r--tests/untried/neg/t7752.check27
-rw-r--r--tests/untried/neg/t7752.scala26
-rw-r--r--tests/untried/neg/t7756a.check7
-rw-r--r--tests/untried/neg/t7756a.scala11
-rw-r--r--tests/untried/neg/t7756b.check6
-rw-r--r--tests/untried/neg/t7756b.flags1
-rw-r--r--tests/untried/neg/t7756b.scala5
-rw-r--r--tests/untried/neg/t7757a.check4
-rw-r--r--tests/untried/neg/t7757a.scala1
-rw-r--r--tests/untried/neg/t7757b.check4
-rw-r--r--tests/untried/neg/t7757b.scala2
-rw-r--r--tests/untried/neg/t7783.check18
-rw-r--r--tests/untried/neg/t7783.flags1
-rw-r--r--tests/untried/neg/t7783.scala15
-rw-r--r--tests/untried/neg/t779.check4
-rw-r--r--tests/untried/neg/t779.scala8
-rw-r--r--tests/untried/neg/t783.check6
-rw-r--r--tests/untried/neg/t783.scala29
-rw-r--r--tests/untried/neg/t7834neg.check41
-rw-r--r--tests/untried/neg/t7834neg.scala76
-rw-r--r--tests/untried/neg/t7848-interp-warn.check12
-rw-r--r--tests/untried/neg/t7848-interp-warn.flags1
-rw-r--r--tests/untried/neg/t7848-interp-warn.scala18
-rw-r--r--tests/untried/neg/t7850.check7
-rw-r--r--tests/untried/neg/t7850.scala16
-rw-r--r--tests/untried/neg/t7859.check19
-rw-r--r--tests/untried/neg/t7859/A_1.scala5
-rw-r--r--tests/untried/neg/t7859/B_2.scala9
-rw-r--r--tests/untried/neg/t7870.check4
-rw-r--r--tests/untried/neg/t7870.scala3
-rw-r--r--tests/untried/neg/t7872.check10
-rw-r--r--tests/untried/neg/t7872.scala9
-rw-r--r--tests/untried/neg/t7872b.check7
-rw-r--r--tests/untried/neg/t7872b.scala23
-rw-r--r--tests/untried/neg/t7872c.check11
-rw-r--r--tests/untried/neg/t7872c.scala8
-rw-r--r--tests/untried/neg/t7877.check7
-rw-r--r--tests/untried/neg/t7877.scala13
-rw-r--r--tests/untried/neg/t7895.check4
-rw-r--r--tests/untried/neg/t7895.scala6
-rw-r--r--tests/untried/neg/t7895b.check7
-rw-r--r--tests/untried/neg/t7895b.scala5
-rw-r--r--tests/untried/neg/t7895c.check13
-rw-r--r--tests/untried/neg/t7895c.scala3
-rw-r--r--tests/untried/neg/t7897.check4
-rw-r--r--tests/untried/neg/t7897.scala23
-rw-r--r--tests/untried/neg/t7899.check6
-rw-r--r--tests/untried/neg/t7899.scala7
-rw-r--r--tests/untried/neg/t7967.check9
-rw-r--r--tests/untried/neg/t7967.scala9
-rw-r--r--tests/untried/neg/t798.check4
-rw-r--r--tests/untried/neg/t798.scala8
-rw-r--r--tests/untried/neg/t7980.check4
-rw-r--r--tests/untried/neg/t7980.scala8
-rw-r--r--tests/untried/neg/t7984.check6
-rw-r--r--tests/untried/neg/t7984.flags1
-rw-r--r--tests/untried/neg/t7984.scala7
-rw-r--r--tests/untried/neg/t800.check16
-rw-r--r--tests/untried/neg/t800.scala17
-rw-r--r--tests/untried/neg/t8006.check6
-rw-r--r--tests/untried/neg/t8006.scala8
-rw-r--r--tests/untried/neg/t8015-ffa.check6
-rw-r--r--tests/untried/neg/t8015-ffa.scala8
-rw-r--r--tests/untried/neg/t8015-ffb.check6
-rw-r--r--tests/untried/neg/t8015-ffb.flags1
-rw-r--r--tests/untried/neg/t8015-ffb.scala11
-rw-r--r--tests/untried/neg/t8024.check6
-rw-r--r--tests/untried/neg/t8024.scala14
-rw-r--r--tests/untried/neg/t8024b.check6
-rw-r--r--tests/untried/neg/t8024b.scala17
-rw-r--r--tests/untried/neg/t8035-deprecated.check21
-rw-r--r--tests/untried/neg/t8035-deprecated.flags1
-rw-r--r--tests/untried/neg/t8035-deprecated.scala10
-rw-r--r--tests/untried/neg/t8035-removed.check16
-rw-r--r--tests/untried/neg/t8035-removed.flags1
-rw-r--r--tests/untried/neg/t8035-removed.scala10
-rw-r--r--tests/untried/neg/t8072.check4
-rw-r--r--tests/untried/neg/t8072.scala6
-rw-r--r--tests/untried/neg/t8104.check4
-rw-r--r--tests/untried/neg/t8104/Macros_1.scala11
-rw-r--r--tests/untried/neg/t8104/Test_2.scala21
-rw-r--r--tests/untried/neg/t8143a.check5
-rw-r--r--tests/untried/neg/t8143a.scala15
-rw-r--r--tests/untried/neg/t8146-non-finitary-2.check9
-rw-r--r--tests/untried/neg/t8146-non-finitary-2.scala8
-rw-r--r--tests/untried/neg/t8146-non-finitary.check9
-rw-r--r--tests/untried/neg/t8146-non-finitary.scala7
-rw-r--r--tests/untried/neg/t8157.check4
-rw-r--r--tests/untried/neg/t8157.scala4
-rw-r--r--tests/untried/neg/t8158.check4
-rw-r--r--tests/untried/neg/t8158/Macros_1.scala34
-rw-r--r--tests/untried/neg/t8158/Test_2.scala14
-rw-r--r--tests/untried/neg/t8177a.check6
-rw-r--r--tests/untried/neg/t8177a.scala6
-rw-r--r--tests/untried/neg/t8182.check22
-rw-r--r--tests/untried/neg/t8182.scala18
-rw-r--r--tests/untried/neg/t8207.check7
-rw-r--r--tests/untried/neg/t8207.scala3
-rw-r--r--tests/untried/neg/t8219-any-any-ref-equals.check10
-rw-r--r--tests/untried/neg/t8219-any-any-ref-equals.scala8
-rw-r--r--tests/untried/neg/t8228.check4
-rw-r--r--tests/untried/neg/t8228.scala7
-rw-r--r--tests/untried/neg/t8229.check4
-rw-r--r--tests/untried/neg/t8229.scala6
-rw-r--r--tests/untried/neg/t8237-default.check13
-rw-r--r--tests/untried/neg/t8237-default.scala29
-rw-r--r--tests/untried/neg/t8244.check4
-rw-r--r--tests/untried/neg/t8244/Raw_1.java4
-rw-r--r--tests/untried/neg/t8244/Test_2.scala12
-rw-r--r--tests/untried/neg/t8244b.check4
-rw-r--r--tests/untried/neg/t8244b.scala18
-rw-r--r--tests/untried/neg/t8244c.check4
-rw-r--r--tests/untried/neg/t8244c.scala18
-rw-r--r--tests/untried/neg/t8244e.check4
-rw-r--r--tests/untried/neg/t8244e/Raw.java4
-rw-r--r--tests/untried/neg/t8244e/Test.scala12
-rw-r--r--tests/untried/neg/t8266-invalid-interp.check10
-rw-r--r--tests/untried/neg/t8266-invalid-interp.scala9
-rw-r--r--tests/untried/neg/t8300-overloading.check7
-rw-r--r--tests/untried/neg/t8300-overloading.scala16
-rw-r--r--tests/untried/neg/t835.check9
-rw-r--r--tests/untried/neg/t835.scala3
-rw-r--r--tests/untried/neg/t836.check7
-rw-r--r--tests/untried/neg/t836.scala16
-rw-r--r--tests/untried/neg/t8372.check7
-rw-r--r--tests/untried/neg/t8372.scala10
-rw-r--r--tests/untried/neg/t8376.check7
-rw-r--r--tests/untried/neg/t8376/J.java4
-rw-r--r--tests/untried/neg/t8376/S.scala4
-rw-r--r--tests/untried/neg/t845.check4
-rw-r--r--tests/untried/neg/t845.scala16
-rw-r--r--tests/untried/neg/t846.check6
-rw-r--r--tests/untried/neg/t846.scala13
-rw-r--r--tests/untried/neg/t856.check14
-rw-r--r--tests/untried/neg/t856.scala11
-rw-r--r--tests/untried/neg/t875.check17
-rw-r--r--tests/untried/neg/t875.scala18
-rw-r--r--tests/untried/neg/t876.check4
-rw-r--r--tests/untried/neg/t876.scala28
-rw-r--r--tests/untried/neg/t877.check7
-rw-r--r--tests/untried/neg/t877.scala3
-rw-r--r--tests/untried/neg/t882.check4
-rw-r--r--tests/untried/neg/t882.scala6
-rw-r--r--tests/untried/neg/t900.check9
-rw-r--r--tests/untried/neg/t900.scala5
-rw-r--r--tests/untried/neg/t908.check4
-rw-r--r--tests/untried/neg/t908.scala11
-rw-r--r--tests/untried/neg/t909.check6
-rw-r--r--tests/untried/neg/t909.scala9
-rw-r--r--tests/untried/neg/t910.check6
-rw-r--r--tests/untried/neg/t910.scala7
-rw-r--r--tests/untried/neg/t935.check7
-rw-r--r--tests/untried/neg/t935.scala14
-rw-r--r--tests/untried/neg/t944.check4
-rw-r--r--tests/untried/neg/t944.scala6
-rw-r--r--tests/untried/neg/t961.check4
-rw-r--r--tests/untried/neg/t961.scala14
-rw-r--r--tests/untried/neg/t963.check12
-rw-r--r--tests/untried/neg/t963.scala18
-rw-r--r--tests/untried/neg/t963b.check6
-rw-r--r--tests/untried/neg/t963b.scala26
-rw-r--r--tests/untried/neg/t987.check19
-rw-r--r--tests/untried/neg/t987.scala25
-rw-r--r--tests/untried/neg/t997.check4
-rw-r--r--tests/untried/neg/t997.scala15
-rw-r--r--tests/untried/neg/tailrec-2.check7
-rw-r--r--tests/untried/neg/tailrec-2.scala29
-rw-r--r--tests/untried/neg/tailrec-3.check10
-rw-r--r--tests/untried/neg/tailrec-3.scala14
-rw-r--r--tests/untried/neg/tailrec.check16
-rw-r--r--tests/untried/neg/tailrec.scala65
-rw-r--r--tests/untried/neg/tcpoly_bounds.check4
-rw-r--r--tests/untried/neg/tcpoly_bounds.scala3
-rw-r--r--tests/untried/neg/tcpoly_infer_ticket1162.check4
-rw-r--r--tests/untried/neg/tcpoly_infer_ticket1162.scala8
-rw-r--r--tests/untried/neg/tcpoly_override.check6
-rw-r--r--tests/untried/neg/tcpoly_override.scala10
-rw-r--r--tests/untried/neg/tcpoly_ticket2101.check4
-rw-r--r--tests/untried/neg/tcpoly_ticket2101.scala28
-rw-r--r--tests/untried/neg/tcpoly_typealias.check16
-rw-r--r--tests/untried/neg/tcpoly_typealias.scala47
-rw-r--r--tests/untried/neg/tcpoly_variance.check5
-rw-r--r--tests/untried/neg/tcpoly_variance.scala7
-rw-r--r--tests/untried/neg/tcpoly_variance_enforce.check57
-rw-r--r--tests/untried/neg/tcpoly_variance_enforce.scala42
-rw-r--r--tests/untried/neg/ticket513.check4
-rw-r--r--tests/untried/neg/ticket513.scala6
-rw-r--r--tests/untried/neg/type-diagnostics.check21
-rw-r--r--tests/untried/neg/type-diagnostics.scala22
-rw-r--r--tests/untried/neg/typeerror.check11
-rw-r--r--tests/untried/neg/typeerror.scala7
-rw-r--r--tests/untried/neg/unchecked-abstract.check27
-rw-r--r--tests/untried/neg/unchecked-abstract.flags1
-rw-r--r--tests/untried/neg/unchecked-abstract.scala93
-rw-r--r--tests/untried/neg/unchecked-impossible.check10
-rw-r--r--tests/untried/neg/unchecked-impossible.flags1
-rw-r--r--tests/untried/neg/unchecked-impossible.scala16
-rw-r--r--tests/untried/neg/unchecked-knowable.check9
-rw-r--r--tests/untried/neg/unchecked-knowable.flags1
-rw-r--r--tests/untried/neg/unchecked-knowable.scala22
-rw-r--r--tests/untried/neg/unchecked-refinement.check15
-rw-r--r--tests/untried/neg/unchecked-refinement.flags1
-rw-r--r--tests/untried/neg/unchecked-refinement.scala27
-rw-r--r--tests/untried/neg/unchecked-suppress.check12
-rw-r--r--tests/untried/neg/unchecked-suppress.flags1
-rw-r--r--tests/untried/neg/unchecked-suppress.scala10
-rw-r--r--tests/untried/neg/unchecked.check21
-rw-r--r--tests/untried/neg/unchecked.flags1
-rw-r--r--tests/untried/neg/unchecked.scala74
-rw-r--r--tests/untried/neg/unchecked2.check45
-rw-r--r--tests/untried/neg/unchecked2.flags1
-rw-r--r--tests/untried/neg/unchecked2.scala33
-rw-r--r--tests/untried/neg/unchecked3.check42
-rw-r--r--tests/untried/neg/unchecked3.flags1
-rw-r--r--tests/untried/neg/unchecked3.scala83
-rw-r--r--tests/untried/neg/unicode-unterminated-quote.check7
-rw-r--r--tests/untried/neg/unicode-unterminated-quote.scala2
-rw-r--r--tests/untried/neg/unit-returns-value.check15
-rw-r--r--tests/untried/neg/unit-returns-value.flags1
-rw-r--r--tests/untried/neg/unit-returns-value.scala32
-rw-r--r--tests/untried/neg/unit2anyref.check6
-rw-r--r--tests/untried/neg/unit2anyref.scala3
-rw-r--r--tests/untried/neg/unreachablechar.check12
-rw-r--r--tests/untried/neg/unreachablechar.flags1
-rw-r--r--tests/untried/neg/unreachablechar.scala8
-rw-r--r--tests/untried/neg/valueclasses-doubledefs.check7
-rw-r--r--tests/untried/neg/valueclasses-doubledefs.scala6
-rw-r--r--tests/untried/neg/valueclasses-impl-restrictions.check13
-rw-r--r--tests/untried/neg/valueclasses-impl-restrictions.scala29
-rw-r--r--tests/untried/neg/valueclasses-pavlov.check7
-rw-r--r--tests/untried/neg/valueclasses-pavlov.scala23
-rw-r--r--tests/untried/neg/valueclasses.check46
-rw-r--r--tests/untried/neg/valueclasses.scala36
-rw-r--r--tests/untried/neg/varargs.check10
-rw-r--r--tests/untried/neg/varargs.scala27
-rw-r--r--tests/untried/neg/variances-refinement.check22
-rw-r--r--tests/untried/neg/variances-refinement.scala40
-rw-r--r--tests/untried/neg/variances.check25
-rw-r--r--tests/untried/neg/variances.scala92
-rw-r--r--tests/untried/neg/variances2.check229
-rw-r--r--tests/untried/neg/variances2.scala303
-rw-r--r--tests/untried/neg/viewtest.check6
-rw-r--r--tests/untried/neg/viewtest.scala116
-rw-r--r--tests/untried/neg/virtpatmat_reach_null.check6
-rw-r--r--tests/untried/neg/virtpatmat_reach_null.flags1
-rw-r--r--tests/untried/neg/virtpatmat_reach_null.scala19
-rw-r--r--tests/untried/neg/virtpatmat_reach_sealed_unsealed.check16
-rw-r--r--tests/untried/neg/virtpatmat_reach_sealed_unsealed.flags1
-rw-r--r--tests/untried/neg/virtpatmat_reach_sealed_unsealed.scala21
-rw-r--r--tests/untried/neg/virtpatmat_unreach_select.check6
-rw-r--r--tests/untried/neg/virtpatmat_unreach_select.flags1
-rw-r--r--tests/untried/neg/virtpatmat_unreach_select.scala12
-rw-r--r--tests/untried/neg/volatile-intersection.check4
-rw-r--r--tests/untried/neg/volatile-intersection.scala21
-rw-r--r--tests/untried/neg/volatile.check7
-rw-r--r--tests/untried/neg/volatile.scala24
-rw-r--r--tests/untried/neg/volatile_no_override.check5
-rw-r--r--tests/untried/neg/volatile_no_override.scala14
-rw-r--r--tests/untried/neg/warn-inferred-any.check12
-rw-r--r--tests/untried/neg/warn-inferred-any.flags1
-rw-r--r--tests/untried/neg/warn-inferred-any.scala19
-rw-r--r--tests/untried/neg/warn-unused-imports.check33
-rw-r--r--tests/untried/neg/warn-unused-imports.flags1
-rw-r--r--tests/untried/neg/warn-unused-imports.scala125
-rw-r--r--tests/untried/neg/warn-unused-privates.check66
-rw-r--r--tests/untried/neg/warn-unused-privates.flags1
-rw-r--r--tests/untried/neg/warn-unused-privates.scala105
-rw-r--r--tests/untried/neg/wellkinded_app.check4
-rw-r--r--tests/untried/neg/wellkinded_app.scala4
-rw-r--r--tests/untried/neg/wellkinded_app2.check4
-rw-r--r--tests/untried/neg/wellkinded_app2.scala4
-rw-r--r--tests/untried/neg/wellkinded_bounds.check4
-rw-r--r--tests/untried/neg/wellkinded_bounds.scala3
-rw-r--r--tests/untried/neg/wellkinded_wrongarity.check4
-rw-r--r--tests/untried/neg/wellkinded_wrongarity.scala5
-rw-r--r--tests/untried/neg/wellkinded_wrongarity2.check13
-rw-r--r--tests/untried/neg/wellkinded_wrongarity2.scala12
-rw-r--r--tests/untried/neg/wrong-args-for-none.check4
-rw-r--r--tests/untried/neg/wrong-args-for-none.scala6
-rw-r--r--tests/untried/neg/xmlcorner.check7
-rw-r--r--tests/untried/neg/xmlcorner.scala22
-rw-r--r--tests/untried/neg/xmltruncated1.check4
-rw-r--r--tests/untried/neg/xmltruncated1.scala2
-rw-r--r--tests/untried/neg/xmltruncated2.check4
-rw-r--r--tests/untried/neg/xmltruncated2.scala2
-rw-r--r--tests/untried/neg/xmltruncated3.check4
-rw-r--r--tests/untried/neg/xmltruncated3.scala2
-rw-r--r--tests/untried/neg/xmltruncated4.check4
-rw-r--r--tests/untried/neg/xmltruncated4.scala2
-rw-r--r--tests/untried/neg/xmltruncated5.check4
-rw-r--r--tests/untried/neg/xmltruncated5.scala3
-rw-r--r--tests/untried/neg/xmltruncated6.check4
-rw-r--r--tests/untried/neg/xmltruncated6.scala2
-rw-r--r--tests/untried/neg/xmltruncated7.check7
-rw-r--r--tests/untried/neg/xmltruncated7.scala3
1970 files changed, 25934 insertions, 0 deletions
diff --git a/tests/untried/neg/abstract-class-2.check b/tests/untried/neg/abstract-class-2.check
new file mode 100644
index 000000000..ca79dd829
--- /dev/null
+++ b/tests/untried/neg/abstract-class-2.check
@@ -0,0 +1,5 @@
+abstract-class-2.scala:11: error: object creation impossible, since method f in trait S2 of type (x: P2.this.p.S1)Int is not defined
+(Note that P.this.p.S1 does not match P2.this.S1: their prefixes (i.e. enclosing instances) differ)
+ object O2 extends S2 {
+ ^
+one error found
diff --git a/tests/untried/neg/abstract-class-2.scala b/tests/untried/neg/abstract-class-2.scala
new file mode 100644
index 000000000..19f74f3da
--- /dev/null
+++ b/tests/untried/neg/abstract-class-2.scala
@@ -0,0 +1,14 @@
+class P {
+ trait S1
+ val p = new P
+
+ trait S2 {
+ def f(x: p.S1): Int
+ }
+}
+
+class P2 extends P {
+ object O2 extends S2 {
+ def f(x: S1) = 5
+ }
+}
diff --git a/tests/untried/neg/abstract-class-error.check b/tests/untried/neg/abstract-class-error.check
new file mode 100644
index 000000000..87d148ecc
--- /dev/null
+++ b/tests/untried/neg/abstract-class-error.check
@@ -0,0 +1,5 @@
+S.scala:1: error: class S needs to be abstract, since method g in class J of type (y: Int, z: java.util.List)Int is not defined
+(Note that java.util.List does not match java.util.List[String]. To implement a raw type, use java.util.List[_])
+class S extends J {
+ ^
+one error found
diff --git a/tests/untried/neg/abstract-class-error/J.java b/tests/untried/neg/abstract-class-error/J.java
new file mode 100644
index 000000000..5877f5cc5
--- /dev/null
+++ b/tests/untried/neg/abstract-class-error/J.java
@@ -0,0 +1,4 @@
+public abstract class J {
+ public abstract int f();
+ public abstract int g(int y, java.util.List z);
+} \ No newline at end of file
diff --git a/tests/untried/neg/abstract-class-error/S.scala b/tests/untried/neg/abstract-class-error/S.scala
new file mode 100644
index 000000000..67f6d8593
--- /dev/null
+++ b/tests/untried/neg/abstract-class-error/S.scala
@@ -0,0 +1,4 @@
+class S extends J {
+ def f() = 55
+ def g(y: Int, z: java.util.List[String]) = 11
+}
diff --git a/tests/untried/neg/abstract-concrete-methods.check b/tests/untried/neg/abstract-concrete-methods.check
new file mode 100644
index 000000000..e128f77e2
--- /dev/null
+++ b/tests/untried/neg/abstract-concrete-methods.check
@@ -0,0 +1,5 @@
+abstract-concrete-methods.scala:7: error: class Outer2 needs to be abstract, since method score in trait Outer of type (i: Outer2#Inner)Double is not defined
+(Note that This#Inner does not match Outer2#Inner: class Inner in class Outer2 is a subclass of trait Inner in trait Outer, but method parameter types must match exactly.)
+class Outer2 extends Outer[Outer2] {
+ ^
+one error found
diff --git a/tests/untried/neg/abstract-concrete-methods.scala b/tests/untried/neg/abstract-concrete-methods.scala
new file mode 100644
index 000000000..7f1aea0db
--- /dev/null
+++ b/tests/untried/neg/abstract-concrete-methods.scala
@@ -0,0 +1,10 @@
+trait Outer[This <: Outer[This]] {
+ self: This =>
+
+ trait Inner
+ def score(i: This#Inner): Double
+}
+class Outer2 extends Outer[Outer2] {
+ class Inner extends super.Inner
+ def score(i: Outer2#Inner) = 0.0
+}
diff --git a/tests/untried/neg/abstract-explaintypes.check b/tests/untried/neg/abstract-explaintypes.check
new file mode 100644
index 000000000..e303b45a3
--- /dev/null
+++ b/tests/untried/neg/abstract-explaintypes.check
@@ -0,0 +1,15 @@
+abstract-explaintypes.scala:6: error: type mismatch;
+ found : A
+ required: A.this.T
+ def foo2: T = bar().baz();
+ ^
+A <: A.this.T?
+false
+abstract-explaintypes.scala:9: error: type mismatch;
+ found : A
+ required: A.this.T
+ def foo5: T = baz().baz();
+ ^
+A <: A.this.T?
+false
+two errors found
diff --git a/tests/untried/neg/abstract-explaintypes.flags b/tests/untried/neg/abstract-explaintypes.flags
new file mode 100644
index 000000000..b36707c7c
--- /dev/null
+++ b/tests/untried/neg/abstract-explaintypes.flags
@@ -0,0 +1 @@
+-explaintypes
diff --git a/tests/untried/neg/abstract-explaintypes.scala b/tests/untried/neg/abstract-explaintypes.scala
new file mode 100644
index 000000000..f8ecae16f
--- /dev/null
+++ b/tests/untried/neg/abstract-explaintypes.scala
@@ -0,0 +1,11 @@
+trait A {
+ type T <: A;
+ def baz(): A;
+ def bar(): T;
+ def foo1: A = bar().bar();
+ def foo2: T = bar().baz();
+ def foo3 = bar().baz();
+ def foo4: A = baz().bar();
+ def foo5: T = baz().baz();
+ def foo6 = baz().baz();
+}
diff --git a/tests/untried/neg/abstract-inaccessible.check b/tests/untried/neg/abstract-inaccessible.check
new file mode 100644
index 000000000..d56f5691b
--- /dev/null
+++ b/tests/untried/neg/abstract-inaccessible.check
@@ -0,0 +1,15 @@
+abstract-inaccessible.scala:5: warning: method implementMe in trait YourTrait references private[foo] trait Bippy.
+Classes which cannot access Bippy may be unable to provide a concrete implementation of implementMe.
+ def implementMe(f: Int => (String, Bippy)): Unit
+ ^
+abstract-inaccessible.scala:6: warning: method overrideMe in trait YourTrait references private[foo] trait Bippy.
+Classes which cannot access Bippy may be unable to override overrideMe.
+ def overrideMe[T <: Bippy](x: T): T = x
+ ^
+abstract-inaccessible.scala:7: warning: method overrideMeAlso in trait YourTrait references private[foo] trait Bippy.
+Classes which cannot access Bippy may be unable to override overrideMeAlso.
+ def overrideMeAlso(x: Map[Int, Set[Bippy]]) = 5
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/abstract-inaccessible.flags b/tests/untried/neg/abstract-inaccessible.flags
new file mode 100644
index 000000000..6c1dd108a
--- /dev/null
+++ b/tests/untried/neg/abstract-inaccessible.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xlint \ No newline at end of file
diff --git a/tests/untried/neg/abstract-inaccessible.scala b/tests/untried/neg/abstract-inaccessible.scala
new file mode 100644
index 000000000..3c80f3052
--- /dev/null
+++ b/tests/untried/neg/abstract-inaccessible.scala
@@ -0,0 +1,9 @@
+package foo {
+ private[foo] trait Bippy { }
+
+ trait YourTrait {
+ def implementMe(f: Int => (String, Bippy)): Unit
+ def overrideMe[T <: Bippy](x: T): T = x
+ def overrideMeAlso(x: Map[Int, Set[Bippy]]) = 5
+ }
+}
diff --git a/tests/untried/neg/abstract-report.check b/tests/untried/neg/abstract-report.check
new file mode 100644
index 000000000..1ffeac060
--- /dev/null
+++ b/tests/untried/neg/abstract-report.check
@@ -0,0 +1,24 @@
+abstract-report.scala:1: error: class Unimplemented needs to be abstract, since:
+it has 12 unimplemented members.
+/** As seen from class Unimplemented, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ // Members declared in scala.collection.GenTraversableOnce
+ def isTraversableAgain: Boolean = ???
+ def toIterator: Iterator[String] = ???
+ def toStream: Stream[String] = ???
+
+ // Members declared in scala.collection.TraversableOnce
+ def copyToArray[B >: String](xs: Array[B],start: Int,len: Int): Unit = ???
+ def exists(p: String => Boolean): Boolean = ???
+ def find(p: String => Boolean): Option[String] = ???
+ def forall(p: String => Boolean): Boolean = ???
+ def foreach[U](f: String => U): Unit = ???
+ def hasDefiniteSize: Boolean = ???
+ def isEmpty: Boolean = ???
+ def seq: scala.collection.TraversableOnce[String] = ???
+ def toTraversable: Traversable[String] = ???
+
+class Unimplemented extends TraversableOnce[String] { }
+ ^
+one error found
diff --git a/tests/untried/neg/abstract-report.scala b/tests/untried/neg/abstract-report.scala
new file mode 100644
index 000000000..f9145a6f0
--- /dev/null
+++ b/tests/untried/neg/abstract-report.scala
@@ -0,0 +1 @@
+class Unimplemented extends TraversableOnce[String] { }
diff --git a/tests/untried/neg/abstract-report2.check b/tests/untried/neg/abstract-report2.check
new file mode 100644
index 000000000..9be3d822f
--- /dev/null
+++ b/tests/untried/neg/abstract-report2.check
@@ -0,0 +1,103 @@
+abstract-report2.scala:3: error: class Foo needs to be abstract, since:
+it has 13 unimplemented members.
+/** As seen from class Foo, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ def add(x$1: Int): Boolean = ???
+ def addAll(x$1: java.util.Collection[_ <: Int]): Boolean = ???
+ def clear(): Unit = ???
+ def contains(x$1: Any): Boolean = ???
+ def containsAll(x$1: java.util.Collection[_]): Boolean = ???
+ def isEmpty(): Boolean = ???
+ def iterator(): java.util.Iterator[Int] = ???
+ def remove(x$1: Any): Boolean = ???
+ def removeAll(x$1: java.util.Collection[_]): Boolean = ???
+ def retainAll(x$1: java.util.Collection[_]): Boolean = ???
+ def size(): Int = ???
+ def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
+ def toArray(): Array[Object] = ???
+
+class Foo extends Collection[Int]
+ ^
+abstract-report2.scala:5: error: class Bar needs to be abstract, since:
+it has 13 unimplemented members.
+/** As seen from class Bar, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ def add(x$1: List[_ <: String]): Boolean = ???
+ def addAll(x$1: java.util.Collection[_ <: List[_ <: String]]): Boolean = ???
+ def clear(): Unit = ???
+ def contains(x$1: Any): Boolean = ???
+ def containsAll(x$1: java.util.Collection[_]): Boolean = ???
+ def isEmpty(): Boolean = ???
+ def iterator(): java.util.Iterator[List[_ <: String]] = ???
+ def remove(x$1: Any): Boolean = ???
+ def removeAll(x$1: java.util.Collection[_]): Boolean = ???
+ def retainAll(x$1: java.util.Collection[_]): Boolean = ???
+ def size(): Int = ???
+ def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
+ def toArray(): Array[Object] = ???
+
+class Bar extends Collection[List[_ <: String]]
+ ^
+abstract-report2.scala:7: error: class Baz needs to be abstract, since:
+it has 13 unimplemented members.
+/** As seen from class Baz, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ def add(x$1: T): Boolean = ???
+ def addAll(x$1: java.util.Collection[_ <: T]): Boolean = ???
+ def clear(): Unit = ???
+ def contains(x$1: Any): Boolean = ???
+ def containsAll(x$1: java.util.Collection[_]): Boolean = ???
+ def isEmpty(): Boolean = ???
+ def iterator(): java.util.Iterator[T] = ???
+ def remove(x$1: Any): Boolean = ???
+ def removeAll(x$1: java.util.Collection[_]): Boolean = ???
+ def retainAll(x$1: java.util.Collection[_]): Boolean = ???
+ def size(): Int = ???
+ def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
+ def toArray(): Array[Object] = ???
+
+class Baz[T] extends Collection[T]
+ ^
+abstract-report2.scala:15: error: class Dingus needs to be abstract, since:
+it has 24 unimplemented members.
+/** As seen from class Dingus, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ // Members declared in java.util.Collection
+ def add(x$1: String): Boolean = ???
+ def addAll(x$1: java.util.Collection[_ <: String]): Boolean = ???
+ def clear(): Unit = ???
+ def contains(x$1: Any): Boolean = ???
+ def containsAll(x$1: java.util.Collection[_]): Boolean = ???
+ def iterator(): java.util.Iterator[String] = ???
+ def remove(x$1: Any): Boolean = ???
+ def removeAll(x$1: java.util.Collection[_]): Boolean = ???
+ def retainAll(x$1: java.util.Collection[_]): Boolean = ???
+ def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ???
+ def toArray(): Array[Object] = ???
+
+ // Members declared in scala.collection.GenTraversableOnce
+ def isTraversableAgain: Boolean = ???
+ def toIterator: Iterator[(Set[Int], String)] = ???
+ def toStream: Stream[(Set[Int], String)] = ???
+
+ // Members declared in scala.collection.TraversableOnce
+ def copyToArray[B >: (Set[Int], String)](xs: Array[B],start: Int,len: Int): Unit = ???
+ def exists(p: ((Set[Int], String)) => Boolean): Boolean = ???
+ def find(p: ((Set[Int], String)) => Boolean): Option[(Set[Int], String)] = ???
+ def forall(p: ((Set[Int], String)) => Boolean): Boolean = ???
+ def foreach[U](f: ((Set[Int], String)) => U): Unit = ???
+ def hasDefiniteSize: Boolean = ???
+ def isEmpty: Boolean = ???
+ def seq: scala.collection.TraversableOnce[(Set[Int], String)] = ???
+ def toTraversable: Traversable[(Set[Int], String)] = ???
+
+ // Members declared in Xyz
+ def foo(x: List[Int]): Boolean = ???
+
+class Dingus extends Bippy[String, Set[Int], List[Int]]
+ ^
+four errors found
diff --git a/tests/untried/neg/abstract-report2.scala b/tests/untried/neg/abstract-report2.scala
new file mode 100644
index 000000000..3262fee7f
--- /dev/null
+++ b/tests/untried/neg/abstract-report2.scala
@@ -0,0 +1,15 @@
+import java.util.Collection
+
+class Foo extends Collection[Int]
+
+class Bar extends Collection[List[_ <: String]]
+
+class Baz[T] extends Collection[T]
+
+trait Xyz[T] {
+ def foo(x: T): Boolean
+}
+
+trait Bippy[T1, T2, T3] extends Collection[T1] with TraversableOnce[(T2, String)] with Xyz[T3]
+
+class Dingus extends Bippy[String, Set[Int], List[Int]]
diff --git a/tests/untried/neg/abstract-vars.check b/tests/untried/neg/abstract-vars.check
new file mode 100644
index 000000000..8aa47745f
--- /dev/null
+++ b/tests/untried/neg/abstract-vars.check
@@ -0,0 +1,21 @@
+abstract-vars.scala:5: error: class Fail1 needs to be abstract, since variable x is not defined
+(Note that variables need to be initialized to be defined)
+class Fail1 extends A {
+ ^
+abstract-vars.scala:9: error: class Fail2 needs to be abstract, since variable x in class A of type Int is not defined
+(Note that variables need to be initialized to be defined)
+class Fail2 extends A { }
+ ^
+abstract-vars.scala:11: error: class Fail3 needs to be abstract, since variable x in class A of type Int is not defined
+(Note that an abstract var requires a setter in addition to the getter)
+class Fail3 extends A {
+ ^
+abstract-vars.scala:14: error: class Fail4 needs to be abstract, since variable x in class A of type Int is not defined
+(Note that an abstract var requires a setter in addition to the getter)
+class Fail4 extends A {
+ ^
+abstract-vars.scala:18: error: class Fail5 needs to be abstract, since variable x in class A of type Int is not defined
+(Note that an abstract var requires a getter in addition to the setter)
+class Fail5 extends A {
+ ^
+5 errors found
diff --git a/tests/untried/neg/abstract-vars.scala b/tests/untried/neg/abstract-vars.scala
new file mode 100644
index 000000000..df6109d3a
--- /dev/null
+++ b/tests/untried/neg/abstract-vars.scala
@@ -0,0 +1,29 @@
+abstract class A {
+ var x: Int
+}
+
+class Fail1 extends A {
+ var x: Int
+}
+
+class Fail2 extends A { }
+
+class Fail3 extends A {
+ val x: Int = 5
+}
+class Fail4 extends A {
+ def x: Int = 5
+}
+
+class Fail5 extends A {
+ def x_=(y: Int) = ()
+}
+
+class Success1 extends A {
+ val x: Int = 5
+ def x_=(y: Int) = ()
+}
+
+class Success2 extends A {
+ var x: Int = 5
+}
diff --git a/tests/untried/neg/abstract.check b/tests/untried/neg/abstract.check
new file mode 100644
index 000000000..811708ccf
--- /dev/null
+++ b/tests/untried/neg/abstract.check
@@ -0,0 +1,11 @@
+abstract.scala:6: error: type mismatch;
+ found : A
+ required: A.this.T
+ def foo2: T = bar().baz();
+ ^
+abstract.scala:9: error: type mismatch;
+ found : A
+ required: A.this.T
+ def foo5: T = baz().baz();
+ ^
+two errors found
diff --git a/tests/untried/neg/abstract.scala b/tests/untried/neg/abstract.scala
new file mode 100644
index 000000000..f8ecae16f
--- /dev/null
+++ b/tests/untried/neg/abstract.scala
@@ -0,0 +1,11 @@
+trait A {
+ type T <: A;
+ def baz(): A;
+ def bar(): T;
+ def foo1: A = bar().bar();
+ def foo2: T = bar().baz();
+ def foo3 = bar().baz();
+ def foo4: A = baz().bar();
+ def foo5: T = baz().baz();
+ def foo6 = baz().baz();
+}
diff --git a/tests/untried/neg/abstraction-from-volatile-type-error.check b/tests/untried/neg/abstraction-from-volatile-type-error.check
new file mode 100644
index 000000000..34ba0551a
--- /dev/null
+++ b/tests/untried/neg/abstraction-from-volatile-type-error.check
@@ -0,0 +1,4 @@
+abstraction-from-volatile-type-error.scala:9: error: illegal abstraction from value with volatile type a.Tv
+ val tv : a.Tv
+ ^
+one error found
diff --git a/tests/untried/neg/abstraction-from-volatile-type-error.scala b/tests/untried/neg/abstraction-from-volatile-type-error.scala
new file mode 100644
index 000000000..5afcb3ec7
--- /dev/null
+++ b/tests/untried/neg/abstraction-from-volatile-type-error.scala
@@ -0,0 +1,11 @@
+class A {
+ type T
+ type Tv = AnyRef with T
+}
+
+object Test {
+ type B = a.type forSome {
+ val a : A
+ val tv : a.Tv
+ }
+}
diff --git a/tests/untried/neg/accesses.check b/tests/untried/neg/accesses.check
new file mode 100644
index 000000000..db58af12c
--- /dev/null
+++ b/tests/untried/neg/accesses.check
@@ -0,0 +1,17 @@
+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 = ()
+ ^
+accesses.scala:25: error: overriding method f4 in class A of type ()Unit;
+ method f4 has weaker access privileges; it should be at least private[p1]
+ private[p2] def f4(): Unit
+ ^
+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
diff --git a/tests/untried/neg/accesses.scala b/tests/untried/neg/accesses.scala
new file mode 100644
index 000000000..b1df6c0e6
--- /dev/null
+++ b/tests/untried/neg/accesses.scala
@@ -0,0 +1,27 @@
+package test.p1.p2
+
+abstract class A {
+ private[p2] def f2(): Unit
+ protected def f3(): Unit
+ private[p1] def f4(): Unit
+ protected[p1] def f5(): Unit
+}
+
+abstract class OK1 extends A {
+ private[p1] def f2(): Unit
+ protected[p2] def f3(): Unit
+ private[test] def f4(): Unit
+ protected[test] def f5(): Unit
+}
+abstract class OK2 extends A {
+ protected[p1] def f2(): Unit
+ def f3(): Unit
+ protected[p1] def f4(): Unit
+ def f5(): Unit
+}
+abstract class Err1 extends A {
+ private def f2(): Unit = ()
+ private[p2] def f3(): Unit = ()
+ private[p2] def f4(): Unit
+ protected[p2] def f5(): Unit
+}
diff --git a/tests/untried/neg/accesses2.check b/tests/untried/neg/accesses2.check
new file mode 100644
index 000000000..66cf9a116
--- /dev/null
+++ b/tests/untried/neg/accesses2.check
@@ -0,0 +1,12 @@
+accesses2.scala:6: error: overriding method f2 in class A of type ()Int;
+ method f2 has weaker access privileges; it should not be private
+ private def f2(): Int = 1
+ ^
+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 {
+ ^
+accesses2.scala:9: error: overriding method f2 in class A of type ()Int;
+ method f2 has weaker access privileges; it should not be private
+ private def f2(): Int = 1
+ ^
+three errors found
diff --git a/tests/untried/neg/accesses2.scala b/tests/untried/neg/accesses2.scala
new file mode 100644
index 000000000..c7640f84b
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/ambiguous-float-dots2.check b/tests/untried/neg/ambiguous-float-dots2.check
new file mode 100644
index 000000000..40c9b4186
--- /dev/null
+++ b/tests/untried/neg/ambiguous-float-dots2.check
@@ -0,0 +1,7 @@
+ambiguous-float-dots2.scala:3: error: identifier expected but '}' found.
+}
+^
+ambiguous-float-dots2.scala:11: error: ';' expected but integer literal found.
+ 1. + 2
+ ^
+two errors found
diff --git a/tests/untried/neg/ambiguous-float-dots2.scala b/tests/untried/neg/ambiguous-float-dots2.scala
new file mode 100644
index 000000000..b1615c927
--- /dev/null
+++ b/tests/untried/neg/ambiguous-float-dots2.scala
@@ -0,0 +1,13 @@
+class A {
+ val x0 = 5.
+}
+
+class B {
+ val x1 = 5.f
+}
+
+class D {
+ 1.+(2)
+ 1. + 2
+ 1 + 2
+}
diff --git a/tests/untried/neg/annot-nonconst.check b/tests/untried/neg/annot-nonconst.check
new file mode 100644
index 000000000..5b3da7a13
--- /dev/null
+++ b/tests/untried/neg/annot-nonconst.check
@@ -0,0 +1,18 @@
+annot-nonconst.scala:1: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class Length(value: Int) extends annotation.ClassfileAnnotation
+ ^
+annot-nonconst.scala:2: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class Ann2(value: String) extends annotation.ClassfileAnnotation
+ ^
+annot-nonconst.scala:6: error: annotation argument needs to be a constant; found: Test.this.n
+ @Length(n) def foo = "foo"
+ ^
+annot-nonconst.scala:7: error: annotation argument cannot be null
+ @Ann2(null) def bar = "bar"
+ ^
+two warnings found
+two errors found
diff --git a/tests/untried/neg/annot-nonconst.scala b/tests/untried/neg/annot-nonconst.scala
new file mode 100644
index 000000000..1b5856f8b
--- /dev/null
+++ b/tests/untried/neg/annot-nonconst.scala
@@ -0,0 +1,8 @@
+class Length(value: Int) extends annotation.ClassfileAnnotation
+class Ann2(value: String) extends annotation.ClassfileAnnotation
+
+object Test {
+ def n = 15
+ @Length(n) def foo = "foo"
+ @Ann2(null) def bar = "bar"
+}
diff --git a/tests/untried/neg/any-vs-anyref.check b/tests/untried/neg/any-vs-anyref.check
new file mode 100644
index 000000000..7378f0495
--- /dev/null
+++ b/tests/untried/neg/any-vs-anyref.check
@@ -0,0 +1,80 @@
+any-vs-anyref.scala:6: error: type mismatch;
+ found : a.type (with underlying type A)
+ required: AnyRef
+Note that A is bounded only by Equals, which means AnyRef is not a known parent.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def foo1[A <: Product](a: A) = { type X = a.type }
+ ^
+any-vs-anyref.scala:7: error: type mismatch;
+ found : a.type (with underlying type A)
+ required: AnyRef
+Note that A is bounded only by Product, Quux, which means AnyRef is not a known parent.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def foo2[A <: Product with Quux](a: A) = { type X = a.type }
+ ^
+any-vs-anyref.scala:8: error: type mismatch;
+ found : a.type (with underlying type Product)
+ required: AnyRef
+Note that Product extends Any, not AnyRef.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def foo3(a: Product) = { type X = a.type }
+ ^
+any-vs-anyref.scala:9: error: type mismatch;
+ found : Product with Quux
+ required: AnyRef
+Note that the parents of this type (Product, Quux) extend Any, not AnyRef.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def foo4(a: Product with Quux) = { type X = a.type }
+ ^
+any-vs-anyref.scala:10: error: value eq is not a member of Quux with Product
+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: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
+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 foo7(x: Quux with Product { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x)
+ ^
+any-vs-anyref.scala:22: error: value eq is not a member of Bippy
+Note that Bippy extends Any, not AnyRef.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def bad1(x: Bippy, y: Bippy) = x eq y
+ ^
+any-vs-anyref.scala:27: error: type mismatch;
+ found : Quux{def g(x: String): String}
+ required: Quux{def g(x: Int): Int}
+ f(new Quux { def g(x: String) = x })
+ ^
+11 errors found
diff --git a/tests/untried/neg/any-vs-anyref.scala b/tests/untried/neg/any-vs-anyref.scala
new file mode 100644
index 000000000..8d237fbae
--- /dev/null
+++ b/tests/untried/neg/any-vs-anyref.scala
@@ -0,0 +1,29 @@
+trait Quux extends Any
+trait QuuxRef extends AnyRef
+final class Bippy(val x: Any) extends AnyVal with Quux
+
+object Foo {
+ def foo1[A <: Product](a: A) = { type X = a.type }
+ def foo2[A <: Product with Quux](a: A) = { type X = a.type }
+ def foo3(a: Product) = { type X = a.type }
+ def foo4(a: Product with Quux) = { type X = a.type }
+ def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x)
+ def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x)
+ def foo7(x: Quux with Product { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x)
+
+ def ok1[A <: QuuxRef](a: A) = { type X = a.type }
+ def ok2[A <: Product with QuuxRef](a: A) = { type X = a.type }
+ def ok3(a: QuuxRef) = { type X = a.type }
+ def ok4(a: Product with QuuxRef) = { type X = a.type }
+ def ok5(x: QuuxRef with Product) = (x eq "abc") && ("abc" eq x)
+ def ok6(x: QuuxRef with Product { def f: Int }) = (x eq "abc") && ("abc" eq x)
+ def ok7(x: QuuxRef { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x)
+
+ def bad1(x: Bippy, y: Bippy) = x eq y
+}
+
+object Bar {
+ def f(x: Quux { def g(x: Int): Int }): Int = x g 5
+ f(new Quux { def g(x: String) = x })
+ f(new Quux { def g(x: Int) = x })
+}
diff --git a/tests/untried/neg/anytrait.check b/tests/untried/neg/anytrait.check
new file mode 100644
index 000000000..fabe74d37
--- /dev/null
+++ b/tests/untried/neg/anytrait.check
@@ -0,0 +1,7 @@
+anytrait.scala:3: error: field definition is not allowed in universal trait extending from class Any
+ var x = 1
+ ^
+anytrait.scala:5: error: this statement is not allowed in universal trait extending from class Any
+ { x += 1 }
+ ^
+two errors found
diff --git a/tests/untried/neg/anytrait.scala b/tests/untried/neg/anytrait.scala
new file mode 100644
index 000000000..e76164f63
--- /dev/null
+++ b/tests/untried/neg/anytrait.scala
@@ -0,0 +1,10 @@
+trait T extends Any {
+
+ var x = 1
+
+ { x += 1 }
+
+ type T = Int
+
+ val y: T
+}
diff --git a/tests/untried/neg/anyval-anyref-parent.check b/tests/untried/neg/anyval-anyref-parent.check
new file mode 100644
index 000000000..8a00fb394
--- /dev/null
+++ b/tests/untried/neg/anyval-anyref-parent.check
@@ -0,0 +1,23 @@
+anyval-anyref-parent.scala:2: error: only classes (not traits) are allowed to extend AnyVal
+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 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
+trait Foo4 extends Any with Immutable // fail
+ ^
+anyval-anyref-parent.scala:11: error: illegal inheritance; superclass AnyVal
+ is not a subclass of the superclass Object
+ of the mixin trait Immutable
+trait Foo5 extends AnyVal with Immutable // fail
+ ^
+anyval-anyref-parent.scala:11: error: only classes (not traits) are allowed to extend AnyVal
+trait Foo5 extends AnyVal with Immutable // fail
+ ^
+6 errors found
diff --git a/tests/untried/neg/anyval-anyref-parent.scala b/tests/untried/neg/anyval-anyref-parent.scala
new file mode 100644
index 000000000..f927992e5
--- /dev/null
+++ b/tests/untried/neg/anyval-anyref-parent.scala
@@ -0,0 +1,12 @@
+trait Foo1 extends Any
+trait Foo2 extends AnyVal // fail
+trait Foo3 extends AnyRef
+
+class Bar1 extends Any // fail
+class Bar2(x: Int) extends AnyVal // fail
+class Bar3(val x: Int) extends AnyVal // fail
+class Bar4 extends AnyRef
+
+trait Foo4 extends Any with Immutable // fail
+trait Foo5 extends AnyVal with Immutable // fail
+trait Foo6 extends AnyRef with Immutable
diff --git a/tests/untried/neg/applydynamic_sip.check b/tests/untried/neg/applydynamic_sip.check
new file mode 100644
index 000000000..2cb2e7f09
--- /dev/null
+++ b/tests/untried/neg/applydynamic_sip.check
@@ -0,0 +1,73 @@
+applydynamic_sip.scala:7: error: applyDynamic does not support passing a vararg parameter
+ qual.sel(a, a2: _*)
+ ^
+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
+error after rewriting to Test.this.bad1.selectDynamic("sel")
+possible cause: maybe a wrong Dynamic method signature?
+ bad1.sel
+ ^
+applydynamic_sip.scala:19: error: type mismatch;
+ found : String("sel")
+ required: Int
+error after rewriting to Test.this.bad1.applyDynamic("sel")
+possible cause: maybe a wrong Dynamic method signature?
+ bad1.sel(1)
+ ^
+applydynamic_sip.scala:20: error: type mismatch;
+ found : String("sel")
+ required: Int
+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
+error after rewriting to Test.this.bad1.updateDynamic("sel")
+possible cause: maybe a wrong Dynamic method signature?
+ bad1.sel = 1
+ ^
+applydynamic_sip.scala:29: error: Int does not take parameters
+error after rewriting to Test.this.bad2.selectDynamic("sel")
+possible cause: maybe a wrong Dynamic method signature?
+ bad2.sel
+ ^
+applydynamic_sip.scala:30: error: Int does not take parameters
+error after rewriting to Test.this.bad2.applyDynamic("sel")
+possible cause: maybe a wrong Dynamic method signature?
+ bad2.sel(1)
+ ^
+applydynamic_sip.scala:31: error: Int does not take parameters
+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
+ ^
+16 errors found
diff --git a/tests/untried/neg/applydynamic_sip.flags b/tests/untried/neg/applydynamic_sip.flags
new file mode 100644
index 000000000..1141f9750
--- /dev/null
+++ b/tests/untried/neg/applydynamic_sip.flags
@@ -0,0 +1 @@
+-language:dynamics
diff --git a/tests/untried/neg/applydynamic_sip.scala b/tests/untried/neg/applydynamic_sip.scala
new file mode 100644
index 000000000..ee4432ebe
--- /dev/null
+++ b/tests/untried/neg/applydynamic_sip.scala
@@ -0,0 +1,33 @@
+object Test extends App {
+ val qual: Dynamic = ???
+ val expr = "expr"
+ val a = "a"
+ val a2 = "a2"
+
+ qual.sel(a, a2: _*)
+ qual.sel(arg = a, a2: _*)
+ qual.sel(arg, arg2 = "a2", a2: _*)
+
+ val bad1 = new Dynamic {
+ def selectDynamic(n: Int) = n
+ def applyDynamic(n: Int) = n
+ def applyDynamicNamed(n: Int) = n
+ def updateDynamic(n: Int) = n
+
+ }
+ bad1.sel
+ bad1.sel(1)
+ bad1.sel(a = 1)
+ bad1.sel = 1
+
+ val bad2 = new Dynamic {
+ def selectDynamic = 1
+ def applyDynamic = 1
+ def applyDynamicNamed = 1
+ def updateDynamic = 1
+ }
+ bad2.sel
+ bad2.sel(1)
+ bad2.sel(a = 1)
+ bad2.sel = 1
+}
diff --git a/tests/untried/neg/bad-advice.check b/tests/untried/neg/bad-advice.check
new file mode 100644
index 000000000..03b3e4f61
--- /dev/null
+++ b/tests/untried/neg/bad-advice.check
@@ -0,0 +1,6 @@
+bad-advice.scala:4: error: pattern type is incompatible with expected type;
+ found : Bip.type
+ required: Int
+ case Bip => true
+ ^
+one error found
diff --git a/tests/untried/neg/bad-advice.flags b/tests/untried/neg/bad-advice.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/bad-advice.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/bad-advice.scala b/tests/untried/neg/bad-advice.scala
new file mode 100644
index 000000000..b1955330d
--- /dev/null
+++ b/tests/untried/neg/bad-advice.scala
@@ -0,0 +1,6 @@
+object Bip
+object Test {
+ def f(x: Int) = x match {
+ case Bip => true
+ }
+}
diff --git a/tests/untried/neg/badtok-1.check b/tests/untried/neg/badtok-1.check
new file mode 100644
index 000000000..b05bc6016
--- /dev/null
+++ b/tests/untried/neg/badtok-1.check
@@ -0,0 +1,7 @@
+badtok-1.scala:2: error: unclosed character literal
+'42'
+^
+badtok-1.scala:2: error: unclosed character literal
+'42'
+ ^
+two errors found
diff --git a/tests/untried/neg/badtok-1.scala b/tests/untried/neg/badtok-1.scala
new file mode 100644
index 000000000..706e79494
--- /dev/null
+++ b/tests/untried/neg/badtok-1.scala
@@ -0,0 +1,2 @@
+// bug 989
+'42'
diff --git a/tests/untried/neg/badtok-2.check b/tests/untried/neg/badtok-2.check
new file mode 100644
index 000000000..e6861c240
--- /dev/null
+++ b/tests/untried/neg/badtok-2.check
@@ -0,0 +1,4 @@
+badtok-2.scala:3: error: unclosed quoted identifier
+`x
+^
+one error found
diff --git a/tests/untried/neg/badtok-2.scala b/tests/untried/neg/badtok-2.scala
new file mode 100644
index 000000000..4d1ba1b2c
--- /dev/null
+++ b/tests/untried/neg/badtok-2.scala
@@ -0,0 +1,3 @@
+//bug 990
+object Test {
+`x
diff --git a/tests/untried/neg/badtok-3.check b/tests/untried/neg/badtok-3.check
new file mode 100644
index 000000000..aee4f6f4d
--- /dev/null
+++ b/tests/untried/neg/badtok-3.check
@@ -0,0 +1,4 @@
+badtok-3.scala:2: error: input ended while parsing XML
+ <x
+ ^
+one error found
diff --git a/tests/untried/neg/badtok-3.scala b/tests/untried/neg/badtok-3.scala
new file mode 100644
index 000000000..49ad3bf9e
--- /dev/null
+++ b/tests/untried/neg/badtok-3.scala
@@ -0,0 +1,2 @@
+object Test {
+ <x
diff --git a/tests/untried/neg/case-collision.check b/tests/untried/neg/case-collision.check
new file mode 100644
index 000000000..22cf105a4
--- /dev/null
+++ b/tests/untried/neg/case-collision.check
@@ -0,0 +1,12 @@
+case-collision.scala:5: warning: Class foo.BIPPY differs only in case from foo.Bippy. Such classes will overwrite one another on case-insensitive filesystems.
+class BIPPY
+ ^
+case-collision.scala:11: warning: Class foo.HyRaX$ differs only in case from foo.Hyrax$. Such classes will overwrite one another on case-insensitive filesystems.
+object HyRaX
+ ^
+case-collision.scala:8: warning: Class foo.DINGO$ differs only in case from foo.Dingo$. Such classes will overwrite one another on case-insensitive filesystems.
+object DINGO
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/case-collision.flags b/tests/untried/neg/case-collision.flags
new file mode 100644
index 000000000..14c1069de
--- /dev/null
+++ b/tests/untried/neg/case-collision.flags
@@ -0,0 +1 @@
+-Ybackend:GenASM -Xfatal-warnings
diff --git a/tests/untried/neg/case-collision.scala b/tests/untried/neg/case-collision.scala
new file mode 100644
index 000000000..241169a77
--- /dev/null
+++ b/tests/untried/neg/case-collision.scala
@@ -0,0 +1,11 @@
+package foo
+
+class Bippy
+
+class BIPPY
+
+object Dingo
+object DINGO
+
+case class Hyrax()
+object HyRaX
diff --git a/tests/untried/neg/case-collision2.check b/tests/untried/neg/case-collision2.check
new file mode 100644
index 000000000..b8481f46b
--- /dev/null
+++ b/tests/untried/neg/case-collision2.check
@@ -0,0 +1,12 @@
+case-collision2.scala:5: warning: Class foo.BIPPY differs only in case from foo.Bippy. Such classes will overwrite one another on case-insensitive filesystems.
+class BIPPY
+ ^
+case-collision2.scala:8: warning: Class foo.DINGO$ differs only in case from foo.Dingo$. Such classes will overwrite one another on case-insensitive filesystems.
+object DINGO
+ ^
+case-collision2.scala:11: warning: Class foo.HyRaX$ differs only in case from foo.Hyrax$. Such classes will overwrite one another on case-insensitive filesystems.
+object HyRaX
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/case-collision2.flags b/tests/untried/neg/case-collision2.flags
new file mode 100644
index 000000000..5bfa9da5c
--- /dev/null
+++ b/tests/untried/neg/case-collision2.flags
@@ -0,0 +1 @@
+-Ynooptimize -Ybackend:GenBCode -Xfatal-warnings
diff --git a/tests/untried/neg/case-collision2.scala b/tests/untried/neg/case-collision2.scala
new file mode 100644
index 000000000..924e33005
--- /dev/null
+++ b/tests/untried/neg/case-collision2.scala
@@ -0,0 +1,12 @@
+package foo
+
+class Bippy
+
+class BIPPY
+
+object Dingo
+object DINGO
+
+case class Hyrax()
+object HyRaX
+
diff --git a/tests/untried/neg/caseinherit.check b/tests/untried/neg/caseinherit.check
new file mode 100644
index 000000000..09327a4ff
--- /dev/null
+++ b/tests/untried/neg/caseinherit.check
@@ -0,0 +1,10 @@
+caseinherit.scala:3: error: case class B has case ancestor foo.A, but case-to-case inheritance is prohibited. To overcome this limitation, use extractors to pattern match on non-leaf nodes.
+ case class B(y: Int) extends A(y)
+ ^
+caseinherit.scala:4: error: case object Bippy has case ancestor foo.A, but case-to-case inheritance is prohibited. To overcome this limitation, use extractors to pattern match on non-leaf nodes.
+ case object Bippy extends A(55)
+ ^
+caseinherit.scala:11: error: case class Dingus has case ancestor foo.A, but case-to-case inheritance is prohibited. To overcome this limitation, use extractors to pattern match on non-leaf nodes.
+ case class Dingus(y: Int) extends Innocent
+ ^
+three errors found
diff --git a/tests/untried/neg/caseinherit.scala b/tests/untried/neg/caseinherit.scala
new file mode 100644
index 000000000..188b7d14f
--- /dev/null
+++ b/tests/untried/neg/caseinherit.scala
@@ -0,0 +1,13 @@
+package foo {
+ case class A(x: Int)
+ case class B(y: Int) extends A(y)
+ case object Bippy extends A(55)
+}
+import foo._
+
+package bar {
+ class Blameless(x: Int)
+ class Innocent extends A(5)
+ case class Dingus(y: Int) extends Innocent
+ case object Hungle extends Blameless(5)
+}
diff --git a/tests/untried/neg/catch-all.check b/tests/untried/neg/catch-all.check
new file mode 100644
index 000000000..aaf51480c
--- /dev/null
+++ b/tests/untried/neg/catch-all.check
@@ -0,0 +1,12 @@
+catch-all.scala:2: warning: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning.
+ try { "warn" } catch { case _ => }
+ ^
+catch-all.scala:4: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
+ try { "warn" } catch { case x => }
+ ^
+catch-all.scala:6: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
+ try { "warn" } catch { case _: RuntimeException => ; case x => }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/catch-all.flags b/tests/untried/neg/catch-all.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/catch-all.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/catch-all.scala b/tests/untried/neg/catch-all.scala
new file mode 100644
index 000000000..c05be7704
--- /dev/null
+++ b/tests/untried/neg/catch-all.scala
@@ -0,0 +1,31 @@
+object CatchAll {
+ try { "warn" } catch { case _ => }
+
+ try { "warn" } catch { case x => }
+
+ try { "warn" } catch { case _: RuntimeException => ; case x => }
+
+ val t = T
+
+ try { "okay" } catch { case T => }
+
+ try { "okay" } catch { case `t` => }
+
+ try { "okay" } catch { case x @ T => }
+
+ try { "okay" } catch { case x @ `t` => }
+
+ try { "okay" } catch { case _: Throwable => }
+
+ try { "okay" } catch { case _: Exception => }
+
+ try { "okay" } catch { case okay: Throwable => }
+
+ try { "okay" } catch { case okay: Exception => }
+
+ try { "okay" } catch { case _ if "".isEmpty => }
+
+ "okay" match { case _ => "" }
+}
+
+object T extends Throwable
diff --git a/tests/untried/neg/check-dead.check b/tests/untried/neg/check-dead.check
new file mode 100644
index 000000000..2150a942b
--- /dev/null
+++ b/tests/untried/neg/check-dead.check
@@ -0,0 +1,15 @@
+check-dead.scala:7: warning: dead code following this construct
+ def z1 = y1(throw new Exception) // should warn
+ ^
+check-dead.scala:10: warning: dead code following this construct
+ def z2 = y2(throw new Exception) // should warn
+ ^
+check-dead.scala:29: warning: dead code following this construct
+ throw new Exception // should warn
+ ^
+check-dead.scala:33: warning: dead code following this construct
+ throw new Exception // should warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/check-dead.flags b/tests/untried/neg/check-dead.flags
new file mode 100644
index 000000000..c7d406c64
--- /dev/null
+++ b/tests/untried/neg/check-dead.flags
@@ -0,0 +1 @@
+-Ywarn-dead-code -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/check-dead.scala b/tests/untried/neg/check-dead.scala
new file mode 100644
index 000000000..2d5bccb21
--- /dev/null
+++ b/tests/untried/neg/check-dead.scala
@@ -0,0 +1,37 @@
+object Other {
+ def oops(msg: String = "xxx"): Nothing = throw new Exception(msg) // should not warn
+}
+
+class NoDeads {
+ def y1(arg: Any) = println("foo")
+ def z1 = y1(throw new Exception) // should warn
+
+ def y2[T](arg: T) = println("foo")
+ def z2 = y2(throw new Exception) // should warn
+
+ def y3[T](arg: => T) = println("foo")
+ def z3 = y3(throw new Exception) // should not warn: by name arg
+
+ def nowarn1 = synchronized { throw new Exception } // should not warn: synchronized should be by name
+
+ def nowarn2: Int = synchronized { // should not warn
+ val i = 10 + 2
+ return i
+ }
+ def nowarn3: Int = synchronized { // should not warn
+ val i = 10 + 2
+ i
+ }
+
+ def nowarn4: String = Other.oops("don't warn about me") // should not warn
+
+ def yeswarn1 = synchronized {
+ throw new Exception // should warn
+ 5 * 5
+ }
+ def yeswarn2: Int = synchronized {
+ throw new Exception // should warn
+ return 5
+ }
+}
+
diff --git a/tests/untried/neg/checksensible.check b/tests/untried/neg/checksensible.check
new file mode 100644
index 000000000..e5f1a38d9
--- /dev/null
+++ b/tests/untried/neg/checksensible.check
@@ -0,0 +1,102 @@
+checksensible.scala:13: warning: comparing a fresh object using `eq' will always yield false
+ (new AnyRef) eq (new AnyRef)
+ ^
+checksensible.scala:14: warning: comparing a fresh object using `ne' will always yield true
+ (new AnyRef) ne (new AnyRef)
+ ^
+checksensible.scala:15: warning: comparing a fresh object using `eq' will always yield false
+ Shmoopie eq (new AnyRef)
+ ^
+checksensible.scala:16: warning: comparing a fresh object using `eq' will always yield false
+ (Shmoopie: AnyRef) eq (new AnyRef)
+ ^
+checksensible.scala:17: warning: comparing a fresh object using `eq' will always yield false
+ (new AnyRef) eq Shmoopie
+ ^
+checksensible.scala:18: warning: comparing a fresh object using `eq' will always yield false
+ (new AnyRef) eq null
+ ^
+checksensible.scala:19: warning: comparing a fresh object using `eq' will always yield false
+ null eq new AnyRef
+ ^
+checksensible.scala:26: warning: comparing values of types Unit and Int using `==' will always yield false
+ (c = 1) == 0
+ ^
+checksensible.scala:27: warning: comparing values of types Int and Unit using `==' will always yield false
+ 0 == (c = 1)
+ ^
+checksensible.scala:29: warning: comparing values of types Int and String using `==' will always yield false
+ 1 == "abc"
+ ^
+checksensible.scala:33: warning: comparing values of types Some[Int] and Int using `==' will always yield false
+ Some(1) == 1 // as above
+ ^
+checksensible.scala:38: warning: comparing a fresh object using `==' will always yield false
+ new AnyRef == 1
+ ^
+checksensible.scala:41: warning: comparing values of types Int and Boolean using `==' will always yield false
+ 1 == (new java.lang.Boolean(true))
+ ^
+checksensible.scala:43: warning: comparing values of types Int and Boolean using `!=' will always yield true
+ 1 != true
+ ^
+checksensible.scala:44: warning: comparing values of types Unit and Boolean using `==' will always yield false
+ () == true
+ ^
+checksensible.scala:45: warning: comparing values of types Unit and Unit using `==' will always yield true
+ () == ()
+ ^
+checksensible.scala:46: warning: comparing values of types Unit and Unit using `==' will always yield true
+ () == println
+ ^
+checksensible.scala:47: warning: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true
+ () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false
+ ^
+checksensible.scala:48: warning: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false
+ scala.runtime.BoxedUnit.UNIT != ()
+ ^
+checksensible.scala:51: warning: comparing values of types Int and Unit using `!=' will always yield true
+ (1 != println)
+ ^
+checksensible.scala:52: warning: comparing values of types Int and Symbol using `!=' will always yield true
+ (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:61: warning: comparing a fresh object using `==' will always yield false
+ new Object == new Object
+ ^
+checksensible.scala:62: warning: comparing a fresh object using `==' will always yield false
+ new Object == "abc"
+ ^
+checksensible.scala:63: warning: comparing a fresh object using `!=' will always yield true
+ new Exception() != new Exception()
+ ^
+checksensible.scala:66: warning: comparing values of types Int and Null using `==' will always yield false
+ if (foo.length == null) "plante" else "plante pas"
+ ^
+checksensible.scala:71: warning: comparing values of types Bip and Bop using `==' will always yield false
+ (x1 == x2)
+ ^
+checksensible.scala:81: warning: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false
+ c3 == z1
+ ^
+checksensible.scala:82: warning: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false
+ z1 == c3
+ ^
+checksensible.scala:83: warning: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true
+ z1 != c3
+ ^
+checksensible.scala:84: warning: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true
+ 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
+one error found
diff --git a/tests/untried/neg/checksensible.flags b/tests/untried/neg/checksensible.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/checksensible.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/checksensible.scala b/tests/untried/neg/checksensible.scala
new file mode 100644
index 000000000..b6083f75e
--- /dev/null
+++ b/tests/untried/neg/checksensible.scala
@@ -0,0 +1,100 @@
+final class Bip { def <=(other: Bop) = true }
+final class Bop { }
+object Bep { }
+
+final class Zing {
+ def !=(other: Zing) = false
+}
+
+// 7 warnings
+class RefEqTest {
+ object Shmoopie
+
+ (new AnyRef) eq (new AnyRef)
+ (new AnyRef) ne (new AnyRef)
+ Shmoopie eq (new AnyRef)
+ (Shmoopie: AnyRef) eq (new AnyRef)
+ (new AnyRef) eq Shmoopie
+ (new AnyRef) eq null
+ null eq new AnyRef
+}
+
+// 13 warnings
+class EqEqValTest {
+ var c = 0
+
+ (c = 1) == 0
+ 0 == (c = 1)
+
+ 1 == "abc"
+ 1 == ("abc": Any) // doesn't warn because an Any may be a boxed Int
+ 1 == (1: Any) // as above
+ "abc" == 1 // warns because the lub of String and Int is Any
+ Some(1) == 1 // as above
+
+ true == new java.lang.Boolean(true) // none of these should warn
+ new java.lang.Boolean(true) == true
+
+ new AnyRef == 1
+ 1 == new AnyRef // doesn't warn because it could be...
+ 1 == (new java.lang.Integer(1)) // ...something like this
+ 1 == (new java.lang.Boolean(true))
+
+ 1 != true
+ () == true
+ () == ()
+ () == println
+ () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false
+ scala.runtime.BoxedUnit.UNIT != ()
+ (scala.runtime.BoxedUnit.UNIT: java.io.Serializable) != () // shouldn't warn
+
+ (1 != println)
+ (1 != 'sym)
+}
+
+// 12 warnings
+class EqEqRefTest {
+ val ref = new Bop
+ ((x: Int) => x + 1) == null
+ Bep == ((_: Int) + 1)
+
+ new Object == new Object
+ new Object == "abc"
+ new Exception() != new Exception()
+
+ val foo: Array[String] = Array("1","2","3")
+ if (foo.length == null) "plante" else "plante pas"
+
+ // final classes with default equals
+ val x1 = new Bip
+ val x2 = new Bop
+ (x1 == x2)
+
+ class C1 { }
+ class C2 extends C1 { }
+ final class Z1 extends C2 { }
+ final class C3 extends C2 { def !=(other: Z1) = false }
+ val z1 = new Z1
+ val c3 = new C3
+
+ // these should always warn
+ c3 == z1
+ z1 == c3
+ z1 != c3
+ c3 != "abc"
+ // this should warn when feeling chatty
+ c3 != z1
+
+ // non-warners
+ (null: AnyRef) == (null: AnyRef)
+ (x1 <= x2)
+
+ def main(args: Array[String]) = {
+ val in = new java.io.FileInputStream(args(0))
+ var c = 0
+ while ((c = in.read) != -1)
+ print(c.toChar)
+
+ in.close
+ }
+}
diff --git a/tests/untried/neg/checksensibleUnit.check b/tests/untried/neg/checksensibleUnit.check
new file mode 100644
index 000000000..7fed4e558
--- /dev/null
+++ b/tests/untried/neg/checksensibleUnit.check
@@ -0,0 +1,7 @@
+checksensibleUnit.scala:3: error: value > is not a member of Unit
+ println((c = 1) > 0)
+ ^
+checksensibleUnit.scala:4: error: value <= is not a member of Unit
+ println((c = 1) <= 0)
+ ^
+two errors found
diff --git a/tests/untried/neg/checksensibleUnit.scala b/tests/untried/neg/checksensibleUnit.scala
new file mode 100644
index 000000000..11c3b67ea
--- /dev/null
+++ b/tests/untried/neg/checksensibleUnit.scala
@@ -0,0 +1,5 @@
+class Test {
+ var c = 0
+ println((c = 1) > 0)
+ println((c = 1) <= 0)
+}
diff --git a/tests/untried/neg/choices.check b/tests/untried/neg/choices.check
new file mode 100644
index 000000000..b114394e9
--- /dev/null
+++ b/tests/untried/neg/choices.check
@@ -0,0 +1,2 @@
+error: bad options: -Yresolve-term-conflict
+one error found
diff --git a/tests/untried/neg/choices.flags b/tests/untried/neg/choices.flags
new file mode 100644
index 000000000..9718467d4
--- /dev/null
+++ b/tests/untried/neg/choices.flags
@@ -0,0 +1 @@
+-Yresolve-term-conflict
diff --git a/tests/untried/neg/choices.scala b/tests/untried/neg/choices.scala
new file mode 100644
index 000000000..882749487
--- /dev/null
+++ b/tests/untried/neg/choices.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+
+ }
+}
diff --git a/tests/untried/neg/class-of-double-targs.check b/tests/untried/neg/class-of-double-targs.check
new file mode 100644
index 000000000..f7e2094f9
--- /dev/null
+++ b/tests/untried/neg/class-of-double-targs.check
@@ -0,0 +1,4 @@
+class-of-double-targs.scala:2: error: expression of type Class[Int](classOf[scala.Int]) does not take type parameters.
+ classOf[Int][Int]
+ ^
+one error found
diff --git a/tests/untried/neg/class-of-double-targs.scala b/tests/untried/neg/class-of-double-targs.scala
new file mode 100644
index 000000000..26a2fa838
--- /dev/null
+++ b/tests/untried/neg/class-of-double-targs.scala
@@ -0,0 +1,3 @@
+object Test {
+ classOf[Int][Int]
+}
diff --git a/tests/untried/neg/classmanifests_new_deprecations.check b/tests/untried/neg/classmanifests_new_deprecations.check
new file mode 100644
index 000000000..fd1e2728c
--- /dev/null
+++ b/tests/untried/neg/classmanifests_new_deprecations.check
@@ -0,0 +1,27 @@
+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]) = ???
+ ^
+classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
+ val cm3: ClassManifest[Int] = null
+ ^
+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]) = ???
+ ^
+classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ val rcm3: scala.reflect.ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
+ type CM[T] = ClassManifest[T]
+ ^
+classmanifests_new_deprecations.scala:15: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ type RCM[T] = scala.reflect.ClassManifest[T]
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+8 warnings found
+one error found
diff --git a/tests/untried/neg/classmanifests_new_deprecations.flags b/tests/untried/neg/classmanifests_new_deprecations.flags
new file mode 100644
index 000000000..c6bfaf1f6
--- /dev/null
+++ b/tests/untried/neg/classmanifests_new_deprecations.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/tests/untried/neg/classmanifests_new_deprecations.scala b/tests/untried/neg/classmanifests_new_deprecations.scala
new file mode 100644
index 000000000..7aebf011f
--- /dev/null
+++ b/tests/untried/neg/classmanifests_new_deprecations.scala
@@ -0,0 +1,37 @@
+object Test extends App {
+ def cm1[T: ClassManifest] = ???
+ def cm2[T](implicit evidence$1: ClassManifest[T]) = ???
+ val cm3: ClassManifest[Int] = null
+
+ def rcm1[T: scala.reflect.ClassManifest] = ???
+ def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ???
+ val rcm3: scala.reflect.ClassManifest[Int] = null
+
+ type CM[T] = ClassManifest[T]
+ def acm1[T: CM] = ???
+ def acm2[T](implicit evidence$1: CM[T]) = ???
+ val acm3: CM[Int] = null
+
+ type RCM[T] = scala.reflect.ClassManifest[T]
+ def arcm1[T: RCM] = ???
+ def arcm2[T](implicit evidence$1: RCM[T]) = ???
+ val arcm3: RCM[Int] = null
+
+ def m1[T: Manifest] = ???
+ def m2[T](implicit evidence$1: Manifest[T]) = ???
+ val m3: Manifest[Int] = null
+
+ def rm1[T: scala.reflect.Manifest] = ???
+ def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ???
+ val rm3: scala.reflect.Manifest[Int] = null
+
+ type M[T] = Manifest[T]
+ def am1[T: M] = ???
+ def am2[T](implicit evidence$1: M[T]) = ???
+ val am3: M[Int] = null
+
+ type RM[T] = scala.reflect.Manifest[T]
+ def arm1[T: RM] = ???
+ def arm2[T](implicit evidence$1: RM[T]) = ???
+ val arm3: RM[Int] = null
+}
diff --git a/tests/untried/neg/classtags_contextbound_a.check b/tests/untried/neg/classtags_contextbound_a.check
new file mode 100644
index 000000000..5edb7f9a5
--- /dev/null
+++ b/tests/untried/neg/classtags_contextbound_a.check
@@ -0,0 +1,4 @@
+classtags_contextbound_a.scala:2: error: No ClassTag available for T
+ def foo[T] = Array[T]()
+ ^
+one error found
diff --git a/tests/untried/neg/classtags_contextbound_a.scala b/tests/untried/neg/classtags_contextbound_a.scala
new file mode 100644
index 000000000..77ca0cfd0
--- /dev/null
+++ b/tests/untried/neg/classtags_contextbound_a.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ def foo[T] = Array[T]()
+ println(foo[Int].getClass)
+}
diff --git a/tests/untried/neg/classtags_contextbound_b.check b/tests/untried/neg/classtags_contextbound_b.check
new file mode 100644
index 000000000..e17ab8b0d
--- /dev/null
+++ b/tests/untried/neg/classtags_contextbound_b.check
@@ -0,0 +1,4 @@
+classtags_contextbound_b.scala:5: error: No ClassTag available for T
+ def foo[T] = mkArray[T]
+ ^
+one error found
diff --git a/tests/untried/neg/classtags_contextbound_b.scala b/tests/untried/neg/classtags_contextbound_b.scala
new file mode 100644
index 000000000..503dfa5c0
--- /dev/null
+++ b/tests/untried/neg/classtags_contextbound_b.scala
@@ -0,0 +1,7 @@
+import scala.reflect.{ClassTag, classTag}
+
+object Test extends App {
+ def mkArray[T: ClassTag] = Array[T]()
+ def foo[T] = mkArray[T]
+ println(foo[Int].getClass)
+}
diff --git a/tests/untried/neg/classtags_contextbound_c.check b/tests/untried/neg/classtags_contextbound_c.check
new file mode 100644
index 000000000..e8666f7a1
--- /dev/null
+++ b/tests/untried/neg/classtags_contextbound_c.check
@@ -0,0 +1,4 @@
+classtags_contextbound_c.scala:4: error: No ClassTag available for T
+ def mkArray[T] = Array[T]()
+ ^
+one error found
diff --git a/tests/untried/neg/classtags_contextbound_c.scala b/tests/untried/neg/classtags_contextbound_c.scala
new file mode 100644
index 000000000..b6b98ca74
--- /dev/null
+++ b/tests/untried/neg/classtags_contextbound_c.scala
@@ -0,0 +1,7 @@
+import scala.reflect.{ClassTag, classTag}
+
+object Test extends App {
+ def mkArray[T] = Array[T]()
+ def foo[T: ClassTag] = mkArray[T]
+ println(foo[Int].getClass)
+}
diff --git a/tests/untried/neg/classtags_dont_use_typetags.check b/tests/untried/neg/classtags_dont_use_typetags.check
new file mode 100644
index 000000000..4f728d267
--- /dev/null
+++ b/tests/untried/neg/classtags_dont_use_typetags.check
@@ -0,0 +1,4 @@
+classtags_dont_use_typetags.scala:4: error: No ClassTag available for T
+ def foo[T: TypeTag] = Array[T]()
+ ^
+one error found
diff --git a/tests/untried/neg/classtags_dont_use_typetags.scala b/tests/untried/neg/classtags_dont_use_typetags.scala
new file mode 100644
index 000000000..3173d8311
--- /dev/null
+++ b/tests/untried/neg/classtags_dont_use_typetags.scala
@@ -0,0 +1,5 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ def foo[T: TypeTag] = Array[T]()
+}
diff --git a/tests/untried/neg/compile-time-only-a.check b/tests/untried/neg/compile-time-only-a.check
new file mode 100644
index 000000000..9bc96f6b9
--- /dev/null
+++ b/tests/untried/neg/compile-time-only-a.check
@@ -0,0 +1,79 @@
+compile-time-only-a.scala:10: error: C3
+@compileTimeOnly("C3") case class C3(x: Int)
+ ^
+compile-time-only-a.scala:12: error: C4
+@compileTimeOnly("C4") case class C4(x: Int)
+ ^
+compile-time-only-a.scala:17: error: C5
+ implicit class C5(val x: Int) {
+ ^
+compile-time-only-a.scala:32: error: C1
+ new C1()
+ ^
+compile-time-only-a.scala:36: error: C2
+ C2
+ ^
+compile-time-only-a.scala:38: error: C3
+ new C3(2)
+ ^
+compile-time-only-a.scala:41: error: C4
+ new C4(2)
+ ^
+compile-time-only-a.scala:45: error: C5
+ 2.ext
+ ^
+compile-time-only-a.scala:46: error: C5
+ C5(2)
+ ^
+compile-time-only-a.scala:49: error: C6.x
+ val _ = c6.x
+ ^
+compile-time-only-a.scala:50: error: C6.foo
+ c6.foo
+ ^
+compile-time-only-a.scala:51: error: C6.Foo
+ type Foo = c6.Foo
+ ^
+compile-time-only-a.scala:52: error: C6.y
+ c6.y = c6.y
+ ^
+compile-time-only-a.scala:52: error: C6.y
+ c6.y = c6.y
+ ^
+compile-time-only-a.scala:54: error: C7
+ val c701: (C7, C7) = ???
+ ^
+compile-time-only-a.scala:55: error: C7
+ val c702: (C7 => C7) = ???
+ ^
+compile-time-only-a.scala:56: error: C7
+ val c703: { val x: C7 } = ???
+ ^
+compile-time-only-a.scala:57: error: C7
+ val c704: AnyRef with C7 = ???
+ ^
+compile-time-only-a.scala:60: error: C7
+ val c706: C7 Either C7 = ???
+ ^
+compile-time-only-a.scala:61: error: C7
+ val c707a: List[C7] = ???
+ ^
+compile-time-only-a.scala:63: error: C7
+ val c708a: T forSome { type T <: C7 } = ???
+ ^
+compile-time-only-a.scala:66: error: C8
+ val c709: (C8[Int], C8[C7]) = ???
+ ^
+compile-time-only-a.scala:67: error: C8
+ val c710: (C8[_] => C8[_]) = ???
+ ^
+compile-time-only-a.scala:74: error: placebo
+class Test {
+ ^
+compile-time-only-a.scala:75: error: placebo
+ @placebo def x = (2: @placebo)
+ ^
+compile-time-only-a.scala:75: error: placebo
+ @placebo def x = (2: @placebo)
+ ^
+26 errors found
diff --git a/tests/untried/neg/compile-time-only-a.scala b/tests/untried/neg/compile-time-only-a.scala
new file mode 100644
index 000000000..130a3c539
--- /dev/null
+++ b/tests/untried/neg/compile-time-only-a.scala
@@ -0,0 +1,76 @@
+import scala.annotation.compileTimeOnly
+import scala.language.existentials
+
+@compileTimeOnly("C1") class C1
+object C1
+
+class C2
+@compileTimeOnly("C2") object C2
+
+@compileTimeOnly("C3") case class C3(x: Int)
+
+@compileTimeOnly("C4") case class C4(x: Int)
+object C4
+
+object pkg {
+ @compileTimeOnly("C5")
+ implicit class C5(val x: Int) {
+ def ext = ???
+ }
+}
+
+class C6(@compileTimeOnly("C6.x") val x: Int) {
+ @compileTimeOnly("C6.foo") def foo = 2
+ @compileTimeOnly("C6.Foo") type Foo = Int
+ @compileTimeOnly("C6.y") var y = 3
+}
+
+@compileTimeOnly("C7") class C7
+@compileTimeOnly("C8") class C8[T]
+
+object Test extends App {
+ new C1()
+ C1
+
+ new C2()
+ C2
+
+ new C3(2)
+ C3(2)
+
+ new C4(2)
+ C4(2)
+
+ import pkg._
+ 2.ext
+ C5(2)
+
+ val c6 = new C6(2)
+ val _ = c6.x
+ c6.foo
+ type Foo = c6.Foo
+ c6.y = c6.y
+
+ val c701: (C7, C7) = ???
+ val c702: (C7 => C7) = ???
+ val c703: { val x: C7 } = ???
+ val c704: AnyRef with C7 = ???
+ // https://groups.google.com/forum/#!topic/scala-internals/5n07TiCnBZU
+ // val c705: ({ @compileTimeOnly("C7") type C7[T] = List[T] })#C7[_] = ???
+ val c706: C7 Either C7 = ???
+ val c707a: List[C7] = ???
+ val c707b = List[C7]()
+ val c708a: T forSome { type T <: C7 } = ???
+ // https://groups.google.com/forum/#!topic/scala-internals/5n07TiCnBZU
+ // val c708b: T forSome { @compileTimeOnly("C7") type T } = ???
+ val c709: (C8[Int], C8[C7]) = ???
+ val c710: (C8[_] => C8[_]) = ???
+}
+
+@compileTimeOnly("placebo")
+class placebo extends scala.annotation.StaticAnnotation
+
+@placebo
+class Test {
+ @placebo def x = (2: @placebo)
+}
diff --git a/tests/untried/neg/compile-time-only-b.check b/tests/untried/neg/compile-time-only-b.check
new file mode 100644
index 000000000..50cdf57fb
--- /dev/null
+++ b/tests/untried/neg/compile-time-only-b.check
@@ -0,0 +1,13 @@
+compile-time-only-b.scala:9: error: splice must be enclosed within a reify {} block
+ val ignored1 = expr.splice
+ ^
+compile-time-only-b.scala:10: error: cannot use value except for signatures of macro implementations
+ val ignored2 = expr.value
+ ^
+compile-time-only-b.scala:13: error: splice must be enclosed within a reify {} block
+ val ignored3 = reify(fortyTwo).splice
+ ^
+compile-time-only-b.scala:14: error: cannot use value except for signatures of macro implementations
+ val ignored4 = reify(fortyTwo).value
+ ^
+four errors found
diff --git a/tests/untried/neg/compile-time-only-b.scala b/tests/untried/neg/compile-time-only-b.scala
new file mode 100644
index 000000000..7636fd38d
--- /dev/null
+++ b/tests/untried/neg/compile-time-only-b.scala
@@ -0,0 +1,15 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ // HAHA!!!
+ // no compileTimeOnly errors here, because scalac does constant folding
+ // the type of reify(42) is Expr[42.type]
+ // therefore the type of expr.splice is 42.type, which is then constfolded
+ val expr = reify(42)
+ val ignored1 = expr.splice
+ val ignored2 = expr.value
+
+ val fortyTwo = 42
+ val ignored3 = reify(fortyTwo).splice
+ val ignored4 = reify(fortyTwo).value
+}
diff --git a/tests/untried/neg/constrs.check b/tests/untried/neg/constrs.check
new file mode 100644
index 000000000..4f4a12bc1
--- /dev/null
+++ b/tests/untried/neg/constrs.check
@@ -0,0 +1,18 @@
+constrs.scala:6: error: type T is not a member of object test
+ def this(y: Int)(z: Int)(t: this.T) = { this(this.u + y + z); Console.println(x) }
+ ^
+constrs.scala:6: error: value u is not a member of object test
+ def this(y: Int)(z: Int)(t: this.T) = { this(this.u + y + z); Console.println(x) }
+ ^
+constrs.scala:10: error: called constructor's definition must precede calling constructor's definition
+ def this() = this("abc")
+ ^
+constrs.scala:12: error: called constructor's definition must precede calling constructor's definition
+ def this(x: Boolean) = this(x)
+ ^
+constrs.scala:16: error: type mismatch;
+ found : Int(1)
+ required: a
+ def this() = this(1)
+ ^
+5 errors found
diff --git a/tests/untried/neg/constrs.scala b/tests/untried/neg/constrs.scala
new file mode 100644
index 000000000..016df098f
--- /dev/null
+++ b/tests/untried/neg/constrs.scala
@@ -0,0 +1,19 @@
+object test {
+
+ abstract class Test(x: Int) {
+ type T;
+ val u = x;
+ def this(y: Int)(z: Int)(t: this.T) = { this(this.u + y + z); Console.println(x) }
+ }
+
+ class Foo(x: Int) {
+ def this() = this("abc")
+ def this(x: String) = this(1)
+ def this(x: Boolean) = this(x)
+ }
+
+ class Bar[a](x: a) {
+ def this() = this(1)
+ }
+
+}
diff --git a/tests/untried/neg/constructor-init-order.check b/tests/untried/neg/constructor-init-order.check
new file mode 100644
index 000000000..9ab6ac592
--- /dev/null
+++ b/tests/untried/neg/constructor-init-order.check
@@ -0,0 +1,9 @@
+constructor-init-order.scala:7: warning: Reference to uninitialized value baz
+ val bar1 = baz // warn
+ ^
+constructor-init-order.scala:17: warning: Reference to uninitialized variable baz
+ var bar1 = baz // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/constructor-init-order.flags b/tests/untried/neg/constructor-init-order.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/constructor-init-order.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/constructor-init-order.scala b/tests/untried/neg/constructor-init-order.scala
new file mode 100644
index 000000000..fe8fec87a
--- /dev/null
+++ b/tests/untried/neg/constructor-init-order.scala
@@ -0,0 +1,23 @@
+trait Foo0 {
+ val quux1: String
+ val quux2 = quux1 // warning here is "future work"
+}
+
+class Foo1 extends Foo0 {
+ val bar1 = baz // warn
+ val bar2 = lazybaz // no warn
+ val bar3 = defbaz // no warn
+ val baz = "oops"
+ lazy val lazybaz = "ok"
+ def defbaz = "ok"
+ val quux1 = "oops"
+}
+
+class Foo2 {
+ var bar1 = baz // warn
+ var bar2 = lazybaz // no warn
+ var bar3 = defbaz // no warn
+ var baz = "oops"
+ lazy val lazybaz = "ok"
+ def defbaz = "ok"
+}
diff --git a/tests/untried/neg/constructor-prefix-error.check b/tests/untried/neg/constructor-prefix-error.check
new file mode 100644
index 000000000..87e948881
--- /dev/null
+++ b/tests/untried/neg/constructor-prefix-error.check
@@ -0,0 +1,4 @@
+constructor-prefix-error.scala:6: error: Outer is not a legal prefix for a constructor
+ val x = new Outer#Inner
+ ^
+one error found
diff --git a/tests/untried/neg/constructor-prefix-error.scala b/tests/untried/neg/constructor-prefix-error.scala
new file mode 100644
index 000000000..c2accea28
--- /dev/null
+++ b/tests/untried/neg/constructor-prefix-error.scala
@@ -0,0 +1,7 @@
+class Outer {
+ class Inner
+}
+
+object Test {
+ val x = new Outer#Inner
+}
diff --git a/tests/untried/neg/cycle-bounds.check b/tests/untried/neg/cycle-bounds.check
new file mode 100644
index 000000000..d924838ae
--- /dev/null
+++ b/tests/untried/neg/cycle-bounds.check
@@ -0,0 +1,4 @@
+cycle-bounds.scala:5: error: illegal cyclic reference involving type T
+class NotOk[T <: Comparable[_ <: T]]
+ ^
+one error found
diff --git a/tests/untried/neg/cycle-bounds.flags b/tests/untried/neg/cycle-bounds.flags
new file mode 100644
index 000000000..ca20f5517
--- /dev/null
+++ b/tests/untried/neg/cycle-bounds.flags
@@ -0,0 +1 @@
+-Ybreak-cycles
diff --git a/tests/untried/neg/cycle-bounds.scala b/tests/untried/neg/cycle-bounds.scala
new file mode 100644
index 000000000..0b43bc703
--- /dev/null
+++ b/tests/untried/neg/cycle-bounds.scala
@@ -0,0 +1,5 @@
+// This should be allowed
+class Ok[T <: Comparable[_ >: T]]
+
+// This is (il)legitimately a cyclic reference
+class NotOk[T <: Comparable[_ <: T]]
diff --git a/tests/untried/neg/cyclics-import.check b/tests/untried/neg/cyclics-import.check
new file mode 100644
index 000000000..be09fca37
--- /dev/null
+++ b/tests/untried/neg/cyclics-import.check
@@ -0,0 +1,6 @@
+cyclics-import.scala:1: error: encountered unrecoverable cycle resolving import.
+Note: this is often due in part to a class depending on a definition nested within its companion.
+If applicable, you may wish to try moving some members into another object.
+import User.UserStatus._
+ ^
+one error found
diff --git a/tests/untried/neg/cyclics-import.scala b/tests/untried/neg/cyclics-import.scala
new file mode 100644
index 000000000..7b510b58e
--- /dev/null
+++ b/tests/untried/neg/cyclics-import.scala
@@ -0,0 +1,17 @@
+import User.UserStatus._
+
+class User {
+ var id: Int = 0
+ var email: String = null
+ var password: String = null
+ var userStatus: UserStatus = null
+}
+
+object User {
+ object UserStatus extends Enumeration {
+ type UserStatus = Value
+
+ val Active = Value("1")
+ val Disabled = Value("2")
+ }
+}
diff --git a/tests/untried/neg/cyclics.check b/tests/untried/neg/cyclics.check
new file mode 100644
index 000000000..c240387d2
--- /dev/null
+++ b/tests/untried/neg/cyclics.check
@@ -0,0 +1,10 @@
+cyclics.scala:2: error: illegal cyclic reference involving type A
+ type A = List[A]
+ ^
+cyclics.scala:3: error: illegal cyclic reference involving type B
+ type B[T] = List[B[B[T]]]
+ ^
+cyclics.scala:5: error: illegal cyclic reference involving type E
+ type C = I { type E = C }
+ ^
+three errors found
diff --git a/tests/untried/neg/cyclics.scala b/tests/untried/neg/cyclics.scala
new file mode 100644
index 000000000..adfc94e4e
--- /dev/null
+++ b/tests/untried/neg/cyclics.scala
@@ -0,0 +1,6 @@
+object test {
+ type A = List[A]
+ type B[T] = List[B[B[T]]]
+ trait I { type E }
+ type C = I { type E = C }
+}
diff --git a/tests/untried/neg/dbldef.check b/tests/untried/neg/dbldef.check
new file mode 100644
index 000000000..b896c4cdc
--- /dev/null
+++ b/tests/untried/neg/dbldef.check
@@ -0,0 +1,12 @@
+dbldef.scala:1: error: x is already defined as value x
+case class test0(x: Int, x: Float)
+ ^
+dbldef.scala:1: error: type mismatch;
+ found : Float
+ required: Int
+case class test0(x: Int, x: Float)
+ ^
+dbldef.scala:1: error: in class test0, multiple overloaded alternatives of x define default arguments
+case class test0(x: Int, x: Float)
+ ^
+three errors found
diff --git a/tests/untried/neg/dbldef.scala b/tests/untried/neg/dbldef.scala
new file mode 100644
index 000000000..c70fb97b2
--- /dev/null
+++ b/tests/untried/neg/dbldef.scala
@@ -0,0 +1 @@
+case class test0(x: Int, x: Float)
diff --git a/tests/untried/neg/deadline-inf-illegal.check b/tests/untried/neg/deadline-inf-illegal.check
new file mode 100644
index 000000000..530d2b244
--- /dev/null
+++ b/tests/untried/neg/deadline-inf-illegal.check
@@ -0,0 +1,15 @@
+deadline-inf-illegal.scala:5: error: value fromNow is not a member of scala.concurrent.duration.Duration
+ d.fromNow
+ ^
+deadline-inf-illegal.scala:6: error: type mismatch;
+ found : scala.concurrent.duration.Duration
+ required: scala.concurrent.duration.FiniteDuration
+ Deadline.now + d
+ ^
+deadline-inf-illegal.scala:7: error: overloaded method value - with alternatives:
+ (other: scala.concurrent.duration.Deadline)scala.concurrent.duration.FiniteDuration <and>
+ (other: scala.concurrent.duration.FiniteDuration)scala.concurrent.duration.Deadline
+ cannot be applied to (scala.concurrent.duration.Duration)
+ Deadline.now - d
+ ^
+three errors found
diff --git a/tests/untried/neg/deadline-inf-illegal.scala b/tests/untried/neg/deadline-inf-illegal.scala
new file mode 100644
index 000000000..942cea701
--- /dev/null
+++ b/tests/untried/neg/deadline-inf-illegal.scala
@@ -0,0 +1,8 @@
+import concurrent.duration.{ Deadline, Duration }
+
+class T {
+ val d: Duration = Duration.Zero
+ d.fromNow
+ Deadline.now + d
+ Deadline.now - d
+}
diff --git a/tests/untried/neg/delayed-init-ref.check b/tests/untried/neg/delayed-init-ref.check
new file mode 100644
index 000000000..90bc02796
--- /dev/null
+++ b/tests/untried/neg/delayed-init-ref.check
@@ -0,0 +1,16 @@
+delayed-init-ref.scala:17: warning: Selecting value vall from object O, which extends scala.DelayedInit, is likely to yield an uninitialized value
+ println(O.vall) // warn
+ ^
+delayed-init-ref.scala:19: warning: Selecting value vall from object O, which extends scala.DelayedInit, is likely to yield an uninitialized value
+ println(vall) // warn
+ ^
+delayed-init-ref.scala:28: warning: trait DelayedInit in package scala is deprecated: DelayedInit semantics can be surprising. Support for `App` will continue.
+See the release notes for more details: https://github.com/scala/scala/releases/tag/v2.11.0-RC1
+trait Before extends DelayedInit {
+ ^
+delayed-init-ref.scala:40: warning: Selecting value foo from trait UserContext, which extends scala.DelayedInit, is likely to yield an uninitialized value
+ println({locally(()); this}.foo) // warn (spurious, but we can't discriminate)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/delayed-init-ref.flags b/tests/untried/neg/delayed-init-ref.flags
new file mode 100644
index 000000000..88a3e4c67
--- /dev/null
+++ b/tests/untried/neg/delayed-init-ref.flags
@@ -0,0 +1 @@
+-deprecation -Xlint -Xfatal-warnings
diff --git a/tests/untried/neg/delayed-init-ref.scala b/tests/untried/neg/delayed-init-ref.scala
new file mode 100644
index 000000000..f2aa804e2
--- /dev/null
+++ b/tests/untried/neg/delayed-init-ref.scala
@@ -0,0 +1,42 @@
+trait T {
+ val traitVal = ""
+}
+
+object O extends App with T {
+ val vall = ""
+ lazy val lazyy = ""
+ def deff = ""
+
+ println(vall) // no warn
+ new {
+ println(vall) // no warn
+ }
+}
+
+object Client {
+ println(O.vall) // warn
+ import O.vall
+ println(vall) // warn
+
+ println(O.lazyy) // no warn
+ println(O.deff) // no warn
+ println(O.traitVal) // no warn
+}
+
+// Delayed init usage pattern from Specs2
+// See: https://groups.google.com/d/msg/scala-sips/wP6dL8nIAQs/ogjoPE-MSVAJ
+trait Before extends DelayedInit {
+ def before()
+ override def delayedInit(x: => Unit): Unit = { before; x }
+}
+object Spec {
+ trait UserContext extends Before {
+ def before() = ()
+ val foo = "foo"
+ }
+ new UserContext {
+ println(foo) // no warn
+ println(this.foo) // no warn
+ println({locally(()); this}.foo) // warn (spurious, but we can't discriminate)
+ }
+}
diff --git a/tests/untried/neg/depmet_1.check b/tests/untried/neg/depmet_1.check
new file mode 100644
index 000000000..7a4f845fd
--- /dev/null
+++ b/tests/untried/neg/depmet_1.check
@@ -0,0 +1,10 @@
+depmet_1.scala:2: error: illegal dependent method type: parameter appears in the type of another parameter in the same section or an earlier one
+ def precise0(y: x.type)(x: String): Unit = {}
+ ^
+depmet_1.scala:3: error: illegal dependent method type: parameter appears in the type of another parameter in the same section or an earlier one
+ def precise1(x: String, y: x.type): Unit = {}
+ ^
+depmet_1.scala:4: error: not found: value y
+ def precise2[T <: y.type](y: String): Unit = {}
+ ^
+three errors found
diff --git a/tests/untried/neg/depmet_1.scala b/tests/untried/neg/depmet_1.scala
new file mode 100644
index 000000000..9388b2c9a
--- /dev/null
+++ b/tests/untried/neg/depmet_1.scala
@@ -0,0 +1,5 @@
+object Test {
+ def precise0(y: x.type)(x: String): Unit = {}
+ def precise1(x: String, y: x.type): Unit = {}
+ def precise2[T <: y.type](y: String): Unit = {}
+}
diff --git a/tests/untried/neg/divergent-implicit.check b/tests/untried/neg/divergent-implicit.check
new file mode 100644
index 000000000..60d876409
--- /dev/null
+++ b/tests/untried/neg/divergent-implicit.check
@@ -0,0 +1,16 @@
+divergent-implicit.scala:4: error: type mismatch;
+ found : Int(1)
+ required: String
+ val x1: String = 1
+ ^
+divergent-implicit.scala:14: error: type mismatch;
+ found : Test2.Foo
+ required: Test2.Bar
+ val x: Bar = new Foo
+ ^
+divergent-implicit.scala:15: error: type mismatch;
+ found : Test2.Baz
+ required: Test2.Bar
+ val y: Bar = new Baz
+ ^
+three errors found
diff --git a/tests/untried/neg/divergent-implicit.scala b/tests/untried/neg/divergent-implicit.scala
new file mode 100644
index 000000000..4a356d54f
--- /dev/null
+++ b/tests/untried/neg/divergent-implicit.scala
@@ -0,0 +1,16 @@
+object Test1 {
+ implicit def cast[A, B](x: A)(implicit c: A => B): B = c(x)
+
+ val x1: String = 1
+ val x2: String = cast[Int, String](1)
+}
+object Test2 {
+ class Foo
+ class Bar
+ class Baz
+ implicit def foo2bar(x: Foo)(implicit baz2bar: Baz => Bar): Bar = baz2bar(new Baz)
+ implicit def baz2bar(x: Baz)(implicit foo2bar: Foo => Bar): Bar = foo2bar(new Foo)
+
+ val x: Bar = new Foo
+ val y: Bar = new Baz
+}
diff --git a/tests/untried/neg/dotless-targs.check b/tests/untried/neg/dotless-targs.check
new file mode 100644
index 000000000..4aab939f6
--- /dev/null
+++ b/tests/untried/neg/dotless-targs.check
@@ -0,0 +1,4 @@
+dotless-targs.scala:2: error: type application is not allowed for postfix operators
+ def f1 = "f1" isInstanceOf[String] // not ok
+ ^
+one error found
diff --git a/tests/untried/neg/dotless-targs.scala b/tests/untried/neg/dotless-targs.scala
new file mode 100644
index 000000000..eff63cbec
--- /dev/null
+++ b/tests/untried/neg/dotless-targs.scala
@@ -0,0 +1,5 @@
+class A {
+ def f1 = "f1" isInstanceOf[String] // not ok
+ def f2 = "f2".isInstanceOf[String] // ok
+ def f3 = "f3" toList // ok
+}
diff --git a/tests/untried/neg/error_dependentMethodTpeConversionToFunction.check b/tests/untried/neg/error_dependentMethodTpeConversionToFunction.check
new file mode 100644
index 000000000..3496a552c
--- /dev/null
+++ b/tests/untried/neg/error_dependentMethodTpeConversionToFunction.check
@@ -0,0 +1,4 @@
+error_dependentMethodTpeConversionToFunction.scala:4: error: method with dependent type (x: AnyRef)x.type cannot be converted to function value
+ val x: Any => Any = foo
+ ^
+one error found
diff --git a/tests/untried/neg/error_dependentMethodTpeConversionToFunction.scala b/tests/untried/neg/error_dependentMethodTpeConversionToFunction.scala
new file mode 100644
index 000000000..d0c4cb48a
--- /dev/null
+++ b/tests/untried/neg/error_dependentMethodTpeConversionToFunction.scala
@@ -0,0 +1,5 @@
+// test DependentMethodTpeConversionToFunctionError
+object Test {
+ def foo(x: AnyRef): x.type = x
+ val x: Any => Any = foo
+}
diff --git a/tests/untried/neg/error_tooManyArgsPattern.check b/tests/untried/neg/error_tooManyArgsPattern.check
new file mode 100644
index 000000000..ee401ad06
--- /dev/null
+++ b/tests/untried/neg/error_tooManyArgsPattern.check
@@ -0,0 +1,4 @@
+error_tooManyArgsPattern.scala:3: error: too many arguments for unapply pattern, maximum = 22
+ case List(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23) => 7
+ ^
+one error found
diff --git a/tests/untried/neg/error_tooManyArgsPattern.scala b/tests/untried/neg/error_tooManyArgsPattern.scala
new file mode 100644
index 000000000..d55ba6100
--- /dev/null
+++ b/tests/untried/neg/error_tooManyArgsPattern.scala
@@ -0,0 +1,5 @@
+object Test {
+ def test(xs: Any) = xs match { // test error message TooManyArgsPatternError
+ case List(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23) => 7
+ }
+}
diff --git a/tests/untried/neg/eta-expand-star-deprecation.check b/tests/untried/neg/eta-expand-star-deprecation.check
new file mode 100644
index 000000000..a79f0df76
--- /dev/null
+++ b/tests/untried/neg/eta-expand-star-deprecation.check
@@ -0,0 +1,4 @@
+warning: -Yeta-expand-keeps-star 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.
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/eta-expand-star-deprecation.flags b/tests/untried/neg/eta-expand-star-deprecation.flags
new file mode 100644
index 000000000..5ac8b638e
--- /dev/null
+++ b/tests/untried/neg/eta-expand-star-deprecation.flags
@@ -0,0 +1 @@
+-Yeta-expand-keeps-star -deprecation -Xfatal-warnings
diff --git a/tests/untried/neg/eta-expand-star-deprecation.scala b/tests/untried/neg/eta-expand-star-deprecation.scala
new file mode 100644
index 000000000..574969252
--- /dev/null
+++ b/tests/untried/neg/eta-expand-star-deprecation.scala
@@ -0,0 +1,8 @@
+object Test {
+ def f[T](xs: T*): Unit = ()
+ def g[T] = f[T] _
+
+ def main(args: Array[String]): Unit = {
+ g(1, 2)
+ }
+}
diff --git a/tests/untried/neg/eta-expand-star.check b/tests/untried/neg/eta-expand-star.check
new file mode 100644
index 000000000..6765d504f
--- /dev/null
+++ b/tests/untried/neg/eta-expand-star.check
@@ -0,0 +1,4 @@
+eta-expand-star.scala:6: error: too many arguments for method apply: (v1: Seq[T])Unit in trait Function1
+ g(1, 2)
+ ^
+one error found
diff --git a/tests/untried/neg/eta-expand-star.scala b/tests/untried/neg/eta-expand-star.scala
new file mode 100644
index 000000000..574969252
--- /dev/null
+++ b/tests/untried/neg/eta-expand-star.scala
@@ -0,0 +1,8 @@
+object Test {
+ def f[T](xs: T*): Unit = ()
+ def g[T] = f[T] _
+
+ def main(args: Array[String]): Unit = {
+ g(1, 2)
+ }
+}
diff --git a/tests/untried/neg/exhausting.check b/tests/untried/neg/exhausting.check
new file mode 100644
index 000000000..619849693
--- /dev/null
+++ b/tests/untried/neg/exhausting.check
@@ -0,0 +1,27 @@
+exhausting.scala:21: warning: match may not be exhaustive.
+It would fail on the following inputs: List(_), List(_, _, _)
+ def fail1[T](xs: List[T]) = xs match {
+ ^
+exhausting.scala:27: warning: match may not be exhaustive.
+It would fail on the following input: Nil
+ def fail2[T](xs: List[T]) = xs match {
+ ^
+exhausting.scala:32: warning: match may not be exhaustive.
+It would fail on the following input: List((x: Int forSome x not in (1, 2)))
+ def fail3a(xs: List[Int]) = xs match {
+ ^
+exhausting.scala:39: warning: match may not be exhaustive.
+It would fail on the following input: Bar3
+ def fail3[T](x: Foo[T]) = x match {
+ ^
+exhausting.scala:47: warning: match may not be exhaustive.
+It would fail on the following inputs: (Bar1, Bar2), (Bar1, Bar3), (Bar2, Bar1), (Bar2, Bar2)
+ def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match {
+ ^
+exhausting.scala:56: warning: match may not be exhaustive.
+It would fail on the following inputs: (Bar1, Bar2), (Bar1, Bar3), (Bar2, Bar1), (Bar2, Bar2)
+ def fail5[T](xx: (Foo[T], Foo[T])) = xx match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+6 warnings found
+one error found
diff --git a/tests/untried/neg/exhausting.flags b/tests/untried/neg/exhausting.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/exhausting.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/exhausting.scala b/tests/untried/neg/exhausting.scala
new file mode 100644
index 000000000..c00569c91
--- /dev/null
+++ b/tests/untried/neg/exhausting.scala
@@ -0,0 +1,61 @@
+object Test {
+ sealed abstract class Foo[T]
+ case object Bar1 extends Foo[Int]
+ case object Bar2 extends Foo[String]
+ case object Bar3 extends Foo[Any]
+
+ def ex1[T](xs: List[T]) = xs match {
+ case ys: List[_] => "ok"
+ }
+ def ex2[T](xx: (Foo[T], Foo[T])) = xx match {
+ case (Bar1, Bar1) => ()
+ case (_, Bar1) => ()
+ case (_, Bar3) => ()
+ case (_, Bar2) => ()
+ }
+ def ex3[T](xx: (Foo[T], Foo[T])) = xx match {
+ case (_: Foo[_], _: Foo[_]) => ()
+ }
+
+ // fails for: ::(_, Nil), ::(_, ::(_, ::(_, _))), ...
+ def fail1[T](xs: List[T]) = xs match {
+ case Nil => "ok"
+ case x :: y :: Nil => "ok"
+ }
+
+ // fails for: Nil
+ def fail2[T](xs: List[T]) = xs match {
+ case _ :: _ => "ok"
+ }
+
+ // fails for: ::(<not in (2, 1)>, _)
+ def fail3a(xs: List[Int]) = xs match {
+ case 1 :: _ =>
+ case 2 :: _ =>
+ case Nil =>
+ }
+
+ // fails for: Bar3
+ def fail3[T](x: Foo[T]) = x match {
+ case Bar1 => "ok"
+ case Bar2 => "ok"
+ }
+ // fails for: (Bar1, Bar2)
+ // fails for: (Bar1, Bar3)
+ // fails for: (Bar2, Bar2)
+ // fails for: (Bar2, Bar1)
+ def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match {
+ case (Bar1, Bar1) => ()
+ case (Bar2, Bar3) => ()
+ case (Bar3, _) => ()
+ }
+ // fails for: (Bar1, Bar2)
+ // fails for: (Bar1, Bar3)
+ // fails for: (Bar2, Bar1)
+ // fails for: (Bar2, Bar2)
+ def fail5[T](xx: (Foo[T], Foo[T])) = xx match {
+ case (Bar1, Bar1) => ()
+ case (Bar2, Bar3) => ()
+ case (Bar3, _) => ()
+ }
+}
diff --git a/tests/untried/neg/faculty.check b/tests/untried/neg/faculty.check
new file mode 100644
index 000000000..b1d1d4c9f
--- /dev/null
+++ b/tests/untried/neg/faculty.check
@@ -0,0 +1,4 @@
+faculty.scala:3: error: recursive method faculty needs result type
+ def faculty(x: Int) = if (x == 0) 1 else x * faculty(x - 1)
+ ^
+one error found
diff --git a/tests/untried/neg/faculty.scala b/tests/untried/neg/faculty.scala
new file mode 100644
index 000000000..1f137a48f
--- /dev/null
+++ b/tests/untried/neg/faculty.scala
@@ -0,0 +1,5 @@
+object Test {
+
+ def faculty(x: Int) = if (x == 0) 1 else x * faculty(x - 1)
+
+}
diff --git a/tests/untried/neg/finitary-error.check b/tests/untried/neg/finitary-error.check
new file mode 100644
index 000000000..7bc92058c
--- /dev/null
+++ b/tests/untried/neg/finitary-error.check
@@ -0,0 +1,4 @@
+finitary-error.scala:3: error: class graph is not finitary because type parameter T is expansively recursive
+trait C[T] extends A[C[B[T]]]
+ ^
+one error found
diff --git a/tests/untried/neg/finitary-error.scala b/tests/untried/neg/finitary-error.scala
new file mode 100644
index 000000000..a48fcdc70
--- /dev/null
+++ b/tests/untried/neg/finitary-error.scala
@@ -0,0 +1,3 @@
+trait A[T]
+trait B[T]
+trait C[T] extends A[C[B[T]]]
diff --git a/tests/untried/neg/for-comprehension-old.check b/tests/untried/neg/for-comprehension-old.check
new file mode 100644
index 000000000..1ecaf12af
--- /dev/null
+++ b/tests/untried/neg/for-comprehension-old.check
@@ -0,0 +1,26 @@
+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
+ ^
+for-comprehension-old.scala:5: error: val in for comprehension must be followed by assignment
+ for (val x <- 1 to 5 ; val y = x) yield x+y // fail
+ ^
+for-comprehension-old.scala:9: error: val in for comprehension must be followed by assignment
+ for (z <- 1 to 2 ; val x <- 1 to 5 ; y = x) yield x+y // fail
+ ^
+for-comprehension-old.scala:10: error: val in for comprehension must be followed by assignment
+ for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail
+ ^
+four warnings found
+four errors found
diff --git a/tests/untried/neg/for-comprehension-old.flags b/tests/untried/neg/for-comprehension-old.flags
new file mode 100644
index 000000000..dcc59ebe3
--- /dev/null
+++ b/tests/untried/neg/for-comprehension-old.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/tests/untried/neg/for-comprehension-old.scala b/tests/untried/neg/for-comprehension-old.scala
new file mode 100644
index 000000000..10ae363bd
--- /dev/null
+++ b/tests/untried/neg/for-comprehension-old.scala
@@ -0,0 +1,11 @@
+class A {
+ for (x <- 1 to 5 ; y = x) yield x+y // ok
+ for (x <- 1 to 5 ; val y = x) yield x+y // fail
+ for (val x <- 1 to 5 ; y = x) yield x+y // fail
+ for (val x <- 1 to 5 ; val y = x) yield x+y // fail
+
+ for (z <- 1 to 2 ; x <- 1 to 5 ; y = x) yield x+y // ok
+ for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // fail
+ for (z <- 1 to 2 ; val x <- 1 to 5 ; y = x) yield x+y // fail
+ for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail
+}
diff --git a/tests/untried/neg/forgot-interpolator.check b/tests/untried/neg/forgot-interpolator.check
new file mode 100644
index 000000000..898845898
--- /dev/null
+++ b/tests/untried/neg/forgot-interpolator.check
@@ -0,0 +1,27 @@
+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 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 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 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 4
+ ^
+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: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.
+8 warnings found
+one error found
diff --git a/tests/untried/neg/forgot-interpolator.flags b/tests/untried/neg/forgot-interpolator.flags
new file mode 100644
index 000000000..7949c2afa
--- /dev/null
+++ b/tests/untried/neg/forgot-interpolator.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings
diff --git a/tests/untried/neg/forgot-interpolator.scala b/tests/untried/neg/forgot-interpolator.scala
new file mode 100644
index 000000000..a53054d89
--- /dev/null
+++ b/tests/untried/neg/forgot-interpolator.scala
@@ -0,0 +1,93 @@
+class A {
+ val bippy = 123
+
+ def f = "Put the $bippy in the $bippy!" // warn 1
+}
+
+class B {
+ val dingus = 123
+
+ def f = "Put the $bippy in the $bippy!" // no warn
+}
+
+class C {
+ def f = """Put the ${println("bippy")} in the bippy!""" // warn 2
+}
+
+package object test {
+ def aleppo = 9
+ def greppo(n: Int) = ???
+ def zappos(n: Int)(implicit ord: math.Ordering[Int]) = ???
+ def hippo(implicit n: Int) = ???
+}
+
+package test {
+ // not sure if overloading is kosher in pkg obj yet
+ class Doo {
+ def beppo(i: Int) = 8 * i
+ def beppo = 8
+ class Dah extends Doo {
+ def f = "$beppo was a marx bros who saw dollars." // warn 3
+ }
+ }
+ class E {
+ 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?" // no longer a warning, private members aren't inherited!
+ }
+ 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 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/tests/untried/neg/forward.check b/tests/untried/neg/forward.check
new file mode 100644
index 000000000..252c99037
--- /dev/null
+++ b/tests/untried/neg/forward.check
@@ -0,0 +1,10 @@
+forward.scala:6: error: forward reference extends over definition of value x
+ def f: Int = x;
+ ^
+forward.scala:10: error: forward reference extends over definition of value x
+ def f: Int = g;
+ ^
+forward.scala:15: error: forward reference extends over definition of variable x
+ def f: Int = g;
+ ^
+three errors found
diff --git a/tests/untried/neg/forward.scala b/tests/untried/neg/forward.scala
new file mode 100644
index 000000000..d5c0851f0
--- /dev/null
+++ b/tests/untried/neg/forward.scala
@@ -0,0 +1,24 @@
+object Test {
+ def f: Int = x;
+ val x: Int = f;
+
+ {
+ def f: Int = x;
+ val x: Int = f;
+ }
+ {
+ def f: Int = g;
+ val x: Int = f;
+ def g: Int = x;
+ }
+ {
+ def f: Int = g;
+ var x: Int = f;
+ def g: Int = x;
+ }
+ {
+ def f: Int = g;
+ Console.println("foo");
+ def g: Int = f;
+ }
+}
diff --git a/tests/untried/neg/found-req-variance.check b/tests/untried/neg/found-req-variance.check
new file mode 100644
index 000000000..cc26458ac
--- /dev/null
+++ b/tests/untried/neg/found-req-variance.check
@@ -0,0 +1,185 @@
+found-req-variance.scala:22: error: type mismatch;
+ found : Inv[B]
+ required: Inv[A]
+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]
+ def ff1 = f[B, B](h[A, A]) // fail
+ ^
+found-req-variance.scala:48: error: type mismatch;
+ found : FF1[B,A]
+ required: FF1[B,B]
+ def ff2 = f[B, B](h[B, A]) // fail
+ ^
+found-req-variance.scala:49: error: type mismatch;
+ found : FF1[C,A]
+ required: FF1[B,B]
+ def ff3 = f[B, B](h[C, A]) // fail
+ ^
+found-req-variance.scala:50: error: type mismatch;
+ found : FF1[A,B]
+ required: FF1[B,B]
+Note: A >: B, but trait FF1 is invariant in type T.
+You may wish to define T as -T instead. (SLS 4.5)
+ def ff4 = f[B, B](h[A, B]) // suggest
+ ^
+found-req-variance.scala:52: error: type mismatch;
+ found : FF1[C,B]
+ required: FF1[B,B]
+Note: C <: B, but trait FF1 is invariant in type T.
+You may wish to define T as +T instead. (SLS 4.5)
+ def ff6 = f[B, B](h[C, B]) // suggest
+ ^
+found-req-variance.scala:53: error: type mismatch;
+ found : FF1[A,C]
+ required: FF1[B,B]
+Note: A >: B, but trait FF1 is invariant in type T.
+You may wish to define T as -T instead. (SLS 4.5)
+ def ff7 = f[B, B](h[A, C]) // suggest
+ ^
+found-req-variance.scala:55: error: type mismatch;
+ found : FF1[C,C]
+ required: FF1[B,B]
+Note: C <: B, but trait FF1 is invariant in type T.
+You may wish to define T as +T instead. (SLS 4.5)
+ def ff9 = f[B, B](h[C, C]) // suggest
+ ^
+found-req-variance.scala:61: error: type mismatch;
+ found : FF2[A,A]
+ required: FF2[B,B]
+Note: A >: B, but trait FF2 is invariant in type R.
+You may wish to define R as -R instead. (SLS 4.5)
+ def ff1 = f[B, B](h[A, A]) // suggest
+ ^
+found-req-variance.scala:62: error: type mismatch;
+ found : FF2[B,A]
+ required: FF2[B,B]
+Note: A >: B, but trait FF2 is invariant in type R.
+You may wish to define R as -R instead. (SLS 4.5)
+ def ff2 = f[B, B](h[B, A]) // suggest
+ ^
+found-req-variance.scala:63: error: type mismatch;
+ found : FF2[C,A]
+ required: FF2[B,B]
+ def ff3 = f[B, B](h[C, A]) // fail
+ ^
+found-req-variance.scala:66: error: type mismatch;
+ found : FF2[C,B]
+ required: FF2[B,B]
+ def ff6 = f[B, B](h[C, B]) // fail
+ ^
+found-req-variance.scala:67: error: type mismatch;
+ found : FF2[A,C]
+ required: FF2[B,B]
+Note: C <: B, but trait FF2 is invariant in type R.
+You may wish to define R as +R instead. (SLS 4.5)
+ def ff7 = f[B, B](h[A, C]) // suggest
+ ^
+found-req-variance.scala:68: error: type mismatch;
+ found : FF2[B,C]
+ required: FF2[B,B]
+Note: C <: B, but trait FF2 is invariant in type R.
+You may wish to define R as +R instead. (SLS 4.5)
+ def ff8 = f[B, B](h[B, C]) // suggest
+ ^
+found-req-variance.scala:69: error: type mismatch;
+ found : FF2[C,C]
+ required: FF2[B,B]
+ def ff9 = f[B, B](h[C, C]) // fail
+ ^
+found-req-variance.scala:86: error: type mismatch;
+ found : java.util.ArrayList[String]
+ required: java.util.List[AnyRef]
+Note: String <: AnyRef, but Java-defined trait List is invariant in type E.
+You may wish to investigate a wildcard type such as `_ <: AnyRef`. (SLS 3.2.10)
+ def g1 = f[AnyRef](new java.util.ArrayList[String] { })
+ ^
+found-req-variance.scala:87: error: type mismatch;
+ found : scala.math.Ordering[AnyRef]
+ required: java.util.Comparator[String]
+Note: AnyRef >: String, but Java-defined trait Comparator is invariant in type T.
+You may wish to investigate a wildcard type such as `_ >: String`. (SLS 3.2.10)
+ def g2 = g[String](Ordering.fromLessThan[AnyRef](_.toString < _.toString))
+ ^
+found-req-variance.scala:94: error: type mismatch;
+ found : Misc.MyData
+ required: Misc.Data[AnyVal]
+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]
+Note: String <: CharSequence, but trait Set is invariant in type A.
+You may wish to investigate a wildcard type such as `_ <: CharSequence`. (SLS 3.2.10)
+ foo(s)
+ ^
+found-req-variance.scala:104: error: type mismatch;
+ found : Misc.Trippy[String,String,String]
+ required: Misc.Trippy[Object,Object,Object]
+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]
+Note: AnyRef >: String, but trait Map is invariant in type A.
+You may wish to investigate a wildcard type such as `_ >: String`. (SLS 3.2.10)
+ def g2 = Set[Map[String, String]]() + Map[AnyRef, String]()
+ ^
+28 errors found
diff --git a/tests/untried/neg/found-req-variance.scala b/tests/untried/neg/found-req-variance.scala
new file mode 100644
index 000000000..de460f2d0
--- /dev/null
+++ b/tests/untried/neg/found-req-variance.scala
@@ -0,0 +1,106 @@
+import scala.collection.mutable.ListBuffer
+
+class A
+class B extends A
+class C extends B
+
+trait FF1[T, +R]
+trait FF2[-T, R]
+
+class Inv[T]
+class InvA extends Inv[A]
+class InvB extends Inv[B]
+class InvC extends Inv[C]
+
+class Multi[+Cov, Inv, -Con]
+class MultiCov[+T <: A] extends Multi[T, B, C]
+class MultiInv[T] extends Multi[A, T, C]
+class MultiCon[-T >: C] extends Multi[A, B, T]
+
+object Test {
+ def f1 = Set[Inv[A]]() + new Inv[A]
+ def f2 = Set[Inv[A]]() + new Inv[B]
+ def f3 = Set[Inv[A]]() + new Inv[C]
+ def f4 = Set[Inv[B]]() + new Inv[A]
+ def f5 = Set[Inv[B]]() + new Inv[B]
+ def f6 = Set[Inv[B]]() + new Inv[C]
+ def f7 = Set[Inv[C]]() + new Inv[A]
+ def f8 = Set[Inv[C]]() + new Inv[B]
+ def f9 = Set[Inv[C]]() + new Inv[C]
+
+ def g1 = Set[Multi[A, B, C]]() + new MultiCov[A]
+ def g2 = Set[Multi[A, B, C]]() + new MultiCov[B]
+ def g3 = Set[Multi[A, B, C]]() + new MultiCov[C]
+ def g4 = Set[Multi[A, B, C]]() + new MultiInv[A]
+ def g5 = Set[Multi[A, B, C]]() + new MultiInv[B]
+ def g6 = Set[Multi[A, B, C]]() + new MultiInv[C]
+ def g7 = Set[Multi[A, B, C]]() + new MultiCon[A]
+ def g8 = Set[Multi[A, B, C]]() + new MultiCon[B]
+ def g9 = Set[Multi[A, B, C]]() + new MultiCon[C]
+}
+
+object Functions {
+ object Set1 {
+ def f[T, R](x: FF1[T, R]) = ()
+ def h[T, R] : FF1[T, R] = sys.error("")
+
+ def ff1 = f[B, B](h[A, A]) // fail
+ def ff2 = f[B, B](h[B, A]) // fail
+ def ff3 = f[B, B](h[C, A]) // fail
+ def ff4 = f[B, B](h[A, B]) // suggest
+ def ff5 = f[B, B](h[B, B]) // ok
+ def ff6 = f[B, B](h[C, B]) // suggest
+ def ff7 = f[B, B](h[A, C]) // suggest
+ def ff8 = f[B, B](h[B, C]) // ok
+ def ff9 = f[B, B](h[C, C]) // suggest
+ }
+ object Set2 {
+ def f[T, R](x: FF2[T, R]) = ()
+ def h[T, R] : FF2[T, R] = sys.error("")
+
+ def ff1 = f[B, B](h[A, A]) // suggest
+ def ff2 = f[B, B](h[B, A]) // suggest
+ def ff3 = f[B, B](h[C, A]) // fail
+ def ff4 = f[B, B](h[A, B]) // ok
+ def ff5 = f[B, B](h[B, B]) // ok
+ def ff6 = f[B, B](h[C, B]) // fail
+ def ff7 = f[B, B](h[A, C]) // suggest
+ def ff8 = f[B, B](h[B, C]) // suggest
+ def ff9 = f[B, B](h[C, C]) // fail
+ }
+}
+
+// TODO
+// object TypeAlias {
+// type LL[T] = List[T]
+// val LL = List
+//
+// def f1 = Set[LL[B]]() + LL[A](new A)
+// def f2 = Set[LL[B]]() + LL[C](new C)
+// }
+
+object Javas {
+ def f[T](x: java.util.List[T]) = ()
+ def g[T](x: java.util.Comparator[T]) = ()
+
+ def g1 = f[AnyRef](new java.util.ArrayList[String] { })
+ def g2 = g[String](Ordering.fromLessThan[AnyRef](_.toString < _.toString))
+}
+
+object Misc {
+ // original motivation
+ class Data[A <: AnyVal]
+ class MyData extends Data[Int] { }
+ def f1 = Set[Data[AnyVal]]() + new MyData
+
+ // from stackoverflow
+ def foo(s: Set[CharSequence]): Unit = ()
+ def f4 = {
+ val s: Set[String] = Set("Hello", "World");
+ foo(s)
+ }
+
+ class Trippy[+T1, T2, +T3]
+ def g1 = Set[Trippy[AnyRef, AnyRef, AnyRef]]() + new Trippy[String, String, String]
+ def g2 = Set[Map[String, String]]() + Map[AnyRef, String]()
+}
diff --git a/tests/untried/neg/gadts1.check b/tests/untried/neg/gadts1.check
new file mode 100644
index 000000000..9b7ea5556
--- /dev/null
+++ b/tests/untried/neg/gadts1.check
@@ -0,0 +1,9 @@
+gadts1.scala:20: error: Test.Cell[a] does not take parameters
+ case Cell[a](x: Int) => c.x = 5
+ ^
+gadts1.scala:20: error: type mismatch;
+ found : Int(5)
+ required: a
+ case Cell[a](x: Int) => c.x = 5
+ ^
+two errors found
diff --git a/tests/untried/neg/gadts1.scala b/tests/untried/neg/gadts1.scala
new file mode 100644
index 000000000..08403e6ee
--- /dev/null
+++ b/tests/untried/neg/gadts1.scala
@@ -0,0 +1,33 @@
+object Test{
+
+abstract class Number
+case class Int(n: scala.Int) extends Number
+case class Double(d: scala.Double) extends Number
+
+trait Term[+a]
+case class Cell[a](var x: a) extends Term[a]
+case class NumTerm(val n: Number) extends Term[Number]
+class IntTerm(n: Int) extends NumTerm(n) with Term[Int]
+
+
+def f[a](t:Term[a], c:Cell[a]): Unit = {
+ t match {
+ case NumTerm(n) => c.x = Double(1.0)
+ }
+ t match {
+ // presently testing that this gets past the parser: eventually
+ // it should actually work.
+ case Cell[a](x: Int) => c.x = 5
+ }
+}
+
+
+val x:Term[Number] = NumTerm(Int(5))
+
+def main(args: Array[String]): Unit = {
+ val cell = Cell[Int](Int(6))
+ Console.println(cell)
+ f[Int](new IntTerm(Int(5)), cell)
+ Console.println(cell)
+}
+}
diff --git a/tests/untried/neg/gadts2-strict.check b/tests/untried/neg/gadts2-strict.check
new file mode 100644
index 000000000..960b35ed2
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/gadts2-strict.flags b/tests/untried/neg/gadts2-strict.flags
new file mode 100644
index 000000000..19243266d
--- /dev/null
+++ b/tests/untried/neg/gadts2-strict.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/tests/untried/neg/gadts2-strict.scala b/tests/untried/neg/gadts2-strict.scala
new file mode 100644
index 000000000..0edceca7f
--- /dev/null
+++ b/tests/untried/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]): Unit = {
+ t match {
+ case NumTerm(n) => c.x = MyDouble(1.0)
+ }
+ }
+
+ val x: Term[Number] = NumTerm(MyInt(5))
+
+ def main(args: Array[String]): Unit = {
+ val cell = Cell[Number](MyInt(6))
+ Console.println(cell)
+ f[Number](new NumTerm(MyInt(5)), cell)
+ Console.println(cell)
+ }
+}
diff --git a/tests/untried/neg/gadts2.check b/tests/untried/neg/gadts2.check
new file mode 100644
index 000000000..dc21f3f52
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/gadts2.flags b/tests/untried/neg/gadts2.flags
new file mode 100644
index 000000000..19243266d
--- /dev/null
+++ b/tests/untried/neg/gadts2.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/tests/untried/neg/gadts2.scala b/tests/untried/neg/gadts2.scala
new file mode 100644
index 000000000..156944b8d
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/higherkind_novalue.check b/tests/untried/neg/higherkind_novalue.check
new file mode 100644
index 000000000..932f7876b
--- /dev/null
+++ b/tests/untried/neg/higherkind_novalue.check
@@ -0,0 +1,7 @@
+higherkind_novalue.scala:2: error: type m takes type parameters
+ val x: m // type of kind *->* doesn't classify a value, but a val/def/... can only contain/return a value
+ ^
+higherkind_novalue.scala:3: error: type m takes type parameters
+ def y: m
+ ^
+two errors found
diff --git a/tests/untried/neg/higherkind_novalue.scala b/tests/untried/neg/higherkind_novalue.scala
new file mode 100644
index 000000000..9c1480c3b
--- /dev/null
+++ b/tests/untried/neg/higherkind_novalue.scala
@@ -0,0 +1,4 @@
+abstract class HigherKind[m[s]] {
+ val x: m // type of kind *->* doesn't classify a value, but a val/def/... can only contain/return a value
+ def y: m
+}
diff --git a/tests/untried/neg/hk-bad-bounds.check b/tests/untried/neg/hk-bad-bounds.check
new file mode 100644
index 000000000..d6293993c
--- /dev/null
+++ b/tests/untried/neg/hk-bad-bounds.check
@@ -0,0 +1,4 @@
+hk-bad-bounds.scala:4: error: type arguments [Set] do not conform to class SeqFactory's type parameter bounds [CC[X] <: Seq[X] with scala.collection.generic.GenericTraversableTemplate[X,CC]]
+ def f(x: Boolean) = if (x) (null: SeqFactory[List]) else (null: SeqFactory[Set])
+ ^
+one error found
diff --git a/tests/untried/neg/hk-bad-bounds.scala b/tests/untried/neg/hk-bad-bounds.scala
new file mode 100644
index 000000000..0ed0b4c38
--- /dev/null
+++ b/tests/untried/neg/hk-bad-bounds.scala
@@ -0,0 +1,5 @@
+import collection.generic.SeqFactory
+
+class A {
+ def f(x: Boolean) = if (x) (null: SeqFactory[List]) else (null: SeqFactory[Set])
+}
diff --git a/tests/untried/neg/illegal-stmt-start.check b/tests/untried/neg/illegal-stmt-start.check
new file mode 100644
index 000000000..01747524f
--- /dev/null
+++ b/tests/untried/neg/illegal-stmt-start.check
@@ -0,0 +1,4 @@
+illegal-stmt-start.scala:3: error: illegal start of statement (no modifiers allowed here)
+ private def bar {}
+ ^
+one error found
diff --git a/tests/untried/neg/illegal-stmt-start.scala b/tests/untried/neg/illegal-stmt-start.scala
new file mode 100644
index 000000000..48ae0a8b0
--- /dev/null
+++ b/tests/untried/neg/illegal-stmt-start.scala
@@ -0,0 +1,5 @@
+class Test {
+ def foo {
+ private def bar {}
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/imp2.check b/tests/untried/neg/imp2.check
new file mode 100644
index 000000000..999cecf16
--- /dev/null
+++ b/tests/untried/neg/imp2.check
@@ -0,0 +1,7 @@
+imp2.scala:18: error: reference to f is ambiguous;
+it is imported twice in the same scope by
+import b._
+and import a._
+ val x = f
+ ^
+one error found
diff --git a/tests/untried/neg/imp2.scala b/tests/untried/neg/imp2.scala
new file mode 100644
index 000000000..993726218
--- /dev/null
+++ b/tests/untried/neg/imp2.scala
@@ -0,0 +1,19 @@
+abstract class C {
+ val f: Int
+}
+
+object A extends C {
+ val f = 1
+}
+
+object B extends C {
+ val f = 2
+}
+
+object Test {
+ val a: C = A;
+ val b: C = B;
+ import a._
+ import b._
+ val x = f
+}
diff --git a/tests/untried/neg/implicit-shadow.check b/tests/untried/neg/implicit-shadow.check
new file mode 100644
index 000000000..042fca867
--- /dev/null
+++ b/tests/untried/neg/implicit-shadow.check
@@ -0,0 +1,11 @@
+implicit-shadow.scala:4: <i2s: error> is not a valid implicit value for Int(1) => ?{def isEmpty: ?} because:
+reference to i2s is ambiguous;
+it is imported twice in the same scope by
+import C._
+and import B._
+ 1.isEmpty
+ ^
+implicit-shadow.scala:4: error: value isEmpty is not a member of Int
+ 1.isEmpty
+ ^
+one error found
diff --git a/tests/untried/neg/implicit-shadow.flags b/tests/untried/neg/implicit-shadow.flags
new file mode 100644
index 000000000..44842a9d6
--- /dev/null
+++ b/tests/untried/neg/implicit-shadow.flags
@@ -0,0 +1 @@
+-Xlog-implicits
diff --git a/tests/untried/neg/implicit-shadow.scala b/tests/untried/neg/implicit-shadow.scala
new file mode 100644
index 000000000..ec7f70b6d
--- /dev/null
+++ b/tests/untried/neg/implicit-shadow.scala
@@ -0,0 +1,13 @@
+object Test {
+ import B._, C._
+
+ 1.isEmpty
+}
+
+trait A {
+ implicit def i2s(i: Int): String = ""
+}
+
+object B extends A
+
+object C extends A
diff --git a/tests/untried/neg/implicits.check b/tests/untried/neg/implicits.check
new file mode 100644
index 000000000..6d61f7f22
--- /dev/null
+++ b/tests/untried/neg/implicits.check
@@ -0,0 +1,14 @@
+implicits.scala:38: error: type mismatch;
+ found : test2.HSome[String,test2.HMap]
+ required: Int
+ foo(set)
+ ^
+implicits.scala:46: error: type mismatch;
+ found : List[Any]
+ required: List[Mxml]
+ children.toList.flatMap ( e => {
+ ^
+implicits.scala:66: error: could not find implicit value for parameter x: Nothing
+ foo {
+ ^
+three errors found
diff --git a/tests/untried/neg/implicits.scala b/tests/untried/neg/implicits.scala
new file mode 100644
index 000000000..22633a1f3
--- /dev/null
+++ b/tests/untried/neg/implicits.scala
@@ -0,0 +1,74 @@
+class Pos
+
+class Super
+
+object Super {
+ implicit def pos2int(p: Pos): Int = 0
+}
+
+object Sub extends Super {
+ class Plus(x: Any) {
+ def +(y: String): String = x.toString + y
+ }
+ implicit def any2plus(x: Any): Plus = new Plus(x)
+}
+
+object Test {
+ import Super._
+ import Sub._
+ val p = new Pos
+ def f(x: Int): Int = x
+ f(p+1)
+}
+
+object test2 {
+ sealed trait HMap {
+ def +[T](v: T) = HSome(v,this)
+ }
+
+ final case class HSome[T, L <: HMap](head: T, tail: L) extends HMap
+
+ final object HEmpty extends HMap
+
+ val set = HEmpty + 3 + "3"
+ implicit def select[T](t: HSome[T,_]) = t.head
+ implicit def selectTail[L](t: HSome[_,L]) = t.tail
+
+ def foo(x: Int) = 3
+ foo(set)
+}
+
+// #2180
+class Mxml {
+
+ private def processChildren( children:Seq[Any] ):List[Mxml] = {
+
+ children.toList.flatMap ( e => {
+
+ e match {
+
+ case s:scala.collection.Traversable[_] => s case a => List(a)
+
+ }
+
+ })
+
+ }
+
+}
+
+// SI-5316
+class Test3 {
+ def foo(p: => Any)(implicit x: Nothing): Unit = ()
+
+ object X
+
+ foo {
+ val a = 0
+
+ {
+ import X._
+ a
+ }
+ }
+}
diff --git a/tests/untried/neg/import-precedence.check b/tests/untried/neg/import-precedence.check
new file mode 100644
index 000000000..5f9961105
--- /dev/null
+++ b/tests/untried/neg/import-precedence.check
@@ -0,0 +1,19 @@
+import-precedence.scala:18: error: reference to X is ambiguous;
+it is imported twice in the same scope by
+import uniq1.uniq2._
+and import uniq1.X
+ object Y { def f = X }
+ ^
+import-precedence.scala:61: error: reference to X is ambiguous;
+it is imported twice in the same scope by
+import uniq1.uniq2._
+and import uniq1._
+ object Y { def f = X }
+ ^
+import-precedence.scala:67: error: reference to X is ambiguous;
+it is imported twice in the same scope by
+import uniq1.uniq2.X
+and import uniq1.X
+ object Y { def f = X }
+ ^
+three errors found
diff --git a/tests/untried/neg/import-precedence.scala b/tests/untried/neg/import-precedence.scala
new file mode 100644
index 000000000..0401635e3
--- /dev/null
+++ b/tests/untried/neg/import-precedence.scala
@@ -0,0 +1,68 @@
+package uniq1 {
+ object X
+ package uniq2 {
+ object X
+ package uniq3 {
+ object X
+ package uniq4 {
+ object X
+ }
+ }
+ }
+}
+
+package p1 {
+ import uniq1.X
+ package p2 {
+ import uniq1.uniq2._
+ object Y { def f = X }
+ }
+}
+
+package p2 {
+ import uniq1.uniq2._
+ package p2 {
+ import uniq1.X
+ object Y { def f = X }
+ }
+}
+
+package p3 {
+ import uniq1.X
+ import uniq1.uniq2._
+ object Y { def f = X }
+}
+
+package p4 {
+ import uniq1.uniq2._
+ import uniq1.X
+ object Y { def f = X }
+}
+
+package p5 {
+ import uniq1.X
+ package p6 {
+ import uniq1.uniq2.X
+ object Y { def f = X }
+ }
+}
+
+package p6 {
+ import uniq1._
+ package p5 {
+ import uniq1.uniq2._
+ object Y { def f = X }
+ }
+}
+
+package p7 {
+ import uniq1._
+ import uniq1.uniq2._
+ object Y { def f = X }
+}
+
+package p8 {
+ import uniq1.X
+ import uniq1.uniq2.X
+ object Y { def f = X }
+}
diff --git a/tests/untried/neg/infix-op-positions.check b/tests/untried/neg/infix-op-positions.check
new file mode 100644
index 000000000..1bff9b941
--- /dev/null
+++ b/tests/untried/neg/infix-op-positions.check
@@ -0,0 +1,7 @@
+infix-op-positions.scala:2: error: value -! is not a member of Option[Int]
+ Option(1) -! "test" // left associative operator
+ ^
+infix-op-positions.scala:3: error: value -!: is not a member of Option[Int]
+ "test" -!: Option(1) // right associative operators
+ ^
+two errors found
diff --git a/tests/untried/neg/infix-op-positions.scala b/tests/untried/neg/infix-op-positions.scala
new file mode 100644
index 000000000..16351b0ab
--- /dev/null
+++ b/tests/untried/neg/infix-op-positions.scala
@@ -0,0 +1,4 @@
+object Test {
+ Option(1) -! "test" // left associative operator
+ "test" -!: Option(1) // right associative operators
+}
diff --git a/tests/untried/neg/interop_abstypetags_arenot_classmanifests.check b/tests/untried/neg/interop_abstypetags_arenot_classmanifests.check
new file mode 100644
index 000000000..d15e33346
--- /dev/null
+++ b/tests/untried/neg/interop_abstypetags_arenot_classmanifests.check
@@ -0,0 +1,4 @@
+interop_abstypetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T.
+ println(classManifest[T])
+ ^
+one error found
diff --git a/tests/untried/neg/interop_abstypetags_arenot_classmanifests.scala b/tests/untried/neg/interop_abstypetags_arenot_classmanifests.scala
new file mode 100644
index 000000000..6b05eddf7
--- /dev/null
+++ b/tests/untried/neg/interop_abstypetags_arenot_classmanifests.scala
@@ -0,0 +1,11 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ def weakTypeTagIsnotClassManifest[T: WeakTypeTag] = {
+ println(classManifest[T])
+ }
+
+ weakTypeTagIsnotClassManifest[Int]
+ weakTypeTagIsnotClassManifest[String]
+ weakTypeTagIsnotClassManifest[Array[Int]]
+}
diff --git a/tests/untried/neg/interop_abstypetags_arenot_classtags.check b/tests/untried/neg/interop_abstypetags_arenot_classtags.check
new file mode 100644
index 000000000..3aa7a50b5
--- /dev/null
+++ b/tests/untried/neg/interop_abstypetags_arenot_classtags.check
@@ -0,0 +1,4 @@
+interop_abstypetags_arenot_classtags.scala:6: error: No ClassTag available for T
+ println(classTag[T])
+ ^
+one error found
diff --git a/tests/untried/neg/interop_abstypetags_arenot_classtags.scala b/tests/untried/neg/interop_abstypetags_arenot_classtags.scala
new file mode 100644
index 000000000..7e049bf65
--- /dev/null
+++ b/tests/untried/neg/interop_abstypetags_arenot_classtags.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.{ClassTag, classTag}
+
+object Test extends App {
+ def weakTypeTagIsnotClassTag[T: WeakTypeTag] = {
+ println(classTag[T])
+ }
+
+ weakTypeTagIsnotClassTag[Int]
+ weakTypeTagIsnotClassTag[String]
+ weakTypeTagIsnotClassTag[Array[Int]]
+}
diff --git a/tests/untried/neg/interop_abstypetags_arenot_manifests.check b/tests/untried/neg/interop_abstypetags_arenot_manifests.check
new file mode 100644
index 000000000..5916b6874
--- /dev/null
+++ b/tests/untried/neg/interop_abstypetags_arenot_manifests.check
@@ -0,0 +1,4 @@
+interop_abstypetags_arenot_manifests.scala:5: error: No Manifest available for T.
+ println(manifest[T])
+ ^
+one error found
diff --git a/tests/untried/neg/interop_abstypetags_arenot_manifests.scala b/tests/untried/neg/interop_abstypetags_arenot_manifests.scala
new file mode 100644
index 000000000..1f934e0bb
--- /dev/null
+++ b/tests/untried/neg/interop_abstypetags_arenot_manifests.scala
@@ -0,0 +1,11 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ def weakTypeTagIsnotManifest[T: WeakTypeTag] = {
+ println(manifest[T])
+ }
+
+ weakTypeTagIsnotManifest[Int]
+ weakTypeTagIsnotManifest[String]
+ weakTypeTagIsnotManifest[Array[Int]]
+}
diff --git a/tests/untried/neg/interop_classmanifests_arenot_typetags.check b/tests/untried/neg/interop_classmanifests_arenot_typetags.check
new file mode 100644
index 000000000..db8e57981
--- /dev/null
+++ b/tests/untried/neg/interop_classmanifests_arenot_typetags.check
@@ -0,0 +1,4 @@
+interop_classmanifests_arenot_typetags.scala:5: error: No TypeTag available for T
+ println(implicitly[TypeTag[T]])
+ ^
+one error found
diff --git a/tests/untried/neg/interop_classmanifests_arenot_typetags.scala b/tests/untried/neg/interop_classmanifests_arenot_typetags.scala
new file mode 100644
index 000000000..b89feaf80
--- /dev/null
+++ b/tests/untried/neg/interop_classmanifests_arenot_typetags.scala
@@ -0,0 +1,11 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ def classManifestIsnotTypeTag[T: ClassManifest] = {
+ println(implicitly[TypeTag[T]])
+ }
+
+ classManifestIsnotTypeTag[Int]
+ classManifestIsnotTypeTag[String]
+ classManifestIsnotTypeTag[Array[Int]]
+}
diff --git a/tests/untried/neg/interop_classtags_arenot_manifests.check b/tests/untried/neg/interop_classtags_arenot_manifests.check
new file mode 100644
index 000000000..fa805b591
--- /dev/null
+++ b/tests/untried/neg/interop_classtags_arenot_manifests.check
@@ -0,0 +1,4 @@
+interop_classtags_arenot_manifests.scala:5: error: No Manifest available for T.
+ println(manifest[T])
+ ^
+one error found
diff --git a/tests/untried/neg/interop_classtags_arenot_manifests.scala b/tests/untried/neg/interop_classtags_arenot_manifests.scala
new file mode 100644
index 000000000..3555118d6
--- /dev/null
+++ b/tests/untried/neg/interop_classtags_arenot_manifests.scala
@@ -0,0 +1,11 @@
+import scala.reflect.{ClassTag, classTag}
+
+object Test extends App {
+ def classTagIsnotManifest[T: ClassTag] = {
+ println(manifest[T])
+ }
+
+ classTagIsnotManifest[Int]
+ classTagIsnotManifest[String]
+ classTagIsnotManifest[Array[Int]]
+}
diff --git a/tests/untried/neg/interop_typetags_arenot_classmanifests.check b/tests/untried/neg/interop_typetags_arenot_classmanifests.check
new file mode 100644
index 000000000..88fb1647e
--- /dev/null
+++ b/tests/untried/neg/interop_typetags_arenot_classmanifests.check
@@ -0,0 +1,4 @@
+interop_typetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T.
+ println(classManifest[T])
+ ^
+one error found
diff --git a/tests/untried/neg/interop_typetags_arenot_classmanifests.scala b/tests/untried/neg/interop_typetags_arenot_classmanifests.scala
new file mode 100644
index 000000000..04857aaa6
--- /dev/null
+++ b/tests/untried/neg/interop_typetags_arenot_classmanifests.scala
@@ -0,0 +1,11 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ def typeTagIsnotClassManifest[T: TypeTag] = {
+ println(classManifest[T])
+ }
+
+ typeTagIsnotClassManifest[Int]
+ typeTagIsnotClassManifest[String]
+ typeTagIsnotClassManifest[Array[Int]]
+}
diff --git a/tests/untried/neg/interop_typetags_arenot_classtags.check b/tests/untried/neg/interop_typetags_arenot_classtags.check
new file mode 100644
index 000000000..1d1fb15f9
--- /dev/null
+++ b/tests/untried/neg/interop_typetags_arenot_classtags.check
@@ -0,0 +1,4 @@
+interop_typetags_arenot_classtags.scala:6: error: No ClassTag available for T
+ println(classTag[T])
+ ^
+one error found
diff --git a/tests/untried/neg/interop_typetags_arenot_classtags.scala b/tests/untried/neg/interop_typetags_arenot_classtags.scala
new file mode 100644
index 000000000..f5bd75fb3
--- /dev/null
+++ b/tests/untried/neg/interop_typetags_arenot_classtags.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.{ClassTag, classTag}
+
+object Test extends App {
+ def typeTagIsnotClassTag[T: TypeTag] = {
+ println(classTag[T])
+ }
+
+ typeTagIsnotClassTag[Int]
+ typeTagIsnotClassTag[String]
+ typeTagIsnotClassTag[Array[Int]]
+}
diff --git a/tests/untried/neg/interop_typetags_without_classtags_arenot_manifests.check b/tests/untried/neg/interop_typetags_without_classtags_arenot_manifests.check
new file mode 100644
index 000000000..ba744a883
--- /dev/null
+++ b/tests/untried/neg/interop_typetags_without_classtags_arenot_manifests.check
@@ -0,0 +1,6 @@
+interop_typetags_without_classtags_arenot_manifests.scala:6: error: to create a manifest here, it is necessary to interoperate with the type tag `evidence$1` in scope.
+however typetag -> manifest conversion requires a class tag for the corresponding type to be present.
+to proceed add a class tag to the type `T` (e.g. by introducing a context bound) and recompile.
+ println(manifest[T])
+ ^
+one error found
diff --git a/tests/untried/neg/interop_typetags_without_classtags_arenot_manifests.scala b/tests/untried/neg/interop_typetags_without_classtags_arenot_manifests.scala
new file mode 100644
index 000000000..ec69c1460
--- /dev/null
+++ b/tests/untried/neg/interop_typetags_without_classtags_arenot_manifests.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+object Test extends App {
+ def typeTagWithoutClassTagIsnotManifest[T: TypeTag] = {
+ println(manifest[T])
+ }
+
+ typeTagWithoutClassTagIsnotManifest[Int]
+ typeTagWithoutClassTagIsnotManifest[String]
+ typeTagWithoutClassTagIsnotManifest[Array[Int]]
+}
diff --git a/tests/untried/neg/java-access-neg.check b/tests/untried/neg/java-access-neg.check
new file mode 100644
index 000000000..af2812b57
--- /dev/null
+++ b/tests/untried/neg/java-access-neg.check
@@ -0,0 +1,16 @@
+S2.scala:12: error: method packageAbstract overrides nothing
+ override private[b] def packageAbstract() = () // fail
+ ^
+S2.scala:16: error: method packageConcrete overrides nothing
+ override private[b] def packageConcrete() = () // fail
+ ^
+S2.scala:36: error: method packageConcrete overrides nothing
+ override protected[b] def packageConcrete() = () // fail
+ ^
+S2.scala:47: error: method packageConcrete overrides nothing
+ override private[a] def packageConcrete() = () // fail
+ ^
+S2.scala:58: error: method packageConcrete overrides nothing
+ override def packageConcrete() = () // fail
+ ^
+5 errors found
diff --git a/tests/untried/neg/java-access-neg/J.java b/tests/untried/neg/java-access-neg/J.java
new file mode 100644
index 000000000..b6bc3363a
--- /dev/null
+++ b/tests/untried/neg/java-access-neg/J.java
@@ -0,0 +1,15 @@
+package a.b;
+
+public abstract class J {
+ public J() { }
+ J(int x1) { }
+ protected J(int x1, int x2) { }
+
+ abstract void packageAbstract();
+ protected abstract void protectedAbstract();
+ public abstract void publicAbstract();
+
+ void packageConcrete() { return; }
+ protected void protectedConcrete() { return; }
+ public void publicConcrete() { return; }
+}
diff --git a/tests/untried/neg/java-access-neg/S2.scala b/tests/untried/neg/java-access-neg/S2.scala
new file mode 100644
index 000000000..b082bb717
--- /dev/null
+++ b/tests/untried/neg/java-access-neg/S2.scala
@@ -0,0 +1,61 @@
+package a.b
+package c
+
+import a.b.J
+
+/** Variations of java-access-pos with us in a nested package.
+ */
+
+/** Declaring "override" all the time.
+ */
+class S1 extends J {
+ override private[b] def packageAbstract() = () // fail
+ override protected[b] def protectedAbstract() = ()
+ override def publicAbstract() = ()
+
+ override private[b] def packageConcrete() = () // fail
+ override protected[b] def protectedConcrete() = ()
+ override def publicConcrete() = ()
+}
+
+/** Implementing abstracts.
+ */
+class S2 extends J {
+ private[b] def packageAbstract() = () // fail
+ protected[b] def protectedAbstract() = ()
+ def publicAbstract() = ()
+}
+
+/** Widening access.
+ */
+class S3 extends J {
+ protected[b] def packageAbstract() = () // fail
+ protected[b] def protectedAbstract() = ()
+ def publicAbstract() = ()
+
+ override protected[b] def packageConcrete() = () // fail
+ override protected[b] def protectedConcrete() = ()
+ override def publicConcrete() = ()
+}
+/** More widening.
+ */
+class S4 extends J {
+ private[a] def packageAbstract() = () // fail
+ protected[a] def protectedAbstract() = ()
+ def publicAbstract() = ()
+
+ override private[a] def packageConcrete() = () // fail
+ override protected[a] def protectedConcrete() = ()
+ override def publicConcrete() = ()
+}
+/** Yet more widening.
+ */
+class S5 extends J {
+ def packageAbstract() = () // fail
+ def protectedAbstract() = ()
+ def publicAbstract() = ()
+
+ override def packageConcrete() = () // fail
+ override def protectedConcrete() = ()
+ override def publicConcrete() = ()
+}
diff --git a/tests/untried/neg/lazy-override.check b/tests/untried/neg/lazy-override.check
new file mode 100644
index 000000000..793e6b202
--- /dev/null
+++ b/tests/untried/neg/lazy-override.check
@@ -0,0 +1,9 @@
+lazy-override.scala:11: error: overriding value x in class A of type Int;
+ lazy value x cannot override a concrete non-lazy value
+ override lazy val x: Int = { print("/*B.x*/"); 3 }
+ ^
+lazy-override.scala:13: error: overriding lazy value y in class A of type Int;
+ value y must be declared lazy to override a concrete lazy value
+ override val y: Int = { print("/*B.y*/"); 3 }
+ ^
+two errors found
diff --git a/tests/untried/neg/lazy-override.scala b/tests/untried/neg/lazy-override.scala
new file mode 100644
index 000000000..f41d7f038
--- /dev/null
+++ b/tests/untried/neg/lazy-override.scala
@@ -0,0 +1,19 @@
+
+/** Test which should fail compilation */
+ class A {
+ val x: Int = { print("/*A.x*/"); 2 }
+ lazy val y: Int = { print("/*A.y*/"); 2 }
+ }
+
+
+ class B extends A {
+ // lazy overrides strict val
+ override lazy val x: Int = { print("/*B.x*/"); 3 }
+ // strict val overrides lazy
+ override val y: Int = { print("/*B.y*/"); 3 }
+ }
+
+
+
+
+
diff --git a/tests/untried/neg/lazyvals.check b/tests/untried/neg/lazyvals.check
new file mode 100644
index 000000000..c4daf9d84
--- /dev/null
+++ b/tests/untried/neg/lazyvals.check
@@ -0,0 +1,25 @@
+lazyvals.scala:6: error: lazy values may not be abstract
+ lazy val t: Int
+ ^
+lazyvals.scala:9: error: lazy not allowed here. Only vals can be lazy
+ lazy var p: Int = 100
+ ^
+lazyvals.scala:12: error: lazy not allowed here. Only vals can be lazy
+ lazy def q: Double = 0.0
+ ^
+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 {}
+ ^
+lazyvals.scala:21: error: lazy not allowed here. Only vals can be lazy
+ lazy class C {}
+ ^
+lazyvals.scala:22: error: lazy not allowed here. Only vals can be lazy
+ lazy object O {}
+ ^
+lazyvals.scala:25: error: lazy modifier not allowed here. Use call-by-name parameters instead
+ class A(lazy val obj: Object) {}
+ ^
+8 errors found
diff --git a/tests/untried/neg/lazyvals.scala b/tests/untried/neg/lazyvals.scala
new file mode 100644
index 000000000..f92534f50
--- /dev/null
+++ b/tests/untried/neg/lazyvals.scala
@@ -0,0 +1,46 @@
+
+/** Test which should fail compilation */
+class Lazy {
+
+ // no abstract lazy values
+ lazy val t: Int
+
+ // no lazy var
+ lazy var p: Int = 100
+
+ // no lazy defs
+ lazy def q: Double = 0.0
+
+ def foo {
+ lazy val t;
+ ()
+ }
+
+ // no trait/class/object can be lazy
+ lazy trait T {}
+ lazy class C {}
+ lazy object O {}
+
+ // no lazy modifiers in class parameters
+ class A(lazy val obj: Object) {}
+}
+
+object T2 {
+ class A {
+ val x: Int = { print("/*A.x*/"); 2 }
+ lazy val y: Int = { print("/*A.y*/"); 2 }
+ }
+
+
+ class B extends A {
+ // lazy overrides strict val
+ override lazy val x: Int = { print("/*B.x*/"); 3 }
+ // strict val overrides lazy
+ override val y: Int = { print("/*B.y*/"); 3 }
+ }
+}
+
+
+
+
+
diff --git a/tests/untried/neg/literate_existentials.check b/tests/untried/neg/literate_existentials.check
new file mode 100644
index 000000000..c98f976f7
--- /dev/null
+++ b/tests/untried/neg/literate_existentials.check
@@ -0,0 +1,4 @@
+literate_existentials.scala:189: error: Cannot prove that Int <:< M forSome { type M <: String }.
+ implicitly[Int <:< (M forSome { type M >: Nothing <: String })] // fails
+ ^
+one error found
diff --git a/tests/untried/neg/literate_existentials.scala b/tests/untried/neg/literate_existentials.scala
new file mode 100644
index 000000000..8580347bf
--- /dev/null
+++ b/tests/untried/neg/literate_existentials.scala
@@ -0,0 +1,224 @@
+
+object LiterateExistentials {
+
+// Let's play with Scala's type system a bit.
+//
+// From adriaanm, we have the following substitution rule, which allows us to
+// determine whether a type is a subtype of an existential in Scala:
+//
+//
+// T <: subst(U) for all i: subst(Li) <: Vi /\ Vi <: subst(Hi)
+// --------------------------------------------------------------
+// T <: U forSome {type X1 :> L1 <: H1; ...; type Xn :> Ln <: Hn}
+//
+// where subst(T) = T.subst(Xi, Vi) // Vi fresh type variables
+//
+// T is a subtype of some existential if all constraints of the existential hold
+// after substituting Vi for the existentially quantified type variables Xi,
+// and T is a subtype of the underlying type U with the same substitution applied.
+//
+//
+// Since we are not a formal substitution system, we will actually be using
+// this rule 'backward' in order to determine whether it allows us to
+// truthfully make claims; In each example, we will start with the proposition
+// that a type is a subtype of an existential. Then, we will fit the
+// proposition into the form on the bottom rule by creating a set of bindings
+// which allow one to be transformed into the other. Next, we will express the
+// top of the substitution rule in terms of a series of constraints. We will
+// simplify those constraints until simple inspection can determine whether
+// they are consistent. From this, we can conclude whether the type system /
+// environment admit the top of the substitution rule (and thus, the bottom). If
+// they do, we can say that the proposition is true.
+
+
+// In each case, we will also probe the compiler to see whether _it_ thinks that
+// the proposition holds, using an uncommented implicitly[_ <:< _] line.
+
+
+
+
+// Proposition: Nothing :< (A forSome { type A >: String <: Any })
+//
+//
+// Bindings:
+// T := Nothing
+// U := A
+// X1 := A
+// L1 := String
+// H1 := Any
+//
+// We need:
+//
+// Nothing <: V1 // (U, which is "A", which V1 substituted for all instances of A)
+// String <: V1
+// V1 <: Any
+//
+// Which simplify to:
+// V1 >: String <: Any
+//
+// That's not inconsistent, so we can say that:
+// T <: U forSome { type X1 >: L1 <: H1 }
+// which means (under our mappings):
+// Nothing <: A forSome { type A >: String <: Any }
+
+// Now to ask the compiler:
+
+ implicitly[Nothing <:< (A forSome { type A >: String <: Any })]
+
+
+// Let's try another:
+//
+// Proposition: Int :< (M forSome { type M >: String <: Any })
+//
+// Bindings:
+// T := Int
+// U := M
+// X1 := M
+// L1 := String
+// H1 := Any
+//
+// We need:
+//
+// Int <: V1
+// String <: V1
+// V1 <: Any
+//
+// Which simplify to:
+//
+// V1 >: lub(Int, String) <: Any
+//
+// V1 >: Any <: Any
+//
+// We have demonstrated consistency! We can say that:
+// T :< (U forSome { type U >: L1 <: H1 })
+// Under our bindings, this is:
+// Int :< (M forSome { type M >: String <: Any })
+
+ implicitly[Int <:< (M forSome { type M >: String <: Any })]
+
+
+
+// Now, let's do a more complicated one:
+//
+// Proposition: (Nothing, List[String]) <: ((A, B) forSome { type A >: String <: AnyRef; type B >: Null <: List[A] })
+//
+// Bindings:
+// T := (Nothing, List[String])
+// U := (A, B)
+// X1 := A
+// X2 := B
+// L1 := String
+// H1 := AnyRef
+// L2 := Null
+// H2 := List[A]
+//
+// We need:
+//
+// (Nothing, List[String]) <: (V1, V2)
+// String <: V1
+// V1 <: AnyRef
+// Null <: V2
+// V2 <: List[V1]
+//
+// Of course, we can split the first line to make:
+//
+// Nothing <: V1
+// List[String]) <: V2
+// String <: V1
+// V1 <: AnyRef
+// Null <: V2
+// V2 <: List[V1]
+//
+// Which reorder to:
+//
+// Nothing <: V1
+// String <: V1
+// V1 <: AnyRef
+// List[String]) <: V2
+// Null <: V2
+// V2 <: List[V1]
+//
+// Which simplify to:
+//
+// String <: V1
+// V1 <: AnyRef
+// List[String]) <: V2
+// V2 <: List[V1]
+//
+// String <: V1
+// V1 <: AnyRef
+// String <: V1
+//
+// V1 >: String <: AnyRef
+//
+// Consistency demonstrated! We can say that:
+// T <: U forSome {type X1 :> L1 <: H1; type X2 :> L2 <: H2}
+// meaning:
+// (Nothing, List[String]) <: ((A, B) forSome { type A >: String <: AnyRef; type B >: Null <: List[A] })
+
+ implicitly[
+ (Nothing, List[String]) <:< ((A, B) forSome { type A >: String <: AnyRef; type B >: Null <: List[A] })
+ ]
+
+
+
+// Now let's try one that isn't true:
+//
+// Proposition: Int :< (M forSome { type M >: Nothing <: String })
+//
+// Bindings:
+// T := Int
+// U := M
+// X1 := M
+// L1 := Nothing
+// H1 := String
+//
+// We need:
+//
+// Int <: V1
+// Nothing <: V1
+// V1 <: String
+//
+// V1 >: Int <: String
+//
+// Alas! These are inconsistent! There is no supertype of Int that is a
+// subtype of String! Our substitution rule does not allow us to claim that our
+// proposition is true.
+//
+
+ implicitly[Int <:< (M forSome { type M >: Nothing <: String })] // fails
+// The preceeding line causes the compiler to generate an error message.
+
+
+
+// Let's look at one final example, courtesy of paulp.
+// Proposition: String :< X forSome { type X >: Nothing <: String }
+//
+// Bindings:
+// T := String
+// U := X
+// X1 := X
+// L1 := Nothing
+// H1 := String
+//
+// We need:
+//
+// String <: V1
+// Nothing <: V1
+// V1 <: String
+//
+// Which simplify to:
+//
+// String <: V1
+// V1 <: String
+//
+// V1 >: String <: String
+//
+// So, we can say:
+// T <: U forSome { type X1 >: L1 <: H1 }
+// which means:
+// String :< X forSome { type X >: Nothing <: String }
+
+ implicitly[String <:< (X forSome { type X >: Nothing <: String })]
+
+}
diff --git a/tests/untried/neg/logImplicits.check b/tests/untried/neg/logImplicits.check
new file mode 100644
index 000000000..270882b71
--- /dev/null
+++ b/tests/untried/neg/logImplicits.check
@@ -0,0 +1,19 @@
+logImplicits.scala:2: applied implicit conversion from xs.type to ?{def size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps[Byte]
+ def f(xs: Array[Byte]) = xs.size
+ ^
+logImplicits.scala:7: applied implicit conversion from String("abc") to ?{def map: ?} = implicit def augmentString(x: String): scala.collection.immutable.StringOps
+ def f = "abc" map (_ + 1)
+ ^
+logImplicits.scala:15: inferred view from String("abc") to Int = C.this.convert:(p: String("abc"))Int
+ math.max(122, x: Int)
+ ^
+logImplicits.scala:19: applied implicit conversion from Int(1) to ?{def ->: ?} = implicit def ArrowAssoc[A](self: A): ArrowAssoc[A]
+ def f = (1 -> 2) + "c"
+ ^
+logImplicits.scala:19: applied implicit conversion from (Int, Int) to ?{def +: ?} = implicit def any2stringadd[A](self: A): any2stringadd[A]
+ def f = (1 -> 2) + "c"
+ ^
+logImplicits.scala:22: error: class Un needs to be abstract, since method unimplemented is not defined
+class Un {
+ ^
+one error found
diff --git a/tests/untried/neg/logImplicits.flags b/tests/untried/neg/logImplicits.flags
new file mode 100644
index 000000000..97e5ae94e
--- /dev/null
+++ b/tests/untried/neg/logImplicits.flags
@@ -0,0 +1 @@
+-Xlog-implicit-conversions \ No newline at end of file
diff --git a/tests/untried/neg/logImplicits.scala b/tests/untried/neg/logImplicits.scala
new file mode 100644
index 000000000..ecb4cbb31
--- /dev/null
+++ b/tests/untried/neg/logImplicits.scala
@@ -0,0 +1,25 @@
+class A {
+ def f(xs: Array[Byte]) = xs.size
+ def g(xs: Array[Byte]) = xs.length
+}
+
+class B {
+ def f = "abc" map (_ + 1)
+}
+
+object C {
+ final val x = "abc"
+
+ implicit def convert(p: x.type): Int = 123
+
+ math.max(122, x: Int)
+}
+
+class D {
+ def f = (1 -> 2) + "c"
+}
+
+class Un {
+ // forcing post-typer failure, since we're only interested in the output from the above
+ def unimplemented: Int
+}
diff --git a/tests/untried/neg/lubs.check b/tests/untried/neg/lubs.check
new file mode 100644
index 000000000..affbd4983
--- /dev/null
+++ b/tests/untried/neg/lubs.check
@@ -0,0 +1,21 @@
+lubs.scala:10: error: type mismatch;
+ found : test1.A[test1.A[Object]]
+ required: test1.A[test1.A[test1.A[Any]]]
+ val x3: A[A[A[Any]]] = f
+ ^
+lubs.scala:11: error: type mismatch;
+ found : test1.A[test1.A[Object]]
+ required: test1.A[test1.A[test1.A[test1.A[Any]]]]
+ val x4: A[A[A[A[Any]]]] = f
+ ^
+lubs.scala:24: error: type mismatch;
+ found : test2.A{type T >: test2.C with test2.D <: test2.A}
+ required: test2.A{type T >: Null <: test2.A{type T >: Null <: test2.A}}
+ val x3: A { type T >: Null <: A { type T >: Null <: A } } = f
+ ^
+lubs.scala:25: error: type mismatch;
+ found : test2.A{type T >: test2.C with test2.D <: test2.A}
+ required: test2.A{type T >: Null <: test2.A{type T >: Null <: test2.A{type T >: Null <: test2.A}}}
+ val x4: A { type T >: Null <: A { type T >: Null <: A { type T >: Null <: A } } } = f
+ ^
+four errors found
diff --git a/tests/untried/neg/lubs.scala b/tests/untried/neg/lubs.scala
new file mode 100644
index 000000000..3524fa4d8
--- /dev/null
+++ b/tests/untried/neg/lubs.scala
@@ -0,0 +1,26 @@
+object test1 {
+ abstract class A[+T]
+ class C extends A[C]
+ class D extends A[D]
+
+ def f = if(1 == 2) new C else new D
+
+ val x1: A[Any] = f
+ val x2: A[A[Any]] = f
+ val x3: A[A[A[Any]]] = f
+ val x4: A[A[A[A[Any]]]] = f
+}
+
+object test2 {
+
+ abstract class A { type T }
+ class C extends A { type T = C }
+ class D extends A { type T = D }
+
+ def f = if (1 == 2) new C else new D
+
+ val x1: A { type T } = f
+ val x2: A { type T >: Null <: A } = f
+ val x3: A { type T >: Null <: A { type T >: Null <: A } } = f
+ val x4: A { type T >: Null <: A { type T >: Null <: A { type T >: Null <: A } } } = f
+}
diff --git a/tests/untried/neg/macro-abort.check b/tests/untried/neg/macro-abort.check
new file mode 100644
index 000000000..1e58add53
--- /dev/null
+++ b/tests/untried/neg/macro-abort.check
@@ -0,0 +1,4 @@
+Test_2.scala:2: error: aborted
+ Macros.abort
+ ^
+one error found
diff --git a/tests/untried/neg/macro-abort/Macros_1.scala b/tests/untried/neg/macro-abort/Macros_1.scala
new file mode 100644
index 000000000..cd2382a6f
--- /dev/null
+++ b/tests/untried/neg/macro-abort/Macros_1.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = {
+ c.abort(c.enclosingPosition, "aborted")
+ }
+ def abort = macro impl
+}
diff --git a/tests/untried/neg/macro-abort/Test_2.scala b/tests/untried/neg/macro-abort/Test_2.scala
new file mode 100644
index 000000000..9eee0ccca
--- /dev/null
+++ b/tests/untried/neg/macro-abort/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.abort
+}
diff --git a/tests/untried/neg/macro-basic-mamdmi.check b/tests/untried/neg/macro-basic-mamdmi.check
new file mode 100644
index 000000000..61df5131c
--- /dev/null
+++ b/tests/untried/neg/macro-basic-mamdmi.check
@@ -0,0 +1,5 @@
+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/tests/untried/neg/macro-basic-mamdmi.flags b/tests/untried/neg/macro-basic-mamdmi.flags
new file mode 100644
index 000000000..5e5dd6ce7
--- /dev/null
+++ b/tests/untried/neg/macro-basic-mamdmi.flags
@@ -0,0 +1 @@
+-language:experimental.macros
diff --git a/tests/untried/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/tests/untried/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
new file mode 100644
index 000000000..c059d962e
--- /dev/null
+++ b/tests/untried/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
@@ -0,0 +1,34 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr[Int](q"$x + 1")
+ }
+
+ def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr[Int](q"$x + 2")
+ }
+
+ def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr[Int](q"$x + 3")
+ }
+}
+
+object Macros {
+ object Shmacros {
+ def foo(x: Int): Int = macro Impls.foo
+ }
+ def bar(x: Int): Int = macro Impls.bar
+}
+
+class Macros {
+ def quux(x: Int): Int = macro Impls.quux
+}
+
+object Test extends App {
+ import Macros.Shmacros._
+ println(foo(2) + Macros.bar(2) * new Macros().quux(4))
+}
diff --git a/tests/untried/neg/macro-blackbox-dynamic-materialization.check b/tests/untried/neg/macro-blackbox-dynamic-materialization.check
new file mode 100644
index 000000000..f6c73f7ed
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-dynamic-materialization.check
@@ -0,0 +1,4 @@
+Test_2.scala:2: error: I don't like classes that contain integers
+ println(implicitly[Foo[C1]])
+ ^
+one error found
diff --git a/tests/untried/neg/macro-blackbox-dynamic-materialization/Macros_1.scala b/tests/untried/neg/macro-blackbox-dynamic-materialization/Macros_1.scala
new file mode 100644
index 000000000..16a379ea5
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-dynamic-materialization/Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+
+trait Foo[T]
+
+class C1(val x: Int)
+class C2(val x: String)
+
+trait LowPriority {
+ implicit def lessSpecific[T]: Foo[T] = null
+}
+
+object Foo extends LowPriority {
+ implicit def moreSpecific[T]: Foo[T] = macro Macros.impl[T]
+}
+
+object Macros {
+ def impl[T: c.WeakTypeTag](c: Context) = {
+ import c.universe._
+ val tpe = weakTypeOf[T]
+ if (tpe.members.exists(_.info =:= typeOf[Int]))
+ c.abort(c.enclosingPosition, "I don't like classes that contain integers")
+ q"new Foo[$tpe]{ override def toString = ${tpe.toString} }"
+ }
+}
diff --git a/tests/untried/neg/macro-blackbox-dynamic-materialization/Test_2.scala b/tests/untried/neg/macro-blackbox-dynamic-materialization/Test_2.scala
new file mode 100644
index 000000000..abb5229bd
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-dynamic-materialization/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ println(implicitly[Foo[C1]])
+ println(implicitly[Foo[C2]])
+}
diff --git a/tests/untried/neg/macro-blackbox-extractor.check b/tests/untried/neg/macro-blackbox-extractor.check
new file mode 100644
index 000000000..4c53ff19b
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-extractor.check
@@ -0,0 +1,4 @@
+Test_2.scala:3: error: extractor macros can only be whitebox
+ case Extractor(x) => println(x)
+ ^
+one error found
diff --git a/tests/untried/neg/macro-blackbox-extractor/Macros_1.scala b/tests/untried/neg/macro-blackbox-extractor/Macros_1.scala
new file mode 100644
index 000000000..64b6270b7
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-extractor/Macros_1.scala
@@ -0,0 +1,21 @@
+import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+object Extractor {
+ def unapply(x: Int): Any = macro Macros.unapplyImpl
+}
+
+object Macros {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/tests/untried/neg/macro-blackbox-extractor/Test_2.scala b/tests/untried/neg/macro-blackbox-extractor/Test_2.scala
new file mode 100644
index 000000000..41be6f976
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-extractor/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ 42 match {
+ case Extractor(x) => println(x)
+ }
+}
diff --git a/tests/untried/neg/macro-blackbox-fundep-materialization.check b/tests/untried/neg/macro-blackbox-fundep-materialization.check
new file mode 100644
index 000000000..3c03064a2
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-fundep-materialization.check
@@ -0,0 +1,8 @@
+Test_2.scala:7: error: type mismatch;
+ found : Iso[Test.Foo,(Int, String, Boolean)]
+ required: Iso[Test.Foo,Nothing]
+Note: (Int, String, Boolean) >: Nothing, but trait Iso is invariant in type U.
+You may wish to define U as -U instead. (SLS 4.5)
+ val equiv = foo(Foo(23, "foo", true))
+ ^
+one error found
diff --git a/tests/untried/neg/macro-blackbox-fundep-materialization.flags b/tests/untried/neg/macro-blackbox-fundep-materialization.flags
new file mode 100644
index 000000000..4c6cdb71e
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-fundep-materialization.flags
@@ -0,0 +1 @@
+-Xlog-implicits \ No newline at end of file
diff --git a/tests/untried/neg/macro-blackbox-fundep-materialization/Macros_1.scala b/tests/untried/neg/macro-blackbox-fundep-materialization/Macros_1.scala
new file mode 100644
index 000000000..8d776388e
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-fundep-materialization/Macros_1.scala
@@ -0,0 +1,39 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+trait Iso[T, U] {
+ def to(t : T) : U
+ // def from(u : U) : T
+}
+
+object Iso {
+ implicit def materializeIso[T, U]: Iso[T, U] = macro impl[T, U]
+ def impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context): c.Expr[Iso[T, U]] = {
+ import c.universe._
+ import definitions._
+ import Flag._
+
+ val sym = c.weakTypeOf[T].typeSymbol
+ if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class")
+ val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+
+ def mkTpt() = {
+ val core = Ident(TupleClass(fields.length) orElse UnitClass)
+ if (fields.length == 0) core
+ else AppliedTypeTree(core, fields map (f => TypeTree(f.info)))
+ }
+
+ def mkFrom() = {
+ if (fields.length == 0) Literal(Constant(Unit))
+ else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim))))
+ }
+
+ val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template(
+ List(AppliedTypeTree(Ident(newTypeName("Iso")), List(Ident(sym), mkTpt()))),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))),
+ DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom()))))
+ c.Expr[Iso[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List())))
+ }
+}
diff --git a/tests/untried/neg/macro-blackbox-fundep-materialization/Test_2.scala b/tests/untried/neg/macro-blackbox-fundep-materialization/Test_2.scala
new file mode 100644
index 000000000..8b60943cf
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-fundep-materialization/Test_2.scala
@@ -0,0 +1,12 @@
+// see the comments for macroExpand.onDelayed for an explanation of what's tested here
+object Test extends App {
+ case class Foo(i: Int, s: String, b: Boolean)
+ def foo[C, L](c: C)(implicit iso: Iso[C, L]): L = iso.to(c)
+
+ {
+ val equiv = foo(Foo(23, "foo", true))
+ def typed[T](t: => T): Unit = {}
+ typed[(Int, String, Boolean)](equiv)
+ println(equiv)
+ }
+}
diff --git a/tests/untried/neg/macro-blackbox-structural.check b/tests/untried/neg/macro-blackbox-structural.check
new file mode 100644
index 000000000..86a218559
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-structural.check
@@ -0,0 +1,4 @@
+Test_2.scala:4: error: value x is not a member of Any
+ println(Macros.foo.x)
+ ^
+one error found
diff --git a/tests/untried/neg/macro-blackbox-structural/Impls_Macros_1.scala b/tests/untried/neg/macro-blackbox-structural/Impls_Macros_1.scala
new file mode 100644
index 000000000..786a3f45f
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-structural/Impls_Macros_1.scala
@@ -0,0 +1,15 @@
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: scala.reflect.macros.blackbox.Context) = {
+ import c.universe._
+ q"""
+ trait Foo {
+ def x = 2
+ }
+ new Foo {}
+ """
+ }
+
+ def foo: Any = macro impl
+}
diff --git a/tests/untried/neg/macro-blackbox-structural/Test_2.scala b/tests/untried/neg/macro-blackbox-structural/Test_2.scala
new file mode 100644
index 000000000..e02b4feb4
--- /dev/null
+++ b/tests/untried/neg/macro-blackbox-structural/Test_2.scala
@@ -0,0 +1,5 @@
+import Macros._
+
+object Test extends App {
+ println(Macros.foo.x)
+}
diff --git a/tests/untried/neg/macro-bundle-abstract.check b/tests/untried/neg/macro-bundle-abstract.check
new file mode 100644
index 000000000..1e51a00d0
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-abstract.check
@@ -0,0 +1,4 @@
+macro-bundle-abstract.scala:10: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-abstract.scala b/tests/untried/neg/macro-bundle-abstract.scala
new file mode 100644
index 000000000..db57d5dc9
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-abstract.scala
@@ -0,0 +1,11 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+abstract class Bundle(c: Context) {
+ def deferred: Int
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+}
diff --git a/tests/untried/neg/macro-bundle-ambiguous.check b/tests/untried/neg/macro-bundle-ambiguous.check
new file mode 100644
index 000000000..843049645
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-ambiguous.check
@@ -0,0 +1,5 @@
+macro-bundle-ambiguous.scala:13: error: macro implementation reference is ambiguous: makes sense both as
+a macro bundle method reference and a vanilla object method reference
+ def foo: Unit = macro Macros.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-ambiguous.scala b/tests/untried/neg/macro-bundle-ambiguous.scala
new file mode 100644
index 000000000..72c6a2c30
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-ambiguous.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: Context) {
+ def impl = ???
+}
+
+object Macros {
+ def impl(c: Context) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+}
diff --git a/tests/untried/neg/macro-bundle-need-qualifier.check b/tests/untried/neg/macro-bundle-need-qualifier.check
new file mode 100644
index 000000000..6a74ee6ae
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-need-qualifier.check
@@ -0,0 +1,4 @@
+macro-bundle-need-qualifier.scala:10: error: not found: value impl
+ def foo: Any = macro impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-need-qualifier.scala b/tests/untried/neg/macro-bundle-need-qualifier.scala
new file mode 100644
index 000000000..1edda8081
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-need-qualifier.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: Context) {
+ import c.universe._
+ def impl = q"()"
+}
+
+object Macros {
+ def foo: Any = macro impl
+}
diff --git a/tests/untried/neg/macro-bundle-noncontext.check b/tests/untried/neg/macro-bundle-noncontext.check
new file mode 100644
index 000000000..bb5d0851f
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-noncontext.check
@@ -0,0 +1,4 @@
+macro-bundle-noncontext.scala:8: error: not found: value Bundle
+ def foo = Bundle.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-noncontext.scala b/tests/untried/neg/macro-bundle-noncontext.scala
new file mode 100644
index 000000000..b3d7f4464
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-noncontext.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+
+class Bundle {
+ def impl = ???
+}
+
+object Macros {
+ def foo = Bundle.impl
+}
diff --git a/tests/untried/neg/macro-bundle-nonpublic-c.check b/tests/untried/neg/macro-bundle-nonpublic-c.check
new file mode 100644
index 000000000..1dfcee58b
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-nonpublic-c.check
@@ -0,0 +1,4 @@
+macro-bundle-nonpublic-c.scala:6: error: private value c escapes its defining scope as part of type Macros.this.c.universe.Literal
+ def impl = q"()"
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-nonpublic-c.scala b/tests/untried/neg/macro-bundle-nonpublic-c.scala
new file mode 100644
index 000000000..a24078751
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-nonpublic-c.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(c: Context) {
+ import c.universe._
+ def impl = q"()"
+}
+
+object Macros {
+ def foo: Any = macro Macros.impl
+}
diff --git a/tests/untried/neg/macro-bundle-nonpublic-impl.check b/tests/untried/neg/macro-bundle-nonpublic-impl.check
new file mode 100644
index 000000000..7a4e1516f
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-nonpublic-impl.check
@@ -0,0 +1,4 @@
+macro-bundle-nonpublic-impl.scala:10: error: bundle implementation must be public
+ def foo: Any = macro Macros.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-nonpublic-impl.scala b/tests/untried/neg/macro-bundle-nonpublic-impl.scala
new file mode 100644
index 000000000..1ed17277c
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-nonpublic-impl.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: Context) {
+ import c.universe._
+ private def impl = q"()"
+}
+
+object Macros {
+ def foo: Any = macro Macros.impl
+}
diff --git a/tests/untried/neg/macro-bundle-nonstatic.check b/tests/untried/neg/macro-bundle-nonstatic.check
new file mode 100644
index 000000000..36bccc54d
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-nonstatic.check
@@ -0,0 +1,13 @@
+macro-bundle-nonstatic.scala:12: error: value Bundle is not a member of object Module
+ def foo1 = macro Module.Bundle.impl
+ ^
+macro-bundle-nonstatic.scala:13: error: value Bundle is not a member of Module
+ def foo2 = macro new Module().Bundle.impl
+ ^
+macro-bundle-nonstatic.scala:17: error: macro bundles must be static
+ def foo = macro Bundle.impl
+ ^
+macro-bundle-nonstatic.scala:23: error: macro bundles must be static
+ def foo = macro Bundle.impl
+ ^
+four errors found
diff --git a/tests/untried/neg/macro-bundle-nonstatic.scala b/tests/untried/neg/macro-bundle-nonstatic.scala
new file mode 100644
index 000000000..dfba79660
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-nonstatic.scala
@@ -0,0 +1,36 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+class Module {
+ class Bundle(val c: Context) {
+ import c.universe._
+ def impl = q"()"
+ }
+}
+
+object Macros1 {
+ def foo1 = macro Module.Bundle.impl
+ def foo2 = macro new Module().Bundle.impl
+}
+
+object Macros2 extends Module {
+ def foo = macro Bundle.impl
+}
+
+object Macros3 {
+ val module = new Module
+ import module._
+ def foo = macro Bundle.impl
+}
+
+object Module {
+ class GoodBundle(val c: Context) {
+ import c.universe._
+ def impl = q"()"
+ }
+}
+
+object Macros4 {
+ import Module._
+ def foo: Unit = macro GoodBundle.impl
+}
diff --git a/tests/untried/neg/macro-bundle-object.check b/tests/untried/neg/macro-bundle-object.check
new file mode 100644
index 000000000..b8800105f
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-object.check
@@ -0,0 +1,8 @@
+macro-bundle-object.scala:10: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context): c.Tree
+ found : : Nothing
+number of parameter sections differ
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-object.scala b/tests/untried/neg/macro-bundle-object.scala
new file mode 100644
index 000000000..c92571033
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-object.scala
@@ -0,0 +1,11 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Bundle {
+ val c: Context = ???
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+}
diff --git a/tests/untried/neg/macro-bundle-overloaded.check b/tests/untried/neg/macro-bundle-overloaded.check
new file mode 100644
index 000000000..499068aaa
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-overloaded.check
@@ -0,0 +1,4 @@
+macro-bundle-overloaded.scala:11: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-overloaded.scala b/tests/untried/neg/macro-bundle-overloaded.scala
new file mode 100644
index 000000000..c5120b5b5
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-overloaded.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.{Context => BlackboxContext}
+import scala.reflect.macros.whitebox.{Context => WhiteboxContext}
+
+class Bundle(val c: BlackboxContext) {
+ def this(c: WhiteboxContext) = this(c: BlackboxContext)
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+}
diff --git a/tests/untried/neg/macro-bundle-polymorphic.check b/tests/untried/neg/macro-bundle-polymorphic.check
new file mode 100644
index 000000000..60a4d5911
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-polymorphic.check
@@ -0,0 +1,19 @@
+macro-bundle-polymorphic.scala:36: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def black1: Any = macro BlackboxBundle1.impl
+ ^
+macro-bundle-polymorphic.scala:37: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def black2: Any = macro BlackboxBundle2.impl
+ ^
+macro-bundle-polymorphic.scala:38: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def black3: Any = macro BlackboxBundle3.impl
+ ^
+macro-bundle-polymorphic.scala:40: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def white1: Any = macro WhiteboxBundle1.impl
+ ^
+macro-bundle-polymorphic.scala:41: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def white2: Any = macro WhiteboxBundle2.impl
+ ^
+macro-bundle-polymorphic.scala:42: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def white3: Any = macro WhiteboxBundle3.impl
+ ^
+6 errors found
diff --git a/tests/untried/neg/macro-bundle-polymorphic.scala b/tests/untried/neg/macro-bundle-polymorphic.scala
new file mode 100644
index 000000000..3e7ffe89c
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-polymorphic.scala
@@ -0,0 +1,43 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.{Context => BlackboxContext}
+import scala.reflect.macros.whitebox.{Context => WhiteboxContext}
+
+class BlackboxBundle1[T](val c: BlackboxContext) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class BlackboxBundle2[T <: BlackboxContext](val c: T) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class BlackboxBundle3[T <: BlackboxContext, U <: T](val c: U) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class WhiteboxBundle1[T](val c: WhiteboxContext) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class WhiteboxBundle2[T <: WhiteboxContext](val c: T) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class WhiteboxBundle3[T <: WhiteboxContext, U <: T](val c: U) {
+ import c.universe._
+ def impl = q"()"
+}
+
+object Macros {
+ def black1: Any = macro BlackboxBundle1.impl
+ def black2: Any = macro BlackboxBundle2.impl
+ def black3: Any = macro BlackboxBundle3.impl
+
+ def white1: Any = macro WhiteboxBundle1.impl
+ def white2: Any = macro WhiteboxBundle2.impl
+ def white3: Any = macro WhiteboxBundle3.impl
+}
diff --git a/tests/untried/neg/macro-bundle-priority-bundle.check b/tests/untried/neg/macro-bundle-priority-bundle.check
new file mode 100644
index 000000000..c6cea72ba
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-priority-bundle.check
@@ -0,0 +1,8 @@
+macro-bundle-priority-bundle.scala:13: error: bundle implementation has incompatible shape:
+ required: : Macros.this.c.Expr[Unit]
+ or : : Macros.this.c.Tree
+ found : (x: Macros.this.c.Tree): Nothing
+number of parameter sections differ
+ def foo: Unit = macro Macros.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-priority-bundle.scala b/tests/untried/neg/macro-bundle-priority-bundle.scala
new file mode 100644
index 000000000..ab9987b8f
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-priority-bundle.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: Context) {
+ def impl(x: c.Tree) = ???
+}
+
+object Macros {
+ def impl(c: Context)(x: c.Tree) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+}
diff --git a/tests/untried/neg/macro-bundle-priority-nonbundle.check b/tests/untried/neg/macro-bundle-priority-nonbundle.check
new file mode 100644
index 000000000..0d03b5074
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-priority-nonbundle.check
@@ -0,0 +1,8 @@
+macro-bundle-priority-nonbundle.scala:13: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.whitebox.Context): c.Expr[Unit]
+ or : (c: scala.reflect.macros.whitebox.Context): c.Tree
+ found : (c: scala.reflect.macros.whitebox.Context)(x: c.Tree): Nothing
+number of parameter sections differ
+ def foo: Unit = macro Macros.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-priority-nonbundle.scala b/tests/untried/neg/macro-bundle-priority-nonbundle.scala
new file mode 100644
index 000000000..0ef5b789a
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-priority-nonbundle.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: scala.reflect.api.Universe) {
+ def impl(x: c.Tree) = ???
+}
+
+object Macros {
+ def impl(c: Context)(x: c.Tree) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+}
diff --git a/tests/untried/neg/macro-bundle-trait.check b/tests/untried/neg/macro-bundle-trait.check
new file mode 100644
index 000000000..869c67e1e
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-trait.check
@@ -0,0 +1,4 @@
+macro-bundle-trait.scala:10: error: not found: value Bundle
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-trait.scala b/tests/untried/neg/macro-bundle-trait.scala
new file mode 100644
index 000000000..2015508b8
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-trait.scala
@@ -0,0 +1,11 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+trait Bundle {
+ val c: Context = ???
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+}
diff --git a/tests/untried/neg/macro-bundle-whitebox-use-raw.check b/tests/untried/neg/macro-bundle-whitebox-use-raw.check
new file mode 100644
index 000000000..5792e317a
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-whitebox-use-raw.check
@@ -0,0 +1,17 @@
+Test_2.scala:2: error: value x is not a member of Any
+ println(ReturnTypeRefinement.foo.x)
+ ^
+Test_2.scala:7: error: type mismatch;
+ found : FundepMaterialization[Test.Foo,(Int, String, Boolean)]
+ required: FundepMaterialization[Test.Foo,Nothing]
+Note: (Int, String, Boolean) >: Nothing, but trait FundepMaterialization is invariant in type U.
+You may wish to define U as -U instead. (SLS 4.5)
+ val equiv = foo(Foo(23, "foo", true))
+ ^
+Test_2.scala:13: error: I don't like classes that contain integers
+ println(implicitly[DynamicMaterialization[C1]])
+ ^
+Test_2.scala:17: error: extractor macros can only be whitebox
+ case ExtractorMacro(x) => println(x)
+ ^
+four errors found
diff --git a/tests/untried/neg/macro-bundle-whitebox-use-raw/Macros_1.scala b/tests/untried/neg/macro-bundle-whitebox-use-raw/Macros_1.scala
new file mode 100644
index 000000000..61bf73e48
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-whitebox-use-raw/Macros_1.scala
@@ -0,0 +1,108 @@
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+
+// whitebox use case #1: return type refinement
+
+class ReturnTypeRefinementBundle(val c: Context) {
+ import c.universe._
+ def impl = {
+ q"""
+ trait Foo {
+ def x = 2
+ }
+ new Foo {}
+ """
+ }
+}
+
+object ReturnTypeRefinement {
+ def foo: Any = macro ReturnTypeRefinementBundle.impl
+}
+
+// whitebox use case #2: fundep materialization
+
+trait FundepMaterialization[T, U] {
+ def to(t : T) : U
+ // def from(u : U) : T
+}
+
+class FundepMaterializationBundle(val c: Context) {
+ import c.universe._
+ import definitions._
+ import Flag._
+
+ def impl[T: c.WeakTypeTag, U: c.WeakTypeTag]: c.Expr[FundepMaterialization[T, U]] = {
+ val sym = c.weakTypeOf[T].typeSymbol
+ if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class")
+ val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+
+ def mkTpt() = {
+ val core = Ident(TupleClass(fields.length) orElse UnitClass)
+ if (fields.length == 0) core
+ else AppliedTypeTree(core, fields map (f => TypeTree(f.info)))
+ }
+
+ def mkFrom() = {
+ if (fields.length == 0) Literal(Constant(Unit))
+ else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim))))
+ }
+
+ val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template(
+ List(AppliedTypeTree(Ident(newTypeName("FundepMaterialization")), List(Ident(sym), mkTpt()))),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))),
+ DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom()))))
+ c.Expr[FundepMaterialization[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List())))
+ }
+}
+
+object FundepMaterialization {
+ implicit def materializeIso[T, U]: FundepMaterialization[T, U] = macro FundepMaterializationBundle.impl[T, U]
+}
+
+// whitebox use case #3: dynamic materialization
+
+trait DynamicMaterialization[T]
+
+class C1(val x: Int)
+class C2(val x: String)
+
+trait LowPriority {
+ implicit def lessSpecific[T]: DynamicMaterialization[T] = null
+}
+
+object DynamicMaterialization extends LowPriority {
+ implicit def moreSpecific[T]: DynamicMaterialization[T] = macro DynamicMaterializationBundle.impl[T]
+}
+
+class DynamicMaterializationBundle(val c: Context) {
+ import c.universe._
+ def impl[T: c.WeakTypeTag] = {
+ val tpe = weakTypeOf[T]
+ if (tpe.members.exists(_.info =:= typeOf[Int]))
+ c.abort(c.enclosingPosition, "I don't like classes that contain integers")
+ q"new DynamicMaterialization[$tpe]{ override def toString = ${tpe.toString} }"
+ }
+}
+
+// whitebox use case #4: extractor macros
+
+object ExtractorMacro {
+ def unapply(x: Int): Any = macro ExtractorBundle.unapplyImpl
+}
+
+class ExtractorBundle(val c: Context) {
+ import c.universe._
+ def unapplyImpl(x: Tree) = {
+ q"""
+ new {
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/tests/untried/neg/macro-bundle-whitebox-use-raw/Test_2.scala b/tests/untried/neg/macro-bundle-whitebox-use-raw/Test_2.scala
new file mode 100644
index 000000000..995da737c
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-whitebox-use-raw/Test_2.scala
@@ -0,0 +1,19 @@
+object Test extends App {
+ println(ReturnTypeRefinement.foo.x)
+
+ case class Foo(i: Int, s: String, b: Boolean)
+ def foo[C, L](c: C)(implicit iso: FundepMaterialization[C, L]): L = iso.to(c)
+ locally {
+ val equiv = foo(Foo(23, "foo", true))
+ def typed[T](t: => T): Unit = {}
+ typed[(Int, String, Boolean)](equiv)
+ println(equiv)
+ }
+
+ println(implicitly[DynamicMaterialization[C1]])
+ println(implicitly[DynamicMaterialization[C2]])
+
+ 42 match {
+ case ExtractorMacro(x) => println(x)
+ }
+}
diff --git a/tests/untried/neg/macro-bundle-whitebox-use-refined.check b/tests/untried/neg/macro-bundle-whitebox-use-refined.check
new file mode 100644
index 000000000..5792e317a
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-whitebox-use-refined.check
@@ -0,0 +1,17 @@
+Test_2.scala:2: error: value x is not a member of Any
+ println(ReturnTypeRefinement.foo.x)
+ ^
+Test_2.scala:7: error: type mismatch;
+ found : FundepMaterialization[Test.Foo,(Int, String, Boolean)]
+ required: FundepMaterialization[Test.Foo,Nothing]
+Note: (Int, String, Boolean) >: Nothing, but trait FundepMaterialization is invariant in type U.
+You may wish to define U as -U instead. (SLS 4.5)
+ val equiv = foo(Foo(23, "foo", true))
+ ^
+Test_2.scala:13: error: I don't like classes that contain integers
+ println(implicitly[DynamicMaterialization[C1]])
+ ^
+Test_2.scala:17: error: extractor macros can only be whitebox
+ case ExtractorMacro(x) => println(x)
+ ^
+four errors found
diff --git a/tests/untried/neg/macro-bundle-whitebox-use-refined/Macros_1.scala b/tests/untried/neg/macro-bundle-whitebox-use-refined/Macros_1.scala
new file mode 100644
index 000000000..186604422
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-whitebox-use-refined/Macros_1.scala
@@ -0,0 +1,108 @@
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+
+// whitebox use case #1: return type refinement
+
+class ReturnTypeRefinementBundle(val c: Context { type PrefixType = Nothing }) {
+ import c.universe._
+ def impl = {
+ q"""
+ trait Foo {
+ def x = 2
+ }
+ new Foo {}
+ """
+ }
+}
+
+object ReturnTypeRefinement {
+ def foo: Any = macro ReturnTypeRefinementBundle.impl
+}
+
+// whitebox use case #2: fundep materialization
+
+trait FundepMaterialization[T, U] {
+ def to(t : T) : U
+ // def from(u : U) : T
+}
+
+class FundepMaterializationBundle(val c: Context { type PrefixType = Nothing }) {
+ import c.universe._
+ import definitions._
+ import Flag._
+
+ def impl[T: c.WeakTypeTag, U: c.WeakTypeTag]: c.Expr[FundepMaterialization[T, U]] = {
+ val sym = c.weakTypeOf[T].typeSymbol
+ if (!sym.isClass || !sym.asClass.isCaseClass) c.abort(c.enclosingPosition, s"$sym is not a case class")
+ val fields = sym.info.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+
+ def mkTpt() = {
+ val core = Ident(TupleClass(fields.length) orElse UnitClass)
+ if (fields.length == 0) core
+ else AppliedTypeTree(core, fields map (f => TypeTree(f.info)))
+ }
+
+ def mkFrom() = {
+ if (fields.length == 0) Literal(Constant(Unit))
+ else Apply(Ident(newTermName("Tuple" + fields.length)), fields map (f => Select(Ident(newTermName("f")), newTermName(f.name.toString.trim))))
+ }
+
+ val evidenceClass = ClassDef(Modifiers(FINAL), newTypeName("$anon"), List(), Template(
+ List(AppliedTypeTree(Ident(newTypeName("FundepMaterialization")), List(Ident(sym), mkTpt()))),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(typeNames.EMPTY), typeNames.EMPTY), termNames.CONSTRUCTOR), List())), Literal(Constant(())))),
+ DefDef(Modifiers(), newTermName("to"), List(), List(List(ValDef(Modifiers(PARAM), newTermName("f"), Ident(sym), EmptyTree))), TypeTree(), mkFrom()))))
+ c.Expr[FundepMaterialization[T, U]](Block(List(evidenceClass), Apply(Select(New(Ident(newTypeName("$anon"))), termNames.CONSTRUCTOR), List())))
+ }
+}
+
+object FundepMaterialization {
+ implicit def materializeIso[T, U]: FundepMaterialization[T, U] = macro FundepMaterializationBundle.impl[T, U]
+}
+
+// whitebox use case #3: dynamic materialization
+
+trait DynamicMaterialization[T]
+
+class C1(val x: Int)
+class C2(val x: String)
+
+trait LowPriority {
+ implicit def lessSpecific[T]: DynamicMaterialization[T] = null
+}
+
+object DynamicMaterialization extends LowPriority {
+ implicit def moreSpecific[T]: DynamicMaterialization[T] = macro DynamicMaterializationBundle.impl[T]
+}
+
+class DynamicMaterializationBundle(val c: Context { type PrefixType = Nothing }) {
+ import c.universe._
+ def impl[T: c.WeakTypeTag] = {
+ val tpe = weakTypeOf[T]
+ if (tpe.members.exists(_.info =:= typeOf[Int]))
+ c.abort(c.enclosingPosition, "I don't like classes that contain integers")
+ q"new DynamicMaterialization[$tpe]{ override def toString = ${tpe.toString} }"
+ }
+}
+
+// whitebox use case #4: extractor macros
+
+object ExtractorMacro {
+ def unapply(x: Int): Any = macro ExtractorBundle.unapplyImpl
+}
+
+class ExtractorBundle(val c: Context { type PrefixType = Nothing }) {
+ import c.universe._
+ def unapplyImpl(x: Tree) = {
+ q"""
+ new {
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/tests/untried/neg/macro-bundle-whitebox-use-refined/Test_2.scala b/tests/untried/neg/macro-bundle-whitebox-use-refined/Test_2.scala
new file mode 100644
index 000000000..995da737c
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-whitebox-use-refined/Test_2.scala
@@ -0,0 +1,19 @@
+object Test extends App {
+ println(ReturnTypeRefinement.foo.x)
+
+ case class Foo(i: Int, s: String, b: Boolean)
+ def foo[C, L](c: C)(implicit iso: FundepMaterialization[C, L]): L = iso.to(c)
+ locally {
+ val equiv = foo(Foo(23, "foo", true))
+ def typed[T](t: => T): Unit = {}
+ typed[(Int, String, Boolean)](equiv)
+ println(equiv)
+ }
+
+ println(implicitly[DynamicMaterialization[C1]])
+ println(implicitly[DynamicMaterialization[C2]])
+
+ 42 match {
+ case ExtractorMacro(x) => println(x)
+ }
+}
diff --git a/tests/untried/neg/macro-bundle-wrongcontext-a.check b/tests/untried/neg/macro-bundle-wrongcontext-a.check
new file mode 100644
index 000000000..10aadb003
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-wrongcontext-a.check
@@ -0,0 +1,4 @@
+macro-bundle-wrongcontext-a.scala:12: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def foo: Any = macro Bundle.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-wrongcontext-a.scala b/tests/untried/neg/macro-bundle-wrongcontext-a.scala
new file mode 100644
index 000000000..0cfd43315
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-wrongcontext-a.scala
@@ -0,0 +1,13 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+abstract class MyContext extends Context
+
+class Bundle(val c: MyContext) {
+ import c.universe._
+ def impl = q"()"
+}
+
+object Macros {
+ def foo: Any = macro Bundle.impl
+}
diff --git a/tests/untried/neg/macro-bundle-wrongcontext-b.check b/tests/untried/neg/macro-bundle-wrongcontext-b.check
new file mode 100644
index 000000000..e9700d379
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-wrongcontext-b.check
@@ -0,0 +1,4 @@
+macro-bundle-wrongcontext-b.scala:10: error: macro bundles must be concrete monomorphic classes having a single constructor with a `val c: Context` parameter
+ def foo: Any = macro Bundle.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-bundle-wrongcontext-b.scala b/tests/untried/neg/macro-bundle-wrongcontext-b.scala
new file mode 100644
index 000000000..5f47e46e4
--- /dev/null
+++ b/tests/untried/neg/macro-bundle-wrongcontext-b.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Bundle(val c: Context { type Foo <: Int }) {
+ import c.universe._
+ def impl = q"()"
+}
+
+object Macros {
+ def foo: Any = macro Bundle.impl
+}
diff --git a/tests/untried/neg/macro-cyclic.check b/tests/untried/neg/macro-cyclic.check
new file mode 100644
index 000000000..7978ec64a
--- /dev/null
+++ b/tests/untried/neg/macro-cyclic.check
@@ -0,0 +1,4 @@
+Impls_Macros_1.scala:5: error: could not find implicit value for parameter e: SourceLocation
+ c.universe.reify { implicitly[SourceLocation] }
+ ^
+one error found
diff --git a/tests/untried/neg/macro-cyclic.flags b/tests/untried/neg/macro-cyclic.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-cyclic.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-cyclic/Impls_Macros_1.scala b/tests/untried/neg/macro-cyclic/Impls_Macros_1.scala
new file mode 100644
index 000000000..ad6890144
--- /dev/null
+++ b/tests/untried/neg/macro-cyclic/Impls_Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = {
+ c.universe.reify { implicitly[SourceLocation] }
+ }
+
+ implicit def sourceLocation: SourceLocation1 = macro impl
+}
+
+trait SourceLocation {
+ /** Source location of the outermost call */
+ val outer: SourceLocation
+
+ /** The name of the source file */
+ val fileName: String
+
+ /** The line number */
+ val line: Int
+
+ /** The character offset */
+ val charOffset: Int
+}
+
+case class SourceLocation1(val outer: SourceLocation, val fileName: String, val line: Int, val charOffset: Int) extends SourceLocation
diff --git a/tests/untried/neg/macro-deprecate-idents.check b/tests/untried/neg/macro-deprecate-idents.check
new file mode 100644
index 000000000..c5902aeea
--- /dev/null
+++ b/tests/untried/neg/macro-deprecate-idents.check
@@ -0,0 +1,67 @@
+macro-deprecate-idents.scala:2: error: macro is now a reserved word; usage as an identifier is disallowed
+ val macro = ???
+ ^
+macro-deprecate-idents.scala:6: error: macro is now a reserved word; usage as an identifier is disallowed
+ var macro = ???
+ ^
+macro-deprecate-idents.scala:10: error: macro is now a reserved word; usage as an identifier is disallowed
+ type macro = Int
+ ^
+macro-deprecate-idents.scala:14: error: macro is now a reserved word; usage as an identifier is disallowed
+ class macro
+ ^
+macro-deprecate-idents.scala:18: error: macro is now a reserved word; usage as an identifier is disallowed
+ class macro
+ ^
+macro-deprecate-idents.scala:22: error: macro is now a reserved word; usage as an identifier is disallowed
+ object macro
+ ^
+macro-deprecate-idents.scala:26: error: macro is now a reserved word; usage as an identifier is disallowed
+ object macro
+ ^
+macro-deprecate-idents.scala:30: error: macro is now a reserved word; usage as an identifier is disallowed
+ trait macro
+ ^
+macro-deprecate-idents.scala:34: error: macro is now a reserved word; usage as an identifier is disallowed
+ trait macro
+ ^
+macro-deprecate-idents.scala:37: error: macro is now a reserved word; usage as an identifier is disallowed
+package macro {
+ ^
+macro-deprecate-idents.scala:38: error: macro is now a reserved word; usage as an identifier is disallowed
+ package macro.bar {
+ ^
+macro-deprecate-idents.scala:43: error: macro is now a reserved word; usage as an identifier is disallowed
+ package macro.foo {
+ ^
+macro-deprecate-idents.scala:48: error: macro is now a reserved word; usage as an identifier is disallowed
+ val Some(macro) = Some(42)
+ ^
+macro-deprecate-idents.scala:49: error: macro is now a reserved word; usage as an identifier is disallowed
+ macro match {
+ ^
+macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is disallowed
+ case macro => println(macro)
+ ^
+macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is disallowed
+ case macro => println(macro)
+ ^
+macro-deprecate-idents.scala:55: error: macro is now a reserved word; usage as an identifier is disallowed
+ def macro = 2
+ ^
+macro-deprecate-idents.scala:3: error: '=' expected but '}' found.
+}
+^
+macro-deprecate-idents.scala:7: error: '=' expected but '}' found.
+}
+^
+macro-deprecate-idents.scala:42: error: '{' expected but ';' found.
+package foo {
+^
+macro-deprecate-idents.scala:45: error: '{' expected but '}' found.
+}
+^
+macro-deprecate-idents.scala:52: error: ')' expected but '}' found.
+}
+^
+22 errors found
diff --git a/tests/untried/neg/macro-deprecate-idents.flags b/tests/untried/neg/macro-deprecate-idents.flags
new file mode 100644
index 000000000..c6bfaf1f6
--- /dev/null
+++ b/tests/untried/neg/macro-deprecate-idents.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/tests/untried/neg/macro-deprecate-idents.scala b/tests/untried/neg/macro-deprecate-idents.scala
new file mode 100644
index 000000000..eb418053b
--- /dev/null
+++ b/tests/untried/neg/macro-deprecate-idents.scala
@@ -0,0 +1,56 @@
+object Test1 {
+ val macro = ???
+}
+
+object Test2 {
+ var macro = ???
+}
+
+object Test3 {
+ type macro = Int
+}
+
+package test4 {
+ class macro
+}
+
+object Test5 {
+ class macro
+}
+
+package test6 {
+ object macro
+}
+
+object Test7 {
+ object macro
+}
+
+package test8 {
+ trait macro
+}
+
+object Test9 {
+ trait macro
+}
+
+package macro {
+ package macro.bar {
+ }
+}
+
+package foo {
+ package macro.foo {
+ }
+}
+
+object Test12 {
+ val Some(macro) = Some(42)
+ macro match {
+ case macro => println(macro)
+ }
+}
+
+object Test13 {
+ def macro = 2
+}
diff --git a/tests/untried/neg/macro-divergence-controlled.check b/tests/untried/neg/macro-divergence-controlled.check
new file mode 100644
index 000000000..4876f7cf9
--- /dev/null
+++ b/tests/untried/neg/macro-divergence-controlled.check
@@ -0,0 +1,4 @@
+Test_2.scala:2: error: could not find implicit value for parameter e: Complex[Foo]
+ println(implicitly[Complex[Foo]])
+ ^
+one error found
diff --git a/tests/untried/neg/macro-divergence-controlled/Impls_Macros_1.scala b/tests/untried/neg/macro-divergence-controlled/Impls_Macros_1.scala
new file mode 100644
index 000000000..5c0450326
--- /dev/null
+++ b/tests/untried/neg/macro-divergence-controlled/Impls_Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+trait Complex[T]
+
+class Foo(val foo: Foo)
+
+object Complex {
+ def impl[T: c.WeakTypeTag](c: Context): c.Expr[Complex[T]] = {
+ import c.universe._
+ val tpe = weakTypeOf[T]
+ for (f <- tpe.decls.collect{case f: TermSymbol if f.isParamAccessor && !f.isMethod => f}) {
+ val trecur = appliedType(typeOf[Complex[_]], List(f.info))
+ if (c.openImplicits.tail.exists(ic => ic.pt =:= trecur)) c.abort(c.enclosingPosition, "diverging implicit expansion. reported by a macro!")
+ val recur = c.inferImplicitValue(trecur, silent = true)
+ if (recur == EmptyTree) c.abort(c.enclosingPosition, s"couldn't synthesize $trecur")
+ }
+ c.Expr[Null](q"null")
+ }
+
+ implicit object ComplexString extends Complex[String]
+ implicit def genComplex[T]: Complex[T] = macro impl[T]
+}
diff --git a/tests/untried/neg/macro-divergence-controlled/Test_2.scala b/tests/untried/neg/macro-divergence-controlled/Test_2.scala
new file mode 100644
index 000000000..e06175f30
--- /dev/null
+++ b/tests/untried/neg/macro-divergence-controlled/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ println(implicitly[Complex[Foo]])
+}
diff --git a/tests/untried/neg/macro-exception.check b/tests/untried/neg/macro-exception.check
new file mode 100644
index 000000000..dca97aebc
--- /dev/null
+++ b/tests/untried/neg/macro-exception.check
@@ -0,0 +1,7 @@
+Test_2.scala:2: error: exception during macro expansion:
+java.lang.Exception
+ at Macros$.impl(Macros_1.scala:6)
+
+ Macros.exception
+ ^
+one error found
diff --git a/tests/untried/neg/macro-exception/Macros_1.scala b/tests/untried/neg/macro-exception/Macros_1.scala
new file mode 100644
index 000000000..cd8e3c844
--- /dev/null
+++ b/tests/untried/neg/macro-exception/Macros_1.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = {
+ throw new Exception()
+ }
+ def exception = macro impl
+}
diff --git a/tests/untried/neg/macro-exception/Test_2.scala b/tests/untried/neg/macro-exception/Test_2.scala
new file mode 100644
index 000000000..223ee32c9
--- /dev/null
+++ b/tests/untried/neg/macro-exception/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.exception
+}
diff --git a/tests/untried/neg/macro-false-deprecation-warning.check b/tests/untried/neg/macro-false-deprecation-warning.check
new file mode 100644
index 000000000..7d56505ec
--- /dev/null
+++ b/tests/untried/neg/macro-false-deprecation-warning.check
@@ -0,0 +1,4 @@
+Impls_Macros_1.scala:5: error: illegal start of simple expression
+}
+^
+one error found
diff --git a/tests/untried/neg/macro-false-deprecation-warning.flags b/tests/untried/neg/macro-false-deprecation-warning.flags
new file mode 100644
index 000000000..59af162db
--- /dev/null
+++ b/tests/untried/neg/macro-false-deprecation-warning.flags
@@ -0,0 +1 @@
+-language:experimental.macros -deprecation \ No newline at end of file
diff --git a/tests/untried/neg/macro-false-deprecation-warning/Impls_Macros_1.scala b/tests/untried/neg/macro-false-deprecation-warning/Impls_Macros_1.scala
new file mode 100644
index 000000000..a97dfd4dd
--- /dev/null
+++ b/tests/untried/neg/macro-false-deprecation-warning/Impls_Macros_1.scala
@@ -0,0 +1,15 @@
+import scala.reflect.macros.blackbox.Context
+
+object Helper {
+ def unapplySeq[T](x: List[T]): Option[Seq[T]] =
+}
+
+object Macros {
+ def impl[T: c.WeakTypeTag](c: Context)(x: c.Expr[List[T]]) = {
+ c.universe.reify(Helper.unapplySeq(x.splice))
+ }
+
+ object UnapplyMacro {
+ def unapplySeq[T](x: List[T]): Option[Seq[T]] = macro impl[T]
+ }
+}
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-a.check b/tests/untried/neg/macro-incompatible-macro-engine-a.check
new file mode 100644
index 000000000..8ae08bd16
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-a.check
@@ -0,0 +1,7 @@
+Test_3.scala:2: error: macro cannot be expanded, because it was compiled by an incompatible macro engine
+ Macros.foo
+ ^
+Test_3.scala:3: error: macro cannot be expanded, because it was compiled by an incompatible macro engine
+ Macros.foo
+ ^
+two errors found
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-a/Macros_2.flags b/tests/untried/neg/macro-incompatible-macro-engine-a/Macros_2.flags
new file mode 100644
index 000000000..966df731d
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-a/Macros_2.flags
@@ -0,0 +1 @@
+-Xplugin:. \ No newline at end of file
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-a/Macros_2.scala b/tests/untried/neg/macro-incompatible-macro-engine-a/Macros_2.scala
new file mode 100644
index 000000000..5b0c1faec
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-a/Macros_2.scala
@@ -0,0 +1,7 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = c.universe.Literal(c.universe.Constant(()))
+ def foo: Unit = macro impl
+}
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-a/Plugin_1.scala b/tests/untried/neg/macro-incompatible-macro-engine-a/Plugin_1.scala
new file mode 100644
index 000000000..8e727dae6
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-a/Plugin_1.scala
@@ -0,0 +1,35 @@
+package incompatibleMacroEngine
+
+import scala.tools.nsc.Global
+import scala.tools.nsc.plugins.{Plugin => NscPlugin}
+
+class Plugin(val global: Global) extends NscPlugin {
+ import global._
+ import analyzer._
+
+ val name = "incompatibleMacroEngine"
+ val description = "A sample analyzer plugin that crafts a macro impl binding with a non-standard macro engine."
+ val components = Nil
+ addMacroPlugin(MacroPlugin)
+
+ object MacroPlugin extends MacroPlugin {
+ def fixupBinding(tree: Tree) = new Transformer {
+ override def transform(tree: Tree) = {
+ tree match {
+ case Literal(const @ Constant(x)) if tree.tpe == null => tree setType ConstantType(const)
+ case _ if tree.tpe == null => tree setType NoType
+ case _ => ;
+ }
+ super.transform(tree)
+ }
+ }.transform(tree)
+
+ override def pluginsTypedMacroBody(typer: Typer, ddef: DefDef): Option[Tree] = {
+ val result = standardTypedMacroBody(typer, ddef)
+ val List(AnnotationInfo(atp, List(Apply(nucleus, _ :: others)), Nil)) = ddef.symbol.annotations
+ val updatedBinding = Apply(nucleus, Assign(Literal(Constant("macroEngine")), Literal(Constant("vxxx (implemented in the incompatibleMacroEngine plugin)"))) :: others)
+ ddef.symbol.setAnnotations(List(AnnotationInfo(atp, List(fixupBinding(updatedBinding)), Nil)))
+ Some(result)
+ }
+ }
+}
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-a/Test_3.scala b/tests/untried/neg/macro-incompatible-macro-engine-a/Test_3.scala
new file mode 100644
index 000000000..4b6836e51
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-a/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ Macros.foo
+ Macros.foo
+}
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-a/scalac-plugin.xml b/tests/untried/neg/macro-incompatible-macro-engine-a/scalac-plugin.xml
new file mode 100644
index 000000000..42b9cdd75
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-a/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>incompatible-macro-engine</name>
+ <classname>incompatibleMacroEngine.Plugin</classname>
+</plugin> \ No newline at end of file
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-b.check b/tests/untried/neg/macro-incompatible-macro-engine-b.check
new file mode 100644
index 000000000..2a7510cf8
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-b.check
@@ -0,0 +1,7 @@
+Test_3.scala:2: error: macro cannot be expanded, because it was compiled by an incompatible macro engine (internal diagnostic: expected = v7.0 (implemented in Scala 2.11.0-M8), actual = vxxx (implemented in the incompatibleMacroEngine plugin))
+ Macros.foo
+ ^
+Test_3.scala:3: error: macro cannot be expanded, because it was compiled by an incompatible macro engine (internal diagnostic: expected = v7.0 (implemented in Scala 2.11.0-M8), actual = vxxx (implemented in the incompatibleMacroEngine plugin))
+ Macros.foo
+ ^
+two errors found
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-b.flags b/tests/untried/neg/macro-incompatible-macro-engine-b.flags
new file mode 100644
index 000000000..037a693bb
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-b.flags
@@ -0,0 +1 @@
+-Ymacro-debug-lite \ No newline at end of file
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-b/Macros_2.flags b/tests/untried/neg/macro-incompatible-macro-engine-b/Macros_2.flags
new file mode 100644
index 000000000..966df731d
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-b/Macros_2.flags
@@ -0,0 +1 @@
+-Xplugin:. \ No newline at end of file
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-b/Macros_2.scala b/tests/untried/neg/macro-incompatible-macro-engine-b/Macros_2.scala
new file mode 100644
index 000000000..5b0c1faec
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-b/Macros_2.scala
@@ -0,0 +1,7 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = c.universe.Literal(c.universe.Constant(()))
+ def foo: Unit = macro impl
+}
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-b/Plugin_1.scala b/tests/untried/neg/macro-incompatible-macro-engine-b/Plugin_1.scala
new file mode 100644
index 000000000..8e727dae6
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-b/Plugin_1.scala
@@ -0,0 +1,35 @@
+package incompatibleMacroEngine
+
+import scala.tools.nsc.Global
+import scala.tools.nsc.plugins.{Plugin => NscPlugin}
+
+class Plugin(val global: Global) extends NscPlugin {
+ import global._
+ import analyzer._
+
+ val name = "incompatibleMacroEngine"
+ val description = "A sample analyzer plugin that crafts a macro impl binding with a non-standard macro engine."
+ val components = Nil
+ addMacroPlugin(MacroPlugin)
+
+ object MacroPlugin extends MacroPlugin {
+ def fixupBinding(tree: Tree) = new Transformer {
+ override def transform(tree: Tree) = {
+ tree match {
+ case Literal(const @ Constant(x)) if tree.tpe == null => tree setType ConstantType(const)
+ case _ if tree.tpe == null => tree setType NoType
+ case _ => ;
+ }
+ super.transform(tree)
+ }
+ }.transform(tree)
+
+ override def pluginsTypedMacroBody(typer: Typer, ddef: DefDef): Option[Tree] = {
+ val result = standardTypedMacroBody(typer, ddef)
+ val List(AnnotationInfo(atp, List(Apply(nucleus, _ :: others)), Nil)) = ddef.symbol.annotations
+ val updatedBinding = Apply(nucleus, Assign(Literal(Constant("macroEngine")), Literal(Constant("vxxx (implemented in the incompatibleMacroEngine plugin)"))) :: others)
+ ddef.symbol.setAnnotations(List(AnnotationInfo(atp, List(fixupBinding(updatedBinding)), Nil)))
+ Some(result)
+ }
+ }
+}
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-b/Test_3.scala b/tests/untried/neg/macro-incompatible-macro-engine-b/Test_3.scala
new file mode 100644
index 000000000..4b6836e51
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-b/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ Macros.foo
+ Macros.foo
+}
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-b/scalac-plugin.xml b/tests/untried/neg/macro-incompatible-macro-engine-b/scalac-plugin.xml
new file mode 100644
index 000000000..42b9cdd75
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-b/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>incompatible-macro-engine</name>
+ <classname>incompatibleMacroEngine.Plugin</classname>
+</plugin> \ No newline at end of file
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-c.check b/tests/untried/neg/macro-incompatible-macro-engine-c.check
new file mode 100644
index 000000000..fb6c59ab7
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-c.check
@@ -0,0 +1,4 @@
+macro-incompatible-macro-engine-c.scala:2: error: can't expand macros compiled by previous versions of Scala
+ MacroLibCompiledByScala210x.foo
+ ^
+one error found
diff --git a/tests/untried/neg/macro-incompatible-macro-engine-c.scala b/tests/untried/neg/macro-incompatible-macro-engine-c.scala
new file mode 100644
index 000000000..75ada5da3
--- /dev/null
+++ b/tests/untried/neg/macro-incompatible-macro-engine-c.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ MacroLibCompiledByScala210x.foo
+}
diff --git a/tests/untried/neg/macro-invalidimpl.check b/tests/untried/neg/macro-invalidimpl.check
new file mode 100644
index 000000000..ea7d71c66
--- /dev/null
+++ b/tests/untried/neg/macro-invalidimpl.check
@@ -0,0 +1,53 @@
+Macros_Test_2.scala:5: error: macro implementation reference has wrong shape. required:
+macro [<static object>].<method name>[[<type args>]] or
+macro [<macro bundle>].<method name>[[<type args>]]
+ def foo(x: Any) = macro impls.foo
+ ^
+Macros_Test_2.scala:10: error: macro implementation reference has wrong shape. required:
+macro [<static object>].<method name>[[<type args>]] or
+macro [<macro bundle>].<method name>[[<type args>]]
+ def foo(x: Any) = macro impls.foo
+ ^
+Macros_Test_2.scala:18: error: macro implementation reference has wrong shape. required:
+macro [<static object>].<method name>[[<type args>]] or
+macro [<macro bundle>].<method name>[[<type args>]]
+ def foo(x: Any) = macro Impls3.foo
+ ^
+Macros_Test_2.scala:22: error: macro implementation reference has wrong shape. required:
+macro [<static object>].<method name>[[<type args>]] or
+macro [<macro bundle>].<method name>[[<type args>]]
+ def foo(x: Any) = macro Impls4.foo
+ ^
+Macros_Test_2.scala:26: error: ambiguous reference to overloaded definition,
+both method foo in object Impls5 of type (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
+and method foo in object Impls5 of type (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any])Nothing
+match expected type ?
+ def foo(x: Any) = macro Impls5.foo
+ ^
+Macros_Test_2.scala:27: error: ambiguous reference to overloaded definition,
+both method foo in object Impls5 of type (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
+and method foo in object Impls5 of type (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any])Nothing
+match expected type ?
+ def foo(x: Any, y: Any) = macro Impls5.foo
+ ^
+Macros_Test_2.scala:31: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Unit]
+ or : (c: scala.reflect.macros.blackbox.Context): c.Tree
+ found : (c: scala.reflect.macros.blackbox.Context)(): c.Expr[Unit]
+number of parameter sections differ
+ def foo1 = macro Impls6.fooEmpty
+ ^
+Macros_Test_2.scala:32: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(): c.Expr[Unit]
+ or : (c: scala.reflect.macros.blackbox.Context)(): c.Tree
+ found : (c: scala.reflect.macros.blackbox.Context): c.Expr[Unit]
+number of parameter sections differ
+ def bar1() = macro Impls6.fooNullary
+ ^
+Macros_Test_2.scala:36: error: type arguments [String] do not conform to method foo's type parameter bounds [U <: Int]
+ def foo = macro Impls7.foo[String]
+ ^
+Macros_Test_2.scala:53: error: macro implementation must be public
+ def foo = macro Impls8.impl
+ ^
+10 errors found
diff --git a/tests/untried/neg/macro-invalidimpl.flags b/tests/untried/neg/macro-invalidimpl.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidimpl.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidimpl/Impls_1.scala b/tests/untried/neg/macro-invalidimpl/Impls_1.scala
new file mode 100644
index 000000000..862c93b5e
--- /dev/null
+++ b/tests/untried/neg/macro-invalidimpl/Impls_1.scala
@@ -0,0 +1,39 @@
+import scala.reflect.macros.blackbox.Context
+
+class Impls1 {
+ def foo(c: Context)(x: c.Expr[Any]) = ???
+}
+
+object Impls2 {
+ def foo(c: Context)(x: c.Expr[Any]) = ???
+}
+
+trait MacroHelpers {
+ object Impls4 {
+ def foo(c: Context)(x: c.Expr[Any]) = x
+ }
+}
+
+object Impls5 {
+ def foo(c: Context)(x: c.Expr[Any]) = ???
+ def foo(c: Context)(x: c.Expr[Any], y: c.Expr[Any]) = ???
+}
+
+object Impls6 {
+ def fooNullary(c: Context) = {
+ import c.universe._
+ c.Expr[Unit](q"""Predef.println("it works")""")
+ }
+
+ def fooEmpty(c: Context)() = fooNullary(c)
+}
+
+object Impls7 {
+ def foo[U <: Int](c: Context) = ???
+}
+
+package foo {
+ object Impls8 {
+ private[foo] def impl(c: Context) = ???
+ }
+}
diff --git a/tests/untried/neg/macro-invalidimpl/Macros_Test_2.scala b/tests/untried/neg/macro-invalidimpl/Macros_Test_2.scala
new file mode 100644
index 000000000..44d665ea2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidimpl/Macros_Test_2.scala
@@ -0,0 +1,55 @@
+import scala.reflect.macros.blackbox.Context
+
+object Macros1 {
+ val impls = new Impls1
+ def foo(x: Any) = macro impls.foo
+}
+
+object Macros2 {
+ val impls = Impls2
+ def foo(x: Any) = macro impls.foo
+}
+
+class Macros3 {
+ object Impls3 {
+ def foo(c: Context)(x: c.Expr[Any]) = ???
+ }
+
+ def foo(x: Any) = macro Impls3.foo
+}
+
+class Macros4 extends MacroHelpers {
+ def foo(x: Any) = macro Impls4.foo
+}
+
+object Macros5 {
+ def foo(x: Any) = macro Impls5.foo
+ def foo(x: Any, y: Any) = macro Impls5.foo
+}
+
+object Macros6 {
+ def foo1 = macro Impls6.fooEmpty
+ def bar1() = macro Impls6.fooNullary
+}
+
+object Macros7 {
+ def foo = macro Impls7.foo[String]
+}
+
+object Test extends App {
+ println(Macros1.foo(42))
+ println(Macros2.foo(42))
+ println(new Macros3().foo(42))
+ println(new Macros4().foo(42))
+ println(Macros5.foo(42))
+ println(Macros6.foo1)
+ println(Macros6.bar1)
+ println(Macros6.bar1())
+ println(Macros7.foo)
+}
+
+package foo {
+ object Test extends App {
+ def foo = macro Impls8.impl
+ }
+}
diff --git a/tests/untried/neg/macro-invalidret.check b/tests/untried/neg/macro-invalidret.check
new file mode 100644
index 000000000..568cc7c57
--- /dev/null
+++ b/tests/untried/neg/macro-invalidret.check
@@ -0,0 +1,35 @@
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.blackbox.Context): c.Tree
+ found : (c: scala.reflect.macros.blackbox.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 incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.blackbox.Context): c.Tree
+ found : (c: scala.reflect.macros.blackbox.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
+ ^
+Macros_Test_2.scala:6: error: macro defs must have explicitly specified return types
+ def foo5 = macro Impls.foo5
+ ^
+Macros_Test_2.scala:7: warning: macro defs must have explicitly specified return types (inference of Int from macro impl's c.Expr[Int] is deprecated and is going to stop working in 2.12)
+ def foo6 = macro Impls.foo6
+ ^
+Macros_Test_2.scala:14: error: exception during macro expansion:
+scala.NotImplementedError: an implementation is missing
+ at scala.Predef$.$qmark$qmark$qmark(Predef.scala:225)
+ at Impls$.foo3(Impls_1.scala:7)
+
+ foo3
+ ^
+Macros_Test_2.scala:15: error: macro implementation is missing
+ foo4
+ ^
+Macros_Test_2.scala:17: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ foo6
+ ^
+two warnings found
+5 errors found
diff --git a/tests/untried/neg/macro-invalidret.flags b/tests/untried/neg/macro-invalidret.flags
new file mode 100644
index 000000000..946c53ec0
--- /dev/null
+++ b/tests/untried/neg/macro-invalidret.flags
@@ -0,0 +1,3 @@
+-language:experimental.macros
+-Xfatal-warnings
+-deprecation \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidret/Impls_1.scala b/tests/untried/neg/macro-invalidret/Impls_1.scala
new file mode 100644
index 000000000..434aeef10
--- /dev/null
+++ b/tests/untried/neg/macro-invalidret/Impls_1.scala
@@ -0,0 +1,10 @@
+import scala.reflect.macros.blackbox.Context
+import scala.reflect.runtime.{universe => ru}
+
+object Impls {
+ def foo1(c: Context) = 2
+ def foo2(c: Context) = ru.Literal(ru.Constant(42))
+ def foo3(c: Context) = ???
+ def foo5(c: Context) = c.universe.Literal(c.universe.Constant(42))
+ def foo6(c: Context) = c.Expr[Int](c.universe.Literal(c.universe.Constant(42)))
+}
diff --git a/tests/untried/neg/macro-invalidret/Macros_Test_2.scala b/tests/untried/neg/macro-invalidret/Macros_Test_2.scala
new file mode 100644
index 000000000..69c9346e0
--- /dev/null
+++ b/tests/untried/neg/macro-invalidret/Macros_Test_2.scala
@@ -0,0 +1,18 @@
+object Macros {
+ def foo1 = macro Impls.foo1
+ def foo2 = macro Impls.foo2
+ def foo3 = macro Impls.foo3
+ def foo4 = macro ???
+ def foo5 = macro Impls.foo5
+ def foo6 = macro Impls.foo6
+}
+
+object Test extends App {
+ import Macros._
+ foo1
+ foo2
+ foo3
+ foo4
+ foo5
+ foo6
+}
diff --git a/tests/untried/neg/macro-invalidshape.check b/tests/untried/neg/macro-invalidshape.check
new file mode 100644
index 000000000..aa694df6d
--- /dev/null
+++ b/tests/untried/neg/macro-invalidshape.check
@@ -0,0 +1,20 @@
+Macros_Test_2.scala:2: error: macro implementation reference has wrong shape. required:
+macro [<static object>].<method name>[[<type args>]] or
+macro [<macro bundle>].<method name>[[<type args>]]
+ def foo1(x: Any) = macro 2
+ ^
+Macros_Test_2.scala:3: error: macro implementation reference has wrong shape. required:
+macro [<static object>].<method name>[[<type args>]] or
+macro [<macro bundle>].<method name>[[<type args>]]
+ def foo2(x: Any) = macro Impls.foo(null)(null)
+ ^
+Macros_Test_2.scala:4: error: missing arguments for method foo in object Impls;
+follow this method with `_' if you want to treat it as a partially applied function
+ def foo3(x: Any) = macro {2; Impls.foo}
+ ^
+Macros_Test_2.scala:7: error: macro implementation reference has wrong shape. required:
+macro [<static object>].<method name>[[<type args>]] or
+macro [<macro bundle>].<method name>[[<type args>]]
+ def foo = macro impl
+ ^
+four errors found
diff --git a/tests/untried/neg/macro-invalidshape.flags b/tests/untried/neg/macro-invalidshape.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidshape.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidshape/Impls_1.scala b/tests/untried/neg/macro-invalidshape/Impls_1.scala
new file mode 100644
index 000000000..acc6b52b7
--- /dev/null
+++ b/tests/untried/neg/macro-invalidshape/Impls_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context)(x: c.Expr[Any]) = ???
+}
diff --git a/tests/untried/neg/macro-invalidshape/Macros_Test_2.scala b/tests/untried/neg/macro-invalidshape/Macros_Test_2.scala
new file mode 100644
index 000000000..aaeb34253
--- /dev/null
+++ b/tests/untried/neg/macro-invalidshape/Macros_Test_2.scala
@@ -0,0 +1,17 @@
+object Macros {
+ def foo1(x: Any) = macro 2
+ def foo2(x: Any) = macro Impls.foo(null)(null)
+ def foo3(x: Any) = macro {2; Impls.foo}
+ {
+ def impl(c: scala.reflect.macros.blackbox.Context) = { import c.universe._; c.Expr[Unit](q"()") }
+ def foo = macro impl
+ foo
+ }
+}
+
+object Test extends App {
+ import Macros._
+ foo1(42)
+ foo2(42)
+ foo3(42)
+}
diff --git a/tests/untried/neg/macro-invalidsig-params-badtype.check b/tests/untried/neg/macro-invalidsig-params-badtype.check
new file mode 100644
index 000000000..159754c72
--- /dev/null
+++ b/tests/untried/neg/macro-invalidsig-params-badtype.check
@@ -0,0 +1,8 @@
+Impls_Macros_1.scala:8: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int]): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree): c.Tree
+ found : (c: scala.reflect.macros.blackbox.Context)(x: Int): Nothing
+type mismatch for parameter x: c.Expr[Int] does not conform to Int
+ def foo(x: Int) = macro Impls.foo
+ ^
+one error found
diff --git a/tests/untried/neg/macro-invalidsig-params-badtype.flags b/tests/untried/neg/macro-invalidsig-params-badtype.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidsig-params-badtype.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala b/tests/untried/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala
new file mode 100644
index 000000000..e549cc957
--- /dev/null
+++ b/tests/untried/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala
@@ -0,0 +1,9 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context)(x: Int) = ???
+}
+
+object Macros {
+ def foo(x: Int) = macro Impls.foo
+}
diff --git a/tests/untried/neg/macro-invalidsig.check b/tests/untried/neg/macro-invalidsig.check
new file mode 100644
index 000000000..8898ffc3d
--- /dev/null
+++ b/tests/untried/neg/macro-invalidsig.check
@@ -0,0 +1,85 @@
+Macros_Test_2.scala:2: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences
+ def foo[U]: Int = macro Impls1.foo[U]
+ ^
+Macros_Test_2.scala:6: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context): c.Tree
+ found : : Nothing
+number of parameter sections differ
+ def foo = macro Impls2.foo
+ ^
+Macros_Test_2.scala:10: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context): c.Tree
+ found : (c: scala.reflect.api.Universe): Nothing
+type mismatch for parameter c: scala.reflect.macros.blackbox.Context does not conform to scala.reflect.api.Universe
+ def foo = macro Impls3.foo
+ ^
+Macros_Test_2.scala:14: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context): c.Tree
+ found : (cs: scala.reflect.macros.blackbox.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 incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any]): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree): c.Tree
+ found : (c: scala.reflect.macros.blackbox.Context): Nothing
+number of parameter sections differ
+ def foo(x: Any) = macro Impls5.foo
+ ^
+Macros_Test_2.scala:22: error: 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 incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int]): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree): c.Tree
+ found : (c: scala.reflect.macros.blackbox.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 incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int]): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree): c.Tree
+ found : (c: scala.reflect.macros.blackbox.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 incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree, y: c.Tree): c.Tree
+ found : (c: scala.reflect.macros.blackbox.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 incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree, y: c.Tree): c.Tree
+ found : (c: scala.reflect.macros.blackbox.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 incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing]
+ or : (c: scala.reflect.macros.blackbox.Context): c.Tree
+ found : (c: scala.reflect.macros.blackbox.Context)(U: c.universe.Type): Nothing
+number of parameter sections differ
+ def foo[U] = macro Impls11.foo[U]
+ ^
+Macros_Test_2.scala:46: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String]
+ def foo[U] = macro Impls12.foo[U]
+ ^
+Macros_Test_2.scala:50: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String]
+ def foo[U <: Int] = macro Impls13.foo[U]
+ ^
+Macros_Test_2.scala:54: error: macro implementation reference has too few type arguments for method foo: [U](c: scala.reflect.macros.blackbox.Context)(implicit evidence$4: c.WeakTypeTag[U])Nothing
+ def foo = macro Impls14.foo
+ ^
+Macros_Test_2.scala:59: error: macro implementation reference has too few type arguments for method foo: [T, U, V](c: scala.reflect.macros.blackbox.Context)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit]
+ def foo15[V]: Unit = macro Impls15.foo
+ ^
+Macros_Test_2.scala:60: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.blackbox.Context)(implicit evidence$7: c.WeakTypeTag[T], implicit evidence$8: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit]
+ def foo16[V]: Unit = macro Impls16.foo[V]
+ ^
+16 errors found
diff --git a/tests/untried/neg/macro-invalidsig.flags b/tests/untried/neg/macro-invalidsig.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidsig.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidsig/Impls_1.scala b/tests/untried/neg/macro-invalidsig/Impls_1.scala
new file mode 100644
index 000000000..2816c4ddf
--- /dev/null
+++ b/tests/untried/neg/macro-invalidsig/Impls_1.scala
@@ -0,0 +1,86 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.macros.blackbox.Context
+
+object Impls1 {
+ def foo[U: c.WeakTypeTag: Numeric](c: Context) = { import c.universe._; q"42" }
+}
+
+object Impls2 {
+ def foo = ???
+}
+
+object Impls3 {
+ def foo(c: scala.reflect.api.Universe) = ???
+}
+
+object Impls4 {
+ def foo(cs: Context*) = ???
+}
+
+object Impls5 {
+ def foo(c: Context) = ???
+}
+
+object Impls6 {
+ def foo[T, U: c.WeakTypeTag](c: Context)(implicit x: c.Expr[Int]) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ 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})
+ """)
+ }
+}
+
+object Impls7 {
+ def foo(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = ???
+}
+
+object Impls8 {
+ def foo(c: Context)(x: c.universe.Symbol) = ???
+}
+
+object Impls9 {
+ def foo(c: Context)(xs: c.Expr[Int]*) = ???
+}
+
+object Impls10 {
+ def foo(c: Context)(y: c.Expr[Int], x: c.Expr[Int]) = ???
+}
+
+object Impls11 {
+ def foo[U](c: Context)(U: c.universe.Type) = ???
+}
+
+object Impls12 {
+ def foo[U <: String](c: Context) = ???
+}
+
+object Impls13 {
+ def foo[U <: String](c: Context) = ???
+}
+
+object Impls14 {
+ def foo[U: c.WeakTypeTag](c: Context) = ???
+}
+
+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.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.Expr[Unit](q"()")
+ }
+}
diff --git a/tests/untried/neg/macro-invalidsig/Macros_Test_2.scala b/tests/untried/neg/macro-invalidsig/Macros_Test_2.scala
new file mode 100644
index 000000000..d662a029e
--- /dev/null
+++ b/tests/untried/neg/macro-invalidsig/Macros_Test_2.scala
@@ -0,0 +1,83 @@
+object Macros1 {
+ def foo[U]: Int = macro Impls1.foo[U]
+}
+
+object Macros2 {
+ def foo = macro Impls2.foo
+}
+
+object Macros3 {
+ def foo = macro Impls3.foo
+}
+
+object Macros4 {
+ def foo = macro Impls4.foo
+}
+
+object Macros5 {
+ def foo(x: Any) = macro Impls5.foo
+}
+
+class Macros6[T] {
+ def foo[U](x: Int) = macro Impls6.foo[T, U]
+}
+
+object Macros7 {
+ def foo(x: Int) = macro Impls7.foo
+}
+
+object Macros8 {
+ def foo(x: Int) = macro Impls8.foo
+}
+
+object Macros9 {
+ def foo(x: Int, y: Int) = macro Impls9.foo
+}
+
+object Macros10 {
+ def foo(x: Int, y: Int) = macro Impls10.foo
+}
+
+object Macros11 {
+ def foo[U] = macro Impls11.foo[U]
+}
+
+object Macros12 {
+ def foo[U] = macro Impls12.foo[U]
+}
+
+object Macros13 {
+ def foo[U <: Int] = macro Impls13.foo[U]
+}
+
+object Macros14 {
+ def foo = macro Impls14.foo
+}
+
+class D[T] {
+ class C[U] {
+ def foo15[V]: Unit = macro Impls15.foo
+ def foo16[V]: Unit = macro Impls16.foo[V]
+ }
+}
+
+object Test extends App {
+ println(Macros1.foo[String])
+ println(Macros2.foo)
+ println(Macros3.foo)
+ println(Macros4.foo)
+ println(Macros5.foo(42))
+ println(new Macros6[Int]().foo[String](42))
+ println(Macros7.foo(42))
+ println(Macros8.foo)
+ println(Macros9.foo(4, 2))
+ println(Macros10.foo(4, 2))
+ println(Macros11.foo[Int])
+ println(Macros12.foo[Int])
+ println(Macros13.foo[Int])
+ println(Macros14.foo)
+ val outer1 = new D[Int]
+ val outer2 = new outer1.C[String]
+ outer2.foo15[Boolean]
+ outer2.foo16[Boolean]
+}
diff --git a/tests/untried/neg/macro-invalidusage-badargs.check b/tests/untried/neg/macro-invalidusage-badargs.check
new file mode 100644
index 000000000..4c1115418
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badargs.check
@@ -0,0 +1,18 @@
+Macros_Test_2.scala:5: error: type mismatch;
+ found : String("42")
+ required: Int
+ foo("42")
+ ^
+Macros_Test_2.scala:6: error: too few argument lists for macro invocation
+ foo
+ ^
+Macros_Test_2.scala:7: error: Int does not take parameters
+ foo(4)(2)
+ ^
+Macros_Test_2.scala:8: error: macro applications do not support named and/or default arguments
+ foo()
+ ^
+Macros_Test_2.scala:9: error: too many arguments for macro method foo: (x: Int)Int
+ foo(4, 2)
+ ^
+5 errors found
diff --git a/tests/untried/neg/macro-invalidusage-badargs.flags b/tests/untried/neg/macro-invalidusage-badargs.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badargs.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidusage-badargs/Impls_1.scala b/tests/untried/neg/macro-invalidusage-badargs/Impls_1.scala
new file mode 100644
index 000000000..8765cfbd5
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badargs/Impls_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context)(x: c.Expr[Int]) = x
+}
diff --git a/tests/untried/neg/macro-invalidusage-badargs/Macros_Test_2.scala b/tests/untried/neg/macro-invalidusage-badargs/Macros_Test_2.scala
new file mode 100644
index 000000000..05ba98730
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badargs/Macros_Test_2.scala
@@ -0,0 +1,10 @@
+object Macros { def foo(x: Int): Int = macro Impls.foo }
+import Macros._
+
+object Test extends App {
+ foo("42")
+ foo
+ foo(4)(2)
+ foo()
+ foo(4, 2)
+}
diff --git a/tests/untried/neg/macro-invalidusage-badbounds.check b/tests/untried/neg/macro-invalidusage-badbounds.check
new file mode 100644
index 000000000..277f407d3
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badbounds.check
@@ -0,0 +1,4 @@
+Macros_Test_2.scala:7: error: type arguments [Int] do not conform to macro method foo's type parameter bounds [U <: String]
+ foo[Int]
+ ^
+one error found
diff --git a/tests/untried/neg/macro-invalidusage-badbounds.flags b/tests/untried/neg/macro-invalidusage-badbounds.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badbounds.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidusage-badbounds/Impls_1.scala b/tests/untried/neg/macro-invalidusage-badbounds/Impls_1.scala
new file mode 100644
index 000000000..1769da91e
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badbounds/Impls_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo[U <: String](c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
+}
diff --git a/tests/untried/neg/macro-invalidusage-badbounds/Macros_Test_2.scala b/tests/untried/neg/macro-invalidusage-badbounds/Macros_Test_2.scala
new file mode 100644
index 000000000..546bc7acc
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badbounds/Macros_Test_2.scala
@@ -0,0 +1,8 @@
+object Macros {
+ def foo[U <: String]: Unit = macro Impls.foo[U]
+}
+
+object Test extends App {
+ import Macros._
+ foo[Int]
+}
diff --git a/tests/untried/neg/macro-invalidusage-badtargs.check b/tests/untried/neg/macro-invalidusage-badtargs.check
new file mode 100644
index 000000000..722ec0376
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badtargs.check
@@ -0,0 +1,18 @@
+Macros_Test_2.scala:13: error: macro method foo1: (x: Int)Int does not take type parameters.
+ foo1[String](42)
+ ^
+Macros_Test_2.scala:14: error: wrong number of type parameters for macro method foo2: [T](x: Int)Int
+ foo2[String, String](42)
+ ^
+Macros_Test_2.scala:15: error: wrong number of type parameters for macro method foo3: [T, U](x: Int)Int
+ foo3[String](42)
+ ^
+Macros_Test_2.scala:16: error: String takes no type parameters, expected: one
+ foo4[String](42)
+ ^
+Macros_Test_2.scala:17: error: kinds of the type arguments (List) do not conform to the expected kinds of the type parameters (type T).
+List's type parameters do not match type T's expected parameters:
+type A has no type parameters, but type U has one
+ foo5[List](42)
+ ^
+5 errors found
diff --git a/tests/untried/neg/macro-invalidusage-badtargs.flags b/tests/untried/neg/macro-invalidusage-badtargs.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badtargs.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidusage-badtargs/Impls_1.scala b/tests/untried/neg/macro-invalidusage-badtargs/Impls_1.scala
new file mode 100644
index 000000000..8765cfbd5
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badtargs/Impls_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context)(x: c.Expr[Int]) = x
+}
diff --git a/tests/untried/neg/macro-invalidusage-badtargs/Macros_Test_2.scala b/tests/untried/neg/macro-invalidusage-badtargs/Macros_Test_2.scala
new file mode 100644
index 000000000..be61c4e8e
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-badtargs/Macros_Test_2.scala
@@ -0,0 +1,18 @@
+import scala.language.higherKinds
+
+object Macros {
+ def foo1(x: Int): Int = macro Impls.foo
+ def foo2[T](x: Int): Int = macro Impls.foo
+ def foo3[T, U](x: Int): Int = macro Impls.foo
+ def foo4[T[_]](x: Int): Int = macro Impls.foo
+ def foo5[T[U[_]]](x: Int): Int = macro Impls.foo
+}
+
+object Test extends App {
+ import Macros._
+ foo1[String](42)
+ foo2[String, String](42)
+ foo3[String](42)
+ foo4[String](42)
+ foo5[List](42)
+}
diff --git a/tests/untried/neg/macro-invalidusage-methodvaluesyntax.check b/tests/untried/neg/macro-invalidusage-methodvaluesyntax.check
new file mode 100644
index 000000000..10046b230
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-methodvaluesyntax.check
@@ -0,0 +1,4 @@
+Macros_Test_2.scala:6: error: macros cannot be eta-expanded
+ val firstClassFoo = Macros.foo _
+ ^
+one error found
diff --git a/tests/untried/neg/macro-invalidusage-methodvaluesyntax.flags b/tests/untried/neg/macro-invalidusage-methodvaluesyntax.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-methodvaluesyntax.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/tests/untried/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
new file mode 100644
index 000000000..5cf284750
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
@@ -0,0 +1,8 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.universe._
+ c.Expr[Unit](q"""println("it works")""")
+ }
+}
diff --git a/tests/untried/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala b/tests/untried/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala
new file mode 100644
index 000000000..83bc8dbfe
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala
@@ -0,0 +1,8 @@
+object Macros {
+ def foo: Unit = macro Impls.foo
+}
+
+object Test extends App {
+ val firstClassFoo = Macros.foo _
+ firstClassFoo
+}
diff --git a/tests/untried/neg/macro-invalidusage-nontypeable.check b/tests/untried/neg/macro-invalidusage-nontypeable.check
new file mode 100644
index 000000000..88e6057e5
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-nontypeable.check
@@ -0,0 +1,4 @@
+Test_2.scala:2: error: not found: value IDoNotExist
+ Macros.foo
+ ^
+one error found
diff --git a/tests/untried/neg/macro-invalidusage-nontypeable.flags b/tests/untried/neg/macro-invalidusage-nontypeable.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-nontypeable.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala b/tests/untried/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala
new file mode 100644
index 000000000..76d696bf1
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala
@@ -0,0 +1,13 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context) = {
+ import c.universe._
+ val body = Ident(TermName("IDoNotExist"))
+ c.Expr[Int](body)
+ }
+}
+
+object Macros {
+ def foo = macro Impls.foo
+}
diff --git a/tests/untried/neg/macro-invalidusage-nontypeable/Test_2.scala b/tests/untried/neg/macro-invalidusage-nontypeable/Test_2.scala
new file mode 100644
index 000000000..5d19639cd
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-nontypeable/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.foo
+}
diff --git a/tests/untried/neg/macro-invalidusage-presuper.check b/tests/untried/neg/macro-invalidusage-presuper.check
new file mode 100644
index 000000000..c0b1ec024
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-presuper.check
@@ -0,0 +1,4 @@
+Macros_Test_2.scala:3: error: only concrete field definitions allowed in early object initialization section
+class D extends { def x = macro impl } with AnyRef
+ ^
+one error found
diff --git a/tests/untried/neg/macro-invalidusage-presuper.flags b/tests/untried/neg/macro-invalidusage-presuper.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-presuper.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidusage-presuper/Impls_1.scala b/tests/untried/neg/macro-invalidusage-presuper/Impls_1.scala
new file mode 100644
index 000000000..ea98f01fa
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-presuper/Impls_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
+} \ No newline at end of file
diff --git a/tests/untried/neg/macro-invalidusage-presuper/Macros_Test_2.scala b/tests/untried/neg/macro-invalidusage-presuper/Macros_Test_2.scala
new file mode 100644
index 000000000..ff46a5915
--- /dev/null
+++ b/tests/untried/neg/macro-invalidusage-presuper/Macros_Test_2.scala
@@ -0,0 +1,3 @@
+import Impls._
+
+class D extends { def x = macro impl } with AnyRef \ No newline at end of file
diff --git a/tests/untried/neg/macro-noexpand.check b/tests/untried/neg/macro-noexpand.check
new file mode 100644
index 000000000..2c176a99b
--- /dev/null
+++ b/tests/untried/neg/macro-noexpand.check
@@ -0,0 +1,4 @@
+Macros_Test_2.scala:7: error: not found: value x
+ foo(x)
+ ^
+one error found
diff --git a/tests/untried/neg/macro-noexpand.flags b/tests/untried/neg/macro-noexpand.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-noexpand.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-noexpand/Impls_1.scala b/tests/untried/neg/macro-noexpand/Impls_1.scala
new file mode 100644
index 000000000..acc6b52b7
--- /dev/null
+++ b/tests/untried/neg/macro-noexpand/Impls_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context)(x: c.Expr[Any]) = ???
+}
diff --git a/tests/untried/neg/macro-noexpand/Macros_Test_2.scala b/tests/untried/neg/macro-noexpand/Macros_Test_2.scala
new file mode 100644
index 000000000..fa9745d97
--- /dev/null
+++ b/tests/untried/neg/macro-noexpand/Macros_Test_2.scala
@@ -0,0 +1,8 @@
+object Macros {
+ def foo(x: Any) = macro Impls.foo
+}
+
+object Test extends App {
+ import Macros._
+ foo(x)
+}
diff --git a/tests/untried/neg/macro-nontypeablebody.check b/tests/untried/neg/macro-nontypeablebody.check
new file mode 100644
index 000000000..9f5831ab3
--- /dev/null
+++ b/tests/untried/neg/macro-nontypeablebody.check
@@ -0,0 +1,4 @@
+Macros_Test_2.scala:2: error: value foo2 is not a member of object Impls
+ def foo(x: Any) = macro Impls.foo2
+ ^
+one error found
diff --git a/tests/untried/neg/macro-nontypeablebody.flags b/tests/untried/neg/macro-nontypeablebody.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-nontypeablebody.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-nontypeablebody/Impls_1.scala b/tests/untried/neg/macro-nontypeablebody/Impls_1.scala
new file mode 100644
index 000000000..acc6b52b7
--- /dev/null
+++ b/tests/untried/neg/macro-nontypeablebody/Impls_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo(c: Context)(x: c.Expr[Any]) = ???
+}
diff --git a/tests/untried/neg/macro-nontypeablebody/Macros_Test_2.scala b/tests/untried/neg/macro-nontypeablebody/Macros_Test_2.scala
new file mode 100644
index 000000000..5eb037b25
--- /dev/null
+++ b/tests/untried/neg/macro-nontypeablebody/Macros_Test_2.scala
@@ -0,0 +1,8 @@
+object Macros {
+ def foo(x: Any) = macro Impls.foo2
+}
+
+object Test extends App {
+ import Macros._
+ foo(42)
+}
diff --git a/tests/untried/neg/macro-override-macro-overrides-abstract-method-a.check b/tests/untried/neg/macro-override-macro-overrides-abstract-method-a.check
new file mode 100644
index 000000000..6b5d3013b
--- /dev/null
+++ b/tests/untried/neg/macro-override-macro-overrides-abstract-method-a.check
@@ -0,0 +1,5 @@
+Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int;
+ macro method foo cannot be used here - term macros cannot override abstract methods
+ def foo(x: Int): Int = macro Impls.impl
+ ^
+one error found
diff --git a/tests/untried/neg/macro-override-macro-overrides-abstract-method-a.flags b/tests/untried/neg/macro-override-macro-overrides-abstract-method-a.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-override-macro-overrides-abstract-method-a.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala b/tests/untried/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala
new file mode 100644
index 000000000..916b45446
--- /dev/null
+++ b/tests/untried/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala
@@ -0,0 +1,13 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def impl(c: Context)(x: c.Expr[Int]) = x
+}
+
+trait Foo {
+ def foo(x: Int): Int
+}
+
+object Macros extends Foo {
+ def foo(x: Int): Int = macro Impls.impl
+}
diff --git a/tests/untried/neg/macro-override-macro-overrides-abstract-method-a/Test_2.scala b/tests/untried/neg/macro-override-macro-overrides-abstract-method-a/Test_2.scala
new file mode 100644
index 000000000..8821dc946
--- /dev/null
+++ b/tests/untried/neg/macro-override-macro-overrides-abstract-method-a/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ val designator: Macros.type = Macros
+ designator.foo(42)
+}
diff --git a/tests/untried/neg/macro-override-macro-overrides-abstract-method-b.check b/tests/untried/neg/macro-override-macro-overrides-abstract-method-b.check
new file mode 100644
index 000000000..c73355554
--- /dev/null
+++ b/tests/untried/neg/macro-override-macro-overrides-abstract-method-b.check
@@ -0,0 +1,11 @@
+Test_2.scala:3: error: <$anon: C with A> inherits conflicting members:
+ macro method t in trait C of type ()Unit and
+ method t in trait A of type ()Unit
+(Note: this can be resolved by declaring an override in <$anon: C with A>.)
+ val c2 = new C with A {}
+ ^
+Test_2.scala:5: error: overriding macro method t in trait C of type ()Unit;
+ method t cannot be used here - only term macros can override term macros
+ val c4 = new C with A { override def t(): Unit = () }
+ ^
+two errors found
diff --git a/tests/untried/neg/macro-override-macro-overrides-abstract-method-b.flags b/tests/untried/neg/macro-override-macro-overrides-abstract-method-b.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-override-macro-overrides-abstract-method-b.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala b/tests/untried/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala
new file mode 100644
index 000000000..17827abf7
--- /dev/null
+++ b/tests/untried/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala
@@ -0,0 +1,8 @@
+import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+trait T { def t(): Unit }
+trait A { def t(): Unit = () }
+
+object Macro { def t(c: Context)(): c.Expr[Unit] = c.universe.reify(()) }
+trait C extends T { self: A => override def t(): Unit = macro Macro.t }
diff --git a/tests/untried/neg/macro-override-macro-overrides-abstract-method-b/Test_2.scala b/tests/untried/neg/macro-override-macro-overrides-abstract-method-b/Test_2.scala
new file mode 100644
index 000000000..79deae63b
--- /dev/null
+++ b/tests/untried/neg/macro-override-macro-overrides-abstract-method-b/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ val c1 = new A with C {}
+ val c2 = new C with A {}
+ val c3 = new C with A { override def t(): Unit = macro Macro.t }
+ val c4 = new C with A { override def t(): Unit = () }
+}
diff --git a/tests/untried/neg/macro-override-method-overrides-macro.check b/tests/untried/neg/macro-override-method-overrides-macro.check
new file mode 100644
index 000000000..e396d65ff
--- /dev/null
+++ b/tests/untried/neg/macro-override-method-overrides-macro.check
@@ -0,0 +1,5 @@
+Macros_Test_2.scala:8: error: overriding macro method foo in class B of type (x: String)Unit;
+ method foo cannot be used here - only term macros can override term macros
+ override def foo(x: String): Unit = println("fooDString")
+ ^
+one error found
diff --git a/tests/untried/neg/macro-override-method-overrides-macro.flags b/tests/untried/neg/macro-override-method-overrides-macro.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-override-method-overrides-macro.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-override-method-overrides-macro/Impls_1.scala b/tests/untried/neg/macro-override-method-overrides-macro/Impls_1.scala
new file mode 100644
index 000000000..8d585be67
--- /dev/null
+++ b/tests/untried/neg/macro-override-method-overrides-macro/Impls_1.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def impl(c: Context)(tag: String, x: c.Expr[_]) = {
+ import c.{prefix => prefix}
+ import c.universe._
+ c.Expr[Unit](q"println($tag, ${prefix.toString}, $x)")
+ }
+
+ def fooBString(c: Context)(x: c.Expr[_]) = impl(c)("fooBString", x)
+ def fooBInt(c: Context)(x: c.Expr[_]) = impl(c)("fooBInt", x)
+ def fooDInt(c: Context)(x: c.Expr[_]) = impl(c)("fooDInt", x)
+ def fooZString(c: Context)(x: c.Expr[_]) = impl(c)("fooZString", x)
+}
diff --git a/tests/untried/neg/macro-override-method-overrides-macro/Macros_Test_2.scala b/tests/untried/neg/macro-override-method-overrides-macro/Macros_Test_2.scala
new file mode 100644
index 000000000..d47157766
--- /dev/null
+++ b/tests/untried/neg/macro-override-method-overrides-macro/Macros_Test_2.scala
@@ -0,0 +1,15 @@
+class B {
+ def foo(x: String): Unit = macro Impls.fooBString
+ def foo(x: Int): Unit = macro Impls.fooBInt
+ def foo(x: Boolean): Unit = println("fooBBoolean")
+}
+
+class D extends B {
+ override def foo(x: String): Unit = println("fooDString")
+ override def foo(x: Int): Unit = macro Impls.fooDInt
+}
+
+class Z extends D {
+ override def foo(x: String): Unit = macro Impls.fooZString
+ override def foo(x: Boolean): Unit = println("fooZBoolean")
+}
diff --git a/tests/untried/neg/macro-qmarkqmarkqmark.check b/tests/untried/neg/macro-qmarkqmarkqmark.check
new file mode 100644
index 000000000..bc3e25eda
--- /dev/null
+++ b/tests/untried/neg/macro-qmarkqmarkqmark.check
@@ -0,0 +1,13 @@
+macro-qmarkqmarkqmark.scala:5: error: macro implementation is missing
+ foo1
+ ^
+macro-qmarkqmarkqmark.scala:8: error: too few argument lists for macro invocation
+ foo2
+ ^
+macro-qmarkqmarkqmark.scala:9: error: macro implementation is missing
+ foo2(1)
+ ^
+macro-qmarkqmarkqmark.scala:12: error: macro implementation is missing
+ foo3[Int]
+ ^
+four errors found
diff --git a/tests/untried/neg/macro-qmarkqmarkqmark.scala b/tests/untried/neg/macro-qmarkqmarkqmark.scala
new file mode 100644
index 000000000..6c0462ea8
--- /dev/null
+++ b/tests/untried/neg/macro-qmarkqmarkqmark.scala
@@ -0,0 +1,13 @@
+import language.experimental.macros
+
+object Macros {
+ def foo1 = macro ???
+ foo1
+
+ def foo2(x: Int) = macro ???
+ foo2
+ foo2(1)
+
+ def foo3[T] = macro ???
+ foo3[Int]
+}
diff --git a/tests/untried/neg/macro-quasiquotes.check b/tests/untried/neg/macro-quasiquotes.check
new file mode 100644
index 000000000..a985aee15
--- /dev/null
+++ b/tests/untried/neg/macro-quasiquotes.check
@@ -0,0 +1,8 @@
+Macros_1.scala:14: error: bundle implementation has incompatible shape:
+ required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Unit]
+ 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): Unit = macro Impls.impl3
+ ^
+one error found
diff --git a/tests/untried/neg/macro-quasiquotes/Macros_1.scala b/tests/untried/neg/macro-quasiquotes/Macros_1.scala
new file mode 100644
index 000000000..62e7a596b
--- /dev/null
+++ b/tests/untried/neg/macro-quasiquotes/Macros_1.scala
@@ -0,0 +1,15 @@
+import language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+class Impls(val c: Context) {
+ import c.universe._
+ def impl1(x: Expr[Int]) = q"println(x)"
+ def impl2(x: Tree) = q"println(x)"
+ def impl3(x: Block) = q"println(x)"
+}
+
+object Macros {
+ def m1(x: Int): Unit = macro Impls.impl1
+ def m2(x: Int): Unit = macro Impls.impl2
+ def m3(x: Int): Unit = macro Impls.impl3
+}
diff --git a/tests/untried/neg/macro-quasiquotes/Test_2.scala b/tests/untried/neg/macro-quasiquotes/Test_2.scala
new file mode 100644
index 000000000..c7b8948d7
--- /dev/null
+++ b/tests/untried/neg/macro-quasiquotes/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ Macros.m1
+ Macros.m2
+ Macros.m3
+}
diff --git a/tests/untried/neg/macro-reify-splice-splice.check b/tests/untried/neg/macro-reify-splice-splice.check
new file mode 100644
index 000000000..bd1ea7ace
--- /dev/null
+++ b/tests/untried/neg/macro-reify-splice-splice.check
@@ -0,0 +1,7 @@
+Macros_1.scala:8: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ { c.universe.reify(c.universe.reify("hello world")) }.splice.splice
+ ^
+one error found
diff --git a/tests/untried/neg/macro-reify-splice-splice.flags b/tests/untried/neg/macro-reify-splice-splice.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/macro-reify-splice-splice.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/macro-reify-splice-splice/Macros_1.scala b/tests/untried/neg/macro-reify-splice-splice/Macros_1.scala
new file mode 100644
index 000000000..4a68fe687
--- /dev/null
+++ b/tests/untried/neg/macro-reify-splice-splice/Macros_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def foo = macro Impls.foo
+
+ object Impls {
+ def foo(c: Context) = c.universe.reify {
+ { c.universe.reify(c.universe.reify("hello world")) }.splice.splice
+ }
+ }
+}
diff --git a/tests/untried/neg/macro-reify-splice-splice/Test_2.scala b/tests/untried/neg/macro-reify-splice-splice/Test_2.scala
new file mode 100644
index 000000000..cff569bd8
--- /dev/null
+++ b/tests/untried/neg/macro-reify-splice-splice/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ println(Macros.foo)
+}
diff --git a/tests/untried/neg/macro-reify-typetag-hktypeparams-notags.check b/tests/untried/neg/macro-reify-typetag-hktypeparams-notags.check
new file mode 100644
index 000000000..44efaae77
--- /dev/null
+++ b/tests/untried/neg/macro-reify-typetag-hktypeparams-notags.check
@@ -0,0 +1,7 @@
+Test.scala:5: error: No TypeTag available for C[T]
+ println(implicitly[TypeTag[C[T]]])
+ ^
+Test.scala:6: error: No TypeTag available for List[C[T]]
+ println(implicitly[TypeTag[List[C[T]]]])
+ ^
+two errors found
diff --git a/tests/untried/neg/macro-reify-typetag-hktypeparams-notags/Test.scala b/tests/untried/neg/macro-reify-typetag-hktypeparams-notags/Test.scala
new file mode 100644
index 000000000..09652721c
--- /dev/null
+++ b/tests/untried/neg/macro-reify-typetag-hktypeparams-notags/Test.scala
@@ -0,0 +1,9 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ def fooNoTypeTagHK[C[_], T] = {
+ println(implicitly[TypeTag[C[T]]])
+ println(implicitly[TypeTag[List[C[T]]]])
+ }
+ fooNoTypeTagHK[List, Int]
+}
diff --git a/tests/untried/neg/macro-reify-typetag-typeparams-notags.check b/tests/untried/neg/macro-reify-typetag-typeparams-notags.check
new file mode 100644
index 000000000..7c67b02aa
--- /dev/null
+++ b/tests/untried/neg/macro-reify-typetag-typeparams-notags.check
@@ -0,0 +1,7 @@
+Test.scala:5: error: No TypeTag available for T
+ println(implicitly[TypeTag[T]])
+ ^
+Test.scala:6: error: No TypeTag available for List[T]
+ println(implicitly[TypeTag[List[T]]])
+ ^
+two errors found
diff --git a/tests/untried/neg/macro-reify-typetag-typeparams-notags/Test.scala b/tests/untried/neg/macro-reify-typetag-typeparams-notags/Test.scala
new file mode 100644
index 000000000..504f7327c
--- /dev/null
+++ b/tests/untried/neg/macro-reify-typetag-typeparams-notags/Test.scala
@@ -0,0 +1,9 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ def fooNoTypeTag[T] = {
+ println(implicitly[TypeTag[T]])
+ println(implicitly[TypeTag[List[T]]])
+ }
+ fooNoTypeTag[Int]
+}
diff --git a/tests/untried/neg/macro-reify-typetag-useabstypetag.check b/tests/untried/neg/macro-reify-typetag-useabstypetag.check
new file mode 100644
index 000000000..7c67b02aa
--- /dev/null
+++ b/tests/untried/neg/macro-reify-typetag-useabstypetag.check
@@ -0,0 +1,7 @@
+Test.scala:5: error: No TypeTag available for T
+ println(implicitly[TypeTag[T]])
+ ^
+Test.scala:6: error: No TypeTag available for List[T]
+ println(implicitly[TypeTag[List[T]]])
+ ^
+two errors found
diff --git a/tests/untried/neg/macro-reify-typetag-useabstypetag/Test.scala b/tests/untried/neg/macro-reify-typetag-useabstypetag/Test.scala
new file mode 100644
index 000000000..95b8dfc99
--- /dev/null
+++ b/tests/untried/neg/macro-reify-typetag-useabstypetag/Test.scala
@@ -0,0 +1,9 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ def fooTypeTag[T: WeakTypeTag] = {
+ println(implicitly[TypeTag[T]])
+ println(implicitly[TypeTag[List[T]]])
+ }
+ fooTypeTag[Int]
+}
diff --git a/tests/untried/neg/macro-without-xmacros-a.check b/tests/untried/neg/macro-without-xmacros-a.check
new file mode 100644
index 000000000..ec194be3a
--- /dev/null
+++ b/tests/untried/neg/macro-without-xmacros-a.check
@@ -0,0 +1,17 @@
+Macros_2.scala:5: error: macro definition needs to be enabled
+by making the implicit value scala.language.experimental.macros visible.
+This can be achieved by adding the import clause 'import scala.language.experimental.macros'
+or by setting the compiler option -language:experimental.macros.
+See the Scala docs for value scala.language.experimental.macros for a discussion
+why the feature needs to be explicitly enabled.
+ def foo(x: Int): Int = macro foo_impl
+ ^
+Macros_2.scala:7: error: macro definition needs to be enabled
+by making the implicit value scala.language.experimental.macros visible.
+ def bar(x: Int): Int = macro bar_impl
+ ^
+Macros_2.scala:11: error: macro definition needs to be enabled
+by making the implicit value scala.language.experimental.macros visible.
+ def quux(x: Int): Int = macro quux_impl
+ ^
+three errors found
diff --git a/tests/untried/neg/macro-without-xmacros-a/Impls_1.scala b/tests/untried/neg/macro-without-xmacros-a/Impls_1.scala
new file mode 100644
index 000000000..04d5d1ac0
--- /dev/null
+++ b/tests/untried/neg/macro-without-xmacros-a/Impls_1.scala
@@ -0,0 +1,18 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr(q"$x + 1")
+ }
+
+ def bar_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr(q"$x + 2")
+ }
+
+ def quux_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr(q"$x + 3")
+ }
+}
diff --git a/tests/untried/neg/macro-without-xmacros-a/Macros_2.scala b/tests/untried/neg/macro-without-xmacros-a/Macros_2.scala
new file mode 100644
index 000000000..e32a70ba8
--- /dev/null
+++ b/tests/untried/neg/macro-without-xmacros-a/Macros_2.scala
@@ -0,0 +1,12 @@
+import Impls._
+
+object Macros {
+ object Shmacros {
+ def foo(x: Int): Int = macro foo_impl
+ }
+ def bar(x: Int): Int = macro bar_impl
+}
+
+class Macros {
+ def quux(x: Int): Int = macro quux_impl
+}
diff --git a/tests/untried/neg/macro-without-xmacros-a/Test_3.scala b/tests/untried/neg/macro-without-xmacros-a/Test_3.scala
new file mode 100644
index 000000000..011eb1f57
--- /dev/null
+++ b/tests/untried/neg/macro-without-xmacros-a/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ import Macros.Shmacros._
+ println(foo(2) + Macros.bar(2) * new Macros().quux(4))
+}
diff --git a/tests/untried/neg/macro-without-xmacros-b.check b/tests/untried/neg/macro-without-xmacros-b.check
new file mode 100644
index 000000000..c97850f0a
--- /dev/null
+++ b/tests/untried/neg/macro-without-xmacros-b.check
@@ -0,0 +1,17 @@
+Macros_2.scala:3: error: macro definition needs to be enabled
+by making the implicit value scala.language.experimental.macros visible.
+This can be achieved by adding the import clause 'import scala.language.experimental.macros'
+or by setting the compiler option -language:experimental.macros.
+See the Scala docs for value scala.language.experimental.macros for a discussion
+why the feature needs to be explicitly enabled.
+ def foo(x: Int): Int = macro Impls.foo_impl
+ ^
+Macros_2.scala:5: error: macro definition needs to be enabled
+by making the implicit value scala.language.experimental.macros visible.
+ def bar(x: Int): Int = macro Impls.bar_impl
+ ^
+Macros_2.scala:9: error: macro definition needs to be enabled
+by making the implicit value scala.language.experimental.macros visible.
+ def quux(x: Int): Int = macro Impls.quux_impl
+ ^
+three errors found
diff --git a/tests/untried/neg/macro-without-xmacros-b/Impls_1.scala b/tests/untried/neg/macro-without-xmacros-b/Impls_1.scala
new file mode 100644
index 000000000..04d5d1ac0
--- /dev/null
+++ b/tests/untried/neg/macro-without-xmacros-b/Impls_1.scala
@@ -0,0 +1,18 @@
+import scala.reflect.macros.blackbox.Context
+
+object Impls {
+ def foo_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr(q"$x + 1")
+ }
+
+ def bar_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr(q"$x + 2")
+ }
+
+ def quux_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
+ import c.universe._
+ c.Expr(q"$x + 3")
+ }
+}
diff --git a/tests/untried/neg/macro-without-xmacros-b/Macros_2.scala b/tests/untried/neg/macro-without-xmacros-b/Macros_2.scala
new file mode 100644
index 000000000..120f50abc
--- /dev/null
+++ b/tests/untried/neg/macro-without-xmacros-b/Macros_2.scala
@@ -0,0 +1,10 @@
+object Macros {
+ object Shmacros {
+ def foo(x: Int): Int = macro Impls.foo_impl
+ }
+ def bar(x: Int): Int = macro Impls.bar_impl
+}
+
+class Macros {
+ def quux(x: Int): Int = macro Impls.quux_impl
+}
diff --git a/tests/untried/neg/macro-without-xmacros-b/Test_3.scala b/tests/untried/neg/macro-without-xmacros-b/Test_3.scala
new file mode 100644
index 000000000..011eb1f57
--- /dev/null
+++ b/tests/untried/neg/macro-without-xmacros-b/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ import Macros.Shmacros._
+ println(foo(2) + Macros.bar(2) * new Macros().quux(4))
+}
diff --git a/tests/untried/neg/main1.check b/tests/untried/neg/main1.check
new file mode 100644
index 000000000..b74510581
--- /dev/null
+++ b/tests/untried/neg/main1.check
@@ -0,0 +1,28 @@
+main1.scala:3: warning: Foo has a main method with parameter type Array[String], but foo1.Foo will not be a runnable program.
+ Reason: companion is a trait, which means no static forwarder can be generated.
+
+ object Foo { // companion is trait
+ ^
+main1.scala:10: warning: Foo has a main method with parameter type Array[String], but foo2.Foo will not be a runnable program.
+ Reason: companion contains its own main method, which means no static forwarder can be generated.
+
+ object Foo { // companion has its own main
+ ^
+main1.scala:22: warning: Foo has a main method with parameter type Array[String], but foo3.Foo will not be a runnable program.
+ Reason: companion contains its own main method (implementation restriction: no main is allowed, regardless of signature), which means no static forwarder can be generated.
+
+ object Foo { // Companion contains main, but not an interfering main.
+ ^
+main1.scala:31: warning: Foo has a main method with parameter type Array[String], but foo4.Foo will not be a runnable program.
+ Reason: companion contains its own main method, which means no static forwarder can be generated.
+
+ object Foo extends Foo { // Inherits main from the class
+ ^
+main1.scala:39: warning: Foo has a main method with parameter type Array[String], but foo5.Foo will not be a runnable program.
+ Reason: companion contains its own main method, which means no static forwarder can be generated.
+
+ object Foo extends Foo { // Overrides main from the class
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+5 warnings found
+one error found
diff --git a/tests/untried/neg/main1.flags b/tests/untried/neg/main1.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/main1.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/main1.scala b/tests/untried/neg/main1.scala
new file mode 100644
index 000000000..2b5551ac3
--- /dev/null
+++ b/tests/untried/neg/main1.scala
@@ -0,0 +1,45 @@
+// negatives
+package foo1 {
+ object Foo { // companion is trait
+ def main(args: Array[String]): Unit = ()
+ }
+ trait Foo
+}
+
+package foo2 {
+ object Foo { // companion has its own main
+ def main(args: Array[String]): Unit = ()
+ }
+ class Foo {
+ def main(args: Array[String]): Unit = ()
+ }
+}
+
+// these should all be made to work, but are negatives for now
+// because forwarders need more work.
+
+package foo3 {
+ object Foo { // Companion contains main, but not an interfering main.
+ def main(args: Array[String]): Unit = ()
+ }
+ class Foo {
+ def main(args: Int): Unit = ()
+ }
+}
+
+package foo4 {
+ object Foo extends Foo { // Inherits main from the class
+ }
+ class Foo {
+ def main(args: Array[String]): Unit = ()
+ }
+}
+
+package foo5 {
+ object Foo extends Foo { // Overrides main from the class
+ override def main(args: Array[String]): Unit = ()
+ }
+ class Foo {
+ def main(args: Array[String]): Unit = ()
+ }
+}
diff --git a/tests/untried/neg/migration28.check b/tests/untried/neg/migration28.check
new file mode 100644
index 000000000..afb4db62e
--- /dev/null
+++ b/tests/untried/neg/migration28.check
@@ -0,0 +1,7 @@
+migration28.scala:4: warning: method scanRight in trait TraversableLike has changed semantics in version 2.9.0:
+The behavior of `scanRight` has changed. The previous behavior can be reproduced with scanRight.reverse.
+ List(1,2,3,4,5).scanRight(0)(_+_)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/migration28.flags b/tests/untried/neg/migration28.flags
new file mode 100644
index 000000000..197b3198c
--- /dev/null
+++ b/tests/untried/neg/migration28.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xmigration
diff --git a/tests/untried/neg/migration28.scala b/tests/untried/neg/migration28.scala
new file mode 100644
index 000000000..facc9b36d
--- /dev/null
+++ b/tests/untried/neg/migration28.scala
@@ -0,0 +1,9 @@
+object Test {
+ import scala.collection.mutable._
+
+ List(1,2,3,4,5).scanRight(0)(_+_)
+
+ def main(args: Array[String]): Unit = {
+
+ }
+}
diff --git a/tests/untried/neg/missing-param-type-tuple.check b/tests/untried/neg/missing-param-type-tuple.check
new file mode 100644
index 000000000..3a4258ff8
--- /dev/null
+++ b/tests/untried/neg/missing-param-type-tuple.check
@@ -0,0 +1,31 @@
+missing-param-type-tuple.scala:3: error: missing parameter type
+Note: The expected type requires a one-argument function accepting a 2-Tuple.
+ Consider a pattern matching anonymous function, `{ case (a, b) => ... }`
+ val x: ((Int, Int)) => Int = (a, b) => 0
+ ^
+missing-param-type-tuple.scala:3: error: missing parameter type
+ val x: ((Int, Int)) => Int = (a, b) => 0
+ ^
+missing-param-type-tuple.scala:5: error: missing parameter type
+Note: The expected type requires a one-argument function accepting a 3-Tuple.
+ Consider a pattern matching anonymous function, `{ case (param1, ..., param3) => ... }`
+ val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
+ ^
+missing-param-type-tuple.scala:5: error: missing parameter type
+ val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
+ ^
+missing-param-type-tuple.scala:5: error: missing parameter type
+ val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
+ ^
+missing-param-type-tuple.scala:7: error: missing parameter type
+Note: The expected type requires a one-argument function accepting a 3-Tuple.
+ Consider a pattern matching anonymous function, `{ case (param1, ..., param3) => ... }`
+ val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
+ ^
+missing-param-type-tuple.scala:7: error: missing parameter type
+ val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
+ ^
+missing-param-type-tuple.scala:7: error: missing parameter type
+ val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
+ ^
+8 errors found
diff --git a/tests/untried/neg/missing-param-type-tuple.scala b/tests/untried/neg/missing-param-type-tuple.scala
new file mode 100644
index 000000000..72c0c8203
--- /dev/null
+++ b/tests/untried/neg/missing-param-type-tuple.scala
@@ -0,0 +1,8 @@
+class C {
+
+ val x: ((Int, Int)) => Int = (a, b) => 0
+
+ val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
+
+ val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
+}
diff --git a/tests/untried/neg/mixins.check b/tests/untried/neg/mixins.check
new file mode 100644
index 000000000..f310ca596
--- /dev/null
+++ b/tests/untried/neg/mixins.check
@@ -0,0 +1,6 @@
+mixins.scala:9: error: illegal inheritance; superclass C
+ is not a subclass of the superclass B
+ of the mixin trait M
+class D extends C with M
+ ^
+one error found
diff --git a/tests/untried/neg/mixins.scala b/tests/untried/neg/mixins.scala
new file mode 100644
index 000000000..18b091f17
--- /dev/null
+++ b/tests/untried/neg/mixins.scala
@@ -0,0 +1,9 @@
+class A;
+
+class B extends A
+
+class C extends A
+
+trait M extends B
+
+class D extends C with M
diff --git a/tests/untried/neg/multi-array.check b/tests/untried/neg/multi-array.check
new file mode 100644
index 000000000..511caa126
--- /dev/null
+++ b/tests/untried/neg/multi-array.check
@@ -0,0 +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/tests/untried/neg/multi-array.flags b/tests/untried/neg/multi-array.flags
new file mode 100644
index 000000000..c36e713ab
--- /dev/null
+++ b/tests/untried/neg/multi-array.flags
@@ -0,0 +1 @@
+-deprecation \ No newline at end of file
diff --git a/tests/untried/neg/multi-array.scala b/tests/untried/neg/multi-array.scala
new file mode 100644
index 000000000..b04e0fa0b
--- /dev/null
+++ b/tests/untried/neg/multi-array.scala
@@ -0,0 +1,14 @@
+/** Multi-dimensional array creation with `new` was removed in 2.10.
+ * The replacement Array.ofDim[Int](10,10) makes the original mistake
+ * which was tested here impossible.
+ * This test will fail now because the constructor doesn't exist anymore.
+ */
+class Foo {
+ val a: Array[Int] = new Array(10, 10)
+}
+
+//Before removal of constructor non-unary Array constructors:
+/** Check that a multi-dimensional array can't be created
+ * when the wrong number of arguments w.r.t. to the array's
+ * type is given.
+ */
diff --git a/tests/untried/neg/name-lookup-stable.check b/tests/untried/neg/name-lookup-stable.check
new file mode 100644
index 000000000..751df9505
--- /dev/null
+++ b/tests/untried/neg/name-lookup-stable.check
@@ -0,0 +1,11 @@
+name-lookup-stable.scala:15: error: reference to PrimaryKey is ambiguous;
+it is both defined in class A and imported subsequently by
+import ColumnOption._
+ (null: Any) match { case PrimaryKey => }
+ ^
+name-lookup-stable.scala:17: error: reference to PrimaryKey is ambiguous;
+it is both defined in class A and imported subsequently by
+import ColumnOption._
+ PrimaryKey // was already ambigious in 2.10.3
+ ^
+two errors found
diff --git a/tests/untried/neg/name-lookup-stable.scala b/tests/untried/neg/name-lookup-stable.scala
new file mode 100644
index 000000000..0d862f06e
--- /dev/null
+++ b/tests/untried/neg/name-lookup-stable.scala
@@ -0,0 +1,20 @@
+// This used to compile under 2.10.3 but the ambiguity is now noticed
+// in 2.11.x (after a70c8219). I think the new behaviour is correct;
+// we shouldn't discard names based on "expected stability" before
+// evaluating ambiguity.
+object ColumnOption {
+ object PrimaryKey
+}
+
+class A {
+ def PrimaryKey: Any = ???
+
+ {
+ import ColumnOption._
+
+ (null: Any) match { case PrimaryKey => }
+
+ PrimaryKey // was already ambigious in 2.10.3
+ }
+}
+
diff --git a/tests/untried/neg/names-defaults-neg-ref.check b/tests/untried/neg/names-defaults-neg-ref.check
new file mode 100644
index 000000000..61d66fd32
--- /dev/null
+++ b/tests/untried/neg/names-defaults-neg-ref.check
@@ -0,0 +1,16 @@
+names-defaults-neg-ref.scala:3: error: in <$anon: A2235 with B2235>, multiple overloaded alternatives of method f define default arguments.
+The members with defaults are defined in trait B2235 and trait A2235.
+ new A2235 with B2235
+ ^
+names-defaults-neg-ref.scala:7: error: in class A, multiple overloaded alternatives of method foo define default arguments.
+class A {
+ ^
+names-defaults-neg-ref.scala:17: error: in class C, multiple overloaded alternatives of method bar define default arguments.
+The members with defaults are defined in class C and class B.
+class C extends B {
+ ^
+names-defaults-neg-ref.scala:21: error: overriding method bar$default$1 in class B of type => String;
+ method bar$default$1 has incompatible type
+ def bar(i: Int = 129083) = i
+ ^
+four errors found
diff --git a/tests/untried/neg/names-defaults-neg-ref.scala b/tests/untried/neg/names-defaults-neg-ref.scala
new file mode 100644
index 000000000..17a482799
--- /dev/null
+++ b/tests/untried/neg/names-defaults-neg-ref.scala
@@ -0,0 +1,26 @@
+object Test extends App {
+ // #2235
+ new A2235 with B2235
+}
+
+// only one overloaded alternative is allowed to have defaults
+class A {
+ def foo(a: Int = 0) = a
+ def foo(b: String = "another") = b
+}
+
+class B {
+ def foo(a: Int) = a
+ def bar(u: String = "ldksj") = u
+}
+
+class C extends B {
+ override def foo(a: Int = 1092) = a
+ def foo(b: String = "lskdfj")
+
+ def bar(i: Int = 129083) = i
+}
+
+// #2235
+trait A2235 { def f(x: Int = 1) = x }
+trait B2235 { def f(x: String = "1") = x }
diff --git a/tests/untried/neg/names-defaults-neg-warn.check b/tests/untried/neg/names-defaults-neg-warn.check
new file mode 100644
index 000000000..0f4edef84
--- /dev/null
+++ b/tests/untried/neg/names-defaults-neg-warn.check
@@ -0,0 +1,9 @@
+names-defaults-neg-warn.scala:11: warning: the parameter name s has been deprecated. Use x instead.
+ deprNam2.f(s = "dlfkj")
+ ^
+names-defaults-neg-warn.scala:12: warning: the parameter name x has been deprecated. Use s instead.
+ deprNam2.g(x = "dlkjf")
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/names-defaults-neg-warn.flags b/tests/untried/neg/names-defaults-neg-warn.flags
new file mode 100644
index 000000000..d1b831ea8
--- /dev/null
+++ b/tests/untried/neg/names-defaults-neg-warn.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/names-defaults-neg-warn.scala b/tests/untried/neg/names-defaults-neg-warn.scala
new file mode 100644
index 000000000..c7a2b2f42
--- /dev/null
+++ b/tests/untried/neg/names-defaults-neg-warn.scala
@@ -0,0 +1,14 @@
+object Test extends App {
+ object deprNam2 {
+ def f(@deprecatedName('s) x: String) = 1
+ def f(s: Object) = 2
+
+ def g(@deprecatedName('x) s: Object) = 3
+ def g(s: String) = 4
+ }
+
+ deprNam2.f(s = new Object)
+ deprNam2.f(s = "dlfkj")
+ deprNam2.g(x = "dlkjf")
+ deprNam2.g(s = new Object)
+}
diff --git a/tests/untried/neg/names-defaults-neg.check b/tests/untried/neg/names-defaults-neg.check
new file mode 100644
index 000000000..20ddd55f1
--- /dev/null
+++ b/tests/untried/neg/names-defaults-neg.check
@@ -0,0 +1,185 @@
+names-defaults-neg.scala:65: error: not enough arguments for method apply: (a: Int, b: String)(c: Int*)Fact in object Fact.
+Unspecified value parameter b.
+ val fac = Fact(1)(2, 3)
+ ^
+names-defaults-neg.scala:5: error: type mismatch;
+ found : String("#")
+ 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)
+ ^
+names-defaults-neg.scala:13: error: reference to x is ambiguous; it is both a method parameter and a variable in scope.
+ test2(x = 1)
+ ^
+names-defaults-neg.scala:15: error: not found: value c
+ test1(c = 0, b = "joke")
+ ^
+names-defaults-neg.scala:16: error: not found: value m
+ test7((m = 1)) // named arguments must be top-level assignments
+ ^
+names-defaults-neg.scala:17: error: not found: value m
+ test7({m = 1})
+ ^
+names-defaults-neg.scala:18: error: not found: value m
+ test7 { m = 1 } // no named arguments in argument block
+ ^
+names-defaults-neg.scala:19: error: reference to x is ambiguous; it is both a method parameter and a variable in scope.
+ test8(x = 1)
+ ^
+names-defaults-neg.scala:22: error: parameter 'a' is already specified at parameter position 1
+ test1(1, a = 2)
+ ^
+names-defaults-neg.scala:23: error: parameter 'b' is already specified at parameter position 1
+ test1(b = 1, b = "2")
+ ^
+names-defaults-neg.scala:26: error: Int does not take parameters
+ test3(b = 3, a = 1)(3)
+ ^
+names-defaults-neg.scala:35: error: ambiguous reference to overloaded definition,
+both method f in object t1 of type (b: String, a: Int)String
+and method f in object t1 of type (a: Int, b: String)String
+match argument types (b: String,a: Int)
+ t1.f(b = "dkljf", a = 1)
+ ^
+names-defaults-neg.scala:42: error: ambiguous reference to overloaded definition,
+both method f in object t3 of type (a2: Int)(b: Int)String
+and method f in object t3 of type (a1: Int)String
+match argument types (Int)
+ t3.f(1)
+ ^
+names-defaults-neg.scala:43: error: ambiguous reference to overloaded definition,
+both method f in object t3 of type (a2: Int)(b: Int)String
+and method f in object t3 of type (a1: Int)String
+match argument types (Int)
+ t3.f(1)(2)
+ ^
+names-defaults-neg.scala:49: error: ambiguous reference to overloaded definition,
+both method g in object t7 of type (a: B)String
+and method g in object t7 of type (a: C, b: Int*)String
+match argument types (C)
+ t7.g(new C()) // ambigous reference
+ ^
+names-defaults-neg.scala:53: error: parameter 'b' is already specified at parameter position 2
+ test5(a = 1, b = "dkjl", b = "dkj")
+ ^
+names-defaults-neg.scala:54: error: parameter 'b' is already specified at parameter position 2
+ test5(1, "2", b = 3)
+ ^
+names-defaults-neg.scala:55: error: when using named arguments, the vararg parameter has to be specified exactly once
+ test5(b = "dlkj")
+ ^
+names-defaults-neg.scala:61: error: ambiguous reference to overloaded definition,
+both method f in object t8 of type (b: String, a: Int)String
+and method f in object t8 of type (a: Int, b: Object)String
+match argument types (a: Int,b: String) and expected result type Any
+ println(t8.f(a = 0, b = "1")) // ambigous reference
+ ^
+names-defaults-neg.scala:69: error: wrong number of arguments for pattern A1(x: Int,y: String)
+ A1() match { case A1(_) => () }
+ ^
+names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])T[T[List[T[X forSome { type X }]]]] exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T[?T[List[?T[X forSome { type X }]]]]
+Error occurred in an application involving default arguments.
+ test4()
+ ^
+names-defaults-neg.scala:79: error: type mismatch;
+ found : List[Int]
+ required: List[List[?]]
+ def test6[T](x: List[List[T]] = List(1,2)) = x
+ ^
+names-defaults-neg.scala:82: error: type mismatch;
+ found : Int
+ 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()
+ ^
+names-defaults-neg.scala:90: error: deprecated parameter name x has to be distinct from any other parameter name (deprecated or not).
+ def deprNam1(x: Int, @deprecatedName('x) y: String) = 0
+ ^
+names-defaults-neg.scala:91: error: deprecated parameter name a has to be distinct from any other parameter name (deprecated or not).
+ def deprNam2(a: String)(@deprecatedName('a) b: Int) = 1
+ ^
+names-defaults-neg.scala:93: warning: the parameter name y has been deprecated. Use b instead.
+ deprNam3(y = 10, b = 2)
+ ^
+names-defaults-neg.scala:93: error: parameter 'b' is already specified at parameter position 1
+ deprNam3(y = 10, b = 2)
+ ^
+names-defaults-neg.scala:98: error: unknown parameter name: m
+ f3818(y = 1, m = 1)
+ ^
+names-defaults-neg.scala:131: error: reference to var2 is ambiguous; it is both a method parameter and a variable in scope.
+ delay(var2 = 40)
+ ^
+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))
+ ^
+names-defaults-neg.scala:136: error: missing parameter type for expanded function ((x$3) => testAnnFun(x$3, ((x$4) => b = x$4)))
+ val taf4: (Int, String) => Unit = testAnnFun(_, b = _)
+ ^
+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) }
+ ^
+names-defaults-neg.scala:147: error: variable definition needs type because 'x' is used as a named argument in its body.
+ object t6 { var x = t.f(x = 1) }
+ ^
+names-defaults-neg.scala:147: warning: type-checking the invocation of method f checks if the named argument expression 'x = ...' is a valid assignment
+in the current scope. The resulting type inference error (see above) can be fixed by providing an explicit type in the local definition for x.
+ object t6 { var x = t.f(x = 1) }
+ ^
+names-defaults-neg.scala:150: error: variable definition needs type because 'x' is used as a named argument in its body.
+ class t9 { var x = t.f(x = 1) }
+ ^
+names-defaults-neg.scala:150: warning: type-checking the invocation of method f checks if the named argument expression 'x = ...' is a valid assignment
+in the current scope. The resulting type inference error (see above) can be fixed by providing an explicit type in the local definition for x.
+ class t9 { var x = t.f(x = 1) }
+ ^
+names-defaults-neg.scala:164: error: variable definition needs type because 'x' is used as a named argument in its body.
+ def u3 { var x = u.f(x = 1) }
+ ^
+names-defaults-neg.scala:167: error: variable definition needs type because 'x' is used as a named argument in its body.
+ def u6 { var x = u.f(x = "32") }
+ ^
+names-defaults-neg.scala:170: error: reference to x is ambiguous; it is both a method parameter and a variable in scope.
+ def u9 { var x: Int = u.f(x = 1) }
+ ^
+names-defaults-neg.scala:177: error: variable definition needs type because 'x' is used as a named argument in its body.
+ class u15 { var x = u.f(x = 1) }
+ ^
+names-defaults-neg.scala:177: warning: type-checking the invocation of method f checks if the named argument expression 'x = ...' is a valid assignment
+in the current scope. The resulting type inference error (see above) can be fixed by providing an explicit type in the local definition for x.
+ class u15 { var x = u.f(x = 1) }
+ ^
+names-defaults-neg.scala:180: error: reference to x is ambiguous; it is both a method parameter and a variable in scope.
+ class u18 { var x: Int = u.f(x = 1) }
+ ^
+four warnings found
+46 errors found
diff --git a/tests/untried/neg/names-defaults-neg.flags b/tests/untried/neg/names-defaults-neg.flags
new file mode 100644
index 000000000..dcc59ebe3
--- /dev/null
+++ b/tests/untried/neg/names-defaults-neg.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/tests/untried/neg/names-defaults-neg.scala b/tests/untried/neg/names-defaults-neg.scala
new file mode 100644
index 000000000..2f8700ac6
--- /dev/null
+++ b/tests/untried/neg/names-defaults-neg.scala
@@ -0,0 +1,184 @@
+object Test extends App {
+ // TESTS
+
+ // re-ordering
+ test1(b = 2, a = "#")
+
+ // mixing named and positional
+ test1(b = "(*", 23)
+
+ // assignment / names
+ var x = 0
+ var y = 0
+ test2(x = 1)
+ test2(y = 1)
+ test1(c = 0, b = "joke")
+ test7((m = 1)) // named arguments must be top-level assignments
+ test7({m = 1})
+ test7 { m = 1 } // no named arguments in argument block
+ test8(x = 1)
+
+ // argument specified twice
+ test1(1, a = 2)
+ test1(b = 1, b = "2")
+
+ // error message when there are too many argument lists (not very nice..)
+ test3(b = 3, a = 1)(3)
+
+
+
+ // overloading resolution
+ object t1 {
+ def f(a: Int, b: String) = "first"
+ def f(b: String, a: Int) = "second"
+ }
+ t1.f(b = "dkljf", a = 1)
+
+
+ object t3 {
+ def f(a1: Int) = "first"
+ def f(a2: Int)(b: Int) = "second"
+ }
+ t3.f(1)
+ t3.f(1)(2)
+
+ object t7 {
+ def g(a: C, b: Int*) = "third"
+ def g(a: B) = "fourth"
+ }
+ t7.g(new C()) // ambigous reference
+
+ // vararg
+ def test5(a: Int, b: String*) = a
+ test5(a = 1, b = "dkjl", b = "dkj")
+ test5(1, "2", b = 3)
+ test5(b = "dlkj")
+
+ object t8 {
+ def f(a: Int, b: Object) = "first"
+ def f(b: String, a: Int) = "second"
+ }
+ println(t8.f(a = 0, b = "1")) // ambigous reference
+
+
+ // case class copy does not exist if there's a vararg
+ val fac = Fact(1)(2, 3)
+ val facc = fac.copy(b = "dlkfj")()
+
+ // no defaults in patterns
+ A1() match { case A1(_) => () }
+
+
+ // return types of default getters
+
+ // definition compiles, but default cannot be used, it doesn't conform
+ def test4[T[P]](x: T[T[List[T[X forSome { type X }]]]] = List(1,2)) = x
+ test4()
+
+ // doesn't compile
+ def test6[T](x: List[List[T]] = List(1,2)) = x
+
+ // correct error message
+ new A2[String]()
+
+ object t3648 {
+ class C(val s: String = "")
+ object C extends C()
+ }
+
+ // deprecated names
+ def deprNam1(x: Int, @deprecatedName('x) y: String) = 0
+ def deprNam2(a: String)(@deprecatedName('a) b: Int) = 1
+ def deprNam3(@deprecatedName('x) a: Int, @deprecatedName('y) b: Int) = a + b
+ deprNam3(y = 10, b = 2)
+
+
+ // t3818
+ def f3818(x: Int = 1, y: Int, z: Int = 1) = 0
+ f3818(y = 1, m = 1)
+
+ // DEFINITIONS
+ def test1(a: Int, b: String) = a +": "+ b
+ def test2(x: Unit) = println("test2")
+ def test3(a: Int, b: Int) = a + b
+ def test7(m: Int) = m
+ def test8[T](x: => T) = println("test8")
+}
+
+class B {
+ def foo(a: Int) = a
+ def bar(u: String = "ldksj") = u
+}
+
+class C extends B {
+ override def foo(a: Int = 1092) = a
+ def foo(b: String = "lskdfj")
+
+ def bar(i: Int = 129083) = i
+}
+
+case class Fact(a: Int, b: String)(c: Int*)
+
+case class A1(x: Int = 1, y: String = "2")
+
+class A2[T](a: T = 1)
+
+
+// anonymous functions
+object anfun {
+ var var2 = 0
+ def delay(var2: => Unit): Unit = { var2 }
+ delay(var2 = 40)
+
+ def testAnnFun(a: Int, b: String) = println(a +": "+ b)
+ val taf2: Int => Unit = testAnnFun(a = _, b = get("+"))
+ val taf3 = testAnnFun(b = _: String, a = get(8))
+ val taf4: (Int, String) => Unit = testAnnFun(_, b = _)
+}
+
+object t3685 {
+ object t { def f(x: Int) = x }
+
+ def t1: Unit = { def x = t.f(x = 1) }
+ def t2: Unit = { val x = t.f(x = 1) }
+ def t3: Unit = { var x = t.f(x = 1) }
+ object t4 { def x = t.f(x = 1) }
+ object t5 { val x = t.f(x = 1) }
+ object t6 { var x = t.f(x = 1) }
+ class t7 { def x = t.f(x = 1) }
+ class t8 { val x = t.f(x = 1) }
+ class t9 { var x = t.f(x = 1) }
+
+ def t10: Unit = { def x: Int = t.f(x = 1) }
+ def t11: Unit = { val x: Int = t.f(x = 1) }
+ def t12: Unit = { var x: Int = t.f(x = 1) }
+ class t13 { def x: Int = t.f(x = 1) }
+ class t14 { val x: Int = t.f(x = 1) }
+ class t15 { var x: Int = t.f(x = 1) }
+
+
+ object u { def f[T](x: T) = 100 }
+
+ def u1: Unit = { def x = u.f(x = 1) }
+ def u2: Unit = { val x = u.f(x = 1) }
+ def u3: Unit = { var x = u.f(x = 1) }
+ def u4: Unit = { def x = u.f(x = "23") }
+ def u5: Unit = { val x = u.f(x = "32") }
+ def u6: Unit = { var x = u.f(x = "32") }
+ def u7: Unit = { def x: Int = u.f(x = 1) }
+ def u8: Unit = { val x: Int = u.f(x = 1) }
+ def u9: Unit = { var x: Int = u.f(x = 1) }
+ def u10: Unit = { def x: Int = u.f(x = "32") }
+ def u11: Unit = { val x: Int = u.f(x = "32") }
+ def u12: Unit = { var x: Int = u.f(x = "32") }
+
+ class u13 { def x = u.f(x = 1) }
+ class u14 { val x = u.f(x = 1) }
+ class u15 { var x = u.f(x = 1) }
+ class u16 { def x: Int = u.f(x = 1) }
+ class u17 { val x: Int = u.f(x = 1) }
+ class u18 { var x: Int = u.f(x = 1) }
+ class u19 { def x: Int = u.f(x = "32") }
+ class u20 { val x: Int = u.f(x = "32") }
+ class u21 { var x: Int = u.f(x = "32") }
+}
diff --git a/tests/untried/neg/nested-annotation.check b/tests/untried/neg/nested-annotation.check
new file mode 100644
index 000000000..ca263943f
--- /dev/null
+++ b/tests/untried/neg/nested-annotation.check
@@ -0,0 +1,10 @@
+nested-annotation.scala:3: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class 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/tests/untried/neg/nested-annotation.scala b/tests/untried/neg/nested-annotation.scala
new file mode 100644
index 000000000..35c0cd3b7
--- /dev/null
+++ b/tests/untried/neg/nested-annotation.scala
@@ -0,0 +1,9 @@
+import annotation._
+
+class ComplexAnnotation(val value: Annotation) extends ClassfileAnnotation
+
+class A {
+ // It's hard to induce this error because @ComplexAnnotation(@inline) is a parse
+ // error so it never gets out of the parser, but:
+ @ComplexAnnotation(new inline) def bippy(): Int = 1
+}
diff --git a/tests/untried/neg/nested-fn-print.check b/tests/untried/neg/nested-fn-print.check
new file mode 100644
index 000000000..ea278554d
--- /dev/null
+++ b/tests/untried/neg/nested-fn-print.check
@@ -0,0 +1,20 @@
+nested-fn-print.scala:4: error: only classes can have declared but undefined members
+(Note that variables need to be initialized to be defined)
+ var x3: Int => Double
+ ^
+nested-fn-print.scala:7: error: type mismatch;
+ found : String("a")
+ required: Int => (Float => Double)
+ x1 = "a"
+ ^
+nested-fn-print.scala:8: error: type mismatch;
+ found : String("b")
+ required: (Int => Float) => Double
+ x2 = "b"
+ ^
+nested-fn-print.scala:9: error: type mismatch;
+ found : String("c")
+ required: Int => Double
+ x3 = "c"
+ ^
+four errors found
diff --git a/tests/untried/neg/nested-fn-print.scala b/tests/untried/neg/nested-fn-print.scala
new file mode 100644
index 000000000..c599a235a
--- /dev/null
+++ b/tests/untried/neg/nested-fn-print.scala
@@ -0,0 +1,11 @@
+object Test {
+ var x1: Int => Float => Double = _
+ var x2: (Int => Float) => Double = _
+ var x3: Int => Double
+
+ def main(args: Array[String]): Unit = {
+ x1 = "a"
+ x2 = "b"
+ x3 = "c"
+ }
+}
diff --git a/tests/untried/neg/newpat_unreachable.check b/tests/untried/neg/newpat_unreachable.check
new file mode 100644
index 000000000..4463e2f1a
--- /dev/null
+++ b/tests/untried/neg/newpat_unreachable.check
@@ -0,0 +1,35 @@
+newpat_unreachable.scala:6: warning: patterns after a variable pattern cannot match (SLS 8.1.1)
+If you intended to match against parameter b of method contrivedExample, you must use backticks, like: case `b` =>
+ case b => println("matched b")
+ ^
+newpat_unreachable.scala:7: warning: unreachable code due to variable pattern 'b' on line 6
+If you intended to match against parameter c of method contrivedExample, you must use backticks, like: case `c` =>
+ case c => println("matched c")
+ ^
+newpat_unreachable.scala:8: warning: unreachable code due to variable pattern 'b' on line 6
+If you intended to match against value d in class A, you must use backticks, like: case `d` =>
+ case d => println("matched d")
+ ^
+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
+ ^
+newpat_unreachable.scala:23: warning: unreachable code due to variable pattern 'b' on line 22
+If you intended to match against parameter c of method h, you must use backticks, like: case `c` =>
+ case c => 2
+ ^
+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.
+9 warnings found
+one error found
diff --git a/tests/untried/neg/newpat_unreachable.flags b/tests/untried/neg/newpat_unreachable.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/newpat_unreachable.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/newpat_unreachable.scala b/tests/untried/neg/newpat_unreachable.scala
new file mode 100644
index 000000000..c9cc85cec
--- /dev/null
+++ b/tests/untried/neg/newpat_unreachable.scala
@@ -0,0 +1,29 @@
+object Test {
+ class A {
+ val d = 55
+
+ def contrivedExample[A, B, C](a: A, b: B, c: C): Unit = a match {
+ case b => println("matched b")
+ case c => println("matched c")
+ case d => println("matched d")
+ case _ => println("matched neither")
+ }
+
+ def correctExample[A, B, C](a: A, b: B, c: C): Unit = a match {
+ case `b` => println("matched b")
+ case `c` => println("matched c")
+ case `d` => println("matched d")
+ case _ => println("matched neither")
+ }
+
+ def f[A](a: A) = {
+ def g[B](b: B) = {
+ def h[C](c: C) = a match {
+ case b => 1
+ case c => 2
+ case _ => 3
+ }
+ }
+ }
+ }
+}
diff --git a/tests/untried/neg/no-implicit-to-anyref-any-val.check b/tests/untried/neg/no-implicit-to-anyref-any-val.check
new file mode 100644
index 000000000..5953e1bd6
--- /dev/null
+++ b/tests/untried/neg/no-implicit-to-anyref-any-val.check
@@ -0,0 +1,34 @@
+no-implicit-to-anyref-any-val.scala:11: error: the result type of an implicit conversion must be more specific than AnyRef
+ 1: AnyRef
+ ^
+no-implicit-to-anyref-any-val.scala:17: error: type mismatch;
+ found : Any
+ required: AnyRef
+ (null: Any): AnyRef
+ ^
+no-implicit-to-anyref-any-val.scala:21: error: type mismatch;
+ found : AnyVal
+ required: AnyRef
+ (0: AnyVal): AnyRef
+ ^
+no-implicit-to-anyref-any-val.scala:27: error: type mismatch;
+ found : Test.AV
+ required: AnyRef
+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
+ ^
+no-implicit-to-anyref-any-val.scala:30: error: the result type of an implicit conversion must be more specific than AnyVal
+ "": AnyVal
+ ^
+no-implicit-to-anyref-any-val.scala:32: error: type mismatch;
+ found : Object
+ required: AnyVal
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method ArrowAssoc in object Predef of type [A](self: A)ArrowAssoc[A]
+ and method Ensuring in object Predef of type [A](self: A)Ensuring[A]
+ are possible conversion functions from Object to AnyVal
+ new Object() : AnyVal
+ ^
+6 errors found
diff --git a/tests/untried/neg/no-implicit-to-anyref-any-val.scala b/tests/untried/neg/no-implicit-to-anyref-any-val.scala
new file mode 100644
index 000000000..f5daf541a
--- /dev/null
+++ b/tests/untried/neg/no-implicit-to-anyref-any-val.scala
@@ -0,0 +1,33 @@
+// Checks that the state of standard implicits in Predef._ and scala._
+// doesn't allow us to unambiguously and implicitly convert AnyVal
+// and subtypes to AnyRef.
+//
+// In the days before value classes, this was precariously held be
+// the competing implicits Any => StringAdd and Any => StringFormat.
+// Since then, these have both become value classes, but seeing as
+// this happened simultaneously, we're still okay.
+object Test {
+ locally {
+ 1: AnyRef
+ }
+
+ locally {
+ // before this test case was added and ContextErrors was tweaked, this
+ // emitted: "Note that Any extends Any, not AnyRef."
+ (null: Any): AnyRef
+ }
+
+ locally {
+ (0: AnyVal): AnyRef
+ }
+
+ class AV(val a: Int) extends AnyVal
+
+ locally {
+ new AV(0): AnyRef
+ }
+
+ "": AnyVal
+
+ new Object() : AnyVal
+}
diff --git a/tests/untried/neg/no-predef.check b/tests/untried/neg/no-predef.check
new file mode 100644
index 000000000..a63d8c5ba
--- /dev/null
+++ b/tests/untried/neg/no-predef.check
@@ -0,0 +1,14 @@
+no-predef.scala:2: error: type mismatch;
+ found : scala.Long(5L)
+ required: java.lang.Long
+ def f1 = 5L: java.lang.Long
+ ^
+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)
+ ^
+three errors found
diff --git a/tests/untried/neg/no-predef.flags b/tests/untried/neg/no-predef.flags
new file mode 100644
index 000000000..3abc2d521
--- /dev/null
+++ b/tests/untried/neg/no-predef.flags
@@ -0,0 +1 @@
+-Yno-predef \ No newline at end of file
diff --git a/tests/untried/neg/no-predef.scala b/tests/untried/neg/no-predef.scala
new file mode 100644
index 000000000..48883d7ba
--- /dev/null
+++ b/tests/untried/neg/no-predef.scala
@@ -0,0 +1,5 @@
+class NoPredef {
+ def f1 = 5L: java.lang.Long
+ def f2 = new java.lang.Long(5) : Long
+ def f3 = "abc" map (_ + 1)
+}
diff --git a/tests/untried/neg/noMember1.check b/tests/untried/neg/noMember1.check
new file mode 100644
index 000000000..846574bef
--- /dev/null
+++ b/tests/untried/neg/noMember1.check
@@ -0,0 +1,5 @@
+noMember1.scala:1: error: object MultiMap is not a member of package scala.collection.mutable
+Note: trait MultiMap exists, but it has no companion object.
+import scala.collection.mutable.MultiMap._
+ ^
+one error found
diff --git a/tests/untried/neg/noMember1.scala b/tests/untried/neg/noMember1.scala
new file mode 100644
index 000000000..0aee7bff7
--- /dev/null
+++ b/tests/untried/neg/noMember1.scala
@@ -0,0 +1,3 @@
+import scala.collection.mutable.MultiMap._
+
+class A
diff --git a/tests/untried/neg/noMember2.check b/tests/untried/neg/noMember2.check
new file mode 100644
index 000000000..f65571bdc
--- /dev/null
+++ b/tests/untried/neg/noMember2.check
@@ -0,0 +1,5 @@
+noMember2.scala:2: error: object MultiMap is not a member of package scala.collection.mutable
+Note: trait MultiMap exists, but it has no companion object.
+ val m = scala.collection.mutable.MultiMap(1, 2, 3)
+ ^
+one error found
diff --git a/tests/untried/neg/noMember2.scala b/tests/untried/neg/noMember2.scala
new file mode 100644
index 000000000..bf72d4f47
--- /dev/null
+++ b/tests/untried/neg/noMember2.scala
@@ -0,0 +1,3 @@
+object Test {
+ val m = scala.collection.mutable.MultiMap(1, 2, 3)
+}
diff --git a/tests/untried/neg/nonlocal-warning.check b/tests/untried/neg/nonlocal-warning.check
new file mode 100644
index 000000000..5202df655
--- /dev/null
+++ b/tests/untried/neg/nonlocal-warning.check
@@ -0,0 +1,9 @@
+nonlocal-warning.scala:4: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
+ catch { case x => 11 }
+ ^
+nonlocal-warning.scala:2: warning: catch block may intercept non-local return from method foo
+ def foo(l: List[Int]): Int = {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/nonlocal-warning.flags b/tests/untried/neg/nonlocal-warning.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/nonlocal-warning.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/nonlocal-warning.scala b/tests/untried/neg/nonlocal-warning.scala
new file mode 100644
index 000000000..f908a8630
--- /dev/null
+++ b/tests/untried/neg/nonlocal-warning.scala
@@ -0,0 +1,18 @@
+class Foo {
+ def foo(l: List[Int]): Int = {
+ try l foreach { _ => return 5 }
+ catch { case x => 11 }
+ 22
+ }
+
+ val pf: PartialFunction[Throwable, Unit] = {
+ case x if false => ()
+ }
+
+ def bar(l: List[Int]): Int = {
+ try l foreach { _ => return 5 }
+ catch pf
+ finally println()
+ 22
+ }
+}
diff --git a/tests/untried/neg/nopredefs.check b/tests/untried/neg/nopredefs.check
new file mode 100644
index 000000000..0a0ab3448
--- /dev/null
+++ b/tests/untried/neg/nopredefs.check
@@ -0,0 +1,4 @@
+nopredefs.scala:5: error: not found: value Set
+ val y = Set(3)
+ ^
+one error found
diff --git a/tests/untried/neg/nopredefs.scala b/tests/untried/neg/nopredefs.scala
new file mode 100644
index 000000000..1128b1893
--- /dev/null
+++ b/tests/untried/neg/nopredefs.scala
@@ -0,0 +1,6 @@
+import Predef.{Set => _, _}
+
+object Test {
+ val x = Map(1 -> 2)
+ val y = Set(3)
+}
diff --git a/tests/untried/neg/not-a-legal-formal-parameter-tuple.check b/tests/untried/neg/not-a-legal-formal-parameter-tuple.check
new file mode 100644
index 000000000..2b906b8ff
--- /dev/null
+++ b/tests/untried/neg/not-a-legal-formal-parameter-tuple.check
@@ -0,0 +1,19 @@
+not-a-legal-formal-parameter-tuple.scala:2: error: not a legal formal parameter.
+Note: Tuples cannot be directly destructured in method or function parameters.
+ Either create a single parameter accepting the Tuple2,
+ or consider a pattern matching anonymous function: `{ case (a, b) => ... }
+ val x: ((Int, Int) => Int) = (((a, b)) => a)
+ ^
+not-a-legal-formal-parameter-tuple.scala:3: error: not a legal formal parameter.
+Note: Tuples cannot be directly destructured in method or function parameters.
+ Either create a single parameter accepting the Tuple2,
+ or consider a pattern matching anonymous function: `{ case (param1, param2) => ... }
+ val y: ((Int, Int, Int) => Int) = (((a, !!)) => a)
+ ^
+not-a-legal-formal-parameter-tuple.scala:4: error: not a legal formal parameter.
+Note: Tuples cannot be directly destructured in method or function parameters.
+ Either create a single parameter accepting the Tuple3,
+ or consider a pattern matching anonymous function: `{ case (param1, ..., param3) => ... }
+ val z: ((Int, Int, Int) => Int) = (((a, NotAPatternVariableName, c)) => a)
+ ^
+three errors found
diff --git a/tests/untried/neg/not-a-legal-formal-parameter-tuple.scala b/tests/untried/neg/not-a-legal-formal-parameter-tuple.scala
new file mode 100644
index 000000000..c7a13557d
--- /dev/null
+++ b/tests/untried/neg/not-a-legal-formal-parameter-tuple.scala
@@ -0,0 +1,5 @@
+class C {
+ val x: ((Int, Int) => Int) = (((a, b)) => a)
+ val y: ((Int, Int, Int) => Int) = (((a, !!)) => a)
+ val z: ((Int, Int, Int) => Int) = (((a, NotAPatternVariableName, c)) => a)
+}
diff --git a/tests/untried/neg/not-possible-cause.check b/tests/untried/neg/not-possible-cause.check
new file mode 100644
index 000000000..5c09fa154
--- /dev/null
+++ b/tests/untried/neg/not-possible-cause.check
@@ -0,0 +1,9 @@
+not-possible-cause.scala:2: error: type mismatch;
+ found : a.type (with underlying type A)
+ required: AnyRef
+Note that A is bounded only by Equals, which means AnyRef is not a known parent.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def foo[A <: Product](a: A) { type X = a.type }
+ ^
+one error found
diff --git a/tests/untried/neg/not-possible-cause.scala b/tests/untried/neg/not-possible-cause.scala
new file mode 100644
index 000000000..6c500b7b8
--- /dev/null
+++ b/tests/untried/neg/not-possible-cause.scala
@@ -0,0 +1,3 @@
+object Foo {
+ def foo[A <: Product](a: A): Unit = { type X = a.type }
+}
diff --git a/tests/untried/neg/null-unsoundness.check b/tests/untried/neg/null-unsoundness.check
new file mode 100644
index 000000000..bc0b5c996
--- /dev/null
+++ b/tests/untried/neg/null-unsoundness.check
@@ -0,0 +1,5 @@
+null-unsoundness.scala:8: error: stable identifier required, but A.this.x found.
+ Note that value x is not stable because its type, A.this.A with A.this.D, is volatile.
+ var y: x.T = new C("abc")
+ ^
+one error found
diff --git a/tests/untried/neg/null-unsoundness.scala b/tests/untried/neg/null-unsoundness.scala
new file mode 100644
index 000000000..0f8ed5e31
--- /dev/null
+++ b/tests/untried/neg/null-unsoundness.scala
@@ -0,0 +1,14 @@
+class B
+class C(x: String) extends B
+
+class A {
+ type A >: Null
+ class D { type T >: C <: B }
+ val x: A with D = null
+ var y: x.T = new C("abc")
+}
+object Test extends A with App {
+ class C { type T = Int; val x = 1 }
+ type A = C
+ y = 42
+}
diff --git a/tests/untried/neg/nullary-override.check b/tests/untried/neg/nullary-override.check
new file mode 100644
index 000000000..f032f4a6c
--- /dev/null
+++ b/tests/untried/neg/nullary-override.check
@@ -0,0 +1,6 @@
+nullary-override.scala:2: warning: non-nullary method overrides nullary method
+class B extends A { override def x(): Int = 4 }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/nullary-override.flags b/tests/untried/neg/nullary-override.flags
new file mode 100644
index 000000000..6c1dd108a
--- /dev/null
+++ b/tests/untried/neg/nullary-override.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xlint \ No newline at end of file
diff --git a/tests/untried/neg/nullary-override.scala b/tests/untried/neg/nullary-override.scala
new file mode 100644
index 000000000..3eb4784a0
--- /dev/null
+++ b/tests/untried/neg/nullary-override.scala
@@ -0,0 +1,3 @@
+class A { def x: Int = 3 }
+class B extends A { override def x(): Int = 4 }
+
diff --git a/tests/untried/neg/object-not-a-value.check b/tests/untried/neg/object-not-a-value.check
new file mode 100644
index 000000000..613210f27
--- /dev/null
+++ b/tests/untried/neg/object-not-a-value.check
@@ -0,0 +1,4 @@
+object-not-a-value.scala:5: error: object java.util.List is not a value
+ List(1) map (_ + 1)
+ ^
+one error found
diff --git a/tests/untried/neg/object-not-a-value.scala b/tests/untried/neg/object-not-a-value.scala
new file mode 100644
index 000000000..207b271df
--- /dev/null
+++ b/tests/untried/neg/object-not-a-value.scala
@@ -0,0 +1,7 @@
+object Test {
+ import java.util._
+
+ def main(args: Array[String]): Unit = {
+ List(1) map (_ + 1)
+ }
+}
diff --git a/tests/untried/neg/overload-msg.check b/tests/untried/neg/overload-msg.check
new file mode 100644
index 000000000..c61ace0dd
--- /dev/null
+++ b/tests/untried/neg/overload-msg.check
@@ -0,0 +1,13 @@
+overload-msg.scala:3: error: overloaded method value + with alternatives:
+ (x: Double)Double <and>
+ (x: Float)Float <and>
+ (x: Long)Long <and>
+ (x: scala.Int)scala.Int <and>
+ (x: Char)scala.Int <and>
+ (x: Short)scala.Int <and>
+ (x: Byte)scala.Int <and>
+ (x: String)String
+ cannot be applied to (Int(in method f))
+ def f[Int](y: Int) = x + y
+ ^
+one error found
diff --git a/tests/untried/neg/overload-msg.scala b/tests/untried/neg/overload-msg.scala
new file mode 100644
index 000000000..8715c156a
--- /dev/null
+++ b/tests/untried/neg/overload-msg.scala
@@ -0,0 +1,4 @@
+// type parameter shadows actual type, massive overload error confuses.
+class A(x: Int) {
+ def f[Int](y: Int) = x + y
+}
diff --git a/tests/untried/neg/overload.check b/tests/untried/neg/overload.check
new file mode 100644
index 000000000..abfabaf3f
--- /dev/null
+++ b/tests/untried/neg/overload.check
@@ -0,0 +1,7 @@
+overload.scala:10: error: ambiguous reference to overloaded definition,
+both method f in class D of type (x: Any)Unit
+and method f in class C of type (x: Int)Unit
+match argument types (Int)
+ (new D).f(1)
+ ^
+one error found
diff --git a/tests/untried/neg/overload.scala b/tests/untried/neg/overload.scala
new file mode 100644
index 000000000..3128a39d0
--- /dev/null
+++ b/tests/untried/neg/overload.scala
@@ -0,0 +1,11 @@
+class C {
+ def f(x: Int): Unit = {}
+}
+
+class D extends C {
+ def f(x: Any): Unit = {}
+}
+
+object Test {
+ (new D).f(1)
+}
diff --git a/tests/untried/neg/overloaded-implicit.check b/tests/untried/neg/overloaded-implicit.check
new file mode 100644
index 000000000..ca0870705
--- /dev/null
+++ b/tests/untried/neg/overloaded-implicit.check
@@ -0,0 +1,9 @@
+overloaded-implicit.scala:2: warning: parameterized overloaded implicit methods are not visible as view bounds
+ implicit def imp1[T](x: List[T]): Map[T, T] = Map()
+ ^
+overloaded-implicit.scala:3: warning: parameterized overloaded implicit methods are not visible as view bounds
+ implicit def imp1[T](x: Set[T]): Map[T, T] = Map()
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/overloaded-implicit.flags b/tests/untried/neg/overloaded-implicit.flags
new file mode 100644
index 000000000..9c1e74e4e
--- /dev/null
+++ b/tests/untried/neg/overloaded-implicit.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings -Xdev
diff --git a/tests/untried/neg/overloaded-implicit.scala b/tests/untried/neg/overloaded-implicit.scala
new file mode 100644
index 000000000..68b1ceaa3
--- /dev/null
+++ b/tests/untried/neg/overloaded-implicit.scala
@@ -0,0 +1,17 @@
+object Test {
+ implicit def imp1[T](x: List[T]): Map[T, T] = Map()
+ implicit def imp1[T](x: Set[T]): Map[T, T] = Map()
+
+ def f[T <% Map[Int, Int]](x: T): Double = 1.0d
+
+ // not parameterized, no warning
+ implicit def imp2(x: List[Int]): String = "a"
+ implicit def imp2(x: Set[Int]): String = "b"
+
+ def g[T <% String](x: T): Double = 2.0d
+
+ def main(args: Array[String]): Unit = {
+ // println(f(List(1)))
+ println(g(List(1)))
+ }
+}
diff --git a/tests/untried/neg/overloaded-unapply.check b/tests/untried/neg/overloaded-unapply.check
new file mode 100644
index 000000000..68a826bac
--- /dev/null
+++ b/tests/untried/neg/overloaded-unapply.check
@@ -0,0 +1,14 @@
+overloaded-unapply.scala:18: error: ambiguous reference to overloaded definition,
+both method unapply in object List of type [a](xs: List[a])Option[Null]
+and method unapply in object List of type [a](xs: List[a])Option[(a, List[a])]
+match argument types (List[a])
+ case List(x, xs) => 7
+ ^
+overloaded-unapply.scala:22: error: cannot resolve overloaded unapply
+ case List(x, xs) => 7
+ ^
+overloaded-unapply.scala:12: error: method unapply is defined twice
+ conflicting symbols both originated in file 'overloaded-unapply.scala'
+ def unapply[a](xs: List[a]): Option[Null] = xs match {
+ ^
+three errors found
diff --git a/tests/untried/neg/overloaded-unapply.scala b/tests/untried/neg/overloaded-unapply.scala
new file mode 100644
index 000000000..36909626c
--- /dev/null
+++ b/tests/untried/neg/overloaded-unapply.scala
@@ -0,0 +1,24 @@
+sealed abstract class List[+a]
+private case object Nil extends List[Nothing]
+private final case class Cons[+a](head: a, tail: List[a])
+extends List[a]
+
+object List {
+ def unapply[a](xs: List[a]): Option[(a, List[a])] = xs match {
+ case Nil => None
+ case Cons(x, xs) => Some(x, xs)
+ }
+
+ def unapply[a](xs: List[a]): Option[Null] = xs match {
+ case Nil => Some(null)
+ case Cons(_, _) => None
+ }
+
+ def foo[a](xs: List[a]) = xs match {
+ case List(x, xs) => 7
+ }
+
+ def bar(xs: Any) = xs match { // test error message OverloadedUnapplyError
+ case List(x, xs) => 7
+ }
+}
diff --git a/tests/untried/neg/override-object-flag.check b/tests/untried/neg/override-object-flag.check
new file mode 100644
index 000000000..344165138
--- /dev/null
+++ b/tests/untried/neg/override-object-flag.check
@@ -0,0 +1,5 @@
+override-object-flag.scala:3: error: overriding object Foo in trait A;
+ object Foo cannot override final member
+trait B extends A { override object Foo }
+ ^
+one error found
diff --git a/tests/untried/neg/override-object-flag.scala b/tests/untried/neg/override-object-flag.scala
new file mode 100644
index 000000000..74d00dd44
--- /dev/null
+++ b/tests/untried/neg/override-object-flag.scala
@@ -0,0 +1,3 @@
+// no flag enabling it, fail
+trait A { object Foo }
+trait B extends A { override object Foo }
diff --git a/tests/untried/neg/override-object-no.check b/tests/untried/neg/override-object-no.check
new file mode 100644
index 000000000..9cfda80fc
--- /dev/null
+++ b/tests/untried/neg/override-object-no.check
@@ -0,0 +1,23 @@
+override-object-no.scala:14: error: overriding object Bar in trait Foo with object Bar in trait Foo2:
+an overriding object must conform to the overridden object's class bound;
+ found : case1.Bippy
+ required: case1.Bippy with case1.Bippo
+ override object Bar extends Bippy { // err
+ ^
+override-object-no.scala:21: error: overriding object Bar in trait Quux1 with object Bar in trait Quux2:
+an overriding object must conform to the overridden object's class bound;
+ found : AnyRef{def g: String}
+ required: AnyRef{def g: Int}
+ trait Quux2 extends Quux1 { override object Bar { def g = "abc" } } // err
+ ^
+override-object-no.scala:25: error: overriding object Bar in trait Quux3;
+ object Bar cannot override final member
+ trait Quux4 extends Quux3 { override object Bar } // err
+ ^
+override-object-no.scala:43: error: overriding object A in class Foo with object A in class P2:
+an overriding object must conform to the overridden object's class bound;
+ found : case2.Bar[List[String]]
+ required: case2.Bar[Traversable[String]]
+ override object A extends Bar[List[String]] // err
+ ^
+four errors found
diff --git a/tests/untried/neg/override-object-no.flags b/tests/untried/neg/override-object-no.flags
new file mode 100644
index 000000000..22e9a95c4
--- /dev/null
+++ b/tests/untried/neg/override-object-no.flags
@@ -0,0 +1 @@
+-Yoverride-objects \ No newline at end of file
diff --git a/tests/untried/neg/override-object-no.scala b/tests/untried/neg/override-object-no.scala
new file mode 100644
index 000000000..745cdb233
--- /dev/null
+++ b/tests/untried/neg/override-object-no.scala
@@ -0,0 +1,45 @@
+// See also pos/override-object-yes.scala
+
+package case1 {
+ // Missing interface in overriding object
+ class Bippy { def f = 1 }
+ trait Bippo
+
+ trait Foo {
+ object Bar extends Bippy with Bippo { override def f = 2 }
+ def f(x: Bippo)
+ def g = f(Bar)
+ }
+ trait Foo2 extends Foo {
+ override object Bar extends Bippy { // err
+ override def f = 3
+ }
+ }
+
+ // type mismatch in member
+ trait Quux1 { object Bar { def g = 55 } }
+ trait Quux2 extends Quux1 { override object Bar { def g = "abc" } } // err
+
+ // still can't override final objects!
+ trait Quux3 { final object Bar { } }
+ trait Quux4 extends Quux3 { override object Bar } // err
+}
+
+// type parameter as-seen-from business
+package case2 {
+ // invariance (see pos for the covariant case)
+ class Bar[T]
+
+ class Foo[T] {
+ object A extends Bar[T]
+ }
+
+ class Baz[S] extends Foo[S] {
+ override object A extends Bar[S]
+ }
+
+ class P1 extends Foo[Traversable[String]]
+ class P2 extends P1 {
+ override object A extends Bar[List[String]] // err
+ }
+}
diff --git a/tests/untried/neg/override.check b/tests/untried/neg/override.check
new file mode 100644
index 000000000..8be98bf4d
--- /dev/null
+++ b/tests/untried/neg/override.check
@@ -0,0 +1,5 @@
+override.scala:9: error: overriding type T in trait A with bounds >: Int <: Int;
+ type T in trait B with bounds >: String <: String has incompatible type
+ lazy val x : A with B = {println(""); x}
+ ^
+one error found
diff --git a/tests/untried/neg/override.scala b/tests/untried/neg/override.scala
new file mode 100755
index 000000000..797551606
--- /dev/null
+++ b/tests/untried/neg/override.scala
@@ -0,0 +1,15 @@
+trait X {
+ trait A { type T >: Int <: Int }
+ val x : A
+ var n : x.T = 3
+}
+
+trait Y extends X {
+ trait B { type T >: String <: String }
+ lazy val x : A with B = {println(""); x}
+ n = "foo"
+}
+
+object Test extends App {
+ new Y {}
+}
diff --git a/tests/untried/neg/parent-inherited-twice-error.check b/tests/untried/neg/parent-inherited-twice-error.check
new file mode 100644
index 000000000..521a6c19d
--- /dev/null
+++ b/tests/untried/neg/parent-inherited-twice-error.check
@@ -0,0 +1,7 @@
+parent-inherited-twice-error.scala:2: error: trait A is inherited twice
+class B extends A with A
+ ^
+parent-inherited-twice-error.scala:2: error: trait A is inherited twice
+class B extends A with A
+ ^
+two errors found
diff --git a/tests/untried/neg/parent-inherited-twice-error.scala b/tests/untried/neg/parent-inherited-twice-error.scala
new file mode 100644
index 000000000..7b433b986
--- /dev/null
+++ b/tests/untried/neg/parent-inherited-twice-error.scala
@@ -0,0 +1,2 @@
+trait A
+class B extends A with A
diff --git a/tests/untried/neg/parstar.check b/tests/untried/neg/parstar.check
new file mode 100644
index 000000000..108f0f4de
--- /dev/null
+++ b/tests/untried/neg/parstar.check
@@ -0,0 +1,7 @@
+parstar.scala:8: error: *-parameter must come last
+ def m(a: A*, b: B ) = a.toArray
+ ^
+parstar.scala:9: error: *-parameter must come last
+ def m(a: A*, b: B*) = a.toArray
+ ^
+two errors found
diff --git a/tests/untried/neg/parstar.scala b/tests/untried/neg/parstar.scala
new file mode 100644
index 000000000..dd8d10844
--- /dev/null
+++ b/tests/untried/neg/parstar.scala
@@ -0,0 +1,10 @@
+package test;
+
+object test {
+ class A
+ class B
+
+ def m(a: A, b: B*) = b.toArray
+ def m(a: A*, b: B ) = a.toArray
+ def m(a: A*, b: B*) = a.toArray
+}
diff --git a/tests/untried/neg/pat_unreachable.check b/tests/untried/neg/pat_unreachable.check
new file mode 100644
index 000000000..374ee4e9c
--- /dev/null
+++ b/tests/untried/neg/pat_unreachable.check
@@ -0,0 +1,17 @@
+pat_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 contrivedExample, you must use backticks, like: case `b` =>
+ case b => println("matched b")
+ ^
+pat_unreachable.scala:23: warning: unreachable code due to variable pattern 'b' on line 22
+If you intended to match against parameter c of method contrivedExample, you must use backticks, like: case `c` =>
+ case c => println("matched c")
+ ^
+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.
+four warnings found
+one error found
diff --git a/tests/untried/neg/pat_unreachable.flags b/tests/untried/neg/pat_unreachable.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/pat_unreachable.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/pat_unreachable.scala b/tests/untried/neg/pat_unreachable.scala
new file mode 100644
index 000000000..1f402e521
--- /dev/null
+++ b/tests/untried/neg/pat_unreachable.scala
@@ -0,0 +1,26 @@
+
+object Test extends App {
+ def unreachable1(xs:Seq[Char]) = xs match {
+ case Seq(x, y, _*) => x::y::Nil
+ case Seq(x, y, z, w) => List(z,w) // redundant!
+ }
+ def unreachable2(xs:Seq[Char]) = xs match {
+ case Seq(x, y, _*) => x::y::Nil
+ case Seq(x, y) => List(x, y)
+ }
+
+ def not_unreachable(xs:Seq[Char]) = xs match {
+ case Seq(x, y, _*) => x::y::Nil
+ case Seq(x) => List(x)
+ }
+ def not_unreachable2(xs:Seq[Char]) = xs match {
+ case Seq(x, y) => x::y::Nil
+ case Seq(x, y, z, _*) => List(x,y)
+ }
+
+ def contrivedExample[A, B, C](a: A, b: B, c: C): Unit = a match {
+ case b => println("matched b")
+ case c => println("matched c")
+ case _ => println("matched neither")
+ }
+}
diff --git a/tests/untried/neg/patmat-classtag-compound.check b/tests/untried/neg/patmat-classtag-compound.check
new file mode 100644
index 000000000..8a54c935b
--- /dev/null
+++ b/tests/untried/neg/patmat-classtag-compound.check
@@ -0,0 +1,6 @@
+patmat-classtag-compound.scala:12: warning: abstract type pattern A is unchecked since it is eliminated by erasure
+ case b: A with Bar => true
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/patmat-classtag-compound.flags b/tests/untried/neg/patmat-classtag-compound.flags
new file mode 100644
index 000000000..144ddac9d
--- /dev/null
+++ b/tests/untried/neg/patmat-classtag-compound.flags
@@ -0,0 +1 @@
+-unchecked -Xfatal-warnings
diff --git a/tests/untried/neg/patmat-classtag-compound.scala b/tests/untried/neg/patmat-classtag-compound.scala
new file mode 100644
index 000000000..e2d0df0a0
--- /dev/null
+++ b/tests/untried/neg/patmat-classtag-compound.scala
@@ -0,0 +1,17 @@
+object Test extends App{
+ trait Bar
+ trait Foo
+ // Failed to give an unchecked warning pre: https://github.com/scala/scala/pull/2848
+ //
+ // Features interacting:
+ // - implicit class tags to enable type patterns on abstract types
+ // - type tests on compound types.
+ //
+ // We could try make these work together, but an unchecked warning is okay for now.
+ def x[A: reflect.ClassTag](a: Any): Boolean = a match{
+ case b: A with Bar => true
+ case _ => false
+ }
+ println(x[Foo](new Bar{}))
+ println(x[String](""))
+}
diff --git a/tests/untried/neg/patmat-type-check.check b/tests/untried/neg/patmat-type-check.check
new file mode 100644
index 000000000..fedac3b74
--- /dev/null
+++ b/tests/untried/neg/patmat-type-check.check
@@ -0,0 +1,46 @@
+patmat-type-check.scala:11: warning: fruitless type test: a value of type Test.Bop4[T] cannot also be a Seq[A]
+ def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
+patmat-type-check.scala:11: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: Test.Bop4[T]
+ def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
+patmat-type-check.scala:15: warning: fruitless type test: a value of type Test.Bop5[_$1,T1,T2] cannot also be a Seq[A]
+ def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
+patmat-type-check.scala:15: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: Test.Bop5[_$1,T1,T2] where type _$1
+ def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
+patmat-type-check.scala:19: warning: fruitless type test: a value of type Test.Bop3[T] cannot also be a Seq[A]
+ def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
+patmat-type-check.scala:19: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: Test.Bop3[T]
+ def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
+patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type;
+ found : Seq[A]
+ required: String
+ def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail
+ ^
+patmat-type-check.scala:23: error: scrutinee is incompatible with pattern type;
+ found : Seq[A]
+ required: Array[Char]
+ def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail
+ ^
+patmat-type-check.scala:27: error: scrutinee is incompatible with pattern type;
+ found : Seq[A]
+ required: Test.Bop2
+ def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail
+ ^
+patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type;
+ found : Seq[A]
+ required: Test.Bop3[Char]
+ def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail
+ ^
+three warnings found
+7 errors found
diff --git a/tests/untried/neg/patmat-type-check.scala b/tests/untried/neg/patmat-type-check.scala
new file mode 100644
index 000000000..26d0409fa
--- /dev/null
+++ b/tests/untried/neg/patmat-type-check.scala
@@ -0,0 +1,31 @@
+object Test
+{
+ def s1 = "bob".toList match { case Seq('b', 'o', 'b') => true } // list ok
+
+ // not final, allowed
+ class Bop
+ def s2(x: Bop) = x match { case Seq('b', 'o', 'b') => true }
+
+ // covariance, allowed
+ final class Bop4[+T]
+ def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true }
+
+ // contravariance, allowed
+ final class Bop5[T, U, -V]
+ def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true }
+
+ // free type parameter, allowed
+ final class Bop3[T]
+ def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true }
+
+ // String and Array are final/invariant, disallowed
+ def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail
+ def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail
+
+ // final, no type parameters, should be disallowed
+ final class Bop2
+ def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail
+
+ // final, invariant type parameter, should be disallowed
+ def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail
+}
diff --git a/tests/untried/neg/patmatexhaust.check b/tests/untried/neg/patmatexhaust.check
new file mode 100644
index 000000000..2dad60845
--- /dev/null
+++ b/tests/untried/neg/patmatexhaust.check
@@ -0,0 +1,42 @@
+patmatexhaust.scala:7: warning: match may not be exhaustive.
+It would fail on the following input: Baz
+ def ma1(x:Foo) = x match {
+ ^
+patmatexhaust.scala:11: warning: match may not be exhaustive.
+It would fail on the following input: Bar(_)
+ def ma2(x:Foo) = x match {
+ ^
+patmatexhaust.scala:23: warning: match may not be exhaustive.
+It would fail on the following inputs: (Kult(_), Kult(_)), (Qult(), Qult())
+ def ma3(x:Mult) = (x,x) match { // not exhaustive
+ ^
+patmatexhaust.scala:49: warning: match may not be exhaustive.
+It would fail on the following inputs: Gp(), Gu
+ def ma4(x:Deep) = x match { // missing cases: Gu, Gp
+ ^
+patmatexhaust.scala:55: warning: unreachable code
+ case _ if 1 == 0 =>
+ ^
+patmatexhaust.scala:53: warning: match may not be exhaustive.
+It would fail on the following input: Gp()
+ def ma5(x:Deep) = x match {
+ ^
+patmatexhaust.scala:75: warning: match may not be exhaustive.
+It would fail on the following input: B()
+ def ma9(x: B) = x match {
+ ^
+patmatexhaust.scala:100: warning: match may not be exhaustive.
+It would fail on the following input: C1()
+ def ma10(x: C) = x match { // not exhaustive: C1 is not sealed.
+ ^
+patmatexhaust.scala:114: warning: match may not be exhaustive.
+It would fail on the following inputs: D1, D2()
+ def ma10(x: C) = x match { // not exhaustive: C1 has subclasses.
+ ^
+patmatexhaust.scala:126: warning: match may not be exhaustive.
+It would fail on the following input: C1()
+ def ma10(x: C) = x match { // not exhaustive: C1 is not abstract.
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+10 warnings found
+one error found
diff --git a/tests/untried/neg/patmatexhaust.flags b/tests/untried/neg/patmatexhaust.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/patmatexhaust.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/patmatexhaust.scala b/tests/untried/neg/patmatexhaust.scala
new file mode 100644
index 000000000..f93719782
--- /dev/null
+++ b/tests/untried/neg/patmatexhaust.scala
@@ -0,0 +1,131 @@
+class TestSealedExhaustive { // compile only
+ sealed abstract class Foo
+
+ case class Bar(x:Int) extends Foo
+ case object Baz extends Foo
+
+ def ma1(x:Foo) = x match {
+ case Bar(_) => // not exhaustive
+ }
+
+ def ma2(x:Foo) = x match {
+ case Baz => // not exhaustive
+ }
+
+ sealed abstract class Mult
+ case class Kult(s:Mult) extends Mult
+ case class Qult() extends Mult
+
+ def ma33(x:Kult) = x match { // exhaustive
+ case Kult(_) => // exhaustive
+ }
+
+ def ma3(x:Mult) = (x,x) match { // not exhaustive
+ case (Kult(_), Qult()) => // Kult missing
+ //case (Kult(_), Kult(_)) =>
+ case (Qult(), Kult(_)) => // Qult missing
+ //case (Qult(), Qult()) =>
+ }
+
+ def ma3u(x:Mult) = ((x,x) : @unchecked) match { // not exhaustive, but not checked!
+ case (Kult(_), Qult()) =>
+ case (Qult(), Kult(_)) =>
+ }
+
+ sealed abstract class Deep
+
+ case object Ga extends Deep
+ sealed class Gp extends Deep
+ case object Gu extends Gp
+
+ def zma3(x:Deep) = x match { // exhaustive!
+ case _ =>
+ }
+ def zma4(x:Deep) = x match { // exhaustive!
+ case Ga =>
+ case _ =>
+ }
+
+ def ma4(x:Deep) = x match { // missing cases: Gu, Gp
+ case Ga =>
+ }
+
+ def ma5(x:Deep) = x match {
+ case Gu =>
+ case _ if 1 == 0 =>
+ case Ga =>
+ }
+
+ def ma6() = List(1,2) match { // give up
+ case List(1,2) =>
+ case x :: xs =>
+ }
+
+ def ma7() = List(1,2) match { //exhaustive
+ case 1::2::Nil =>
+ case _ =>
+ }
+
+ sealed class B
+ case class B1() extends B
+ case object B2 extends B
+ def ma8(x: B) = x match {
+ case _: B => true
+ }
+ def ma9(x: B) = x match {
+ case B1() => true // missing B, which is not abstract so must be included
+ case B2 => true
+ }
+
+ object ob1 {
+ sealed abstract class C
+ sealed abstract class C1 extends C
+ object C2 extends C
+ case class C3() extends C
+ case object C4 extends C
+
+ def ma10(x: C) = x match { // exhaustive: abstract sealed C1 is dead end.
+ case C3() => true
+ case C2 | C4 => true
+ }
+ }
+
+ object ob2 {
+ sealed abstract class C
+ abstract class C1 extends C
+ object C2 extends C
+ case class C3() extends C
+ case object C4 extends C
+
+ def ma10(x: C) = x match { // not exhaustive: C1 is not sealed.
+ case C3() => true
+ case C2 | C4 => true
+ }
+ }
+ object ob3 {
+ sealed abstract class C
+ sealed abstract class C1 extends C
+ object D1 extends C1
+ case class D2() extends C1
+ object C2 extends C
+ case class C3() extends C
+ case object C4 extends C
+
+ def ma10(x: C) = x match { // not exhaustive: C1 has subclasses.
+ case C3() => true
+ case C2 | C4 => true
+ }
+ }
+ object ob4 {
+ sealed abstract class C
+ sealed class C1 extends C
+ object C2 extends C
+ case class C3() extends C
+ case object C4 extends C
+
+ def ma10(x: C) = x match { // not exhaustive: C1 is not abstract.
+ case C3() => true
+ case C2 | C4 => true
+ }
+ }
+}
diff --git a/tests/untried/neg/patternalts.check b/tests/untried/neg/patternalts.check
new file mode 100644
index 000000000..9bec9a001
--- /dev/null
+++ b/tests/untried/neg/patternalts.check
@@ -0,0 +1,4 @@
+patternalts.scala:3: error: illegal variable in pattern alternative
+ case List(x) | List() => Console.println(x)
+ ^
+one error found
diff --git a/tests/untried/neg/patternalts.scala b/tests/untried/neg/patternalts.scala
new file mode 100644
index 000000000..539df4320
--- /dev/null
+++ b/tests/untried/neg/patternalts.scala
@@ -0,0 +1,5 @@
+object Test {
+ List(1) match {
+ case List(x) | List() => Console.println(x)
+ }
+}
diff --git a/tests/untried/neg/permanent-blindness.check b/tests/untried/neg/permanent-blindness.check
new file mode 100644
index 000000000..cdde201ef
--- /dev/null
+++ b/tests/untried/neg/permanent-blindness.check
@@ -0,0 +1,12 @@
+permanent-blindness.scala:10: warning: imported `Bippy' is permanently hidden by definition of class Bippy in package bar
+ import foo.{ Bippy, Bop, Dingus }
+ ^
+permanent-blindness.scala:10: warning: imported `Bop' is permanently hidden by definition of object Bop in package bar
+ import foo.{ Bippy, Bop, Dingus }
+ ^
+permanent-blindness.scala:10: warning: imported `Dingus' is permanently hidden by definition of object Dingus in package bar
+ import foo.{ Bippy, Bop, Dingus }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/permanent-blindness.flags b/tests/untried/neg/permanent-blindness.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/permanent-blindness.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/permanent-blindness.scala b/tests/untried/neg/permanent-blindness.scala
new file mode 100644
index 000000000..bb57e36fc
--- /dev/null
+++ b/tests/untried/neg/permanent-blindness.scala
@@ -0,0 +1,22 @@
+package foo {
+ class Bippy
+ object Bop {
+ def fff = 5
+ }
+ object Dingus
+}
+
+package bar {
+ import foo.{ Bippy, Bop, Dingus }
+
+ class Bippy
+ object Bop
+ object Dingus
+
+
+ class Ding {
+ def fff = 5
+
+ def g = new Bippy
+ }
+}
diff --git a/tests/untried/neg/predef-masking.check b/tests/untried/neg/predef-masking.check
new file mode 100644
index 000000000..79e4dece8
--- /dev/null
+++ b/tests/untried/neg/predef-masking.check
@@ -0,0 +1,4 @@
+predef-masking.scala:7: error: value + is not a member of type parameter T
+ def f[T](x: T) = x + 5
+ ^
+one error found
diff --git a/tests/untried/neg/predef-masking.scala b/tests/untried/neg/predef-masking.scala
new file mode 100644
index 000000000..67b69aa16
--- /dev/null
+++ b/tests/untried/neg/predef-masking.scala
@@ -0,0 +1,21 @@
+// Testing predef masking
+import Predef.{ any2stringadd => _, _ }
+
+object StringPlusConfusion {
+ // Would love to do something about this error message, but by the
+ // time we get our hands on it the context is lost.
+ def f[T](x: T) = x + 5
+
+ // After we block out any2stringadd, the error is:
+ //
+ // work/a.scala:7: error: value + is not a member of type parameter T
+ // def f[T](x: T) = x + 5
+ // ^
+ // Normally, it is:
+ //
+ // work/a.scala:7: error: type mismatch;
+ // found : Int(5)
+ // required: String
+ // def f[T](x: T) = x + 5
+ // ^
+}
diff --git a/tests/untried/neg/primitive-sigs-1.check b/tests/untried/neg/primitive-sigs-1.check
new file mode 100644
index 000000000..77dc457a4
--- /dev/null
+++ b/tests/untried/neg/primitive-sigs-1.check
@@ -0,0 +1,6 @@
+B.scala:3: error: type mismatch;
+ found : Bippy
+ required: AC[Integer]
+ J.f(new Bippy())
+ ^
+one error found
diff --git a/tests/untried/neg/primitive-sigs-1/A.scala b/tests/untried/neg/primitive-sigs-1/A.scala
new file mode 100644
index 000000000..007a64c8f
--- /dev/null
+++ b/tests/untried/neg/primitive-sigs-1/A.scala
@@ -0,0 +1,9 @@
+// scala: the signature in the abstract class will use the
+// upper bound as return type, which for us will be Integer
+// since primitives can't appear in bounds.
+abstract class AC[T <: Int] {
+ def f(): T
+}
+class Bippy extends AC[Int] {
+ def f(): Int = 5
+}
diff --git a/tests/untried/neg/primitive-sigs-1/B.scala b/tests/untried/neg/primitive-sigs-1/B.scala
new file mode 100644
index 000000000..0958bcda5
--- /dev/null
+++ b/tests/untried/neg/primitive-sigs-1/B.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ J.f(new Bippy())
+ }
+}
diff --git a/tests/untried/neg/primitive-sigs-1/J.java b/tests/untried/neg/primitive-sigs-1/J.java
new file mode 100644
index 000000000..2e43b8330
--- /dev/null
+++ b/tests/untried/neg/primitive-sigs-1/J.java
@@ -0,0 +1,8 @@
+// java: often the java or scala compiler will save us from
+// the untruth in the signature, but not always.
+public class J {
+ public static Integer f(AC<Integer> x) { return x.f(); }
+ public static void main(String[] args) {
+ f(new Bippy());
+ }
+}
diff --git a/tests/untried/neg/protected-constructors.check b/tests/untried/neg/protected-constructors.check
new file mode 100644
index 000000000..f44d7db9b
--- /dev/null
+++ b/tests/untried/neg/protected-constructors.check
@@ -0,0 +1,22 @@
+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
+ object Ding in package dingus where target is defined
+ val foo3 = new Ding.Foo3("abc")
+ ^
+protected-constructors.scala:15: 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
+ object Ding in package dingus where target is defined
+ class Bar3 extends Ding.Foo3("abc")
+ ^
+four errors found
diff --git a/tests/untried/neg/protected-constructors.scala b/tests/untried/neg/protected-constructors.scala
new file mode 100644
index 000000000..2838caf09
--- /dev/null
+++ b/tests/untried/neg/protected-constructors.scala
@@ -0,0 +1,21 @@
+package dingus {
+ class Foo1() { protected def this(name: String) = this() }
+ class Foo2 protected (name: String) { }
+ object Ding {
+ protected class Foo3(name: String) { }
+ }
+}
+
+package hungus {
+ import dingus._
+
+ object P {
+ class Bar1 extends Foo1("abc")
+ class Bar2 extends Foo2("abc")
+ class Bar3 extends Ding.Foo3("abc")
+
+ val foo1 = new Foo1("abc")
+ val foo2 = new Foo2("abc")
+ val foo3 = new Ding.Foo3("abc")
+ }
+}
diff --git a/tests/untried/neg/protected-static-fail.check b/tests/untried/neg/protected-static-fail.check
new file mode 100644
index 000000000..9f0bc92e7
--- /dev/null
+++ b/tests/untried/neg/protected-static-fail.check
@@ -0,0 +1,16 @@
+S.scala:5: error: method f in object J cannot be accessed in object bippy.J
+ J.f()
+ ^
+S.scala:6: error: method f1 in object S1 cannot be accessed in object bippy.S1
+ Access to protected method f1 not permitted because
+ enclosing object Test in package bippy is not a subclass of
+ object S1 in package bippy where target is defined
+ S1.f1()
+ ^
+S.scala:8: error: method f2 in class S2 cannot be accessed in bippy.S2
+ Access to protected method f2 not permitted because
+ enclosing object Test in package bippy is not a subclass of
+ class S2 in package bippy where target is defined
+ x.f2()
+ ^
+three errors found
diff --git a/tests/untried/neg/protected-static-fail/J.java b/tests/untried/neg/protected-static-fail/J.java
new file mode 100644
index 000000000..c340800d7
--- /dev/null
+++ b/tests/untried/neg/protected-static-fail/J.java
@@ -0,0 +1,7 @@
+package bippy;
+
+public class J {
+ private static String f() {
+ return "hi mom";
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/protected-static-fail/S.scala b/tests/untried/neg/protected-static-fail/S.scala
new file mode 100644
index 000000000..f9dd89d9d
--- /dev/null
+++ b/tests/untried/neg/protected-static-fail/S.scala
@@ -0,0 +1,10 @@
+package bippy
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ J.f()
+ S1.f1()
+ val x = new S2
+ x.f2()
+ }
+}
diff --git a/tests/untried/neg/protected-static-fail/S0.scala b/tests/untried/neg/protected-static-fail/S0.scala
new file mode 100644
index 000000000..93a7bd91a
--- /dev/null
+++ b/tests/untried/neg/protected-static-fail/S0.scala
@@ -0,0 +1,9 @@
+package bippy
+
+object S1 {
+ protected def f1() = "hi mom"
+}
+
+class S2 {
+ protected def f2() = "hi mom"
+}
diff --git a/tests/untried/neg/qualifying-class-error-1.check b/tests/untried/neg/qualifying-class-error-1.check
new file mode 100644
index 000000000..c70db9ba6
--- /dev/null
+++ b/tests/untried/neg/qualifying-class-error-1.check
@@ -0,0 +1,4 @@
+qualifying-class-error-1.scala:2: error: this can be used only in a class, object, or template
+class B extends A(this.getClass.getName.length)
+ ^
+one error found
diff --git a/tests/untried/neg/qualifying-class-error-1.scala b/tests/untried/neg/qualifying-class-error-1.scala
new file mode 100644
index 000000000..09152fe04
--- /dev/null
+++ b/tests/untried/neg/qualifying-class-error-1.scala
@@ -0,0 +1,2 @@
+class A(val i:Int)
+class B extends A(this.getClass.getName.length)
diff --git a/tests/untried/neg/qualifying-class-error-2.check b/tests/untried/neg/qualifying-class-error-2.check
new file mode 100644
index 000000000..50c275968
--- /dev/null
+++ b/tests/untried/neg/qualifying-class-error-2.check
@@ -0,0 +1,4 @@
+qualifying-class-error-2.scala:9: error: A is not an enclosing class
+ protected[A] def f() {}
+ ^
+one error found
diff --git a/tests/untried/neg/qualifying-class-error-2.scala b/tests/untried/neg/qualifying-class-error-2.scala
new file mode 100644
index 000000000..9b80e1030
--- /dev/null
+++ b/tests/untried/neg/qualifying-class-error-2.scala
@@ -0,0 +1,11 @@
+package A {
+ trait X {
+ protected[A] def f()
+ }
+}
+
+package B {
+ class Y extends A.X {
+ protected[A] def f(): Unit = {}
+ }
+}
diff --git a/tests/untried/neg/quasiquotes-syntax-error-position.check b/tests/untried/neg/quasiquotes-syntax-error-position.check
new file mode 100644
index 000000000..9fd6ce041
--- /dev/null
+++ b/tests/untried/neg/quasiquotes-syntax-error-position.check
@@ -0,0 +1,47 @@
+quasiquotes-syntax-error-position.scala:5: error: '=' expected but identifier found.
+ q"def $a f"
+ ^
+quasiquotes-syntax-error-position.scala:6: error: illegal start of simple expression
+ q"$a("
+ ^
+quasiquotes-syntax-error-position.scala:7: error: '}' expected but end of quote found.
+ q"class $t { def foo = $a"
+ ^
+quasiquotes-syntax-error-position.scala:8: error: '.' expected but unquotee found.
+ q"import $t $t"
+ ^
+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"
+ ^
+quasiquotes-syntax-error-position.scala:11: error: case classes without a parameter list are not allowed;
+use either case objects or case classes with an explicit `()' as a parameter list.
+ q"case class A"
+ ^
+quasiquotes-syntax-error-position.scala:12: error: identifier expected but ']' found.
+ tq"$t => $t $t]"
+ ^
+quasiquotes-syntax-error-position.scala:13: error: end of quote expected but 'case' found.
+ cq"pattern => body ; case pattern2 =>"
+ ^
+quasiquotes-syntax-error-position.scala:14: error: ')' expected but end of quote found.
+ pq"$a(bar"
+ ^
+quasiquotes-syntax-error-position.scala:15: error: ':' expected but ')' found.
+ q"def foo(x)"
+ ^
+quasiquotes-syntax-error-position.scala:16: error: illegal start of simple expression
+ q"$a(])"
+ ^
+quasiquotes-syntax-error-position.scala:17: error: in XML literal: '>' expected instead of '$'
+ q"foo bar <xml$a>"
+ ^
+quasiquotes-syntax-error-position.scala:19: error: ';' expected but '<:' found.
+ q"val $x: $x <: $x"
+ ^
+quasiquotes-syntax-error-position.scala:20: error: '=' expected but '.' found.
+ q"def f ( $x ) . $x"
+ ^
+15 errors found
diff --git a/tests/untried/neg/quasiquotes-syntax-error-position.scala b/tests/untried/neg/quasiquotes-syntax-error-position.scala
new file mode 100644
index 000000000..823fe9a55
--- /dev/null
+++ b/tests/untried/neg/quasiquotes-syntax-error-position.scala
@@ -0,0 +1,21 @@
+import scala.reflect.runtime.universe._
+object test extends App {
+ val a = TermName("a")
+ val t = TypeName("t")
+ q"def $a f"
+ q"$a("
+ q"class $t { def foo = $a"
+ q"import $t $t"
+ q"package p"
+ q"foo@$a"
+ q"case class A"
+ tq"$t => $t $t]"
+ cq"pattern => body ; case pattern2 =>"
+ pq"$a(bar"
+ q"def foo(x)"
+ q"$a(])"
+ q"foo bar <xml$a>"
+ val x = q"x"
+ q"val $x: $x <: $x"
+ q"def f ( $x ) . $x"
+}
diff --git a/tests/untried/neg/quasiquotes-unliftable-not-found.check b/tests/untried/neg/quasiquotes-unliftable-not-found.check
new file mode 100644
index 000000000..5594aa1b1
--- /dev/null
+++ b/tests/untried/neg/quasiquotes-unliftable-not-found.check
@@ -0,0 +1,4 @@
+quasiquotes-unliftable-not-found.scala:4: error: Can't find reflect.runtime.universe.Unliftable[Test.C], consider providing it
+ val q"${c: C}" = q"()"
+ ^
+one error found
diff --git a/tests/untried/neg/quasiquotes-unliftable-not-found.scala b/tests/untried/neg/quasiquotes-unliftable-not-found.scala
new file mode 100644
index 000000000..b2a1ccb47
--- /dev/null
+++ b/tests/untried/neg/quasiquotes-unliftable-not-found.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ import scala.reflect.runtime.universe._
+ class C
+ val q"${c: C}" = q"()"
+}
diff --git a/tests/untried/neg/raw-types-stubs.check b/tests/untried/neg/raw-types-stubs.check
new file mode 100644
index 000000000..f1b26a23b
--- /dev/null
+++ b/tests/untried/neg/raw-types-stubs.check
@@ -0,0 +1,11 @@
+S_3.scala:1: error: class Sub needs to be abstract, since:
+it has 2 unimplemented members.
+/** As seen from class Sub, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ def raw(x$1: M_1[_ <: String]): Unit = ???
+ def raw(x$1: Any): Unit = ???
+
+class Sub extends Raw_2 { }
+ ^
+one error found
diff --git a/tests/untried/neg/raw-types-stubs/M_1.java b/tests/untried/neg/raw-types-stubs/M_1.java
new file mode 100644
index 000000000..6ea0d2e59
--- /dev/null
+++ b/tests/untried/neg/raw-types-stubs/M_1.java
@@ -0,0 +1,3 @@
+public class M_1<K extends String> { }
+
+
diff --git a/tests/untried/neg/raw-types-stubs/Raw_2.java b/tests/untried/neg/raw-types-stubs/Raw_2.java
new file mode 100644
index 000000000..eff7df790
--- /dev/null
+++ b/tests/untried/neg/raw-types-stubs/Raw_2.java
@@ -0,0 +1,4 @@
+public abstract class Raw_2 {
+ public abstract void raw(Object list);
+ public abstract void raw(M_1 list);
+}
diff --git a/tests/untried/neg/raw-types-stubs/S_3.scala b/tests/untried/neg/raw-types-stubs/S_3.scala
new file mode 100644
index 000000000..618eedc88
--- /dev/null
+++ b/tests/untried/neg/raw-types-stubs/S_3.scala
@@ -0,0 +1 @@
+class Sub extends Raw_2 { }
diff --git a/tests/untried/neg/reassignment.check b/tests/untried/neg/reassignment.check
new file mode 100644
index 000000000..f0effd145
--- /dev/null
+++ b/tests/untried/neg/reassignment.check
@@ -0,0 +1,13 @@
+reassignment.scala:2: error: not found: value x
+ x = 5
+ ^
+reassignment.scala:3: error: not found: value y
+ y := 45
+ ^
+reassignment.scala:4: error: not found: value y
+ y += 45
+ ^
+reassignment.scala:6: error: reassignment to val
+ z = 51
+ ^
+four errors found
diff --git a/tests/untried/neg/reassignment.scala b/tests/untried/neg/reassignment.scala
new file mode 100644
index 000000000..afb354200
--- /dev/null
+++ b/tests/untried/neg/reassignment.scala
@@ -0,0 +1,7 @@
+class A {
+ x = 5
+ y := 45
+ y += 45
+ val z = 50
+ z = 51
+}
diff --git a/tests/untried/neg/reflection-names-neg.check b/tests/untried/neg/reflection-names-neg.check
new file mode 100644
index 000000000..f941ec8dc
--- /dev/null
+++ b/tests/untried/neg/reflection-names-neg.check
@@ -0,0 +1,13 @@
+reflection-names-neg.scala:5: error: type mismatch;
+ found : String("abc")
+ required: reflect.runtime.universe.Name
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method stringToTermName in trait Names of type (s: String)reflect.runtime.universe.TermName
+ and method stringToTypeName in trait Names of type (s: String)reflect.runtime.universe.TypeName
+ are possible conversion functions from String("abc") to reflect.runtime.universe.Name
+ val x2 = ("abc": Name) drop 1 // error
+ ^
+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/tests/untried/neg/reflection-names-neg.scala b/tests/untried/neg/reflection-names-neg.scala
new file mode 100644
index 000000000..7283d16db
--- /dev/null
+++ b/tests/untried/neg/reflection-names-neg.scala
@@ -0,0 +1,6 @@
+import scala.reflect.runtime.universe._
+
+object Test {
+ val x1 = "abc" drop 1 // "bc": String
+ val x2 = ("abc": Name) drop 1 // error
+}
diff --git a/tests/untried/neg/reify_ann2b.check b/tests/untried/neg/reify_ann2b.check
new file mode 100644
index 000000000..d32bedaf8
--- /dev/null
+++ b/tests/untried/neg/reify_ann2b.check
@@ -0,0 +1,4 @@
+reify_ann2b.scala:9: error: inner classes cannot be classfile annotations
+ class ann(bar: String) extends annotation.ClassfileAnnotation
+ ^
+one error found
diff --git a/tests/untried/neg/reify_ann2b.scala b/tests/untried/neg/reify_ann2b.scala
new file mode 100644
index 000000000..974d5daf5
--- /dev/null
+++ b/tests/untried/neg/reify_ann2b.scala
@@ -0,0 +1,28 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ // test 1: reify
+ val tree = reify{
+ class ann(bar: String) extends annotation.ClassfileAnnotation
+
+ @ann(bar="1a") @ann(bar="1b") class C[@ann(bar="2a") @ann(bar="2b") T](@ann(bar="3a") @ann(bar="3b") x: T @ann(bar="4a") @ann(bar="4b")) {
+ @ann(bar="5a") @ann(bar="5b") def f(x: Int @ann(bar="6a") @ann(bar="6b")) = {
+ @ann(bar="7a") @ann(bar="7b") val r = (x + 3): @ann(bar="8a") @ann(bar="8b")
+ val s = 4: Int @ann(bar="9a") @ann(bar="9b")
+ r + s
+ }
+ }
+ }.tree
+ println(tree.toString)
+
+ // test 2: import and typecheck
+ val toolbox = cm.mkToolBox()
+ val ttree = toolbox.typeCheck(tree)
+ println(ttree.toString)
+
+ // test 3: import and compile
+ toolbox.eval(tree)
+}
diff --git a/tests/untried/neg/reify_metalevel_breach_+0_refers_to_1.check b/tests/untried/neg/reify_metalevel_breach_+0_refers_to_1.check
new file mode 100644
index 000000000..75b7555b0
--- /dev/null
+++ b/tests/untried/neg/reify_metalevel_breach_+0_refers_to_1.check
@@ -0,0 +1,7 @@
+reify_metalevel_breach_+0_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ inner.splice
+ ^
+one error found
diff --git a/tests/untried/neg/reify_metalevel_breach_+0_refers_to_1.scala b/tests/untried/neg/reify_metalevel_breach_+0_refers_to_1.scala
new file mode 100644
index 000000000..409a03e23
--- /dev/null
+++ b/tests/untried/neg/reify_metalevel_breach_+0_refers_to_1.scala
@@ -0,0 +1,16 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val code = reify{
+ val x = 2
+ val inner = reify{x}
+ inner.splice
+ };
+
+ val toolbox = cm.mkToolBox()
+ val evaluated = toolbox.eval(code.tree)
+ println("evaluated = " + evaluated)
+}
diff --git a/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_a.check b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_a.check
new file mode 100644
index 000000000..ca5556db0
--- /dev/null
+++ b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_a.check
@@ -0,0 +1,7 @@
+reify_metalevel_breach_-1_refers_to_0_a.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ val code = reify{outer.splice.splice}
+ ^
+one error found
diff --git a/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_a.scala b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_a.scala
new file mode 100644
index 000000000..297db6b72
--- /dev/null
+++ b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_a.scala
@@ -0,0 +1,14 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val x = 2
+ val outer = reify{reify{x}}
+ val code = reify{outer.splice.splice}
+
+ val toolbox = cm.mkToolBox()
+ val evaluated = toolbox.eval(code.tree)
+ println("evaluated = " + evaluated)
+}
diff --git a/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_b.check b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_b.check
new file mode 100644
index 000000000..e34cb1ac1
--- /dev/null
+++ b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_b.check
@@ -0,0 +1,7 @@
+reify_metalevel_breach_-1_refers_to_0_b.scala:12: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ }.splice
+ ^
+one error found
diff --git a/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_b.scala b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_b.scala
new file mode 100644
index 000000000..aab0778f6
--- /dev/null
+++ b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_0_b.scala
@@ -0,0 +1,18 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val x = 2
+ val code = reify{
+ {
+ val inner = reify{reify{x}}
+ inner.splice
+ }.splice
+ }
+
+ val toolbox = cm.mkToolBox()
+ val evaluated = toolbox.eval(code.tree)
+ println("evaluated = " + evaluated)
+}
diff --git a/tests/untried/neg/reify_metalevel_breach_-1_refers_to_1.check b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_1.check
new file mode 100644
index 000000000..90b0e8dac
--- /dev/null
+++ b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_1.check
@@ -0,0 +1,7 @@
+reify_metalevel_breach_-1_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ inner.splice.splice
+ ^
+one error found
diff --git a/tests/untried/neg/reify_metalevel_breach_-1_refers_to_1.scala b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_1.scala
new file mode 100644
index 000000000..806caf5c6
--- /dev/null
+++ b/tests/untried/neg/reify_metalevel_breach_-1_refers_to_1.scala
@@ -0,0 +1,16 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val code = reify{
+ val x = 2
+ val inner = reify{reify{x}}
+ inner.splice.splice
+ };
+
+ val toolbox = cm.mkToolBox()
+ val evaluated = toolbox.eval(code.tree)
+ println("evaluated = " + evaluated)
+}
diff --git a/tests/untried/neg/reify_nested_inner_refers_to_local.check b/tests/untried/neg/reify_nested_inner_refers_to_local.check
new file mode 100644
index 000000000..68689b18d
--- /dev/null
+++ b/tests/untried/neg/reify_nested_inner_refers_to_local.check
@@ -0,0 +1,7 @@
+reify_nested_inner_refers_to_local.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ reify{x}.splice
+ ^
+one error found
diff --git a/tests/untried/neg/reify_nested_inner_refers_to_local.scala b/tests/untried/neg/reify_nested_inner_refers_to_local.scala
new file mode 100644
index 000000000..526aba723
--- /dev/null
+++ b/tests/untried/neg/reify_nested_inner_refers_to_local.scala
@@ -0,0 +1,15 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val code = reify{
+ val x = 2
+ reify{x}.splice
+ };
+
+ val toolbox = cm.mkToolBox()
+ val evaluated = toolbox.eval(code.tree)
+ println("evaluated = " + evaluated)
+}
diff --git a/tests/untried/neg/run-gadts-strict.check b/tests/untried/neg/run-gadts-strict.check
new file mode 100644
index 000000000..b4d36c462
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/run-gadts-strict.flags b/tests/untried/neg/run-gadts-strict.flags
new file mode 100644
index 000000000..19243266d
--- /dev/null
+++ b/tests/untried/neg/run-gadts-strict.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/tests/untried/neg/run-gadts-strict.scala b/tests/untried/neg/run-gadts-strict.scala
new file mode 100644
index 000000000..041d10d4b
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/sabin2.check b/tests/untried/neg/sabin2.check
new file mode 100644
index 000000000..8a0936106
--- /dev/null
+++ b/tests/untried/neg/sabin2.check
@@ -0,0 +1,6 @@
+sabin2.scala:22: error: type mismatch;
+ found : Test.Base#T
+ required: _7.T where val _7: Test.Base
+ a.set(b.get()) // Error
+ ^
+one error found
diff --git a/tests/untried/neg/sabin2.scala b/tests/untried/neg/sabin2.scala
new file mode 100644
index 000000000..24a4e511a
--- /dev/null
+++ b/tests/untried/neg/sabin2.scala
@@ -0,0 +1,23 @@
+object Test extends App
+ {
+ abstract class Base {
+ type T
+ var x: T = _
+ class Inner {
+ def set(y: T) = x = y
+ def get() = x
+ def print() = println("Hello world")
+ }
+ }
+
+ object IntBase extends Base { type T = Int }
+ object StringBase extends Base { type T = String }
+
+ val a : Base#Inner = new IntBase.Inner
+ val b : Base#Inner = new StringBase.Inner
+
+ a.print() // OK
+ b.print() // OK
+
+ a.set(b.get()) // Error
+ }
diff --git a/tests/untried/neg/saferJavaConversions.check b/tests/untried/neg/saferJavaConversions.check
new file mode 100644
index 000000000..0e53d2c43
--- /dev/null
+++ b/tests/untried/neg/saferJavaConversions.check
@@ -0,0 +1,6 @@
+saferJavaConversions.scala:13: error: type mismatch;
+ found : String("a")
+ required: Foo
+ val v = map.get("a") // now this is a type error
+ ^
+one error found
diff --git a/tests/untried/neg/saferJavaConversions.scala b/tests/untried/neg/saferJavaConversions.scala
new file mode 100644
index 000000000..f0611204e
--- /dev/null
+++ b/tests/untried/neg/saferJavaConversions.scala
@@ -0,0 +1,20 @@
+
+case class Foo(s: String)
+
+object Test {
+ def f1 = {
+ import scala.collection.JavaConversions._
+ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b")
+ val v = map.get("a") // should be a type error, actually returns null
+ }
+ def f2 = {
+ import scala.collection.convert.wrapAsScala._
+ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b")
+ val v = map.get("a") // now this is a type error
+ }
+ def f3 = {
+ import scala.collection.convert.wrapAsJava._
+ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b")
+ val v = map.get("a")
+ }
+}
diff --git a/tests/untried/neg/saito.check b/tests/untried/neg/saito.check
new file mode 100644
index 000000000..061a45b76
--- /dev/null
+++ b/tests/untried/neg/saito.check
@@ -0,0 +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/tests/untried/neg/saito.scala b/tests/untried/neg/saito.scala
new file mode 100644
index 000000000..b4fcd598e
--- /dev/null
+++ b/tests/untried/neg/saito.scala
@@ -0,0 +1,14 @@
+class B {}
+class A { self: B =>
+ def m(): B = {
+ this
+ }
+}
+
+object Exec{
+ def main(args: Array[String]): Unit = {
+ val a: A = new A; // should not be allowed
+ val b: B = a.m();
+ }
+}
+
diff --git a/tests/untried/neg/sammy_restrictions.check b/tests/untried/neg/sammy_restrictions.check
new file mode 100644
index 000000000..8cc49f9aa
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/sammy_restrictions.flags b/tests/untried/neg/sammy_restrictions.flags
new file mode 100644
index 000000000..48fd86716
--- /dev/null
+++ b/tests/untried/neg/sammy_restrictions.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/tests/untried/neg/sammy_restrictions.scala b/tests/untried/neg/sammy_restrictions.scala
new file mode 100644
index 000000000..5f1a04cd2
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/sammy_wrong_arity.check b/tests/untried/neg/sammy_wrong_arity.check
new file mode 100644
index 000000000..af547a201
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/sammy_wrong_arity.flags b/tests/untried/neg/sammy_wrong_arity.flags
new file mode 100644
index 000000000..48fd86716
--- /dev/null
+++ b/tests/untried/neg/sammy_wrong_arity.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/tests/untried/neg/sammy_wrong_arity.scala b/tests/untried/neg/sammy_wrong_arity.scala
new file mode 100644
index 000000000..d03d266a0
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/scopes.check b/tests/untried/neg/scopes.check
new file mode 100644
index 000000000..f8e8c3758
--- /dev/null
+++ b/tests/untried/neg/scopes.check
@@ -0,0 +1,26 @@
+scopes.scala:3: error: t is already defined as type t
+ type t = Float
+ ^
+scopes.scala:5: error: x is already defined as value x
+ val x: Float = .0f;
+ ^
+scopes.scala:8: error: y is already defined as value y
+ val y: Float = .0f
+ ^
+scopes.scala:6: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ {
+ ^
+scopes.scala:11: error: x is already defined as value x
+ def f1(x: Int, x: Float) = x
+ ^
+scopes.scala:12: error: y is already defined as value y
+ def f2(x: Int)(y: Int, y: Float) = x + y
+ ^
+scopes.scala:13: error: x is already defined as value x
+ val closure = (x: Int, x: Float) => x
+ ^
+scopes.scala:15: error: x is already defined as value x
+ case x::x => x
+ ^
+one warning found
+7 errors found
diff --git a/tests/untried/neg/scopes.scala b/tests/untried/neg/scopes.scala
new file mode 100644
index 000000000..660e82661
--- /dev/null
+++ b/tests/untried/neg/scopes.scala
@@ -0,0 +1,18 @@
+object test1 {
+ type t = Int
+ type t = Float
+ val x: Int = 0
+ val x: Float = .0f;
+ {
+ val y: Int = 0
+ val y: Float = .0f
+ ()
+ }
+ def f1(x: Int, x: Float) = x
+ def f2(x: Int)(y: Int, y: Float) = x + y
+ val closure = (x: Int, x: Float) => x
+ List() match {
+ case x::x => x
+ case Nil => Nil
+ }
+}
diff --git a/tests/untried/neg/sealed-final-neg.check b/tests/untried/neg/sealed-final-neg.check
new file mode 100644
index 000000000..500d23f49
--- /dev/null
+++ b/tests/untried/neg/sealed-final-neg.check
@@ -0,0 +1,4 @@
+sealed-final-neg.scala:41: error: expected class or object definition
+"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed."
+^
+one error found
diff --git a/tests/untried/neg/sealed-final-neg.flags b/tests/untried/neg/sealed-final-neg.flags
new file mode 100644
index 000000000..cfabf7a5b
--- /dev/null
+++ b/tests/untried/neg/sealed-final-neg.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Yinline-warnings -optimise \ No newline at end of file
diff --git a/tests/untried/neg/sealed-final-neg.scala b/tests/untried/neg/sealed-final-neg.scala
new file mode 100644
index 000000000..bc25330e1
--- /dev/null
+++ b/tests/untried/neg/sealed-final-neg.scala
@@ -0,0 +1,41 @@
+package neg1 {
+ sealed abstract class Foo {
+ @inline def bar(x: Int) = x + 1
+ }
+ object Foo {
+ def mkFoo(): Foo = new Baz2
+ }
+
+ object Baz1 extends Foo
+ final class Baz2 extends Foo
+ final class Baz3 extends Foo {
+ override def bar(x: Int) = x - 1
+ }
+
+ object Test {
+ // bar can't be inlined - it is overridden in Baz3
+ def f = Foo.mkFoo() bar 10
+ }
+}
+
+package neg2 {
+ sealed abstract class Foo {
+ @inline def bar(x: Int) = x + 1
+ }
+ object Foo {
+ def mkFoo(): Foo = new Baz2
+ }
+
+ object Baz1 extends Foo
+ final class Baz2 extends Foo
+ class Baz3 extends Foo {
+ override def bar(x: Int) = x - 1
+ }
+
+ object Test {
+ // bar can't be inlined - Baz3 is not final
+ def f = Foo.mkFoo() bar 10
+ }
+}
+
+"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed."
diff --git a/tests/untried/neg/sealed-java-enums.check b/tests/untried/neg/sealed-java-enums.check
new file mode 100644
index 000000000..a3c39ec5c
--- /dev/null
+++ b/tests/untried/neg/sealed-java-enums.check
@@ -0,0 +1,7 @@
+sealed-java-enums.scala:5: warning: match may not be exhaustive.
+It would fail on the following inputs: BLOCKED, TERMINATED, TIMED_WAITING
+ def f(state: State) = state match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/sealed-java-enums.flags b/tests/untried/neg/sealed-java-enums.flags
new file mode 100644
index 000000000..e709c6591
--- /dev/null
+++ b/tests/untried/neg/sealed-java-enums.flags
@@ -0,0 +1 @@
+-Xexperimental -Xfatal-warnings
diff --git a/tests/untried/neg/sealed-java-enums.scala b/tests/untried/neg/sealed-java-enums.scala
new file mode 100644
index 000000000..2daf93f30
--- /dev/null
+++ b/tests/untried/neg/sealed-java-enums.scala
@@ -0,0 +1,10 @@
+import java.lang.Thread.State
+import java.lang.Thread.State._
+
+object Test {
+ def f(state: State) = state match {
+ case NEW | WAITING => true
+ case RUNNABLE => false
+ // and I forget the rest
+ }
+}
diff --git a/tests/untried/neg/sensitive.check b/tests/untried/neg/sensitive.check
new file mode 100644
index 000000000..32d988ec9
--- /dev/null
+++ b/tests/untried/neg/sensitive.check
@@ -0,0 +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/tests/untried/neg/sensitive.scala b/tests/untried/neg/sensitive.scala
new file mode 100644
index 000000000..a084a0a8c
--- /dev/null
+++ b/tests/untried/neg/sensitive.scala
@@ -0,0 +1,18 @@
+class Certificate{}
+
+object Admin extends Certificate;
+
+class SecurityViolationException extends Exception
+
+object Sensitive {
+ def makeSensitive(credentials: Certificate): Sensitive =
+ if (credentials == Admin) new Sensitive()
+ else throw new SecurityViolationException
+}
+class Sensitive private () {
+}
+
+object Attacker {
+ val x = Sensitive.makeSensitive(null)
+ val y = new Sensitive()
+}
diff --git a/tests/untried/neg/sensitive2.check b/tests/untried/neg/sensitive2.check
new file mode 100644
index 000000000..19152fe18
--- /dev/null
+++ b/tests/untried/neg/sensitive2.check
@@ -0,0 +1,10 @@
+sensitive2.scala:6: error: type mismatch;
+ found : String("abc")
+ required: Test.Foo[_]
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method foo1 in object Test of type [A](a: A)Test.Foo[A]
+ and method foo2 in object Test of type (a: Any)Test.Foo[String]
+ are possible conversion functions from String("abc") to Test.Foo[_]
+ val a: Foo[_] = "abc"
+ ^
+one error found
diff --git a/tests/untried/neg/sensitive2.scala b/tests/untried/neg/sensitive2.scala
new file mode 100644
index 000000000..e0cf515bd
--- /dev/null
+++ b/tests/untried/neg/sensitive2.scala
@@ -0,0 +1,8 @@
+object Test {
+ class Foo[A](z: A)
+ implicit def foo1[A](a: A): Foo[A] = new Foo(a)
+ implicit def foo2(a: Any): Foo[String] = new Foo("123")
+
+ val a: Foo[_] = "abc"
+
+}
diff --git a/tests/untried/neg/serialversionuid-not-const.check b/tests/untried/neg/serialversionuid-not-const.check
new file mode 100644
index 000000000..9c383d97a
--- /dev/null
+++ b/tests/untried/neg/serialversionuid-not-const.check
@@ -0,0 +1,10 @@
+serialversionuid-not-const.scala:1: error: annotation argument needs to be a constant; found: 13L.toLong
+@SerialVersionUID(13l.toLong) class C1 extends Serializable
+ ^
+serialversionuid-not-const.scala:3: error: annotation argument needs to be a constant; found: 13.asInstanceOf[Long]
+@SerialVersionUID(13.asInstanceOf[Long]) class C3 extends Serializable
+ ^
+serialversionuid-not-const.scala:4: error: annotation argument needs to be a constant; found: Test.bippy
+@SerialVersionUID(Test.bippy) class C4 extends Serializable
+ ^
+three errors found
diff --git a/tests/untried/neg/serialversionuid-not-const.scala b/tests/untried/neg/serialversionuid-not-const.scala
new file mode 100644
index 000000000..f0e3ef4e7
--- /dev/null
+++ b/tests/untried/neg/serialversionuid-not-const.scala
@@ -0,0 +1,16 @@
+@SerialVersionUID(13l.toLong) class C1 extends Serializable
+@SerialVersionUID(13l) class C2 extends Serializable
+@SerialVersionUID(13.asInstanceOf[Long]) class C3 extends Serializable
+@SerialVersionUID(Test.bippy) class C4 extends Serializable
+
+object Test {
+ val bippy = 13L
+
+ def show(c: Class[_]) = println(java.io.ObjectStreamClass.lookup(c).getSerialVersionUID)
+ def main(args: Array[String]): Unit = {
+ show(classOf[C1])
+ show(classOf[C2])
+ show(classOf[C3])
+ show(classOf[C4])
+ }
+}
diff --git a/tests/untried/neg/spec-overrides.check b/tests/untried/neg/spec-overrides.check
new file mode 100644
index 000000000..639186af4
--- /dev/null
+++ b/tests/untried/neg/spec-overrides.check
@@ -0,0 +1,7 @@
+spec-overrides.scala:8: error: Type parameter has to be specialized at least for the same types as in the overridden method. Missing types: Int
+ override def a[@specialized(Double) T](t: T): List[T] = Nil
+ ^
+spec-overrides.scala:12: error: Type parameter has to be specialized at least for the same types as in the overridden method. Missing types: Int
+ override def a[T](t: T): List[T] = Nil
+ ^
+two errors found
diff --git a/tests/untried/neg/spec-overrides.scala b/tests/untried/neg/spec-overrides.scala
new file mode 100644
index 000000000..713ce27bd
--- /dev/null
+++ b/tests/untried/neg/spec-overrides.scala
@@ -0,0 +1,26 @@
+class P {
+ def a[@specialized(Int) T](t: T): List[T] = List(t)
+}
+class FX extends P {
+ override def a[@specialized(Int) T](t: T): List[T] = Nil
+}
+class FX1 extends P {
+ override def a[@specialized(Double) T](t: T): List[T] = Nil
+}
+
+class FX2 extends P {
+ override def a[T](t: T): List[T] = Nil
+}
+
+object Test extends App {
+ val fx = new FX
+ val p = new P
+
+ println(fx.a(3))
+ println((fx: P).a(3))
+ println((fx: P).a(3.0))
+
+
+ // val d = new Derived[Int]
+ // println((d: Base[Int]).m(10))
+}
diff --git a/tests/untried/neg/specification-scopes.check b/tests/untried/neg/specification-scopes.check
new file mode 100644
index 000000000..ab986135e
--- /dev/null
+++ b/tests/untried/neg/specification-scopes.check
@@ -0,0 +1,12 @@
+P_2.scala:14: error: reference to x is ambiguous;
+it is both defined in object C and imported subsequently by
+import Q.X._
+ println("L14: "+x) // reference to 'x' is ambiguous here
+ ^
+P_2.scala:19: error: reference to y is ambiguous;
+it is imported twice in the same scope by
+import P.X._
+and import X.y
+ println("L19: "+y) // reference to 'y' is ambiguous here
+ ^
+two errors found
diff --git a/tests/untried/neg/specification-scopes/P_1.scala b/tests/untried/neg/specification-scopes/P_1.scala
new file mode 100644
index 000000000..3b11f1167
--- /dev/null
+++ b/tests/untried/neg/specification-scopes/P_1.scala
@@ -0,0 +1,6 @@
+package P {
+ object X { val x = 1; val y = 2; }
+}
+package Q {
+ object X { val x = true; val y = "" }
+}
diff --git a/tests/untried/neg/specification-scopes/P_2.scala b/tests/untried/neg/specification-scopes/P_2.scala
new file mode 100644
index 000000000..d59f82e90
--- /dev/null
+++ b/tests/untried/neg/specification-scopes/P_2.scala
@@ -0,0 +1,21 @@
+package P { // 'X' bound by package clause
+ import Console._ // 'println' bound by wildcard import
+ object A {
+ println("L4: "+X) // 'X' refers to 'P.X' here
+ object B {
+ import Q._ // 'X' bound by wildcard import
+ println("L7: "+X) // 'X' refers to 'Q.X' here
+ import X._ // 'x' and 'y' bound by wildcard import
+ println("L8: "+x) // 'x' refers to 'Q.X.x' here
+ object C {
+ val x = 3 // 'x' bound by local definition
+ println("L12: "+x); // 'x' refers to constant '3' here
+ { import Q.X._ // 'x' and 'y' bound by wildcard
+ println("L14: "+x) // reference to 'x' is ambiguous here
+ import X.y // 'y' bound by explicit import
+ println("L16: "+y); // 'y' refers to 'Q.X.y' here
+ { val x = "abc" // 'x' bound by local definition
+ import P.X._ // 'x' and 'y' bound by wildcard
+ println("L19: "+y) // reference to 'y' is ambiguous here
+ println("L20: "+x) // 'x' refers to string ''abc'' here
+}}}}}}
diff --git a/tests/untried/neg/stmt-expr-discard.check b/tests/untried/neg/stmt-expr-discard.check
new file mode 100644
index 000000000..1207e6da5
--- /dev/null
+++ b/tests/untried/neg/stmt-expr-discard.check
@@ -0,0 +1,9 @@
+stmt-expr-discard.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ + 2
+ ^
+stmt-expr-discard.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ - 4
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/stmt-expr-discard.flags b/tests/untried/neg/stmt-expr-discard.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/stmt-expr-discard.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/stmt-expr-discard.scala b/tests/untried/neg/stmt-expr-discard.scala
new file mode 100644
index 000000000..e60c85462
--- /dev/null
+++ b/tests/untried/neg/stmt-expr-discard.scala
@@ -0,0 +1,5 @@
+class A {
+ def f = 1
+ + 2
+ - 4
+}
diff --git a/tests/untried/neg/stringinterpolation_macro-neg.check b/tests/untried/neg/stringinterpolation_macro-neg.check
new file mode 100644
index 000000000..703846ad6
--- /dev/null
+++ b/tests/untried/neg/stringinterpolation_macro-neg.check
@@ -0,0 +1,172 @@
+stringinterpolation_macro-neg.scala:13: error: there are no parts
+ new StringContext().f()
+ ^
+stringinterpolation_macro-neg.scala:14: error: too few arguments for interpolated string
+ new StringContext("", " is ", "%2d years old").f(s)
+ ^
+stringinterpolation_macro-neg.scala:15: error: too many arguments for interpolated string
+ new StringContext("", " is ", "%2d years old").f(s, d, d)
+ ^
+stringinterpolation_macro-neg.scala:16: error: too few arguments for interpolated string
+ new StringContext("", "").f()
+ ^
+stringinterpolation_macro-neg.scala:19: error: type mismatch;
+ found : String
+ required: Boolean
+ f"$s%b"
+ ^
+stringinterpolation_macro-neg.scala:20: error: type mismatch;
+ found : String
+ required: Char
+ f"$s%c"
+ ^
+stringinterpolation_macro-neg.scala:21: error: type mismatch;
+ found : Double
+ required: Char
+ f"$f%c"
+ ^
+stringinterpolation_macro-neg.scala:22: error: type mismatch;
+ found : String
+ required: Int
+ f"$s%x"
+ ^
+stringinterpolation_macro-neg.scala:23: error: type mismatch;
+ found : Boolean
+ required: Int
+ f"$b%d"
+ ^
+stringinterpolation_macro-neg.scala:24: error: type mismatch;
+ found : String
+ required: Int
+ f"$s%d"
+ ^
+stringinterpolation_macro-neg.scala:25: error: type mismatch;
+ found : Double
+ required: Int
+ f"$f%o"
+ ^
+stringinterpolation_macro-neg.scala:26: error: type mismatch;
+ found : String
+ required: Double
+ f"$s%e"
+ ^
+stringinterpolation_macro-neg.scala:27: error: type mismatch;
+ found : Boolean
+ required: Double
+ f"$b%f"
+ ^
+stringinterpolation_macro-neg.scala:32: error: type mismatch;
+ found : String
+ required: Int
+Note that implicit conversions are not applicable because they are ambiguous:
+ both value strToInt2 of type String => Int
+ and value strToInt1 of type String => Int
+ are possible conversion functions from String to Int
+ f"$s%d"
+ ^
+stringinterpolation_macro-neg.scala:35: error: illegal conversion character 'i'
+ f"$s%i"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag '+'
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag ' '
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag '0'
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag ','
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag '('
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:39: error: Only '-' allowed for c conversion
+ f"$c%#+ 0,(c"
+ ^
+stringinterpolation_macro-neg.scala:40: error: # not allowed for d conversion
+ f"$d%#d"
+ ^
+stringinterpolation_macro-neg.scala:41: error: ',' only allowed for d conversion of integral types
+ f"$d%,x"
+ ^
+stringinterpolation_macro-neg.scala:42: error: only use '+' for BigInt conversions to o, x, X
+ f"$d%+ (x"
+ ^
+stringinterpolation_macro-neg.scala:42: error: only use ' ' for BigInt conversions to o, x, X
+ f"$d%+ (x"
+ ^
+stringinterpolation_macro-neg.scala:42: error: only use '(' for BigInt conversions to o, x, X
+ f"$d%+ (x"
+ ^
+stringinterpolation_macro-neg.scala:43: error: ',' not allowed for a, A
+ f"$f%,(a"
+ ^
+stringinterpolation_macro-neg.scala:43: error: '(' not allowed for a, A
+ f"$f%,(a"
+ ^
+stringinterpolation_macro-neg.scala:44: error: Only '-' allowed for date/time conversions
+ f"$t%#+ 0,(tT"
+ ^
+stringinterpolation_macro-neg.scala:47: error: precision not allowed
+ f"$c%.2c"
+ ^
+stringinterpolation_macro-neg.scala:48: error: precision not allowed
+ f"$d%.2d"
+ ^
+stringinterpolation_macro-neg.scala:49: error: precision not allowed
+ f"%.2%"
+ ^
+stringinterpolation_macro-neg.scala:50: error: precision not allowed
+ f"%.2n"
+ ^
+stringinterpolation_macro-neg.scala:51: error: precision not allowed
+ f"$f%.2a"
+ ^
+stringinterpolation_macro-neg.scala:52: error: precision not allowed
+ f"$t%.2tT"
+ ^
+stringinterpolation_macro-neg.scala:55: error: No last arg
+ f"%<s"
+ ^
+stringinterpolation_macro-neg.scala:56: error: No last arg
+ f"%<c"
+ ^
+stringinterpolation_macro-neg.scala:57: error: No last arg
+ f"%<tT"
+ ^
+stringinterpolation_macro-neg.scala:58: error: Argument index out of range
+ f"${8}%d ${9}%d%3$$d"
+ ^
+stringinterpolation_macro-neg.scala:59: error: Argument index out of range
+ f"${8}%d ${9}%d%0$$d"
+ ^
+stringinterpolation_macro-neg.scala:62: warning: Index is not this arg
+ f"${8}%d ${9}%1$$d"
+ ^
+stringinterpolation_macro-neg.scala:63: warning: Argument index ignored if '<' flag is present
+ f"$s%s $s%s %1$$<s"
+ ^
+stringinterpolation_macro-neg.scala:64: warning: Index is not this arg
+ f"$s%s $s%1$$s"
+ ^
+stringinterpolation_macro-neg.scala:67: error: type mismatch;
+ found : String
+ required: java.util.Formattable
+ f"$s%#s"
+ ^
+stringinterpolation_macro-neg.scala:70: error: 'G' doesn't seem to be a date or time conversion
+ f"$t%tG"
+ ^
+stringinterpolation_macro-neg.scala:71: error: Date/time conversion must have two characters
+ f"$t%t"
+ ^
+stringinterpolation_macro-neg.scala:72: error: Missing conversion operator in '%10.5'; use %% for literal %, %n for newline
+ f"$s%10.5"
+ ^
+stringinterpolation_macro-neg.scala:75: error: conversions must follow a splice; use %% for literal %, %n for newline
+ f"${d}random-leading-junk%d"
+ ^
+three warnings found
+45 errors found
diff --git a/tests/untried/neg/stringinterpolation_macro-neg.scala b/tests/untried/neg/stringinterpolation_macro-neg.scala
new file mode 100644
index 000000000..3869d42d6
--- /dev/null
+++ b/tests/untried/neg/stringinterpolation_macro-neg.scala
@@ -0,0 +1,76 @@
+object Test extends App {
+ val s = "Scala"
+ val d = 8
+ val b = false
+ val f = 3.14159
+ val c = 'c'
+ val t = new java.util.Date
+ val x = new java.util.Formattable {
+ def formatTo(ff: java.util.Formatter, g: Int, w: Int, p: Int): Unit = ff format "xxx"
+ }
+
+ // 1) number of arguments
+ new StringContext().f()
+ new StringContext("", " is ", "%2d years old").f(s)
+ new StringContext("", " is ", "%2d years old").f(s, d, d)
+ new StringContext("", "").f()
+
+ // 2) Interpolation mismatches
+ f"$s%b"
+ f"$s%c"
+ f"$f%c"
+ f"$s%x"
+ f"$b%d"
+ f"$s%d"
+ f"$f%o"
+ f"$s%e"
+ f"$b%f"
+
+ {
+ implicit val strToInt1 = (s: String) => 1
+ implicit val strToInt2 = (s: String) => 2
+ f"$s%d"
+ }
+
+ f"$s%i"
+
+ // 3) flag mismatches
+ f"$s%+ 0,(s"
+ f"$c%#+ 0,(c"
+ f"$d%#d"
+ f"$d%,x"
+ f"$d%+ (x"
+ f"$f%,(a"
+ f"$t%#+ 0,(tT"
+
+ // 4) bad precisions
+ f"$c%.2c"
+ f"$d%.2d"
+ f"%.2%"
+ f"%.2n"
+ f"$f%.2a"
+ f"$t%.2tT"
+
+ // 5) bad indexes
+ f"%<s"
+ f"%<c"
+ f"%<tT"
+ f"${8}%d ${9}%d%3$$d"
+ f"${8}%d ${9}%d%0$$d"
+
+ // warnings
+ f"${8}%d ${9}%1$$d"
+ f"$s%s $s%s %1$$<s"
+ f"$s%s $s%1$$s"
+
+ // 6) bad arg types
+ f"$s%#s"
+
+ // 7) misunderstood conversions
+ f"$t%tG"
+ f"$t%t"
+ f"$s%10.5"
+
+ // 8) other brain failures
+ f"${d}random-leading-junk%d"
+}
diff --git a/tests/untried/neg/structural.check b/tests/untried/neg/structural.check
new file mode 100644
index 000000000..5b2f352a7
--- /dev/null
+++ b/tests/untried/neg/structural.check
@@ -0,0 +1,28 @@
+structural.scala:47: error: Parameter type in structural refinement may not refer to the type of that refinement (self type)
+ val s1 = new { def f(p: this.type): Unit = () }
+ ^
+structural.scala:10: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
+ def f1[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: A): Object; val x: A }) = x.m[Tata](x.x) //fail
+ ^
+structural.scala:11: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
+ def f2[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: B): Object; val x: B }) = x.m[Tata](x.x) //fail
+ ^
+structural.scala:12: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
+ def f3[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: C): Object; val x: C }) = x.m[Tata](x.x) //fail
+ ^
+structural.scala:13: error: Parameter type in structural refinement may not refer to a type member of that refinement
+ def f4[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: D): Object; val x: D }) = x.m[Tata](x.x) //fail
+ ^
+structural.scala:42: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
+ type Summable[T] = { def +(v : T) : T }
+ ^
+structural.scala:46: error: Parameter type in structural refinement may not refer to the type of that refinement (self type)
+ type S1 = { def f(p: this.type): Unit }
+ ^
+structural.scala:49: error: Parameter type in structural refinement may not refer to a type member of that refinement
+ type S2 = { type T; def f(p: T): Unit }
+ ^
+structural.scala:52: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
+ def s3[U >: Null <: Object](p: { def f(p: U): Unit; def u: U }) = ()
+ ^
+9 errors found
diff --git a/tests/untried/neg/structural.scala b/tests/untried/neg/structural.scala
new file mode 100644
index 000000000..d78339931
--- /dev/null
+++ b/tests/untried/neg/structural.scala
@@ -0,0 +1,54 @@
+object Test extends App {
+
+ def f(x: { type D; def m: D }): Null = null
+
+ class Tata
+
+ abstract class Toto[A <: Object] {
+ type B <: Object
+
+ def f1[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: A): Object; val x: A }) = x.m[Tata](x.x) //fail
+ def f2[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: B): Object; val x: B }) = x.m[Tata](x.x) //fail
+ def f3[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: C): Object; val x: C }) = x.m[Tata](x.x) //fail
+ def f4[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: D): Object; val x: D }) = x.m[Tata](x.x) //fail
+ def f5[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: E): Object; val x: Tata }) = x.m[Tata](x.x) //suceed
+
+ def f6[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): A }) = x.m[Tata](null) //suceed
+ def f7[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): B }) = x.m[Tata](null) //suceed
+ def f8[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): C }) = x.m[Tata](null) //suceed
+ def f9[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): D }) = x.m[Tata](null) //fail
+ def f0[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): E }) = x.m[Tata](null) //suceed
+
+ }
+
+ val tata = new Tata
+ val toto = new Toto[Tata] {
+ type B = Tata
+ }
+
+ //toto.f1[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Tata): Object = null; val x = tata })
+ //toto.f2[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Tata): Object = null; val x = tata })
+ //toto.f3[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Tata): Object = null; val x = tata })
+ //toto.f4[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: D): Object = null; val x = tata })
+ toto.f5[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: E): Object = null; val x: Test.Tata = tata })
+
+ toto.f6[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): Tata = null })
+ toto.f7[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): Tata = null })
+ toto.f8[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): Tata = null })
+ //toto.f9[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): D = null })
+ toto.f0[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): E = null })
+
+ /* Bug #1246 */
+ type Summable[T] = { def +(v : T) : T }
+ def sum[T <: Summable[T]](xs : List[T]) = xs.reduceLeft[T](_ + _)
+
+ /* Bug #1004 & #967 */
+ type S1 = { def f(p: this.type): Unit }
+ val s1 = new { def f(p: this.type): Unit = () }
+
+ type S2 = { type T; def f(p: T): Unit }
+ //val s2: S2 = new { type T = A; def f(p: T): Unit = () }
+
+ def s3[U >: Null <: Object](p: { def f(p: U): Unit; def u: U }) = ()
+
+}
diff --git a/tests/untried/neg/suggest-similar.check b/tests/untried/neg/suggest-similar.check
new file mode 100644
index 000000000..057aa8b25
--- /dev/null
+++ b/tests/untried/neg/suggest-similar.check
@@ -0,0 +1,10 @@
+suggest-similar.scala:8: error: not found: value flippitx
+ flippitx = 123
+ ^
+suggest-similar.scala:9: error: not found: value identiyt
+ Nil map identiyt
+ ^
+suggest-similar.scala:10: error: not found: type Bingus
+ new Bingus
+ ^
+three errors found
diff --git a/tests/untried/neg/suggest-similar.scala b/tests/untried/neg/suggest-similar.scala
new file mode 100644
index 000000000..ff327478f
--- /dev/null
+++ b/tests/untried/neg/suggest-similar.scala
@@ -0,0 +1,11 @@
+class Dingus
+object Dingus {
+ var flippity = 1
+}
+import Dingus._
+
+class A {
+ flippitx = 123
+ Nil map identiyt
+ new Bingus
+}
diff --git a/tests/untried/neg/super-cast-or-test.check b/tests/untried/neg/super-cast-or-test.check
new file mode 100644
index 000000000..8e5eed62b
--- /dev/null
+++ b/tests/untried/neg/super-cast-or-test.check
@@ -0,0 +1,7 @@
+super-cast-or-test.scala:1: error: super not allowed here: use this.asInstanceOf instead
+trait A { def f = super.asInstanceOf[AnyRef] }
+ ^
+super-cast-or-test.scala:2: error: super not allowed here: use this.isInstanceOf instead
+trait B { def g = super.isInstanceOf[AnyRef] }
+ ^
+two errors found
diff --git a/tests/untried/neg/super-cast-or-test.scala b/tests/untried/neg/super-cast-or-test.scala
new file mode 100644
index 000000000..a0f86d808
--- /dev/null
+++ b/tests/untried/neg/super-cast-or-test.scala
@@ -0,0 +1,3 @@
+trait A { def f = super.asInstanceOf[AnyRef] }
+trait B { def g = super.isInstanceOf[AnyRef] }
+
diff --git a/tests/untried/neg/switch.check b/tests/untried/neg/switch.check
new file mode 100644
index 000000000..f968d3a44
--- /dev/null
+++ b/tests/untried/neg/switch.check
@@ -0,0 +1,9 @@
+switch.scala:38: warning: could not emit switch for @switch annotated match
+ def fail2(c: Char) = (c: @switch @unchecked) match {
+ ^
+switch.scala:45: warning: could not emit switch for @switch annotated match
+ def fail3(c: Char) = (c: @unchecked @switch) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/switch.flags b/tests/untried/neg/switch.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/switch.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/switch.scala b/tests/untried/neg/switch.scala
new file mode 100644
index 000000000..a66ed768f
--- /dev/null
+++ b/tests/untried/neg/switch.scala
@@ -0,0 +1,66 @@
+import scala.annotation.switch
+
+// this is testing not so much how things ought to be but how they are;
+// the test is supposed to start failing if the behavior changes at all.
+object Other {
+ val C1 = 'P' // fails: not final
+ final val C2 = 'Q' // succeeds: singleton type Char('Q') inferred
+ final val C3: Char = 'R' // fails: type Char specified
+ final val C4 = '\u000A' // succeeds like C2 but more unicodey
+}
+
+object Main {
+ def succ1(c: Char) = (c: @switch) match {
+ case 'A' | 'B' | 'C' => true
+ case 'd' => true
+ case 'f' | 'g' => true
+ case _ => false
+ }
+
+ def succ2(c: Char) = (c: @switch) match {
+ case 'A' | 'B' | 'C' => true
+ case Other.C2 => true
+ case Other.C4 => true
+ case _ => false
+ }
+
+ // has a guard, but since SI-5830 that's ok
+ def succ_guard(c: Char) = (c: @switch) match {
+ case 'A' | 'B' | 'C' => true
+ case x if x == 'A' => true
+ case _ => false
+ }
+
+ // throwing in @unchecked on the next two to make sure
+ // multiple annotations are processed correctly
+
+ // thinks a val in an object is constant... so naive
+ def fail2(c: Char) = (c: @switch @unchecked) match {
+ case 'A' => true
+ case Other.C1 => true
+ case _ => false
+ }
+
+ // more naivete
+ def fail3(c: Char) = (c: @unchecked @switch) match {
+ case 'A' => true
+ case Other.C3 => true
+ case _ => false
+ }
+
+ // guard case done correctly
+ def succ3(c: Char) = (c: @switch) match {
+ case 'A' | 'B' | 'C' => true
+ case x => x == 'A'
+ }
+
+ // some ints just to mix it up a bit
+ def succ4(x: Int, y: Int) = ((x+y): @switch) match {
+ case 1 => 5
+ case 2 => 10
+ case 3 => 20
+ case 4 => 50
+ case 5|6|7|8 => 100
+ case _ => -1
+ }
+}
diff --git a/tests/untried/neg/t0003.check b/tests/untried/neg/t0003.check
new file mode 100644
index 000000000..8bab55db3
--- /dev/null
+++ b/tests/untried/neg/t0003.check
@@ -0,0 +1,6 @@
+t0003.scala:2: error: type mismatch;
+ found : A => (B => B)
+ required: A => B
+ def foo[A, B, C](l: List[A], f: A => B=>B, g: B=>B=>C): List[C] = l map (g compose f)
+ ^
+one error found
diff --git a/tests/untried/neg/t0003.scala b/tests/untried/neg/t0003.scala
new file mode 100644
index 000000000..e41cfa9e9
--- /dev/null
+++ b/tests/untried/neg/t0003.scala
@@ -0,0 +1,3 @@
+object Test {
+ def foo[A, B, C](l: List[A], f: A => B=>B, g: B=>B=>C): List[C] = l map (g compose f)
+}
diff --git a/tests/untried/neg/t0015.check b/tests/untried/neg/t0015.check
new file mode 100644
index 000000000..43adc22f7
--- /dev/null
+++ b/tests/untried/neg/t0015.check
@@ -0,0 +1,6 @@
+t0015.scala:5: error: type mismatch;
+ found : () => Nothing
+ required: Nothing => ?
+ Nil.map(f _)
+ ^
+one error found
diff --git a/tests/untried/neg/t0015.scala b/tests/untried/neg/t0015.scala
new file mode 100644
index 000000000..225197f95
--- /dev/null
+++ b/tests/untried/neg/t0015.scala
@@ -0,0 +1,25 @@
+abstract class Test
+{
+ def f: Nothing
+
+ Nil.map(f _)
+}
+
+abstract class M
+{ self =>
+
+ type T
+ final type selfType = M {type T = self.T}
+ type actualSelfType >: self.type <: selfType
+
+
+ def f[U](x: Any) = {}
+
+ // compiles successfully
+ //f[Int](self: actualSelfType)
+
+ f[Int](self: selfType) // compiles Ok now was well, because we narrow to singletonType in this situation
+
+ //def g(x: Any) = {}
+ //g(self: selfType)
+}
diff --git a/tests/untried/neg/t0117.check b/tests/untried/neg/t0117.check
new file mode 100644
index 000000000..579cf883a
--- /dev/null
+++ b/tests/untried/neg/t0117.check
@@ -0,0 +1,4 @@
+t0117.scala:2: error: Implementation restriction: traits may not select fields or methods from super[C] where C is a class
+trait B extends A { println(super[A].a) }
+ ^
+one error found
diff --git a/tests/untried/neg/t0117.scala b/tests/untried/neg/t0117.scala
new file mode 100644
index 000000000..4cd9ad6ef
--- /dev/null
+++ b/tests/untried/neg/t0117.scala
@@ -0,0 +1,5 @@
+class A { def a = 0 }
+trait B extends A { println(super[A].a) }
+object Test extends App {
+ new B {}
+}
diff --git a/tests/untried/neg/t0152.check b/tests/untried/neg/t0152.check
new file mode 100644
index 000000000..a7909bf14
--- /dev/null
+++ b/tests/untried/neg/t0152.check
@@ -0,0 +1,6 @@
+t0152.scala:10: error: illegal inheritance;
+ object boom inherits different type instances of class Value:
+Value[Int] and Value[String]
+ object boom extends Value[java.lang.String]("foo") with PlusOne
+ ^
+one error found
diff --git a/tests/untried/neg/t0152.scala b/tests/untried/neg/t0152.scala
new file mode 100644
index 000000000..d86d59e97
--- /dev/null
+++ b/tests/untried/neg/t0152.scala
@@ -0,0 +1,13 @@
+class Value[+T](x: T) {
+ def value = x
+}
+
+trait PlusOne extends Value[Int] {
+ override def value = super.value + 1
+}
+
+object Test extends App {
+ object boom extends Value[java.lang.String]("foo") with PlusOne
+
+ println(boom.value) // class cast exception!
+}
diff --git a/tests/untried/neg/t0204.check b/tests/untried/neg/t0204.check
new file mode 100644
index 000000000..0f7acfddd
--- /dev/null
+++ b/tests/untried/neg/t0204.check
@@ -0,0 +1,4 @@
+t0204.scala:4: error: class type required but Program.A{type T = String} found
+ trait C extends B
+ ^
+one error found
diff --git a/tests/untried/neg/t0204.scala b/tests/untried/neg/t0204.scala
new file mode 100644
index 000000000..0de9d9d16
--- /dev/null
+++ b/tests/untried/neg/t0204.scala
@@ -0,0 +1,5 @@
+object Program {
+ trait A { type T }
+ type B = A { type T = String }
+ trait C extends B
+}
diff --git a/tests/untried/neg/t0207.check b/tests/untried/neg/t0207.check
new file mode 100644
index 000000000..ebe6759b3
--- /dev/null
+++ b/tests/untried/neg/t0207.check
@@ -0,0 +1,7 @@
+t0207.scala:3: error: type T takes type parameters
+ type S = (T with T)[A]
+ ^
+t0207.scala:3: error: type T takes type parameters
+ type S = (T with T)[A]
+ ^
+two errors found
diff --git a/tests/untried/neg/t0207.scala b/tests/untried/neg/t0207.scala
new file mode 100644
index 000000000..d9df0ca95
--- /dev/null
+++ b/tests/untried/neg/t0207.scala
@@ -0,0 +1,4 @@
+trait A {
+ type T[_]
+ type S = (T with T)[A]
+}
diff --git a/tests/untried/neg/t0209.check b/tests/untried/neg/t0209.check
new file mode 100644
index 000000000..1904e58e7
--- /dev/null
+++ b/tests/untried/neg/t0209.check
@@ -0,0 +1,6 @@
+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/tests/untried/neg/t0209.scala b/tests/untried/neg/t0209.scala
new file mode 100644
index 000000000..cd9bd9754
--- /dev/null
+++ b/tests/untried/neg/t0209.scala
@@ -0,0 +1,17 @@
+abstract class A {
+ def f(x : this.type) : B
+}
+
+class B extends A {
+ override def f(x : this.type) : B = x
+}
+
+class C extends A {
+ override def f(x : this.type) : B = null
+}
+
+object Program {
+ def main(args : Array[String]): Unit = {
+ (new B: A).f(new C)
+ }
+}
diff --git a/tests/untried/neg/t0214.check b/tests/untried/neg/t0214.check
new file mode 100644
index 000000000..30bb0488c
--- /dev/null
+++ b/tests/untried/neg/t0214.check
@@ -0,0 +1,4 @@
+t0214.scala:3: error: missing parameter type
+ a2p(x => x._1,(2,3))
+ ^
+one error found
diff --git a/tests/untried/neg/t0214.scala b/tests/untried/neg/t0214.scala
new file mode 100644
index 000000000..bdc42bfd7
--- /dev/null
+++ b/tests/untried/neg/t0214.scala
@@ -0,0 +1,4 @@
+object Test {
+ def a2p[a,b,c](f:((a,b))=>c,v:(a,b)):c = f(v)
+ a2p(x => x._1,(2,3))
+}
diff --git a/tests/untried/neg/t0218.check b/tests/untried/neg/t0218.check
new file mode 100644
index 000000000..a22583d23
--- /dev/null
+++ b/tests/untried/neg/t0218.check
@@ -0,0 +1,4 @@
+t0218.scala:10: error: class type required but APQ.this.P found
+ List(new PP)
+ ^
+one error found
diff --git a/tests/untried/neg/t0218.scala b/tests/untried/neg/t0218.scala
new file mode 100644
index 000000000..319be82a7
--- /dev/null
+++ b/tests/untried/neg/t0218.scala
@@ -0,0 +1,12 @@
+trait APQ {
+ class Placement {
+ }
+
+ type P <: Placement
+
+ type PP = P
+
+ def pq(numQueens: Int, numRows: Int) : List[Placement] = {
+ List(new PP)
+ }
+}
diff --git a/tests/untried/neg/t0226.check b/tests/untried/neg/t0226.check
new file mode 100644
index 000000000..247f1f244
--- /dev/null
+++ b/tests/untried/neg/t0226.check
@@ -0,0 +1,10 @@
+t0226.scala:5: error: not found: type A1
+ (implicit _1: Foo[List[A1]], _2: Foo[A2]): Foo[Tuple2[List[A1], A2]] =
+ ^
+t0226.scala:5: error: not found: type A1
+ (implicit _1: Foo[List[A1]], _2: Foo[A2]): Foo[Tuple2[List[A1], A2]] =
+ ^
+t0226.scala:8: error: could not find implicit value for parameter rep: Test.this.Foo[((List[Char], Int), (scala.collection.immutable.Nil.type, Int))]
+ foo(((List('b'), 3), (Nil, 4)))
+ ^
+three errors found
diff --git a/tests/untried/neg/t0226.scala b/tests/untried/neg/t0226.scala
new file mode 100644
index 000000000..beca3cd64
--- /dev/null
+++ b/tests/untried/neg/t0226.scala
@@ -0,0 +1,9 @@
+class Test {
+ def foo[A](x: A)(implicit rep: Foo[A]): Foo[A] = rep
+ abstract class Foo[A]
+ implicit def list2Foo[List[A1], A2]
+ (implicit _1: Foo[List[A1]], _2: Foo[A2]): Foo[Tuple2[List[A1], A2]] =
+ null //dummy
+
+ foo(((List('b'), 3), (Nil, 4)))
+}
diff --git a/tests/untried/neg/t0259.check b/tests/untried/neg/t0259.check
new file mode 100644
index 000000000..8c15d9841
--- /dev/null
+++ b/tests/untried/neg/t0259.check
@@ -0,0 +1,7 @@
+t0259.scala:4: error: double definition:
+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()
+ ^
+one error found
diff --git a/tests/untried/neg/t0259.scala b/tests/untried/neg/t0259.scala
new file mode 100644
index 000000000..29aef7011
--- /dev/null
+++ b/tests/untried/neg/t0259.scala
@@ -0,0 +1,6 @@
+package test;
+class TestCase3() {
+ def this( groups: (String, Int)*) = this()
+ def this( groups: String*) = this()
+}
+object Main extends TestCase3 with App
diff --git a/tests/untried/neg/t0345.check b/tests/untried/neg/t0345.check
new file mode 100644
index 000000000..1e55d01cd
--- /dev/null
+++ b/tests/untried/neg/t0345.check
@@ -0,0 +1,4 @@
+t0345.scala:2: error: object creation impossible, since method cons in trait Lizt of type (a: Nothing)Unit is not defined
+ val empty = new Lizt[Nothing] {
+ ^
+one error found
diff --git a/tests/untried/neg/t0345.scala b/tests/untried/neg/t0345.scala
new file mode 100644
index 000000000..15b941bc4
--- /dev/null
+++ b/tests/untried/neg/t0345.scala
@@ -0,0 +1,15 @@
+object Lizt {
+ val empty = new Lizt[Nothing] {
+ def cons[A](a : A): Unit = {}
+ }
+}
+
+trait Lizt[A] {
+ def cons(a : A) : Unit
+}
+class Test {
+ abstract class C[A] {}
+ val c = new C[Int] {
+ def f[A](x: A): Unit = {}
+ }
+ }
diff --git a/tests/untried/neg/t0351.check b/tests/untried/neg/t0351.check
new file mode 100644
index 000000000..ce10605ec
--- /dev/null
+++ b/tests/untried/neg/t0351.check
@@ -0,0 +1,4 @@
+t0351.scala:2: error: no by-name parameter type allowed here
+ def identity[T](x : => T) : (=> T)
+ ^
+one error found
diff --git a/tests/untried/neg/t0351.scala b/tests/untried/neg/t0351.scala
new file mode 100644
index 000000000..665bd89da
--- /dev/null
+++ b/tests/untried/neg/t0351.scala
@@ -0,0 +1,3 @@
+abstract class Foo {
+ def identity[T](x : => T) : (=> T)
+}
diff --git a/tests/untried/neg/t0418.check b/tests/untried/neg/t0418.check
new file mode 100644
index 000000000..b95f8e4e1
--- /dev/null
+++ b/tests/untried/neg/t0418.check
@@ -0,0 +1,4 @@
+t0418.scala:2: error: not found: value Foo12340771
+ null match { case Foo12340771.Bar(x) => x }
+ ^
+one error found
diff --git a/tests/untried/neg/t0418.scala b/tests/untried/neg/t0418.scala
new file mode 100644
index 000000000..67007010d
--- /dev/null
+++ b/tests/untried/neg/t0418.scala
@@ -0,0 +1,3 @@
+object Test {
+ null match { case Foo12340771.Bar(x) => x }
+}
diff --git a/tests/untried/neg/t0503.check b/tests/untried/neg/t0503.check
new file mode 100644
index 000000000..51e5bbeda
--- /dev/null
+++ b/tests/untried/neg/t0503.check
@@ -0,0 +1,7 @@
+t0503.scala:1: error: expected class or object definition
+val x = new { } with { }
+^
+t0503.scala:3: error: expected class or object definition
+val y = new { } with A
+^
+two errors found
diff --git a/tests/untried/neg/t0503.scala b/tests/untried/neg/t0503.scala
new file mode 100644
index 000000000..322e1ad13
--- /dev/null
+++ b/tests/untried/neg/t0503.scala
@@ -0,0 +1,3 @@
+val x = new { } with { }
+trait A
+val y = new { } with A
diff --git a/tests/untried/neg/t0513.check b/tests/untried/neg/t0513.check
new file mode 100644
index 000000000..edc0c9ab6
--- /dev/null
+++ b/tests/untried/neg/t0513.check
@@ -0,0 +1,7 @@
+t0513.scala:5: error: type arguments [Nothing,Int] do not conform to class Y's type parameter bounds [T1,T2 <: T1]
+ val test2 = Test[Y[Nothing, Int]] // No error
+ ^
+t0513.scala:5: error: type arguments [Nothing,Int] do not conform to class Y's type parameter bounds [T1,T2 <: T1]
+ val test2 = Test[Y[Nothing, Int]] // No error
+ ^
+two errors found
diff --git a/tests/untried/neg/t0513.scala b/tests/untried/neg/t0513.scala
new file mode 100644
index 000000000..0193483ca
--- /dev/null
+++ b/tests/untried/neg/t0513.scala
@@ -0,0 +1,6 @@
+object Test {
+ case class Y[T1, T2 <: T1]()
+ //val test = Y[Nothing, Int] // Compiler error
+ case class Test[T]()
+ val test2 = Test[Y[Nothing, Int]] // No error
+}
diff --git a/tests/untried/neg/t0528neg.check b/tests/untried/neg/t0528neg.check
new file mode 100644
index 000000000..c8c3ab422
--- /dev/null
+++ b/tests/untried/neg/t0528neg.check
@@ -0,0 +1,4 @@
+t0528neg.scala:2: error: covariant type A occurs in invariant position in type => Array[T forSome { type T <: A }] of method toArray
+ def toArray: Array[T forSome {type T <: A}]
+ ^
+one error found
diff --git a/tests/untried/neg/t0528neg.scala b/tests/untried/neg/t0528neg.scala
new file mode 100644
index 000000000..d19bdac73
--- /dev/null
+++ b/tests/untried/neg/t0528neg.scala
@@ -0,0 +1,15 @@
+trait Sequ[+A] {
+ def toArray: Array[T forSome {type T <: A}]
+}
+
+class RichStr extends Sequ[Char] {
+ // override to a primitive array
+ def toArray: Array[Char] = new Array[Char](10)
+}
+
+object Foo extends App {
+ val x: RichStr = new RichStr
+
+ println(x.toArray) // call directly
+ println((x: Sequ[Char]).toArray) // calling through the bridge misses unboxing
+}
diff --git a/tests/untried/neg/t0565.check b/tests/untried/neg/t0565.check
new file mode 100644
index 000000000..98e61a250
--- /dev/null
+++ b/tests/untried/neg/t0565.check
@@ -0,0 +1,4 @@
+t0565.scala:8: error: Parameter type in structural refinement may not refer to a type member of that refinement
+ def z (w : T) : T } =
+ ^
+one error found
diff --git a/tests/untried/neg/t0565.scala b/tests/untried/neg/t0565.scala
new file mode 100644
index 000000000..53059a4e0
--- /dev/null
+++ b/tests/untried/neg/t0565.scala
@@ -0,0 +1,22 @@
+object Test extends App {
+
+ class MacGuffin
+
+ object A {
+ var x : { type T >: Null <: AnyRef;
+ val y : T;
+ def z (w : T) : T } =
+ new { type T = String;
+ val y = "foo";
+ def z (w : String) = w + "bar" }
+ lazy val u = { println("u evaluated"); x }
+ def foo (v : => u.type#T) : u.type#T = {
+ x = new { type T = MacGuffin;
+ val y = new MacGuffin;
+ def z (w : MacGuffin) = w }
+ u.z(v)
+ }
+ }
+
+ A.foo(A.u.y)
+}
diff --git a/tests/untried/neg/t0590.check b/tests/untried/neg/t0590.check
new file mode 100644
index 000000000..a3ef70c6c
--- /dev/null
+++ b/tests/untried/neg/t0590.check
@@ -0,0 +1,6 @@
+t0590.scala:2: error: type mismatch;
+ found : Null(null)
+ required: T
+ implicit def foo[T] : T = null
+ ^
+one error found
diff --git a/tests/untried/neg/t0590.scala b/tests/untried/neg/t0590.scala
new file mode 100644
index 000000000..3416ade35
--- /dev/null
+++ b/tests/untried/neg/t0590.scala
@@ -0,0 +1,3 @@
+object Test {
+ implicit def foo[T] : T = null
+}
diff --git a/tests/untried/neg/t0606.check b/tests/untried/neg/t0606.check
new file mode 100644
index 000000000..fb83fca74
--- /dev/null
+++ b/tests/untried/neg/t0606.check
@@ -0,0 +1,4 @@
+t0606.scala:5: error: private value db escapes its defining scope as part of type Foo.this.db.Info
+ val info = new db.Info
+ ^
+one error found
diff --git a/tests/untried/neg/t0606.scala b/tests/untried/neg/t0606.scala
new file mode 100644
index 000000000..e76ea810e
--- /dev/null
+++ b/tests/untried/neg/t0606.scala
@@ -0,0 +1,6 @@
+class Database {
+ class Info
+}
+class Foo(db : Database) {
+ val info = new db.Info
+}
diff --git a/tests/untried/neg/t0673.check b/tests/untried/neg/t0673.check
new file mode 100644
index 000000000..fd27afc23
--- /dev/null
+++ b/tests/untried/neg/t0673.check
@@ -0,0 +1,4 @@
+Test.scala:2: error: object JavaClass.InnerClass is not a value
+ val x = JavaClass.InnerClass
+ ^
+one error found
diff --git a/tests/untried/neg/t0673/JavaClass.java b/tests/untried/neg/t0673/JavaClass.java
new file mode 100644
index 000000000..e469e1348
--- /dev/null
+++ b/tests/untried/neg/t0673/JavaClass.java
@@ -0,0 +1,3 @@
+public class JavaClass {
+ public static class InnerClass {}
+}
diff --git a/tests/untried/neg/t0673/Test.scala b/tests/untried/neg/t0673/Test.scala
new file mode 100644
index 000000000..43b97887e
--- /dev/null
+++ b/tests/untried/neg/t0673/Test.scala
@@ -0,0 +1,3 @@
+object Test {
+ val x = JavaClass.InnerClass
+}
diff --git a/tests/untried/neg/t0699.check b/tests/untried/neg/t0699.check
new file mode 100644
index 000000000..c944da8c1
--- /dev/null
+++ b/tests/untried/neg/t0699.check
@@ -0,0 +1,10 @@
+B.scala:2: error: illegal inheritance from sealed trait T
+ trait T1 extends A.T
+ ^
+B.scala:3: error: illegal inheritance from sealed class C
+ trait T2 extends A.C
+ ^
+B.scala:4: error: illegal inheritance from sealed class C
+ class C1 extends A.C
+ ^
+three errors found
diff --git a/tests/untried/neg/t0699/A.scala b/tests/untried/neg/t0699/A.scala
new file mode 100644
index 000000000..a75ebbd25
--- /dev/null
+++ b/tests/untried/neg/t0699/A.scala
@@ -0,0 +1,4 @@
+object A {
+ sealed trait T
+ sealed class C
+}
diff --git a/tests/untried/neg/t0699/B.scala b/tests/untried/neg/t0699/B.scala
new file mode 100644
index 000000000..d27ad16ee
--- /dev/null
+++ b/tests/untried/neg/t0699/B.scala
@@ -0,0 +1,5 @@
+object B {
+ trait T1 extends A.T
+ trait T2 extends A.C
+ class C1 extends A.C
+}
diff --git a/tests/untried/neg/t0764.check b/tests/untried/neg/t0764.check
new file mode 100644
index 000000000..0c7cff1e1
--- /dev/null
+++ b/tests/untried/neg/t0764.check
@@ -0,0 +1,7 @@
+t0764.scala:13: error: type mismatch;
+ found : Node{type T = _1.type} where val _1: Node{type T = NextType}
+ required: Node{type T = Main.this.AType}
+ (which expands to) Node{type T = Node{type T = NextType}}
+ new Main[AType]( (value: AType).prepend )
+ ^
+one error found
diff --git a/tests/untried/neg/t0764.scala b/tests/untried/neg/t0764.scala
new file mode 100644
index 000000000..7ee76feab
--- /dev/null
+++ b/tests/untried/neg/t0764.scala
@@ -0,0 +1,45 @@
+class Top[A] {
+ type AType = A
+}
+
+trait Node { outer =>
+ type T <: Node
+ def prepend = new Node { type T = outer.type }
+}
+
+class Main[NextType <: Node](value: Node { type T = NextType })
+ extends Top[Node { type T = NextType }] {
+
+ new Main[AType]( (value: AType).prepend )
+}
+
+/* we've been back-and-forth on this one -- see PRs on SI-8177 for the reasoning
+I think it should compile and that the following error is due to broken =:= on existentials
+ found : Node{type T = _1.type} where val _1: Node{type T = NextType}
+ required: Node{type T = Main.this.AType}
+ (which expands to) Node{type T = Node{type T = NextType}}
+
+I claim (omitting the forSome for brevity, even though the premature skolemization is probably the issue)
+_1.type =:= Main.this.AType
+because
+(1) _1.type <:< Main.this.AType and (2) Main.this.AType <:< _1.type
+(1), because:
+_1.type <:< Node{type T = NextType} (because skolemization and _1's upper bound)
+(2), because:
+Node{type T = NextType} <:< _1.type forSome val _1: Node{type T = NextType}
+because:
+Node{type T = NextType} <:< T forSome {type T <: Node{type T = NextType} with Singleton}
+because
+Node{type T = NextType} <:< Node{type T = NextType} with Singleton
+
+hmmm.. might the with Singleton be throwing a wrench in our existential house?
+
+Behold the equivalent program which type checks without the fix for SI-8177.
+(Expand type alias, convert type member to type param;
+note the covariance to encode subtyping on type members.)
+
+class Node[+T <: Node[_]] { def prepend = new Node[this.type] }
+class Main[NextType <: Node[_]](value: Node[NextType]) {
+ new Main(value.prepend)
+}
+*/
diff --git a/tests/untried/neg/t0764b.check b/tests/untried/neg/t0764b.check
new file mode 100644
index 000000000..4040954e7
--- /dev/null
+++ b/tests/untried/neg/t0764b.check
@@ -0,0 +1,47 @@
+t0764b.scala:27: error: type mismatch;
+ found : p1.t0764.Node{type T = p1.t0764.<refinement>.type}
+ required: p1.t0764.NodeAlias[p1.t0764.NodeAlias[A]]
+ (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}}
+ private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail
+ ^
+t0764b.scala:28: error: type mismatch;
+ found : p1.t0764.Node{type T = p1.t0764.<refinement>.type}
+ required: p1.t0764.NodeAlias[p1.t0764.Node{type T = A}]
+ (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}}
+ private[this] def f3 = new Main1[Node { type T = A }](v.prepend) // fail
+ ^
+t0764b.scala:34: error: type mismatch;
+ found : p1.t0764.Node{type T = p1.t0764.<refinement>.type}
+ required: p1.t0764.Node{type T = p1.t0764.NodeAlias[A]}
+ (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}}
+ private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail
+ ^
+t0764b.scala:35: error: type mismatch;
+ found : p1.t0764.Node{type T = p1.t0764.<refinement>.type}
+ required: p1.t0764.Node{type T = p1.t0764.Node{type T = A}}
+ private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail
+ ^
+t0764b.scala:51: error: type mismatch;
+ found : p2.t0764.Node{type T = p2.t0764.<refinement>.type}
+ required: p2.t0764.NodeAlias[p2.t0764.NodeAlias[A]]
+ (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}}
+ private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail
+ ^
+t0764b.scala:52: error: type mismatch;
+ found : p2.t0764.Node{type T = p2.t0764.<refinement>.type}
+ required: p2.t0764.NodeAlias[p2.t0764.Node{type T = A}]
+ (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}}
+ private[this] def f3 = new Main1[Node { type T = A }](v.prepend) // fail
+ ^
+t0764b.scala:58: error: type mismatch;
+ found : p2.t0764.Node{type T = p2.t0764.<refinement>.type}
+ required: p2.t0764.Node{type T = p2.t0764.NodeAlias[A]}
+ (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}}
+ private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail
+ ^
+t0764b.scala:59: error: type mismatch;
+ found : p2.t0764.Node{type T = p2.t0764.<refinement>.type}
+ required: p2.t0764.Node{type T = p2.t0764.Node{type T = A}}
+ private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail
+ ^
+8 errors found
diff --git a/tests/untried/neg/t0764b.scala b/tests/untried/neg/t0764b.scala
new file mode 100644
index 000000000..14c623c67
--- /dev/null
+++ b/tests/untried/neg/t0764b.scala
@@ -0,0 +1,63 @@
+// see neg/t0764 why this should probably be a pos/ test -- alas something's wrong with existential subtyping (?)
+
+// In all cases when calling "prepend" the receiver 'v'
+// has static type NodeAlias[A] or (equivalently) Node { type T = A }.
+// Since prepend explicitly returns the singleton type of the receiver,
+// the return type of prepend in all cases is "v.type", and so the call
+// to "new Main" can be parameterized with any of the following, in order
+// of decreasing specificity with a tie for second place:
+//
+// new Main[v.type](v.prepend)
+// new Main[NodeAlias[A]](v.prepend)
+// new Main[Node { type T = A }](v.prepend)
+// new Main(v.prepend)
+
+// the `fail` comments below denote what didn't compile before SI-8177 fixed all of them
+
+package p1 {
+ object t0764 {
+ type NodeAlias[A] = Node { type T = A }
+ trait Node { outer =>
+ type T <: Node
+ def prepend: Node { type T = outer.type } = ???
+ }
+
+ class Main1[A <: Node](v: NodeAlias[A]) {
+ private[this] def f1 = new Main1(v.prepend) // fail
+ private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail
+ private[this] def f3 = new Main1[Node { type T = A }](v.prepend) // fail
+ private[this] def f4 = new Main1[v.type](v.prepend) // ok
+ }
+
+ class Main2[A <: Node](v: Node { type T = A }) {
+ private[this] def f1 = new Main2(v.prepend) // fail
+ private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail
+ private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail
+ private[this] def f4 = new Main2[v.type](v.prepend) // ok
+ }
+ }
+}
+
+package p2 {
+ object t0764 {
+ type NodeAlias[A] = Node { type T = A }
+ trait Node { outer =>
+ type T <: Node
+ def prepend: NodeAlias[outer.type] = ???
+ }
+
+ class Main1[A <: Node](v: NodeAlias[A]) {
+ private[this] def f1 = new Main1(v.prepend) // ok! <<========== WOT
+ private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail
+ private[this] def f3 = new Main1[Node { type T = A }](v.prepend) // fail
+ private[this] def f4 = new Main1[v.type](v.prepend) // ok
+ }
+
+ class Main2[A <: Node](v: Node { type T = A }) {
+ private[this] def f1 = new Main2(v.prepend) // fail
+ private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail
+ private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail
+ private[this] def f4 = new Main2[v.type](v.prepend) // ok
+ }
+ }
+}
diff --git a/tests/untried/neg/t0816.check b/tests/untried/neg/t0816.check
new file mode 100644
index 000000000..48f37c141
--- /dev/null
+++ b/tests/untried/neg/t0816.check
@@ -0,0 +1,4 @@
+t0816.scala:5: error: case class Ctest has case ancestor Btest, but case-to-case inheritance is prohibited. To overcome this limitation, use extractors to pattern match on non-leaf nodes.
+case class Ctest(override val data: String) extends Btest(data, true)
+ ^
+one error found
diff --git a/tests/untried/neg/t0816.scala b/tests/untried/neg/t0816.scala
new file mode 100644
index 000000000..0128a0ad7
--- /dev/null
+++ b/tests/untried/neg/t0816.scala
@@ -0,0 +1,12 @@
+abstract class Atest(val data: String)
+
+case class Btest(override val data: String, val b: Boolean) extends Atest(data)
+
+case class Ctest(override val data: String) extends Btest(data, true)
+
+class testCaseClass {
+ def test(x: Atest) = x match {
+ case Ctest(data) => Console.println("C")
+ case Btest(data, b) => Console.println("B")
+ }
+}
diff --git a/tests/untried/neg/t0842.check b/tests/untried/neg/t0842.check
new file mode 100644
index 000000000..3351aa117
--- /dev/null
+++ b/tests/untried/neg/t0842.check
@@ -0,0 +1,4 @@
+t0842.scala:1: error: A.this.type does not take type parameters
+trait A[T] { def m: this.type[T] = this }
+ ^
+one error found
diff --git a/tests/untried/neg/t0842.scala b/tests/untried/neg/t0842.scala
new file mode 100644
index 000000000..f32c2ba26
--- /dev/null
+++ b/tests/untried/neg/t0842.scala
@@ -0,0 +1 @@
+trait A[T] { def m: this.type[T] = this }
diff --git a/tests/untried/neg/t0899.check b/tests/untried/neg/t0899.check
new file mode 100644
index 000000000..8b71be8e0
--- /dev/null
+++ b/tests/untried/neg/t0899.check
@@ -0,0 +1,10 @@
+t0899.scala:9: error: super may be not be used on value o
+ override val o = "Ha! " + super.o
+ ^
+t0899.scala:11: error: super may be not be used on variable v
+ super.v = "aa"
+ ^
+t0899.scala:12: error: super may be not be used on variable v
+ println(super.v)
+ ^
+three errors found
diff --git a/tests/untried/neg/t0899.scala b/tests/untried/neg/t0899.scala
new file mode 100644
index 000000000..817dc19eb
--- /dev/null
+++ b/tests/untried/neg/t0899.scala
@@ -0,0 +1,13 @@
+class Top {
+ val o = "Hi there!"
+ var v = "Hi there!"
+ type T
+ val x: T
+}
+
+class Bot extends Top {
+ override val o = "Ha! " + super.o
+ val y: super.T = x
+ super.v = "aa"
+ println(super.v)
+}
diff --git a/tests/untried/neg/t0903.check b/tests/untried/neg/t0903.check
new file mode 100644
index 000000000..2dd05cd3e
--- /dev/null
+++ b/tests/untried/neg/t0903.check
@@ -0,0 +1,7 @@
+t0903.scala:3: error: value += is not a member of Int
+ x += 1
+ ^
+t0903.scala:4: error: reassignment to val
+ x = 2
+ ^
+two errors found
diff --git a/tests/untried/neg/t0903.scala b/tests/untried/neg/t0903.scala
new file mode 100644
index 000000000..cf8abce97
--- /dev/null
+++ b/tests/untried/neg/t0903.scala
@@ -0,0 +1,5 @@
+object Test {
+ val x = 1
+ x += 1
+ x = 2
+}
diff --git a/tests/untried/neg/t1009.check b/tests/untried/neg/t1009.check
new file mode 100644
index 000000000..5c9978b73
--- /dev/null
+++ b/tests/untried/neg/t1009.check
@@ -0,0 +1,4 @@
+t1009.scala:2: error: empty quoted identifier
+ def `` = "fish"
+ ^
+one error found
diff --git a/tests/untried/neg/t1009.scala b/tests/untried/neg/t1009.scala
new file mode 100644
index 000000000..a260397d2
--- /dev/null
+++ b/tests/untried/neg/t1009.scala
@@ -0,0 +1,3 @@
+object Foo extends App{
+ def `` = "fish"
+}
diff --git a/tests/untried/neg/t1010.check b/tests/untried/neg/t1010.check
new file mode 100644
index 000000000..2cc8f9d98
--- /dev/null
+++ b/tests/untried/neg/t1010.check
@@ -0,0 +1,6 @@
+t1010.scala:14: error: type mismatch;
+ found : MailBox#Message
+ required: _3.in.Message where val _3: Actor
+ unstable.send(msg) // in.Message becomes unstable.Message, but that's ok since Message is a concrete type member
+ ^
+one error found
diff --git a/tests/untried/neg/t1010.scala b/tests/untried/neg/t1010.scala
new file mode 100644
index 000000000..fd142978e
--- /dev/null
+++ b/tests/untried/neg/t1010.scala
@@ -0,0 +1,15 @@
+class MailBox {
+ class Message
+ //type Message = AnyRef
+}
+
+abstract class Actor {
+ private val in = new MailBox
+
+ def send(msg: in.Message) = sys.error("foo")
+
+ def unstable: Actor = sys.error("foo")
+
+ def dubiousSend(msg: MailBox#Message): Nothing =
+ unstable.send(msg) // in.Message becomes unstable.Message, but that's ok since Message is a concrete type member
+}
diff --git a/tests/untried/neg/t1033.check b/tests/untried/neg/t1033.check
new file mode 100644
index 000000000..16e799264
--- /dev/null
+++ b/tests/untried/neg/t1033.check
@@ -0,0 +1,4 @@
+t1033.scala:5: error: return outside method definition
+ return 10
+ ^
+one error found
diff --git a/tests/untried/neg/t1033.scala b/tests/untried/neg/t1033.scala
new file mode 100644
index 000000000..28af01d5c
--- /dev/null
+++ b/tests/untried/neg/t1033.scala
@@ -0,0 +1,13 @@
+object A {
+ def f :Int = {
+ class B {
+ println("B")
+ return 10
+ }
+ new B
+ 20
+ }
+ def main(args: Array[String]): Unit = {
+ f
+ }
+}
diff --git a/tests/untried/neg/t1038.check b/tests/untried/neg/t1038.check
new file mode 100644
index 000000000..b191b89ad
--- /dev/null
+++ b/tests/untried/neg/t1038.check
@@ -0,0 +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/tests/untried/neg/t1038.scala b/tests/untried/neg/t1038.scala
new file mode 100644
index 000000000..367022965
--- /dev/null
+++ b/tests/untried/neg/t1038.scala
@@ -0,0 +1,8 @@
+class X(x : Int)
+
+object Y {
+ val a = new X
+ import a._
+ implicit val b : Int = 1
+ implicit val c = 2
+}
diff --git a/tests/untried/neg/t1041.check b/tests/untried/neg/t1041.check
new file mode 100644
index 000000000..d82f3a858
--- /dev/null
+++ b/tests/untried/neg/t1041.check
@@ -0,0 +1,6 @@
+t1041.scala:3: error: type mismatch;
+ found : Int(1)
+ required: List[Int]
+ case 1 => 4
+ ^
+one error found
diff --git a/tests/untried/neg/t1041.scala b/tests/untried/neg/t1041.scala
new file mode 100644
index 000000000..a5895c68a
--- /dev/null
+++ b/tests/untried/neg/t1041.scala
@@ -0,0 +1,6 @@
+object test {
+ (1 :: 2 :: Nil) match {
+ case 1 => 4
+ case _ => 0
+ }
+}
diff --git a/tests/untried/neg/t1049.check b/tests/untried/neg/t1049.check
new file mode 100644
index 000000000..4a63cb175
--- /dev/null
+++ b/tests/untried/neg/t1049.check
@@ -0,0 +1,4 @@
+t1049.scala:6: error: not found: value a
+ case a : a.MapTo =>
+ ^
+one error found
diff --git a/tests/untried/neg/t1049.scala b/tests/untried/neg/t1049.scala
new file mode 100644
index 000000000..2f59ed3c0
--- /dev/null
+++ b/tests/untried/neg/t1049.scala
@@ -0,0 +1,9 @@
+class J {
+ type tttt[a, b] <: _root_.scala.collection.mutable.Map[a, b]
+
+ def r(aa : tttt[String, String]) = {
+ 0 match {
+ case a : a.MapTo =>
+ }
+ }
+}
diff --git a/tests/untried/neg/t1106.check b/tests/untried/neg/t1106.check
new file mode 100644
index 000000000..f81d0c602
--- /dev/null
+++ b/tests/untried/neg/t1106.check
@@ -0,0 +1,7 @@
+t1106.scala:2: error: expected class or object definition
+val p = new Par[String]
+^
+t1106.scala:5: error: expected class or object definition
+new Foo[p.type](p) // crashes compiler
+^
+two errors found
diff --git a/tests/untried/neg/t1106.scala b/tests/untried/neg/t1106.scala
new file mode 100644
index 000000000..a218eee7a
--- /dev/null
+++ b/tests/untried/neg/t1106.scala
@@ -0,0 +1,5 @@
+class Par[S]
+val p = new Par[String]
+class Foo[T[x]<:Par[x]](t: T[String])
+
+new Foo[p.type](p) // crashes compiler
diff --git a/tests/untried/neg/t1112.check b/tests/untried/neg/t1112.check
new file mode 100644
index 000000000..5e3821b15
--- /dev/null
+++ b/tests/untried/neg/t1112.check
@@ -0,0 +1,4 @@
+t1112.scala:12: error: too many arguments for method call: (p: Int)(f: => Test.this.Type1)Unit
+ call(0,() => System.out.println("here we are"))
+ ^
+one error found
diff --git a/tests/untried/neg/t1112.scala b/tests/untried/neg/t1112.scala
new file mode 100644
index 000000000..1a88629fa
--- /dev/null
+++ b/tests/untried/neg/t1112.scala
@@ -0,0 +1,14 @@
+// checks that error doesn't crash the compiler
+// (due to isFunctionType normalizing Type1 to a function type,
+// but then the code that used that test not using the normalized type for further operations)
+class Test {
+ type Type1 = () => Unit
+
+ def call(p: Int)(f: => Type1) = {
+ f()
+ }
+
+ def run = {
+ call(0,() => System.out.println("here we are"))
+ }
+}
diff --git a/tests/untried/neg/t112706A.check b/tests/untried/neg/t112706A.check
new file mode 100644
index 000000000..ad403ab13
--- /dev/null
+++ b/tests/untried/neg/t112706A.check
@@ -0,0 +1,6 @@
+t112706A.scala:5: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2)
+ required: String
+ case Tuple2(node,_) =>
+ ^
+one error found
diff --git a/tests/untried/neg/t112706A.scala b/tests/untried/neg/t112706A.scala
new file mode 100644
index 000000000..11304720b
--- /dev/null
+++ b/tests/untried/neg/t112706A.scala
@@ -0,0 +1,8 @@
+package test;
+trait Test {
+ def foo(p : List[Tuple2[String,String]]) = {
+ for (t <- p) t._1 match {
+ case Tuple2(node,_) =>
+ }
+ }
+}
diff --git a/tests/untried/neg/t1163.check b/tests/untried/neg/t1163.check
new file mode 100644
index 000000000..69e6b7ac4
--- /dev/null
+++ b/tests/untried/neg/t1163.check
@@ -0,0 +1,7 @@
+t1163.scala:2: error: overriding method foo in trait Sub of type => Sub;
+ method foo in trait Super of type => Super has incompatible type;
+ (Note that method foo in trait Sub of type => Sub is abstract,
+ and is therefore overridden by concrete method foo in trait Super of type => Super)
+trait Sub extends Super { override def foo: Sub }
+ ^
+one error found
diff --git a/tests/untried/neg/t1163.scala b/tests/untried/neg/t1163.scala
new file mode 100644
index 000000000..caf5747f9
--- /dev/null
+++ b/tests/untried/neg/t1163.scala
@@ -0,0 +1,2 @@
+trait Super { def foo: Super = new Super {} }
+trait Sub extends Super { override def foo: Sub }
diff --git a/tests/untried/neg/t1168.check b/tests/untried/neg/t1168.check
new file mode 100644
index 000000000..d9b754774
--- /dev/null
+++ b/tests/untried/neg/t1168.check
@@ -0,0 +1,4 @@
+t1168.scala:6: error: Names of vals or vars may not end in `_='
+ val r_= = 4
+ ^
+one error found
diff --git a/tests/untried/neg/t1168.scala b/tests/untried/neg/t1168.scala
new file mode 100644
index 000000000..85f2dc90d
--- /dev/null
+++ b/tests/untried/neg/t1168.scala
@@ -0,0 +1,7 @@
+class tor {
+ def r_= = 4
+}
+
+class child extends tor {
+ val r_= = 4
+}
diff --git a/tests/untried/neg/t1181.check b/tests/untried/neg/t1181.check
new file mode 100644
index 000000000..13b73d538
--- /dev/null
+++ b/tests/untried/neg/t1181.check
@@ -0,0 +1,10 @@
+t1181.scala:8: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ case (Nil, Nil) => map
+ ^
+t1181.scala:9: error: type mismatch;
+ found : scala.collection.immutable.Map[Symbol,Symbol]
+ required: Symbol
+ _ => buildMap(map.updated(keyList.head, valueList.head), keyList.tail, valueList.tail)
+ ^
+one warning found
+one error found
diff --git a/tests/untried/neg/t1181.scala b/tests/untried/neg/t1181.scala
new file mode 100644
index 000000000..5e5fceacc
--- /dev/null
+++ b/tests/untried/neg/t1181.scala
@@ -0,0 +1,12 @@
+package test
+
+import scala.collection.immutable.Map
+
+class CompilerTest(val valueList: List[Symbol]) {
+ def buildMap(map: Map[Symbol, Symbol], keyList: List[Symbol], valueList: List[Symbol]): Map[Symbol, Symbol] = {
+ (keyList, valueList) match {
+ case (Nil, Nil) => map
+ _ => buildMap(map.updated(keyList.head, valueList.head), keyList.tail, valueList.tail)
+ }
+ }
+}
diff --git a/tests/untried/neg/t1183.check b/tests/untried/neg/t1183.check
new file mode 100644
index 000000000..c402829c7
--- /dev/null
+++ b/tests/untried/neg/t1183.check
@@ -0,0 +1,17 @@
+t1183.scala:6: error: name clash: class Foo defines object Baz
+and its companion object Foo also defines class Baz
+ object Baz
+ ^
+t1183.scala:7: error: name clash: class Foo defines class Bam
+and its companion object Foo also defines object Bam
+ class Bam
+ ^
+t1183.scala:8: error: name clash: class Foo defines object Bar
+and its companion object Foo also defines class Bar
+ object Bar
+ ^
+t1183.scala:9: error: name clash: class Foo defines class Bar
+and its companion object Foo also defines class Bar
+ case class Bar(i:Int)
+ ^
+four errors found
diff --git a/tests/untried/neg/t1183.scala b/tests/untried/neg/t1183.scala
new file mode 100644
index 000000000..23868ab40
--- /dev/null
+++ b/tests/untried/neg/t1183.scala
@@ -0,0 +1,34 @@
+// bug 1183 from in the old tracker, not in Trac
+
+object Test {
+
+ class Foo(j:Int) {
+ object Baz
+ class Bam
+ object Bar
+ case class Bar(i:Int)
+ }
+
+
+ class Test717 {
+ val foo1 = new Foo(1)
+
+ def runTest() = {
+ val res = (foo1.Bar(2):Any) match {
+ case foo1.Bar(2) => true // (1)
+ }
+ require(res)
+ }
+ }
+
+ // (2)
+ object Foo {
+ class Bar(val x : String)
+ class Baz
+ object Bam
+ object Bar
+
+ def unapply(s : String) : Option[Bar] = Some(new Bar(s))
+ }
+
+}
diff --git a/tests/untried/neg/t1215.check b/tests/untried/neg/t1215.check
new file mode 100644
index 000000000..1f9dd6bf3
--- /dev/null
+++ b/tests/untried/neg/t1215.check
@@ -0,0 +1,4 @@
+t1215.scala:2: error: value += is not a member of Int
+ val x = 1 += 1
+ ^
+one error found
diff --git a/tests/untried/neg/t1215.scala b/tests/untried/neg/t1215.scala
new file mode 100644
index 000000000..0e994d06e
--- /dev/null
+++ b/tests/untried/neg/t1215.scala
@@ -0,0 +1,3 @@
+object Test {
+ val x = 1 += 1
+}
diff --git a/tests/untried/neg/t1224.check b/tests/untried/neg/t1224.check
new file mode 100644
index 000000000..ab8a6f113
--- /dev/null
+++ b/tests/untried/neg/t1224.check
@@ -0,0 +1,4 @@
+t1224.scala:4: error: lower bound C[A.this.T] does not conform to upper bound C[C[A.this.T]]
+ type T >: C[T] <: C[C[T]]
+ ^
+one error found
diff --git a/tests/untried/neg/t1224.flags b/tests/untried/neg/t1224.flags
new file mode 100644
index 000000000..ca20f5517
--- /dev/null
+++ b/tests/untried/neg/t1224.flags
@@ -0,0 +1 @@
+-Ybreak-cycles
diff --git a/tests/untried/neg/t1224.scala b/tests/untried/neg/t1224.scala
new file mode 100644
index 000000000..35e01fa37
--- /dev/null
+++ b/tests/untried/neg/t1224.scala
@@ -0,0 +1,5 @@
+trait C[T] {}
+
+abstract class A {
+ type T >: C[T] <: C[C[T]]
+}
diff --git a/tests/untried/neg/t1241.check b/tests/untried/neg/t1241.check
new file mode 100644
index 000000000..e1ccf4172
--- /dev/null
+++ b/tests/untried/neg/t1241.check
@@ -0,0 +1,4 @@
+t1241.scala:5: error: class type required but AnyRef{def hello(): Unit} found
+ val x4 = new T { def hello() { println("4") } } // error!
+ ^
+one error found
diff --git a/tests/untried/neg/t1241.scala b/tests/untried/neg/t1241.scala
new file mode 100644
index 000000000..1956d1678
--- /dev/null
+++ b/tests/untried/neg/t1241.scala
@@ -0,0 +1,8 @@
+object test extends App {
+ // more..
+ type T = { def hello() }
+ //val x4 = new AnyRef { def hello() { println("4") } } // ok!
+ val x4 = new T { def hello(): Unit = { println("4") } } // error!
+ x4.hello()
+ // more..
+}
diff --git a/tests/untried/neg/t1275.check b/tests/untried/neg/t1275.check
new file mode 100644
index 000000000..a930e25ab
--- /dev/null
+++ b/tests/untried/neg/t1275.check
@@ -0,0 +1,6 @@
+t1275.scala:11: error: type mismatch;
+ found : xs.MyType[a]
+ required: s
+ = xs f
+ ^
+one error found
diff --git a/tests/untried/neg/t1275.scala b/tests/untried/neg/t1275.scala
new file mode 100644
index 000000000..d7513bf09
--- /dev/null
+++ b/tests/untried/neg/t1275.scala
@@ -0,0 +1,15 @@
+object Test {
+ trait Seq[+t] {
+ type MyType[+t] <: Seq[t]
+
+ def f: MyType[t]
+ }
+
+ // illegal abstract type member refinement: changes the arity of MyType
+ // the error is pretty strange, since the compiler forms the illegal type xs.MyType[a] anyway
+ def span[a, s <: Seq[a] { type MyType/*look ma, no type parameters!*/ <: s } ](xs: s): s
+ = xs f
+// ^
+// found : xs.MyType[a]
+// required: s
+}
diff --git a/tests/untried/neg/t1286.check b/tests/untried/neg/t1286.check
new file mode 100644
index 000000000..912709613
--- /dev/null
+++ b/tests/untried/neg/t1286.check
@@ -0,0 +1,5 @@
+b.scala:1: error: Companions 'trait Foo' and 'object Foo' must be defined in same file:
+ Found in t1286/a.scala and t1286/b.scala
+object Foo extends Foo {
+ ^
+one error found
diff --git a/tests/untried/neg/t1286/a.scala b/tests/untried/neg/t1286/a.scala
new file mode 100644
index 000000000..85ffe3bb5
--- /dev/null
+++ b/tests/untried/neg/t1286/a.scala
@@ -0,0 +1,3 @@
+trait Foo {
+ def jump = Foo.x
+}
diff --git a/tests/untried/neg/t1286/b.scala b/tests/untried/neg/t1286/b.scala
new file mode 100644
index 000000000..48f3b440c
--- /dev/null
+++ b/tests/untried/neg/t1286/b.scala
@@ -0,0 +1,3 @@
+object Foo extends Foo {
+ val x = "x"
+}
diff --git a/tests/untried/neg/t1355.check b/tests/untried/neg/t1355.check
new file mode 100644
index 000000000..f9786e927
--- /dev/null
+++ b/tests/untried/neg/t1355.check
@@ -0,0 +1,4 @@
+t1355.scala:1: error: type arguments [A[T]] do not conform to trait A's type parameter bounds [T <: A[A[T]]]
+trait A[T <: A[A[T]]]
+ ^
+one error found
diff --git a/tests/untried/neg/t1355.scala b/tests/untried/neg/t1355.scala
new file mode 100644
index 000000000..3abb3c70c
--- /dev/null
+++ b/tests/untried/neg/t1355.scala
@@ -0,0 +1 @@
+trait A[T <: A[A[T]]]
diff --git a/tests/untried/neg/t1364.check b/tests/untried/neg/t1364.check
new file mode 100644
index 000000000..cb8803abd
--- /dev/null
+++ b/tests/untried/neg/t1364.check
@@ -0,0 +1,5 @@
+t1364.scala:9: error: overriding type T in trait A with bounds <: AnyRef{type S[-U]};
+ type T has incompatible type
+ type T = { type S[U] = U }
+ ^
+one error found
diff --git a/tests/untried/neg/t1364.scala b/tests/untried/neg/t1364.scala
new file mode 100644
index 000000000..dbc7dcf99
--- /dev/null
+++ b/tests/untried/neg/t1364.scala
@@ -0,0 +1,15 @@
+trait A {
+ type T <: { type S[-U] }
+ val x : T
+ def y : x.S[AnyRef]
+ def z : x.S[String] = y
+}
+
+object B extends A {
+ type T = { type S[U] = U }
+ val x : T = null
+ def y : x.S[AnyRef] = new AnyRef
+ def t : String = z
+}
+
+// println(B.t)
diff --git a/tests/untried/neg/t1371.check b/tests/untried/neg/t1371.check
new file mode 100644
index 000000000..f2e9ffebe
--- /dev/null
+++ b/tests/untried/neg/t1371.check
@@ -0,0 +1,4 @@
+t1371.scala:1: error: unbound wildcard type
+trait A[T <: (_)]
+ ^
+one error found
diff --git a/tests/untried/neg/t1371.scala b/tests/untried/neg/t1371.scala
new file mode 100644
index 000000000..4ad84a9d5
--- /dev/null
+++ b/tests/untried/neg/t1371.scala
@@ -0,0 +1,2 @@
+trait A[T <: (_)]
+
diff --git a/tests/untried/neg/t1422.check b/tests/untried/neg/t1422.check
new file mode 100644
index 000000000..362d7ef36
--- /dev/null
+++ b/tests/untried/neg/t1422.check
@@ -0,0 +1,7 @@
+t1422.scala:1: error: private[this] not allowed for case class parameters
+case class A(private[this] val foo:String) { }
+ ^
+t1422.scala:1: error: value foo in class A cannot be accessed in A
+case class A(private[this] val foo:String) { }
+ ^
+two errors found
diff --git a/tests/untried/neg/t1422.scala b/tests/untried/neg/t1422.scala
new file mode 100644
index 000000000..af308244c
--- /dev/null
+++ b/tests/untried/neg/t1422.scala
@@ -0,0 +1 @@
+case class A(private[this] val foo:String) { }
diff --git a/tests/untried/neg/t1431.check b/tests/untried/neg/t1431.check
new file mode 100644
index 000000000..a17ba7324
--- /dev/null
+++ b/tests/untried/neg/t1431.check
@@ -0,0 +1,4 @@
+t1431.scala:8: error: class type required but X#Factory found
+ def fun[X<:MyTrait with Singleton]() = new X#Factory().value
+ ^
+one error found
diff --git a/tests/untried/neg/t1431.scala b/tests/untried/neg/t1431.scala
new file mode 100644
index 000000000..aff1dbc01
--- /dev/null
+++ b/tests/untried/neg/t1431.scala
@@ -0,0 +1,10 @@
+object Bug_New {
+ trait MyTrait {
+ type Alpha
+ def the_value : Alpha
+ class Factory() {def value : Alpha = the_value}
+ }
+
+ def fun[X<:MyTrait with Singleton]() = new X#Factory().value
+}
+
diff --git a/tests/untried/neg/t1432.check b/tests/untried/neg/t1432.check
new file mode 100644
index 000000000..e41f3453f
--- /dev/null
+++ b/tests/untried/neg/t1432.check
@@ -0,0 +1,8 @@
+t1432.scala:12: error: type mismatch;
+ found : (Int, Bug_NoUnique.Alias2[Bug_NoUnique.Wrap[Unit]] => Double)
+ (which expands to) (Int, Bug_NoUnique.Wrap[Bug_NoUnique.Wrap[Unit]] => Double)
+ required: Bug_NoUnique.TypeCon[Unit]
+ (which expands to) (Int, Unit => Double)
+ def test(x : TypeCon[Wrap[Unit]]) : TypeCon[Unit] = wrap(x)
+ ^
+one error found
diff --git a/tests/untried/neg/t1432.scala b/tests/untried/neg/t1432.scala
new file mode 100644
index 000000000..bdf233128
--- /dev/null
+++ b/tests/untried/neg/t1432.scala
@@ -0,0 +1,14 @@
+object Bug_NoUnique {
+
+ type TypeCon[Env] = (Int, Env=>Double)
+
+ case class Wrap[E](parent:E) {}
+
+ type Alias2[E] = Wrap[E]
+
+ def wrap[E,A,Y](v : (A,E=>Y)) : (A,Alias2[E]=>Y) =
+ throw new Error("Body here")
+
+ def test(x : TypeCon[Wrap[Unit]]) : TypeCon[Unit] = wrap(x)
+}
+
diff --git a/tests/untried/neg/t1477.check b/tests/untried/neg/t1477.check
new file mode 100644
index 000000000..72bffa327
--- /dev/null
+++ b/tests/untried/neg/t1477.check
@@ -0,0 +1,5 @@
+t1477.scala:13: error: overriding type V in trait C with bounds <: Middle.this.D;
+ type V is a volatile type; cannot override a type with non-volatile upper bound
+ type V <: (D with U)
+ ^
+one error found
diff --git a/tests/untried/neg/t1477.scala b/tests/untried/neg/t1477.scala
new file mode 100644
index 000000000..a9a6d678c
--- /dev/null
+++ b/tests/untried/neg/t1477.scala
@@ -0,0 +1,25 @@
+object Test extends App {
+ trait A
+ trait B extends A
+
+ trait C {
+ type U
+ trait D { type T >: B <: A }
+ type V <: D
+ val y: V#T = new B { }
+ }
+
+ trait Middle extends C {
+ type V <: (D with U)
+ }
+
+ class D extends Middle {
+ trait E
+ trait F { type T = E }
+ type U = F
+ def frob(arg : E) : E = arg
+ frob(y)
+ }
+
+ new D
+}
diff --git a/tests/untried/neg/t1503.check b/tests/untried/neg/t1503.check
new file mode 100644
index 000000000..7adeea20f
--- /dev/null
+++ b/tests/untried/neg/t1503.check
@@ -0,0 +1,8 @@
+t1503.scala:7: warning: The value matched by Whatever is bound to n, which may be used under the
+unsound assumption that it has type Whatever.type, whereas we can only safely
+count on it having type Any, as the pattern is matched using `==` (see SI-1503).
+ def matchWhateverCCE(x: Any) = x match { case n @ Whatever => n }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t1503.flags b/tests/untried/neg/t1503.flags
new file mode 100644
index 000000000..e93641e93
--- /dev/null
+++ b/tests/untried/neg/t1503.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t1503.scala b/tests/untried/neg/t1503.scala
new file mode 100644
index 000000000..e17248575
--- /dev/null
+++ b/tests/untried/neg/t1503.scala
@@ -0,0 +1,8 @@
+object Whatever {
+ override def equals(x: Any) = true
+}
+
+class Test {
+ // when left to its own devices, and not under -Xfuture, the return type is Whatever.type
+ def matchWhateverCCE(x: Any) = x match { case n @ Whatever => n }
+}
diff --git a/tests/untried/neg/t1523.check b/tests/untried/neg/t1523.check
new file mode 100644
index 000000000..d2489f260
--- /dev/null
+++ b/tests/untried/neg/t1523.check
@@ -0,0 +1,4 @@
+t1523.scala:4: error: too many arguments for method bug: (x: Any)Any
+ def go() = bug("a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a")
+ ^
+one error found
diff --git a/tests/untried/neg/t1523.scala b/tests/untried/neg/t1523.scala
new file mode 100644
index 000000000..219fb0c06
--- /dev/null
+++ b/tests/untried/neg/t1523.scala
@@ -0,0 +1,5 @@
+object test {
+ def bug(x: Any) = x
+
+ def go() = bug("a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a")
+}
diff --git a/tests/untried/neg/t1548.check b/tests/untried/neg/t1548.check
new file mode 100644
index 000000000..7f5a3f44e
--- /dev/null
+++ b/tests/untried/neg/t1548.check
@@ -0,0 +1,4 @@
+S.scala:2: error: method defaultMethod overrides nothing
+ override def defaultMethod = "Boo!"
+ ^
+one error found
diff --git a/tests/untried/neg/t1548/J.java b/tests/untried/neg/t1548/J.java
new file mode 100644
index 000000000..01dd56d34
--- /dev/null
+++ b/tests/untried/neg/t1548/J.java
@@ -0,0 +1,12 @@
+package javapkg;
+
+public class J {
+
+ String defaultMethod() {
+ return "foo";
+ }
+
+ public String toString() {
+ return "JavaClass: "+defaultMethod();
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t1548/S.scala b/tests/untried/neg/t1548/S.scala
new file mode 100644
index 000000000..086b78029
--- /dev/null
+++ b/tests/untried/neg/t1548/S.scala
@@ -0,0 +1,3 @@
+class ScalaClass extends javapkg.J {
+ override def defaultMethod = "Boo!"
+}
diff --git a/tests/untried/neg/t1623.check b/tests/untried/neg/t1623.check
new file mode 100644
index 000000000..251039ad3
--- /dev/null
+++ b/tests/untried/neg/t1623.check
@@ -0,0 +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/tests/untried/neg/t1623.scala b/tests/untried/neg/t1623.scala
new file mode 100644
index 000000000..f5189aa4c
--- /dev/null
+++ b/tests/untried/neg/t1623.scala
@@ -0,0 +1,12 @@
+package test
+
+trait A
+trait B
+
+class BImpl extends B {
+ this: A =>
+}
+
+object Test2 extends App {
+ val b = new BImpl
+}
diff --git a/tests/untried/neg/t1672b.check b/tests/untried/neg/t1672b.check
new file mode 100644
index 000000000..60ccf7717
--- /dev/null
+++ b/tests/untried/neg/t1672b.check
@@ -0,0 +1,16 @@
+t1672b.scala:3: error: could not optimize @tailrec annotated method bar: it contains a recursive call not in tail position
+ def bar : Nothing = {
+ ^
+t1672b.scala:14: error: could not optimize @tailrec annotated method baz: it contains a recursive call not in tail position
+ def baz : Nothing = {
+ ^
+t1672b.scala:29: error: could not optimize @tailrec annotated method boz: it contains a recursive call not in tail position
+ case _: Throwable => boz; ???
+ ^
+t1672b.scala:34: error: could not optimize @tailrec annotated method bez: it contains a recursive call not in tail position
+ def bez : Nothing = {
+ ^
+t1672b.scala:46: error: could not optimize @tailrec annotated method bar: it contains a recursive call not in tail position
+ else 1 + (try {
+ ^
+5 errors found
diff --git a/tests/untried/neg/t1672b.scala b/tests/untried/neg/t1672b.scala
new file mode 100644
index 000000000..0ccdd0363
--- /dev/null
+++ b/tests/untried/neg/t1672b.scala
@@ -0,0 +1,52 @@
+object Test {
+ @annotation.tailrec
+ def bar : Nothing = {
+ try {
+ throw new RuntimeException
+ } catch {
+ case _: Throwable => bar
+ } finally {
+ bar
+ }
+ }
+
+ @annotation.tailrec
+ def baz : Nothing = {
+ try {
+ throw new RuntimeException
+ } catch {
+ case _: Throwable => baz
+ } finally {
+ ???
+ }
+ }
+
+ @annotation.tailrec
+ def boz : Nothing = {
+ try {
+ throw new RuntimeException
+ } catch {
+ case _: Throwable => boz; ???
+ }
+ }
+
+ @annotation.tailrec
+ def bez : Nothing = {
+ try {
+ bez
+ } finally {
+ ???
+ }
+ }
+
+ // the `liftedTree` local method will prevent a tail call here.
+ @annotation.tailrec
+ def bar(i : Int) : Int = {
+ if (i == 0) 0
+ else 1 + (try {
+ throw new RuntimeException
+ } catch {
+ case _: Throwable => bar(i - 1)
+ })
+ }
+}
diff --git a/tests/untried/neg/t1701.check b/tests/untried/neg/t1701.check
new file mode 100644
index 000000000..d603e62e5
--- /dev/null
+++ b/tests/untried/neg/t1701.check
@@ -0,0 +1,4 @@
+t1701.scala:1: error: Cloneable does not take type parameters
+class A extends java.lang.Cloneable[String, Option, Int]
+ ^
+one error found
diff --git a/tests/untried/neg/t1701.scala b/tests/untried/neg/t1701.scala
new file mode 100644
index 000000000..7cd6ff995
--- /dev/null
+++ b/tests/untried/neg/t1701.scala
@@ -0,0 +1 @@
+class A extends java.lang.Cloneable[String, Option, Int]
diff --git a/tests/untried/neg/t1705.check b/tests/untried/neg/t1705.check
new file mode 100644
index 000000000..7f75bd0fb
--- /dev/null
+++ b/tests/untried/neg/t1705.check
@@ -0,0 +1,7 @@
+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 = {
+ ^
+two errors found
diff --git a/tests/untried/neg/t1705.scala b/tests/untried/neg/t1705.scala
new file mode 100644
index 000000000..fabdca0ec
--- /dev/null
+++ b/tests/untried/neg/t1705.scala
@@ -0,0 +1,35 @@
+package trials
+object crashing {
+ trait C {
+ abstract class T[A] {
+ def f[Z] (a:T[Z]) : T[A]
+ }
+ }
+ abstract class Thing {
+ val c = new C{
+ class T[A](a:A) {
+ def f[Z](t:T[Z]) = new T(a)
+ }
+ }
+ val x1 = {
+ class C[T] { val x: T }
+ new C[String]
+ }
+ }
+}
+/*
+
+Infinite loop in Typer.addLocals. Printing all calls to it:
+
+addLocals: Unit
+addLocals: this.T[A]
+addLocals: java.lang.Object with crashing.C{ ... }
+addLocals: >: Nothing <: java.lang.Object with crashing.C{type T[A] <: java.lang.Object with ScalaObject{def f[Z](this.T[Z]): this.T[A]}}
+addLocals: >: Nothing <: java.lang.Object with ScalaObject{def f[Z](this.T[Z]): this.T[Z]}
+addLocals: >: Nothing <: java.lang.Object with ScalaObject{def f[Z](this.T[Z]): this.T[Z]}
+addLocals: >: Nothing <: java.lang.Object with ScalaObject{def f[Z](this.T[Z]): this.T[Z]}
+[...]
+*
+ C { type T[A] <: { def f[Z]: T[Z] => T[A] } }
+
+*/
diff --git a/tests/untried/neg/t1838.check b/tests/untried/neg/t1838.check
new file mode 100644
index 000000000..a476158c7
--- /dev/null
+++ b/tests/untried/neg/t1838.check
@@ -0,0 +1,7 @@
+t1838.scala:6: error: `sealed' modifier can be used only for classes
+ sealed val v = 0
+ ^
+t1838.scala:5: error: `sealed' modifier can be used only for classes
+ sealed def f = 0
+ ^
+two errors found
diff --git a/tests/untried/neg/t1838.scala b/tests/untried/neg/t1838.scala
new file mode 100644
index 000000000..36eeb4050
--- /dev/null
+++ b/tests/untried/neg/t1838.scala
@@ -0,0 +1,7 @@
+package test
+
+class A {
+ sealed class B
+ sealed def f = 0
+ sealed val v = 0
+}
diff --git a/tests/untried/neg/t1845.check b/tests/untried/neg/t1845.check
new file mode 100644
index 000000000..a6c82f565
--- /dev/null
+++ b/tests/untried/neg/t1845.check
@@ -0,0 +1,6 @@
+t1845.scala:6: error: encountered unrecoverable cycle resolving import.
+Note: this is often due in part to a class depending on a definition nested within its companion.
+If applicable, you may wish to try moving some members into another object.
+ import lexical._
+ ^
+one error found
diff --git a/tests/untried/neg/t1845.scala b/tests/untried/neg/t1845.scala
new file mode 100644
index 000000000..4d3966484
--- /dev/null
+++ b/tests/untried/neg/t1845.scala
@@ -0,0 +1,10 @@
+class Tokens { abstract class Token }
+trait TokenParsers { val lexical: Tokens }
+
+
+class MyTokenParsers extends TokenParsers {
+ import lexical._
+
+
+ val lexical = new Tokens
+}
diff --git a/tests/untried/neg/t1872.check b/tests/untried/neg/t1872.check
new file mode 100644
index 000000000..c5dc2a808
--- /dev/null
+++ b/tests/untried/neg/t1872.check
@@ -0,0 +1,8 @@
+t1872.scala:3: warning: fruitless type test: a value of type Int cannot also be a scala.util.Random
+ def f(x: Int) = x.isInstanceOf[util.Random]
+ ^
+t1872.scala:3: error: isInstanceOf cannot test if value types are references.
+ def f(x: Int) = x.isInstanceOf[util.Random]
+ ^
+one warning found
+one error found
diff --git a/tests/untried/neg/t1872.scala b/tests/untried/neg/t1872.scala
new file mode 100644
index 000000000..f3c265304
--- /dev/null
+++ b/tests/untried/neg/t1872.scala
@@ -0,0 +1,4 @@
+class A {
+ // a true result here would necessitate profound soul searching
+ def f(x: Int) = x.isInstanceOf[util.Random]
+}
diff --git a/tests/untried/neg/t1878.check b/tests/untried/neg/t1878.check
new file mode 100644
index 000000000..581437551
--- /dev/null
+++ b/tests/untried/neg/t1878.check
@@ -0,0 +1,7 @@
+t1878.scala:3: error: bad simple pattern: bad use of _* (a sequence pattern must be the last pattern)
+ val err1 = "" match { case Seq(f @ _*, ',') => f }
+ ^
+t1878.scala:9: error: bad simple pattern: bad use of _* (a sequence pattern must be the last pattern)
+ val List(List(_*, arg2), _) = List(List(1,2,3), List(4,5,6))
+ ^
+two errors found
diff --git a/tests/untried/neg/t1878.scala b/tests/untried/neg/t1878.scala
new file mode 100644
index 000000000..b29186afc
--- /dev/null
+++ b/tests/untried/neg/t1878.scala
@@ -0,0 +1,17 @@
+object Test extends App {
+ // illegal
+ val err1 = "" match { case Seq(f @ _*, ',') => f }
+
+ // no error
+ val List(List(arg1, _*), _) = List(List(1,2,3), List(4,5,6))
+
+ // illegal
+ val List(List(_*, arg2), _) = List(List(1,2,3), List(4,5,6))
+
+ /* see t1878-typer.scala
+ // illegal - bug #1764
+ null match {
+ case <p> { _* } </p> =>
+ }
+ */
+}
diff --git a/tests/untried/neg/t1909-object.check b/tests/untried/neg/t1909-object.check
new file mode 100644
index 000000000..401c1f7eb
--- /dev/null
+++ b/tests/untried/neg/t1909-object.check
@@ -0,0 +1,4 @@
+t1909-object.scala:4: error: !!! SI-1909 Unable to STATICally lift object InnerTrouble$1, which is defined in the self- or super-constructor call of class Kaboom. A VerifyError is likely.
+ object InnerTrouble
+ ^
+one error found
diff --git a/tests/untried/neg/t1909-object.flags b/tests/untried/neg/t1909-object.flags
new file mode 100644
index 000000000..eb8b40661
--- /dev/null
+++ b/tests/untried/neg/t1909-object.flags
@@ -0,0 +1 @@
+-Xdev -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t1909-object.scala b/tests/untried/neg/t1909-object.scala
new file mode 100644
index 000000000..5bb58419b
--- /dev/null
+++ b/tests/untried/neg/t1909-object.scala
@@ -0,0 +1,12 @@
+class Kaboom(a: Any) {
+ def this() = {
+ this({
+ object InnerTrouble
+ InnerTrouble
+ })
+ }
+}
+
+object Test extends App {
+ new Kaboom()
+}
diff --git a/tests/untried/neg/t1909b.check b/tests/untried/neg/t1909b.check
new file mode 100644
index 000000000..9a683643a
--- /dev/null
+++ b/tests/untried/neg/t1909b.check
@@ -0,0 +1,4 @@
+t1909b.scala:4: error: this can be used only in a class, object, or template
+ def bar() = this.z + 5
+ ^
+one error found
diff --git a/tests/untried/neg/t1909b.scala b/tests/untried/neg/t1909b.scala
new file mode 100644
index 000000000..637fa9619
--- /dev/null
+++ b/tests/untried/neg/t1909b.scala
@@ -0,0 +1,7 @@
+class Ticket1909 (x: Int) {
+ var z = 12
+ def this() = this({
+ def bar() = this.z + 5
+ bar
+ })
+}
diff --git a/tests/untried/neg/t1960.check b/tests/untried/neg/t1960.check
new file mode 100644
index 000000000..5238141c4
--- /dev/null
+++ b/tests/untried/neg/t1960.check
@@ -0,0 +1,4 @@
+t1960.scala:5: error: parameter 'p' requires field but conflicts with method p in trait TBase
+class Aclass (p: Int) extends TBase { def g() { f(p) } }
+ ^
+one error found
diff --git a/tests/untried/neg/t1960.scala b/tests/untried/neg/t1960.scala
new file mode 100644
index 000000000..ad9a96011
--- /dev/null
+++ b/tests/untried/neg/t1960.scala
@@ -0,0 +1,5 @@
+object ClassFormatErrorExample extends App { new Aclass(1) }
+
+trait TBase { var p:Int = 0; def f(p1: Int): Unit = {} }
+
+class Aclass (p: Int) extends TBase { def g(): Unit = { f(p) } }
diff --git a/tests/untried/neg/t1980.check b/tests/untried/neg/t1980.check
new file mode 100644
index 000000000..2fa27fa46
--- /dev/null
+++ b/tests/untried/neg/t1980.check
@@ -0,0 +1,12 @@
+t1980.scala:2: warning: by-name parameters will be evaluated eagerly when called as a right-associative infix operator. For more details, see SI-1980.
+ def op1_:(x: => Any) = () // warn
+ ^
+t1980.scala:3: warning: by-name parameters will be evaluated eagerly when called as a right-associative infix operator. For more details, see SI-1980.
+ def op2_:(x: Any, y: => Any) = () // warn
+ ^
+t1980.scala:4: warning: by-name parameters will be evaluated eagerly when called as a right-associative infix operator. For more details, see SI-1980.
+ def op3_:(x: Any, y: => Any)(a: Any) = () // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t1980.flags b/tests/untried/neg/t1980.flags
new file mode 100644
index 000000000..7949c2afa
--- /dev/null
+++ b/tests/untried/neg/t1980.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings
diff --git a/tests/untried/neg/t1980.scala b/tests/untried/neg/t1980.scala
new file mode 100644
index 000000000..132865e69
--- /dev/null
+++ b/tests/untried/neg/t1980.scala
@@ -0,0 +1,9 @@
+object Test {
+ def op1_:(x: => Any) = () // warn
+ def op2_:(x: Any, y: => Any) = () // warn
+ def op3_:(x: Any, y: => Any)(a: Any) = () // warn
+
+ def op4() = () // no warn
+ def op5(x: => Any) = () // no warn
+ def op6_:(x: Any)(a: => Any) = () // no warn
+}
diff --git a/tests/untried/neg/t200.check b/tests/untried/neg/t200.check
new file mode 100644
index 000000000..b6b1a3226
--- /dev/null
+++ b/tests/untried/neg/t200.check
@@ -0,0 +1,5 @@
+t200.scala:7: error: method foo is defined twice
+ conflicting symbols both originated in file 't200.scala'
+ def foo: Int;
+ ^
+one error found
diff --git a/tests/untried/neg/t200.scala b/tests/untried/neg/t200.scala
new file mode 100644
index 000000000..692fe368e
--- /dev/null
+++ b/tests/untried/neg/t200.scala
@@ -0,0 +1,8 @@
+trait X {
+ def foo: Int;
+}
+
+trait Y extends X {
+ def foo: String;
+ def foo: Int;
+}
diff --git a/tests/untried/neg/t2031.check b/tests/untried/neg/t2031.check
new file mode 100644
index 000000000..74aa6c9c0
--- /dev/null
+++ b/tests/untried/neg/t2031.check
@@ -0,0 +1,6 @@
+t2031.scala:8: error: polymorphic expression cannot be instantiated to expected type;
+ found : [A]scala.collection.mutable.Builder[A,scala.collection.immutable.TreeSet[A]]
+ required: scala.collection.generic.CanBuildFrom[scala.collection.immutable.TreeSet[Int],Int,?]
+ res0.map(x => x)(TreeSet.newBuilder)
+ ^
+one error found
diff --git a/tests/untried/neg/t2031.scala b/tests/untried/neg/t2031.scala
new file mode 100644
index 000000000..fde7a603f
--- /dev/null
+++ b/tests/untried/neg/t2031.scala
@@ -0,0 +1,9 @@
+import scala.collection.immutable._
+
+object Test extends App {
+ val res0 = TreeSet(1, 2, 3)
+
+ //res0.map(x => x)(TreeSet.newBuilder[Int])
+
+ res0.map(x => x)(TreeSet.newBuilder)
+}
diff --git a/tests/untried/neg/t2066.check b/tests/untried/neg/t2066.check
new file mode 100644
index 000000000..efade87e2
--- /dev/null
+++ b/tests/untried/neg/t2066.check
@@ -0,0 +1,21 @@
+t2066.scala:6: error: overriding method f in trait A1 of type [T[_]]=> Unit;
+ method f has incompatible type
+ override def f[T[+_]] = ()
+ ^
+t2066.scala:10: error: overriding method f in trait A1 of type [T[_]]=> Unit;
+ method f has incompatible type
+ override def f[T[-_]] = ()
+ ^
+t2066.scala:23: error: overriding method f in trait A2 of type [T[+_]]=> Unit;
+ method f has incompatible type
+ override def f[T[-_]] = ()
+ ^
+t2066.scala:45: error: overriding method f in trait A4 of type [T[X[+_]]]=> Unit;
+ method f has incompatible type
+ override def f[T[X[_]]] = ()
+ ^
+t2066.scala:53: error: overriding method f in trait A5 of type [T[X[-_]]]=> Unit;
+ method f has incompatible type
+ override def f[T[X[_]]] = ()
+ ^
+5 errors found
diff --git a/tests/untried/neg/t2066.scala b/tests/untried/neg/t2066.scala
new file mode 100644
index 000000000..7f15d39c6
--- /dev/null
+++ b/tests/untried/neg/t2066.scala
@@ -0,0 +1,70 @@
+trait A1 {
+ def f[T[_]] = ()
+}
+
+trait B1 extends A1 {
+ override def f[T[+_]] = ()
+}
+
+trait C1 extends A1 {
+ override def f[T[-_]] = ()
+}
+
+
+trait A2 {
+ def f[T[+_]] = ()
+}
+
+trait B2 extends A2 {
+ override def f[T[_]] = () // okay
+}
+
+trait C2 extends A2 {
+ override def f[T[-_]] = ()
+}
+
+
+trait A3 {
+ def f[T[-_]] = ()
+}
+
+trait B3 extends A3 {
+ override def f[T[_]] = () // okay
+}
+
+trait C3 extends A3 {
+ override def f[T[-_]] = ()
+}
+
+
+trait A4 {
+ def f[T[X[+_]]] = ()
+}
+
+trait B4 extends A4 {
+ override def f[T[X[_]]] = ()
+}
+
+trait A5 {
+ def f[T[X[-_]]] = ()
+}
+
+trait B5 extends A5 {
+ override def f[T[X[_]]] = ()
+}
+
+
+
+trait A6 {
+ def f[T[X[_]]] = ()
+}
+
+trait B6 extends A6 {
+ override def f[T[X[+_]]] = () // okay
+}
+trait C6 extends A6 {
+ override def f[T[X[_]]] = () // okay
+}
+trait D6 extends A6 {
+ override def f[T[X[-_]]] = ()
+}
diff --git a/tests/untried/neg/t2066b.check b/tests/untried/neg/t2066b.check
new file mode 100644
index 000000000..097c44fef
--- /dev/null
+++ b/tests/untried/neg/t2066b.check
@@ -0,0 +1,5 @@
+t2066b.scala:7: error: overriding method f in trait A of type [T[_]](x: T[Int])T[Any];
+ method f has incompatible type
+ def f[T[+_]](x : T[Int]) : T[Any] = x
+ ^
+one error found
diff --git a/tests/untried/neg/t2066b.scala b/tests/untried/neg/t2066b.scala
new file mode 100644
index 000000000..2f8ffde14
--- /dev/null
+++ b/tests/untried/neg/t2066b.scala
@@ -0,0 +1,16 @@
+object Test extends App {
+ trait A {
+ def f[T[_]](x : T[Int]) : T[Any]
+ }
+
+ class B extends A {
+ def f[T[+_]](x : T[Int]) : T[Any] = x
+ }
+
+ class P[Y](var y : Y)
+
+ val p = new P(1)
+ val palias = (new B():A).f[P](p)
+ palias.y = "hello"
+ val z: Int = p.y
+}
diff --git a/tests/untried/neg/t2070.check b/tests/untried/neg/t2070.check
new file mode 100644
index 000000000..ef1d08f7b
--- /dev/null
+++ b/tests/untried/neg/t2070.check
@@ -0,0 +1,6 @@
+t2070.scala:8: error: The kind of trait T does not conform to the expected kind of type T[X] in trait A.
+t2070.B.T's type parameters do not match type T's expected parameters:
+type X (in object B) has one type parameter, but type X (in trait A) has none
+ trait T[X[_]]
+ ^
+one error found
diff --git a/tests/untried/neg/t2070.scala b/tests/untried/neg/t2070.scala
new file mode 100644
index 000000000..c810568ed
--- /dev/null
+++ b/tests/untried/neg/t2070.scala
@@ -0,0 +1,10 @@
+object t2070 {
+ trait A {
+ type T[X]
+ def f(x : T[Int]) = x
+ }
+
+ object B extends A {
+ trait T[X[_]]
+ }
+}
diff --git a/tests/untried/neg/t2078.check b/tests/untried/neg/t2078.check
new file mode 100644
index 000000000..00bb323a0
--- /dev/null
+++ b/tests/untried/neg/t2078.check
@@ -0,0 +1,4 @@
+t2078.scala:2: error: contravariant type S occurs in covariant position in type => AnyRef{val x: S} of value f
+ val f = new { val x = y }
+ ^
+one error found
diff --git a/tests/untried/neg/t2078.scala b/tests/untried/neg/t2078.scala
new file mode 100644
index 000000000..342ba088c
--- /dev/null
+++ b/tests/untried/neg/t2078.scala
@@ -0,0 +1,9 @@
+class A[-S](y : S) {
+ val f = new { val x = y }
+}
+
+object Test extends App {
+ val a = new A(1)
+ val b = a : A[Nothing]
+ println(b.f.x)
+}
diff --git a/tests/untried/neg/t2102.check b/tests/untried/neg/t2102.check
new file mode 100644
index 000000000..b4f91a531
--- /dev/null
+++ b/tests/untried/neg/t2102.check
@@ -0,0 +1,6 @@
+t2102.scala:2: error: type mismatch;
+ found : java.util.Iterator[Int]
+ required: scala.collection.Iterator[_]
+ val x: Iterator[_] = new java.util.ArrayList[Int]().iterator
+ ^
+one error found
diff --git a/tests/untried/neg/t2102.scala b/tests/untried/neg/t2102.scala
new file mode 100644
index 000000000..9c3703903
--- /dev/null
+++ b/tests/untried/neg/t2102.scala
@@ -0,0 +1,3 @@
+object Test {
+ val x: Iterator[_] = new java.util.ArrayList[Int]().iterator
+}
diff --git a/tests/untried/neg/t2139.check b/tests/untried/neg/t2139.check
new file mode 100644
index 000000000..e26f29076
--- /dev/null
+++ b/tests/untried/neg/t2139.check
@@ -0,0 +1,6 @@
+t2139.scala:13: error: type mismatch;
+ found : Int(4)
+ required: Nothing
+ val z:Int=(u.f _)(4)
+ ^
+one error found
diff --git a/tests/untried/neg/t2139.scala b/tests/untried/neg/t2139.scala
new file mode 100644
index 000000000..316c0d441
--- /dev/null
+++ b/tests/untried/neg/t2139.scala
@@ -0,0 +1,15 @@
+/*
+ NOTE: if inference is changed so that
+ T is inferred to be Int, rather than Nothing,
+ the piece of code below will start to compile OK.
+ In that case, see ticket #2139, and make sure that
+ the generated code will no longer crash!
+*/
+class U {
+ def f[T](x:T):T=x
+}
+object H extends App {
+ val u=new U
+ val z:Int=(u.f _)(4)
+ println("done")
+}
diff --git a/tests/untried/neg/t2144.check b/tests/untried/neg/t2144.check
new file mode 100644
index 000000000..670e188c2
--- /dev/null
+++ b/tests/untried/neg/t2144.check
@@ -0,0 +1,4 @@
+t2144.scala:2: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
+ def foo[A](a: A) = new { def bar(x: A): A = x }
+ ^
+one error found
diff --git a/tests/untried/neg/t2144.scala b/tests/untried/neg/t2144.scala
new file mode 100644
index 000000000..af9a5e166
--- /dev/null
+++ b/tests/untried/neg/t2144.scala
@@ -0,0 +1,3 @@
+object Test {
+ def foo[A](a: A) = new { def bar(x: A): A = x }
+}
diff --git a/tests/untried/neg/t2148.check b/tests/untried/neg/t2148.check
new file mode 100644
index 000000000..27b5dce50
--- /dev/null
+++ b/tests/untried/neg/t2148.check
@@ -0,0 +1,4 @@
+t2148.scala:9: error: A is not a legal prefix for a constructor
+ val b = new A with A#A1
+ ^
+one error found
diff --git a/tests/untried/neg/t2148.scala b/tests/untried/neg/t2148.scala
new file mode 100644
index 000000000..897f1457b
--- /dev/null
+++ b/tests/untried/neg/t2148.scala
@@ -0,0 +1,10 @@
+class A {
+ var i = 0
+ trait A1 extends A {
+ i += 1
+ }
+}
+
+object Bob {
+ val b = new A with A#A1
+}
diff --git a/tests/untried/neg/t2180.check b/tests/untried/neg/t2180.check
new file mode 100644
index 000000000..addc4cfbb
--- /dev/null
+++ b/tests/untried/neg/t2180.check
@@ -0,0 +1,6 @@
+t2180.scala:3: error: type mismatch;
+ found : List[Any]
+ required: List[Mxml]
+ children.toList.flatMap ( e => {
+ ^
+one error found
diff --git a/tests/untried/neg/t2180.scala b/tests/untried/neg/t2180.scala
new file mode 100644
index 000000000..54a9e49c1
--- /dev/null
+++ b/tests/untried/neg/t2180.scala
@@ -0,0 +1,9 @@
+class Mxml {
+ private def processChildren( children:Seq[Any] ):List[Mxml] = {
+ children.toList.flatMap ( e => {
+ e match {
+ case s:scala.collection.Traversable[_] => s case a => List(a)
+ }
+ })
+ }
+}
diff --git a/tests/untried/neg/t2206.check b/tests/untried/neg/t2206.check
new file mode 100644
index 000000000..766f35d93
--- /dev/null
+++ b/tests/untried/neg/t2206.check
@@ -0,0 +1,5 @@
+t2206.scala:10: error: value f is not a member of o.A
+ Note: implicit method ax is not applicable here because it comes after the application point and it lacks an explicit result type
+ a.f()
+ ^
+one error found
diff --git a/tests/untried/neg/t2206.scala b/tests/untried/neg/t2206.scala
new file mode 100644
index 000000000..529f5030b
--- /dev/null
+++ b/tests/untried/neg/t2206.scala
@@ -0,0 +1,15 @@
+object o {
+ class A
+
+ class AX {
+ def f(): Unit = { }
+ }
+
+ import Implicits._
+ val a = new A
+ a.f()
+
+ object Implicits {
+ implicit def ax(a: A) = new AX
+ }
+}
diff --git a/tests/untried/neg/t2208.check b/tests/untried/neg/t2208.check
new file mode 100644
index 000000000..64bb3a77c
--- /dev/null
+++ b/tests/untried/neg/t2208.check
@@ -0,0 +1,4 @@
+t2208.scala:7: error: type arguments [Any] do not conform to type Alias's type parameter bounds [X <: Test.A]
+ class C extends Alias[Any] // not ok, normalisation should check bounds before expanding Alias
+ ^
+one error found
diff --git a/tests/untried/neg/t2208.scala b/tests/untried/neg/t2208.scala
new file mode 100644
index 000000000..53165cc81
--- /dev/null
+++ b/tests/untried/neg/t2208.scala
@@ -0,0 +1,8 @@
+object Test {
+ class A
+
+ class B[X]
+ type Alias[X <: A] = B[X]
+
+ class C extends Alias[Any] // not ok, normalisation should check bounds before expanding Alias
+}
diff --git a/tests/untried/neg/t2213.check b/tests/untried/neg/t2213.check
new file mode 100644
index 000000000..9fb3bb2eb
--- /dev/null
+++ b/tests/untried/neg/t2213.check
@@ -0,0 +1,25 @@
+t2213.scala:9: error: class C needs to be abstract, since:
+it has 4 unimplemented members.
+/** As seen from class C, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ def f: Int = ???
+ def g: Int = ???
+ val x: Int = ???
+ val y: Int = ???
+
+class C extends A {}
+ ^
+t2213.scala:11: error: object creation impossible, since:
+it has 4 unimplemented members.
+/** As seen from object Q, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ def f: Int = ???
+ def g: Int = ???
+ val x: Int = ???
+ val y: Int = ???
+
+object Q extends A { }
+ ^
+two errors found
diff --git a/tests/untried/neg/t2213.scala b/tests/untried/neg/t2213.scala
new file mode 100644
index 000000000..61050906f
--- /dev/null
+++ b/tests/untried/neg/t2213.scala
@@ -0,0 +1,11 @@
+abstract class A {
+ def f: Int
+ def g: Int
+
+ val x: Int
+ val y: Int
+}
+
+class C extends A {}
+
+object Q extends A { }
diff --git a/tests/untried/neg/t2275a.check b/tests/untried/neg/t2275a.check
new file mode 100644
index 000000000..cd3c868e7
--- /dev/null
+++ b/tests/untried/neg/t2275a.check
@@ -0,0 +1,13 @@
+t2275a.scala:4: error: in XML literal: in XML content, please use '}}' to express '}'
+ }else{
+ ^
+t2275a.scala:3: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed <br>
+ <br>
+ ^
+t2275a.scala:4: error: ';' expected but 'else' found.
+ }else{
+ ^
+t2275a.scala:7: error: '}' expected but eof found.
+}
+ ^
+four errors found
diff --git a/tests/untried/neg/t2275a.scala b/tests/untried/neg/t2275a.scala
new file mode 100644
index 000000000..7f2b803da
--- /dev/null
+++ b/tests/untried/neg/t2275a.scala
@@ -0,0 +1,7 @@
+object Test {
+ if(true) {
+ <br>
+ }else{
+ <span>{"louenesee"}</span>
+ }
+}
diff --git a/tests/untried/neg/t2275b.check b/tests/untried/neg/t2275b.check
new file mode 100644
index 000000000..43e34cc4d
--- /dev/null
+++ b/tests/untried/neg/t2275b.check
@@ -0,0 +1,10 @@
+t2275b.scala:2: error: in XML literal: in XML content, please use '}}' to express '}'
+ {<br>}xx
+ ^
+t2275b.scala:2: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed <br>
+ {<br>}xx
+ ^
+t2275b.scala:3: error: '}' expected but eof found.
+}
+ ^
+three errors found
diff --git a/tests/untried/neg/t2275b.scala b/tests/untried/neg/t2275b.scala
new file mode 100644
index 000000000..312cba8d6
--- /dev/null
+++ b/tests/untried/neg/t2275b.scala
@@ -0,0 +1,3 @@
+object Test {
+ {<br>}xx
+}
diff --git a/tests/untried/neg/t2296a.check b/tests/untried/neg/t2296a.check
new file mode 100644
index 000000000..863b86104
--- /dev/null
+++ b/tests/untried/neg/t2296a.check
@@ -0,0 +1,5 @@
+S.scala:6: error: Implementation restriction: trait S accesses protected method foo inside a concrete trait method.
+Add an accessor in a class extending class J as a workaround.
+ foo()
+ ^
+one error found
diff --git a/tests/untried/neg/t2296a/J.java b/tests/untried/neg/t2296a/J.java
new file mode 100644
index 000000000..78ff3e980
--- /dev/null
+++ b/tests/untried/neg/t2296a/J.java
@@ -0,0 +1,7 @@
+package j;
+
+public class J {
+ protected void foo() {
+ System.out.println("J.foo()");
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t2296a/S.scala b/tests/untried/neg/t2296a/S.scala
new file mode 100644
index 000000000..2b2e6cdda
--- /dev/null
+++ b/tests/untried/neg/t2296a/S.scala
@@ -0,0 +1,18 @@
+package s {
+ import j.J
+
+ trait S extends J {
+ def bar(): Unit = {
+ foo()
+ }
+ }
+
+ class SC extends J with S
+}
+
+object Test {
+ def main(args : Array[String]): Unit = {
+ (new s.SC).bar()
+ (new s.S { }).bar()
+ }
+}
diff --git a/tests/untried/neg/t2296b.check b/tests/untried/neg/t2296b.check
new file mode 100644
index 000000000..07cc54d57
--- /dev/null
+++ b/tests/untried/neg/t2296b.check
@@ -0,0 +1,5 @@
+S_2.scala:6: error: Implementation restriction: trait S accesses protected method foo inside a concrete trait method.
+Add an accessor in a class extending class J_1 as a workaround.
+ foo()
+ ^
+one error found
diff --git a/tests/untried/neg/t2296b/J_1.java b/tests/untried/neg/t2296b/J_1.java
new file mode 100644
index 000000000..4c91d4707
--- /dev/null
+++ b/tests/untried/neg/t2296b/J_1.java
@@ -0,0 +1,7 @@
+package j;
+
+public class J_1 {
+ protected void foo() {
+ System.out.println("J.foo()");
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t2296b/S_2.scala b/tests/untried/neg/t2296b/S_2.scala
new file mode 100644
index 000000000..786ba0bfc
--- /dev/null
+++ b/tests/untried/neg/t2296b/S_2.scala
@@ -0,0 +1,18 @@
+package s {
+ import j.J_1
+
+ trait S extends J_1 {
+ def bar(): Unit = {
+ foo()
+ }
+ }
+
+ class SC extends J_1 with S
+}
+
+object Test {
+ def main(args : Array[String]): Unit = {
+ (new s.SC).bar()
+ (new s.S { }).bar()
+ }
+}
diff --git a/tests/untried/neg/t2316.check b/tests/untried/neg/t2316.check
new file mode 100644
index 000000000..fea174566
--- /dev/null
+++ b/tests/untried/neg/t2316.check
@@ -0,0 +1,7 @@
+t2316.scala:28: error: ambiguous implicit values:
+ both method T1FromT3 in object T1 of type (implicit t3: test.T3)test.T1
+ and method T1FromT2 in object T1 of type (implicit t2: test.T2)test.T1
+ match expected type test.T1
+ val t1 = requireT1
+ ^
+one error found
diff --git a/tests/untried/neg/t2316.scala b/tests/untried/neg/t2316.scala
new file mode 100644
index 000000000..bf4bb0ec6
--- /dev/null
+++ b/tests/untried/neg/t2316.scala
@@ -0,0 +1,43 @@
+object test {
+ case class T1(val source: String)
+
+
+ object T1 {
+ implicit def T1FromT2(implicit t2: T2): T1 = T1("implicit def T1FromT2")
+ implicit def T1FromT3(implicit t3: T3): T1 = T1("implicit def T1FromT3")
+ }
+
+ trait T2 {
+ }
+
+ object T2 {
+ implicit val t2: T2 = new T2 {}
+ }
+
+ trait T3
+
+ def requireT1(implicit t1: T1) = t1
+
+ {
+ val t1 = requireT1
+ assert(t1.source == "implicit def T1FromT2")
+ }
+
+ {
+ implicit def t3: T3 = new T3 {}
+ val t1 = requireT1
+ assert(t1.source == "implicit def T1FromT2")
+
+ // Expected a compile error here, but because T1.T1FromT2(T2.t2) was cached as a non-local implicit
+ // expression for type T1, this is not checked!
+ //
+ // (fragment of implicit-cache-error2.scala):26: error: ambiguous implicit values:
+ // both method T1FromT3 in object T1 of type (implicit t3: this.T3)this.T1
+ // and method T1FromT2 in object T1 of type (implicit t2: this.T2)this.T1
+ // match expected type this.T1
+ // val t1 = requireT1
+ // ^
+ // one error found
+
+ }
+}
diff --git a/tests/untried/neg/t2336.check b/tests/untried/neg/t2336.check
new file mode 100644
index 000000000..28acd4d17
--- /dev/null
+++ b/tests/untried/neg/t2336.check
@@ -0,0 +1,4 @@
+t2336.scala:6: error: Foo[Int] is not a legal prefix for a constructor
+ new Foo[Int]#Bar(0)
+ ^
+one error found
diff --git a/tests/untried/neg/t2336.scala b/tests/untried/neg/t2336.scala
new file mode 100755
index 000000000..4cea02b72
--- /dev/null
+++ b/tests/untried/neg/t2336.scala
@@ -0,0 +1,7 @@
+// we get now: t2336.scala:5: error: type Foo[Int] is not a stable prefix
+class Foo[A] {
+ class Bar[B >: A](x: B) extends Foo[B]
+}
+object bug {
+ new Foo[Int]#Bar(0)
+}
diff --git a/tests/untried/neg/t2388.check b/tests/untried/neg/t2388.check
new file mode 100644
index 000000000..3f97608a4
--- /dev/null
+++ b/tests/untried/neg/t2388.check
@@ -0,0 +1,4 @@
+t2388.scala:2: error: recursive method search needs result type
+ val searchField = new AnyRef { search() }
+ ^
+one error found
diff --git a/tests/untried/neg/t2388.scala b/tests/untried/neg/t2388.scala
new file mode 100644
index 000000000..3634f346f
--- /dev/null
+++ b/tests/untried/neg/t2388.scala
@@ -0,0 +1,4 @@
+class Foo {
+ val searchField = new AnyRef { search() }
+ def search() = searchField
+}
diff --git a/tests/untried/neg/t2405.check b/tests/untried/neg/t2405.check
new file mode 100644
index 000000000..78360bcc2
--- /dev/null
+++ b/tests/untried/neg/t2405.check
@@ -0,0 +1,8 @@
+t2405.scala:6: warning: imported `y' is permanently hidden by definition of method y
+ import A.{x => y}
+ ^
+t2405.scala:8: error: could not find implicit value for parameter e: Int
+ implicitly[Int]
+ ^
+one warning found
+one error found
diff --git a/tests/untried/neg/t2405.scala b/tests/untried/neg/t2405.scala
new file mode 100644
index 000000000..6982285b9
--- /dev/null
+++ b/tests/untried/neg/t2405.scala
@@ -0,0 +1,10 @@
+object A { implicit val x: Int = 1 }
+
+// Expecting shadowing #1
+object Test2 {
+ {
+ import A.{x => y}
+ def y: Int = 0
+ implicitly[Int]
+ }
+}
diff --git a/tests/untried/neg/t2416.check b/tests/untried/neg/t2416.check
new file mode 100644
index 000000000..0899ad09d
--- /dev/null
+++ b/tests/untried/neg/t2416.check
@@ -0,0 +1,10 @@
+t2416.scala:3: error: type arguments [Int] do not conform to trait A's type parameter bounds [X <: Double]
+ def x : A[Int]#B = 10 // no you won't
+ ^
+t2416.scala:8: error: type arguments [Boolean] do not conform to type B's type parameter bounds [Y <: Double]
+ def x : A#B[Boolean] = 10 // seriously?
+ ^
+t2416.scala:13: error: type arguments [String] do not conform to type B's type parameter bounds [Z <: Double]
+ type C[Z <: A] = Z#B[String] // nuh-uh!
+ ^
+three errors found
diff --git a/tests/untried/neg/t2416.scala b/tests/untried/neg/t2416.scala
new file mode 100644
index 000000000..6fd2ca229
--- /dev/null
+++ b/tests/untried/neg/t2416.scala
@@ -0,0 +1,14 @@
+object t2416a {
+ trait A[X <: Double] { type B = X }
+ def x : A[Int]#B = 10 // no you won't
+}
+
+object t2416b {
+ trait A{type B[Y <: Double] = Int}
+ def x : A#B[Boolean] = 10 // seriously?
+}
+
+object t2416c {
+ trait A{type B[Z <: Double] = Int}
+ type C[Z <: A] = Z#B[String] // nuh-uh!
+}
diff --git a/tests/untried/neg/t2421b.check b/tests/untried/neg/t2421b.check
new file mode 100644
index 000000000..f666a7d9d
--- /dev/null
+++ b/tests/untried/neg/t2421b.check
@@ -0,0 +1,4 @@
+t2421b.scala:12: error: could not find implicit value for parameter aa: Test.F[Test.A]
+ f
+ ^
+one error found \ No newline at end of file
diff --git a/tests/untried/neg/t2421b.scala b/tests/untried/neg/t2421b.scala
new file mode 100644
index 000000000..4e23a74e8
--- /dev/null
+++ b/tests/untried/neg/t2421b.scala
@@ -0,0 +1,17 @@
+object Test {
+ class A
+ class B
+ class C
+ class F[X]
+
+ def f(implicit aa: F[A]) = println(aa)
+
+ // implicit def a : F[A] = new F[A]()
+ implicit def b[X <: B] = new F[X]()
+
+ f
+}
+
+/* bug:
+error: type arguments [Test2.A] do not conform to method b's type parameter bounds [X <: Test2.B]
+*/
diff --git a/tests/untried/neg/t2441.check b/tests/untried/neg/t2441.check
new file mode 100644
index 000000000..6eaacd8fd
--- /dev/null
+++ b/tests/untried/neg/t2441.check
@@ -0,0 +1,4 @@
+t2441.scala:12: error: private class Y escapes its defining scope as part of type Some[B.Y]
+ override def f = Some(new B.Y)
+ ^
+one error found
diff --git a/tests/untried/neg/t2441.scala b/tests/untried/neg/t2441.scala
new file mode 100644
index 000000000..6784ebb33
--- /dev/null
+++ b/tests/untried/neg/t2441.scala
@@ -0,0 +1,15 @@
+trait X
+trait A {
+ def f: Option[X]
+ def g: Option[X]
+}
+object B {
+ private class Y extends X { val y = 42 }
+}
+class B extends A {
+ private class Bippy
+
+ override def f = Some(new B.Y)
+ override def g: Option[X] = Some(new B.Y)
+}
+
diff --git a/tests/untried/neg/t2442.check b/tests/untried/neg/t2442.check
new file mode 100644
index 000000000..9ff0b4466
--- /dev/null
+++ b/tests/untried/neg/t2442.check
@@ -0,0 +1,11 @@
+t2442.scala:4: warning: match may not be exhaustive.
+It would fail on the following input: THREE
+ def f(e: MyEnum) = e match {
+ ^
+t2442.scala:11: warning: match may not be exhaustive.
+It would fail on the following input: BLUE
+ def g(e: MySecondEnum) = e match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/t2442.flags b/tests/untried/neg/t2442.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t2442.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t2442/MyEnum.java b/tests/untried/neg/t2442/MyEnum.java
new file mode 100644
index 000000000..3ffbbb31b
--- /dev/null
+++ b/tests/untried/neg/t2442/MyEnum.java
@@ -0,0 +1,3 @@
+public enum MyEnum {
+ ONE, TWO, THREE;
+} \ No newline at end of file
diff --git a/tests/untried/neg/t2442/MySecondEnum.java b/tests/untried/neg/t2442/MySecondEnum.java
new file mode 100644
index 000000000..0f841286d
--- /dev/null
+++ b/tests/untried/neg/t2442/MySecondEnum.java
@@ -0,0 +1,6 @@
+public enum MySecondEnum {
+ RED(1), BLUE(2) { public void foo() {} };
+ MySecondEnum(int i) {}
+
+ public void foo() {}
+} \ No newline at end of file
diff --git a/tests/untried/neg/t2442/t2442.scala b/tests/untried/neg/t2442/t2442.scala
new file mode 100644
index 000000000..305c9d624
--- /dev/null
+++ b/tests/untried/neg/t2442/t2442.scala
@@ -0,0 +1,15 @@
+class Test {
+ import MyEnum._
+
+ def f(e: MyEnum) = e match {
+ case ONE => println("one")
+ case TWO => println("two")
+ // missing case --> exhaustivity warning!
+ }
+
+ import MySecondEnum._
+ def g(e: MySecondEnum) = e match {
+ case RED => println("red")
+ // missing case --> exhaustivity warning!
+ }
+}
diff --git a/tests/untried/neg/t2462a.check b/tests/untried/neg/t2462a.check
new file mode 100644
index 000000000..86d74b86d
--- /dev/null
+++ b/tests/untried/neg/t2462a.check
@@ -0,0 +1,4 @@
+t2462a.scala:2: error: Cannot construct a collection of type List[String] with elements of type Int based on a collection of type List[Int].
+ List(1,2,3).map[Int, List[String]](x => 1)
+ ^
+one error found
diff --git a/tests/untried/neg/t2462a.scala b/tests/untried/neg/t2462a.scala
new file mode 100644
index 000000000..5e49314d5
--- /dev/null
+++ b/tests/untried/neg/t2462a.scala
@@ -0,0 +1,3 @@
+object Test {
+ List(1,2,3).map[Int, List[String]](x => 1)
+}
diff --git a/tests/untried/neg/t2462b.check b/tests/untried/neg/t2462b.check
new file mode 100644
index 000000000..b3b8007a9
--- /dev/null
+++ b/tests/untried/neg/t2462b.check
@@ -0,0 +1,11 @@
+t2462b.scala:6: warning: Invalid implicitNotFound message for trait Meh in package test:
+The type parameters Too, Elem referenced in the message of the @implicitNotFound annotation are not defined by trait Meh.
+trait Meh[-From, +To]
+ ^
+t2462b.scala:9: warning: Invalid implicitNotFound message for trait Meh2 in package test:
+The type parameter Elem referenced in the message of the @implicitNotFound annotation is not defined by trait Meh2.
+trait Meh2[-From, +To]
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/t2462b.flags b/tests/untried/neg/t2462b.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t2462b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t2462b.scala b/tests/untried/neg/t2462b.scala
new file mode 100644
index 000000000..576db4bd3
--- /dev/null
+++ b/tests/untried/neg/t2462b.scala
@@ -0,0 +1,9 @@
+package test
+
+import scala.annotation.implicitNotFound
+
+@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.")
+trait Meh[-From, +To]
+
+@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.")
+trait Meh2[-From, +To]
diff --git a/tests/untried/neg/t2462c.check b/tests/untried/neg/t2462c.check
new file mode 100644
index 000000000..edeead55d
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t2462c.flags b/tests/untried/neg/t2462c.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t2462c.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t2462c.scala b/tests/untried/neg/t2462c.scala
new file mode 100644
index 000000000..acf04afba
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t2488.check b/tests/untried/neg/t2488.check
new file mode 100644
index 000000000..170dbf88f
--- /dev/null
+++ b/tests/untried/neg/t2488.check
@@ -0,0 +1,31 @@
+t2488.scala:7: error: overloaded method value f with alternatives:
+ ()Int <and>
+ (a: Int,b: Int)Int
+ cannot be applied to (b: Int, Int)
+ println(c.f(b = 2, 2))
+ ^
+t2488.scala:8: error: overloaded method value f with alternatives:
+ ()Int <and>
+ (a: Int,b: Int)Int
+ cannot be applied to (a: Int, c: Int)
+ println(c.f(a = 2, c = 2))
+ ^
+t2488.scala:9: error: overloaded method value f with alternatives:
+ ()Int <and>
+ (a: Int,b: Int)Int
+ cannot be applied to (Int, c: Int)
+ println(c.f(2, c = 2))
+ ^
+t2488.scala:10: error: overloaded method value f with alternatives:
+ ()Int <and>
+ (a: Int,b: Int)Int
+ cannot be applied to (c: Int, Int)
+ println(c.f(c = 2, 2))
+ ^
+t2488.scala:11: error: overloaded method value f with alternatives:
+ ()Int <and>
+ (a: Int,b: Int)Int
+ cannot be applied to (Int)
+ println(c.f(2))
+ ^
+5 errors found
diff --git a/tests/untried/neg/t2488.scala b/tests/untried/neg/t2488.scala
new file mode 100644
index 000000000..8db052eec
--- /dev/null
+++ b/tests/untried/neg/t2488.scala
@@ -0,0 +1,12 @@
+class C {
+ def f(a:Int, b:Int) = 1
+ def f() = 2
+}
+object Test extends App {
+ val c = new C()
+ println(c.f(b = 2, 2))
+ println(c.f(a = 2, c = 2))
+ println(c.f(2, c = 2))
+ println(c.f(c = 2, 2))
+ println(c.f(2))
+}
diff --git a/tests/untried/neg/t2494.check b/tests/untried/neg/t2494.check
new file mode 100644
index 000000000..6d43011e2
--- /dev/null
+++ b/tests/untried/neg/t2494.check
@@ -0,0 +1,4 @@
+t2494.scala:1: error: recursive value a needs type
+object A { val a = { println("a = " + a); a = 1} }
+ ^
+one error found
diff --git a/tests/untried/neg/t2494.scala b/tests/untried/neg/t2494.scala
new file mode 100755
index 000000000..71e6bc4bb
--- /dev/null
+++ b/tests/untried/neg/t2494.scala
@@ -0,0 +1 @@
+object A { val a = { println("a = " + a); a = 1} }
diff --git a/tests/untried/neg/t2641.check b/tests/untried/neg/t2641.check
new file mode 100644
index 000000000..a0a960f0e
--- /dev/null
+++ b/tests/untried/neg/t2641.check
@@ -0,0 +1,7 @@
+t2641.scala:18: error: wrong number of type arguments for ManagedSeq, should be 2
+ with TraversableViewLike[A, ManagedSeqStrict[A], ManagedSeq[A]]
+ ^
+t2641.scala:27: error: value managedIterator is not a member of ManagedSeq[A,Coll]
+ override def managedIterator = self.managedIterator slice (from, until)
+ ^
+two errors found
diff --git a/tests/untried/neg/t2641.scala b/tests/untried/neg/t2641.scala
new file mode 100644
index 000000000..bc048e039
--- /dev/null
+++ b/tests/untried/neg/t2641.scala
@@ -0,0 +1,30 @@
+import scala.collection._
+import scala.collection.generic._
+import scala.collection.mutable.Builder
+
+
+abstract class ManagedSeqStrict[+A]
+ extends Traversable[A]
+ with GenericTraversableTemplate[A, ManagedSeqStrict]
+{
+ override def companion: GenericCompanion[ManagedSeqStrict] = null
+
+ override def foreach[U](f: A => U): Unit = ()
+}
+
+trait ManagedSeq[+A, +Coll]
+ extends ManagedSeqStrict[A]
+ with TraversableView[A, ManagedSeqStrict[A]]
+ with TraversableViewLike[A, ManagedSeqStrict[A], ManagedSeq[A]]
+{ self =>
+
+ override def underlying = throw new Exception("no underlying")
+
+ //trait Transformed[+B] extends ManagedSeq[B] with super.Transformed[B]
+ trait Transformed[+B] extends ManagedSeq[B, Coll] with super.Transformed[B]
+
+ trait Sliced extends Transformed[A] with super.Sliced {
+ override def managedIterator = self.managedIterator slice (from, until)
+ }
+
+}
diff --git a/tests/untried/neg/t276.check b/tests/untried/neg/t276.check
new file mode 100644
index 000000000..b241953a2
--- /dev/null
+++ b/tests/untried/neg/t276.check
@@ -0,0 +1,5 @@
+t276.scala:6: error: overriding type Bar in class Foo, which equals (Int, Int);
+ class Bar cannot be used here - classes can only override abstract types
+ class Bar
+ ^
+one error found
diff --git a/tests/untried/neg/t276.scala b/tests/untried/neg/t276.scala
new file mode 100644
index 000000000..dfc8b468d
--- /dev/null
+++ b/tests/untried/neg/t276.scala
@@ -0,0 +1,7 @@
+class Foo {
+ type Bar = (Int, Int)
+}
+
+class FooFoo extends Foo {
+ class Bar
+}
diff --git a/tests/untried/neg/t2773.check b/tests/untried/neg/t2773.check
new file mode 100644
index 000000000..a5ffb5fbd
--- /dev/null
+++ b/tests/untried/neg/t2773.check
@@ -0,0 +1,7 @@
+t2773.scala:5: error: value x is not a member of C
+ import c.x
+ ^
+t2773.scala:6: error: not found: value x
+ println(x)
+ ^
+two errors found
diff --git a/tests/untried/neg/t2773.scala b/tests/untried/neg/t2773.scala
new file mode 100755
index 000000000..aaa6351c8
--- /dev/null
+++ b/tests/untried/neg/t2773.scala
@@ -0,0 +1,8 @@
+class C(x: Int) { def foo = x }
+
+object Test {
+ val c = new C(0)
+ import c.x
+ println(x)
+}
+
diff --git a/tests/untried/neg/t2775.check b/tests/untried/neg/t2775.check
new file mode 100644
index 000000000..934a970f2
--- /dev/null
+++ b/tests/untried/neg/t2775.check
@@ -0,0 +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/tests/untried/neg/t2775.scala b/tests/untried/neg/t2775.scala
new file mode 100644
index 000000000..9e4f2f606
--- /dev/null
+++ b/tests/untried/neg/t2775.scala
@@ -0,0 +1 @@
+trait B[S] { type T = S; val c = new Array[T](1) }
diff --git a/tests/untried/neg/t2779.check b/tests/untried/neg/t2779.check
new file mode 100644
index 000000000..0ab4c50d0
--- /dev/null
+++ b/tests/untried/neg/t2779.check
@@ -0,0 +1,5 @@
+t2779.scala:16: error: method f is defined twice
+ conflicting symbols both originated in file 't2779.scala'
+ override def f = List(M1)
+ ^
+one error found
diff --git a/tests/untried/neg/t2779.scala b/tests/untried/neg/t2779.scala
new file mode 100755
index 000000000..d025055aa
--- /dev/null
+++ b/tests/untried/neg/t2779.scala
@@ -0,0 +1,25 @@
+abstract class M
+{
+ def f: List[M] = Nil
+}
+
+object M1 extends M
+
+object M2 extends M
+{
+ override def f = List(M1)
+}
+
+object M3 extends M
+{
+ override def f = List(M1)
+ override def f = List(M1)
+}
+
+object M4 extends M
+{
+ override def f = List(
+ M3,
+ M2
+ )
+}
diff --git a/tests/untried/neg/t278.check b/tests/untried/neg/t278.check
new file mode 100644
index 000000000..405f7d225
--- /dev/null
+++ b/tests/untried/neg/t278.check
@@ -0,0 +1,11 @@
+t278.scala:5: error: overloaded method value a with alternatives:
+ => C.this.A => Unit <and>
+ => () => Unit
+ does not take type parameters
+ println(a[A])
+ ^
+t278.scala:4: error: method a is defined twice
+ conflicting symbols both originated in file 't278.scala'
+ def a = (p:A) => ()
+ ^
+two errors found
diff --git a/tests/untried/neg/t278.scala b/tests/untried/neg/t278.scala
new file mode 100644
index 000000000..39a711bb0
--- /dev/null
+++ b/tests/untried/neg/t278.scala
@@ -0,0 +1,6 @@
+class C {
+ class A
+ def a = () => ()
+ def a = (p:A) => ()
+ println(a[A])
+}
diff --git a/tests/untried/neg/t2796.check b/tests/untried/neg/t2796.check
new file mode 100644
index 000000000..22ee35a7e
--- /dev/null
+++ b/tests/untried/neg/t2796.check
@@ -0,0 +1,9 @@
+t2796.scala:11: warning: early type members are deprecated. Move them to the regular body: the semantics are the same.
+ type X = Int // warn
+ ^
+t2796.scala:7: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized.
+ val abstractVal = "T1.abstractVal" // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/t2796.flags b/tests/untried/neg/t2796.flags
new file mode 100644
index 000000000..d1b831ea8
--- /dev/null
+++ b/tests/untried/neg/t2796.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t2796.scala b/tests/untried/neg/t2796.scala
new file mode 100644
index 000000000..6e1ac852c
--- /dev/null
+++ b/tests/untried/neg/t2796.scala
@@ -0,0 +1,27 @@
+trait Base {
+ val abstractVal: String
+ final val useAbstractVal = abstractVal
+}
+
+trait T1 extends {
+ val abstractVal = "T1.abstractVal" // warn
+} with Base
+
+trait T2 extends {
+ type X = Int // warn
+} with Base
+
+class C1 extends {
+ val abstractVal = "C1.abstractVal" // okay
+} with Base
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ assert(new C1 ().useAbstractVal == "C1.abstractVal")
+ // This currently fails. a more ambitious approach to this ticket would add $earlyinit$
+ // to traits and call it from the right places in the right order.
+ //
+ // For now, we'll just issue a warning.
+ assert(new T1 {}.useAbstractVal == "T1.abstractVal")
+ }
+}
diff --git a/tests/untried/neg/t2801.check b/tests/untried/neg/t2801.check
new file mode 100644
index 000000000..25320de5b
--- /dev/null
+++ b/tests/untried/neg/t2801.check
@@ -0,0 +1,6 @@
+t2801.scala:2: error: type mismatch;
+ found : Null(null)
+ required: A
+ def f[A <: AnyRef] = { val a: A = null ; a }
+ ^
+one error found
diff --git a/tests/untried/neg/t2801.scala b/tests/untried/neg/t2801.scala
new file mode 100644
index 000000000..d425f58b5
--- /dev/null
+++ b/tests/untried/neg/t2801.scala
@@ -0,0 +1,3 @@
+object Test {
+ def f[A <: AnyRef] = { val a: A = null ; a }
+}
diff --git a/tests/untried/neg/t284.check b/tests/untried/neg/t284.check
new file mode 100644
index 000000000..7c2e9be03
--- /dev/null
+++ b/tests/untried/neg/t284.check
@@ -0,0 +1,6 @@
+t284.scala:2: warning: Detected apparent refinement of Unit; are you missing an '=' sign?
+ def f1(a: T): Unit { }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t284.flags b/tests/untried/neg/t284.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t284.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t284.scala b/tests/untried/neg/t284.scala
new file mode 100644
index 000000000..b04fe33c9
--- /dev/null
+++ b/tests/untried/neg/t284.scala
@@ -0,0 +1,5 @@
+trait B[T] {
+ def f1(a: T): Unit { }
+ def f2(a: T): Unit
+ def f3(a: T): Unit = { }
+}
diff --git a/tests/untried/neg/t2870.check b/tests/untried/neg/t2870.check
new file mode 100644
index 000000000..99522eca6
--- /dev/null
+++ b/tests/untried/neg/t2870.check
@@ -0,0 +1,9 @@
+t2870.scala:1: error: not found: type Jar
+class Jars(jar: Jar)
+ ^
+t2870.scala:4: error: encountered unrecoverable cycle resolving import.
+Note: this is often due in part to a class depending on a definition nested within its companion.
+If applicable, you may wish to try moving some members into another object.
+ import scala.util.Properties.javaClassPath
+ ^
+two errors found
diff --git a/tests/untried/neg/t2870.scala b/tests/untried/neg/t2870.scala
new file mode 100755
index 000000000..4de19242e
--- /dev/null
+++ b/tests/untried/neg/t2870.scala
@@ -0,0 +1,9 @@
+class Jars(jar: Jar)
+
+object Jars {
+ import scala.util.Properties.javaClassPath
+
+ val scala = fromClasspathString(javaClassPath)
+
+ def fromClasspathString(s: String): Jars = null
+}
diff --git a/tests/untried/neg/t2910.check b/tests/untried/neg/t2910.check
new file mode 100644
index 000000000..44bf1993d
--- /dev/null
+++ b/tests/untried/neg/t2910.check
@@ -0,0 +1,16 @@
+t2910.scala:3: error: forward reference extends over definition of value ret
+ val ret = l.map({ case MyMatch(id) => id })
+ ^
+t2910.scala:9: error: forward reference extends over definition of value z
+ println(s.length)
+ ^
+t2910.scala:16: error: forward reference extends over definition of value z
+ x
+ ^
+t2910.scala:30: error: forward reference extends over definition of value x
+ lazy val f: Int = x
+ ^
+t2910.scala:35: error: forward reference extends over definition of variable x
+ lazy val f: Int = g
+ ^
+5 errors found
diff --git a/tests/untried/neg/t2910.scala b/tests/untried/neg/t2910.scala
new file mode 100644
index 000000000..f2ce3718c
--- /dev/null
+++ b/tests/untried/neg/t2910.scala
@@ -0,0 +1,39 @@
+object Junk {
+ def f(l: List[String]): List[String] = {
+ val ret = l.map({ case MyMatch(id) => id })
+ val MyMatch = "(\\d+)".r
+ ret
+ }
+
+ def test2(): Unit = {
+ println(s.length)
+ val z = 0
+ lazy val s = "abc"
+ }
+
+ def test4(): Unit = {
+ lazy val x = {
+ x
+ val z = 0
+ lazy val x = 12
+ z
+ }
+ }
+}
+
+// updated forwards.scala for lazy vals
+object Test {
+ lazy val f: Int = x
+ val x: Int = f
+
+ {
+ lazy val f: Int = x
+ val x: Int = f
+ println(x)
+ }
+ {
+ lazy val f: Int = g
+ var x: Int = f
+ lazy val g: Int = x
+ }
+}
diff --git a/tests/untried/neg/t2918.check b/tests/untried/neg/t2918.check
new file mode 100644
index 000000000..aae3045e8
--- /dev/null
+++ b/tests/untried/neg/t2918.check
@@ -0,0 +1,10 @@
+t2918.scala:2: error: illegal cyclic reference involving type A
+ def g[X, A[X] <: A[X]](x: A[X]) = x
+ ^
+t2918.scala:2: error: cyclic aliasing or subtyping involving type A
+ def g[X, A[X] <: A[X]](x: A[X]) = x
+ ^
+t2918.scala:2: error: A does not take type parameters
+ def g[X, A[X] <: A[X]](x: A[X]) = x
+ ^
+three errors found
diff --git a/tests/untried/neg/t2918.scala b/tests/untried/neg/t2918.scala
new file mode 100755
index 000000000..ff2be39ae
--- /dev/null
+++ b/tests/untried/neg/t2918.scala
@@ -0,0 +1,3 @@
+object Test {
+ def g[X, A[X] <: A[X]](x: A[X]) = x
+}
diff --git a/tests/untried/neg/t2968.check b/tests/untried/neg/t2968.check
new file mode 100644
index 000000000..5d2387f98
--- /dev/null
+++ b/tests/untried/neg/t2968.check
@@ -0,0 +1,10 @@
+t2968.scala:8: error: Missing closing brace `}' assumed here
+} // missing brace
+^
+t2968.scala:17: error: Missing closing brace `}' assumed here
+} // missing brace
+^
+t2968.scala:26: error: Missing closing brace `}' assumed here
+} // missing brace
+^
+three errors found
diff --git a/tests/untried/neg/t2968.scala b/tests/untried/neg/t2968.scala
new file mode 100644
index 000000000..41c3a798a
--- /dev/null
+++ b/tests/untried/neg/t2968.scala
@@ -0,0 +1,26 @@
+object t1 {
+ case object Const {
+ }
+
+ class Var
+ {
+
+} // missing brace
+
+object t2 {
+ case class Const() {
+ }
+
+ class Var
+ {
+
+} // missing brace
+
+object t3 {
+ final case class Const() {
+ }
+
+ class Var
+ {
+
+} // missing brace
diff --git a/tests/untried/neg/t2968b.check b/tests/untried/neg/t2968b.check
new file mode 100644
index 000000000..36d25a2d1
--- /dev/null
+++ b/tests/untried/neg/t2968b.check
@@ -0,0 +1,4 @@
+t2968b.scala:7: error: '}' expected but eof found.
+// missing brace
+ ^
+one error found
diff --git a/tests/untried/neg/t2968b.scala b/tests/untried/neg/t2968b.scala
new file mode 100644
index 000000000..422b618ab
--- /dev/null
+++ b/tests/untried/neg/t2968b.scala
@@ -0,0 +1,7 @@
+case class Const()
+{
+}
+
+class Var
+{
+// missing brace
diff --git a/tests/untried/neg/t2973.check b/tests/untried/neg/t2973.check
new file mode 100644
index 000000000..582fe0063
--- /dev/null
+++ b/tests/untried/neg/t2973.check
@@ -0,0 +1,4 @@
+t2973.scala:1: error: ';' expected but 'package' found.
+package foo {} package bar {}
+ ^
+one error found \ No newline at end of file
diff --git a/tests/untried/neg/t2973.scala b/tests/untried/neg/t2973.scala
new file mode 100644
index 000000000..b9d973580
--- /dev/null
+++ b/tests/untried/neg/t2973.scala
@@ -0,0 +1 @@
+package foo {} package bar {}
diff --git a/tests/untried/neg/t3006.check b/tests/untried/neg/t3006.check
new file mode 100644
index 000000000..2447eebc9
--- /dev/null
+++ b/tests/untried/neg/t3006.check
@@ -0,0 +1,6 @@
+t3006.scala:8: error: type mismatch;
+ found : String("H")
+ required: Int
+ println(A(3) + "H")
+ ^
+one error found
diff --git a/tests/untried/neg/t3006.scala b/tests/untried/neg/t3006.scala
new file mode 100755
index 000000000..a84b69c84
--- /dev/null
+++ b/tests/untried/neg/t3006.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ case class A(x: Int);
+
+ class Foo(a: A) { println("Foo created!"); def +(x: Int) = new A(this.a.x + x); }
+
+ implicit def aToFoo(x: A) = new Foo(x);
+
+ println(A(3) + "H")
+
+}
diff --git a/tests/untried/neg/t3015.check b/tests/untried/neg/t3015.check
new file mode 100644
index 000000000..729db844e
--- /dev/null
+++ b/tests/untried/neg/t3015.check
@@ -0,0 +1,6 @@
+t3015.scala:7: error: scrutinee is incompatible with pattern type;
+ found : _$1
+ required: String
+ val b(foo) = "foo"
+ ^
+one error found
diff --git a/tests/untried/neg/t3015.scala b/tests/untried/neg/t3015.scala
new file mode 100644
index 000000000..adfa15b38
--- /dev/null
+++ b/tests/untried/neg/t3015.scala
@@ -0,0 +1,8 @@
+class UnApp[P] {
+ def unapply(a: P): Option[P] = Some(a)
+}
+
+object Test extends App {
+ val b: UnApp[_] = new UnApp[String]
+ val b(foo) = "foo"
+}
diff --git a/tests/untried/neg/t3098.check b/tests/untried/neg/t3098.check
new file mode 100644
index 000000000..5343b128f
--- /dev/null
+++ b/tests/untried/neg/t3098.check
@@ -0,0 +1,7 @@
+b.scala:3: warning: match may not be exhaustive.
+It would fail on the following input: (_ : C)
+ def f = (null: T) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t3098.flags b/tests/untried/neg/t3098.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t3098.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t3098/a.scala b/tests/untried/neg/t3098/a.scala
new file mode 100644
index 000000000..57a103c7a
--- /dev/null
+++ b/tests/untried/neg/t3098/a.scala
@@ -0,0 +1,6 @@
+// Traits.scala
+sealed trait T
+
+trait A extends T
+trait B extends T
+trait C extends T
diff --git a/tests/untried/neg/t3098/b.scala b/tests/untried/neg/t3098/b.scala
new file mode 100644
index 000000000..84a1f9f6f
--- /dev/null
+++ b/tests/untried/neg/t3098/b.scala
@@ -0,0 +1,8 @@
+// Test.scala
+object Test {
+ def f = (null: T) match {
+ case _: A => println("A")
+ case _: B => println("B")
+ // no C
+ }
+}
diff --git a/tests/untried/neg/t3118.check b/tests/untried/neg/t3118.check
new file mode 100644
index 000000000..da00f1c33
--- /dev/null
+++ b/tests/untried/neg/t3118.check
@@ -0,0 +1,7 @@
+t3118.scala:6: error: value C is not a member of O1
+ println(x.C()) // should not be accessible
+ ^
+t3118.scala:7: error: type C is not a member of O1
+ println(new x.C) // is correctly not accessible
+ ^
+two errors found
diff --git a/tests/untried/neg/t3118.scala b/tests/untried/neg/t3118.scala
new file mode 100644
index 000000000..9be24c1ed
--- /dev/null
+++ b/tests/untried/neg/t3118.scala
@@ -0,0 +1,8 @@
+class O1 {
+ private[this] case class C()
+
+ val x = new O1
+
+ println(x.C()) // should not be accessible
+ println(new x.C) // is correctly not accessible
+}
diff --git a/tests/untried/neg/t3160ambiguous.check b/tests/untried/neg/t3160ambiguous.check
new file mode 100644
index 000000000..73a0c6d5d
--- /dev/null
+++ b/tests/untried/neg/t3160ambiguous.check
@@ -0,0 +1,7 @@
+t3160ambiguous.scala:8: error: reference to List is ambiguous;
+it is imported twice in the same scope by
+import scala.collection.immutable._
+and import Bippy._
+ def f(x: List[Any]): String = ??? // ambiguous, because Bippy.List is accessible
+ ^
+one error found
diff --git a/tests/untried/neg/t3160ambiguous.scala b/tests/untried/neg/t3160ambiguous.scala
new file mode 100644
index 000000000..57745e60d
--- /dev/null
+++ b/tests/untried/neg/t3160ambiguous.scala
@@ -0,0 +1,15 @@
+object Bippy {
+ private class List[+T]
+}
+class Bippy {
+ import Bippy._
+ import scala.collection.immutable._
+
+ def f(x: List[Any]): String = ??? // ambiguous, because Bippy.List is accessible
+}
+class Other {
+ import Bippy._
+ import scala.collection.immutable._
+
+ def f(x: List[Any]): String = ??? // unambiguous, because Bippy.List is inaccessible
+}
diff --git a/tests/untried/neg/t3189.check b/tests/untried/neg/t3189.check
new file mode 100644
index 000000000..122af5647
--- /dev/null
+++ b/tests/untried/neg/t3189.check
@@ -0,0 +1,4 @@
+t3189.scala:2: error: bad simple pattern: use _* to match a sequence
+ val Array(a,b*) = ("": Any)
+ ^
+one error found
diff --git a/tests/untried/neg/t3189.scala b/tests/untried/neg/t3189.scala
new file mode 100644
index 000000000..4ea4bb758
--- /dev/null
+++ b/tests/untried/neg/t3189.scala
@@ -0,0 +1,3 @@
+object A {
+ val Array(a,b*) = ("": Any)
+} \ No newline at end of file
diff --git a/tests/untried/neg/t3209.check b/tests/untried/neg/t3209.check
new file mode 100644
index 000000000..c5a6b1d95
--- /dev/null
+++ b/tests/untried/neg/t3209.check
@@ -0,0 +1,4 @@
+t3209.scala:2: error: expected start of definition
+package test
+^
+one error found
diff --git a/tests/untried/neg/t3209.scala b/tests/untried/neg/t3209.scala
new file mode 100644
index 000000000..d89372665
--- /dev/null
+++ b/tests/untried/neg/t3209.scala
@@ -0,0 +1,2 @@
+@javax.annotation.Generated(Array("test"))
+package test \ No newline at end of file
diff --git a/tests/untried/neg/t3222.check b/tests/untried/neg/t3222.check
new file mode 100644
index 000000000..6170827cc
--- /dev/null
+++ b/tests/untried/neg/t3222.check
@@ -0,0 +1,13 @@
+t3222.scala:1: error: not found: type B
+@throws(classOf[B])
+ ^
+t3222.scala:4: error: not found: type D
+ def foo(@throws(classOf[D]) x: Int) {}
+ ^
+t3222.scala:3: error: not found: type C
+ @throws(classOf[C])
+ ^
+t3222.scala:6: error: not found: type E
+ @throws(classOf[E])
+ ^
+four errors found
diff --git a/tests/untried/neg/t3222.scala b/tests/untried/neg/t3222.scala
new file mode 100644
index 000000000..7918671a9
--- /dev/null
+++ b/tests/untried/neg/t3222.scala
@@ -0,0 +1,9 @@
+@throws(classOf[B])
+class ExceptionTest {
+ @throws(classOf[C])
+ def foo(@throws(classOf[D]) x: Int): Unit = {}
+
+ @throws(classOf[E])
+ type t = String
+}
+
diff --git a/tests/untried/neg/t3224.check b/tests/untried/neg/t3224.check
new file mode 100644
index 000000000..69b02c886
--- /dev/null
+++ b/tests/untried/neg/t3224.check
@@ -0,0 +1,26 @@
+t3224.scala:30: error: polymorphic expression cannot be instantiated to expected type;
+ found : [T]Array[T]
+ required: List[?]
+ println(Texts textL Array())
+ ^
+t3224.scala:34: error: type mismatch;
+ found : List[Nothing]
+ required: Array[?]
+ println(Texts textA List())
+ ^
+t3224.scala:35: error: type mismatch;
+ found : List[Int]
+ required: Array[?]
+ println(Texts textA List(1))
+ ^
+t3224.scala:36: error: type mismatch;
+ found : List[Int]
+ required: Array[?]
+ println(Texts textA List(1, 1));
+ ^
+t3224.scala:48: error: polymorphic expression cannot be instantiated to expected type;
+ found : [T]Array[T]
+ required: List[?]
+ assert(size(Array()) == 0)
+ ^
+5 errors found
diff --git a/tests/untried/neg/t3224.scala b/tests/untried/neg/t3224.scala
new file mode 100755
index 000000000..b7af8a67b
--- /dev/null
+++ b/tests/untried/neg/t3224.scala
@@ -0,0 +1,50 @@
+object Texts{
+ def textL[T](list: List[T]) = {
+ list match{
+ case List() => "Empty"
+ case List(_) => "One"
+ case List(_*) => "Many"
+ }
+ }
+
+ def textA[T](array: Array[T]) = {
+ array match{
+ case Array() => "Empty"
+ case Array(_) => "One"
+ case Array(_*) => "Many"
+ }
+ }
+}
+
+object Test extends App {
+ {
+ implicit def array2list[T](array: Array[T]) = {
+ println(array.toList.size)
+ array.toList
+ }
+
+ println(Texts textL List())
+ println(Texts textL List(1))
+ println(Texts textL List(1, 1));
+
+ println(Texts textL Array())
+ println(Texts textL Array(1))
+ println(Texts textL Array(1, 1))
+
+ println(Texts textA List())
+ println(Texts textA List(1))
+ println(Texts textA List(1, 1));
+
+ println(Texts textA Array())
+ println(Texts textA Array(1))
+ println(Texts textA Array(1, 1))
+ }
+
+ {
+ implicit def array2list[T](array: Array[T]) = array.toList
+ def size[T](list: List[T]) = list.size
+
+ assert(size(array2list(Array())) == 0)
+ assert(size(Array()) == 0)
+ }
+}
diff --git a/tests/untried/neg/t3234.check b/tests/untried/neg/t3234.check
new file mode 100644
index 000000000..8f0d624ed
--- /dev/null
+++ b/tests/untried/neg/t3234.check
@@ -0,0 +1,6 @@
+t3234.scala:17: warning: At the end of the day, could not inline @inline-marked method foo3
+ println(foo(42) + foo2(11) + foo3(2))
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t3234.flags b/tests/untried/neg/t3234.flags
new file mode 100644
index 000000000..cc3d9fb6f
--- /dev/null
+++ b/tests/untried/neg/t3234.flags
@@ -0,0 +1 @@
+-Yinline -Yinline-warnings -Xfatal-warnings
diff --git a/tests/untried/neg/t3234.scala b/tests/untried/neg/t3234.scala
new file mode 100644
index 000000000..1f5b18645
--- /dev/null
+++ b/tests/untried/neg/t3234.scala
@@ -0,0 +1,19 @@
+trait Trait1 {
+ // need more work before this one works
+ // @inline
+ def foo2(n: Int) = n*n
+}
+
+trait Trait2 {
+ @inline def foo3(n: Int) = 1
+}
+
+class Base extends Trait1 {
+ @inline def foo(n: Int) = n
+}
+
+object Test extends Base with Trait2 {
+ def main(args: Array[String]) = {
+ println(foo(42) + foo2(11) + foo3(2))
+ }
+}
diff --git a/tests/untried/neg/t3240.check b/tests/untried/neg/t3240.check
new file mode 100644
index 000000000..efae682c6
--- /dev/null
+++ b/tests/untried/neg/t3240.check
@@ -0,0 +1,4 @@
+t3240.scala:3: error: only classes can have declared but undefined members
+ type t
+ ^
+one error found
diff --git a/tests/untried/neg/t3240.scala b/tests/untried/neg/t3240.scala
new file mode 100644
index 000000000..fdd86d8ea
--- /dev/null
+++ b/tests/untried/neg/t3240.scala
@@ -0,0 +1,8 @@
+class A {
+ val foo = new {
+ type t
+ def apply(a: Option[t], defVal: Any) = {
+ a.getOrElse(defVal).asInstanceOf[t]
+ }
+ }
+}
diff --git a/tests/untried/neg/t3275.check b/tests/untried/neg/t3275.check
new file mode 100644
index 000000000..117c79232
--- /dev/null
+++ b/tests/untried/neg/t3275.check
@@ -0,0 +1,4 @@
+t3275.scala:2: error: @tailrec annotated method contains no recursive calls
+ @annotation.tailrec def foo() = 5
+ ^
+one error found
diff --git a/tests/untried/neg/t3275.scala b/tests/untried/neg/t3275.scala
new file mode 100644
index 000000000..18e38a1a9
--- /dev/null
+++ b/tests/untried/neg/t3275.scala
@@ -0,0 +1,3 @@
+object Test {
+ @annotation.tailrec def foo() = 5
+}
diff --git a/tests/untried/neg/t3346b.check b/tests/untried/neg/t3346b.check
new file mode 100644
index 000000000..bcde6d90e
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t3346b.scala b/tests/untried/neg/t3346b.scala
new file mode 100644
index 000000000..f28ee8ba3
--- /dev/null
+++ b/tests/untried/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)
+}
diff --git a/tests/untried/neg/t3346c.check b/tests/untried/neg/t3346c.check
new file mode 100644
index 000000000..575379d00
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t3346c.scala b/tests/untried/neg/t3346c.scala
new file mode 100644
index 000000000..a5ac166b2
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t3346i.check b/tests/untried/neg/t3346i.check
new file mode 100644
index 000000000..cc17ab7ce
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t3346i.scala b/tests/untried/neg/t3346i.scala
new file mode 100644
index 000000000..9ad254453
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t3392.check b/tests/untried/neg/t3392.check
new file mode 100644
index 000000000..842d63eec
--- /dev/null
+++ b/tests/untried/neg/t3392.check
@@ -0,0 +1,4 @@
+t3392.scala:9: error: not found: value x
+ case x@A(x/*<-- refers to the pattern that includes this comment*/.Ex(42)) =>
+ ^
+one error found
diff --git a/tests/untried/neg/t3392.scala b/tests/untried/neg/t3392.scala
new file mode 100644
index 000000000..655c2e84a
--- /dev/null
+++ b/tests/untried/neg/t3392.scala
@@ -0,0 +1,11 @@
+object Test {
+ case class A(a: Int) {
+ object Ex {
+ def unapply(i: Int): Option[Int] = Some(i)
+ }
+ }
+
+ A(42) match {
+ case x@A(x/*<-- refers to the pattern that includes this comment*/.Ex(42)) =>
+ }
+}
diff --git a/tests/untried/neg/t3399.check b/tests/untried/neg/t3399.check
new file mode 100644
index 000000000..987da944c
--- /dev/null
+++ b/tests/untried/neg/t3399.check
@@ -0,0 +1,4 @@
+t3399.scala:23: error: Cannot prove that Nats.Add[Nats._1,Nats._1] =:= Nats._1.
+ implicitly[ Add[_1, _1] =:= _1]
+ ^
+one error found
diff --git a/tests/untried/neg/t3399.scala b/tests/untried/neg/t3399.scala
new file mode 100644
index 000000000..e39e54ac6
--- /dev/null
+++ b/tests/untried/neg/t3399.scala
@@ -0,0 +1,24 @@
+object Nats {
+ sealed trait Nat {
+ // fold right on N, N-1, ..., 1
+ type FoldR[Init <: Type, Type, F <: Fold[Nat, Type]] <: Type
+ }
+ sealed trait _0 extends Nat {
+ type FoldR[Init <: Type, Type, F <: Fold[Nat, Type]] = Init
+ }
+ sealed trait Succ[N <: Nat] extends Nat {
+ type FoldR[Init <: Type, Type, F <: Fold[Nat, Type]] =
+ F#Apply[Succ[N], N#FoldR[Init, Type, F]]
+ }
+
+ type Add[A <: Nat, B <: Nat] = A#FoldR[B, Nat, Inc]
+ trait Fold[-Elem, Value] {
+ type Apply[N <: Elem, Acc <: Value] <: Value
+ }
+ type Inc = Fold[Any, Nat] {
+ type Apply[N <: Any, Acc <: Nat] = Succ[Acc]
+ }
+
+ type _1 = Succ[_0]
+ implicitly[ Add[_1, _1] =:= _1]
+}
diff --git a/tests/untried/neg/t3403.check b/tests/untried/neg/t3403.check
new file mode 100644
index 000000000..e52d140e6
--- /dev/null
+++ b/tests/untried/neg/t3403.check
@@ -0,0 +1,4 @@
+t3403.scala:2: error: implementation limitation: the BeanProperty annotation cannot be used in a type alias or renamed import
+class Foo { @bp var bar: Int = 1 }
+ ^
+one error found
diff --git a/tests/untried/neg/t3403.scala b/tests/untried/neg/t3403.scala
new file mode 100644
index 000000000..7cf0c3e0f
--- /dev/null
+++ b/tests/untried/neg/t3403.scala
@@ -0,0 +1,2 @@
+import scala.beans.{BeanProperty => bp}
+class Foo { @bp var bar: Int = 1 }
diff --git a/tests/untried/neg/t343.check b/tests/untried/neg/t343.check
new file mode 100644
index 000000000..d310b7915
--- /dev/null
+++ b/tests/untried/neg/t343.check
@@ -0,0 +1,4 @@
+t343.scala:5: error: private class Foo escapes its defining scope as part of type C.this.Foo
+ def get:Foo = new Foo();
+ ^
+one error found
diff --git a/tests/untried/neg/t343.scala b/tests/untried/neg/t343.scala
new file mode 100644
index 000000000..ed57d2eef
--- /dev/null
+++ b/tests/untried/neg/t343.scala
@@ -0,0 +1,14 @@
+package scalaInner1;
+
+class C {
+ private class Foo {}
+ def get:Foo = new Foo();
+}
+
+
+
+object Test {
+ def main(args:Array[String]) = {
+ val c = new C().get;
+ }
+}
diff --git a/tests/untried/neg/t3453.check b/tests/untried/neg/t3453.check
new file mode 100644
index 000000000..52c948128
--- /dev/null
+++ b/tests/untried/neg/t3453.check
@@ -0,0 +1,21 @@
+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/tests/untried/neg/t3453.scala b/tests/untried/neg/t3453.scala
new file mode 100644
index 000000000..af7781894
--- /dev/null
+++ b/tests/untried/neg/t3453.scala
@@ -0,0 +1,66 @@
+// test shadowing of implicits by synonymous non-implicit symbols
+// whether they be inherited, imported (explicitly or using a wildcard) or defined directly
+class A
+class B
+
+trait S {
+ implicit def aToB(a: A): B = new B
+}
+
+class T1 extends S {
+ def x: B = {
+ val aToB = 3
+ // ok: doesn't compile, because aToB method requires 'T.this.' prefix
+ //aToB(new A)
+
+ // bug: compiles, using T.this.aToB,
+ // despite it not being accessible without a prefix
+ new A
+ }
+}
+
+object O {
+ implicit def aToB(a: A): B = new B
+}
+
+class T2a {
+ import O._
+
+ def x: B = {
+ val aToB = 3
+ // ok: doesn't compile, because aToB method requires 'T.this.' prefix
+ //aToB(new A)
+
+ // bug: compiles, using T.this.aToB,
+ // despite it not being accessible without a prefix
+ new A
+ }
+}
+
+class T2b {
+ import O.aToB
+
+ def x: B = {
+ val aToB = 3
+ // ok: doesn't compile, because aToB method requires 'T.this.' prefix
+ //aToB(new A)
+
+ // bug: compiles, using T.this.aToB,
+ // despite it not being accessible without a prefix
+ new A
+ }
+}
+
+class T3 {
+ implicit def aToB(a: A): B = new B
+
+ def x: B = {
+ val aToB = 3
+ // ok: doesn't compile, because aToB method requires 'T.this.' prefix
+ //aToB(new A)
+
+ // bug: compiles, using T.this.aToB,
+ // despite it not being accessible without a prefix
+ new A
+ }
+}
diff --git a/tests/untried/neg/t3481.check b/tests/untried/neg/t3481.check
new file mode 100644
index 000000000..debe07275
--- /dev/null
+++ b/tests/untried/neg/t3481.check
@@ -0,0 +1,29 @@
+t3481.scala:5: error: type mismatch;
+ found : String("hello")
+ required: _$1
+ f[A[Int]]("hello")
+ ^
+t3481.scala:11: error: type mismatch;
+ found : _$2
+ required: b.T
+ (which expands to) _$2
+ def f[T <: B[_]](a: T#T, b: T) = b.m(a)
+ ^
+t3481.scala:12: error: type mismatch;
+ found : String("Hello")
+ required: _$2
+ f("Hello", new B[Int])
+ ^
+t3481.scala:18: error: type mismatch;
+ found : String("Hello")
+ required: t3481.ex3.b.T2
+ (which expands to) _$3
+ b.m("Hello")
+ ^
+t3481.scala:25: error: type mismatch;
+ found : String("Hello")
+ required: t3481.ex4.Test.b.T2
+ (which expands to) _$4
+ b.m("Hello")
+ ^
+5 errors found
diff --git a/tests/untried/neg/t3481.scala b/tests/untried/neg/t3481.scala
new file mode 100644
index 000000000..6924fdf56
--- /dev/null
+++ b/tests/untried/neg/t3481.scala
@@ -0,0 +1,28 @@
+object t3481 {
+ object ex1 {
+ trait A[T] { type B = T }
+ def f[T <: A[_]](a: T#B) = 1
+ f[A[Int]]("hello")
+ }
+
+ object ex2 {
+ trait A { type T; def m(t: T) = t.toString }
+ class B[T2] extends A { type T = T2 }
+ def f[T <: B[_]](a: T#T, b: T) = b.m(a)
+ f("Hello", new B[Int])
+ }
+
+ object ex3 {
+ class B[T] { type T2 = T; def m(t: T2) = t.toString }
+ val b: B[_] = new B[Int]
+ b.m("Hello")
+ }
+
+ object ex4 {
+ abstract class B[T] { type T2 = T; def m(t: T2): Any }
+ object Test {
+ val b: B[_] = sys.error("")
+ b.m("Hello")
+ }
+ }
+}
diff --git a/tests/untried/neg/t3507-old.check b/tests/untried/neg/t3507-old.check
new file mode 100644
index 000000000..b3ac40473
--- /dev/null
+++ b/tests/untried/neg/t3507-old.check
@@ -0,0 +1,4 @@
+t3507-old.scala:13: error: No Manifest available for _1.b.c.type.
+ mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier
+ ^
+one error found
diff --git a/tests/untried/neg/t3507-old.scala b/tests/untried/neg/t3507-old.scala
new file mode 100644
index 000000000..5f8f3644b
--- /dev/null
+++ b/tests/untried/neg/t3507-old.scala
@@ -0,0 +1,15 @@
+class A {
+ object b {
+ object c
+ }
+ def m = b.c
+}
+
+object Test {
+ var a: A = new A // mutable
+ val c /*: object _1.b.c forSome { val _1: A } */ = a.m // widening using existential
+
+ def mani[T: Manifest](x: T) = ()
+ mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier
+ // --> _1 is not in scope here
+}
diff --git a/tests/untried/neg/t3604.check b/tests/untried/neg/t3604.check
new file mode 100644
index 000000000..b07c5c9c7
--- /dev/null
+++ b/tests/untried/neg/t3604.check
@@ -0,0 +1,7 @@
+t3604.scala:3: error: in XML literal: expected closing tag of abbr
+ <abbr></div>
+ ^
+t3604.scala:3: error: start tag was here: abbr>
+ <abbr></div>
+ ^
+two errors found
diff --git a/tests/untried/neg/t3604.scala b/tests/untried/neg/t3604.scala
new file mode 100644
index 000000000..f890a58e5
--- /dev/null
+++ b/tests/untried/neg/t3604.scala
@@ -0,0 +1,6 @@
+object Main {
+ <div>
+ <abbr></div>
+ { "..." }
+ </div>
+}
diff --git a/tests/untried/neg/t3614.check b/tests/untried/neg/t3614.check
new file mode 100644
index 000000000..81628ef37
--- /dev/null
+++ b/tests/untried/neg/t3614.check
@@ -0,0 +1,4 @@
+t3614.scala:2: error: only declarations allowed here
+ def v = new ({ def a=0 })
+ ^
+one error found
diff --git a/tests/untried/neg/t3614.scala b/tests/untried/neg/t3614.scala
new file mode 100644
index 000000000..70e429440
--- /dev/null
+++ b/tests/untried/neg/t3614.scala
@@ -0,0 +1,3 @@
+object t3614 {
+ def v = new ({ def a=0 })
+}
diff --git a/tests/untried/neg/t3649.check b/tests/untried/neg/t3649.check
new file mode 100644
index 000000000..76d68fa3b
--- /dev/null
+++ b/tests/untried/neg/t3649.check
@@ -0,0 +1,10 @@
+t3649.scala:1: error: C is already defined as (compiler-generated) case class companion object C
+object T { class C(s: String = ""); val C = 0 }
+ ^
+t3649.scala:2: error: C is already defined as (compiler-generated) case class companion object C
+object U { class C(val s: String = ""); val C = new C() {} }
+ ^
+t3649.scala:2: error: not enough arguments for constructor C: (s: String)U.C
+object U { class C(val s: String = ""); val C = new C() {} }
+ ^
+three errors found
diff --git a/tests/untried/neg/t3649.scala b/tests/untried/neg/t3649.scala
new file mode 100644
index 000000000..2aaff9610
--- /dev/null
+++ b/tests/untried/neg/t3649.scala
@@ -0,0 +1,2 @@
+object T { class C(s: String = ""); val C = 0 }
+object U { class C(val s: String = ""); val C = new C() {} }
diff --git a/tests/untried/neg/t3653.check b/tests/untried/neg/t3653.check
new file mode 100644
index 000000000..ad68e29fb
--- /dev/null
+++ b/tests/untried/neg/t3653.check
@@ -0,0 +1,7 @@
+t3653.scala:3: error: double definition:
+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/tests/untried/neg/t3653.scala b/tests/untried/neg/t3653.scala
new file mode 100644
index 000000000..0bedc4fdc
--- /dev/null
+++ b/tests/untried/neg/t3653.scala
@@ -0,0 +1,4 @@
+class B {
+ def x(i: Int) = 3
+ def x(implicit x: Int) = 5
+}
diff --git a/tests/untried/neg/t3663.check b/tests/untried/neg/t3663.check
new file mode 100644
index 000000000..c4b27ef21
--- /dev/null
+++ b/tests/untried/neg/t3663.check
@@ -0,0 +1,4 @@
+main.scala:11: error: variable foo in class PackageProtected cannot be accessed in test.Test
+ println(t.foo)
+ ^
+one error found
diff --git a/tests/untried/neg/t3663/PackageProtected.java b/tests/untried/neg/t3663/PackageProtected.java
new file mode 100644
index 000000000..f4535a55b
--- /dev/null
+++ b/tests/untried/neg/t3663/PackageProtected.java
@@ -0,0 +1,5 @@
+package test;
+
+class PackageProtected {
+ int foo;
+}
diff --git a/tests/untried/neg/t3663/main.scala b/tests/untried/neg/t3663/main.scala
new file mode 100644
index 000000000..a70ee52cf
--- /dev/null
+++ b/tests/untried/neg/t3663/main.scala
@@ -0,0 +1,14 @@
+package test
+
+final class Test extends PackageProtected {
+ def bar = foo
+}
+
+package another {
+ object Main {
+ def bug(t: Test): Unit = {
+ // Can always be replicated.
+ println(t.foo)
+ }
+ }
+}
diff --git a/tests/untried/neg/t3683a.check b/tests/untried/neg/t3683a.check
new file mode 100644
index 000000000..6386265eb
--- /dev/null
+++ b/tests/untried/neg/t3683a.check
@@ -0,0 +1,7 @@
+t3683a.scala:14: warning: match may not be exhaustive.
+It would fail on the following input: XX()
+ w match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t3683a.flags b/tests/untried/neg/t3683a.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t3683a.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t3683a.scala b/tests/untried/neg/t3683a.scala
new file mode 100644
index 000000000..ac1b6265c
--- /dev/null
+++ b/tests/untried/neg/t3683a.scala
@@ -0,0 +1,20 @@
+sealed trait Foo
+sealed trait Bar extends Foo
+sealed trait W[T >: Bar <: Foo]
+case class X() extends W[Foo]
+case class XX() extends W[Bar]
+case class Y() extends W[Bar]
+case class Z[T >: Bar <: Foo](
+ z1: W[T]
+) extends W[T]
+
+object Main {
+ // should warn for not including XX()
+ def f1(w: W[Bar]): Int = {
+ w match {
+ // case XX() => 2
+ case Y() => 1
+ case Z(z) => f1(z)
+ }
+ }
+}
diff --git a/tests/untried/neg/t3683b.check b/tests/untried/neg/t3683b.check
new file mode 100644
index 000000000..6e3369241
--- /dev/null
+++ b/tests/untried/neg/t3683b.check
@@ -0,0 +1,8 @@
+t3683b.scala:15: error: constructor cannot be instantiated to expected type;
+ found : X
+ required: W[Bar]
+Note: Foo >: Bar (and X <: W[Foo]), but trait W is invariant in type T.
+You may wish to define T as -T instead. (SLS 4.5)
+ case X() => 1
+ ^
+one error found
diff --git a/tests/untried/neg/t3683b.scala b/tests/untried/neg/t3683b.scala
new file mode 100644
index 000000000..1c361ed2d
--- /dev/null
+++ b/tests/untried/neg/t3683b.scala
@@ -0,0 +1,21 @@
+sealed trait Foo
+sealed trait Bar extends Foo
+sealed trait W[T >: Bar <: Foo]
+case class X() extends W[Foo]
+case class XX() extends W[Bar]
+case class Y() extends W[Bar]
+case class Z[T >: Bar <: Foo](
+ z1: W[T]
+) extends W[T]
+
+object Main {
+ // should fail for including X()
+ def f1(w: W[Bar]): Int = {
+ w match {
+ case X() => 1
+ case XX() => 2
+ case Y() => 1
+ case Z(z) => f1(z)
+ }
+ }
+}
diff --git a/tests/untried/neg/t3691.check b/tests/untried/neg/t3691.check
new file mode 100644
index 000000000..6a7e13049
--- /dev/null
+++ b/tests/untried/neg/t3691.check
@@ -0,0 +1,16 @@
+t3691.scala:4: error: type mismatch;
+ found : Test.A[String]
+ required: AnyRef{type A[x]}
+ val b = (new A[String]{}): { type A[x] } // not ok
+ ^
+t3691.scala:5: error: type mismatch;
+ found : Test.A[String]
+ required: AnyRef{type A}
+ val c = (new A[String]{}): { type A } // not ok
+ ^
+t3691.scala:7: error: type mismatch;
+ found : AnyRef{type A = String}
+ required: AnyRef{type A[X]}
+ val x = (new { type A = String }): { type A[X] } // not ok
+ ^
+three errors found
diff --git a/tests/untried/neg/t3691.scala b/tests/untried/neg/t3691.scala
new file mode 100644
index 000000000..c1daa4918
--- /dev/null
+++ b/tests/untried/neg/t3691.scala
@@ -0,0 +1,11 @@
+object Test {
+ trait A[X] { type A[x <: X] = x }
+ val a = (new A[String]{}): { type A[x <: String] } // ok
+ val b = (new A[String]{}): { type A[x] } // not ok
+ val c = (new A[String]{}): { type A } // not ok
+
+ val x = (new { type A = String }): { type A[X] } // not ok
+//a: AnyRef{type A[X]}
+
+ identity[x.A[Any]] _
+}
diff --git a/tests/untried/neg/t3692-new.check b/tests/untried/neg/t3692-new.check
new file mode 100644
index 000000000..bb8692f3c
--- /dev/null
+++ b/tests/untried/neg/t3692-new.check
@@ -0,0 +1,19 @@
+t3692-new.scala:14: warning: non-variable type argument Int in type pattern scala.collection.immutable.Map[Int,Int] (the underlying of Map[Int,Int]) is unchecked since it is eliminated by erasure
+ case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer]
+ ^
+t3692-new.scala:15: warning: non-variable type argument Int in type pattern scala.collection.immutable.Map[Int,V] (the underlying of Map[Int,V]) is unchecked since it is eliminated by erasure
+ case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
+ ^
+t3692-new.scala:16: warning: non-variable type argument Int in type pattern scala.collection.immutable.Map[T,Int] (the underlying of Map[T,Int]) is unchecked since it is eliminated by erasure
+ case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
+ ^
+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 {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+5 warnings found
+one error found
diff --git a/tests/untried/neg/t3692-new.flags b/tests/untried/neg/t3692-new.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t3692-new.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t3692-new.scala b/tests/untried/neg/t3692-new.scala
new file mode 100644
index 000000000..6ecf4acb8
--- /dev/null
+++ b/tests/untried/neg/t3692-new.scala
@@ -0,0 +1,20 @@
+import scala.reflect.{ClassTag, classTag}
+import java.lang.Integer
+
+object Tester {
+ def main(args: Array[String]) = {
+ val map = Map("John" -> 1, "Josh" -> 2)
+ new Tester().toJavaMap(map)
+ }
+}
+
+class Tester {
+ private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: ClassTag[T], m2: ClassTag[V]): java.util.Map[_, _] = {
+ map match {
+ case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer]
+ case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
+ case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
+ case _ => new java.util.HashMap[T, V]
+ }
+ }
+}
diff --git a/tests/untried/neg/t3714-neg.check b/tests/untried/neg/t3714-neg.check
new file mode 100644
index 000000000..4f2971696
--- /dev/null
+++ b/tests/untried/neg/t3714-neg.check
@@ -0,0 +1,13 @@
+t3714-neg.scala:17: error: value break in class BreakImpl cannot be accessed in BreakImpl
+ Access to protected value break not permitted because
+ enclosing object Test is not a subclass of
+ class BreakImpl where target is defined
+ case b: BreakImpl => b.break
+ ^
+t3714-neg.scala:25: error: value break in class BreakImpl cannot be accessed in BreakImpl
+ Access to protected value break not permitted because
+ enclosing object Test is not a subclass of
+ class BreakImpl where target is defined
+ case b: BreakImpl => b.break
+ ^
+two errors found
diff --git a/tests/untried/neg/t3714-neg.scala b/tests/untried/neg/t3714-neg.scala
new file mode 100644
index 000000000..72518de14
--- /dev/null
+++ b/tests/untried/neg/t3714-neg.scala
@@ -0,0 +1,41 @@
+// this is a slight negative twist on run/t3714.scala.
+trait Break {
+ protected val break: Int;
+}
+
+class BreakImpl(protected val break: Int) extends Break { }
+object BreakImpl {
+ def apply(x: Int): Break = new BreakImpl(x)
+ def unapply(x: Any) = x match {
+ case x: BreakImpl => Some(x.break)
+ case _ => None
+ }
+}
+
+object Test {
+ def f1(x: Break) = x match {
+ case b: BreakImpl => b.break
+ case b => -1
+ }
+ def f2(x: Break) = x match {
+ case BreakImpl(x) => x
+ case _ => -1
+ }
+ def f3(x: Any) = x match {
+ case b: BreakImpl => b.break
+ case b => -1
+ }
+ def f4(x: Any) = x match {
+ case BreakImpl(x) => x
+ case _ => -1
+ }
+
+ def main(args: Array[String]): Unit = {
+ val break = BreakImpl(22)
+ assert(f1(break) == 22)
+ assert(f2(break) == 22)
+ assert(f3(break) == 22)
+ assert(f4(break) == 22)
+ }
+}
+
diff --git a/tests/untried/neg/t3736.check b/tests/untried/neg/t3736.check
new file mode 100644
index 000000000..7a20f6c08
--- /dev/null
+++ b/tests/untried/neg/t3736.check
@@ -0,0 +1,16 @@
+t3736.scala:4: error: super not allowed here: use this.isInstanceOf instead
+ def f2 = super.isInstanceOf[String]
+ ^
+t3736.scala:5: error: super not allowed here: use this.asInstanceOf instead
+ def f3 = super.asInstanceOf[AnyRef]
+ ^
+t3736.scala:6: error: super not allowed here: use this.== instead
+ def f4 = super.==(new AnyRef)
+ ^
+t3736.scala:7: error: super not allowed here: use this.!= instead
+ def f5 = super.!=(new AnyRef)
+ ^
+t3736.scala:8: error: super not allowed here: use this.## instead
+ def f6 = super.##
+ ^
+5 errors found
diff --git a/tests/untried/neg/t3736.scala b/tests/untried/neg/t3736.scala
new file mode 100644
index 000000000..cf0920912
--- /dev/null
+++ b/tests/untried/neg/t3736.scala
@@ -0,0 +1,34 @@
+object Test {
+ class A {
+ def f1 = super.toString
+ def f2 = super.isInstanceOf[String]
+ def f3 = super.asInstanceOf[AnyRef]
+ def f4 = super.==(new AnyRef)
+ def f5 = super.!=(new AnyRef)
+ def f6 = super.##
+ }
+
+ // Ill-advised overloads to be sure...
+ class B {
+ def ##(x: String) = true
+ def ==(x1: String, xs: List[_]) = true
+ def !=(x1: String, xs: List[_]) = true
+ }
+
+ class C extends B {
+ override def ##(x: String) = super.##(x)
+ override def ==(x1: String, xs: List[_]) = super.==(x1, xs)
+ override def !=(x1: String, xs: List[_]) = super.!=(x1, xs)
+ }
+
+ def main(args: Array[String]): Unit = {
+ val x = new A
+ x.f1
+ x.f2
+ x.f3
+ x.f4
+ x.f5
+ x.f6
+ }
+}
+
diff --git a/tests/untried/neg/t3757.check b/tests/untried/neg/t3757.check
new file mode 100644
index 000000000..1507df8c4
--- /dev/null
+++ b/tests/untried/neg/t3757.check
@@ -0,0 +1,4 @@
+B.scala:4: error: method foo overrides nothing
+ override def foo = "B"
+ ^
+one error found
diff --git a/tests/untried/neg/t3757/A.java b/tests/untried/neg/t3757/A.java
new file mode 100644
index 000000000..37da86fe1
--- /dev/null
+++ b/tests/untried/neg/t3757/A.java
@@ -0,0 +1,5 @@
+package a;
+
+public abstract class A {
+ abstract String foo(); // package protected!
+} \ No newline at end of file
diff --git a/tests/untried/neg/t3757/B.scala b/tests/untried/neg/t3757/B.scala
new file mode 100644
index 000000000..e899f51e7
--- /dev/null
+++ b/tests/untried/neg/t3757/B.scala
@@ -0,0 +1,5 @@
+package b
+
+class B extends a.A {
+ override def foo = "B"
+}
diff --git a/tests/untried/neg/t3761-overload-byname.check b/tests/untried/neg/t3761-overload-byname.check
new file mode 100644
index 000000000..ae7d21dfa
--- /dev/null
+++ b/tests/untried/neg/t3761-overload-byname.check
@@ -0,0 +1,13 @@
+t3761-overload-byname.scala:9: error: ambiguous reference to overloaded definition,
+both method m1 in object t of type (x: => Int, s: Object)Int
+and method m1 in object t of type (x: => AnyVal, s: String)Int
+match argument types (Int,String)
+ m1(1, "")
+ ^
+t3761-overload-byname.scala:11: error: ambiguous reference to overloaded definition,
+both method m2 in object t of type (x: => Int, s: Object)Int
+and method m2 in object t of type (x: => Any, s: String)Int
+match argument types (Int,String)
+ m2(1, "")
+ ^
+two errors found
diff --git a/tests/untried/neg/t3761-overload-byname.scala b/tests/untried/neg/t3761-overload-byname.scala
new file mode 100644
index 000000000..5b9a381b9
--- /dev/null
+++ b/tests/untried/neg/t3761-overload-byname.scala
@@ -0,0 +1,13 @@
+object t {
+ def m1(x: => AnyVal, s: String) = 0
+ def m1(x: => Int, s: Object) = 1
+
+ def m2(x: => Any, s: String) = 0
+ def m2(x: => Int, s: Object) = 1
+
+
+ m1(1, "")
+ m1(1d, "")
+ m2(1, "")
+ m2("", "")
+}
diff --git a/tests/untried/neg/t3769.check b/tests/untried/neg/t3769.check
new file mode 100644
index 000000000..40ccf05ff
--- /dev/null
+++ b/tests/untried/neg/t3769.check
@@ -0,0 +1,7 @@
+t3769.scala:2: error: in XML literal: expected closing tag of a
+ val x = <b> <c><a></c> {"text"} </b>
+ ^
+t3769.scala:2: error: start tag was here: a>
+ val x = <b> <c><a></c> {"text"} </b>
+ ^
+two errors found
diff --git a/tests/untried/neg/t3769.scala b/tests/untried/neg/t3769.scala
new file mode 100644
index 000000000..0132b59ed
--- /dev/null
+++ b/tests/untried/neg/t3769.scala
@@ -0,0 +1,3 @@
+object Test {
+ val x = <b> <c><a></c> {"text"} </b>
+}
diff --git a/tests/untried/neg/t3776.check b/tests/untried/neg/t3776.check
new file mode 100644
index 000000000..0dfe12959
--- /dev/null
+++ b/tests/untried/neg/t3776.check
@@ -0,0 +1,4 @@
+t3776.scala:8: error: value someOperation is not a member of _$1
+ def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v
+ ^
+one error found
diff --git a/tests/untried/neg/t3776.scala b/tests/untried/neg/t3776.scala
new file mode 100644
index 000000000..e24b2fea6
--- /dev/null
+++ b/tests/untried/neg/t3776.scala
@@ -0,0 +1,10 @@
+object MyParser {
+ implicit def literal(s: String): Parser[String] = ???
+ trait Parser[+T]
+ def parse[T](p: Parser[T], in: java.lang.CharSequence): Option[T] = ???
+}
+object Test {
+ class ParsedAs(a: String) (implicit pattern: MyParser.Parser[_]) {
+ def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v
+ }
+}
diff --git a/tests/untried/neg/t3816.check b/tests/untried/neg/t3816.check
new file mode 100644
index 000000000..40621f896
--- /dev/null
+++ b/tests/untried/neg/t3816.check
@@ -0,0 +1,7 @@
+t3816.scala:30: error: stable identifier required, but `syncID` found.
+ case Some( `syncID` ) =>
+ ^
+t3816.scala:38: error: stable identifier required, but Test.this.foo found.
+ case Some( `foo` ) =>
+ ^
+two errors found
diff --git a/tests/untried/neg/t3816.scala b/tests/untried/neg/t3816.scala
new file mode 100644
index 000000000..0eadbcf8f
--- /dev/null
+++ b/tests/untried/neg/t3816.scala
@@ -0,0 +1,42 @@
+class B {
+ def ::(a: List[Int]): Unit = {
+ a match {
+ case x::xs =>
+ case _ =>
+ }
+ }
+}
+
+object Test {
+ def testSuccess1( x: Any ) = {
+ val stable = 2
+ x match {
+ case Some( `stable` ) =>
+ case _ =>
+ }
+ }
+
+ val bar = 3
+ def testSuccess2( x: Any ) = {
+ x match {
+ case Some( `bar` ) =>
+ case _ =>
+ }
+ }
+
+ def testFail1( x: Any ) = {
+ var syncID = 0
+ x match {
+ case Some( `syncID` ) =>
+ case _ =>
+ }
+ }
+
+ var foo = 0
+ def testFail2( x: Any ) = {
+ x match {
+ case Some( `foo` ) =>
+ case _ =>
+ }
+ }
+}
diff --git a/tests/untried/neg/t3836.check b/tests/untried/neg/t3836.check
new file mode 100644
index 000000000..ff2fc36ae
--- /dev/null
+++ b/tests/untried/neg/t3836.check
@@ -0,0 +1,13 @@
+t3836.scala:17: error: reference to IOException is ambiguous;
+it is imported twice in the same scope by
+import foo.bar._
+and import java.io._
+ def f = new IOException // genuinely different
+ ^
+t3836.scala:26: error: reference to Bippy is ambiguous;
+it is imported twice in the same scope by
+import baz._
+and import bar._
+ def f: Bippy[Int] = ???
+ ^
+two errors found
diff --git a/tests/untried/neg/t3836.scala b/tests/untried/neg/t3836.scala
new file mode 100644
index 000000000..a68f6e172
--- /dev/null
+++ b/tests/untried/neg/t3836.scala
@@ -0,0 +1,28 @@
+package foo
+
+package object bar {
+ type IOException = Object
+ type Bippy[T] = List[T]
+}
+
+package object baz {
+ type Bippy[+T] = List[T]
+}
+
+package baz {
+ import java.io._
+ import foo.bar._
+
+ object Test {
+ def f = new IOException // genuinely different
+ }
+}
+
+package baz2 {
+ import bar._
+ import baz._
+
+ object Test2 {
+ def f: Bippy[Int] = ???
+ }
+}
diff --git a/tests/untried/neg/t3854.check b/tests/untried/neg/t3854.check
new file mode 100644
index 000000000..c478481a6
--- /dev/null
+++ b/tests/untried/neg/t3854.check
@@ -0,0 +1,5 @@
+t3854.scala:1: error: class Bar needs to be abstract, since method foo in trait Foo of type [G[_]](implicit n: N[G,F])X[F] is not defined
+(Note that N[G,F] does not match M[G])
+class Bar[F[_]] extends Foo[F] {
+ ^
+one error found
diff --git a/tests/untried/neg/t3854.scala b/tests/untried/neg/t3854.scala
new file mode 100644
index 000000000..e8db76c0a
--- /dev/null
+++ b/tests/untried/neg/t3854.scala
@@ -0,0 +1,15 @@
+class Bar[F[_]] extends Foo[F] {
+ def foo[G[_[_], _]](implicit M: M[G]): X[({type λ[α] = G[F, α] })#λ] = null
+}
+// vim: set ts=4 sw=4 et:
+
+trait M[F[_[_], _]]
+trait N[F[_], G[_]]
+
+trait X[F[_]] {
+ def apply[A]: F[A]
+}
+
+trait Foo[F[_]] {
+ def foo[G[_]](implicit n: N[G, F]): X[F]
+}
diff --git a/tests/untried/neg/t3871.check b/tests/untried/neg/t3871.check
new file mode 100644
index 000000000..b920357ee
--- /dev/null
+++ b/tests/untried/neg/t3871.check
@@ -0,0 +1,7 @@
+t3871.scala:4: error: variable foo in class Sub2 cannot be accessed in Sub2
+ Access to protected method foo not permitted because
+ enclosing class Base is not a subclass of
+ class Sub2 where target is defined
+ s.foo = true
+ ^
+one error found
diff --git a/tests/untried/neg/t3871.scala b/tests/untried/neg/t3871.scala
new file mode 100644
index 000000000..fc459867d
--- /dev/null
+++ b/tests/untried/neg/t3871.scala
@@ -0,0 +1,11 @@
+class Base {
+ def mkNew() = {
+ val s = new Sub2
+ s.foo = true
+ s
+ }
+}
+
+class Sub2 extends Base {
+ protected var foo = false
+}
diff --git a/tests/untried/neg/t3871b.check b/tests/untried/neg/t3871b.check
new file mode 100644
index 000000000..6ab5ddfaf
--- /dev/null
+++ b/tests/untried/neg/t3871b.check
@@ -0,0 +1,97 @@
+t3871b.scala:61: error: not found: value protOT
+ protOT // not allowed
+ ^
+t3871b.scala:77: error: method prot in class A cannot be accessed in E.this.A
+ Access to protected method prot not permitted because
+ prefix type E.this.A does not conform to
+ class B in class E where the access take place
+ a.prot // not allowed, prefix type `A` does not conform to `B`
+ ^
+t3871b.scala:79: error: value protT is not a member of E.this.B
+ b.protT // not allowed
+ ^
+t3871b.scala:80: error: value protT is not a member of E.this.C
+ c.protT // not allowed
+ ^
+t3871b.scala:81: error: value protT is not a member of E.this.A
+ a.protT // not allowed
+ ^
+t3871b.scala:91: error: method prot in class A cannot be accessed in E.this.A
+ Access to protected method prot not permitted because
+ prefix type E.this.A does not conform to
+ object B in class E where the access take place
+ a.prot // not allowed
+ ^
+t3871b.scala:93: error: value protT is not a member of E.this.B
+ b.protT // not allowed
+ ^
+t3871b.scala:94: error: value protT is not a member of E.this.C
+ c.protT // not allowed
+ ^
+t3871b.scala:95: error: value protT is not a member of E.this.A
+ a.protT // not allowed
+ ^
+t3871b.scala:102: error: method prot in class A cannot be accessed in E.this.B
+ Access to protected method prot not permitted because
+ enclosing class Z in class E is not a subclass of
+ class A in class E where target is defined
+ b.prot // not allowed
+ ^
+t3871b.scala:103: error: method prot in class A cannot be accessed in E.this.C
+ Access to protected method prot not permitted because
+ enclosing class Z in class E is not a subclass of
+ class A in class E where target is defined
+ c.prot // not allowed
+ ^
+t3871b.scala:104: error: method prot in class A cannot be accessed in E.this.A
+ Access to protected method prot not permitted because
+ enclosing class Z in class E is not a subclass of
+ class A in class E where target is defined
+ a.prot // not allowed
+ ^
+t3871b.scala:109: error: value protT is not a member of E.this.B
+ b.protT // not allowed
+ ^
+t3871b.scala:110: error: value protT is not a member of E.this.C
+ c.protT // not allowed
+ ^
+t3871b.scala:111: error: value protT is not a member of E.this.A
+ a.protT // not allowed
+ ^
+t3871b.scala:120: error: method prot in class A cannot be accessed in Other.this.e.B
+ Access to protected method prot not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ b.prot // not allowed
+ ^
+t3871b.scala:121: error: method prot in class A cannot be accessed in Other.this.e.C
+ Access to protected method prot not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ c.prot // not allowed
+ ^
+t3871b.scala:122: error: method prot in class A cannot be accessed in Other.this.e.A
+ Access to protected method prot not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ a.prot // not allowed
+ ^
+t3871b.scala:123: error: method protE in class A cannot be accessed in Other.this.e.B
+ Access to protected method protE not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ b.protE // not allowed
+ ^
+t3871b.scala:124: error: method protE in class A cannot be accessed in Other.this.e.A
+ Access to protected method protE not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ a.protE // not allowed
+ ^
+t3871b.scala:125: error: method protE in class A cannot be accessed in Other.this.e.C
+ Access to protected method protE not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ c.protE // not allowed
+ ^
+21 errors found
diff --git a/tests/untried/neg/t3871b.scala b/tests/untried/neg/t3871b.scala
new file mode 100644
index 000000000..b490b7789
--- /dev/null
+++ b/tests/untried/neg/t3871b.scala
@@ -0,0 +1,127 @@
+/**
+
+The protected modifier applies to class member definitions. Protected members of a class can be accessed from within
+
+ 0a. the companion module of any of those classes
+
+A protected identifier x may be used as a member name in a selection r.x only
+if one of the following applies:
+ 1a. The access is within the template defining the member, or,
+ if a qualification C is given,
+ 1b. inside the package C, or
+ 1c. the class C , or its companion module, or
+ 2. r is one of the reserved words this and super, or
+ 3. r’s type conforms to a type-instance of the class which contains the access.
+
+ 4. A different form of qualification is protected[this]. A member M marked with this
+ modifier is called object-protected; it can be accessed only from within the object
+ in which it is defined. That is, a selection p.M is only legal if the prefix is this
+ or O.this, for some class O enclosing the reference. In addition, the restrictions
+ for unqualified protected apply.
+*/
+
+object E {
+ val e = new E
+ import e._
+ def n(a: A, b: B, c: C) = {
+ b.protE // 1c
+ c.protE // 1c
+ a.protE // 1c
+ A.protOE // 1c
+ }
+}
+
+class E {
+ object A {
+ protected def protO = 2
+ protected[E] def protOE = 3
+ protected[this] def protOT = 3
+ }
+ class A {
+ protected def prot = 2
+ protected[E] def protE = 3
+ protected[this] def protT = 4
+
+ // 1a
+ prot; protE; protT
+ def foo = {prot; protE; protT}
+ new { prot; protE }
+ def this(a: Any) = {this(); prot; protE; protT}
+ object B extends A {
+ A.this.prot
+ A.this.protE
+ A.this.protT
+ }
+
+ import A._
+ // 0a
+ protO
+ // 3
+ protOE
+ protOT // not allowed
+ }
+
+ class B extends A {
+ // 1b
+ this.prot; this.protE;
+ super.prot; super.protE;
+
+ // 4
+ this.protT
+ // 4 !!! "or the super keyword"
+ super.protT
+
+ def n(a: A, b: B, c: C) = {
+ b.prot // 3
+ c.prot // 3
+ a.prot // not allowed, prefix type `A` does not conform to `B`
+
+ b.protT // not allowed
+ c.protT // not allowed
+ a.protT // not allowed
+ }
+ }
+ object B {
+ def n(a: A, b: B, c: C) = {
+ b.prot // 3 !!!
+ c.prot // 3 !!!
+ // Wording of 3 seems insufficient, missing:
+ // "... (if the access is from a class), or
+ // the type instance of companion class (if the access is from a module)"
+ a.prot // not allowed
+
+ b.protT // not allowed
+ c.protT // not allowed
+ a.protT // not allowed
+ }
+ }
+ class C extends B
+
+ class Z {
+ def n(a: A, b: B, c: C) = {
+ b.prot // not allowed
+ c.prot // not allowed
+ a.prot // not allowed
+ b.protE // 2
+ a.protE // 2
+ c.protE // 2
+
+ b.protT // not allowed
+ c.protT // not allowed
+ a.protT // not allowed
+ }
+ }
+}
+
+class Other {
+ val e = new E
+ import e._
+ def n(a: A, b: B, c: C) = {
+ b.prot // not allowed
+ c.prot // not allowed
+ a.prot // not allowed
+ b.protE // not allowed
+ a.protE // not allowed
+ c.protE // not allowed
+ }
+}
diff --git a/tests/untried/neg/t3873.check b/tests/untried/neg/t3873.check
new file mode 100644
index 000000000..f9f413aea
--- /dev/null
+++ b/tests/untried/neg/t3873.check
@@ -0,0 +1,6 @@
+t3873.scala:11: error: type mismatch;
+ found : Test.a.B
+ required: a.B where val a: A
+ wrongf(new A)(a.b) // should not compile
+ ^
+one error found
diff --git a/tests/untried/neg/t3873.scala b/tests/untried/neg/t3873.scala
new file mode 100644
index 000000000..bf5799955
--- /dev/null
+++ b/tests/untried/neg/t3873.scala
@@ -0,0 +1,12 @@
+class A {
+ class B
+ def b: B = new B
+}
+
+object Test {
+ def wrongf(a: A)(b: a.B): a.B = b
+
+ val a = new A
+ wrongf(a)(a.b)
+ wrongf(new A)(a.b) // should not compile
+}
diff --git a/tests/untried/neg/t3909.check b/tests/untried/neg/t3909.check
new file mode 100644
index 000000000..7da019560
--- /dev/null
+++ b/tests/untried/neg/t3909.check
@@ -0,0 +1,4 @@
+t3909.scala:1: error: in object DO, multiple overloaded alternatives of m1 define default arguments
+object DO {
+ ^
+one error found
diff --git a/tests/untried/neg/t3909.scala b/tests/untried/neg/t3909.scala
new file mode 100644
index 000000000..758dc70fd
--- /dev/null
+++ b/tests/untried/neg/t3909.scala
@@ -0,0 +1,12 @@
+object DO {
+ class Extras { }
+ object Extras { val defaultValue = new Extras }
+
+ def m1(str: String, extraStuff: Extras = Extras.defaultValue): Int = str.length
+ def m1(i: Int, extraStuff: Extras = Extras.defaultValue): Int = 2 * i
+
+ def main(args: Array[String]): Unit = {
+ val m1s = m1("foo")
+ val m1i = m1(42)
+ }
+}
diff --git a/tests/untried/neg/t391.check b/tests/untried/neg/t391.check
new file mode 100644
index 000000000..879d9af71
--- /dev/null
+++ b/tests/untried/neg/t391.check
@@ -0,0 +1,13 @@
+t391.scala:2: error: identifier expected but 'def' found.
+ def fun1(def x: Int): Int = x; // the "def x" is illegal
+ ^
+t391.scala:4: error: ':' expected but '}' found.
+}
+^
+t391.scala:6: error: identifier expected but 'def' found.
+class E(def x: Int); // the "def x" is illegal
+ ^
+t391.scala:6: error: ':' expected but eof found.
+class E(def x: Int); // the "def x" is illegal
+ ^
+four errors found
diff --git a/tests/untried/neg/t391.scala b/tests/untried/neg/t391.scala
new file mode 100644
index 000000000..08c083baa
--- /dev/null
+++ b/tests/untried/neg/t391.scala
@@ -0,0 +1,6 @@
+trait C {
+ def fun1(def x: Int): Int = x; // the "def x" is illegal
+ def fun2(val x: Int): Int = x; // the "val x" is illegal
+}
+
+class E(def x: Int); // the "def x" is illegal
diff --git a/tests/untried/neg/t3913.check b/tests/untried/neg/t3913.check
new file mode 100644
index 000000000..d85e5c5be
--- /dev/null
+++ b/tests/untried/neg/t3913.check
@@ -0,0 +1,4 @@
+t3913.scala:2: error: super constructor cannot be passed a self reference unless parameter is declared by-name
+object LimboStage extends Stage( Set( LimboStage ))
+ ^
+one error found
diff --git a/tests/untried/neg/t3913.scala b/tests/untried/neg/t3913.scala
new file mode 100644
index 000000000..a5408fe02
--- /dev/null
+++ b/tests/untried/neg/t3913.scala
@@ -0,0 +1,8 @@
+class Stage( val transits: Set[ Stage ])
+object LimboStage extends Stage( Set( LimboStage ))
+
+object Test {
+ def main( args: Array[ String ]): Unit = {
+ val x = LimboStage
+ }
+}
diff --git a/tests/untried/neg/t3934.check b/tests/untried/neg/t3934.check
new file mode 100644
index 000000000..8b06799f0
--- /dev/null
+++ b/tests/untried/neg/t3934.check
@@ -0,0 +1,13 @@
+t3934.scala:15: error: method f2 in class J cannot be accessed in test.J
+ Access to protected method f2 not permitted because
+ enclosing class S1 in package nest is not a subclass of
+ class J in package test where target is defined
+ def g2(x: J) = x.f2()
+ ^
+t3934.scala:20: error: method f2 in class J cannot be accessed in test.J
+ Access to protected method f2 not permitted because
+ prefix type test.J does not conform to
+ class S2 in package nest where the access take place
+ def g2(x: J) = x.f2()
+ ^
+two errors found
diff --git a/tests/untried/neg/t3934.scala b/tests/untried/neg/t3934.scala
new file mode 100644
index 000000000..46e9088af
--- /dev/null
+++ b/tests/untried/neg/t3934.scala
@@ -0,0 +1,23 @@
+package test {
+
+class J {
+ def f1(): Int = { return 5; }
+ protected def f2(): Int = { return 5; }
+}
+
+}
+
+package test {
+package nest {
+
+class S1 {
+ def g1(x: J) = x.f1()
+ def g2(x: J) = x.f2()
+}
+
+class S2 extends J {
+ def g1(x: J) = x.f1()
+ def g2(x: J) = x.f2()
+}
+
+}}
diff --git a/tests/untried/neg/t3971.check b/tests/untried/neg/t3971.check
new file mode 100644
index 000000000..868511987
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t3971.scala b/tests/untried/neg/t3971.scala
new file mode 100644
index 000000000..35f64fde0
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t3977.check b/tests/untried/neg/t3977.check
new file mode 100644
index 000000000..72335a092
--- /dev/null
+++ b/tests/untried/neg/t3977.check
@@ -0,0 +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/tests/untried/neg/t3977.scala b/tests/untried/neg/t3977.scala
new file mode 100644
index 000000000..11a8cdba4
--- /dev/null
+++ b/tests/untried/neg/t3977.scala
@@ -0,0 +1,13 @@
+trait Bool {
+ type If[T]
+}
+
+trait False extends Bool {
+ type If[F] = F
+}
+
+class Field[E, N <: Bool](implicit val w: N#If[E]) {
+ type NoNull = Field[E, False]
+
+ new NoNull
+}
diff --git a/tests/untried/neg/t3987.check b/tests/untried/neg/t3987.check
new file mode 100644
index 000000000..a9f7912b7
--- /dev/null
+++ b/tests/untried/neg/t3987.check
@@ -0,0 +1,7 @@
+t3987.scala:11: error: type mismatch;
+ found : Gox
+ required: Test.GoxZed
+ (which expands to) t#Zed forSome { type t <: Gox }
+ val y: GoxZed = x
+ ^
+one error found
diff --git a/tests/untried/neg/t3987.scala b/tests/untried/neg/t3987.scala
new file mode 100644
index 000000000..1226d8022
--- /dev/null
+++ b/tests/untried/neg/t3987.scala
@@ -0,0 +1,13 @@
+class Gox {
+ object Zed { }
+ class Zed { }
+}
+
+object Test {
+ type GoxZed = t#Zed forSome { type t <: Gox }
+
+ def main(args: Array[String]): Unit = {
+ val x = new Gox
+ val y: GoxZed = x
+ }
+}
diff --git a/tests/untried/neg/t3995.check b/tests/untried/neg/t3995.check
new file mode 100644
index 000000000..00ecf4ca5
--- /dev/null
+++ b/tests/untried/neg/t3995.check
@@ -0,0 +1,6 @@
+t3995.scala:31: error: type mismatch;
+ found : String("")
+ required: _1.F0 where val _1: Lift
+ (new Lift).apply("")
+ ^
+one error found
diff --git a/tests/untried/neg/t3995.scala b/tests/untried/neg/t3995.scala
new file mode 100644
index 000000000..be169639d
--- /dev/null
+++ b/tests/untried/neg/t3995.scala
@@ -0,0 +1,32 @@
+class Lift {
+ def apply(f: F0): Unit = {}
+
+ class F0
+ object F0 {
+ implicit def f2f0(fn: String): F0 = ???
+ }
+}
+
+object Test {
+ val l = new Lift
+ val f = ""
+
+ "": l.F0 // okay
+
+ l.apply("") // okay
+
+ {
+ val l = new Lift
+ l.apply("") // okay
+ }
+
+ // fails trying to mkAttributedQualifier for pre = Skolem(_1 <: Lift with Singletom).F0
+ // should this even have shown up in `companionImplicitMap`? It says that:
+ //
+ // "@return For those parts that refer to classes with companion objects that
+ // can be accessed with unambiguous stable prefixes, the implicits infos
+ // which are members of these companion objects."
+ //
+ // The skolem is stable, but it doen't seem much good to us
+ (new Lift).apply("")
+}
diff --git a/tests/untried/neg/t4044.check b/tests/untried/neg/t4044.check
new file mode 100644
index 000000000..0e1ea4f51
--- /dev/null
+++ b/tests/untried/neg/t4044.check
@@ -0,0 +1,14 @@
+t4044.scala:9: error: AnyRef takes no type parameters, expected: one
+ M[AnyRef] // error, (AnyRef :: *) not kind-conformant to (N :: * -> * -> *)
+ ^
+t4044.scala:11: error: kinds of the type arguments (Test.A) do not conform to the expected kinds of the type parameters (type N).
+Test.A's type parameters do not match type N's expected parameters:
+type _ has no type parameters, but type O has one
+ M[A] // error, (A :: (* -> *) not kind-conformant to (N :: * -> * -> *)
+ ^
+t4044.scala:15: error: kinds of the type arguments (Test.C) do not conform to the expected kinds of the type parameters (type N).
+Test.C's type parameters do not match type N's expected parameters:
+type _ has one type parameter, but type _ has none
+ M[C] // error, (C :: (* -> * -> * -> *) not kind-conformant to (N :: * -> * -> *)
+ ^
+three errors found
diff --git a/tests/untried/neg/t4044.scala b/tests/untried/neg/t4044.scala
new file mode 100644
index 000000000..eeb1d11ac
--- /dev/null
+++ b/tests/untried/neg/t4044.scala
@@ -0,0 +1,16 @@
+object Test {
+ def M[N[O[_]]] = ()
+ type A[_] = Any
+ type B[_[_]] = Any
+ type C[_[_[_]]] = Any
+
+ M[Any] // okay, Any is kind overloaded.
+
+ M[AnyRef] // error, (AnyRef :: *) not kind-conformant to (N :: * -> * -> *)
+
+ M[A] // error, (A :: (* -> *) not kind-conformant to (N :: * -> * -> *)
+
+ M[B] // okay, (B :: (* -> * -> *) is kind-conformant to (N :: * -> * -> *)
+
+ M[C] // error, (C :: (* -> * -> * -> *) not kind-conformant to (N :: * -> * -> *)
+}
diff --git a/tests/untried/neg/t4064.check b/tests/untried/neg/t4064.check
new file mode 100644
index 000000000..0d0e20ded
--- /dev/null
+++ b/tests/untried/neg/t4064.check
@@ -0,0 +1,4 @@
+t4064.scala:4: error: value FALSE is not a member of object Boolean
+ new Foo[Boolean](Boolean.FALSE)
+ ^
+one error found
diff --git a/tests/untried/neg/t4064.scala b/tests/untried/neg/t4064.scala
new file mode 100644
index 000000000..f8cb7848a
--- /dev/null
+++ b/tests/untried/neg/t4064.scala
@@ -0,0 +1,5 @@
+class Foo[T](v: T) {}
+
+object Test {
+ new Foo[Boolean](Boolean.FALSE)
+}
diff --git a/tests/untried/neg/t4069.check b/tests/untried/neg/t4069.check
new file mode 100644
index 000000000..08e937bdf
--- /dev/null
+++ b/tests/untried/neg/t4069.check
@@ -0,0 +1,16 @@
+t4069.scala:7: error: unexpected end of input: possible missing '}' in XML block
+ case 2 =>
+ ^
+t4069.scala:6: error: Missing closing brace `}' assumed here
+ </div>
+ ^
+t4069.scala:9: error: in XML literal: in XML content, please use '}}' to express '}'
+ }
+ ^
+t4069.scala:4: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed <div>
+ <div>
+ ^
+t4069.scala:10: error: '}' expected but eof found.
+}
+ ^
+5 errors found
diff --git a/tests/untried/neg/t4069.scala b/tests/untried/neg/t4069.scala
new file mode 100644
index 000000000..80df6ec16
--- /dev/null
+++ b/tests/untried/neg/t4069.scala
@@ -0,0 +1,10 @@
+object ParserBug {
+ 1 match {
+ case 1 =>
+ <div>
+ { 1 match { case 1 => "1"; case 2 => "2" }
+ </div>
+ case 2 =>
+ <div/>
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t4079.check b/tests/untried/neg/t4079.check
new file mode 100644
index 000000000..f4c956c44
--- /dev/null
+++ b/tests/untried/neg/t4079.check
@@ -0,0 +1,4 @@
+t4079_2.scala:2: error: could not find implicit value for parameter f: Functor[List]
+ Cat.compose[List,Option].Functor
+ ^
+one error found
diff --git a/tests/untried/neg/t4079/t4079_1.scala b/tests/untried/neg/t4079/t4079_1.scala
new file mode 100644
index 000000000..cbae86478
--- /dev/null
+++ b/tests/untried/neg/t4079/t4079_1.scala
@@ -0,0 +1,33 @@
+trait Functor[F[_]] {
+ def map[A,B](fa: F[A], f: A => B): F[B]
+}
+
+trait ComposeT[F[_],G[_]] {
+ type Apply[A] = F[G[A]]
+}
+
+case class Compose[F[_],G[_]]() {
+ def Functor(implicit f: Functor[F], g: Functor[G]): Functor[ComposeT[F,G]#Apply] =
+ new Functor[ComposeT[F,G]#Apply] {
+ def map[A,B](c: ComposeT[F,G]#Apply[A], h: A => B) =
+ f.map(c, (x:G[A]) => g.map(x,h))
+ }
+}
+
+object Cat {
+ def compose[F[_],G[_]] = Compose[F,G]()
+}
+
+object Functors {
+ implicit val List = new Functor[List] {
+ def map[A,B](fa: List[A], f: A => B): List[B] = fa map f
+ }
+ implicit val Option = new Functor[Option] {
+ def map[A,B](fa: Option[A], f: A => B): Option[B] = fa map f
+ }
+}
+
+object Main {
+ import Functors._
+ val cf = Cat.compose[List,Option].Functor
+}
diff --git a/tests/untried/neg/t4079/t4079_2.scala b/tests/untried/neg/t4079/t4079_2.scala
new file mode 100644
index 000000000..9069f0ab4
--- /dev/null
+++ b/tests/untried/neg/t4079/t4079_2.scala
@@ -0,0 +1,3 @@
+object Test {
+ Cat.compose[List,Option].Functor
+}
diff --git a/tests/untried/neg/t409.check b/tests/untried/neg/t409.check
new file mode 100644
index 000000000..0edc0d03c
--- /dev/null
+++ b/tests/untried/neg/t409.check
@@ -0,0 +1,4 @@
+t409.scala:6: error: class Case1 needs to be a trait to be mixed in
+class Toto extends Expr with Case1(12);
+ ^
+one error found
diff --git a/tests/untried/neg/t409.scala b/tests/untried/neg/t409.scala
new file mode 100644
index 000000000..5dac2fdaa
--- /dev/null
+++ b/tests/untried/neg/t409.scala
@@ -0,0 +1,18 @@
+abstract class Expr;
+case class Case1(x: Int) extends Expr;
+case class Case2(x: Int) extends Expr;
+case class Case3(x: Int) extends Expr;
+
+class Toto extends Expr with Case1(12);
+
+object Main {
+ def f(x: Expr): Int = x match {
+ case Case1(x) => x
+ case Case2(x) => x
+ case Case3(x) => x
+ }
+
+ def main(args: Array[String]): Unit = {
+ Console.println(f(new Toto));
+ }
+}
diff --git a/tests/untried/neg/t4091.check b/tests/untried/neg/t4091.check
new file mode 100644
index 000000000..2fdd07fd4
--- /dev/null
+++ b/tests/untried/neg/t4091.check
@@ -0,0 +1,4 @@
+t4091.scala:1: error: expected start of definition
+private a
+ ^
+one error found
diff --git a/tests/untried/neg/t4091.scala b/tests/untried/neg/t4091.scala
new file mode 100644
index 000000000..7df116d5b
--- /dev/null
+++ b/tests/untried/neg/t4091.scala
@@ -0,0 +1,2 @@
+private a
+class b
diff --git a/tests/untried/neg/t4098.check b/tests/untried/neg/t4098.check
new file mode 100644
index 000000000..232c082ec
--- /dev/null
+++ b/tests/untried/neg/t4098.check
@@ -0,0 +1,13 @@
+t4098.scala:3: error: forward reference not allowed from self constructor invocation
+ this(b)
+ ^
+t4098.scala:8: error: forward reference not allowed from self constructor invocation
+ this(b)
+ ^
+t4098.scala:13: error: forward reference not allowed from self constructor invocation
+ this(b)
+ ^
+t4098.scala:18: error: forward reference not allowed from self constructor invocation
+ this(b)
+ ^
+four errors found
diff --git a/tests/untried/neg/t4098.scala b/tests/untried/neg/t4098.scala
new file mode 100644
index 000000000..2e6d16764
--- /dev/null
+++ b/tests/untried/neg/t4098.scala
@@ -0,0 +1,22 @@
+class A(a: Any) {
+ def this() = {
+ this(b)
+ def b = new {}
+ }
+
+ def this(x: Int) = {
+ this(b)
+ lazy val b = new {}
+ }
+
+ def this(x: Int, y: Int) = {
+ this(b)
+ val b = new {}
+ }
+
+ def this(x: Int, y: Int, z: Int) = {
+ this(b)
+ println(".")
+ def b = new {}
+ }
+}
diff --git a/tests/untried/neg/t412.check b/tests/untried/neg/t412.check
new file mode 100644
index 000000000..9cb467e85
--- /dev/null
+++ b/tests/untried/neg/t412.check
@@ -0,0 +1,5 @@
+t412.scala:11: error: stable identifier required, but A.this.c found.
+ Note that value c is not stable because its type, A.this.CX with A.this.C2, is volatile.
+ def castA(x: c.T): T2 = x;
+ ^
+one error found
diff --git a/tests/untried/neg/t412.scala b/tests/untried/neg/t412.scala
new file mode 100644
index 000000000..54cd90da1
--- /dev/null
+++ b/tests/untried/neg/t412.scala
@@ -0,0 +1,31 @@
+object Magic {
+
+ abstract class A[T1,T2]() {
+ trait C { type T; }
+ trait C1 extends C { type T = T1; }
+ trait C2 extends C { type T <: T2; }
+
+ type CX >: Null;
+ val c: CX with C2 = null;
+
+ def castA(x: c.T): T2 = x;
+ }
+
+ class B[T1,T2] extends A[T1,T2]() {
+ type CX = C1;
+
+ def castB(x: T1): T2 = castA(x);
+ }
+
+ def cast[T1,T2](v: T1): T2 =
+ new B[T1,T2]().castB(v)
+
+}
+
+object Test {
+
+ def main(args: Array[String]): Unit = {
+ Magic.cast[String,Exception]("xyz").printStackTrace();
+ }
+
+}
diff --git a/tests/untried/neg/t4134.check b/tests/untried/neg/t4134.check
new file mode 100644
index 000000000..35a1820b0
--- /dev/null
+++ b/tests/untried/neg/t4134.check
@@ -0,0 +1,4 @@
+t4134.scala:22: error: Member method f of mixin trait T2 is missing a concrete super implementation.
+class Konkret extends T3
+ ^
+one error found
diff --git a/tests/untried/neg/t4134.scala b/tests/untried/neg/t4134.scala
new file mode 100644
index 000000000..18f813dd1
--- /dev/null
+++ b/tests/untried/neg/t4134.scala
@@ -0,0 +1,30 @@
+
+
+
+trait T1 {
+ def f: String
+}
+
+trait T2 extends T1 {
+ abstract override def f: String = "goo"
+ def something = super.f // So the "abstract override" is needed
+}
+
+trait Q1 {
+ def f: String = "bippy"
+}
+
+//trait T3 extends Q1 with T2 {
+trait T3 extends T2 with Q1 {
+ abstract override def f: String = super[Q1].f + " " + super[T2].f + " hoo"
+}
+
+class Konkret extends T3
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val k = new Konkret
+ println(k.f)
+ println(k.something)
+ }
+}
diff --git a/tests/untried/neg/t4137.check b/tests/untried/neg/t4137.check
new file mode 100644
index 000000000..9767bdb1c
--- /dev/null
+++ b/tests/untried/neg/t4137.check
@@ -0,0 +1,9 @@
+t4137.scala:9: error: overriding type EPC in trait A, which equals [X1]C[X1];
+ type EPC has incompatible type
+ override type EPC = C[T]
+ ^
+t4137.scala:10: error: overriding type EPC2 in trait A, which equals [X1]C[X1];
+ type EPC2 has incompatible type
+ override type EPC2[X1 <: String] = C[X1]
+ ^
+two errors found
diff --git a/tests/untried/neg/t4137.scala b/tests/untried/neg/t4137.scala
new file mode 100644
index 000000000..60de6de70
--- /dev/null
+++ b/tests/untried/neg/t4137.scala
@@ -0,0 +1,11 @@
+trait C[T]
+
+trait A[T] {
+ type EPC[X1] = C[X1]
+ type EPC2[X1] = C[X1]
+}
+
+trait B[T] extends A[T] {
+ override type EPC = C[T]
+ override type EPC2[X1 <: String] = C[X1]
+}
diff --git a/tests/untried/neg/t414.check b/tests/untried/neg/t414.check
new file mode 100644
index 000000000..30211eef8
--- /dev/null
+++ b/tests/untried/neg/t414.check
@@ -0,0 +1,12 @@
+t414.scala:5: error: pattern type is incompatible with expected type;
+ found : Empty.type
+ required: IntMap[a]
+Note: if you intended to match against the class, try `case Empty()`
+ case Empty =>
+ ^
+t414.scala:7: error: type mismatch;
+ found : Unit
+ required: a
+ case _ =>
+ ^
+two errors found
diff --git a/tests/untried/neg/t414.scala b/tests/untried/neg/t414.scala
new file mode 100644
index 000000000..86646d13c
--- /dev/null
+++ b/tests/untried/neg/t414.scala
@@ -0,0 +1,10 @@
+case class Empty[a]() extends IntMap[a];
+case class Node[a](left: IntMap[a], keyVal: Tuple2[Int, a], right: IntMap[a]) extends IntMap[a];
+abstract class IntMap[a] {
+ def lookup(key: Int): a = this match {
+ case Empty =>
+ sys.error("clef inexistante")
+ case _ =>
+ };
+
+};
diff --git a/tests/untried/neg/t4158.check b/tests/untried/neg/t4158.check
new file mode 100644
index 000000000..af281c52c
--- /dev/null
+++ b/tests/untried/neg/t4158.check
@@ -0,0 +1,7 @@
+t4158.scala:3: error: an expression of type Null is ineligible for implicit conversion
+ var y = null: Int
+ ^
+t4158.scala:2: error: an expression of type Null is ineligible for implicit conversion
+ var x: Int = null
+ ^
+two errors found
diff --git a/tests/untried/neg/t4158.scala b/tests/untried/neg/t4158.scala
new file mode 100644
index 000000000..be3dc4398
--- /dev/null
+++ b/tests/untried/neg/t4158.scala
@@ -0,0 +1,4 @@
+class A {
+ var x: Int = null
+ var y = null: Int
+}
diff --git a/tests/untried/neg/t4163.check b/tests/untried/neg/t4163.check
new file mode 100644
index 000000000..47bc78d31
--- /dev/null
+++ b/tests/untried/neg/t4163.check
@@ -0,0 +1,7 @@
+t4163.scala:4: error: '<-' expected but '=' found.
+ x = 3
+ ^
+t4163.scala:5: error: illegal start of simple expression
+ y <- 0 to 100
+^
+two errors found
diff --git a/tests/untried/neg/t4163.scala b/tests/untried/neg/t4163.scala
new file mode 100644
index 000000000..44686731d
--- /dev/null
+++ b/tests/untried/neg/t4163.scala
@@ -0,0 +1,8 @@
+class Bug {
+ val z = (
+ for {
+ x = 3
+ y <- 0 to 100
+ } yield y
+ ).toArray
+}
diff --git a/tests/untried/neg/t4166.check b/tests/untried/neg/t4166.check
new file mode 100644
index 000000000..10b77d841
--- /dev/null
+++ b/tests/untried/neg/t4166.check
@@ -0,0 +1,4 @@
+t4166.scala:3: error: super constructor arguments cannot reference unconstructed `this`
+class Demo extends Base(new { Demo.this.toString }) {
+ ^
+one error found
diff --git a/tests/untried/neg/t4166.scala b/tests/untried/neg/t4166.scala
new file mode 100644
index 000000000..a2ee0671a
--- /dev/null
+++ b/tests/untried/neg/t4166.scala
@@ -0,0 +1,11 @@
+class Base(a: Any)
+
+class Demo extends Base(new { Demo.this.toString }) {
+ val x: Any = ()
+}
+
+
+class Demo2 extends Base(new { this.toString }) {
+ val x: Any = ()
+}
+
diff --git a/tests/untried/neg/t4174.check b/tests/untried/neg/t4174.check
new file mode 100644
index 000000000..914fcff76
--- /dev/null
+++ b/tests/untried/neg/t4174.check
@@ -0,0 +1,4 @@
+t4174.scala:7: error: method bar overrides nothing
+ foo(new C { override def bar = 1 })
+ ^
+one error found
diff --git a/tests/untried/neg/t4174.scala b/tests/untried/neg/t4174.scala
new file mode 100644
index 000000000..b4a5ab29d
--- /dev/null
+++ b/tests/untried/neg/t4174.scala
@@ -0,0 +1,9 @@
+class C
+
+object Test {
+ def foo(c: C) = 0
+
+ def main(args: Array[String]): Unit = {
+ foo(new C { override def bar = 1 })
+ }
+}
diff --git a/tests/untried/neg/t418.check b/tests/untried/neg/t418.check
new file mode 100644
index 000000000..1b99717b8
--- /dev/null
+++ b/tests/untried/neg/t418.check
@@ -0,0 +1,4 @@
+t418.scala:2: error: not found: value Foo12340771
+ null match { case Foo12340771.Bar(x) => x }
+ ^
+one error found
diff --git a/tests/untried/neg/t418.scala b/tests/untried/neg/t418.scala
new file mode 100644
index 000000000..67007010d
--- /dev/null
+++ b/tests/untried/neg/t418.scala
@@ -0,0 +1,3 @@
+object Test {
+ null match { case Foo12340771.Bar(x) => x }
+}
diff --git a/tests/untried/neg/t4196.check b/tests/untried/neg/t4196.check
new file mode 100644
index 000000000..a0586819e
--- /dev/null
+++ b/tests/untried/neg/t4196.check
@@ -0,0 +1,4 @@
+t4196.scala:5: error: Some[String] does not take parameters
+ }.apply("first param") ("spurious param")
+ ^
+one error found
diff --git a/tests/untried/neg/t4196.scala b/tests/untried/neg/t4196.scala
new file mode 100644
index 000000000..a0ad4db72
--- /dev/null
+++ b/tests/untried/neg/t4196.scala
@@ -0,0 +1,6 @@
+object Weird {
+ { (s: String) =>
+ val foo = Some(s); // to illustrate that vals are printed in the error
+ foo
+ }.apply("first param") ("spurious param")
+}
diff --git a/tests/untried/neg/t421.check b/tests/untried/neg/t421.check
new file mode 100644
index 000000000..dc5fa425a
--- /dev/null
+++ b/tests/untried/neg/t421.check
@@ -0,0 +1,4 @@
+t421.scala:5: error: star patterns must correspond with varargs parameters
+ case Bar("foo",_*) => sys.error("huh?");
+ ^
+one error found
diff --git a/tests/untried/neg/t421.scala b/tests/untried/neg/t421.scala
new file mode 100644
index 000000000..9a327be89
--- /dev/null
+++ b/tests/untried/neg/t421.scala
@@ -0,0 +1,8 @@
+object foo {
+ case class Bar(a:String, b:AnyRef, c:String*);
+
+ Bar("foo","meets","bar") match {
+ case Bar("foo",_*) => sys.error("huh?");
+ }
+
+}
diff --git a/tests/untried/neg/t4217.check b/tests/untried/neg/t4217.check
new file mode 100644
index 000000000..6c49ec335
--- /dev/null
+++ b/tests/untried/neg/t4217.check
@@ -0,0 +1,4 @@
+t4217.scala:2: error: 'case' expected but '}' found.
+ 42 match { }
+ ^
+one error found
diff --git a/tests/untried/neg/t4217.scala b/tests/untried/neg/t4217.scala
new file mode 100644
index 000000000..0817df2cb
--- /dev/null
+++ b/tests/untried/neg/t4217.scala
@@ -0,0 +1,3 @@
+object A extends App {
+ 42 match { }
+}
diff --git a/tests/untried/neg/t4221.check b/tests/untried/neg/t4221.check
new file mode 100644
index 000000000..46c2d10a9
--- /dev/null
+++ b/tests/untried/neg/t4221.check
@@ -0,0 +1,6 @@
+t4221.scala:8: error: type mismatch;
+ found : Unit
+ required: Wrapper[S]
+ def wrap[S <: Cl#Sub[S]](v: S): Wrapper[S] = {
+ ^
+one error found
diff --git a/tests/untried/neg/t4221.scala b/tests/untried/neg/t4221.scala
new file mode 100644
index 000000000..0a8b8add1
--- /dev/null
+++ b/tests/untried/neg/t4221.scala
@@ -0,0 +1,10 @@
+class Cl {
+ class Sub[TheSub <: Sub[TheSub]]
+}
+
+case class Wrapper[T](v: T)
+
+object O {
+ def wrap[S <: Cl#Sub[S]](v: S): Wrapper[S] = {
+ }
+}
diff --git a/tests/untried/neg/t425.check b/tests/untried/neg/t425.check
new file mode 100644
index 000000000..77ea0c5a4
--- /dev/null
+++ b/tests/untried/neg/t425.check
@@ -0,0 +1,4 @@
+t425.scala:3: error: case class B has case ancestor Temp.A, but case-to-case inheritance is prohibited. To overcome this limitation, use extractors to pattern match on non-leaf nodes.
+ case class B(override val x: Int, y: Double) extends A(x)
+ ^
+one error found
diff --git a/tests/untried/neg/t425.scala b/tests/untried/neg/t425.scala
new file mode 100644
index 000000000..e50c50ac3
--- /dev/null
+++ b/tests/untried/neg/t425.scala
@@ -0,0 +1,11 @@
+object Temp{
+ case class A(x: Int)
+ case class B(override val x: Int, y: Double) extends A(x)
+
+ val b: A = B(5, 3.3)
+ b match {
+ case B(x, y) => Console.println(y)
+ case A(x) => Console.println(x)
+ }
+}
+
diff --git a/tests/untried/neg/t4270.check b/tests/untried/neg/t4270.check
new file mode 100644
index 000000000..cfe0a93e0
--- /dev/null
+++ b/tests/untried/neg/t4270.check
@@ -0,0 +1,4 @@
+t4270.scala:5: error: could not find implicit value for parameter e: Int
+ implicitly[Int]
+ ^
+one error found
diff --git a/tests/untried/neg/t4270.scala b/tests/untried/neg/t4270.scala
new file mode 100644
index 000000000..2c7c71d8c
--- /dev/null
+++ b/tests/untried/neg/t4270.scala
@@ -0,0 +1,6 @@
+object Test1 {
+ object A { implicit val x: Int = 1 }
+ import A.x
+ def x: Int = 0
+ implicitly[Int]
+}
diff --git a/tests/untried/neg/t4271.check b/tests/untried/neg/t4271.check
new file mode 100644
index 000000000..91d9fbcfa
--- /dev/null
+++ b/tests/untried/neg/t4271.check
@@ -0,0 +1,10 @@
+t4271.scala:9: error: value to is not a member of Int
+ 3 to 5
+ ^
+t4271.scala:10: error: value ensuring is not a member of Int
+ 5 ensuring true
+ ^
+t4271.scala:11: error: value -> is not a member of Int
+ 3 -> 5
+ ^
+three errors found
diff --git a/tests/untried/neg/t4271.scala b/tests/untried/neg/t4271.scala
new file mode 100644
index 000000000..46ae3ad9e
--- /dev/null
+++ b/tests/untried/neg/t4271.scala
@@ -0,0 +1,12 @@
+object foo {
+ object Donotuseme
+ implicit def Ensuring[A](x: A) = Donotuseme
+ implicit def doubleWrapper(x: Int) = Donotuseme
+ implicit def floatWrapper(x: Int) = Donotuseme
+ implicit def intWrapper(x: Int) = Donotuseme
+ implicit def longWrapper(x: Int) = Donotuseme
+ implicit def ArrowAssoc[A](x: A) = Donotuseme
+ 3 to 5
+ 5 ensuring true
+ 3 -> 5
+}
diff --git a/tests/untried/neg/t4283b.check b/tests/untried/neg/t4283b.check
new file mode 100644
index 000000000..30d03a310
--- /dev/null
+++ b/tests/untried/neg/t4283b.check
@@ -0,0 +1,4 @@
+Test.scala:2: error: Unable to access method f in class AbstractFoo with a super reference.
+ override def f(): Int = super.f()
+ ^
+one error found
diff --git a/tests/untried/neg/t4283b/AbstractFoo.java b/tests/untried/neg/t4283b/AbstractFoo.java
new file mode 100644
index 000000000..7abcd5e76
--- /dev/null
+++ b/tests/untried/neg/t4283b/AbstractFoo.java
@@ -0,0 +1,5 @@
+package test;
+
+/* package private */ class AbstractFoo {
+ public int f() { return 2; }
+}
diff --git a/tests/untried/neg/t4283b/ScalaBipp.scala b/tests/untried/neg/t4283b/ScalaBipp.scala
new file mode 100644
index 000000000..36dea9f4d
--- /dev/null
+++ b/tests/untried/neg/t4283b/ScalaBipp.scala
@@ -0,0 +1,5 @@
+package test
+
+class ScalaBipp extends AbstractFoo {
+ def make: Option[ScalaBipp] = Option(this)
+}
diff --git a/tests/untried/neg/t4283b/Test.scala b/tests/untried/neg/t4283b/Test.scala
new file mode 100644
index 000000000..0dc5636ff
--- /dev/null
+++ b/tests/untried/neg/t4283b/Test.scala
@@ -0,0 +1,3 @@
+object Derived extends test.ScalaBipp {
+ override def f(): Int = super.f()
+}
diff --git a/tests/untried/neg/t4302.check b/tests/untried/neg/t4302.check
new file mode 100644
index 000000000..ea4872927
--- /dev/null
+++ b/tests/untried/neg/t4302.check
@@ -0,0 +1,6 @@
+t4302.scala:2: warning: abstract type T is unchecked since it is eliminated by erasure
+ def hasMatch[T](x: AnyRef) = x.isInstanceOf[T]
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t4302.flags b/tests/untried/neg/t4302.flags
new file mode 100644
index 000000000..779916d58
--- /dev/null
+++ b/tests/untried/neg/t4302.flags
@@ -0,0 +1 @@
+-unchecked -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t4302.scala b/tests/untried/neg/t4302.scala
new file mode 100644
index 000000000..53565f05c
--- /dev/null
+++ b/tests/untried/neg/t4302.scala
@@ -0,0 +1,3 @@
+object Test {
+ def hasMatch[T](x: AnyRef) = x.isInstanceOf[T]
+}
diff --git a/tests/untried/neg/t4417.check b/tests/untried/neg/t4417.check
new file mode 100644
index 000000000..dbd0f1df4
--- /dev/null
+++ b/tests/untried/neg/t4417.check
@@ -0,0 +1,7 @@
+t4417.scala:11: error: constructor Pixel$mcD$sp in class Pixel$mcD$sp cannot be accessed in object Pixel
+ Access to protected constructor Pixel$mcD$sp not permitted because
+ 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/tests/untried/neg/t4417.scala b/tests/untried/neg/t4417.scala
new file mode 100644
index 000000000..3f6ddc815
--- /dev/null
+++ b/tests/untried/neg/t4417.scala
@@ -0,0 +1,17 @@
+
+
+
+
+class Pixel[@specialized T] protected (var v: T)
+
+
+object Pixel {
+ type Pixel1d = Pixel[Double]
+
+ def apply(v: Double): Pixel1d = new Pixel1d(v)
+}
+
+
+
+
+
diff --git a/tests/untried/neg/t4419.check b/tests/untried/neg/t4419.check
new file mode 100644
index 000000000..a53e0c95d
--- /dev/null
+++ b/tests/untried/neg/t4419.check
@@ -0,0 +1,4 @@
+t4419.scala:2: error: forward reference extends over definition of value b
+ { val b = a; val a = 1 ; println(a) }
+ ^
+one error found
diff --git a/tests/untried/neg/t4419.scala b/tests/untried/neg/t4419.scala
new file mode 100644
index 000000000..161593f9b
--- /dev/null
+++ b/tests/untried/neg/t4419.scala
@@ -0,0 +1,3 @@
+class A {
+ { val b = a; val a = 1 ; println(a) }
+}
diff --git a/tests/untried/neg/t4425.check b/tests/untried/neg/t4425.check
new file mode 100644
index 000000000..00006c08f
--- /dev/null
+++ b/tests/untried/neg/t4425.check
@@ -0,0 +1,13 @@
+t4425.scala:3: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: Int)(y: Option[Int]): None.type exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ 42 match { case _ X _ => () }
+ ^
+t4425.scala:8: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: Int)(y: Int): Some[(Int, Int)] exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ 42 match { case _ X _ => () }
+ ^
+t4425.scala:13: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: String)(y: String): Some[(Int, Int)] exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ "" match { case _ X _ => () }
+ ^
+three errors found
diff --git a/tests/untried/neg/t4425.flags b/tests/untried/neg/t4425.flags
new file mode 100644
index 000000000..1182725e8
--- /dev/null
+++ b/tests/untried/neg/t4425.flags
@@ -0,0 +1 @@
+-optimize \ No newline at end of file
diff --git a/tests/untried/neg/t4425.scala b/tests/untried/neg/t4425.scala
new file mode 100644
index 000000000..8feedc20f
--- /dev/null
+++ b/tests/untried/neg/t4425.scala
@@ -0,0 +1,14 @@
+object Foo {
+ object X { def unapply(x : Int)(y : Option[Int] = None) = None }
+ 42 match { case _ X _ => () }
+}
+
+object Foo2 {
+ object X { def unapply(x : Int)(y: Int) = Some((2,2)) }
+ 42 match { case _ X _ => () }
+}
+
+object Foo3 {
+ object X { def unapply(x : String)(y: String) = Some((2,2)) }
+ "" match { case _ X _ => () }
+}
diff --git a/tests/untried/neg/t4425b.check b/tests/untried/neg/t4425b.check
new file mode 100644
index 000000000..8418b4fd1
--- /dev/null
+++ b/tests/untried/neg/t4425b.check
@@ -0,0 +1,49 @@
+t4425b.scala:5: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:6: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:7: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println( "" match { case X(_) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:8: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println((X: Any) match { case X(_) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:9: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:10: error: object X is not a case class, nor does it have an unapply/unapplySeq member
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:18: error: too many patterns for object X: expected 1, found 2
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:19: error: too many patterns for object X: expected 1, found 2
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:22: error: too many patterns for object X: expected 1, found 2
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:23: error: too many patterns for object X: expected 1, found 2
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:31: error: too many patterns for object X offering Nothing: expected 1, found 2
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:32: error: too many patterns for object X offering Nothing: expected 1, found 2
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:35: error: too many patterns for object X offering Nothing: expected 1, found 2
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:36: error: too many patterns for object X offering Nothing: expected 1, found 2
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+14 errors found
diff --git a/tests/untried/neg/t4425b.scala b/tests/untried/neg/t4425b.scala
new file mode 100644
index 000000000..23c4855c7
--- /dev/null
+++ b/tests/untried/neg/t4425b.scala
@@ -0,0 +1,38 @@
+object Test1 {
+ object X { def unapply(x : String)(y: String) = throw new Exception }
+
+ def f1(): Unit = {
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ println( "" match { case X(_) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_) => "ok" ; case _ => "fail" })
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ }
+}
+
+object Test2 {
+ object X { def unapply(x : String) = throw new Exception }
+
+ def f1(): Unit = {
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ println( "" match { case X(_) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_) => "ok" ; case _ => "fail" })
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ }
+}
+
+object Test3 {
+ object X { def unapply(x : String) = None }
+
+ def f1(): Unit = {
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ println( "" match { case X(_) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_) => "ok" ; case _ => "fail" })
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ }
+}
diff --git a/tests/untried/neg/t4431.check b/tests/untried/neg/t4431.check
new file mode 100644
index 000000000..7896ec1a6
--- /dev/null
+++ b/tests/untried/neg/t4431.check
@@ -0,0 +1,7 @@
+t4431.scala:5: error: class BB needs to be abstract, since there is a deferred declaration of method f which is not implemented in a subclass
+ class BB extends B { def f (): Unit }
+ ^
+t4431.scala:8: error: trait cannot redefine final method from class AnyRef
+ trait C { def wait (): Unit }
+ ^
+two errors found
diff --git a/tests/untried/neg/t4431.scala b/tests/untried/neg/t4431.scala
new file mode 100644
index 000000000..5fbb239e0
--- /dev/null
+++ b/tests/untried/neg/t4431.scala
@@ -0,0 +1,16 @@
+object Test {
+ // this works.
+ class B { final def f(): Unit = () }
+ trait A extends B { def f (): Unit }
+ class BB extends B { def f (): Unit }
+
+ // this earns a VerifyError.
+ trait C { def wait (): Unit }
+ class D { }
+
+ def main(args: Array[String]): Unit = {
+ new B with A { }
+ new BB
+// new D with C { }
+ }
+}
diff --git a/tests/untried/neg/t4440.check b/tests/untried/neg/t4440.check
new file mode 100644
index 000000000..10e7188e3
--- /dev/null
+++ b/tests/untried/neg/t4440.check
@@ -0,0 +1,15 @@
+t4440.scala:12: warning: The outer reference in this type test cannot be checked at run time.
+ case _: b.Inner => println("b")
+ ^
+t4440.scala:13: warning: The outer reference in this type test cannot be checked at run time.
+ case _: a.Inner => println("a") // this is the case we want
+ ^
+t4440.scala:16: warning: The outer reference in this type test cannot be checked at run time.
+ case _: a.Inner => println("a")
+ ^
+t4440.scala:17: warning: The outer reference in this type test cannot be checked at run time.
+ case _: b.Inner => println("b") // this is the case we want
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/t4440.flags b/tests/untried/neg/t4440.flags
new file mode 100644
index 000000000..779916d58
--- /dev/null
+++ b/tests/untried/neg/t4440.flags
@@ -0,0 +1 @@
+-unchecked -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t4440.scala b/tests/untried/neg/t4440.scala
new file mode 100644
index 000000000..383b141ed
--- /dev/null
+++ b/tests/untried/neg/t4440.scala
@@ -0,0 +1,19 @@
+// constructors used to drop outer fields when they were not accessed
+// however, how can you know (respecting separate compilation) that they're not accessed!?
+class Outer { final class Inner }
+
+// the matches below require Inner's outer pointer
+// until SI-4440 is fixed properly, we can't make this a run test
+// in principle, the output should be "a\nb", but without outer checks it's "b\na"
+object Test extends App {
+ val a = new Outer
+ val b = new Outer
+ (new a.Inner: Any) match {
+ case _: b.Inner => println("b")
+ case _: a.Inner => println("a") // this is the case we want
+ }
+ (new b.Inner: Any) match {
+ case _: a.Inner => println("a")
+ case _: b.Inner => println("b") // this is the case we want
+ }
+}
diff --git a/tests/untried/neg/t4457_1.check b/tests/untried/neg/t4457_1.check
new file mode 100644
index 000000000..c6b83c6ce
--- /dev/null
+++ b/tests/untried/neg/t4457_1.check
@@ -0,0 +1,7 @@
+t4457_1.scala:27: error: ambiguous reference to overloaded definition,
+both method aFunc in object ImplicitConvAmbiguity2 of type [A](a: ImplicitConvAmbiguity2.NZ[A])ImplicitConvAmbiguity2.AA[Float]
+and method aFunc in object ImplicitConvAmbiguity2 of type [A](a: ImplicitConvAmbiguity2.NE[A])ImplicitConvAmbiguity2.AA[A]
+match argument types (Float)
+ val x = aFunc(4F)
+ ^
+one error found
diff --git a/tests/untried/neg/t4457_1.scala b/tests/untried/neg/t4457_1.scala
new file mode 100644
index 000000000..11dae1097
--- /dev/null
+++ b/tests/untried/neg/t4457_1.scala
@@ -0,0 +1,33 @@
+object ImplicitConvAmbiguity2 {
+
+ class N[T]
+ class NE[T] extends N[T]
+ class NN[T] extends N[T]
+ class NQ[T] extends N[T]
+ class NZ[T] extends N[T]
+ class AA[A]
+ class BB[A]
+
+ implicit def conv1(i: Float) = new NE[Float]
+ implicit def conv3(op: AA[java.util.TooManyListenersException]) = new N[java.util.TooManyListenersException]
+ implicit def conv4(op: AA[Float]) = new N[Float]
+ implicit def conv7(i: Float) = new NZ[Float]
+ implicit def conv5(e: BB[java.util.GregorianCalendar]) = new N[java.util.GregorianCalendar]
+
+ // These two will be in conflict in typeMe1
+ def aFunc[A](a: NE[A]) = new AA[A]
+ def aFunc[A](a: NZ[A]) = new AA[Float]
+
+ def aFunc[A](a: NN[A]) = new BB[A]
+ def aFunc[A](a: NQ[A]) = new BB[A]
+
+ def bFunc[T](e1: N[T]) = {}
+
+ def typeMe1: Unit = {
+ val x = aFunc(4F)
+ bFunc(x)
+ }
+ def typeMe2: Unit = {
+ bFunc(aFunc(4F))
+ }
+}
diff --git a/tests/untried/neg/t4457_2.check b/tests/untried/neg/t4457_2.check
new file mode 100644
index 000000000..770a35539
--- /dev/null
+++ b/tests/untried/neg/t4457_2.check
@@ -0,0 +1,13 @@
+t4457_2.scala:27: error: ambiguous reference to overloaded definition,
+both method aFunc in object ImplicitConvAmbiguity2 of type [A](a: ImplicitConvAmbiguity2.NZ[A])ImplicitConvAmbiguity2.AA[A]
+and method aFunc in object ImplicitConvAmbiguity2 of type [A](a: ImplicitConvAmbiguity2.NE[A])ImplicitConvAmbiguity2.AA[A]
+match argument types (Float)
+ val x = aFunc(4F)
+ ^
+t4457_2.scala:31: error: ambiguous reference to overloaded definition,
+both method aFunc in object ImplicitConvAmbiguity2 of type [A](a: ImplicitConvAmbiguity2.NZ[A])ImplicitConvAmbiguity2.AA[A]
+and method aFunc in object ImplicitConvAmbiguity2 of type [A](a: ImplicitConvAmbiguity2.NE[A])ImplicitConvAmbiguity2.AA[A]
+match argument types (Float)
+ bFunc(aFunc(4F))
+ ^
+two errors found
diff --git a/tests/untried/neg/t4457_2.scala b/tests/untried/neg/t4457_2.scala
new file mode 100644
index 000000000..f2664cc14
--- /dev/null
+++ b/tests/untried/neg/t4457_2.scala
@@ -0,0 +1,33 @@
+object ImplicitConvAmbiguity2 {
+
+ class N[T]
+ class NE[T] extends N[T]
+ class NN[T] extends N[T]
+ class NQ[T] extends N[T]
+ class NZ[T] extends N[T]
+ class AA[A]
+ class BB[A]
+
+ implicit def conv1(i: Float) = new NE[Float]
+ implicit def conv3(op: AA[java.util.TooManyListenersException]) = new N[java.util.TooManyListenersException]
+ implicit def conv4(op: AA[Float]) = new N[Float]
+ implicit def conv7(i: Float) = new NZ[Float]
+ implicit def conv5(e: BB[java.util.GregorianCalendar]) = new N[java.util.GregorianCalendar]
+
+ def aFunc[A](a: NE[A]) = new AA[A]
+ def aFunc[A](a: NZ[A]) = new AA[A]
+
+ def aFunc[A](a: NN[A]) = new BB[A]
+
+ def aFunc[A](a: NQ[A]) = new BB[A]
+
+ def bFunc[T](e1: N[T]) = {}
+
+ def typeMe2: Unit = {
+ val x = aFunc(4F)
+ bFunc(x)
+ }
+ def typeMe1: Unit = {
+ bFunc(aFunc(4F))
+ }
+}
diff --git a/tests/untried/neg/t4460a.check b/tests/untried/neg/t4460a.check
new file mode 100644
index 000000000..b711e7acb
--- /dev/null
+++ b/tests/untried/neg/t4460a.check
@@ -0,0 +1,4 @@
+t4460a.scala:6: error: called constructor's definition must precede calling constructor's definition
+ def this() = this() // was binding to Predef.<init> !!
+ ^
+one error found
diff --git a/tests/untried/neg/t4460a.scala b/tests/untried/neg/t4460a.scala
new file mode 100644
index 000000000..0a7a22178
--- /dev/null
+++ b/tests/untried/neg/t4460a.scala
@@ -0,0 +1,7 @@
+trait A
+
+class B(val x: Int) {
+ self: A =>
+
+ def this() = this() // was binding to Predef.<init> !!
+}
diff --git a/tests/untried/neg/t4460b.check b/tests/untried/neg/t4460b.check
new file mode 100644
index 000000000..f0e703fd1
--- /dev/null
+++ b/tests/untried/neg/t4460b.check
@@ -0,0 +1,4 @@
+t4460b.scala:7: error: called constructor's definition must precede calling constructor's definition
+ def this() = this() // was binding to Predef.<init> !!
+ ^
+one error found
diff --git a/tests/untried/neg/t4460b.scala b/tests/untried/neg/t4460b.scala
new file mode 100644
index 000000000..1233017dd
--- /dev/null
+++ b/tests/untried/neg/t4460b.scala
@@ -0,0 +1,9 @@
+trait A
+
+class Outer() {
+ class B(val x: Int) {
+ self: A =>
+
+ def this() = this() // was binding to Predef.<init> !!
+ }
+}
diff --git a/tests/untried/neg/t4460c.check b/tests/untried/neg/t4460c.check
new file mode 100644
index 000000000..4e96711b8
--- /dev/null
+++ b/tests/untried/neg/t4460c.check
@@ -0,0 +1,7 @@
+t4460c.scala:4: error: overloaded method constructor B with alternatives:
+ (a: String)B <and>
+ (x: Int)B
+ cannot be applied to ()
+ def this(a: String) = this()
+ ^
+one error found
diff --git a/tests/untried/neg/t4460c.scala b/tests/untried/neg/t4460c.scala
new file mode 100644
index 000000000..1ae258508
--- /dev/null
+++ b/tests/untried/neg/t4460c.scala
@@ -0,0 +1,7 @@
+class B(val x: Int) {
+ self: A =>
+
+ def this(a: String) = this()
+}
+
+class A()
diff --git a/tests/untried/neg/t4515.check b/tests/untried/neg/t4515.check
new file mode 100644
index 000000000..708fcfbd2
--- /dev/null
+++ b/tests/untried/neg/t4515.check
@@ -0,0 +1,16 @@
+t4515.scala:37: error: type mismatch;
+ found : _$1 where type _$1
+ required: _$2
+ handler.onEvent(target, ctx.getEvent, node, ctx)
+ ^
+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/tests/untried/neg/t4515.scala b/tests/untried/neg/t4515.scala
new file mode 100644
index 000000000..8965b9686
--- /dev/null
+++ b/tests/untried/neg/t4515.scala
@@ -0,0 +1,41 @@
+import scala.collection.mutable.HashMap
+
+object Main {
+ trait Target { }
+
+ trait PushEventContext[EventType] {
+ def getEvent: EventType
+ }
+ trait PushNode[EventType] { }
+ trait DerivedPushNode[EventType] extends PushNode[EventType] { }
+
+ trait HandlerBase[EventType] {
+ def onEvent(target: Target,
+ event: EventType,
+ node: PushNode[EventType],
+ ctx: PushEventContext[EventType]): Unit
+ }
+ val handlers = new HashMap[DerivedPushNode[_], HandlerBase[_]]
+
+ object TimerPushService {
+ private val INSTANCE: TimerPushService = new TimerPushService
+ def get: TimerPushService = INSTANCE
+ }
+
+ class TimerPushService {
+ def add[EventType](node: DerivedPushNode[EventType],
+ context: PushEventContext[EventType]): Unit = {}
+
+ def pollEvents[EventType](node: DerivedPushNode[EventType]): List[PushEventContext[EventType]] =
+ Nil
+ }
+
+ def onTimer(target: Target): Unit = {
+ val pushService = TimerPushService.get
+ for ((node, handler) <- handlers) {
+ for (ctx <- pushService.pollEvents(node)) {
+ handler.onEvent(target, ctx.getEvent, node, ctx)
+ }
+ }
+ }
+}
diff --git a/tests/untried/neg/t452.check b/tests/untried/neg/t452.check
new file mode 100644
index 000000000..aac663068
--- /dev/null
+++ b/tests/untried/neg/t452.check
@@ -0,0 +1,6 @@
+t452.scala:3: error: type mismatch;
+ found : Test.type
+ required: Test.Foo
+ def this() = this(this);
+ ^
+one error found
diff --git a/tests/untried/neg/t452.scala b/tests/untried/neg/t452.scala
new file mode 100644
index 000000000..855406d0c
--- /dev/null
+++ b/tests/untried/neg/t452.scala
@@ -0,0 +1,8 @@
+object Test {
+ class Foo(x: Foo) {
+ def this() = this(this);
+ }
+ def main(args: Array[String]): Unit = {
+ new Foo();
+ }
+}
diff --git a/tests/untried/neg/t4541.check b/tests/untried/neg/t4541.check
new file mode 100644
index 000000000..7bd8ff78f
--- /dev/null
+++ b/tests/untried/neg/t4541.check
@@ -0,0 +1,7 @@
+t4541.scala:11: error: variable data in class Sparse cannot be accessed in Sparse[Int]
+ Access to protected method data not permitted because
+ prefix type Sparse[Int] does not conform to
+ class Sparse$mcI$sp where the access take place
+ that.data
+ ^
+one error found
diff --git a/tests/untried/neg/t4541.scala b/tests/untried/neg/t4541.scala
new file mode 100644
index 000000000..744af1c28
--- /dev/null
+++ b/tests/untried/neg/t4541.scala
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+@SerialVersionUID(1L)
+final class Sparse[@specialized(Int) T](d: Array[T]) extends Serializable {
+ protected var data: Array[T] = d
+ def set(that: Sparse[T]) = {
+ that.data
+ }
+}
+
+
+
diff --git a/tests/untried/neg/t4541b.check b/tests/untried/neg/t4541b.check
new file mode 100644
index 000000000..8a52fd97f
--- /dev/null
+++ b/tests/untried/neg/t4541b.check
@@ -0,0 +1,7 @@
+t4541b.scala:13: error: variable data in class SparseArray cannot be accessed in SparseArray[Int]
+ Access to protected method data not permitted because
+ prefix type SparseArray[Int] does not conform to
+ class SparseArray$mcI$sp where the access take place
+ use(that.data.clone)
+ ^
+one error found
diff --git a/tests/untried/neg/t4541b.scala b/tests/untried/neg/t4541b.scala
new file mode 100644
index 000000000..ba406cad6
--- /dev/null
+++ b/tests/untried/neg/t4541b.scala
@@ -0,0 +1,16 @@
+
+
+
+
+
+@SerialVersionUID(1L)
+final class SparseArray[@specialized(Int) T](private var data: Array[T]) extends Serializable {
+ def use(inData: Array[T]) = {
+ data = inData;
+ }
+
+ def set(that: SparseArray[T]) = {
+ use(that.data.clone)
+ }
+}
+
diff --git a/tests/untried/neg/t4568.check b/tests/untried/neg/t4568.check
new file mode 100644
index 000000000..f94d69948
--- /dev/null
+++ b/tests/untried/neg/t4568.check
@@ -0,0 +1,4 @@
+t4568.scala:8: error: recursive method isSubListOf needs result type
+ case h :: t => y.contains(h) && (t.isSubListOf(y.drop(y.indexOf(h) + 1)))
+ ^
+one error found
diff --git a/tests/untried/neg/t4568.scala b/tests/untried/neg/t4568.scala
new file mode 100644
index 000000000..6fda28736
--- /dev/null
+++ b/tests/untried/neg/t4568.scala
@@ -0,0 +1,13 @@
+object SubList {
+ implicit def sublistable[A](x: List[A]) = new SubListable(x)
+
+ class SubListable[A](x: List[A]) {
+ def isSubListOf(y: List[A]) = {
+ x match {
+ case Nil => true
+ case h :: t => y.contains(h) && (t.isSubListOf(y.drop(y.indexOf(h) + 1)))
+ }
+ }
+ }
+
+}
diff --git a/tests/untried/neg/t4584.check b/tests/untried/neg/t4584.check
new file mode 100644
index 000000000..97d07afa0
--- /dev/null
+++ b/tests/untried/neg/t4584.check
@@ -0,0 +1,7 @@
+t4584.scala:1: error: error in unicode escape
+class A { val \u2
+ ^
+t4584.scala:1: error: illegal character '\uffff'
+class A { val \u2
+ ^
+two errors found
diff --git a/tests/untried/neg/t4584.scala b/tests/untried/neg/t4584.scala
new file mode 100644
index 000000000..b34aba91a
--- /dev/null
+++ b/tests/untried/neg/t4584.scala
@@ -0,0 +1 @@
+class A { val \u2 \ No newline at end of file
diff --git a/tests/untried/neg/t464-neg.check b/tests/untried/neg/t464-neg.check
new file mode 100644
index 000000000..e822e7fb6
--- /dev/null
+++ b/tests/untried/neg/t464-neg.check
@@ -0,0 +1,16 @@
+t464-neg.scala:7: error: not found: value f1
+ f1()
+ ^
+t464-neg.scala:8: error: method f1 in class A cannot be accessed in A
+ super.f1()
+ ^
+t464-neg.scala:9: error: value f2 is not a member of B
+ def otherb(b2: B) = b2.f2()
+ ^
+t464-neg.scala:10: error: method f3 in class A cannot be accessed in B
+ f3()
+ ^
+t464-neg.scala:11: error: method f3 in class A cannot be accessed in A
+ super.f3()
+ ^
+5 errors found
diff --git a/tests/untried/neg/t464-neg.scala b/tests/untried/neg/t464-neg.scala
new file mode 100644
index 000000000..c2f027a21
--- /dev/null
+++ b/tests/untried/neg/t464-neg.scala
@@ -0,0 +1,12 @@
+class A {
+ private[this] def f1(): Unit = {}
+ protected[this] def f2(): Unit = {}
+ private[A] def f3(): Unit = {}
+}
+class B extends A {
+ f1()
+ super.f1()
+ def otherb(b2: B) = b2.f2()
+ f3()
+ super.f3()
+}
diff --git a/tests/untried/neg/t4691_exhaust_extractor.check b/tests/untried/neg/t4691_exhaust_extractor.check
new file mode 100644
index 000000000..639694414
--- /dev/null
+++ b/tests/untried/neg/t4691_exhaust_extractor.check
@@ -0,0 +1,15 @@
+t4691_exhaust_extractor.scala:17: warning: match may not be exhaustive.
+It would fail on the following input: Bar3()
+ def f1(x: Foo) = x match {
+ ^
+t4691_exhaust_extractor.scala:23: warning: match may not be exhaustive.
+It would fail on the following input: Bar3()
+ def f2(x: Foo) = x match {
+ ^
+t4691_exhaust_extractor.scala:29: warning: match may not be exhaustive.
+It would fail on the following input: Bar3()
+ def f3(x: Foo) = x match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t4691_exhaust_extractor.flags b/tests/untried/neg/t4691_exhaust_extractor.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t4691_exhaust_extractor.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t4691_exhaust_extractor.scala b/tests/untried/neg/t4691_exhaust_extractor.scala
new file mode 100644
index 000000000..25b64186d
--- /dev/null
+++ b/tests/untried/neg/t4691_exhaust_extractor.scala
@@ -0,0 +1,33 @@
+sealed trait Foo
+class Bar1 extends Foo
+class Bar2 extends Foo
+class Bar3 extends Foo
+
+// these extractors are known to always succeed as they return a Some
+object Baz1 {
+ def unapply(x: Bar1): Some[Int] = Some(1)
+}
+object Baz2 {
+ def unapply(x: Bar2): Some[Int] = Some(2)
+}
+
+
+object Test {
+ // warning: missing Bar3
+ def f1(x: Foo) = x match {
+ case _: Bar1 => 1
+ case _: Bar2 => 2
+ }
+
+ // warning: missing Bar3
+ def f2(x: Foo) = x match {
+ case _: Bar1 => 1
+ case Baz2(x) => x
+ }
+
+ // warning: missing Bar3
+ def f3(x: Foo) = x match {
+ case Baz1(x) => x
+ case Baz2(x) => x
+ }
+}
diff --git a/tests/untried/neg/t4727.check b/tests/untried/neg/t4727.check
new file mode 100644
index 000000000..a17cdde04
--- /dev/null
+++ b/tests/untried/neg/t4727.check
@@ -0,0 +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/tests/untried/neg/t4727.scala b/tests/untried/neg/t4727.scala
new file mode 100644
index 000000000..40c06713c
--- /dev/null
+++ b/tests/untried/neg/t4727.scala
@@ -0,0 +1,7 @@
+class C[T](x : T = null)
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ new C[Int]
+ }
+}
diff --git a/tests/untried/neg/t4728.check b/tests/untried/neg/t4728.check
new file mode 100644
index 000000000..c6ef182d3
--- /dev/null
+++ b/tests/untried/neg/t4728.check
@@ -0,0 +1,7 @@
+t4728.scala:10: error: ambiguous reference to overloaded definition,
+both method f in object Ambiguous of type (ys: Y*)Int
+and method f in object Ambiguous of type (x: X)Int
+match argument types (Y) and expected result type Any
+ println(Ambiguous.f(new Y))
+ ^
+one error found
diff --git a/tests/untried/neg/t4728.scala b/tests/untried/neg/t4728.scala
new file mode 100644
index 000000000..83d3fc7c2
--- /dev/null
+++ b/tests/untried/neg/t4728.scala
@@ -0,0 +1,11 @@
+class X
+class Y extends X
+object Ambiguous {
+ def f(x: X) = 1
+ def f(ys: Y*) = 2
+}
+
+object Test extends App {
+ println(Ambiguous.f(new X))
+ println(Ambiguous.f(new Y))
+}
diff --git a/tests/untried/neg/t473.check b/tests/untried/neg/t473.check
new file mode 100644
index 000000000..a14222c96
--- /dev/null
+++ b/tests/untried/neg/t473.check
@@ -0,0 +1,4 @@
+t473.scala:3: error: super constructor cannot be passed a self reference unless parameter is declared by-name
+case object Voop extends Foo(Voop)
+ ^
+one error found
diff --git a/tests/untried/neg/t473.scala b/tests/untried/neg/t473.scala
new file mode 100644
index 000000000..c7631705a
--- /dev/null
+++ b/tests/untried/neg/t473.scala
@@ -0,0 +1,3 @@
+class Foo(x: Foo)
+case object Bar extends Foo(null)
+case object Voop extends Foo(Voop)
diff --git a/tests/untried/neg/t4749.check b/tests/untried/neg/t4749.check
new file mode 100644
index 000000000..353914095
--- /dev/null
+++ b/tests/untried/neg/t4749.check
@@ -0,0 +1,34 @@
+t4749.scala:2: warning: Fail1 has a main method with parameter type Array[String], but bippy.Fail1 will not be a runnable program.
+ Reason: main method must have exact signature (Array[String])Unit
+ object Fail1 {
+ ^
+t4749.scala:6: warning: Fail2 has a main method with parameter type Array[String], but bippy.Fail2 will not be a runnable program.
+ Reason: main methods cannot be generic.
+ object Fail2 {
+ ^
+t4749.scala:13: warning: Fail3 has a main method with parameter type Array[String], but bippy.Fail3 will not be a runnable program.
+ Reason: main methods cannot refer to type parameters or abstract types.
+ object Fail3 extends Bippy[Unit] { }
+ ^
+t4749.scala:16: warning: Fail4 has a main method with parameter type Array[String], but bippy.Fail4 will not be a runnable program.
+ Reason: companion is a trait, which means no static forwarder can be generated.
+
+ object Fail4 {
+ ^
+t4749.scala:21: warning: Fail5 has a main method with parameter type Array[String], but bippy.Fail5 will not be a runnable program.
+ Reason: companion contains its own main method, which means no static forwarder can be generated.
+
+ object Fail5 extends Fail5 { }
+ ^
+t4749.scala:26: warning: Fail6 has a main method with parameter type Array[String], but bippy.Fail6 will not be a runnable program.
+ Reason: companion contains its own main method (implementation restriction: no main is allowed, regardless of signature), which means no static forwarder can be generated.
+
+ object Fail6 {
+ ^
+t4749.scala:42: warning: Win3 has a main method with parameter type Array[String], but bippy.Win3 will not be a runnable program.
+ Reason: main method must have exact signature (Array[String])Unit
+ object Win3 extends WinBippy[Unit] { }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+7 warnings found
+one error found
diff --git a/tests/untried/neg/t4749.flags b/tests/untried/neg/t4749.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t4749.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t4749.scala b/tests/untried/neg/t4749.scala
new file mode 100644
index 000000000..2c67e2ea9
--- /dev/null
+++ b/tests/untried/neg/t4749.scala
@@ -0,0 +1,44 @@
+package bippy {
+ object Fail1 {
+ def main(args: Array[String]): Any = ()
+ }
+
+ object Fail2 {
+ def main[T](args: Array[String]): T = null.asInstanceOf[T]
+ }
+
+ abstract class Bippy[T] {
+ def main(args: Array[String]): T = null.asInstanceOf[T]
+ }
+ object Fail3 extends Bippy[Unit] { }
+
+
+ object Fail4 {
+ def main(args: Array[String]): Unit = ()
+ }
+ trait Fail4 { }
+
+ object Fail5 extends Fail5 { }
+ class Fail5 {
+ def main(args: Array[String]): Unit = ()
+ }
+
+ object Fail6 {
+ def main(args: Array[String]): Unit = ()
+ }
+ class Fail6 {
+ def main = "bippy"
+ }
+
+ object Win1 {
+ def main(args: Array[String]): Unit = ()
+ }
+ object Win2 extends Bippy[Unit] {
+ override def main(args: Array[String]): Unit = ()
+ }
+ trait WinBippy[T] {
+ def main(args: Array[String]): T = null.asInstanceOf[T]
+ }
+ object Win3 extends WinBippy[Unit] { }
+}
+
diff --git a/tests/untried/neg/t4762.check b/tests/untried/neg/t4762.check
new file mode 100644
index 000000000..a0525f622
--- /dev/null
+++ b/tests/untried/neg/t4762.check
@@ -0,0 +1,9 @@
+t4762.scala:15: warning: private[this] value x in class B shadows mutable x inherited from class A. Changes to x will not be visible within class B - you may want to give them distinct names.
+ /* (99,99) */ (this.x, this.y),
+ ^
+t4762.scala:48: warning: private[this] value x in class Derived shadows mutable x inherited from class Base. Changes to x will not be visible within class Derived - you may want to give them distinct names.
+ class Derived( x : Int ) extends Base( x ) { override def toString = x.toString }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/t4762.flags b/tests/untried/neg/t4762.flags
new file mode 100644
index 000000000..e93641e93
--- /dev/null
+++ b/tests/untried/neg/t4762.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t4762.scala b/tests/untried/neg/t4762.scala
new file mode 100644
index 000000000..07b3152a6
--- /dev/null
+++ b/tests/untried/neg/t4762.scala
@@ -0,0 +1,51 @@
+// https://issues.scala-lang.org/browse/SI-4762
+
+// In A, x and y are -1.
+class A(var x: Int) {
+ val y: Int = -1
+}
+
+// In B, x and y are 99 and private[this], implicitly so
+// in the case of x.
+class B(x: Int) extends A(-1) {
+ private[this] def y: Int = 99
+
+ // Three distinct results.
+ def f = List(
+ /* (99,99) */ (this.x, this.y),
+ /* (-1,99) */ ((this: B).x, (this: B).y),
+ /* (-1,-1) */ ((this: A).x, (this: A).y)
+ )
+
+ // The 99s tell us we are reading the private[this]
+ // data of a different instance.
+ def g(b: B) = List(
+ /* (-1,99) */ (b.x, b.y),
+ /* (-1,99) */ ((b: B).x, (b: B).y),
+ /* (-1,-1) */ ((b: A).x, (b: A).y)
+ )
+}
+
+object Test {
+ def f(x: A) = /* -2 */ x.x + x.y
+ def g1(x: B) = /* -2 */ (x: A).x + (x: A).y
+ def g2(x: B) = (x: B).x + (x: B).y
+ // java.lang.IllegalAccessError: tried to access method B.y()I from class Test$
+
+ def main(args: Array[String]): Unit = {
+ val b = new B(99)
+ b.f foreach println
+ b.g(new B(99)) foreach println
+
+ println(f(b))
+ println(g1(b))
+ println(g2(b))
+ }
+}
+
+class bug4762 {
+ class Base( var x : Int ) { def increment(): Unit = { x = x + 1 } }
+ class Derived( x : Int ) extends Base( x ) { override def toString = x.toString }
+
+ val derived = new Derived( 1 )
+}
diff --git a/tests/untried/neg/t4818.check b/tests/untried/neg/t4818.check
new file mode 100644
index 000000000..a5e15e456
--- /dev/null
+++ b/tests/untried/neg/t4818.check
@@ -0,0 +1,6 @@
+t4818.scala:4: error: type mismatch;
+ found : Int(5)
+ required: Nothing
+ def f(x: Any) = x match { case Fn(f) => f(5) }
+ ^
+one error found
diff --git a/tests/untried/neg/t4818.scala b/tests/untried/neg/t4818.scala
new file mode 100644
index 000000000..faae22920
--- /dev/null
+++ b/tests/untried/neg/t4818.scala
@@ -0,0 +1,7 @@
+object Test {
+ case class Fn[A, B](f: A => B)
+
+ def f(x: Any) = x match { case Fn(f) => f(5) }
+
+ Fn((x: String) => x)
+}
diff --git a/tests/untried/neg/t4831.check b/tests/untried/neg/t4831.check
new file mode 100644
index 000000000..3b8b836f0
--- /dev/null
+++ b/tests/untried/neg/t4831.check
@@ -0,0 +1,7 @@
+t4831.scala:10: error: reference to b is ambiguous;
+it is imported twice in the same scope by
+import O.b
+and import O.{a=>b}
+ println(b)
+ ^
+one error found
diff --git a/tests/untried/neg/t4831.scala b/tests/untried/neg/t4831.scala
new file mode 100644
index 000000000..82346ec57
--- /dev/null
+++ b/tests/untried/neg/t4831.scala
@@ -0,0 +1,11 @@
+object O {
+ val a = 0
+ val b = 1
+}
+
+import O.{a => b}
+import O.b
+
+object test {
+ println(b)
+}
diff --git a/tests/untried/neg/t4842.check b/tests/untried/neg/t4842.check
new file mode 100644
index 000000000..b53bbdbd1
--- /dev/null
+++ b/tests/untried/neg/t4842.check
@@ -0,0 +1,7 @@
+t4842.scala:2: error: self constructor arguments cannot reference unconstructed `this`
+ def this(x: Int) = this(new { println(Foo.this)}) // error
+ ^
+t4842.scala:6: error: self constructor arguments cannot reference unconstructed `this`
+ def this() = { this(???)(new { println(TypeArg.this.x) } ); println("next") } // error
+ ^
+two errors found
diff --git a/tests/untried/neg/t4842.scala b/tests/untried/neg/t4842.scala
new file mode 100644
index 000000000..c6244efda
--- /dev/null
+++ b/tests/untried/neg/t4842.scala
@@ -0,0 +1,7 @@
+class Foo (x: AnyRef) {
+ def this(x: Int) = this(new { println(Foo.this)}) // error
+}
+
+class TypeArg[X](val x: X)(a: AnyRef) {
+ def this() = { this(???)(new { println(TypeArg.this.x) } ); println("next") } // error
+}
diff --git a/tests/untried/neg/t4851.check b/tests/untried/neg/t4851.check
new file mode 100644
index 000000000..132dd91b5
--- /dev/null
+++ b/tests/untried/neg/t4851.check
@@ -0,0 +1,51 @@
+S.scala:2: warning: Adaptation of argument list by inserting () has been deprecated: leaky (Object-receiving) target makes this especially dangerous.
+ signature: J(x: Any): J
+ given arguments: <none>
+ after adaptation: new J((): Unit)
+ val x1 = new J
+ ^
+S.scala:3: warning: Adaptation of argument list by inserting () has been deprecated: 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
+ after adaptation: Some((1, 2, 3): (Int, Int, Int))
+ val y1 = Some(1, 2, 3)
+ ^
+S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not be what you want.
+ signature: Some(x: A): Some[A]
+ 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: Adaptation of argument list by inserting () has been deprecated: 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: Adaptation of argument list by inserting () has been deprecated: 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
+ after adaptation: Test.anyId((1, 2, 3): (Int, Int, Int))
+ val w1 = anyId(1, 2 ,3)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+8 warnings found
+one error found
diff --git a/tests/untried/neg/t4851.flags b/tests/untried/neg/t4851.flags
new file mode 100644
index 000000000..ca0d0a0ba
--- /dev/null
+++ b/tests/untried/neg/t4851.flags
@@ -0,0 +1 @@
+-Ywarn-adapted-args -Xfatal-warnings -deprecation
diff --git a/tests/untried/neg/t4851/J.java b/tests/untried/neg/t4851/J.java
new file mode 100644
index 000000000..9c35b8a16
--- /dev/null
+++ b/tests/untried/neg/t4851/J.java
@@ -0,0 +1,15 @@
+public class J {
+ Object x;
+
+ public J(Object x) {
+ this.x = x;
+ }
+
+ public J(int x1, int x2, int x3, int x4, int x5, int x6) {
+ this.x = null;
+ }
+
+ public String toString() {
+ return "J:" + x.getClass();
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t4851/J2.java b/tests/untried/neg/t4851/J2.java
new file mode 100644
index 000000000..82954d948
--- /dev/null
+++ b/tests/untried/neg/t4851/J2.java
@@ -0,0 +1,11 @@
+public class J2<T> {
+ T x;
+
+ public <T> J(T x) {
+ this.x = x;
+ }
+
+ public String toString() {
+ return "J2:" + x.getClass();
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t4851/S.scala b/tests/untried/neg/t4851/S.scala
new file mode 100644
index 000000000..779ba376b
--- /dev/null
+++ b/tests/untried/neg/t4851/S.scala
@@ -0,0 +1,28 @@
+object Test {
+ val x1 = new J
+ val x2 = new J()
+ val x3 = new J(1, 2, 3, 4, 5)
+
+ val y1 = Some(1, 2, 3)
+ val y2 = new Some(1, 2, 3)
+
+ val z1 = new J2
+ val z2 = new J2()
+ val z3 = new J2(())
+
+ def anyId(a: Any) = a
+ val w1 = anyId(1, 2 ,3)
+
+ def main(args: Array[String]): Unit = {
+ println(x1)
+ println(x2)
+ println(x3)
+ println(y1)
+
+ println(z1)
+ println(z2)
+ println(z3)
+
+ println(w1)
+ }
+}
diff --git a/tests/untried/neg/t4877.check b/tests/untried/neg/t4877.check
new file mode 100644
index 000000000..5a2413ca8
--- /dev/null
+++ b/tests/untried/neg/t4877.check
@@ -0,0 +1,22 @@
+t4877.scala:4: error: type mismatch;
+ found : AnyRef{def bar: Int}
+ required: AnyRef{def bar: String}
+ def foo: AnyRef { def bar: String } = new AnyRef { def bar = 42 }
+ ^
+t4877.scala:6: error: type mismatch;
+ found : AnyRef{def bar(x: Int): String}
+ required: AnyRef{def bar(x: Int): Int}
+ def foo3: AnyRef { def bar(x: Int): Int } = new AnyRef { def bar(x: Int) = "abc" }
+ ^
+t4877.scala:7: error: type mismatch;
+ found : C{def bar(x: Int): Int}
+ required: C{def bar(x: Int): Int; def quux(x: Int): Int}
+ def foo4: C { def bar(x: Int): Int ; def quux(x: Int): Int } = new C { def bar(x: Int) = 5 }
+ ^
+t4877.scala:17: error: type mismatch;
+ found : AnyRef{type Mom = String; def bar(x: Int): Int; def bippy(): List[Int]}
+ required: B.this.Bippy
+ (which expands to) AnyRef{type Mom; def bar(x: Int): this.Mom; def bippy(): List[this.Mom]}
+ val x: Bippy = new AnyRef {
+ ^
+four errors found
diff --git a/tests/untried/neg/t4877.flags b/tests/untried/neg/t4877.flags
new file mode 100644
index 000000000..7ccd56103
--- /dev/null
+++ b/tests/untried/neg/t4877.flags
@@ -0,0 +1 @@
+-Xlint \ No newline at end of file
diff --git a/tests/untried/neg/t4877.scala b/tests/untried/neg/t4877.scala
new file mode 100644
index 000000000..8968a8a8f
--- /dev/null
+++ b/tests/untried/neg/t4877.scala
@@ -0,0 +1,22 @@
+trait C { }
+
+class A {
+ def foo: AnyRef { def bar: String } = new AnyRef { def bar = 42 }
+ def foo2: AnyRef { def bar: String } = new AnyRef { def bar = "abc" }
+ def foo3: AnyRef { def bar(x: Int): Int } = new AnyRef { def bar(x: Int) = "abc" }
+ def foo4: C { def bar(x: Int): Int ; def quux(x: Int): Int } = new C { def bar(x: Int) = 5 }
+}
+
+class B {
+ type Bippy = {
+ type Mom
+ def bar(x: Int): Mom
+ def bippy(): List[Mom]
+ }
+
+ val x: Bippy = new AnyRef {
+ type Mom = String
+ def bar(x: Int) = 55
+ def bippy() = List(bar(55))
+ }
+}
diff --git a/tests/untried/neg/t4879.check b/tests/untried/neg/t4879.check
new file mode 100644
index 000000000..c7edd583c
--- /dev/null
+++ b/tests/untried/neg/t4879.check
@@ -0,0 +1,13 @@
+t4879.scala:6: error: pattern type is incompatible with expected type;
+ found : C.type
+ required: C
+Note: if you intended to match against the class, try `case C(_)`
+ case C => true
+ ^
+t4879.scala:10: error: pattern type is incompatible with expected type;
+ found : D.type
+ required: D[T,U,V]
+Note: if you intended to match against the class, try `case D(_,_,_)`
+ case D => true
+ ^
+two errors found
diff --git a/tests/untried/neg/t4879.scala b/tests/untried/neg/t4879.scala
new file mode 100644
index 000000000..7d6561e9e
--- /dev/null
+++ b/tests/untried/neg/t4879.scala
@@ -0,0 +1,15 @@
+case class C(d: Double) { }
+case class D[T, U, V](bingo: Int, donkey: String, private val vegas: Set[A])(jehovah: Int) { }
+
+class A {
+ def f = (new C(5)) match {
+ case C => true
+ case _ => false
+ }
+ def g[T, U, V](x: D[T, U, V]) = x match {
+ case D => true
+ case _ => false
+ }
+}
+
+
diff --git a/tests/untried/neg/t4882.check b/tests/untried/neg/t4882.check
new file mode 100644
index 000000000..0aafc8277
--- /dev/null
+++ b/tests/untried/neg/t4882.check
@@ -0,0 +1,4 @@
+t4882.scala:2: error: `implicit' modifier not allowed for constructors
+ implicit def this(a: String) = this(a.toInt)
+ ^
+one error found
diff --git a/tests/untried/neg/t4882.scala b/tests/untried/neg/t4882.scala
new file mode 100644
index 000000000..4e58ef787
--- /dev/null
+++ b/tests/untried/neg/t4882.scala
@@ -0,0 +1,3 @@
+class Foo(value: Int) {
+ implicit def this(a: String) = this(a.toInt)
+}
diff --git a/tests/untried/neg/t4928.check b/tests/untried/neg/t4928.check
new file mode 100644
index 000000000..18a5d57a6
--- /dev/null
+++ b/tests/untried/neg/t4928.check
@@ -0,0 +1,5 @@
+t4928.scala:3: error: parameter 'a' is already specified at parameter position 1
+Note that 'z' is not a parameter name of the invoked method.
+ f(z = 0, a = 1)
+ ^
+one error found
diff --git a/tests/untried/neg/t4928.scala b/tests/untried/neg/t4928.scala
new file mode 100644
index 000000000..17a598031
--- /dev/null
+++ b/tests/untried/neg/t4928.scala
@@ -0,0 +1,4 @@
+class C {
+ def f(a: Int, b: Int = 0) = 0
+ f(z = 0, a = 1)
+}
diff --git a/tests/untried/neg/t4987.check b/tests/untried/neg/t4987.check
new file mode 100644
index 000000000..8d7344d27
--- /dev/null
+++ b/tests/untried/neg/t4987.check
@@ -0,0 +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/tests/untried/neg/t4987.scala b/tests/untried/neg/t4987.scala
new file mode 100644
index 000000000..e55acd412
--- /dev/null
+++ b/tests/untried/neg/t4987.scala
@@ -0,0 +1,2 @@
+class Foo2 private (a: Int, b: Int)
+object Bar2 { new Foo2(0, 0) }
diff --git a/tests/untried/neg/t4989.check b/tests/untried/neg/t4989.check
new file mode 100644
index 000000000..814507fc3
--- /dev/null
+++ b/tests/untried/neg/t4989.check
@@ -0,0 +1,7 @@
+t4989.scala:14: error: method print in class A cannot be directly accessed from class C because class B redeclares it as abstract
+ override def print(): String = super.print() // should be an error
+ ^
+t4989.scala:18: error: method print in class A cannot be directly accessed from trait T because class B redeclares it as abstract
+ override def print(): String = super.print() // should be an error
+ ^
+two errors found
diff --git a/tests/untried/neg/t4989.scala b/tests/untried/neg/t4989.scala
new file mode 100644
index 000000000..e7ff80ed7
--- /dev/null
+++ b/tests/untried/neg/t4989.scala
@@ -0,0 +1,68 @@
+abstract class A0 {
+ def print(): String
+}
+
+class A extends A0 {
+ def print(): String = "A"
+}
+
+abstract class B extends A {
+ def print() : String
+}
+
+class C extends B {
+ override def print(): String = super.print() // should be an error
+}
+
+trait T extends B {
+ override def print(): String = super.print() // should be an error
+}
+
+class D extends A {
+ override def print(): String = super.print() // okay
+}
+
+
+// it's okay do this when trait are in the mix, as the
+// suitable super accessor methods are used.
+object ConcreteMethodAndIntermediaryAreTraits {
+ trait T1 {
+ def print(): String = ""
+ }
+
+ trait T2 extends T1 {
+ def print(): String
+ }
+
+ class C3 extends T2 {
+ def print(): String = super.print() // okay
+ }
+}
+
+object IntermediaryIsTrait {
+ class T1 {
+ def print(): String = ""
+ }
+
+ trait T2 extends T1 {
+ def print(): String
+ }
+
+ class C3 extends T2 {
+ override def print(): String = super.print() // okay
+ }
+}
+
+object ConcreteMethodIsTrait {
+ trait T1 {
+ def print(): String = ""
+ }
+
+ abstract class T2 extends T1 {
+ def print(): String
+ }
+
+ class C3 extends T2 {
+ override def print(): String = super.print() // okay
+ }
+}
diff --git a/tests/untried/neg/t500.check b/tests/untried/neg/t500.check
new file mode 100644
index 000000000..b3f5c8597
--- /dev/null
+++ b/tests/untried/neg/t500.check
@@ -0,0 +1,4 @@
+t500.scala:3: error: lower bound X does not conform to upper bound Y
+ type T >: X <: Y;
+ ^
+one error found
diff --git a/tests/untried/neg/t500.scala b/tests/untried/neg/t500.scala
new file mode 100644
index 000000000..d843d71f0
--- /dev/null
+++ b/tests/untried/neg/t500.scala
@@ -0,0 +1,22 @@
+object Magic {
+ abstract class O[X,Y] {
+ type T >: X <: Y;
+ class I { def magic(v: T): T = v; }
+ }
+ def magic[X,Y](v: X): Y = {
+ val o: O[X,Y] = null;
+ val i: o.I = new o.I();
+ i.magic(v);
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ try {
+ val i: Int = Magic.magic("42");
+ Console.println(i);
+ } catch {
+ case ex: Throwable => ex.printStackTrace()
+ }
+ }
+}
diff --git a/tests/untried/neg/t501.check b/tests/untried/neg/t501.check
new file mode 100644
index 000000000..3e3bf3907
--- /dev/null
+++ b/tests/untried/neg/t501.check
@@ -0,0 +1,4 @@
+t501.scala:3: error: lower bound X does not conform to upper bound Y
+ abstract class I { type T >: X <: Y; }
+ ^
+one error found
diff --git a/tests/untried/neg/t501.scala b/tests/untried/neg/t501.scala
new file mode 100644
index 000000000..437ab8f21
--- /dev/null
+++ b/tests/untried/neg/t501.scala
@@ -0,0 +1,18 @@
+object Magic {
+ class O[X,Y] {
+ abstract class I { type T >: X <: Y; }
+ val i: I = null;
+ def magic(v: i.T): i.T = v;
+ }
+ def magic[X,Y](v: X): Y = {
+ val o: O[X,Y] = new O();
+ o.magic(v);
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val i: Int = Magic.magic("42");
+ Console.println(i);
+ }
+}
diff --git a/tests/untried/neg/t5031.check b/tests/untried/neg/t5031.check
new file mode 100644
index 000000000..2f1090c32
--- /dev/null
+++ b/tests/untried/neg/t5031.check
@@ -0,0 +1,5 @@
+package.scala:2: error: Companions 'class Test' and 'object Test' must be defined in same file:
+ Found in t5031/package.scala and t5031/Id.scala
+ class Test
+ ^
+one error found
diff --git a/tests/untried/neg/t5031/Id.scala b/tests/untried/neg/t5031/Id.scala
new file mode 100644
index 000000000..2f0db002d
--- /dev/null
+++ b/tests/untried/neg/t5031/Id.scala
@@ -0,0 +1,4 @@
+package t5031
+
+object Test
+
diff --git a/tests/untried/neg/t5031/package.scala b/tests/untried/neg/t5031/package.scala
new file mode 100644
index 000000000..17b63220b
--- /dev/null
+++ b/tests/untried/neg/t5031/package.scala
@@ -0,0 +1,3 @@
+package object t5031 {
+ class Test
+}
diff --git a/tests/untried/neg/t5031b.check b/tests/untried/neg/t5031b.check
new file mode 100644
index 000000000..3bc2284a4
--- /dev/null
+++ b/tests/untried/neg/t5031b.check
@@ -0,0 +1,5 @@
+b.scala:3: error: Companions 'class Bippy' and 'object Bippy' must be defined in same file:
+ Found in t5031b/a.scala and t5031b/b.scala
+object Bippy
+ ^
+one error found
diff --git a/tests/untried/neg/t5031b/a.scala b/tests/untried/neg/t5031b/a.scala
new file mode 100644
index 000000000..0ab9aa976
--- /dev/null
+++ b/tests/untried/neg/t5031b/a.scala
@@ -0,0 +1,3 @@
+package foo
+
+class Bippy
diff --git a/tests/untried/neg/t5031b/b.scala b/tests/untried/neg/t5031b/b.scala
new file mode 100644
index 000000000..bdef237af
--- /dev/null
+++ b/tests/untried/neg/t5031b/b.scala
@@ -0,0 +1,3 @@
+package foo
+
+object Bippy
diff --git a/tests/untried/neg/t5044.check b/tests/untried/neg/t5044.check
new file mode 100644
index 000000000..197da2a4e
--- /dev/null
+++ b/tests/untried/neg/t5044.check
@@ -0,0 +1,9 @@
+t5044.scala:7: error: recursive value a needs type
+ val id = m(a)
+ ^
+t5044.scala:6: warning: type-checking the invocation of method foo checks if the named argument expression 'id = ...' is a valid assignment
+in the current scope. The resulting type inference error (see above) can be fixed by providing an explicit type in the local definition for id.
+ val a = foo(id = 1)
+ ^
+one warning found
+one error found
diff --git a/tests/untried/neg/t5044.scala b/tests/untried/neg/t5044.scala
new file mode 100644
index 000000000..8ea8ef67f
--- /dev/null
+++ b/tests/untried/neg/t5044.scala
@@ -0,0 +1,9 @@
+class T {
+ def foo[T](id: T) = 0
+ def m(a: Int) = 0
+
+ def f: Unit = {
+ val a = foo(id = 1)
+ val id = m(a)
+ }
+}
diff --git a/tests/untried/neg/t5060.check b/tests/untried/neg/t5060.check
new file mode 100644
index 000000000..09b2d9a4b
--- /dev/null
+++ b/tests/untried/neg/t5060.check
@@ -0,0 +1,7 @@
+t5060.scala:2: error: covariant type T occurs in contravariant position in type => AnyRef{def contains(x: T): Unit} of value foo0
+ val foo0 = {
+ ^
+t5060.scala:6: error: covariant type T occurs in contravariant position in type => AnyRef{def contains(x: T): Unit} of method foo1
+ def foo1 = {
+ ^
+two errors found
diff --git a/tests/untried/neg/t5060.scala b/tests/untried/neg/t5060.scala
new file mode 100644
index 000000000..4d934a9a1
--- /dev/null
+++ b/tests/untried/neg/t5060.scala
@@ -0,0 +1,19 @@
+class A[+T] {
+ val foo0 = {
+ class AsVariantAsIWantToBe { def contains(x: T) = () }
+ new AsVariantAsIWantToBe
+ }
+ def foo1 = {
+ class VarianceIsTheSpiceOfTypes { def contains(x: T) = () }
+ new VarianceIsTheSpiceOfTypes
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val xs: A[String] = new A[String]
+ println(xs.foo0 contains "abc")
+ println((xs: A[Any]).foo0 contains 5)
+ // java.lang.NoSuchMethodException: A$AsVariantAsIWantToBe$1.contains(java.lang.String)
+ }
+}
diff --git a/tests/untried/neg/t5063.check b/tests/untried/neg/t5063.check
new file mode 100644
index 000000000..c6e553c1b
--- /dev/null
+++ b/tests/untried/neg/t5063.check
@@ -0,0 +1,4 @@
+t5063.scala:2: error: value + is not a member of AnyRef
+ super.+("")
+ ^
+one error found
diff --git a/tests/untried/neg/t5063.scala b/tests/untried/neg/t5063.scala
new file mode 100644
index 000000000..5b34b53fb
--- /dev/null
+++ b/tests/untried/neg/t5063.scala
@@ -0,0 +1,3 @@
+class A {
+ super.+("")
+}
diff --git a/tests/untried/neg/t5067.check b/tests/untried/neg/t5067.check
new file mode 100644
index 000000000..32491766d
--- /dev/null
+++ b/tests/untried/neg/t5067.check
@@ -0,0 +1,6 @@
+t5067.scala:3: error: type mismatch;
+ found : ((Int, Int)) => Int
+ required: (Int, Int) => Int
+ override def tupled: (Int, Int) => Int = super.tupled
+ ^
+one error found
diff --git a/tests/untried/neg/t5067.scala b/tests/untried/neg/t5067.scala
new file mode 100644
index 000000000..f8235c0e8
--- /dev/null
+++ b/tests/untried/neg/t5067.scala
@@ -0,0 +1,4 @@
+class Foo extends Function2[Int, Int, Int] {
+ def apply(x: Int, y: Int) = x + y
+ override def tupled: (Int, Int) => Int = super.tupled
+}
diff --git a/tests/untried/neg/t5078.check b/tests/untried/neg/t5078.check
new file mode 100644
index 000000000..8f66445b0
--- /dev/null
+++ b/tests/untried/neg/t5078.check
@@ -0,0 +1,13 @@
+t5078.scala:7: error: an unapply method must accept a single argument.
+ val Foo(x1) = 1
+ ^
+t5078.scala:7: error: recursive value x1 needs type
+ val Foo(x1) = 1
+ ^
+t5078.scala:8: error: an unapply method must accept a single argument.
+ val Foo2(y2) = 2
+ ^
+t5078.scala:8: error: recursive value y2 needs type
+ val Foo2(y2) = 2
+ ^
+four errors found
diff --git a/tests/untried/neg/t5078.scala b/tests/untried/neg/t5078.scala
new file mode 100644
index 000000000..2e727e773
--- /dev/null
+++ b/tests/untried/neg/t5078.scala
@@ -0,0 +1,11 @@
+object Foo { def unapply: Option[Int] = Some(42) }
+object Foo2 { def unapply(): Option[Int] = Some(42) }
+
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val Foo(x1) = 1
+ val Foo2(y2) = 2
+ ()
+ }
+}
diff --git a/tests/untried/neg/t5093.check b/tests/untried/neg/t5093.check
new file mode 100644
index 000000000..daba46001
--- /dev/null
+++ b/tests/untried/neg/t5093.check
@@ -0,0 +1,10 @@
+t5093.scala:2: error: illegal cyclic reference involving type C
+ def f[C[X] <: C[X]](l: C[_]) = l.x
+ ^
+t5093.scala:2: error: cyclic aliasing or subtyping involving type C
+ def f[C[X] <: C[X]](l: C[_]) = l.x
+ ^
+t5093.scala:2: error: C does not take type parameters
+ def f[C[X] <: C[X]](l: C[_]) = l.x
+ ^
+three errors found
diff --git a/tests/untried/neg/t5093.scala b/tests/untried/neg/t5093.scala
new file mode 100644
index 000000000..9cde364de
--- /dev/null
+++ b/tests/untried/neg/t5093.scala
@@ -0,0 +1,3 @@
+class T {
+ def f[C[X] <: C[X]](l: C[_]) = l.x
+}
diff --git a/tests/untried/neg/t510.check b/tests/untried/neg/t510.check
new file mode 100644
index 000000000..355a6cdf0
--- /dev/null
+++ b/tests/untried/neg/t510.check
@@ -0,0 +1,4 @@
+t510.scala:19: error: cyclic aliasing or subtyping involving type T
+ def g(t: e.T): Unit = {
+ ^
+one error found
diff --git a/tests/untried/neg/t510.scala b/tests/untried/neg/t510.scala
new file mode 100644
index 000000000..a1cd2df00
--- /dev/null
+++ b/tests/untried/neg/t510.scala
@@ -0,0 +1,26 @@
+abstract class C {
+
+ type T <: Any;
+
+}
+
+abstract class D[S <: C](_c: S) extends C {
+
+ val c: S = _c;
+ type T <: c.T;
+
+}
+
+abstract class E(e: E) extends D[E](e);
+
+object Test {
+
+ def f(e: E): Unit = {
+ def g(t: e.T): Unit = {
+ val i: Int = t;
+ ()
+ }
+ ()
+ }
+
+}
diff --git a/tests/untried/neg/t5106.check b/tests/untried/neg/t5106.check
new file mode 100644
index 000000000..ac16041cf
--- /dev/null
+++ b/tests/untried/neg/t5106.check
@@ -0,0 +1,11 @@
+t5106.scala:3: error: type mismatch;
+ found : Int(4)
+ required: String
+ val (n, l): (String, Int) = (4, "")
+ ^
+t5106.scala:3: error: type mismatch;
+ found : String("")
+ required: Int
+ val (n, l): (String, Int) = (4, "")
+ ^
+two errors found
diff --git a/tests/untried/neg/t5106.scala b/tests/untried/neg/t5106.scala
new file mode 100644
index 000000000..6508662fd
--- /dev/null
+++ b/tests/untried/neg/t5106.scala
@@ -0,0 +1,5 @@
+class A {
+ def f: Unit = {
+ val (n, l): (String, Int) = (4, "")
+ }
+}
diff --git a/tests/untried/neg/t512.check b/tests/untried/neg/t512.check
new file mode 100644
index 000000000..051e5ee19
--- /dev/null
+++ b/tests/untried/neg/t512.check
@@ -0,0 +1,7 @@
+t512.scala:3: error: not found: value something
+ val xxx = something ||
+ ^
+t512.scala:4: error: not found: value something_else
+ something_else;
+ ^
+two errors found
diff --git a/tests/untried/neg/t512.scala b/tests/untried/neg/t512.scala
new file mode 100644
index 000000000..0a0ccde75
--- /dev/null
+++ b/tests/untried/neg/t512.scala
@@ -0,0 +1,5 @@
+package test;
+class Foo {
+ val xxx = something ||
+ something_else;
+}
diff --git a/tests/untried/neg/t5120.check b/tests/untried/neg/t5120.check
new file mode 100644
index 000000000..34d4ebde3
--- /dev/null
+++ b/tests/untried/neg/t5120.check
@@ -0,0 +1,12 @@
+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/tests/untried/neg/t5120.scala b/tests/untried/neg/t5120.scala
new file mode 100644
index 000000000..478436d85
--- /dev/null
+++ b/tests/untried/neg/t5120.scala
@@ -0,0 +1,29 @@
+class Cell[T](x0: T) {
+ type U = T
+ var x1: U = x0
+}
+
+object Test {
+ val str: Cell[String] = new Cell("a")
+ val other: Cell[Int] = new Cell(0)
+
+ def main(args: Array[String]): Unit = {
+ List(str, other) foreach (_.x1 = new AnyRef)
+ str.x1.length
+ }
+}
+// another way demonstrating the same underlying problem, as reported by roman kalukiewicz
+
+class Holder[_T](_f1 : _T, _f2 : _T) {
+ type T = _T
+ var f1 : T = _f1
+ var f2 : T = _f2
+}
+object Test2 {
+ val str = new Holder("t1", "t2")
+ val num = new Holder(1, 2)
+ List(str, num).foreach(h => h.f1 = new Thread())
+ def main(args: Array[String]): Unit = {
+ println(str.f1)
+ }
+}
diff --git a/tests/untried/neg/t5148.check b/tests/untried/neg/t5148.check
new file mode 100644
index 000000000..f426bd201
--- /dev/null
+++ b/tests/untried/neg/t5148.check
@@ -0,0 +1,5 @@
+error: bad symbolic reference. A signature in Imports.class refers to type Request
+in class scala.tools.nsc.interpreter.IMain which is not available.
+It may be completely missing from the current classpath, or the version on
+the classpath might be incompatible with the version used when compiling Imports.class.
+one error found
diff --git a/tests/untried/neg/t5148.scala b/tests/untried/neg/t5148.scala
new file mode 100644
index 000000000..fca64e57d
--- /dev/null
+++ b/tests/untried/neg/t5148.scala
@@ -0,0 +1,4 @@
+package scala.tools.nsc
+package interpreter
+
+class IMain extends Imports
diff --git a/tests/untried/neg/t515.check b/tests/untried/neg/t515.check
new file mode 100644
index 000000000..47d2d30d0
--- /dev/null
+++ b/tests/untried/neg/t515.check
@@ -0,0 +1,6 @@
+t515.scala:7: error: type mismatch;
+ found : String
+ required: Test.Truc
+ val parent: Truc = file.getMachin
+ ^
+one error found
diff --git a/tests/untried/neg/t515.scala b/tests/untried/neg/t515.scala
new file mode 100644
index 000000000..bb2376dca
--- /dev/null
+++ b/tests/untried/neg/t515.scala
@@ -0,0 +1,8 @@
+object Test extends App {
+ class Truc {
+ def getMachin() = "machin"
+ def getMachinAsTruc() = this
+ }
+ val file = new Truc
+ val parent: Truc = file.getMachin
+}
diff --git a/tests/untried/neg/t5152.check b/tests/untried/neg/t5152.check
new file mode 100644
index 000000000..fd510dbae
--- /dev/null
+++ b/tests/untried/neg/t5152.check
@@ -0,0 +1,11 @@
+t5152.scala:7: error: kinds of the type arguments (Test.B) do not conform to the expected kinds of the type parameters (type E) in class A.
+Test.B's type parameters do not match type E's expected parameters:
+type E has one type parameter, but type _ has none
+ class B[E[_]] extends A[B] { } // B is depth 2 but A requires 1
+ ^
+t5152.scala:11: error: kinds of the type arguments (Test.B1) do not conform to the expected kinds of the type parameters (type E) in class A1.
+Test.B1's type parameters do not match type E's expected parameters:
+type _ has no type parameters, but type G has one
+ class B1[E[_]] extends A1[B1] // B1 is depth 2 but A1 requires 3
+ ^
+two errors found
diff --git a/tests/untried/neg/t5152.scala b/tests/untried/neg/t5152.scala
new file mode 100644
index 000000000..56df31ed4
--- /dev/null
+++ b/tests/untried/neg/t5152.scala
@@ -0,0 +1,17 @@
+object Test {
+ new C
+ new C1
+ new C2
+
+ class A[E[_]] { }
+ class B[E[_]] extends A[B] { } // B is depth 2 but A requires 1
+ class C extends B { }
+
+ class A1[E[F[G[_]]]] { }
+ class B1[E[_]] extends A1[B1] // B1 is depth 2 but A1 requires 3
+ class C1 extends B1 { }
+
+ class A2[E[_]] { }
+ class B2[E] extends A2[B2] { } // this one is correct
+ class C2 extends B2 { }
+}
diff --git a/tests/untried/neg/t5182.check b/tests/untried/neg/t5182.check
new file mode 100644
index 000000000..3161f9268
--- /dev/null
+++ b/tests/untried/neg/t5182.check
@@ -0,0 +1,7 @@
+t5182.scala:2: error: unknown annotation argument name: qwe
+ @java.lang.Deprecated(qwe = "wer") def ok(q:Int) = 1
+ ^
+t5182.scala:3: error: classfile annotation arguments have to be supplied as named arguments
+ @java.lang.Deprecated("wer") def whereAmI(q:Int) = 1
+ ^
+two errors found
diff --git a/tests/untried/neg/t5182.flags b/tests/untried/neg/t5182.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t5182.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t5182.scala b/tests/untried/neg/t5182.scala
new file mode 100644
index 000000000..0687e99ef
--- /dev/null
+++ b/tests/untried/neg/t5182.scala
@@ -0,0 +1,5 @@
+class test {
+ @java.lang.Deprecated(qwe = "wer") def ok(q:Int) = 1
+ @java.lang.Deprecated("wer") def whereAmI(q:Int) = 1
+ @java.lang.Deprecated() def bippy(q:Int) = 1
+}
diff --git a/tests/untried/neg/t5189.check b/tests/untried/neg/t5189.check
new file mode 100644
index 000000000..4885de99c
--- /dev/null
+++ b/tests/untried/neg/t5189.check
@@ -0,0 +1,6 @@
+t5189.scala:3: error: type mismatch;
+ found : Nothing => Any
+ required: Any => Any
+ def f(x: Any): Any => Any = x match { case Foo(bar) => bar }
+ ^
+one error found
diff --git a/tests/untried/neg/t5189.scala b/tests/untried/neg/t5189.scala
new file mode 100644
index 000000000..19e8e7466
--- /dev/null
+++ b/tests/untried/neg/t5189.scala
@@ -0,0 +1,5 @@
+class TestNeg1 {
+ case class Foo[T, U](f: T => U)
+ def f(x: Any): Any => Any = x match { case Foo(bar) => bar }
+ // uh-oh, Any => Any should be Nothing => Any.
+}
diff --git a/tests/untried/neg/t5189_inferred.check b/tests/untried/neg/t5189_inferred.check
new file mode 100644
index 000000000..9cc5dcc24
--- /dev/null
+++ b/tests/untried/neg/t5189_inferred.check
@@ -0,0 +1,6 @@
+t5189_inferred.scala:7: error: type mismatch;
+ found : scala.collection.immutable.Nil.type
+ required: ?A1 where type ?A1
+ f(Invariant(arr): Covariant[Any])(0) = Nil
+ ^
+one error found
diff --git a/tests/untried/neg/t5189_inferred.scala b/tests/untried/neg/t5189_inferred.scala
new file mode 100644
index 000000000..c97b4117c
--- /dev/null
+++ b/tests/untried/neg/t5189_inferred.scala
@@ -0,0 +1,8 @@
+trait Covariant[+A]
+case class Invariant[A](xs: Array[A]) extends Covariant[A]
+
+class Test {
+ val arr = Array("abc")
+ def f[A](v: Covariant[A]) /*inferred!*/ = v match { case Invariant(xs) => xs }
+ f(Invariant(arr): Covariant[Any])(0) = Nil
+}
diff --git a/tests/untried/neg/t5189b.check b/tests/untried/neg/t5189b.check
new file mode 100644
index 000000000..46996e96d
--- /dev/null
+++ b/tests/untried/neg/t5189b.check
@@ -0,0 +1,11 @@
+t5189b.scala:38: error: type mismatch;
+ found : TestNeg.Wrapped[?T7] where type ?T7 <: T (this is a GADT skolem)
+ required: TestNeg.Wrapped[T]
+Note: ?T7 <: T, but class Wrapped is invariant in type W.
+You may wish to define W as +W instead. (SLS 4.5)
+ case Wrapper/*[_ <: T ]*/(wrapped) => wrapped // : Wrapped[_ <: T], which is a subtype of Wrapped[T] if and only if Wrapped is covariant in its type parameter
+ ^
+t5189b.scala:51: error: value foo is not a member of type parameter T
+ case Some(xs) => xs.foo // the error message should not refer to a skolem (testing extrapolation)
+ ^
+two errors found
diff --git a/tests/untried/neg/t5189b.scala b/tests/untried/neg/t5189b.scala
new file mode 100644
index 000000000..7c1871dc9
--- /dev/null
+++ b/tests/untried/neg/t5189b.scala
@@ -0,0 +1,80 @@
+class TestPos {
+ class AbsWrapperCov[+A]
+ case class Wrapper[B](x: B) extends AbsWrapperCov[B]
+
+ def unwrap[T](x: AbsWrapperCov[T]): T = x match {
+ case Wrapper/*[_ <: T ]*/(x) => x // _ <: T, which is a subtype of T
+ }
+
+ def unwrapOption[T](x: Option[T]): T = x match {
+ case Some(xs) => xs
+ }
+
+
+ case class Down[+T](x: T)
+ case class Up[-T](f: T => Unit)
+
+ def f1[T](x1: Down[T])(x2: Up[T]) = ((x1, x2)) match {
+ case (Down(x), Up(f)) => f(x)
+ }
+}
+
+
+object TestNeg extends App {
+ class AbsWrapperCov[+A]
+ case class Wrapper[B](x: Wrapped[B]) extends AbsWrapperCov[B]
+
+ /*
+ when inferring Wrapper's type parameter B from x's type AbsWrapperCov[T],
+ we must take into account that x's actual type is AbsWrapperCov[Tactual] forSome {type Tactual <: T}
+ as AbsWrapperCov is covariant in A -- in other words, we must not assume we know T exactly, all we know is its upper bound
+
+ since method application is the only way to generate this slack between run-time and compile-time types,
+ we'll simply replace the skolems that represent method type parameters as seen from the method's body by
+ other skolems that are (upper/lower)-bounded by the type-parameter skolems
+ (depending on whether the skolem appears in a covariant/contravariant position)
+ */
+ def unwrap[T](x: AbsWrapperCov[T]): Wrapped[T] = x match {
+ case Wrapper/*[_ <: T ]*/(wrapped) => wrapped // : Wrapped[_ <: T], which is a subtype of Wrapped[T] if and only if Wrapped is covariant in its type parameter
+ }
+
+ class Wrapped[W](var cell: W) // must be invariant (to trigger the bug)
+
+ // class A { def imNotAB = println("notB")}
+ // class B
+ //
+ // val w = new Wrapped(new A)
+ // unwrap[Any](Wrapper(w)).cell = new B
+ // w.cell.imNotAB
+
+ def unwrapOption[T](x: Option[T]): T = x match {
+ case Some(xs) => xs.foo // the error message should not refer to a skolem (testing extrapolation)
+ }
+
+}
+
+// class TestPos1 {
+// class Base[T]
+// case class C[T](x: T) extends Base[T]
+// def foo[T](b: Base[T]): T = b match { case C(x) => x }
+//
+// case class Span[K <: Ordered[K]](low: Option[K], high: Option[K]) extends Function1[K, Boolean] {
+// override def equals(x$1: Any): Boolean = x$1 match {
+// case Span((low$0 @ _), (high$0 @ _)) if low$0.equals(low).$amp$amp(high$0.equals(high)) => true
+// case _ => false
+// }
+// def apply(k: K): Boolean = this match {
+// case Span(Some(low), Some(high)) => (k >= low && k <= high)
+// case Span(Some(low), None) => (k >= low)
+// case Span(None, Some(high)) => (k <= high)
+// case _ => false
+// }
+// }
+// }
+//
+// class TestNeg1 {
+// case class Foo[T, U](f: T => U)
+// def f(x: Any): Any => Any = x match { case Foo(bar) => bar }
+// // uh-oh, Any => Any should be Nothing => Any.
+// }
+
diff --git a/tests/untried/neg/t520.check b/tests/untried/neg/t520.check
new file mode 100644
index 000000000..0035f89a7
--- /dev/null
+++ b/tests/untried/neg/t520.check
@@ -0,0 +1,4 @@
+t520.scala:8: error: overloaded method verifyKeyword needs result type
+ verifyKeyword("", source, pos);
+ ^
+one error found
diff --git a/tests/untried/neg/t520.scala b/tests/untried/neg/t520.scala
new file mode 100644
index 000000000..076aca312
--- /dev/null
+++ b/tests/untried/neg/t520.scala
@@ -0,0 +1,9 @@
+object test {
+
+ def verifyKeyword(keyword : String, source : java.io.File, pos : Int) = {
+ assert(keyword != null);
+ }
+
+ def verifyKeyword(source : java.io.File, pos : Int) =
+ verifyKeyword("", source, pos);
+}
diff --git a/tests/untried/neg/t521.check b/tests/untried/neg/t521.check
new file mode 100644
index 000000000..a10019565
--- /dev/null
+++ b/tests/untried/neg/t521.check
@@ -0,0 +1,15 @@
+t521.scala:10: error: class PlainFile needs to be abstract, since method path in class AbstractFile of type => String is not defined
+class PlainFile(val file : File) extends AbstractFile {}
+ ^
+t521.scala:13: error: overriding value file in class PlainFile of type java.io.File;
+ value file needs `override' modifier
+final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
+ ^
+t521.scala:13: error: class ZipArchive needs to be abstract, since method path in class AbstractFile of type => String is not defined
+final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
+ ^
+t521.scala:15: error: overriding value path in class VirtualFile of type String;
+ method path needs to be a stable, immutable value
+ override def path = "";
+ ^
+four errors found
diff --git a/tests/untried/neg/t521.scala b/tests/untried/neg/t521.scala
new file mode 100644
index 000000000..c6afebc0b
--- /dev/null
+++ b/tests/untried/neg/t521.scala
@@ -0,0 +1,17 @@
+package test
+
+import java.io.File
+import java.util.zip.ZipFile
+
+abstract class AbstractFile {
+ def path : String;
+}
+
+class PlainFile(val file : File) extends AbstractFile {}
+class VirtualFile(val name : String, val path : String) extends AbstractFile {}
+
+final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
+ class Entry(name : String, path : String) extends VirtualFile(name, path) {
+ override def path = "";
+ }
+}
diff --git a/tests/untried/neg/t5318.check b/tests/untried/neg/t5318.check
new file mode 100644
index 000000000..d6a3a5793
--- /dev/null
+++ b/tests/untried/neg/t5318.check
@@ -0,0 +1,5 @@
+t5318.scala:7: error: diverging implicit expansion for type CompilerHang.this.TC[F]
+starting with method tc in class CompilerHang
+ breakage // type checker doesn't terminate, should report inference failure
+ ^
+one error found
diff --git a/tests/untried/neg/t5318.scala b/tests/untried/neg/t5318.scala
new file mode 100644
index 000000000..5be82a02a
--- /dev/null
+++ b/tests/untried/neg/t5318.scala
@@ -0,0 +1,8 @@
+class CompilerHang {
+ trait TC[M[_]]
+ trait S[A]
+
+ implicit def tc[M[_]](implicit M0: TC[M]): TC[S] = null
+ def breakage[F[_] : TC] = 0
+ breakage // type checker doesn't terminate, should report inference failure
+}
diff --git a/tests/untried/neg/t5318b.check b/tests/untried/neg/t5318b.check
new file mode 100644
index 000000000..47a10d673
--- /dev/null
+++ b/tests/untried/neg/t5318b.check
@@ -0,0 +1,5 @@
+t5318b.scala:7: error: diverging implicit expansion for type DivergingImplicitReported.this.TC[F]
+starting with method tc in class DivergingImplicitReported
+ breakage // correct: diverging implicit expansion
+ ^
+one error found \ No newline at end of file
diff --git a/tests/untried/neg/t5318b.scala b/tests/untried/neg/t5318b.scala
new file mode 100644
index 000000000..a2d55b1e4
--- /dev/null
+++ b/tests/untried/neg/t5318b.scala
@@ -0,0 +1,8 @@
+class DivergingImplicitReported {
+ trait TC[M]
+ trait S
+
+ implicit def tc[M](implicit M0: TC[M]): TC[S] = null
+ def breakage[F: TC] = 0
+ breakage // correct: diverging implicit expansion
+}
diff --git a/tests/untried/neg/t5318c.check b/tests/untried/neg/t5318c.check
new file mode 100644
index 000000000..594539be6
--- /dev/null
+++ b/tests/untried/neg/t5318c.check
@@ -0,0 +1,5 @@
+t5318c.scala:13: error: diverging implicit expansion for type CompilerHang.this.TC[F]
+starting with method tc in class CompilerHang
+ breakage // type checker doesn't terminate, should report inference failure
+ ^
+one error found
diff --git a/tests/untried/neg/t5318c.scala b/tests/untried/neg/t5318c.scala
new file mode 100644
index 000000000..477a9874a
--- /dev/null
+++ b/tests/untried/neg/t5318c.scala
@@ -0,0 +1,14 @@
+class CompilerHang {
+ trait TC[M[_]]
+ trait S[A]
+
+ class C[M[_]] {
+ type TCM = TC[M]
+ }
+
+ // A nefarious implicit, to motivate the removal of `&& sym.owner.isTerm` from
+ // `isFreeTypeParamNoSkolem`.
+ implicit def tc[x[_], CC[x[_]] <: C[x]](implicit M0: CC[x]#TCM): CC[x]#TCM = null
+ def breakage[F[_] : TC] = 0
+ breakage // type checker doesn't terminate, should report inference failure
+}
diff --git a/tests/untried/neg/t5340.check b/tests/untried/neg/t5340.check
new file mode 100644
index 000000000..2de19293c
--- /dev/null
+++ b/tests/untried/neg/t5340.check
@@ -0,0 +1,6 @@
+t5340.scala:17: error: type mismatch;
+ found : MyApp.r.E
+ required: MyApp.s.E
+ println(b: s.E)
+ ^
+one error found
diff --git a/tests/untried/neg/t5340.scala b/tests/untried/neg/t5340.scala
new file mode 100644
index 000000000..b283f1333
--- /dev/null
+++ b/tests/untried/neg/t5340.scala
@@ -0,0 +1,29 @@
+class Poly {
+ class E
+ object E {
+ implicit def conv(value: Any): E = sys.error("")
+ }
+}
+
+object MyApp {
+ val r: Poly = sys.error("")
+ val s: Poly = sys.error("")
+ val b: r.E = sys.error("")
+
+ // okay
+ s.E.conv(b): s.E
+
+ // compilation fails with error below
+ println(b: s.E)
+
+ // amb prefix: MyApp.s.type#class E MyApp.r.type#class E
+ // amb prefix: MyApp.s.type#class E MyApp.r.type#class E
+ // ../test/pending/run/t5310.scala:17: error: type mismatch;
+ // found : MyApp.r.E
+ // required: MyApp.s.E
+ // println(b: s.E)
+ // ^
+
+ // The type error is as expected, but the `amb prefix` should be logged,
+ // rather than printed to standard out.
+}
diff --git a/tests/untried/neg/t5352.check b/tests/untried/neg/t5352.check
new file mode 100644
index 000000000..1675da9e9
--- /dev/null
+++ b/tests/untried/neg/t5352.check
@@ -0,0 +1,13 @@
+t5352.scala:11: error: type mismatch;
+ found : boop.Bar
+ required: boop.BarF
+ (which expands to) AnyRef{def f(): Int}
+ x = xs.head
+ ^
+t5352.scala:14: error: method f in class Bar1 cannot be accessed in boop.Bar1
+ Access to protected method f not permitted because
+ enclosing object boop is not a subclass of
+ class Bar1 in object boop where target is defined
+ (new Bar1).f
+ ^
+two errors found
diff --git a/tests/untried/neg/t5352.flags b/tests/untried/neg/t5352.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t5352.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t5352.scala b/tests/untried/neg/t5352.scala
new file mode 100644
index 000000000..ed74a840f
--- /dev/null
+++ b/tests/untried/neg/t5352.scala
@@ -0,0 +1,15 @@
+object boop {
+ abstract class Bar { protected def f(): Any }
+ class Bar1 extends Bar { protected def f(): Int = 5 }
+ class Bar2 extends Bar { protected def f(): Int = 5 }
+
+ val xs = List(new Bar1, new Bar2)
+
+ type BarF = { def f(): Int }
+
+ var x: BarF = _
+ x = xs.head
+ x.f
+
+ (new Bar1).f
+}
diff --git a/tests/untried/neg/t5354.check b/tests/untried/neg/t5354.check
new file mode 100644
index 000000000..e47cecb5f
--- /dev/null
+++ b/tests/untried/neg/t5354.check
@@ -0,0 +1,7 @@
+t5354.scala:9: error: ambiguous implicit values:
+ both method x123 in package foo of type => foo.Bippy
+ and method z of type => foo.Bippy
+ match expected type foo.Bippy
+ implicitly[Bippy]
+ ^
+one error found
diff --git a/tests/untried/neg/t5354.scala b/tests/untried/neg/t5354.scala
new file mode 100644
index 000000000..99b565015
--- /dev/null
+++ b/tests/untried/neg/t5354.scala
@@ -0,0 +1,15 @@
+package object foo {
+ implicit def x123: Bippy = new Bippy("x")
+}
+package foo {
+ class Bippy(override val toString: String){ }
+ class Dingus {
+ def f1 = {
+ implicit def z: Bippy = new Bippy("z")
+ implicitly[Bippy]
+ }
+ }
+ object Test extends App {
+ println(new Dingus().f1)
+ }
+}
diff --git a/tests/untried/neg/t5357.check b/tests/untried/neg/t5357.check
new file mode 100644
index 000000000..338555907
--- /dev/null
+++ b/tests/untried/neg/t5357.check
@@ -0,0 +1,4 @@
+t5357.scala:5: error: Pattern variables must start with a lower-case letter. (SLS 8.1.1.)
+ case A: N => 1
+ ^
+one error found
diff --git a/tests/untried/neg/t5357.scala b/tests/untried/neg/t5357.scala
new file mode 100644
index 000000000..6a52283dd
--- /dev/null
+++ b/tests/untried/neg/t5357.scala
@@ -0,0 +1,9 @@
+trait M
+
+case class N() extends M {
+ def mytest(x: M) = x match {
+ case A: N => 1
+ case _ => 0
+ }
+}
+
diff --git a/tests/untried/neg/t5358.check b/tests/untried/neg/t5358.check
new file mode 100644
index 000000000..59e83bba2
--- /dev/null
+++ b/tests/untried/neg/t5358.check
@@ -0,0 +1,7 @@
+t5358.scala:3: error: class C inherits conflicting members:
+ method hi in trait A of type => String and
+ method hi in trait B of type => String
+(Note: this can be resolved by declaring an override in class C.)
+class C extends A with B
+ ^
+one error found
diff --git a/tests/untried/neg/t5358.scala b/tests/untried/neg/t5358.scala
new file mode 100644
index 000000000..13d827ed8
--- /dev/null
+++ b/tests/untried/neg/t5358.scala
@@ -0,0 +1,4 @@
+trait A { def hi = "A" }
+trait B { def hi = "B" }
+class C extends A with B
+
diff --git a/tests/untried/neg/t5361.check b/tests/untried/neg/t5361.check
new file mode 100644
index 000000000..d7fee87cc
--- /dev/null
+++ b/tests/untried/neg/t5361.check
@@ -0,0 +1,4 @@
+t5361.scala:2: error: only declarations allowed here
+ val x : { val self = this } = new { self => }
+ ^
+one error found
diff --git a/tests/untried/neg/t5361.scala b/tests/untried/neg/t5361.scala
new file mode 100644
index 000000000..1705c09df
--- /dev/null
+++ b/tests/untried/neg/t5361.scala
@@ -0,0 +1,3 @@
+class A {
+ val x : { val self = this } = new { self => }
+}
diff --git a/tests/untried/neg/t5376.check b/tests/untried/neg/t5376.check
new file mode 100644
index 000000000..0376163c3
--- /dev/null
+++ b/tests/untried/neg/t5376.check
@@ -0,0 +1,11 @@
+t5376.scala:12: error: type mismatch;
+ found : String("a")
+ required: Int
+ "a": Int
+ ^
+t5376.scala:22: error: type mismatch;
+ found : String("a")
+ required: Int
+ "a": Int
+ ^
+two errors found
diff --git a/tests/untried/neg/t5376.scala b/tests/untried/neg/t5376.scala
new file mode 100644
index 000000000..9dcaccbf1
--- /dev/null
+++ b/tests/untried/neg/t5376.scala
@@ -0,0 +1,24 @@
+object Test {
+ object O1 { implicit def f(s: String): Int = 1 }
+ object O2 { implicit def f(s: String): Int = 2 }
+ object O3 { def f(s: String): Int = 3 }
+
+ // Import two implicits with the same name in the same scope.
+ def m1 = {
+ import O1._
+ import O2._
+
+ // Implicit usage compiles.
+ "a": Int
+ }
+
+ // Import one implict and one non-implicit method with the
+ // same name in the same scope.
+ def m2 = {
+ import O1._
+ import O3._
+
+ // Implicit usage compiles.
+ "a": Int
+ }
+}
diff --git a/tests/untried/neg/t5378.check b/tests/untried/neg/t5378.check
new file mode 100644
index 000000000..c1460083f
--- /dev/null
+++ b/tests/untried/neg/t5378.check
@@ -0,0 +1,31 @@
+t5378.scala:7: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement
+ def contains = new { def apply[T1 <: T](value: T1) = ??? }
+ ^
+t5378.scala:8: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement
+ def contains1 = new { def apply[T1 <: A1](value: T1) = ??? }
+ ^
+t5378.scala:9: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement
+ def contains2 = new { def apply[T1 <: A2](value: T1) = ??? }
+ ^
+t5378.scala:15: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement
+ new Bippy { def apply[T1 <: T](value: T1) = ??? }
+ ^
+t5378.scala:16: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement
+ new Bippy { def apply[T1 <: B1](value: T1) = ??? }
+ ^
+t5378.scala:17: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement
+ new Bippy { def apply[T1 <: B2](value: T1) = ??? }
+ ^
+t5378.scala:21: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement
+ def apply1[T1 <: B3](value: T1) = ???
+ ^
+t5378.scala:23: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
+ def apply3(value: B3) = ???
+ ^
+t5378.scala:28: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
+ def apply1(s: String)(x: Int)(value: T) = ???
+ ^
+t5378.scala:29: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement
+ def apply2[T1 <: T](s: String)(x: Int)(value: T1) = ???
+ ^
+10 errors found
diff --git a/tests/untried/neg/t5378.scala b/tests/untried/neg/t5378.scala
new file mode 100644
index 000000000..fa6afa02b
--- /dev/null
+++ b/tests/untried/neg/t5378.scala
@@ -0,0 +1,54 @@
+import scala.language.reflectiveCalls
+
+class Coll[+T] {
+ type A1 <: T
+ type A2 <: A1
+
+ def contains = new { def apply[T1 <: T](value: T1) = ??? }
+ def contains1 = new { def apply[T1 <: A1](value: T1) = ??? }
+ def contains2 = new { def apply[T1 <: A2](value: T1) = ??? }
+ def contains3 = {
+ trait Bippy {
+ type B1 <: T
+ type B2 <: B1
+ }
+ new Bippy { def apply[T1 <: T](value: T1) = ??? }
+ new Bippy { def apply[T1 <: B1](value: T1) = ??? }
+ new Bippy { def apply[T1 <: B2](value: T1) = ??? }
+ new Bippy {
+ type B3 = B2
+ type B4 = List[B2]
+ def apply1[T1 <: B3](value: T1) = ???
+ def apply2[T1 <: B4](value: T1) = ???
+ def apply3(value: B3) = ???
+ def apply4(value: B4) = value.head
+ }
+ }
+ def contains4 = new {
+ def apply1(s: String)(x: Int)(value: T) = ???
+ def apply2[T1 <: T](s: String)(x: Int)(value: T1) = ???
+ }
+ def containsOk = {
+ trait Bippy {
+ type B1 <: AnyRef
+ type B2 <: B1
+ }
+ new Bippy { def apply[T1 <: AnyRef](value: T1) = ??? }
+ new Bippy { type B1 = String ; def apply[T1 <: B1](value: T1) = ??? }
+ new Bippy { type B2 = String ; def apply[T1 <: B2](value: T1) = ??? }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val xs = new Coll[List[String]]
+ val ys: Coll[Traversable[String]] = xs
+
+ println(ys contains Nil)
+ // java.lang.NoSuchMethodException: Coll$$anon$1.apply(scala.collection.Traversable)
+ // at java.lang.Class.getMethod(Class.java:1605)
+ // at Test$.reflMethod$Method1(a.scala:14)
+ // at Test$.main(a.scala:14)
+ // at Test.main(a.scala)
+ }
+}
diff --git a/tests/untried/neg/t5390.check b/tests/untried/neg/t5390.check
new file mode 100644
index 000000000..6a0129b89
--- /dev/null
+++ b/tests/untried/neg/t5390.check
@@ -0,0 +1,4 @@
+t5390.scala:7: error: forward reference extends over definition of value b
+ val b = a.B("")
+ ^
+one error found
diff --git a/tests/untried/neg/t5390.scala b/tests/untried/neg/t5390.scala
new file mode 100644
index 000000000..de596a478
--- /dev/null
+++ b/tests/untried/neg/t5390.scala
@@ -0,0 +1,10 @@
+class A {
+ object B { def apply(s: String) = 0}
+}
+
+object X {
+ def foo: Unit = {
+ val b = a.B("")
+ val a = new A
+ }
+}
diff --git a/tests/untried/neg/t5390b.check b/tests/untried/neg/t5390b.check
new file mode 100644
index 000000000..cbf8fafa6
--- /dev/null
+++ b/tests/untried/neg/t5390b.check
@@ -0,0 +1,4 @@
+t5390b.scala:7: error: forward reference extends over definition of value b
+ val b = a.B("")
+ ^
+one error found
diff --git a/tests/untried/neg/t5390b.scala b/tests/untried/neg/t5390b.scala
new file mode 100644
index 000000000..94032c907
--- /dev/null
+++ b/tests/untried/neg/t5390b.scala
@@ -0,0 +1,10 @@
+class A {
+ case class B(s: String)
+}
+
+object X {
+ def foo: Unit = {
+ val b = a.B("")
+ val a = new A
+ }
+}
diff --git a/tests/untried/neg/t5390c.check b/tests/untried/neg/t5390c.check
new file mode 100644
index 000000000..f8a794d69
--- /dev/null
+++ b/tests/untried/neg/t5390c.check
@@ -0,0 +1,4 @@
+t5390c.scala:7: error: forward reference extends over definition of value b
+ val b = new a.B("")
+ ^
+one error found
diff --git a/tests/untried/neg/t5390c.scala b/tests/untried/neg/t5390c.scala
new file mode 100644
index 000000000..6277400dc
--- /dev/null
+++ b/tests/untried/neg/t5390c.scala
@@ -0,0 +1,10 @@
+class A {
+ case class B(s: String)
+}
+
+object X {
+ def foo: Unit = {
+ val b = new a.B("")
+ val a = new A
+ }
+}
diff --git a/tests/untried/neg/t5390d.check b/tests/untried/neg/t5390d.check
new file mode 100644
index 000000000..daa29142e
--- /dev/null
+++ b/tests/untried/neg/t5390d.check
@@ -0,0 +1,4 @@
+t5390d.scala:7: error: forward reference extends over definition of value b
+ val b = a.B.toString
+ ^
+one error found
diff --git a/tests/untried/neg/t5390d.scala b/tests/untried/neg/t5390d.scala
new file mode 100644
index 000000000..d376b714b
--- /dev/null
+++ b/tests/untried/neg/t5390d.scala
@@ -0,0 +1,10 @@
+class A {
+ case class B(s: String)
+}
+
+object X {
+ def foo: Unit = {
+ val b = a.B.toString
+ val a = new A
+ }
+}
diff --git a/tests/untried/neg/t5426.check b/tests/untried/neg/t5426.check
new file mode 100644
index 000000000..98f3ddaaa
--- /dev/null
+++ b/tests/untried/neg/t5426.check
@@ -0,0 +1,15 @@
+t5426.scala:2: warning: comparing values of types Some[Int] and Int using `==' will always yield false
+ def f1 = Some(5) == 5
+ ^
+t5426.scala:3: warning: comparing values of types Int and Some[Int] using `==' will always yield false
+ 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: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
+one error found
diff --git a/tests/untried/neg/t5426.flags b/tests/untried/neg/t5426.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t5426.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t5426.scala b/tests/untried/neg/t5426.scala
new file mode 100644
index 000000000..af0f98196
--- /dev/null
+++ b/tests/untried/neg/t5426.scala
@@ -0,0 +1,10 @@
+class A {
+ def f1 = Some(5) == 5
+ def f2 = 5 == Some(5)
+
+ val x1 = 5
+ val x2 = Some(5)
+
+ (x1 == x2)
+ (x2 == x1)
+}
diff --git a/tests/untried/neg/t5429.check b/tests/untried/neg/t5429.check
new file mode 100644
index 000000000..4350696bc
--- /dev/null
+++ b/tests/untried/neg/t5429.check
@@ -0,0 +1,142 @@
+t5429.scala:20: error: overriding value value in class A of type Int;
+ object value needs `override' modifier
+ object value // fail
+ ^
+t5429.scala:21: error: overriding lazy value lazyvalue in class A of type Int;
+ object lazyvalue needs `override' modifier
+ object lazyvalue // fail
+ ^
+t5429.scala:22: error: overriding method nullary in class A of type => Int;
+ object nullary needs `override' modifier
+ object nullary // fail
+ ^
+t5429.scala:23: error: overriding method emptyArg in class A of type ()Int;
+ object emptyArg needs `override' modifier
+ object emptyArg // fail
+ ^
+t5429.scala:27: error: overriding value value in class A0 of type Any;
+ object value needs `override' modifier
+ object value // fail
+ ^
+t5429.scala:28: error: overriding lazy value lazyvalue in class A0 of type Any;
+ object lazyvalue needs `override' modifier
+ object lazyvalue // fail
+ ^
+t5429.scala:29: error: overriding method nullary in class A0 of type => Any;
+ object nullary needs `override' modifier
+ object nullary // fail
+ ^
+t5429.scala:30: error: overriding method emptyArg in class A0 of type ()Any;
+ object emptyArg needs `override' modifier
+ object emptyArg // fail
+ ^
+t5429.scala:35: error: overriding value value in class A of type Int;
+ object value has incompatible type
+ override object value // fail
+ ^
+t5429.scala:36: error: overriding lazy value lazyvalue in class A of type Int;
+ object lazyvalue must be declared lazy to override a concrete lazy value
+ override object lazyvalue // fail
+ ^
+t5429.scala:37: error: overriding method nullary in class A of type => Int;
+ object nullary has incompatible type
+ override object nullary // fail
+ ^
+t5429.scala:38: error: overriding method emptyArg in class A of type ()Int;
+ object emptyArg has incompatible type
+ override object emptyArg // fail
+ ^
+t5429.scala:39: error: object oneArg overrides nothing.
+Note: the super classes of class C contain the following, non final members named oneArg:
+def oneArg(x: String): Int
+ override object oneArg // fail
+ ^
+t5429.scala:43: error: overriding lazy value lazyvalue in class A0 of type Any;
+ object lazyvalue must be declared lazy to override a concrete lazy value
+ override object lazyvalue // !!! this fails, but should succeed (lazy over lazy)
+ ^
+t5429.scala:46: error: object oneArg overrides nothing.
+Note: the super classes of class C0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
+ override object oneArg // fail
+ ^
+t5429.scala:50: error: overriding value value in class A of type Int;
+ value value needs `override' modifier
+ val value = 0 // fail
+ ^
+t5429.scala:51: error: overriding lazy value lazyvalue in class A of type Int;
+ value lazyvalue needs `override' modifier
+ val lazyvalue = 0 // fail
+ ^
+t5429.scala:52: error: overriding method nullary in class A of type => Int;
+ value nullary needs `override' modifier
+ val nullary = 5 // fail
+ ^
+t5429.scala:53: error: overriding method emptyArg in class A of type ()Int;
+ value emptyArg needs `override' modifier
+ val emptyArg = 10 // fail
+ ^
+t5429.scala:58: error: overriding lazy value lazyvalue in class A0 of type Any;
+ value lazyvalue must be declared lazy to override a concrete lazy value
+ override val lazyvalue = 0 // fail (non-lazy)
+ ^
+t5429.scala:61: error: value oneArg overrides nothing.
+Note: the super classes of class D0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
+ override val oneArg = 15 // fail
+ ^
+t5429.scala:65: error: overriding value value in class A of type Int;
+ method value needs `override' modifier
+ def value = 0 // fail
+ ^
+t5429.scala:66: error: overriding lazy value lazyvalue in class A of type Int;
+ method lazyvalue needs `override' modifier
+ def lazyvalue = 2 // fail
+ ^
+t5429.scala:67: error: overriding method nullary in class A of type => Int;
+ method nullary needs `override' modifier
+ def nullary = 5 // fail
+ ^
+t5429.scala:68: error: overriding method emptyArg in class A of type ()Int;
+ method emptyArg needs `override' modifier
+ def emptyArg = 10 // fail
+ ^
+t5429.scala:72: error: overriding value value in class A0 of type Any;
+ method value needs to be a stable, immutable value
+ override def value = 0 // fail
+ ^
+t5429.scala:73: error: overriding lazy value lazyvalue in class A0 of type Any;
+ method lazyvalue needs to be a stable, immutable value
+ override def lazyvalue = 2 // fail
+ ^
+t5429.scala:76: error: method oneArg overrides nothing.
+Note: the super classes of class E0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
+ override def oneArg = 15 // fail
+ ^
+t5429.scala:80: error: overriding value value in class A of type Int;
+ lazy value value needs `override' modifier
+ lazy val value = 0 // fail
+ ^
+t5429.scala:81: error: overriding lazy value lazyvalue in class A of type Int;
+ lazy value lazyvalue needs `override' modifier
+ lazy val lazyvalue = 2 // fail
+ ^
+t5429.scala:82: error: overriding method nullary in class A of type => Int;
+ lazy value nullary needs `override' modifier
+ lazy val nullary = 5 // fail
+ ^
+t5429.scala:83: error: overriding method emptyArg in class A of type ()Int;
+ lazy value emptyArg needs `override' modifier
+ lazy val emptyArg = 10 // fail
+ ^
+t5429.scala:87: error: overriding value value in class A0 of type Any;
+ lazy value value cannot override a concrete non-lazy value
+ override lazy val value = 0 // fail (strict over lazy)
+ ^
+t5429.scala:91: error: value oneArg overrides nothing.
+Note: the super classes of class F0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
+ override lazy val oneArg = 15 // fail
+ ^
+34 errors found
diff --git a/tests/untried/neg/t5429.scala b/tests/untried/neg/t5429.scala
new file mode 100644
index 000000000..1cd4dcd03
--- /dev/null
+++ b/tests/untried/neg/t5429.scala
@@ -0,0 +1,93 @@
+// /scala/trac/5429/a.scala
+// Wed Feb 1 08:05:27 PST 2012
+
+class A {
+ val value = 0
+ lazy val lazyvalue = 2
+ def nullary = 5
+ def emptyArg() = 10
+ def oneArg(x: String) = 15
+}
+class A0 {
+ val value: Any = 0
+ lazy val lazyvalue: Any = 2
+ def nullary: Any = 5
+ def emptyArg(): Any = 10
+ def oneArg(x: String): Any = 15
+}
+
+class B extends A {
+ object value // fail
+ object lazyvalue // fail
+ object nullary // fail
+ object emptyArg // fail
+ object oneArg // overload
+}
+class B0 extends A0 {
+ object value // fail
+ object lazyvalue // fail
+ object nullary // fail
+ object emptyArg // fail
+ object oneArg // overload
+}
+
+class C extends A {
+ override object value // fail
+ override object lazyvalue // fail
+ override object nullary // fail
+ override object emptyArg // fail
+ override object oneArg // fail
+}
+class C0 extends A0 {
+ override object value // !!! this succeeds, but should fail (lazy over strict)
+ override object lazyvalue // !!! this fails, but should succeed (lazy over lazy)
+ override object nullary // override
+ override object emptyArg // override
+ override object oneArg // fail
+}
+
+class D extends A {
+ val value = 0 // fail
+ val lazyvalue = 0 // fail
+ val nullary = 5 // fail
+ val emptyArg = 10 // fail
+ val oneArg = 15 // overload
+}
+class D0 extends A0 {
+ override val value = 0 // override
+ override val lazyvalue = 0 // fail (non-lazy)
+ override val nullary = 5 // override
+ override val emptyArg = 10 // override
+ override val oneArg = 15 // fail
+}
+
+class E extends A {
+ def value = 0 // fail
+ def lazyvalue = 2 // fail
+ def nullary = 5 // fail
+ def emptyArg = 10 // fail
+ def oneArg = 15 // overload
+}
+class E0 extends A0 {
+ override def value = 0 // fail
+ override def lazyvalue = 2 // fail
+ override def nullary = 5 // override
+ override def emptyArg = 10 // override
+ override def oneArg = 15 // fail
+}
+
+class F extends A {
+ lazy val value = 0 // fail
+ lazy val lazyvalue = 2 // fail
+ lazy val nullary = 5 // fail
+ lazy val emptyArg = 10 // fail
+ lazy val oneArg = 15 // overload
+}
+class F0 extends A0 {
+ override lazy val value = 0 // fail (strict over lazy)
+ override lazy val lazyvalue = 2 // override (lazy over lazy)
+ override lazy val nullary = 5 // override
+ override lazy val emptyArg = 10 // override
+ override lazy val oneArg = 15 // fail
+}
+
diff --git a/tests/untried/neg/t5440.check b/tests/untried/neg/t5440.check
new file mode 100644
index 000000000..1c4592cce
--- /dev/null
+++ b/tests/untried/neg/t5440.check
@@ -0,0 +1,7 @@
+t5440.scala:3: warning: match may not be exhaustive.
+It would fail on the following inputs: (List(_), Nil), (Nil, List(_))
+ (list1, list2) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t5440.flags b/tests/untried/neg/t5440.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t5440.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t5440.scala b/tests/untried/neg/t5440.scala
new file mode 100644
index 000000000..909bab1e3
--- /dev/null
+++ b/tests/untried/neg/t5440.scala
@@ -0,0 +1,7 @@
+object Test {
+ def merge(list1: List[Long], list2: List[Long]): Boolean =
+ (list1, list2) match {
+ case (hd1::_, hd2::_) => true
+ case (Nil, Nil) => true
+ }
+}
diff --git a/tests/untried/neg/t545.check b/tests/untried/neg/t545.check
new file mode 100644
index 000000000..aae575fa9
--- /dev/null
+++ b/tests/untried/neg/t545.check
@@ -0,0 +1,4 @@
+t545.scala:4: error: value blah is not a member of Test.Foo
+ val x = foo.blah match {
+ ^
+one error found
diff --git a/tests/untried/neg/t545.scala b/tests/untried/neg/t545.scala
new file mode 100644
index 000000000..f1f9909dc
--- /dev/null
+++ b/tests/untried/neg/t545.scala
@@ -0,0 +1,9 @@
+object Test {
+ class Foo
+ val foo = new Foo
+ val x = foo.blah match {
+ case List(x) => x
+ case Nil => null
+ case _ => throw new Error("too many!")
+ }
+}
diff --git a/tests/untried/neg/t5452-new.check b/tests/untried/neg/t5452-new.check
new file mode 100644
index 000000000..1850a7004
--- /dev/null
+++ b/tests/untried/neg/t5452-new.check
@@ -0,0 +1,8 @@
+t5452-new.scala:30: error: overloaded method value apply with alternatives:
+ ()Queryable[CoffeesTable] <and>
+ (t: Tree)(implicit evidence$2: scala.reflect.ClassTag[CoffeesTable])Nothing <and>
+ (implicit evidence$1: scala.reflect.ClassTag[CoffeesTable])Nothing
+ cannot be applied to (Queryable[CoffeesTable])
+ Queryable[CoffeesTable]( q.treeFilter(null) )
+ ^
+one error found
diff --git a/tests/untried/neg/t5452-new.scala b/tests/untried/neg/t5452-new.scala
new file mode 100644
index 000000000..ef5f199e7
--- /dev/null
+++ b/tests/untried/neg/t5452-new.scala
@@ -0,0 +1,31 @@
+import scala.reflect.{ClassTag, classTag}
+
+// /scala/trac/5452/a.scala
+// Mon Feb 13 22:52:36 PST 2012
+
+// import scala.reflect.runtime.universe._
+
+trait Tree
+
+object Bip {
+ def ??? = sys.error("")
+}
+import Bip._
+
+case class Queryable[T]() {
+ def treeFilter( t:Tree ) : Queryable[T] = ???
+}
+
+object Queryable {
+ def apply[T:ClassTag] = ???
+ def apply[T:ClassTag]( t:Tree ) = ???
+}
+
+trait CoffeesTable{
+ def sales : Int
+}
+
+object Test extends App{
+ val q = new Queryable[CoffeesTable]
+ Queryable[CoffeesTable]( q.treeFilter(null) )
+}
diff --git a/tests/untried/neg/t5452-old.check b/tests/untried/neg/t5452-old.check
new file mode 100644
index 000000000..1860c98c5
--- /dev/null
+++ b/tests/untried/neg/t5452-old.check
@@ -0,0 +1,8 @@
+t5452-old.scala:28: error: overloaded method value apply with alternatives:
+ ()Queryable[CoffeesTable] <and>
+ (t: Tree)(implicit evidence$2: Manifest[CoffeesTable])Nothing <and>
+ (implicit evidence$1: Manifest[CoffeesTable])Nothing
+ cannot be applied to (Queryable[CoffeesTable])
+ Queryable[CoffeesTable]( q.treeFilter(null) )
+ ^
+one error found
diff --git a/tests/untried/neg/t5452-old.scala b/tests/untried/neg/t5452-old.scala
new file mode 100644
index 000000000..4f6dcbbe4
--- /dev/null
+++ b/tests/untried/neg/t5452-old.scala
@@ -0,0 +1,29 @@
+// /scala/trac/5452/a.scala
+// Mon Feb 13 22:52:36 PST 2012
+
+// import scala.reflect.runtime.universe._
+
+trait Tree
+
+object Bip {
+ def ??? = sys.error("")
+}
+import Bip._
+
+case class Queryable[T]() {
+ def treeFilter( t:Tree ) : Queryable[T] = ???
+}
+
+object Queryable {
+ def apply[T:Manifest] = ???
+ def apply[T:Manifest]( t:Tree ) = ???
+}
+
+trait CoffeesTable{
+ def sales : Int
+}
+
+object Test extends App{
+ val q = new Queryable[CoffeesTable]
+ Queryable[CoffeesTable]( q.treeFilter(null) )
+}
diff --git a/tests/untried/neg/t5455.check b/tests/untried/neg/t5455.check
new file mode 100644
index 000000000..788daf99f
--- /dev/null
+++ b/tests/untried/neg/t5455.check
@@ -0,0 +1,4 @@
+t5455.scala:4: error: lazy vals are not tailcall transformed
+ @annotation.tailrec final lazy val bar: Thing[Int] = {
+ ^
+one error found
diff --git a/tests/untried/neg/t5455.scala b/tests/untried/neg/t5455.scala
new file mode 100644
index 000000000..6e5433578
--- /dev/null
+++ b/tests/untried/neg/t5455.scala
@@ -0,0 +1,16 @@
+trait Test {
+ def root: Test
+
+ @annotation.tailrec final lazy val bar: Thing[Int] = {
+ if (this eq root)
+ Thing(() => System.identityHashCode(bar))
+ else
+ root.bar
+ }
+
+ def f = bar.f()
+}
+
+case class Thing[A](f: () => A) {
+ override def toString = "" + f()
+}
diff --git a/tests/untried/neg/t5493.check b/tests/untried/neg/t5493.check
new file mode 100644
index 000000000..78b1536bc
--- /dev/null
+++ b/tests/untried/neg/t5493.check
@@ -0,0 +1,4 @@
+t5493.scala:2: error: not found: value iDontExist
+ def meh(xs: Any): Any = xs :: iDontExist :: Nil
+ ^
+one error found
diff --git a/tests/untried/neg/t5493.scala b/tests/untried/neg/t5493.scala
new file mode 100644
index 000000000..459cf53bb
--- /dev/null
+++ b/tests/untried/neg/t5493.scala
@@ -0,0 +1,3 @@
+object Test {
+ def meh(xs: Any): Any = xs :: iDontExist :: Nil
+}
diff --git a/tests/untried/neg/t5497.check b/tests/untried/neg/t5497.check
new file mode 100644
index 000000000..4d6d52b51
--- /dev/null
+++ b/tests/untried/neg/t5497.check
@@ -0,0 +1,4 @@
+t5497.scala:3: error: not found: value sq
+ case other => println(null.asInstanceOf[sq.Filter].tableName)
+ ^
+one error found
diff --git a/tests/untried/neg/t5497.scala b/tests/untried/neg/t5497.scala
new file mode 100644
index 000000000..c846b1ba5
--- /dev/null
+++ b/tests/untried/neg/t5497.scala
@@ -0,0 +1,5 @@
+object TestQueryable extends App{
+ ({
+ case other => println(null.asInstanceOf[sq.Filter].tableName)
+ } : Any => Unit)(null)
+}
diff --git a/tests/untried/neg/t550.check b/tests/untried/neg/t550.check
new file mode 100644
index 000000000..da862e110
--- /dev/null
+++ b/tests/untried/neg/t550.check
@@ -0,0 +1,7 @@
+t550.scala:6: error: type List takes type parameters
+ def sum[a](xs: List)(implicit m: Monoid[a]): a =
+ ^
+t550.scala:8: error: could not find implicit value for parameter m: Monoid[a]
+ sum(List(1,2,3))
+ ^
+two errors found
diff --git a/tests/untried/neg/t550.scala b/tests/untried/neg/t550.scala
new file mode 100644
index 000000000..5212a2658
--- /dev/null
+++ b/tests/untried/neg/t550.scala
@@ -0,0 +1,9 @@
+abstract class Monoid[a] {
+ def unit: a
+}
+
+object test {
+ def sum[a](xs: List)(implicit m: Monoid[a]): a =
+ if (xs.isEmpty) m.unit else xs.head
+ sum(List(1,2,3))
+}
diff --git a/tests/untried/neg/t5510.check b/tests/untried/neg/t5510.check
new file mode 100644
index 000000000..322a2f5e2
--- /dev/null
+++ b/tests/untried/neg/t5510.check
@@ -0,0 +1,19 @@
+t5510.scala:2: error: unclosed string literal
+ val s1 = s"xxx
+ ^
+t5510.scala:3: error: unclosed string literal
+ val s2 = s"xxx $x
+ ^
+t5510.scala:4: error: unclosed string literal
+ val s3 = s"xxx $$
+ ^
+t5510.scala:5: error: unclosed string literal
+ val s4 = ""s"
+ ^
+t5510.scala:6: error: unclosed multi-line string literal
+ val s5 = ""s""" $s1 $s2 s"
+ ^
+t5510.scala:7: error: unclosed multi-line string literal
+}
+ ^
+6 errors found
diff --git a/tests/untried/neg/t5510.scala b/tests/untried/neg/t5510.scala
new file mode 100644
index 000000000..12630eb2c
--- /dev/null
+++ b/tests/untried/neg/t5510.scala
@@ -0,0 +1,7 @@
+object Test {
+ val s1 = s"xxx
+ val s2 = s"xxx $x
+ val s3 = s"xxx $$
+ val s4 = ""s"
+ val s5 = ""s""" $s1 $s2 s"
+}
diff --git a/tests/untried/neg/t5529.check b/tests/untried/neg/t5529.check
new file mode 100644
index 000000000..da3f84e1e
--- /dev/null
+++ b/tests/untried/neg/t5529.check
@@ -0,0 +1,7 @@
+t5529.scala:12: error: File is already defined as class File
+ type File
+ ^
+t5529.scala:10: error: class type required but test.Test.File found
+ sealed class Dir extends File { }
+ ^
+two errors found
diff --git a/tests/untried/neg/t5529.scala b/tests/untried/neg/t5529.scala
new file mode 100644
index 000000000..033009a8a
--- /dev/null
+++ b/tests/untried/neg/t5529.scala
@@ -0,0 +1,13 @@
+// /scala/trac/5529/a.scala
+// Tue Feb 28 13:11:28 PST 2012
+
+package test;
+
+object Test {
+ sealed class File {
+ val i = 1
+ }
+ sealed class Dir extends File { }
+
+ type File
+}
diff --git a/tests/untried/neg/t5543.check b/tests/untried/neg/t5543.check
new file mode 100644
index 000000000..b61de0f78
--- /dev/null
+++ b/tests/untried/neg/t5543.check
@@ -0,0 +1,10 @@
+t5543.scala:3: error: not found: type T
+ def this(x: T) { this() }
+ ^
+t5543.scala:11: error: not found: value x
+ def this(a: Int, b: Int = x) {
+ ^
+t5543.scala:18: error: not found: value x
+ def this(a: Int = x) { this() }
+ ^
+three errors found
diff --git a/tests/untried/neg/t5543.scala b/tests/untried/neg/t5543.scala
new file mode 100644
index 000000000..4e03e6e11
--- /dev/null
+++ b/tests/untried/neg/t5543.scala
@@ -0,0 +1,19 @@
+class C1 {
+ type T
+ def this(x: T) { this() }
+}
+
+class C1a[T] {
+ def this(x: T) { this() } // works, no error here
+}
+
+class C2(x: Int) {
+ def this(a: Int, b: Int = x) {
+ this(b)
+ }
+}
+
+class C3 {
+ val x = 0
+ def this(a: Int = x) { this() }
+}
diff --git a/tests/untried/neg/t5544.check b/tests/untried/neg/t5544.check
new file mode 100644
index 000000000..d4113935a
--- /dev/null
+++ b/tests/untried/neg/t5544.check
@@ -0,0 +1,4 @@
+Test_2.scala:2: error: value baz is not a member of object Api
+ Api.baz
+ ^
+one error found
diff --git a/tests/untried/neg/t5544/Api_1.scala b/tests/untried/neg/t5544/Api_1.scala
new file mode 100644
index 000000000..77637f440
--- /dev/null
+++ b/tests/untried/neg/t5544/Api_1.scala
@@ -0,0 +1,8 @@
+import scala.annotation.StaticAnnotation
+
+class ann(val bar: Any) extends StaticAnnotation
+
+object Api {
+ @ann({def baz = "baz!!"})
+ def foo = println("foo")
+}
diff --git a/tests/untried/neg/t5544/Test_2.scala b/tests/untried/neg/t5544/Test_2.scala
new file mode 100644
index 000000000..4c8c99cbc
--- /dev/null
+++ b/tests/untried/neg/t5544/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Api.baz
+}
diff --git a/tests/untried/neg/t5553_1.check b/tests/untried/neg/t5553_1.check
new file mode 100644
index 000000000..afd648988
--- /dev/null
+++ b/tests/untried/neg/t5553_1.check
@@ -0,0 +1,54 @@
+t5553_1.scala:18: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (z: String)Base[T]
+and method apply in object Foo1 of type (a: Int)Base[T]
+match expected type ?
+ def test1[T] = Foo1[T]
+ ^
+t5553_1.scala:19: error: type mismatch;
+ found : [T](z: String)Base[T] <and> (a: Int)Base[T]
+ required: Int
+ def test2[T]: Int = Foo1[T]
+ ^
+t5553_1.scala:20: error: type mismatch;
+ found : [T(in method apply)](z: String)Base[T(in method apply)] <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test3)]
+ def test3[T]: Base[T] = Foo1[T]
+ ^
+t5553_1.scala:24: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (z: String)Base[T]
+and method apply in object Foo2 of type (a: Int)Base[T]
+match expected type ?
+ def test4[T] = Foo2[T]
+ ^
+t5553_1.scala:25: error: type mismatch;
+ found : [T](z: String)Base[T] <and> (a: Int)Base[T]
+ required: Int
+ def test5[T]: Int = Foo2[T]
+ ^
+t5553_1.scala:26: error: type mismatch;
+ found : [T(in method apply)](z: String)Base[T(in method apply)] <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test6)]
+ def test6[T]: Base[T] = Foo2[T]
+ ^
+t5553_1.scala:30: error: ambiguous reference to overloaded definition,
+both method apply in object Foo3 of type (z: String)String
+and method apply in object Foo3 of type (a: Int)Base[T]
+match expected type ?
+ def test7[T] = Foo3[T]
+ ^
+t5553_1.scala:31: error: type mismatch;
+ found : [T](z: String)String <and> (a: Int)Base[T]
+ required: String
+ def test8[T]: String = Foo3[T]
+ ^
+t5553_1.scala:32: error: type mismatch;
+ found : [T](z: String)String <and> (a: Int)Base[T]
+ required: Int
+ def test9[T]: Int = Foo3[T]
+ ^
+t5553_1.scala:33: error: type mismatch;
+ found : [T(in method apply)](z: String)String <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test10)]
+ def test10[T]: Base[T] = Foo3[T]
+ ^
+10 errors found
diff --git a/tests/untried/neg/t5553_1.scala b/tests/untried/neg/t5553_1.scala
new file mode 100644
index 000000000..32d61ec85
--- /dev/null
+++ b/tests/untried/neg/t5553_1.scala
@@ -0,0 +1,34 @@
+class Base[T]
+
+object Foo1 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String): Base[T] = new Base[T]
+}
+
+object Foo2 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String="abc"): Base[T] = new Base[T]
+}
+
+object Foo3 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String="abc"): String = z
+}
+object Test {
+ def test1[T] = Foo1[T]
+ def test2[T]: Int = Foo1[T]
+ def test3[T]: Base[T] = Foo1[T]
+}
+
+object Test2 {
+ def test4[T] = Foo2[T]
+ def test5[T]: Int = Foo2[T]
+ def test6[T]: Base[T] = Foo2[T]
+}
+
+object Test3{
+ def test7[T] = Foo3[T]
+ def test8[T]: String = Foo3[T]
+ def test9[T]: Int = Foo3[T]
+ def test10[T]: Base[T] = Foo3[T]
+}
diff --git a/tests/untried/neg/t5553_2.check b/tests/untried/neg/t5553_2.check
new file mode 100644
index 000000000..599fdb052
--- /dev/null
+++ b/tests/untried/neg/t5553_2.check
@@ -0,0 +1,50 @@
+t5553_2.scala:27: error: type mismatch;
+ found : Base[T]
+ required: Int
+ def test4[T]: Int = Foo1[T](1)
+ ^
+t5553_2.scala:34: error: type mismatch;
+ found : String
+ required: Base[T]
+ def test7[T]: Base[T] = Foo2[T]
+ ^
+t5553_2.scala:35: error: type mismatch;
+ found : String
+ required: Int
+ def test8[T]: Int = Foo2[T]
+ ^
+t5553_2.scala:40: error: type mismatch;
+ found : String
+ required: Int
+ def test9[T]: Int = Foo3[T]
+ ^
+t5553_2.scala:41: error: type mismatch;
+ found : String
+ required: Base[T]
+ def test10[T]: Base[T] = Foo3[T]
+ ^
+t5553_2.scala:47: error: could not find implicit value for parameter z: String
+ def test13[T]: Int = Foo3[T]
+ ^
+t5553_2.scala:48: error: could not find implicit value for parameter z: String
+ def test14[T]: Base[T] = Foo3[T]
+ ^
+t5553_2.scala:49: error: could not find implicit value for parameter z: String
+ def test15[T]: String = Foo3[T]
+ ^
+t5553_2.scala:50: error: could not find implicit value for parameter z: String
+ def test16[T] = Foo3[T]
+ ^
+t5553_2.scala:54: error: ambiguous reference to overloaded definition,
+both method apply in object Foo4 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo4 of type (x: Int)Base[T]
+match argument types (Int)
+ def test17[T] = Foo4[T](1)
+ ^
+t5553_2.scala:55: error: ambiguous reference to overloaded definition,
+both method apply in object Foo4 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo4 of type (x: Int)Base[T]
+match argument types (Int) and expected result type Base[T]
+ def test18[T]: Base[T] = Foo4[T](1)
+ ^
+11 errors found
diff --git a/tests/untried/neg/t5553_2.scala b/tests/untried/neg/t5553_2.scala
new file mode 100644
index 000000000..16958aec8
--- /dev/null
+++ b/tests/untried/neg/t5553_2.scala
@@ -0,0 +1,59 @@
+class Base[T]
+
+object Foo1 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int, z: String="abc"): String = z
+}
+
+object Foo2 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T]: String = "abc"
+}
+
+object Foo3 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](implicit z: String): String = z
+}
+
+object Foo4 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int)(implicit z: String): Base[T] = new Base[T]
+}
+
+object Test1 {
+ def test1[T] = Foo1[T](1)
+ def test2[T]: String = Foo1[T](1)
+ def test3[T]: Base[T] = Foo1[T](1)
+ def test4[T]: Int = Foo1[T](1)
+
+}
+
+object Test2 {
+ def test5[T] = Foo2[T]
+ def test6[T]: String = Foo2[T]
+ def test7[T]: Base[T] = Foo2[T]
+ def test8[T]: Int = Foo2[T]
+}
+
+object Test3 {
+ implicit val v: String = "abc"
+ def test9[T]: Int = Foo3[T]
+ def test10[T]: Base[T] = Foo3[T]
+ def test11[T]: String = Foo3[T]
+ def test12[T] = Foo3[T]
+}
+
+object Test4 {
+ def test13[T]: Int = Foo3[T]
+ def test14[T]: Base[T] = Foo3[T]
+ def test15[T]: String = Foo3[T]
+ def test16[T] = Foo3[T]
+}
+
+object Test5 {
+ def test17[T] = Foo4[T](1)
+ def test18[T]: Base[T] = Foo4[T](1)
+ //def test19[T]: String = Foo4[T](1) // #5554
+}
+
+
diff --git a/tests/untried/neg/t5554.check b/tests/untried/neg/t5554.check
new file mode 100644
index 000000000..8f657fd32
--- /dev/null
+++ b/tests/untried/neg/t5554.check
@@ -0,0 +1,67 @@
+t5554.scala:14: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test1[T]: Int = Foo1[T](1)
+ ^
+t5554.scala:16: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test3[T]: String = Foo1[T](1)
+ ^
+t5554.scala:17: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test4[T] = Foo1[T](1)
+ ^
+t5554.scala:22: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test5[T]: Int = Foo1[T](1)
+ ^
+t5554.scala:25: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test8[T] = Foo1[T](1)
+ ^
+t5554.scala:29: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int)
+ def test9[T]: String = Foo2[T](1)
+ ^
+t5554.scala:30: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int) and expected result type Base[T]
+ def test10[T]: Base[T] = Foo2[T](1)
+ ^
+t5554.scala:31: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int)
+ def test11[T] = Foo2[T](1)
+ ^
+t5554.scala:36: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int)
+ def test12[T]: String = Foo2[T](1)
+ ^
+t5554.scala:37: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int) and expected result type Base[T]
+ def test13[T]: Base[T] = Foo2[T](1)
+ ^
+t5554.scala:38: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int)
+ def test14[T] = Foo2[T](1)
+ ^
+11 errors found
diff --git a/tests/untried/neg/t5554.scala b/tests/untried/neg/t5554.scala
new file mode 100644
index 000000000..d279abea7
--- /dev/null
+++ b/tests/untried/neg/t5554.scala
@@ -0,0 +1,39 @@
+class Base[T]
+
+object Foo1 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int)(implicit z: String): String = z
+}
+
+object Foo2 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int)(implicit z: String): Base[T] = new Base[T]
+}
+
+object Test1 {
+ def test1[T]: Int = Foo1[T](1)
+ def test2[T]: Base[T] = Foo1[T](1)
+ def test3[T]: String = Foo1[T](1)
+ def test4[T] = Foo1[T](1)
+}
+
+object Test2 {
+ implicit val v: String = "foo"
+ def test5[T]: Int = Foo1[T](1)
+ def test6[T]: Base[T] = Foo1[T](1)
+ def test7[T]: String = Foo1[T](1)
+ def test8[T] = Foo1[T](1)
+}
+
+object Test3 {
+ def test9[T]: String = Foo2[T](1)
+ def test10[T]: Base[T] = Foo2[T](1)
+ def test11[T] = Foo2[T](1)
+}
+
+object Test4 {
+ implicit val v: String = "foo"
+ def test12[T]: String = Foo2[T](1)
+ def test13[T]: Base[T] = Foo2[T](1)
+ def test14[T] = Foo2[T](1)
+}
diff --git a/tests/untried/neg/t556.check b/tests/untried/neg/t556.check
new file mode 100644
index 000000000..30cc296b3
--- /dev/null
+++ b/tests/untried/neg/t556.check
@@ -0,0 +1,7 @@
+t556.scala:3: error: missing parameter type
+ def g:Int = f((x,y)=>x)
+ ^
+t556.scala:3: error: missing parameter type
+ def g:Int = f((x,y)=>x)
+ ^
+two errors found
diff --git a/tests/untried/neg/t556.scala b/tests/untried/neg/t556.scala
new file mode 100644
index 000000000..b0113258c
--- /dev/null
+++ b/tests/untried/neg/t556.scala
@@ -0,0 +1,4 @@
+object Main extends App {
+ def f(a:Int=>Int):Int = a(4)
+ def g:Int = f((x,y)=>x)
+}
diff --git a/tests/untried/neg/t5564.check b/tests/untried/neg/t5564.check
new file mode 100644
index 000000000..e7e13ccc9
--- /dev/null
+++ b/tests/untried/neg/t5564.check
@@ -0,0 +1,4 @@
+t5564.scala:8: error: inferred type arguments [A] do not conform to method bar's type parameter bounds [B >: A <: C]
+ def bar[B >: A <: C]: T = throw new Exception
+ ^
+one error found
diff --git a/tests/untried/neg/t5564.scala b/tests/untried/neg/t5564.scala
new file mode 100644
index 000000000..663cf8872
--- /dev/null
+++ b/tests/untried/neg/t5564.scala
@@ -0,0 +1,9 @@
+
+
+
+trait C
+
+
+class Foo[@specialized(Int) T, A] {
+ def bar[B >: A <: C]: T = throw new Exception
+}
diff --git a/tests/untried/neg/t5572.check b/tests/untried/neg/t5572.check
new file mode 100644
index 000000000..3c9adf41c
--- /dev/null
+++ b/tests/untried/neg/t5572.check
@@ -0,0 +1,16 @@
+t5572.scala:16: error: type mismatch;
+ found : B
+ 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)
+ ^
+three errors found
diff --git a/tests/untried/neg/t5572.scala b/tests/untried/neg/t5572.scala
new file mode 100644
index 000000000..81f848362
--- /dev/null
+++ b/tests/untried/neg/t5572.scala
@@ -0,0 +1,23 @@
+class A
+class B
+
+trait X
+
+object Z {
+ def transf(a: A, b: B): X = null
+}
+
+class Test {
+
+ def bar(): (A, B)
+
+ def foo: Unit = {
+ val (b, a) = bar()
+ Z.transf(a, b) match {
+ case sth =>
+ run(sth, b)
+ }
+ }
+
+ def run(x: X, z: B): Unit = ()
+}
diff --git a/tests/untried/neg/t5578.check b/tests/untried/neg/t5578.check
new file mode 100644
index 000000000..56123d2e0
--- /dev/null
+++ b/tests/untried/neg/t5578.check
@@ -0,0 +1,7 @@
+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/tests/untried/neg/t5578.scala b/tests/untried/neg/t5578.scala
new file mode 100644
index 000000000..ce72f32d5
--- /dev/null
+++ b/tests/untried/neg/t5578.scala
@@ -0,0 +1,39 @@
+trait Base {
+ type Rep[T]
+}
+
+trait Expressions {
+ // constants/symbols (atomic)
+ abstract class Exp[T]
+ // ...
+ case class Sym[T](n: Int) extends Exp[T]
+
+ // operations (composite, defined in subtraits)
+ abstract class Def[T]
+
+ // additional members for managing encountered definitions
+ def findOrCreateDefinition[T](rhs: Def[T]): Sym[T]
+ implicit def toExp[T:Manifest](d: Def[T]): Exp[T] = findOrCreateDefinition(d)
+}
+
+trait BaseExp extends Base with Expressions {
+ type Rep[T] = Exp[T]
+
+ def findOrCreateDefinition[T](rhs: Def[T]): Sym[T] = null // stub
+}
+
+trait NumericOps extends Base {
+ def plus[T](x: Rep[T], y: Rep[T]): Rep[T]
+}
+
+trait NumericOpsExp extends BaseExp {
+ case class Plus[T:Numeric](x: Rep[T], y: Rep[T])
+ extends Def[T]
+
+ def plus[T: Numeric](x: Rep[T], y: Rep[T]): Rep[T] = Plus[T](x,y)
+
+ // Possible solutions:
+// def plus[T: Numeric: Manifest](x: Rep[T], y: Rep[T]): Rep[T] = Plus[T](x, y)
+// def plus[T](x: Rep[T], y: Rep[T])(implicit num: Numeric[T], man: Manifest[T]): Rep[T] = Plus(x,y)
+
+}
diff --git a/tests/untried/neg/t558.check b/tests/untried/neg/t558.check
new file mode 100644
index 000000000..f33ddc451
--- /dev/null
+++ b/tests/untried/neg/t558.check
@@ -0,0 +1,4 @@
+t558.scala:13: error: value file is not a member of NewModel.this.RootURL
+ final val source = top.file;
+ ^
+one error found
diff --git a/tests/untried/neg/t558.scala b/tests/untried/neg/t558.scala
new file mode 100644
index 000000000..58b030347
--- /dev/null
+++ b/tests/untried/neg/t558.scala
@@ -0,0 +1,19 @@
+package scala.tools.nsc.models;
+import scala.tools.nsc.io.AbstractFile;
+
+abstract class NewModel {
+ abstract class SymbolURL {
+ val top : RootURL;
+ val name : String;
+ val source : AbstractFile;
+ }
+ abstract class NodeURL extends SymbolURL {
+ val parent : SymbolURL;
+ final val top = parent.top;
+ final val source = top.file;
+
+ }
+ abstract class RootURL extends SymbolURL {
+ final val top : RootURL = this;
+ }
+}
diff --git a/tests/untried/neg/t5580a.check b/tests/untried/neg/t5580a.check
new file mode 100644
index 000000000..50a31857d
--- /dev/null
+++ b/tests/untried/neg/t5580a.check
@@ -0,0 +1,6 @@
+t5580a.scala:9: error: polymorphic expression cannot be instantiated to expected type;
+ found : [A]scala.collection.mutable.Set[A]
+ required: scala.collection.mutable.Map[bar,scala.collection.mutable.Set[bar]]
+ if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
+ ^
+one error found
diff --git a/tests/untried/neg/t5580a.scala b/tests/untried/neg/t5580a.scala
new file mode 100644
index 000000000..742f0e85e
--- /dev/null
+++ b/tests/untried/neg/t5580a.scala
@@ -0,0 +1,11 @@
+import scala.collection.mutable.WeakHashMap
+
+class bar{ }
+class foo{
+ val map = WeakHashMap[AnyRef, collection.mutable.Map[bar, collection.mutable.Set[bar]]]()
+
+ def test={
+ val tmp:bar=null
+ if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
+ }
+}
diff --git a/tests/untried/neg/t5580b.check b/tests/untried/neg/t5580b.check
new file mode 100644
index 000000000..45fde46ff
--- /dev/null
+++ b/tests/untried/neg/t5580b.check
@@ -0,0 +1,6 @@
+t5580b.scala:11: error: polymorphic expression cannot be instantiated to expected type;
+ found : [A]scala.collection.mutable.Set[A]
+ required: scala.collection.mutable.Map[bar,scala.collection.mutable.Set[bar]]
+ if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
+ ^
+one error found
diff --git a/tests/untried/neg/t5580b.scala b/tests/untried/neg/t5580b.scala
new file mode 100644
index 000000000..2161da458
--- /dev/null
+++ b/tests/untried/neg/t5580b.scala
@@ -0,0 +1,13 @@
+import scala.collection.mutable.WeakHashMap
+import scala.collection.JavaConversions._
+
+class bar { }
+
+class foo {
+ val map = WeakHashMap[AnyRef, collection.mutable.Map[bar, collection.mutable.Set[bar]]]()
+
+ def test={
+ val tmp:bar=null
+ if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
+ }
+}
diff --git a/tests/untried/neg/t5617.check b/tests/untried/neg/t5617.check
new file mode 100644
index 000000000..79cc3a1e3
--- /dev/null
+++ b/tests/untried/neg/t5617.check
@@ -0,0 +1,8 @@
+t5617.scala:12: error: method foo overrides nothing.
+Note: the super classes of trait C contain the following, non final members named foo:
+def foo(u: Unit): Int
+def foo(x: Boolean): Int
+def foo(i: Int)(b: String): Int
+ override def foo(s: String): Int
+ ^
+one error found
diff --git a/tests/untried/neg/t5617.scala b/tests/untried/neg/t5617.scala
new file mode 100644
index 000000000..41541b5e9
--- /dev/null
+++ b/tests/untried/neg/t5617.scala
@@ -0,0 +1,14 @@
+trait A {
+ def foo(i: Int)(b: String): Int
+ def foo(u: Unit): Int // not reported
+ def foo(x: Float): Int // not reported
+}
+trait B[X] extends A {
+ def foo(x: X): Int
+ def foo(u: Unit): Int
+ final def foo(x: Float): Int = 0 // not reported
+}
+trait C extends B[Boolean] {
+ override def foo(s: String): Int
+ val foo = 0 // not reported
+}
diff --git a/tests/untried/neg/t562.check b/tests/untried/neg/t562.check
new file mode 100644
index 000000000..8c3823642
--- /dev/null
+++ b/tests/untried/neg/t562.check
@@ -0,0 +1,4 @@
+t562.scala:10: error: super may be not be used on value y
+ override val y = super.y;
+ ^
+one error found
diff --git a/tests/untried/neg/t562.scala b/tests/untried/neg/t562.scala
new file mode 100644
index 000000000..c4a6e6174
--- /dev/null
+++ b/tests/untried/neg/t562.scala
@@ -0,0 +1,11 @@
+package test;
+
+abstract class XXX;
+
+trait YYY extends XXX {
+ val y = 10;
+}
+
+class Foo extends XXX with YYY {
+ override val y = super.y;
+}
diff --git a/tests/untried/neg/t563.check b/tests/untried/neg/t563.check
new file mode 100644
index 000000000..1431c85eb
--- /dev/null
+++ b/tests/untried/neg/t563.check
@@ -0,0 +1,4 @@
+t563.scala:6: error: missing parameter type
+ map(n,ptr => Option(ptr.get));
+ ^
+one error found
diff --git a/tests/untried/neg/t563.scala b/tests/untried/neg/t563.scala
new file mode 100644
index 000000000..204ad3cbd
--- /dev/null
+++ b/tests/untried/neg/t563.scala
@@ -0,0 +1,7 @@
+object Test {
+ def map[A,R](a : List[A], f : A => R) : List[R] = a.map(f);
+
+ def split(sn : Iterable[List[Option[Int]]]) : Unit =
+ for (n <- sn)
+ map(n,ptr => Option(ptr.get));
+}
diff --git a/tests/untried/neg/t565.check b/tests/untried/neg/t565.check
new file mode 100644
index 000000000..136cc94b6
--- /dev/null
+++ b/tests/untried/neg/t565.check
@@ -0,0 +1,5 @@
+t565.scala:2: error: only classes can have declared but undefined members
+(Note that variables need to be initialized to be defined)
+ var s0: String
+ ^
+one error found
diff --git a/tests/untried/neg/t565.scala b/tests/untried/neg/t565.scala
new file mode 100644
index 000000000..9a4732fcc
--- /dev/null
+++ b/tests/untried/neg/t565.scala
@@ -0,0 +1,3 @@
+object test {
+ var s0: String
+}
diff --git a/tests/untried/neg/t5663-badwarneq.check b/tests/untried/neg/t5663-badwarneq.check
new file mode 100644
index 000000000..732e4f44d
--- /dev/null
+++ b/tests/untried/neg/t5663-badwarneq.check
@@ -0,0 +1,42 @@
+t5663-badwarneq.scala:47: warning: comparing case class values of types Some[Int] and None.type using `==' will always yield false
+ println(new Some(1) == None) // Should complain on type, was: spuriously complains on fresh object
+ ^
+t5663-badwarneq.scala:48: warning: comparing case class values of types Some[Int] and Thing using `==' will always yield false
+ println(Some(1) == new Thing(1)) // Should complain on type, was: spuriously complains on fresh object
+ ^
+t5663-badwarneq.scala:56: warning: ThingOne and Thingy are unrelated: they will most likely never compare equal
+ println(t1 == t2) // true, but apparently unrelated, a compromise warning
+ ^
+t5663-badwarneq.scala:57: warning: ThingThree and Thingy are unrelated: they will most likely never compare equal
+ println(t4 == t2) // true, complains because ThingThree is final and Thingy not a subclass, stronger claim than unrelated
+ ^
+t5663-badwarneq.scala:60: warning: comparing case class values of types ThingTwo and Some[Int] using `==' will always yield false
+ println(t3 == Some(1)) // false, warn on different cases
+ ^
+t5663-badwarneq.scala:61: warning: comparing values of types ThingOne and Cousin using `==' will always yield false
+ println(t1 == c) // should warn
+ ^
+t5663-badwarneq.scala:69: warning: comparing case class values of types Simple and SimpleSibling.type using `==' will always yield false
+ println(new Simple() == SimpleSibling) // like Some(1) == None, but needn't be final case
+ ^
+t5663-badwarneq.scala:72: warning: ValueClass1 and Int are unrelated: they will never compare equal
+ println(new ValueClass1(5) == 5) // bad
+ ^
+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:78: warning: ValueClass2[String] and String are unrelated: they will never compare equal
+ println(new ValueClass2("abc") == "abc") // bad
+ ^
+t5663-badwarneq.scala:79: warning: ValueClass2[Int] and ValueClass1 are unrelated: they will never compare equal
+ println(new ValueClass2(5) == new ValueClass1(5)) // bad - different value classes
+ ^
+t5663-badwarneq.scala:81: warning: comparing values of types ValueClass3 and ValueClass2[Int] using `==' will always yield false
+ println(ValueClass3(5) == new ValueClass2(5)) // bad
+ ^
+t5663-badwarneq.scala:82: warning: comparing values of types ValueClass3 and Int using `==' will always yield false
+ println(ValueClass3(5) == 5) // bad
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+13 warnings found
+one error found
diff --git a/tests/untried/neg/t5663-badwarneq.flags b/tests/untried/neg/t5663-badwarneq.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t5663-badwarneq.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t5663-badwarneq.scala b/tests/untried/neg/t5663-badwarneq.scala
new file mode 100644
index 000000000..1cc554264
--- /dev/null
+++ b/tests/untried/neg/t5663-badwarneq.scala
@@ -0,0 +1,94 @@
+
+// alias
+trait Thingy
+
+class Gramps
+
+// sibling classes that extend a case class
+case class Thing(i: Int) extends Gramps
+class ThingOne(x:Int) extends Thing(x)
+class ThingTwo(y:Int) extends Thing(y) with Thingy
+final class ThingThree(z:Int) extends Thing(z)
+
+// not case cousin
+class Cousin extends Gramps
+
+class SimpleParent
+case class Simple() extends SimpleParent
+case object SimpleSibling extends SimpleParent
+
+// value classes
+final class ValueClass1(val value: Int) extends AnyVal
+final class ValueClass2[T](val value: T) extends AnyVal
+final case class ValueClass3(val value: Int) extends AnyVal
+
+/* It's not possible to run partest without -deprecation.
+ * Since detecting the warnings requires a neg test with
+ * -Xfatal-warnings, and deprecation terminates the compile,
+ * we'll just comment out the nasty part. The point was
+ * just to show there's nothing special about a trait
+ * that extends a case class, which is only permitted
+ * (deprecatingly) by omitting the parens.
+ *
+// common ancestor is something else
+class AnyThing
+case class SomeThing extends AnyThing // deprecation
+class OtherThing extends AnyThing
+
+// how you inherit caseness doesn't matter
+trait InThing extends SomeThing
+class MyThing extends InThing
+*/
+
+object Test {
+ def main(a: Array[String]): Unit = {
+ // nothing to do with Gavin
+ println(new Some(1) == new Some(1)) // OK, true
+ println(new Some(1) == None) // Should complain on type, was: spuriously complains on fresh object
+ println(Some(1) == new Thing(1)) // Should complain on type, was: spuriously complains on fresh object
+
+ val t1 = new ThingOne(11)
+ val t2: Thingy = new ThingTwo(11)
+ val t3 = new ThingTwo(11)
+ val t4 = new ThingThree(11)
+ val c = new Cousin
+
+ println(t1 == t2) // true, but apparently unrelated, a compromise warning
+ println(t4 == t2) // true, complains because ThingThree is final and Thingy not a subclass, stronger claim than unrelated
+ println(t2 == t3) // OK, two Thingy
+ println(t3 == t2) // ditto with case receiver
+ println(t3 == Some(1)) // false, warn on different cases
+ println(t1 == c) // should warn
+
+ // don't warn on fresh cases
+ println(new ThingOne(11) == t1) // OK, was: two cases not warnable on trunk
+ println(new ThingTwo(11) == t2) // true, was: spuriously complains on fresh object
+ println(new ThingOne(11) == t3) // two cases not warnable on trunk
+ println(new ThingTwo(11) == t3) // ditto
+
+ println(new Simple() == SimpleSibling) // like Some(1) == None, but needn't be final case
+
+ println(new ValueClass1(5) == new ValueClass1(5)) // ok
+ println(new ValueClass1(5) == 5) // bad
+ println(new ValueClass1(5) == (5: Any)) // ok, have to let it through
+ println(5 == new ValueClass1(5)) // bad
+ println((5: Any) == new ValueClass1(5) == (5: Any)) // ok
+
+ println(new ValueClass2("abc") == new ValueClass2("abc")) // ok
+ println(new ValueClass2("abc") == "abc") // bad
+ println(new ValueClass2(5) == new ValueClass1(5)) // bad - different value classes
+ println(ValueClass3(5) == new ValueClass3(5)) // ok
+ println(ValueClass3(5) == new ValueClass2(5)) // bad
+ println(ValueClass3(5) == 5) // bad
+
+ /*
+ val mine = new MyThing
+ val some = new SomeThing
+ val other = new OtherThing
+ println(mine == some) // OK, two Something
+ println(some == mine)
+ println(mine == other) // OK, two Anything?
+ println(mine == t1) // false
+ */
+ }
+}
diff --git a/tests/untried/neg/t5666.check b/tests/untried/neg/t5666.check
new file mode 100644
index 000000000..1c714796b
--- /dev/null
+++ b/tests/untried/neg/t5666.check
@@ -0,0 +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/tests/untried/neg/t5666.scala b/tests/untried/neg/t5666.scala
new file mode 100644
index 000000000..21ab9f45a
--- /dev/null
+++ b/tests/untried/neg/t5666.scala
@@ -0,0 +1,14 @@
+object t5666 {
+ new Any
+ new AnyVal
+ new Double
+ new Float
+ new Long
+ new Int
+ new Char
+ new Short
+ new Byte
+ new Boolean
+ new Unit
+ new Nothing
+}
diff --git a/tests/untried/neg/t5675.check b/tests/untried/neg/t5675.check
new file mode 100644
index 000000000..da608a2b7
--- /dev/null
+++ b/tests/untried/neg/t5675.check
@@ -0,0 +1,2 @@
+error: there were 1 feature warning(s); re-run with -feature for details
+one error found
diff --git a/tests/untried/neg/t5675.flags b/tests/untried/neg/t5675.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t5675.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t5675.scala b/tests/untried/neg/t5675.scala
new file mode 100644
index 000000000..12f2973c7
--- /dev/null
+++ b/tests/untried/neg/t5675.scala
@@ -0,0 +1,7 @@
+class PostFix {
+ val list = List(1, 2, 3)
+ def main(args: Array[String]): Unit = {
+ val a = list filter (2 !=)
+ val b = list filter (2 != _)
+ }
+}
diff --git a/tests/untried/neg/t5683.check b/tests/untried/neg/t5683.check
new file mode 100644
index 000000000..7c0e50113
--- /dev/null
+++ b/tests/untried/neg/t5683.check
@@ -0,0 +1,16 @@
+t5683.scala:12: error: inferred kinds of the type arguments (Object,Int) do not conform to the expected kinds of the type parameters (type M,type B).
+Object's type parameters do not match type M's expected parameters:
+class Object has no type parameters, but type M has one
+ val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] }
+ ^
+t5683.scala:12: error: type mismatch;
+ found : Int => Test.W[String,Int]
+ required: Int => M[B]
+ val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] }
+ ^
+t5683.scala:12: error: type mismatch;
+ found : Test.K[M,Int,B]
+ required: Test.K[Test.StringW,Int,Int]
+ val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] }
+ ^
+three errors found
diff --git a/tests/untried/neg/t5683.scala b/tests/untried/neg/t5683.scala
new file mode 100644
index 000000000..05ab03579
--- /dev/null
+++ b/tests/untried/neg/t5683.scala
@@ -0,0 +1,23 @@
+object Test {
+ trait NT[X]
+ trait W[W, A] extends NT[Int]
+ type StringW[T] = W[String, T]
+ trait K[M[_], A, B]
+
+ def k[M[_], B](f: Int => M[B]): K[M, Int, B] = null
+
+ val okay1: K[StringW,Int,Int] = k{ (y: Int) => null: StringW[Int] }
+ val okay2 = k[StringW,Int]{ (y: Int) => null: W[String, Int] }
+
+ val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] }
+
+ // remove `extends NT[Int]`, and the last line gives an inference error
+ // rather than a crash.
+ // test/files/pos/t5683.scala:12: error: no type parameters for method k: (f: Int => M[B])Test.K[M,Int,B] exist so that it can be applied to arguments (Int => Test.W[String,Int])
+ // --- because ---
+ // argument expression's type is not compatible with formal parameter type;
+ // found : Int => Test.W[String,Int]
+ // required: Int => ?M[?B]
+ // val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] }
+ // ^
+}
diff --git a/tests/untried/neg/t5687.check b/tests/untried/neg/t5687.check
new file mode 100644
index 000000000..5096077ee
--- /dev/null
+++ b/tests/untried/neg/t5687.check
@@ -0,0 +1,8 @@
+t5687.scala:4: error: type arguments [T] do not conform to class Template's type parameter bounds [T <: AnyRef]
+ type Repr[T]<:Template[T]
+ ^
+t5687.scala:20: error: overriding type Repr in class Template with bounds[T] <: Template[T];
+ type Repr has incompatible type
+ type Repr = CurveTemplate[T]
+ ^
+two errors found
diff --git a/tests/untried/neg/t5687.scala b/tests/untried/neg/t5687.scala
new file mode 100644
index 000000000..6ffecf972
--- /dev/null
+++ b/tests/untried/neg/t5687.scala
@@ -0,0 +1,55 @@
+abstract class Template[T <: AnyRef](private val t: T) {
+
+// type Repr[A<:AnyRef]<:Template[T]
+ type Repr[T]<:Template[T]
+
+ def access1(timeout: Int): Repr[T] = this.asInstanceOf[Repr[T]]
+ def access2: Repr[T] = this.asInstanceOf[Repr[T]]
+ val access3: Repr[T] = this.asInstanceOf[Repr[T]]
+ def access4(v: Repr[T]): Repr[T] = this.asInstanceOf[Repr[T]]
+ def access5(x: X): Repr[T] = this.asInstanceOf[Repr[T]]
+ def access5(x: Y): Repr[T] = this.asInstanceOf[Repr[T]]
+
+ def withReadModifiers(readModifiers:Int): Repr[T] = this.asInstanceOf[Repr[T]]
+}
+
+class Curve
+
+class CurveTemplate [T <: Curve](t: T) extends Template(t) {
+// type Repr[A<: AnyRef] = CurveTemplate[T]
+ type Repr = CurveTemplate[T]
+}
+
+class Base
+class X extends Base
+class Y extends Base
+
+
+object Example {
+ def test1(): Unit = {
+ new CurveTemplate(new Curve).access1(10)
+
+ new CurveTemplate(new Curve).access2
+
+ new CurveTemplate(new Curve).access3
+
+ new CurveTemplate(new Curve).access4(null)
+
+ new CurveTemplate(new Curve).access5(new X)
+
+ ()
+
+ }
+
+ def test2(): Unit = {
+ new CurveTemplate(new Curve).access1(10).withReadModifiers(1)
+
+ new CurveTemplate(new Curve).access2.withReadModifiers(1)
+
+ new CurveTemplate(new Curve).access3.withReadModifiers(1)
+
+ new CurveTemplate(new Curve).access4(null).withReadModifiers(1)
+
+ new CurveTemplate(new Curve).access5(new X).withReadModifiers(1)
+ }
+}
diff --git a/tests/untried/neg/t5689.check b/tests/untried/neg/t5689.check
new file mode 100644
index 000000000..7d4f7fb63
--- /dev/null
+++ b/tests/untried/neg/t5689.check
@@ -0,0 +1,8 @@
+t5689.scala:4: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(i: c.Expr[Double]): c.Expr[String]
+ or : (c: scala.reflect.macros.blackbox.Context)(i: c.Tree): c.Tree
+ found : (c: scala.reflect.macros.blackbox.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
+ ^
+one error found
diff --git a/tests/untried/neg/t5689.flags b/tests/untried/neg/t5689.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/t5689.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/t5689.scala b/tests/untried/neg/t5689.scala
new file mode 100644
index 000000000..d757a5541
--- /dev/null
+++ b/tests/untried/neg/t5689.scala
@@ -0,0 +1,6 @@
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def returnsString(i: Double): String = macro returnsIntImpl
+ def returnsIntImpl(c: Context)(i: c.Expr[Double]): c.Expr[Int] = ???
+}
diff --git a/tests/untried/neg/t5696.check b/tests/untried/neg/t5696.check
new file mode 100644
index 000000000..e0fb61b83
--- /dev/null
+++ b/tests/untried/neg/t5696.check
@@ -0,0 +1,19 @@
+t5696.scala:6: error: too many argument lists for constructor invocation
+ new G(1)(2) {}
+ ^
+t5696.scala:14: error: too many argument lists for constructor invocation
+ new G()(2) {}
+ ^
+t5696.scala:22: error: too many argument lists for constructor invocation
+ new G[Int]()(2) {}
+ ^
+t5696.scala:30: error: too many argument lists for constructor invocation
+ new G[Int]()(2)(3) {}
+ ^
+t5696.scala:38: error: too many argument lists for constructor invocation
+ new G[Int]()()(2) {}
+ ^
+t5696.scala:46: error: too many argument lists for constructor invocation
+ object x extends G(1)(2) {}
+ ^
+6 errors found
diff --git a/tests/untried/neg/t5696.scala b/tests/untried/neg/t5696.scala
new file mode 100644
index 000000000..051e3a07f
--- /dev/null
+++ b/tests/untried/neg/t5696.scala
@@ -0,0 +1,47 @@
+class TestApply1 {
+ class G(y: Int) {
+ def apply(x: Int) = 1
+ }
+
+ new G(1)(2) {}
+}
+
+class TestApply2 {
+ class G {
+ def apply(x: Int) = 1
+ }
+
+ new G()(2) {}
+}
+
+class TestApply3 {
+ class G[X] {
+ def apply(x: Int) = 1
+ }
+
+ new G[Int]()(2) {}
+}
+
+class TestApply4 {
+ class G[X] {
+ def apply(x: Int)(y: Int) = 1
+ }
+
+ new G[Int]()(2)(3) {}
+}
+
+class TestApply5 {
+ class G[X]()() {
+ def apply(x: Int) = 1
+ }
+
+ new G[Int]()()(2) {}
+}
+
+class TestApply6 {
+ class G(y: Int) {
+ def apply(x: Int) = 1
+ }
+
+ object x extends G(1)(2) {}
+}
diff --git a/tests/untried/neg/t5702-neg-bad-and-wild.check b/tests/untried/neg/t5702-neg-bad-and-wild.check
new file mode 100644
index 000000000..a52136dbf
--- /dev/null
+++ b/tests/untried/neg/t5702-neg-bad-and-wild.check
@@ -0,0 +1,28 @@
+t5702-neg-bad-and-wild.scala:10: error: bad simple pattern: bad use of _* (a sequence pattern must be the last pattern)
+ case List(1, _*,) => // bad use of _* (a sequence pattern must be the last pattern)
+ ^
+t5702-neg-bad-and-wild.scala:10: error: illegal start of simple pattern
+ case List(1, _*,) => // bad use of _* (a sequence pattern must be the last pattern)
+ ^
+t5702-neg-bad-and-wild.scala:12: error: illegal start of simple pattern
+ case List(1, _*3,) => // illegal start of simple pattern
+ ^
+t5702-neg-bad-and-wild.scala:14: error: bad simple pattern: use _* to match a sequence
+ case List(1, x*) => // use _* to match a sequence
+ ^
+t5702-neg-bad-and-wild.scala:15: error: bad simple pattern: trailing * is not a valid pattern
+ case List(x*, 1) => // trailing * is not a valid pattern
+ ^
+t5702-neg-bad-and-wild.scala:16: error: bad simple pattern: trailing * is not a valid pattern
+ case (1, x*) => // trailing * is not a valid pattern
+ ^
+t5702-neg-bad-and-wild.scala:17: error: bad simple pattern: bad use of _* (sequence pattern not allowed)
+ case (1, x@_*) => // bad use of _* (sequence pattern not allowed)
+ ^
+t5702-neg-bad-and-wild.scala:23: error: bad simple pattern: bad use of _* (a sequence pattern must be the last pattern)
+ val K(ns @ _*, x) = k // bad use of _* (a sequence pattern must be the last pattern)
+ ^
+t5702-neg-bad-and-wild.scala:24: error: bad simple pattern: bad use of _* (sequence pattern not allowed)
+ val (b, _ * ) = (5,6) // bad use of _* (sequence pattern not allowed)
+ ^
+9 errors found
diff --git a/tests/untried/neg/t5702-neg-bad-and-wild.scala b/tests/untried/neg/t5702-neg-bad-and-wild.scala
new file mode 100644
index 000000000..aadda37da
--- /dev/null
+++ b/tests/untried/neg/t5702-neg-bad-and-wild.scala
@@ -0,0 +1,29 @@
+
+object Test {
+ case class K(i: Int)
+
+ def main(args: Array[String]) {
+ val k = new K(9)
+ val is = List(1,2,3)
+
+ is match {
+ case List(1, _*,) => // bad use of _* (a sequence pattern must be the last pattern)
+ // illegal start of simple pattern
+ case List(1, _*3,) => // illegal start of simple pattern
+ //case List(1, _*3:) => // poor recovery by parens
+ case List(1, x*) => // use _* to match a sequence
+ case List(x*, 1) => // trailing * is not a valid pattern
+ case (1, x*) => // trailing * is not a valid pattern
+ case (1, x@_*) => // bad use of _* (sequence pattern not allowed)
+ }
+
+// good syntax, bad semantics, detected by typer
+//gowild.scala:14: error: star patterns must correspond with varargs parameters
+ val K(is @ _*) = k
+ val K(ns @ _*, x) = k // bad use of _* (a sequence pattern must be the last pattern)
+ val (b, _ * ) = (5,6) // bad use of _* (sequence pattern not allowed)
+// no longer complains
+//bad-and-wild.scala:15: error: ')' expected but '}' found.
+ }
+}
+
diff --git a/tests/untried/neg/t5702-neg-bad-brace.check b/tests/untried/neg/t5702-neg-bad-brace.check
new file mode 100644
index 000000000..503f7d95e
--- /dev/null
+++ b/tests/untried/neg/t5702-neg-bad-brace.check
@@ -0,0 +1,10 @@
+t5702-neg-bad-brace.scala:14: error: Unmatched closing brace '}' ignored here
+ case List(1, _*} =>
+ ^
+t5702-neg-bad-brace.scala:14: error: illegal start of simple pattern
+ case List(1, _*} =>
+ ^
+t5702-neg-bad-brace.scala:15: error: ')' expected but '}' found.
+ }
+ ^
+three errors found
diff --git a/tests/untried/neg/t5702-neg-bad-brace.scala b/tests/untried/neg/t5702-neg-bad-brace.scala
new file mode 100644
index 000000000..16a341cf8
--- /dev/null
+++ b/tests/untried/neg/t5702-neg-bad-brace.scala
@@ -0,0 +1,17 @@
+
+object Test {
+
+ def main(args: Array[String]) {
+ val is = List(1,2,3)
+
+ is match {
+// the erroneous brace is ignored, so we can't halt on it.
+// maybe brace healing can detect overlapping unmatched (...}
+// In this case, the fix emits an extra error:
+// t5702-neg-bad-brace.scala:10: error: Unmatched closing brace '}' ignored here
+// t5702-neg-bad-brace.scala:10: error: illegal start of simple pattern (i.e., =>)
+// t5702-neg-bad-brace.scala:11: error: ')' expected but '}' found.
+ case List(1, _*} =>
+ }
+ }
+}
diff --git a/tests/untried/neg/t5702-neg-bad-xbrace.check b/tests/untried/neg/t5702-neg-bad-xbrace.check
new file mode 100644
index 000000000..9240abea4
--- /dev/null
+++ b/tests/untried/neg/t5702-neg-bad-xbrace.check
@@ -0,0 +1,7 @@
+t5702-neg-bad-xbrace.scala:19: error: bad simple pattern: bad brace or paren after _*
+ case <year>{_*)}</year> => y
+ ^
+t5702-neg-bad-xbrace.scala:28: error: bad simple pattern: bad brace or paren after _*
+ val <top>{a, z@_*)}</top> = xml
+ ^
+two errors found
diff --git a/tests/untried/neg/t5702-neg-bad-xbrace.scala b/tests/untried/neg/t5702-neg-bad-xbrace.scala
new file mode 100644
index 000000000..64bbdb18b
--- /dev/null
+++ b/tests/untried/neg/t5702-neg-bad-xbrace.scala
@@ -0,0 +1,31 @@
+
+object Test {
+ def main(args: Array[String]) {
+ /* PiS example, minus a brace
+ val yearMade = 1965
+ val old =
+ <a>{ if (yearMade < 2000) <old>yearMade}</old>
+ else xml.NodeSeq.Empty } </a>
+ println(old)
+ */
+
+ // bad brace or paren after _*
+ // actually, we know it's a bad paren...
+ // we skip it because not in a context looking for rparen
+ val xyear = <year>1965</year>
+ val ancient =
+ <b>{
+ val when = xyear match {
+ case <year>{_*)}</year> => y
+ case _ => "2035"
+ }
+ <old>{when}</old>
+ }</b>
+ println(ancient)
+
+ val xml = <top><a>apple</a><b>boy</b><c>child</c></top>
+ // bad brace or paren after _*
+ val <top>{a, z@_*)}</top> = xml
+ println("A for "+ a +", ending with "+ z)
+ }
+}
diff --git a/tests/untried/neg/t5702-neg-ugly-xbrace.check b/tests/untried/neg/t5702-neg-ugly-xbrace.check
new file mode 100644
index 000000000..cdd2438b0
--- /dev/null
+++ b/tests/untried/neg/t5702-neg-ugly-xbrace.check
@@ -0,0 +1,19 @@
+t5702-neg-ugly-xbrace.scala:11: error: bad simple pattern: bad brace or paren after _*
+ val <top>{a, z@_*)</top> = xml
+ ^
+t5702-neg-ugly-xbrace.scala:12: error: Missing closing brace `}' assumed here
+ println("A for "+ a +", ending with "+ z)
+ ^
+t5702-neg-ugly-xbrace.scala:13: error: in XML literal: in XML content, please use '}}' to express '}'
+ }
+ ^
+t5702-neg-ugly-xbrace.scala:11: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed <top>
+ val <top>{a, z@_*)</top> = xml
+ ^
+t5702-neg-ugly-xbrace.scala:14: error: illegal start of simple pattern
+}
+^
+t5702-neg-ugly-xbrace.scala:14: error: '}' expected but eof found.
+}
+ ^
+6 errors found
diff --git a/tests/untried/neg/t5702-neg-ugly-xbrace.scala b/tests/untried/neg/t5702-neg-ugly-xbrace.scala
new file mode 100644
index 000000000..0ff7bfa09
--- /dev/null
+++ b/tests/untried/neg/t5702-neg-ugly-xbrace.scala
@@ -0,0 +1,14 @@
+
+object Test {
+ def main(args: Array[String]) {
+
+ val xml = <top><a>apple</a><b>boy</b><c>child</c></top>
+ // This is the more likely typo, and the uglier parse.
+ // We could turn it into a } if } does not follow (to
+ // avoid handing }} back to xml) but that is quite ad hoc.
+ // Assuming } for ) after _* would not be not outlandish.
+ // bad brace or paren after _*
+ val <top>{a, z@_*)</top> = xml
+ println("A for "+ a +", ending with "+ z)
+ }
+}
diff --git a/tests/untried/neg/t5728.check b/tests/untried/neg/t5728.check
new file mode 100644
index 000000000..14f9c42ae
--- /dev/null
+++ b/tests/untried/neg/t5728.check
@@ -0,0 +1,4 @@
+t5728.scala:3: error: implicit classes must accept exactly one primary constructor parameter
+ implicit class Foo
+ ^
+one error found
diff --git a/tests/untried/neg/t5728.scala b/tests/untried/neg/t5728.scala
new file mode 100644
index 000000000..99337d06d
--- /dev/null
+++ b/tests/untried/neg/t5728.scala
@@ -0,0 +1,7 @@
+object Test {
+
+ implicit class Foo
+
+ implicit def Foo = new Foo
+
+}
diff --git a/tests/untried/neg/t5735.check b/tests/untried/neg/t5735.check
new file mode 100644
index 000000000..f6e002804
--- /dev/null
+++ b/tests/untried/neg/t5735.check
@@ -0,0 +1,6 @@
+t5735.scala:6: error: type mismatch;
+ found : (x: Int)Int <and> => String
+ required: Int
+ val z: Int = a
+ ^
+one error found
diff --git a/tests/untried/neg/t5735.scala b/tests/untried/neg/t5735.scala
new file mode 100644
index 000000000..fde71ff96
--- /dev/null
+++ b/tests/untried/neg/t5735.scala
@@ -0,0 +1,7 @@
+abstract class Base {
+ def a: String = "one"
+}
+class Clazz extends Base {
+ def a(x: Int): Int = 2
+ val z: Int = a
+}
diff --git a/tests/untried/neg/t5753.check b/tests/untried/neg/t5753.check
new file mode 100644
index 000000000..379416c17
--- /dev/null
+++ b/tests/untried/neg/t5753.check
@@ -0,0 +1,5 @@
+Test_2.scala:9: error: macro implementation not found: foo
+(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
+ println(foo(42))
+ ^
+one error found
diff --git a/tests/untried/neg/t5753.flags b/tests/untried/neg/t5753.flags
new file mode 100644
index 000000000..cd66464f2
--- /dev/null
+++ b/tests/untried/neg/t5753.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/tests/untried/neg/t5753/Impls_Macros_1.scala b/tests/untried/neg/t5753/Impls_Macros_1.scala
new file mode 100644
index 000000000..9872c6917
--- /dev/null
+++ b/tests/untried/neg/t5753/Impls_Macros_1.scala
@@ -0,0 +1,6 @@
+import scala.reflect.macros.blackbox.Context
+
+trait Impls {
+ def impl(c: Context)(x: c.Expr[Any]) = x
+}
+
diff --git a/tests/untried/neg/t5753/Test_2.scala b/tests/untried/neg/t5753/Test_2.scala
new file mode 100644
index 000000000..d52ed65c6
--- /dev/null
+++ b/tests/untried/neg/t5753/Test_2.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.blackbox.Context
+
+object Macros extends Impls {
+ def foo(x: Any): Any = macro impl
+}
+
+object Test extends App {
+ import Macros._
+ println(foo(42))
+}
+
diff --git a/tests/untried/neg/t576.check b/tests/untried/neg/t576.check
new file mode 100644
index 000000000..7105c9286
--- /dev/null
+++ b/tests/untried/neg/t576.check
@@ -0,0 +1,4 @@
+t576.scala:14: error: overloaded method insert needs result type
+ if (true) sibling.insert(node);
+ ^
+one error found
diff --git a/tests/untried/neg/t576.scala b/tests/untried/neg/t576.scala
new file mode 100644
index 000000000..fd83217a4
--- /dev/null
+++ b/tests/untried/neg/t576.scala
@@ -0,0 +1,20 @@
+package lampion.collections;
+
+abstract class BaseListXXX {
+ type Node <: BaseNode;
+ abstract class BaseNode {
+ }
+}
+trait PriorityTreeXXX extends BaseListXXX {
+ type Node <: BasicTreeNode;
+
+ trait BasicTreeNode extends BaseNode {
+ def sibling: Node;
+ def insert(dir : Int, node : Node) = {
+ if (true) sibling.insert(node);
+ //else insert(node);
+
+ }
+ def insert(node : Node) : Unit = {}
+ }
+}
diff --git a/tests/untried/neg/t5761.check b/tests/untried/neg/t5761.check
new file mode 100644
index 000000000..2d66af26f
--- /dev/null
+++ b/tests/untried/neg/t5761.check
@@ -0,0 +1,19 @@
+t5761.scala:4: error: not enough arguments for constructor D: (x: Int)D[Int].
+Unspecified value parameter x.
+ println(new D[Int]{}) // crash
+ ^
+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
+ ^
+t5761.scala:13: error: not found: type Tread
+ new Tread("sth") { }.run()
+ ^
+t5761.scala:13: error: value run is not a member of AnyRef
+ new Tread("sth") { }.run()
+ ^
+5 errors found
diff --git a/tests/untried/neg/t5761.scala b/tests/untried/neg/t5761.scala
new file mode 100644
index 000000000..040c4eb75
--- /dev/null
+++ b/tests/untried/neg/t5761.scala
@@ -0,0 +1,16 @@
+class D[-A](x: A) { }
+
+object Test1 {
+ println(new D[Int]{}) // crash
+}
+
+object Test2 {
+ println(new D[Int]()) // no crash
+ println(new D[Int]{}) // crash
+}
+
+object Test3 {
+ new Tread("sth") { }.run()
+}
+
+
diff --git a/tests/untried/neg/t5762.check b/tests/untried/neg/t5762.check
new file mode 100644
index 000000000..2a2f12144
--- /dev/null
+++ b/tests/untried/neg/t5762.check
@@ -0,0 +1,15 @@
+t5762.scala:6: warning: non-variable type argument Int in type pattern D[Int] is unchecked since it is eliminated by erasure
+ case _: D[Int] if bippy => 1
+ ^
+t5762.scala:7: warning: non-variable type argument String in type pattern D[String] is unchecked since it is eliminated by erasure
+ case _: D[String] => 2
+ ^
+t5762.scala:20: warning: non-variable type argument D[Int] in type pattern D[D[Int]] is unchecked since it is eliminated by erasure
+ case _: D[D[Int]] if bippy => 1
+ ^
+t5762.scala:21: warning: non-variable type argument D[String] in type pattern D[D[String]] is unchecked since it is eliminated by erasure
+ case _: D[D[String]] => 2
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/t5762.flags b/tests/untried/neg/t5762.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t5762.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t5762.scala b/tests/untried/neg/t5762.scala
new file mode 100644
index 000000000..fb73552b1
--- /dev/null
+++ b/tests/untried/neg/t5762.scala
@@ -0,0 +1,24 @@
+class D[-A]
+
+object Test {
+ var bippy: Boolean = true
+ def f1(x: D[Int with String]) = x match {
+ case _: D[Int] if bippy => 1
+ case _: D[String] => 2
+ }
+ // Correctly warns:
+ //
+ // a.scala:5: warning: non variable type-argument Int in type pattern D[Int] is unchecked since it is eliminated by erasure
+ // case _: D[Int] => 1
+ // ^
+ // a.scala:6: warning: non variable type-argument String in type pattern D[String] is unchecked since it is eliminated by erasure
+ // case _: D[String] => 2
+ // ^
+ // two warnings found
+
+ def f2(x: D[D[Int] with D[String]]) = x match {
+ case _: D[D[Int]] if bippy => 1
+ case _: D[D[String]] => 2
+ }
+ // No warnings!
+}
diff --git a/tests/untried/neg/t5799.check b/tests/untried/neg/t5799.check
new file mode 100644
index 000000000..3b43d06a9
--- /dev/null
+++ b/tests/untried/neg/t5799.check
@@ -0,0 +1,4 @@
+t5799.scala:2: error: secondary constructor is not allowed in value class
+ def this(s: String) = this(s.toDouble)
+ ^
+one error found
diff --git a/tests/untried/neg/t5799.scala b/tests/untried/neg/t5799.scala
new file mode 100644
index 000000000..9bd6ab7dd
--- /dev/null
+++ b/tests/untried/neg/t5799.scala
@@ -0,0 +1,8 @@
+class Foo(val bar: Double) extends AnyVal {
+ def this(s: String) = this(s.toDouble)
+}
+object Test {
+ def main(args: Array[String]): Unit =
+ new Foo("")
+ }
+
diff --git a/tests/untried/neg/t5801.check b/tests/untried/neg/t5801.check
new file mode 100644
index 000000000..abf8e6e93
--- /dev/null
+++ b/tests/untried/neg/t5801.check
@@ -0,0 +1,22 @@
+t5801.scala:1: error: object sth is not a member of package scala
+import scala.sth
+ ^
+t5801.scala:4: error: not found: value sth
+ def foo(a: Int)(implicit b: sth.Sth): Unit = {}
+ ^
+t5801.scala:7: error: not found: value sth
+ def bar(x: Int)(implicit y: Int): sth.Sth = null
+ ^
+t5801.scala:8: error: could not find implicit value for parameter y: Int
+ bar(1)
+ ^
+t5801.scala:10: error: not found: value sth
+ def meh(x: Int)(implicit a: sth.Sth, b: Int): Unit = {}
+ ^
+t5801.scala:13: error: not found: value sth
+ def meh2(x: Int)(implicit b: Int, a: sth.Sth): Unit = {}
+ ^
+t5801.scala:14: error: could not find implicit value for parameter b: Int
+ meh2(1)
+ ^
+7 errors found
diff --git a/tests/untried/neg/t5801.scala b/tests/untried/neg/t5801.scala
new file mode 100644
index 000000000..d452222ac
--- /dev/null
+++ b/tests/untried/neg/t5801.scala
@@ -0,0 +1,16 @@
+import scala.sth
+
+object Test extends App {
+ def foo(a: Int)(implicit b: sth.Sth): Unit = {}
+ foo(1)
+
+ def bar(x: Int)(implicit y: Int): sth.Sth = null
+ bar(1)
+
+ def meh(x: Int)(implicit a: sth.Sth, b: Int): Unit = {}
+ meh(1)
+
+ def meh2(x: Int)(implicit b: Int, a: sth.Sth): Unit = {}
+ meh2(1)
+}
+
diff --git a/tests/untried/neg/t5803.check b/tests/untried/neg/t5803.check
new file mode 100644
index 000000000..6a2de2e1d
--- /dev/null
+++ b/tests/untried/neg/t5803.check
@@ -0,0 +1,4 @@
+t5803.scala:3: error: could not find implicit value for parameter ev: Nothing
+ new Foo(): String
+ ^
+one error found
diff --git a/tests/untried/neg/t5803.scala b/tests/untried/neg/t5803.scala
new file mode 100644
index 000000000..f818272f8
--- /dev/null
+++ b/tests/untried/neg/t5803.scala
@@ -0,0 +1,4 @@
+object Test {
+ class Foo()(implicit ev: Nothing)
+ new Foo(): String
+}
diff --git a/tests/untried/neg/t5821.check b/tests/untried/neg/t5821.check
new file mode 100644
index 000000000..f9c00604b
--- /dev/null
+++ b/tests/untried/neg/t5821.check
@@ -0,0 +1,4 @@
+t5821.scala:1: error: not found: object SthImportant
+import SthImportant._
+ ^
+one error found
diff --git a/tests/untried/neg/t5821.scala b/tests/untried/neg/t5821.scala
new file mode 100644
index 000000000..4af0a2bf7
--- /dev/null
+++ b/tests/untried/neg/t5821.scala
@@ -0,0 +1,8 @@
+import SthImportant._
+
+class Bar
+
+class Foo2 {
+ type Sth = Array[Bar]
+ def foo(xs: Sth): Bar = if ((xs eq null) || (xs.length == 0)) null else xs(0)
+}
diff --git a/tests/untried/neg/t5830.check b/tests/untried/neg/t5830.check
new file mode 100644
index 000000000..58c3a1be3
--- /dev/null
+++ b/tests/untried/neg/t5830.check
@@ -0,0 +1,9 @@
+t5830.scala:6: warning: unreachable code
+ case 'a' => println("b") // unreachable
+ ^
+t5830.scala:4: warning: could not emit switch for @switch annotated match
+ def unreachable(ch: Char) = (ch: @switch) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/t5830.flags b/tests/untried/neg/t5830.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t5830.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t5830.scala b/tests/untried/neg/t5830.scala
new file mode 100644
index 000000000..18e89c20f
--- /dev/null
+++ b/tests/untried/neg/t5830.scala
@@ -0,0 +1,9 @@
+import scala.annotation.switch
+
+class Test {
+ def unreachable(ch: Char) = (ch: @switch) match {
+ case 'a' => println("b") // ok
+ case 'a' => println("b") // unreachable
+ case 'c' =>
+ }
+}
diff --git a/tests/untried/neg/t5839.check b/tests/untried/neg/t5839.check
new file mode 100644
index 000000000..d4b125bd1
--- /dev/null
+++ b/tests/untried/neg/t5839.check
@@ -0,0 +1,6 @@
+t5839.scala:5: error: type mismatch;
+ found : (x: String => String)Int <and> (x: Int)Int
+ required: Int => String
+ val x: String = goo(foo _)
+ ^
+one error found
diff --git a/tests/untried/neg/t5839.scala b/tests/untried/neg/t5839.scala
new file mode 100644
index 000000000..d3a5d4b25
--- /dev/null
+++ b/tests/untried/neg/t5839.scala
@@ -0,0 +1,7 @@
+object Test {
+ def goo[T](x: Int => T): T = x(1)
+ implicit def f(x: Int): String = ""
+ def foo(x: Int): Int = x + 1
+ val x: String = goo(foo _)
+ def foo(x: String => String) = 1
+}
diff --git a/tests/untried/neg/t585.check b/tests/untried/neg/t585.check
new file mode 100644
index 000000000..d332ac541
--- /dev/null
+++ b/tests/untried/neg/t585.check
@@ -0,0 +1,4 @@
+t585.scala:1: error: unclosed comment
+/*
+^
+one error found
diff --git a/tests/untried/neg/t585.scala b/tests/untried/neg/t585.scala
new file mode 100644
index 000000000..0875e2cb0
--- /dev/null
+++ b/tests/untried/neg/t585.scala
@@ -0,0 +1,4 @@
+/*
+/* * /
+/* * /
+*/
diff --git a/tests/untried/neg/t5856.check b/tests/untried/neg/t5856.check
new file mode 100644
index 000000000..08a61bdc0
--- /dev/null
+++ b/tests/untried/neg/t5856.check
@@ -0,0 +1,31 @@
+t5856.scala:10: error: invalid string interpolation: `$$', `$'ident or `$'BlockExpr expected
+ val s9 = s"$"
+ ^
+t5856.scala:10: error: unclosed string literal
+ val s9 = s"$"
+ ^
+t5856.scala:2: error: error in interpolated string: identifier or block expected
+ val s1 = s"$null"
+ ^
+t5856.scala:3: error: error in interpolated string: identifier or block expected
+ val s2 = s"$false"
+ ^
+t5856.scala:4: error: error in interpolated string: identifier or block expected
+ val s3 = s"$true"
+ ^
+t5856.scala:5: error: error in interpolated string: identifier or block expected
+ val s4 = s"$yield"
+ ^
+t5856.scala:6: error: error in interpolated string: identifier or block expected
+ val s5 = s"$return"
+ ^
+t5856.scala:7: error: error in interpolated string: identifier or block expected
+ val s6 = s"$new"
+ ^
+t5856.scala:8: error: error in interpolated string: identifier or block expected
+ val s7 = s"$s1 $null $super"
+ ^
+t5856.scala:9: error: error in interpolated string: identifier or block expected
+ val s8 = s"$super"
+ ^
+10 errors found
diff --git a/tests/untried/neg/t5856.scala b/tests/untried/neg/t5856.scala
new file mode 100644
index 000000000..2ceee590a
--- /dev/null
+++ b/tests/untried/neg/t5856.scala
@@ -0,0 +1,11 @@
+object Test {
+ val s1 = s"$null"
+ val s2 = s"$false"
+ val s3 = s"$true"
+ val s4 = s"$yield"
+ val s5 = s"$return"
+ val s6 = s"$new"
+ val s7 = s"$s1 $null $super"
+ val s8 = s"$super"
+ val s9 = s"$"
+} \ No newline at end of file
diff --git a/tests/untried/neg/t5878.check b/tests/untried/neg/t5878.check
new file mode 100644
index 000000000..c60c4653a
--- /dev/null
+++ b/tests/untried/neg/t5878.check
@@ -0,0 +1,13 @@
+t5878.scala:1: error: value class may not wrap another user-defined value class
+case class Foo(x: Bar) extends AnyVal
+ ^
+t5878.scala:2: error: value class may not wrap another user-defined value class
+case class Bar(x: Foo) extends AnyVal
+ ^
+t5878.scala:4: error: value class may not wrap another user-defined value class
+class Foo1(val x: Bar1) extends AnyVal
+ ^
+t5878.scala:5: error: value class may not wrap another user-defined value class
+class Bar1(val x: Foo1) extends AnyVal
+ ^
+four errors found
diff --git a/tests/untried/neg/t5878.scala b/tests/untried/neg/t5878.scala
new file mode 100644
index 000000000..b4e33627e
--- /dev/null
+++ b/tests/untried/neg/t5878.scala
@@ -0,0 +1,6 @@
+case class Foo(x: Bar) extends AnyVal
+case class Bar(x: Foo) extends AnyVal
+
+class Foo1(val x: Bar1) extends AnyVal
+class Bar1(val x: Foo1) extends AnyVal
+
diff --git a/tests/untried/neg/t588.check b/tests/untried/neg/t588.check
new file mode 100644
index 000000000..ff08f77a6
--- /dev/null
+++ b/tests/untried/neg/t588.check
@@ -0,0 +1,13 @@
+t588.scala:3: error: double definition:
+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:
+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/tests/untried/neg/t588.scala b/tests/untried/neg/t588.scala
new file mode 100644
index 000000000..f30937377
--- /dev/null
+++ b/tests/untried/neg/t588.scala
@@ -0,0 +1,15 @@
+abstract class Test0 {
+ def visit(f: Int => Unit): Boolean
+ def visit(f: Int => String): Boolean
+}
+trait Test {
+ type TypeA <: TraitA;
+ type TypeB <: TypeA with TraitB;
+
+ def f(node : TypeA) : Unit;
+ def f(brac : TypeB) : Unit;
+
+ trait TraitA;
+ trait TraitB;
+
+}
diff --git a/tests/untried/neg/t5882.check b/tests/untried/neg/t5882.check
new file mode 100644
index 000000000..e0958e19d
--- /dev/null
+++ b/tests/untried/neg/t5882.check
@@ -0,0 +1,9 @@
+t5882.scala:4: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ case class Scope()
+ ^
+t5882.scala:5: error: implementation restriction: nested object is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ object Bar
+ ^
+two errors found
diff --git a/tests/untried/neg/t5882.scala b/tests/untried/neg/t5882.scala
new file mode 100644
index 000000000..3a55abdc9
--- /dev/null
+++ b/tests/untried/neg/t5882.scala
@@ -0,0 +1,6 @@
+// SIP-15 was changed to allow nested classes. See run/t5882.scala
+
+class NodeOps(val n: Any) extends AnyVal {
+ case class Scope()
+ object Bar
+}
diff --git a/tests/untried/neg/t5892.check b/tests/untried/neg/t5892.check
new file mode 100644
index 000000000..839bf9de2
--- /dev/null
+++ b/tests/untried/neg/t5892.check
@@ -0,0 +1,17 @@
+t5892.scala:5: error: type mismatch;
+ found : Boolean(false)
+ required: String
+class C[@annot(false) X] {
+ ^
+t5892.scala:9: error: not found: value b2s
+class D[@annot(b2s(false)) X] {
+ ^
+t5892.scala:13: error: type mismatch;
+ found : Boolean(false)
+ required: String
+@annot(false) class E {
+ ^
+t5892.scala:17: error: not found: value b2s
+@annot(b2s(false)) class F {
+ ^
+four errors found
diff --git a/tests/untried/neg/t5892.scala b/tests/untried/neg/t5892.scala
new file mode 100644
index 000000000..5e3b2f313
--- /dev/null
+++ b/tests/untried/neg/t5892.scala
@@ -0,0 +1,25 @@
+import language.implicitConversions
+
+class annot(a: String) extends annotation.StaticAnnotation
+
+class C[@annot(false) X] {
+ implicit def b2s(b: Boolean): String = ""
+}
+
+class D[@annot(b2s(false)) X] {
+ implicit def b2s(b: Boolean): String = ""
+}
+
+@annot(false) class E {
+ implicit def b2s(b: Boolean): String = ""
+}
+
+@annot(b2s(false)) class F {
+ implicit def b2s(b: Boolean): String = ""
+}
+
+object T {
+ implicit def b2s(b: Boolean): String = ""
+ @annot(false) val x = 0
+ @annot(b2s(false)) val y = 0
+}
diff --git a/tests/untried/neg/t5903a.check b/tests/untried/neg/t5903a.check
new file mode 100644
index 000000000..34003b0a8
--- /dev/null
+++ b/tests/untried/neg/t5903a.check
@@ -0,0 +1,4 @@
+Test_2.scala:4: error: too many patterns for <$anon: AnyRef> offering (SomeTree.type, SomeTree.type): expected 2, found 3
+ case nq"$x + $y + $z" => println((x, y))
+ ^
+one error found
diff --git a/tests/untried/neg/t5903a/Macros_1.scala b/tests/untried/neg/t5903a/Macros_1.scala
new file mode 100644
index 000000000..5d084ceed
--- /dev/null
+++ b/tests/untried/neg/t5903a/Macros_1.scala
@@ -0,0 +1,28 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+trait Tree
+case object SomeTree extends Tree
+
+object NewQuasiquotes {
+ implicit class QuasiquoteInterpolation(c: StringContext) {
+ object nq {
+ def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl
+ }
+ }
+}
+
+object QuasiquoteMacros {
+ def unapplyImpl(c: Context)(t: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = this
+ def _1 = SomeTree
+ def _2 = SomeTree
+ def unapply(t: Tree) = this
+ }.unapply($t)
+ """
+ }
+}
diff --git a/tests/untried/neg/t5903a/Test_2.scala b/tests/untried/neg/t5903a/Test_2.scala
new file mode 100644
index 000000000..4d78dfb5e
--- /dev/null
+++ b/tests/untried/neg/t5903a/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import NewQuasiquotes._
+ SomeTree match {
+ case nq"$x + $y + $z" => println((x, y))
+ }
+}
diff --git a/tests/untried/neg/t5903b.check b/tests/untried/neg/t5903b.check
new file mode 100644
index 000000000..e7637d3ed
--- /dev/null
+++ b/tests/untried/neg/t5903b.check
@@ -0,0 +1,6 @@
+Test_2.scala:4: error: type mismatch;
+ found : Int
+ required: String
+ case t"$x" => println(x)
+ ^
+one error found
diff --git a/tests/untried/neg/t5903b/Macros_1.scala b/tests/untried/neg/t5903b/Macros_1.scala
new file mode 100644
index 000000000..6ce49c022
--- /dev/null
+++ b/tests/untried/neg/t5903b/Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply[T](x: T): Any = macro Macros.unapplyImpl[T]
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = "2"
+ def unapply(x: String) = this
+ }.unapply($x)
+ """
+ }
+}
diff --git a/tests/untried/neg/t5903b/Test_2.scala b/tests/untried/neg/t5903b/Test_2.scala
new file mode 100644
index 000000000..0f6f80d32
--- /dev/null
+++ b/tests/untried/neg/t5903b/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 2 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/tests/untried/neg/t5903c.check b/tests/untried/neg/t5903c.check
new file mode 100644
index 000000000..05bd775d3
--- /dev/null
+++ b/tests/untried/neg/t5903c.check
@@ -0,0 +1,4 @@
+Test_2.scala:4: error: String is not supported
+ case t"$x" => println(x)
+ ^
+one error found
diff --git a/tests/untried/neg/t5903c/Macros_1.scala b/tests/untried/neg/t5903c/Macros_1.scala
new file mode 100644
index 000000000..4792f0045
--- /dev/null
+++ b/tests/untried/neg/t5903c/Macros_1.scala
@@ -0,0 +1,26 @@
+import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply[T](x: T): Any = macro Macros.unapplyImpl[T]
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
+ import c.universe._
+ if (!(c.weakTypeOf[Int] =:= c.weakTypeOf[T])) c.abort(c.enclosingPosition, s"${c.weakTypeOf[T]} is not supported")
+ else {
+ q"""
+ new {
+ def isEmpty = false
+ def get = 2
+ def unapply(x: Int) = this
+ }.unapply($x)
+ """
+ }
+ }
+}
diff --git a/tests/untried/neg/t5903c/Test_2.scala b/tests/untried/neg/t5903c/Test_2.scala
new file mode 100644
index 000000000..a1fd31dd4
--- /dev/null
+++ b/tests/untried/neg/t5903c/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ "2" match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/tests/untried/neg/t5903d.check b/tests/untried/neg/t5903d.check
new file mode 100644
index 000000000..54a91a7ba
--- /dev/null
+++ b/tests/untried/neg/t5903d.check
@@ -0,0 +1,4 @@
+Test_2.scala:4: error: extractor macros can only be whitebox
+ case t"$x" => println(x)
+ ^
+one error found
diff --git a/tests/untried/neg/t5903d/Macros_1.scala b/tests/untried/neg/t5903d/Macros_1.scala
new file mode 100644
index 000000000..3500c2a78
--- /dev/null
+++ b/tests/untried/neg/t5903d/Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply(x: Int): Any = macro Macros.unapplyImpl
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ new { def unapply(x: Int) = new Match(x) }.unapply($x)
+ """
+ }
+}
diff --git a/tests/untried/neg/t5903d/Test_2.scala b/tests/untried/neg/t5903d/Test_2.scala
new file mode 100644
index 000000000..95c717a9d
--- /dev/null
+++ b/tests/untried/neg/t5903d/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 42 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/tests/untried/neg/t5903e.check b/tests/untried/neg/t5903e.check
new file mode 100644
index 000000000..3bdeb091a
--- /dev/null
+++ b/tests/untried/neg/t5903e.check
@@ -0,0 +1,4 @@
+Test_2.scala:4: error: value class may not be a member of another class
+ case t"$x" => println(x)
+ ^
+one error found
diff --git a/tests/untried/neg/t5903e/Macros_1.scala b/tests/untried/neg/t5903e/Macros_1.scala
new file mode 100644
index 000000000..a64ff7e0b
--- /dev/null
+++ b/tests/untried/neg/t5903e/Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.whitebox.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply(x: Int): Any = macro Macros.unapplyImpl
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ class Match(x: Int) extends AnyVal {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/tests/untried/neg/t5903e/Test_2.scala b/tests/untried/neg/t5903e/Test_2.scala
new file mode 100644
index 000000000..d69d47243
--- /dev/null
+++ b/tests/untried/neg/t5903e/Test_2.scala
@@ -0,0 +1,6 @@
+class C {
+ import Interpolation._
+ 42 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/tests/untried/neg/t591.check b/tests/untried/neg/t591.check
new file mode 100644
index 000000000..d33f6d7a2
--- /dev/null
+++ b/tests/untried/neg/t591.check
@@ -0,0 +1,5 @@
+t591.scala:38: error: method input_= is defined twice
+ conflicting symbols both originated in file 't591.scala'
+ def input_=(in : Input) = {}
+ ^
+one error found
diff --git a/tests/untried/neg/t591.scala b/tests/untried/neg/t591.scala
new file mode 100644
index 000000000..0f0b02395
--- /dev/null
+++ b/tests/untried/neg/t591.scala
@@ -0,0 +1,41 @@
+abstract class BaseList {
+ type Node <: BaseNode;
+
+
+ abstract class BaseNode {
+ protected def self : Node;
+ private[BaseList] def self00 = self;
+ def dirty : Unit = {}
+ def replaceWith(node : Node) = {}
+ }
+
+ implicit def baseNode2Node(bnode : BaseNode): Node = bnode.self00;
+
+
+}
+
+
+trait BaseFlow extends BaseList {
+ type Node <: BFNode;
+ type Flow <: FlowBase;
+ type Output <: OutputBase;
+ type Input <: InputBase;
+
+ abstract class FlowBase {
+
+ }
+ trait OutputBase extends FlowBase {
+
+ }
+ trait InputBase extends FlowBase {
+
+ }
+
+ trait BFNode extends BaseNode {
+ private var input : Input = _;
+ private var output : Output = _;
+
+ def input_=(in : Input) = {}
+
+ }
+}
diff --git a/tests/untried/neg/t593.check b/tests/untried/neg/t593.check
new file mode 100644
index 000000000..c1aeab8ec
--- /dev/null
+++ b/tests/untried/neg/t593.check
@@ -0,0 +1,4 @@
+t593.scala:1: error: traits or objects may not have parameters
+trait Wrapper[T](x : T) {
+ ^
+one error found
diff --git a/tests/untried/neg/t593.scala b/tests/untried/neg/t593.scala
new file mode 100644
index 000000000..df7199a42
--- /dev/null
+++ b/tests/untried/neg/t593.scala
@@ -0,0 +1,2 @@
+trait Wrapper[T](x : T) {
+}
diff --git a/tests/untried/neg/t5956.check b/tests/untried/neg/t5956.check
new file mode 100644
index 000000000..f5ae42c79
--- /dev/null
+++ b/tests/untried/neg/t5956.check
@@ -0,0 +1,7 @@
+t5956.scala:1: error: C is already defined as case class C
+object O { case class C[T](); class C() }
+ ^
+t5956.scala:2: error: C is already defined as case class C
+object T { case class C[T](); case class C() }
+ ^
+two errors found
diff --git a/tests/untried/neg/t5956.flags b/tests/untried/neg/t5956.flags
new file mode 100644
index 000000000..dcc59ebe3
--- /dev/null
+++ b/tests/untried/neg/t5956.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/tests/untried/neg/t5956.scala b/tests/untried/neg/t5956.scala
new file mode 100644
index 000000000..3cc10f3e1
--- /dev/null
+++ b/tests/untried/neg/t5956.scala
@@ -0,0 +1,2 @@
+object O { case class C[T](); class C() }
+object T { case class C[T](); case class C() }
diff --git a/tests/untried/neg/t5969.check b/tests/untried/neg/t5969.check
new file mode 100644
index 000000000..9d8ac9a3a
--- /dev/null
+++ b/tests/untried/neg/t5969.check
@@ -0,0 +1,7 @@
+t5969.scala:9: error: overloaded method value g with alternatives:
+ (x: C2)String <and>
+ (x: C1)String
+ cannot be applied to (String)
+ if (false) List(g(x)) else List[C1]() map g
+ ^
+one error found
diff --git a/tests/untried/neg/t5969.scala b/tests/untried/neg/t5969.scala
new file mode 100644
index 000000000..d010cacd1
--- /dev/null
+++ b/tests/untried/neg/t5969.scala
@@ -0,0 +1,11 @@
+class C1
+class C2
+class A {
+ def f(x: Any) = x
+ def g(x: C1): String = "A"
+ def g(x: C2): String = "B"
+
+ def crash() = f(List[String]() flatMap { x =>
+ if (false) List(g(x)) else List[C1]() map g
+ })
+}
diff --git a/tests/untried/neg/t6011.check b/tests/untried/neg/t6011.check
new file mode 100644
index 000000000..cb7f18903
--- /dev/null
+++ b/tests/untried/neg/t6011.check
@@ -0,0 +1,12 @@
+t6011.scala:4: warning: unreachable code
+ case 'a' | 'c' => 1 // unreachable
+ ^
+t6011.scala:10: warning: unreachable code
+ case 'b' | 'a' => 1 // unreachable
+ ^
+t6011.scala:8: warning: could not emit switch for @switch annotated match
+ def f2(ch: Char): Any = (ch: @annotation.switch) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t6011.flags b/tests/untried/neg/t6011.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t6011.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t6011.scala b/tests/untried/neg/t6011.scala
new file mode 100644
index 000000000..31a9f99a2
--- /dev/null
+++ b/tests/untried/neg/t6011.scala
@@ -0,0 +1,23 @@
+object Test {
+ def f(ch: Char): Any = ch match {
+ case 'a' => 1
+ case 'a' | 'c' => 1 // unreachable
+ }
+
+ // won't be compiled to a switch since it has an unreachable (duplicate) case
+ def f2(ch: Char): Any = (ch: @annotation.switch) match {
+ case 'a' | 'b' => 1
+ case 'b' | 'a' => 1 // unreachable
+ case _ =>
+ }
+
+ // s'all good
+ def f3(ch: Char): Any = (ch: @annotation.switch) match {
+ case 'a' | 'b' if (true: Boolean) => 1
+ case 'b' | 'a' => 1 // ok
+ case _ => // need third case to check switch annotation (two-case switches are always okay to compile to if-then-else)
+ }
+
+
+ def main(args: Array[String]): Unit = f('a')
+}
diff --git a/tests/untried/neg/t6013.check b/tests/untried/neg/t6013.check
new file mode 100644
index 000000000..502da999f
--- /dev/null
+++ b/tests/untried/neg/t6013.check
@@ -0,0 +1,7 @@
+DerivedScala.scala:4: error: class C needs to be abstract, since there is a deferred declaration of method foo in class B of type => Int which is not implemented in a subclass
+class C extends B
+ ^
+DerivedScala.scala:7: error: class DerivedScala needs to be abstract, since there is a deferred declaration of method foo in class Abstract of type ()Boolean which is not implemented in a subclass
+class DerivedScala extends Abstract
+ ^
+two errors found
diff --git a/tests/untried/neg/t6013/Abstract.java b/tests/untried/neg/t6013/Abstract.java
new file mode 100644
index 000000000..c0ef046bb
--- /dev/null
+++ b/tests/untried/neg/t6013/Abstract.java
@@ -0,0 +1,7 @@
+public abstract class Abstract extends Base {
+ // overrides Base#bar under the erasure model
+ public void bar(java.util.List<java.lang.Integer> foo) { return; }
+
+ // must force re-implementation in derived classes
+ public abstract boolean foo();
+}
diff --git a/tests/untried/neg/t6013/Base.java b/tests/untried/neg/t6013/Base.java
new file mode 100644
index 000000000..b73d7fd82
--- /dev/null
+++ b/tests/untried/neg/t6013/Base.java
@@ -0,0 +1,10 @@
+abstract public class Base {
+ // This must considered to be overridden by Abstract#foo based
+ // on the erased signatures. This special case is handled by
+ // `javaErasedOverridingSym` in `RefChecks`.
+ public abstract void bar(java.util.List<java.lang.String> foo) { return; }
+
+ // But, a concrete method in a Java superclass must not excuse
+ // a deferred method in the Java subclass!
+ public boolean foo() { return true; }
+}
diff --git a/tests/untried/neg/t6013/DerivedScala.scala b/tests/untried/neg/t6013/DerivedScala.scala
new file mode 100644
index 000000000..fc0c55d39
--- /dev/null
+++ b/tests/untried/neg/t6013/DerivedScala.scala
@@ -0,0 +1,7 @@
+// Scala extending Scala (this case was working fine before this bug.)
+class A { def foo: Int = 0 }
+abstract class B extends A { def foo: Int }
+class C extends B
+
+// Scala extending Java
+class DerivedScala extends Abstract
diff --git a/tests/untried/neg/t6040.check b/tests/untried/neg/t6040.check
new file mode 100644
index 000000000..16c90ede7
--- /dev/null
+++ b/tests/untried/neg/t6040.check
@@ -0,0 +1,9 @@
+t6040.scala:1: error: extension of type scala.Dynamic needs to be enabled
+by making the implicit value scala.language.dynamics visible.
+This can be achieved by adding the import clause 'import scala.language.dynamics'
+or by setting the compiler option -language:dynamics.
+See the Scala docs for value scala.language.dynamics for a discussion
+why the feature needs to be explicitly enabled.
+class X extends Dynamic
+ ^
+one error found
diff --git a/tests/untried/neg/t6040.scala b/tests/untried/neg/t6040.scala
new file mode 100644
index 000000000..7e2c1b105
--- /dev/null
+++ b/tests/untried/neg/t6040.scala
@@ -0,0 +1 @@
+class X extends Dynamic
diff --git a/tests/untried/neg/t6042.check b/tests/untried/neg/t6042.check
new file mode 100644
index 000000000..221f06e2c
--- /dev/null
+++ b/tests/untried/neg/t6042.check
@@ -0,0 +1,4 @@
+t6042.scala:7: error: illegal type selection from volatile type a.OpSemExp (with upper bound LazyExp[a.OpSemExp] with _$1)
+ def foo[AA <: LazyExp[_]](a: AA): a.OpSemExp#Val = ??? // a.OpSemExp is volatile, because of `with This`
+ ^
+one error found
diff --git a/tests/untried/neg/t6042.scala b/tests/untried/neg/t6042.scala
new file mode 100644
index 000000000..5a123d17c
--- /dev/null
+++ b/tests/untried/neg/t6042.scala
@@ -0,0 +1,8 @@
+trait LazyExp[+This <: LazyExp[This]] { this: This =>
+ type OpSemExp <: LazyExp[OpSemExp] with This
+ type Val
+}
+
+object Test {
+ def foo[AA <: LazyExp[_]](a: AA): a.OpSemExp#Val = ??? // a.OpSemExp is volatile, because of `with This`
+}
diff --git a/tests/untried/neg/t6048.check b/tests/untried/neg/t6048.check
new file mode 100644
index 000000000..f8eddf547
--- /dev/null
+++ b/tests/untried/neg/t6048.check
@@ -0,0 +1,18 @@
+t6048.scala:3: warning: unreachable code
+ case _ if false => x // unreachable
+ ^
+t6048.scala:8: warning: unreachable code
+ case _ if false => x // unreachable
+ ^
+t6048.scala:13: warning: patterns after a variable pattern cannot match (SLS 8.1.1)
+ case _ => x
+ ^
+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.
+5 warnings found
+one error found
diff --git a/tests/untried/neg/t6048.flags b/tests/untried/neg/t6048.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t6048.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t6048.scala b/tests/untried/neg/t6048.scala
new file mode 100644
index 000000000..803e651d1
--- /dev/null
+++ b/tests/untried/neg/t6048.scala
@@ -0,0 +1,22 @@
+class A {
+ def f1(x: Int) = x match {
+ case _ if false => x // unreachable
+ case 5 => x
+ }
+
+ def f2(x: Int) = x match {
+ case _ if false => x // unreachable
+ case 5 if true => x
+ }
+
+ def f3(x: Int) = x match {
+ case _ => x
+ case 5 if true => x // unreachable
+ }
+
+ def test1(x: Int) = x match {
+ case c if c < 0 => 0
+ case 1 => 1
+ case _ => 2
+ }
+}
diff --git a/tests/untried/neg/t6074.check b/tests/untried/neg/t6074.check
new file mode 100644
index 000000000..38670e5b3
--- /dev/null
+++ b/tests/untried/neg/t6074.check
@@ -0,0 +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/tests/untried/neg/t6074.scala b/tests/untried/neg/t6074.scala
new file mode 100644
index 000000000..8c14f00f1
--- /dev/null
+++ b/tests/untried/neg/t6074.scala
@@ -0,0 +1,6 @@
+class A private () { }
+class B { }
+object T {
+ implicit def a2b(a: A): B = null
+ def t = new A()
+}
diff --git a/tests/untried/neg/t608.check b/tests/untried/neg/t608.check
new file mode 100644
index 000000000..5c7f49d00
--- /dev/null
+++ b/tests/untried/neg/t608.check
@@ -0,0 +1,6 @@
+t608.scala:16: error: type mismatch;
+ found : hs{type a = ha}
+ required: hs{type s = hs; type a = ha}
+ = g(f(x).bimap(id))
+ ^
+one error found
diff --git a/tests/untried/neg/t608.scala b/tests/untried/neg/t608.scala
new file mode 100644
index 000000000..34dc4c035
--- /dev/null
+++ b/tests/untried/neg/t608.scala
@@ -0,0 +1,17 @@
+trait CrashDueToTypeError {
+ def id[a](x :a) :a = x
+
+ trait Bifunctor {
+ type a; // content
+ type s <: Bifunctor
+
+ // uncomment this-vvvvvvvvvvvvvvvvvvvvvvvvvvvv, and it compiles
+ def bimap[c](f :a=>c) :s{/*type s=Bifunctor.this.s;*/type a=c; }
+ }
+
+ def hylo[hs <: Bifunctor,ha,hb,hc]
+ (f :hb=>hs{type s=hs; type a=ha},
+ g :hs{type s=hs; type a=ha}=>hc)(x :hb)
+ :hc
+ = g(f(x).bimap(id))
+}
diff --git a/tests/untried/neg/t6082.check b/tests/untried/neg/t6082.check
new file mode 100644
index 000000000..b68de5ce0
--- /dev/null
+++ b/tests/untried/neg/t6082.check
@@ -0,0 +1,13 @@
+t6082.scala:1: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class annot(notValue: String) extends annotation.ClassfileAnnotation
+ ^
+t6082.scala:2: error: classfile annotation arguments have to be supplied as named arguments
+@annot("") class C
+ ^
+t6082.scala:2: error: annotation annot is missing argument notValue
+@annot("") class C
+ ^
+one warning found
+two errors found
diff --git a/tests/untried/neg/t6082.scala b/tests/untried/neg/t6082.scala
new file mode 100644
index 000000000..9acc3963d
--- /dev/null
+++ b/tests/untried/neg/t6082.scala
@@ -0,0 +1,2 @@
+class annot(notValue: String) extends annotation.ClassfileAnnotation
+@annot("") class C
diff --git a/tests/untried/neg/t6083.check b/tests/untried/neg/t6083.check
new file mode 100644
index 000000000..c9b5ba05d
--- /dev/null
+++ b/tests/untried/neg/t6083.check
@@ -0,0 +1,10 @@
+t6083.scala:6: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class annot(value: String) extends annotation.ClassfileAnnotation
+ ^
+t6083.scala:7: error: annotation argument needs to be a constant; found: conv.i2s(101)
+@annot(101) class C
+ ^
+one warning found
+one error found
diff --git a/tests/untried/neg/t6083.scala b/tests/untried/neg/t6083.scala
new file mode 100644
index 000000000..1de18e652
--- /dev/null
+++ b/tests/untried/neg/t6083.scala
@@ -0,0 +1,7 @@
+object conv {
+ implicit def i2s(i: Int): String = ""
+}
+import conv._
+
+class annot(value: String) extends annotation.ClassfileAnnotation
+@annot(101) class C
diff --git a/tests/untried/neg/t6120.check b/tests/untried/neg/t6120.check
new file mode 100644
index 000000000..a7d17e29c
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t6120.flags b/tests/untried/neg/t6120.flags
new file mode 100644
index 000000000..04d7c7d41
--- /dev/null
+++ b/tests/untried/neg/t6120.flags
@@ -0,0 +1 @@
+-feature -deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t6120.scala b/tests/untried/neg/t6120.scala
new file mode 100644
index 000000000..425f09db4
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t6123-explaintypes-macros.check b/tests/untried/neg/t6123-explaintypes-macros.check
new file mode 100644
index 000000000..2c86f3c9c
--- /dev/null
+++ b/tests/untried/neg/t6123-explaintypes-macros.check
@@ -0,0 +1,10 @@
+c.universe.Expr[Any]* <: c.universe.Expr[String]*?
+false
+BadMac_2.scala:6: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.blackbox.Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit]
+ or : (c: scala.reflect.macros.blackbox.Context)(format: c.Tree, params: Tree*): c.Tree
+ found : (c: scala.reflect.macros.blackbox.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
+ ^
+one error found
diff --git a/tests/untried/neg/t6123-explaintypes-macros/BadMac_2.flags b/tests/untried/neg/t6123-explaintypes-macros/BadMac_2.flags
new file mode 100644
index 000000000..b36707c7c
--- /dev/null
+++ b/tests/untried/neg/t6123-explaintypes-macros/BadMac_2.flags
@@ -0,0 +1 @@
+-explaintypes
diff --git a/tests/untried/neg/t6123-explaintypes-macros/BadMac_2.scala b/tests/untried/neg/t6123-explaintypes-macros/BadMac_2.scala
new file mode 100644
index 000000000..75ded4ef7
--- /dev/null
+++ b/tests/untried/neg/t6123-explaintypes-macros/BadMac_2.scala
@@ -0,0 +1,8 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+// explain some macro types to me
+object BadMac {
+ def printf(format: String, params: Any*): Unit = macro printf_impl
+ def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] = ???
+}
diff --git a/tests/untried/neg/t6123-explaintypes-macros/Macros.flags b/tests/untried/neg/t6123-explaintypes-macros/Macros.flags
new file mode 100644
index 000000000..b36707c7c
--- /dev/null
+++ b/tests/untried/neg/t6123-explaintypes-macros/Macros.flags
@@ -0,0 +1 @@
+-explaintypes
diff --git a/tests/untried/neg/t6123-explaintypes-macros/Macros.scala b/tests/untried/neg/t6123-explaintypes-macros/Macros.scala
new file mode 100644
index 000000000..f2238b39a
--- /dev/null
+++ b/tests/untried/neg/t6123-explaintypes-macros/Macros.scala
@@ -0,0 +1,10 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def printf(format: String, params: Any*): Unit = macro printf_impl
+ def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] = ???
+}
+
+// something trivial to run
+object Test extends App
diff --git a/tests/untried/neg/t6138.check b/tests/untried/neg/t6138.check
new file mode 100644
index 000000000..8fd997824
--- /dev/null
+++ b/tests/untried/neg/t6138.check
@@ -0,0 +1,7 @@
+t6138.scala:4: error: ambiguous reference to overloaded definition,
+both method getClass in object definitions of type (s: Int)Any
+and method getClass in object definitions of type (s: String)Any
+match argument types (Nothing)
+ getClass(???): String
+ ^
+one error found
diff --git a/tests/untried/neg/t6138.scala b/tests/untried/neg/t6138.scala
new file mode 100644
index 000000000..2f45a46b1
--- /dev/null
+++ b/tests/untried/neg/t6138.scala
@@ -0,0 +1,5 @@
+object definitions {
+ def getClass(s: String): Any = ???
+ def getClass(s: Int): Any = ???
+ getClass(???): String
+}
diff --git a/tests/untried/neg/t6162-inheritance.check b/tests/untried/neg/t6162-inheritance.check
new file mode 100644
index 000000000..13c78030d
--- /dev/null
+++ b/tests/untried/neg/t6162-inheritance.check
@@ -0,0 +1,18 @@
+usage.scala:3: warning: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version.
+class SubFoo extends Foo
+ ^
+usage.scala:5: warning: inheritance from trait T in package t6126 is deprecated
+object SubT extends T
+ ^
+usage.scala:8: warning: inheritance from trait S in package t6126 is deprecated
+ new S {
+ ^
+usage.scala:3: warning: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version.
+class SubFoo extends Foo
+ ^
+usage.scala:5: warning: inheritance from trait T in package t6126 is deprecated
+object SubT extends T
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+5 warnings found
+one error found
diff --git a/tests/untried/neg/t6162-inheritance.flags b/tests/untried/neg/t6162-inheritance.flags
new file mode 100644
index 000000000..65faf5357
--- /dev/null
+++ b/tests/untried/neg/t6162-inheritance.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -deprecation \ No newline at end of file
diff --git a/tests/untried/neg/t6162-inheritance/defn.scala b/tests/untried/neg/t6162-inheritance/defn.scala
new file mode 100644
index 000000000..bb582d27b
--- /dev/null
+++ b/tests/untried/neg/t6162-inheritance/defn.scala
@@ -0,0 +1,10 @@
+package scala.t6126
+
+@deprecatedInheritance("`Foo` will be made final in a future version.", "2.10.0")
+class Foo
+
+@deprecatedInheritance()
+trait T
+
+@deprecatedInheritance()
+trait S
diff --git a/tests/untried/neg/t6162-inheritance/usage.scala b/tests/untried/neg/t6162-inheritance/usage.scala
new file mode 100644
index 000000000..097e4f590
--- /dev/null
+++ b/tests/untried/neg/t6162-inheritance/usage.scala
@@ -0,0 +1,10 @@
+package scala.t6126
+
+class SubFoo extends Foo
+
+object SubT extends T
+
+object O {
+ new S {
+ }
+}
diff --git a/tests/untried/neg/t6162-overriding.check b/tests/untried/neg/t6162-overriding.check
new file mode 100644
index 000000000..6bff75d88
--- /dev/null
+++ b/tests/untried/neg/t6162-overriding.check
@@ -0,0 +1,9 @@
+t6162-overriding.scala:14: warning: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version.
+ override def bar = 43
+ ^
+t6162-overriding.scala:15: warning: overriding method baz in class Bar is deprecated
+ override def baz = 43
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/t6162-overriding.flags b/tests/untried/neg/t6162-overriding.flags
new file mode 100644
index 000000000..65faf5357
--- /dev/null
+++ b/tests/untried/neg/t6162-overriding.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -deprecation \ No newline at end of file
diff --git a/tests/untried/neg/t6162-overriding.scala b/tests/untried/neg/t6162-overriding.scala
new file mode 100644
index 000000000..4cab0c2de
--- /dev/null
+++ b/tests/untried/neg/t6162-overriding.scala
@@ -0,0 +1,17 @@
+package scala.t6162
+
+class Bar {
+ @deprecatedOverriding("`bar` will be made private in a future version.", "2.10.0")
+ def bar = 42
+
+ @deprecatedOverriding()
+ def baz = 42
+
+ def baz(a: Any) = 0
+}
+
+class SubBar extends Bar {
+ override def bar = 43
+ override def baz = 43
+ override def baz(a: Any) = 43 // okay
+}
diff --git a/tests/untried/neg/t6214.check b/tests/untried/neg/t6214.check
new file mode 100644
index 000000000..6349a3e71
--- /dev/null
+++ b/tests/untried/neg/t6214.check
@@ -0,0 +1,4 @@
+t6214.scala:5: error: missing parameter type
+ m { s => case class Foo() }
+ ^
+one error found
diff --git a/tests/untried/neg/t6214.scala b/tests/untried/neg/t6214.scala
new file mode 100644
index 000000000..0d5ffc5de
--- /dev/null
+++ b/tests/untried/neg/t6214.scala
@@ -0,0 +1,7 @@
+object Test {
+ def m(f: String => Unit) = 0
+ def m(f: Int => Unit) = 0
+ def foo: Unit = {
+ m { s => case class Foo() }
+ }
+}
diff --git a/tests/untried/neg/t6227.check b/tests/untried/neg/t6227.check
new file mode 100644
index 000000000..5e3c63671
--- /dev/null
+++ b/tests/untried/neg/t6227.check
@@ -0,0 +1,4 @@
+t6227.scala:2: error: illegal combination of modifiers: implicit and case for: class IntOps
+ implicit case class IntOps( i: Int ) {
+ ^
+one error found
diff --git a/tests/untried/neg/t6227.scala b/tests/untried/neg/t6227.scala
new file mode 100644
index 000000000..46416839d
--- /dev/null
+++ b/tests/untried/neg/t6227.scala
@@ -0,0 +1,6 @@
+object Test {
+ implicit case class IntOps( i: Int ) {
+ def twice = i * 2
+ }
+}
+
diff --git a/tests/untried/neg/t6258.check b/tests/untried/neg/t6258.check
new file mode 100644
index 000000000..73363d828
--- /dev/null
+++ b/tests/untried/neg/t6258.check
@@ -0,0 +1,16 @@
+t6258.scala:2: error: missing parameter type for expanded function
+The argument types of an anonymous function must be fully known. (SLS 8.5)
+Expected type was: PartialFunction[?, Int]
+ val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param
+ ^
+t6258.scala:5: error: missing parameter type for expanded function
+The argument types of an anonymous function must be fully known. (SLS 8.5)
+Expected type was: PartialFunction[?,Int]
+ foo { case a : Int => a } // undefined param
+ ^
+t6258.scala:22: error: missing parameter type for expanded function
+The argument types of an anonymous function must be fully known. (SLS 8.5)
+Expected type was: PartialFunction[?,Any]
+ bar[M[Any]] (foo { // undefined param
+ ^
+three errors found
diff --git a/tests/untried/neg/t6258.scala b/tests/untried/neg/t6258.scala
new file mode 100644
index 000000000..19794b325
--- /dev/null
+++ b/tests/untried/neg/t6258.scala
@@ -0,0 +1,25 @@
+object Test {
+ val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param
+
+ def foo[A](pf: PartialFunction[A, Int]): Unit = {};
+ foo { case a : Int => a } // undefined param
+
+ val g : PartialFunction[Int, _] = { case a : Int => a } // okay
+}
+
+
+// Another variation, seen in the wild with Specs2.
+class X {
+ trait Matcher[-T]
+
+ def bar[T](m: Matcher[T]) = null
+ def bar[T](i: Int) = null
+
+ def foo[T](p: PartialFunction[T, Any]): Matcher[T] = null
+
+ case class M[X](a: X)
+
+ bar[M[Any]] (foo { // undefined param
+ case M(_) => null
+ })
+}
diff --git a/tests/untried/neg/t6260-named.check b/tests/untried/neg/t6260-named.check
new file mode 100644
index 000000000..ed6ab5e76
--- /dev/null
+++ b/tests/untried/neg/t6260-named.check
@@ -0,0 +1,13 @@
+t6260-named.scala:12: error: bridge generated for member method apply: (a: C[Any])C[Any] in object O
+which overrides method apply: (v1: T1)R in trait Function1
+clashes with definition of the member itself;
+both have erased type (v1: Object)Object
+ def apply(a: C[Any]) = a
+ ^
+t6260-named.scala:14: error: bridge generated for member method apply: (a: C[Any])C[Any] in class X
+which overrides method apply: (a: A)A in trait T
+clashes with definition of the member itself;
+both have erased type (a: Object)Object
+ class X extends T[C[Any]] { def apply(a: C[Any]) = a }
+ ^
+two errors found
diff --git a/tests/untried/neg/t6260-named.scala b/tests/untried/neg/t6260-named.scala
new file mode 100644
index 000000000..7cd9ce847
--- /dev/null
+++ b/tests/untried/neg/t6260-named.scala
@@ -0,0 +1,15 @@
+class C[A](private val a: Any) extends AnyVal
+trait T[A] {
+ def apply(a: A): A
+}
+
+object Test {
+ (x: C[Any]) => {println(s"f($x)"); x} // okay
+ new T[C[Any]] { def apply(a: C[Any]) = a } // okay
+
+ // we can't rename the specific apply method to avoid the clash
+ object O extends Function1[C[Any], C[Any]] {
+ def apply(a: C[Any]) = a
+ }
+ class X extends T[C[Any]] { def apply(a: C[Any]) = a }
+}
diff --git a/tests/untried/neg/t6260c.check b/tests/untried/neg/t6260c.check
new file mode 100644
index 000000000..cbbcfd150
--- /dev/null
+++ b/tests/untried/neg/t6260c.check
@@ -0,0 +1,7 @@
+t6260c.scala:4: error: bridge generated for member method f: ()Option[A] in class Bar1
+which overrides method f: ()A in class Foo1
+clashes with definition of the member itself;
+both have erased type ()Object
+ class Bar1[A] extends Foo1[Option[A]] { def f(): Option[A] = ??? }
+ ^
+one error found
diff --git a/tests/untried/neg/t6260c.scala b/tests/untried/neg/t6260c.scala
new file mode 100644
index 000000000..02bf15237
--- /dev/null
+++ b/tests/untried/neg/t6260c.scala
@@ -0,0 +1,4 @@
+final class Option[+A](val value: A) extends AnyVal
+
+abstract class Foo1[A] { def f(): A }
+ class Bar1[A] extends Foo1[Option[A]] { def f(): Option[A] = ??? }
diff --git a/tests/untried/neg/t6263.check b/tests/untried/neg/t6263.check
new file mode 100644
index 000000000..9e9c7c615
--- /dev/null
+++ b/tests/untried/neg/t6263.check
@@ -0,0 +1,9 @@
+t6263.scala:5: error: type mismatch;
+ found : A.this.c.type (with underlying type C)
+ required: AnyRef
+Note that C extends Any, not AnyRef.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ type t = c.type
+ ^
+one error found
diff --git a/tests/untried/neg/t6263.scala b/tests/untried/neg/t6263.scala
new file mode 100644
index 000000000..6575185b5
--- /dev/null
+++ b/tests/untried/neg/t6263.scala
@@ -0,0 +1,6 @@
+class C(val a: Any) extends AnyVal
+class A {
+ implicit def c2AnyRef(c: C): AnyRef = new {}
+ val c = new C(0)
+ type t = c.type
+}
diff --git a/tests/untried/neg/t6264.check b/tests/untried/neg/t6264.check
new file mode 100644
index 000000000..c0975a80b
--- /dev/null
+++ b/tests/untried/neg/t6264.check
@@ -0,0 +1,6 @@
+t6264.scala:3: warning: non-variable type argument Tuple1[_] in type Tuple2[_, Tuple1[_]] is unchecked since it is eliminated by erasure
+ x.isInstanceOf[Tuple2[_, Tuple1[_]]]
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t6264.flags b/tests/untried/neg/t6264.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t6264.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t6264.scala b/tests/untried/neg/t6264.scala
new file mode 100644
index 000000000..dc3b72793
--- /dev/null
+++ b/tests/untried/neg/t6264.scala
@@ -0,0 +1,6 @@
+class Foo {
+ def foo(x: AnyRef): Unit = {
+ x.isInstanceOf[Tuple2[_, Tuple1[_]]]
+ ()
+ }
+}
diff --git a/tests/untried/neg/t6276.check b/tests/untried/neg/t6276.check
new file mode 100644
index 000000000..f275de9d0
--- /dev/null
+++ b/tests/untried/neg/t6276.check
@@ -0,0 +1,21 @@
+t6276.scala:4: warning: method a in class C does nothing other than call itself recursively
+ def a: Any = a // warn
+ ^
+t6276.scala:5: warning: value b in class C does nothing other than call itself recursively
+ val b: Any = b // warn
+ ^
+t6276.scala:7: warning: method c in class C does nothing other than call itself recursively
+ def c: Any = this.c // warn
+ ^
+t6276.scala:8: warning: method d in class C does nothing other than call itself recursively
+ def d: Any = C.this.d // warn
+ ^
+t6276.scala:13: warning: method a does nothing other than call itself recursively
+ def a: Any = a // warn
+ ^
+t6276.scala:22: warning: method a does nothing other than call itself recursively
+ def a = a // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+6 warnings found
+one error found
diff --git a/tests/untried/neg/t6276.flags b/tests/untried/neg/t6276.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t6276.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t6276.scala b/tests/untried/neg/t6276.scala
new file mode 100644
index 000000000..a3b0d6d5d
--- /dev/null
+++ b/tests/untried/neg/t6276.scala
@@ -0,0 +1,44 @@
+object Test {
+ def foo(a: Int, b: Int, c: Int): Unit = {
+ class C {
+ def a: Any = a // warn
+ val b: Any = b // warn
+
+ def c: Any = this.c // warn
+ def d: Any = C.this.d // warn
+ }
+
+ def method: Unit = {
+ // method local
+ def a: Any = a // warn
+ }
+
+ trait T {
+ def a: Any
+ }
+
+ new T {
+ // inherited return type
+ def a = a // warn
+ }
+
+ // no warnings below
+ new {
+ def a: Any = {println(""); a}
+ val b: Any = {println(""); b}
+ def c(i: Int): Any = c(i - 0)
+ }
+
+ class D {
+ def other: D = null
+ def foo: Any = other.foo
+ }
+
+ class E {
+ def foo: Any = 0
+ class D extends E {
+ override def foo: Any = E.this.foo
+ }
+ }
+ }
+}
diff --git a/tests/untried/neg/t6283.check b/tests/untried/neg/t6283.check
new file mode 100644
index 000000000..69e417ee9
--- /dev/null
+++ b/tests/untried/neg/t6283.check
@@ -0,0 +1,4 @@
+t6283.scala:1: error: `abstract' modifier cannot be used with value classes
+abstract class Funky(val i: Int) extends AnyVal
+ ^
+one error found
diff --git a/tests/untried/neg/t6283.scala b/tests/untried/neg/t6283.scala
new file mode 100644
index 000000000..d41eb18a7
--- /dev/null
+++ b/tests/untried/neg/t6283.scala
@@ -0,0 +1 @@
+abstract class Funky(val i: Int) extends AnyVal
diff --git a/tests/untried/neg/t6289.check b/tests/untried/neg/t6289.check
new file mode 100644
index 000000000..f6f43cabd
--- /dev/null
+++ b/tests/untried/neg/t6289.check
@@ -0,0 +1,10 @@
+#partest java6
+t6289/J.java:2: method does not override or implement a method from a supertype
+ @Override public void foo() { }
+ ^
+1 error
+#partest java7
+t6289/J.java:2: error: method does not override or implement a method from a supertype
+ @Override public void foo() { }
+ ^
+1 error
diff --git a/tests/untried/neg/t6289.flags b/tests/untried/neg/t6289.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t6289.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t6289/J.java b/tests/untried/neg/t6289/J.java
new file mode 100644
index 000000000..83f50c9ae
--- /dev/null
+++ b/tests/untried/neg/t6289/J.java
@@ -0,0 +1,5 @@
+public class J {
+ @Override public void foo() { }
+
+ public void bar() { foo(); }
+}
diff --git a/tests/untried/neg/t6289/SUT_5.scala b/tests/untried/neg/t6289/SUT_5.scala
new file mode 100644
index 000000000..0a996352c
--- /dev/null
+++ b/tests/untried/neg/t6289/SUT_5.scala
@@ -0,0 +1,5 @@
+
+/** The System Under Test.
+ * We bail on the earlier round that generates the first error.
+ */
+class SUT extends J
diff --git a/tests/untried/neg/t630.check b/tests/untried/neg/t630.check
new file mode 100644
index 000000000..0814ef0c1
--- /dev/null
+++ b/tests/untried/neg/t630.check
@@ -0,0 +1,5 @@
+t630.scala:20: error: overriding value foo in trait Bar of type Req2;
+ object foo has incompatible type
+ object foo extends Req1
+ ^
+one error found
diff --git a/tests/untried/neg/t630.scala b/tests/untried/neg/t630.scala
new file mode 100644
index 000000000..8a073963b
--- /dev/null
+++ b/tests/untried/neg/t630.scala
@@ -0,0 +1,23 @@
+trait Req1
+
+trait Req2 {
+ def test() = Console.println("Test")
+}
+
+trait Foo {
+ val foo : Req1
+}
+
+trait Bar {
+ val foo : Req2
+ def test() = foo.test
+}
+
+object Test
+ extends Foo
+ with Bar
+{
+ object foo extends Req1
+
+ def main(argv : Array[String]) = test
+}
diff --git a/tests/untried/neg/t631.check b/tests/untried/neg/t631.check
new file mode 100644
index 000000000..3759565e1
--- /dev/null
+++ b/tests/untried/neg/t631.check
@@ -0,0 +1,4 @@
+t631.scala:1: error: `implicit' modifier cannot be used for top-level objects
+implicit object Test {
+ ^
+one error found
diff --git a/tests/untried/neg/t631.scala b/tests/untried/neg/t631.scala
new file mode 100644
index 000000000..631db3eb1
--- /dev/null
+++ b/tests/untried/neg/t631.scala
@@ -0,0 +1,3 @@
+implicit object Test {
+ Console.println("foo")
+}
diff --git a/tests/untried/neg/t6323a.check b/tests/untried/neg/t6323a.check
new file mode 100644
index 000000000..261a60ef3
--- /dev/null
+++ b/tests/untried/neg/t6323a.check
@@ -0,0 +1,15 @@
+t6323a.scala:10: materializing requested scala.reflect.type.ClassTag[Test] using `package`.this.materializeClassTag[Test]()
+ val lookAtMe = m.reflect(Test("a",List(5)))
+ ^
+t6323a.scala:11: materializing requested reflect.runtime.universe.type.TypeTag[Test] using `package`.this.materializeTypeTag[Test](scala.reflect.runtime.`package`.universe)
+ val value = u.typeOf[Test]
+ ^
+t6323a.scala:11: `package`.this.materializeTypeTag[Test](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[Test] because:
+failed to typecheck the materialized tag:
+cannot create a TypeTag referring to class Test.Test local to the reifee: use WeakTypeTag instead
+ val value = u.typeOf[Test]
+ ^
+t6323a.scala:11: error: No TypeTag available for Test
+ val value = u.typeOf[Test]
+ ^
+one error found
diff --git a/tests/untried/neg/t6323a.flags b/tests/untried/neg/t6323a.flags
new file mode 100644
index 000000000..4c6cdb71e
--- /dev/null
+++ b/tests/untried/neg/t6323a.flags
@@ -0,0 +1 @@
+-Xlog-implicits \ No newline at end of file
diff --git a/tests/untried/neg/t6323a.scala b/tests/untried/neg/t6323a.scala
new file mode 100644
index 000000000..a32eb915d
--- /dev/null
+++ b/tests/untried/neg/t6323a.scala
@@ -0,0 +1,21 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => m}
+import scala.reflect.runtime.{universe => u}
+
+object Test extends App {
+ locally {
+ try {
+ case class Test(a:String,b:List[Int])
+
+ val lookAtMe = m.reflect(Test("a",List(5)))
+ val value = u.typeOf[Test]
+ val members = value.members
+ val member = value.members.filter(_.name.encoded == "a")
+ val aAccessor = lookAtMe.reflectMethod(member.head.asMethod)
+ val thisShouldBeA = aAccessor.apply()
+ println(thisShouldBeA)
+ } catch {
+ case ScalaReflectionException(msg) => println(msg)
+ }
+ }
+}
diff --git a/tests/untried/neg/t633.check b/tests/untried/neg/t633.check
new file mode 100644
index 000000000..d69d3be70
--- /dev/null
+++ b/tests/untried/neg/t633.check
@@ -0,0 +1,4 @@
+t633.scala:3: error: not found: type ListBuffer
+ def t(a : ListBuffer[String]) = {
+ ^
+one error found
diff --git a/tests/untried/neg/t633.scala b/tests/untried/neg/t633.scala
new file mode 100644
index 000000000..fd4e56072
--- /dev/null
+++ b/tests/untried/neg/t633.scala
@@ -0,0 +1,8 @@
+object Test
+{
+ def t(a : ListBuffer[String]) = {
+ Console.println(a.length)
+ }
+
+ def main(argv : Array[String]) = t(null)
+}
diff --git a/tests/untried/neg/t6335.check b/tests/untried/neg/t6335.check
new file mode 100644
index 000000000..1727a05eb
--- /dev/null
+++ b/tests/untried/neg/t6335.check
@@ -0,0 +1,9 @@
+t6335.scala:6: error: method Z is defined twice
+ conflicting symbols both originated in file 't6335.scala'
+ implicit class Z[A](val i: A) { def zz = i }
+ ^
+t6335.scala:3: error: method X is defined twice
+ conflicting symbols both originated in file 't6335.scala'
+ implicit class X(val x: Int) { def xx = x }
+ ^
+two errors found
diff --git a/tests/untried/neg/t6335.scala b/tests/untried/neg/t6335.scala
new file mode 100644
index 000000000..6c898af5b
--- /dev/null
+++ b/tests/untried/neg/t6335.scala
@@ -0,0 +1,7 @@
+object ImplicitClass {
+ def X(i: Int): Unit = {}
+ implicit class X(val x: Int) { def xx = x }
+
+ def Z[A](i: A): Unit = {}
+ implicit class Z[A](val i: A) { def zz = i }
+}
diff --git a/tests/untried/neg/t6336.check b/tests/untried/neg/t6336.check
new file mode 100644
index 000000000..f70a5f70a
--- /dev/null
+++ b/tests/untried/neg/t6336.check
@@ -0,0 +1,7 @@
+t6336.scala:3: error: Parameter type in structural refinement may not refer to a user-defined value class
+ val a = new { def y[T](x: X[T]) = x.i }
+ ^
+t6336.scala:4: error: Result type in structural refinement may not refer to a user-defined value class
+ val b = new { def y[T](x: T): X[T] = new X(2) }
+ ^
+two errors found
diff --git a/tests/untried/neg/t6336.scala b/tests/untried/neg/t6336.scala
new file mode 100644
index 000000000..d8b795e3e
--- /dev/null
+++ b/tests/untried/neg/t6336.scala
@@ -0,0 +1,12 @@
+object D {
+ def main(args: Array[String]): Unit = {
+ val a = new { def y[T](x: X[T]) = x.i }
+ val b = new { def y[T](x: T): X[T] = new X(2) }
+ val x = new X(3)
+ val t = a.y(x)
+ println(t)
+ }
+}
+
+class X[T](val i: Int) extends AnyVal
+
diff --git a/tests/untried/neg/t6337.check b/tests/untried/neg/t6337.check
new file mode 100644
index 000000000..8448f7132
--- /dev/null
+++ b/tests/untried/neg/t6337.check
@@ -0,0 +1,7 @@
+t6337.scala:10: error: value class may not wrap another user-defined value class
+class X[T](val i: XX[T]) extends AnyVal
+ ^
+t6337.scala:20: error: value class may not wrap another user-defined value class
+class X1[T](val i: XX1[T]) extends AnyVal
+ ^
+two errors found
diff --git a/tests/untried/neg/t6337.scala b/tests/untried/neg/t6337.scala
new file mode 100644
index 000000000..a6cb9bb33
--- /dev/null
+++ b/tests/untried/neg/t6337.scala
@@ -0,0 +1,21 @@
+object C {
+
+ def main(args: Array[String]) = {
+ val x = new X(new XX(3))
+ println(x.i.x + 9)
+ }
+
+}
+
+class X[T](val i: XX[T]) extends AnyVal
+class XX[T](val x: T) extends AnyVal
+
+object C1 {
+ def main(args: Array[String]): Unit = {
+ val x = new X1(new XX1(Some(3)))
+ println(x.i.x.get + 9)
+ }
+}
+
+class X1[T](val i: XX1[T]) extends AnyVal
+class XX1[T](val x: Option[T]) extends AnyVal
diff --git a/tests/untried/neg/t6340.check b/tests/untried/neg/t6340.check
new file mode 100644
index 000000000..f18b8c3f4
--- /dev/null
+++ b/tests/untried/neg/t6340.check
@@ -0,0 +1,10 @@
+t6340.scala:11: error: value D is not a member of object Foo
+ import Foo.{ A, B, C, D, E, X, Y, Z }
+ ^
+t6340.scala:16: error: not found: type D
+ val d = new D
+ ^
+t6340.scala:17: error: not found: type W
+ val w = new W
+ ^
+three errors found
diff --git a/tests/untried/neg/t6340.scala b/tests/untried/neg/t6340.scala
new file mode 100644
index 000000000..8934d5c15
--- /dev/null
+++ b/tests/untried/neg/t6340.scala
@@ -0,0 +1,21 @@
+object Foo {
+ class A
+ class B
+ class C
+ class X
+ class Y
+ class Z
+}
+
+object Test {
+ import Foo.{ A, B, C, D, E, X, Y, Z }
+
+ val a = new A
+ val b = new B
+ val c = new C
+ val d = new D
+ val w = new W
+ val x = new X
+ val y = new Y
+ val z = new Z
+}
diff --git a/tests/untried/neg/t6355a.check b/tests/untried/neg/t6355a.check
new file mode 100644
index 000000000..5768d31f0
--- /dev/null
+++ b/tests/untried/neg/t6355a.check
@@ -0,0 +1,7 @@
+t6355a.scala:12: error: implementation restriction: applyDynamic cannot be overloaded except by methods with different numbers of type parameters, e.g. applyDynamic[T1](method: String)(arg: T1) and applyDynamic[T1, T2](method: String)(arg1: T1, arg2: T2)
+ def applyDynamic(name: String)(x: Int): Int = 2
+ ^
+t6355a.scala:18: error: implementation restriction: applyDynamic cannot be overloaded except by methods with different numbers of type parameters, e.g. applyDynamic[T1](method: String)(arg: T1) and applyDynamic[T1, T2](method: String)(arg1: T1, arg2: T2)
+ def applyDynamic[T1, T2](name: String)(x: String, y: T1, z: T2): Int = 3
+ ^
+two errors found
diff --git a/tests/untried/neg/t6355a.scala b/tests/untried/neg/t6355a.scala
new file mode 100644
index 000000000..0500ed04c
--- /dev/null
+++ b/tests/untried/neg/t6355a.scala
@@ -0,0 +1,19 @@
+package foo
+
+import scala.language.dynamics
+
+class DoesntExtendDynamic {
+ def applyDynamic(name: String)(s: String): Int = 1
+ def applyDynamic(name: String)(x: Int): Int = 2
+}
+
+class A extends Dynamic {
+ def applyDynamic(name: String)(s: String): Int = 1
+ def applyDynamic(name: String)(x: Int): Int = 2
+}
+
+class B extends Dynamic {
+ def applyDynamic[T1](name: String)(x: T1): Int = 1
+ def applyDynamic[T1, T2](name: String)(x: T1, y: T2): Int = 2
+ def applyDynamic[T1, T2](name: String)(x: String, y: T1, z: T2): Int = 3
+}
diff --git a/tests/untried/neg/t6355b.check b/tests/untried/neg/t6355b.check
new file mode 100644
index 000000000..f827f07e5
--- /dev/null
+++ b/tests/untried/neg/t6355b.check
@@ -0,0 +1,11 @@
+t6355b.scala:14: error: value applyDynamic is not a member of A
+error after rewriting to x.<applyDynamic: error>("bippy")
+possible cause: maybe a wrong Dynamic method signature?
+ println(x.bippy(42))
+ ^
+t6355b.scala:15: error: value applyDynamic is not a member of A
+error after rewriting to x.<applyDynamic: error>("bippy")
+possible cause: maybe a wrong Dynamic method signature?
+ println(x.bippy("42"))
+ ^
+two errors found
diff --git a/tests/untried/neg/t6355b.scala b/tests/untried/neg/t6355b.scala
new file mode 100644
index 000000000..5f3c97cb0
--- /dev/null
+++ b/tests/untried/neg/t6355b.scala
@@ -0,0 +1,17 @@
+import scala.language.dynamics
+
+class A extends Dynamic {
+ def selectDynamic(method: String): B = new B(method)
+}
+class B(method: String) {
+ def apply(x: Int) = s"$method(x: Int) called with x = $x"
+ def apply(x: String) = s"""$method(x: String) called with x = "$x""""
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val x = new A
+ println(x.bippy(42))
+ println(x.bippy("42"))
+ }
+}
diff --git a/tests/untried/neg/t6357.check b/tests/untried/neg/t6357.check
new file mode 100644
index 000000000..a534d1439
--- /dev/null
+++ b/tests/untried/neg/t6357.check
@@ -0,0 +1,4 @@
+t6357.scala:3: error: value class may not be a local class
+ final class Y(val j: Int) extends AnyVal
+ ^
+one error found
diff --git a/tests/untried/neg/t6357.scala b/tests/untried/neg/t6357.scala
new file mode 100644
index 000000000..47f562963
--- /dev/null
+++ b/tests/untried/neg/t6357.scala
@@ -0,0 +1,6 @@
+object K {
+ def q = {
+ final class Y(val j: Int) extends AnyVal
+ 3
+ }
+}
diff --git a/tests/untried/neg/t6359.check b/tests/untried/neg/t6359.check
new file mode 100644
index 000000000..5bcdc5733
--- /dev/null
+++ b/tests/untried/neg/t6359.check
@@ -0,0 +1,9 @@
+t6359.scala:3: error: implementation restriction: nested object is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ object X
+ ^
+t6359.scala:4: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ class Y
+ ^
+two errors found
diff --git a/tests/untried/neg/t6359.scala b/tests/untried/neg/t6359.scala
new file mode 100644
index 000000000..96550fd90
--- /dev/null
+++ b/tests/untried/neg/t6359.scala
@@ -0,0 +1,8 @@
+class M(val t: Int) extends AnyVal {
+ def lazyString = {
+ object X
+ class Y
+
+ () => {X; new Y}
+ }
+}
diff --git a/tests/untried/neg/t6375.check b/tests/untried/neg/t6375.check
new file mode 100644
index 000000000..89d7d8060
--- /dev/null
+++ b/tests/untried/neg/t6375.check
@@ -0,0 +1,27 @@
+t6375.scala:6: warning: no valid targets for annotation on value x1 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @getter)
+ @Bippy val x1: Int // warn
+ ^
+t6375.scala:7: warning: no valid targets for annotation on value x2 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.field @getter)
+ @(Bippy @field) val x2: Int // warn
+ ^
+t6375.scala:9: warning: no valid targets for annotation on value x4 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.setter @getter)
+ @(Bippy @setter) val x4: Int // warn
+ ^
+t6375.scala:10: warning: no valid targets for annotation on value x5 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.param @getter)
+ @(Bippy @param) val x5: Int // warn
+ ^
+t6375.scala:20: warning: no valid targets for annotation on value q1 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.getter @field)
+ @(Bippy @getter) private[this] val q1: Int = 1 // warn
+ ^
+t6375.scala:40: warning: no valid targets for annotation on value p2 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.getter @param)
+ @(Bippy @getter) p2: Int, // warn
+ ^
+t6375.scala:41: warning: no valid targets for annotation on value p3 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.setter @param)
+ @(Bippy @setter) p3: Int, // warn
+ ^
+t6375.scala:42: warning: no valid targets for annotation on value p4 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.field @param)
+ @(Bippy @field) p4: Int // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+8 warnings found
+one error found
diff --git a/tests/untried/neg/t6375.flags b/tests/untried/neg/t6375.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t6375.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t6375.scala b/tests/untried/neg/t6375.scala
new file mode 100644
index 000000000..21634df68
--- /dev/null
+++ b/tests/untried/neg/t6375.scala
@@ -0,0 +1,67 @@
+import scala.annotation.meta._
+
+class Bippy extends scala.annotation.StaticAnnotation
+
+abstract class Foo {
+ @Bippy val x1: Int // warn
+ @(Bippy @field) val x2: Int // warn
+ @(Bippy @getter) val x3: Int // no warn
+ @(Bippy @setter) val x4: Int // warn
+ @(Bippy @param) val x5: Int // warn
+}
+
+object Bar extends Foo {
+ val x1 = 1
+ val x2 = 2
+ val x3 = 3
+ val x4 = 4
+ val x5 = 5
+
+ @(Bippy @getter) private[this] val q1: Int = 1 // warn
+ @(Bippy @getter) private val q2: Int = 1 // no warn
+
+ def f1(@(Bippy @param) x: Int): Int = 0 // no warn
+ def f2(@(Bippy @getter) x: Int): Int = 0 // warn - todo
+ def f3(@(Bippy @setter) x: Int): Int = 0 // warn - todo
+ def f4(@(Bippy @field) x: Int): Int = 0 // warn - todo
+ def f5(@Bippy x: Int): Int = 0 // no warn
+
+ @(Bippy @companionClass) def g1(x: Int): Int = 0 // warn - todo
+ @(Bippy @companionObject) def g2(x: Int): Int = 0 // warn - todo
+ @(Bippy @companionMethod) def g3(x: Int): Int = 0 // no warn
+ @Bippy def g4(x: Int): Int = 0 // no warn
+
+ @(Bippy @companionObject @companionMethod) def g5(x: Int): Int = 0 // no warn
+}
+
+class Dingo(
+ @Bippy p0: Int, // no warn
+ @(Bippy @param) p1: Int, // no warn
+ @(Bippy @getter) p2: Int, // warn
+ @(Bippy @setter) p3: Int, // warn
+ @(Bippy @field) p4: Int // warn
+)
+
+class ValDingo(
+ @Bippy val p0: Int, // no warn
+ @(Bippy @param) val p1: Int, // no warn
+ @(Bippy @getter) val p2: Int, // no warn
+ @(Bippy @setter) val p3: Int, // warn - todo
+ @(Bippy @field) val p4: Int // no warn
+)
+
+class VarDingo(
+ @Bippy var p0: Int, // no warn
+ @(Bippy @param) var p1: Int, // no warn
+ @(Bippy @getter) var p2: Int, // no warn
+ @(Bippy @setter) var p3: Int, // no warn
+ @(Bippy @field) var p4: Int // no warn
+)
+
+case class CaseDingo(
+ @Bippy p0: Int, // no warn
+ @(Bippy @param) p1: Int, // no warn
+ @(Bippy @getter) p2: Int, // no warn
+ @(Bippy @setter) p3: Int, // warn - todo
+ @(Bippy @field) p4: Int // no warn
+)
diff --git a/tests/untried/neg/t639.check b/tests/untried/neg/t639.check
new file mode 100644
index 000000000..6d41d872d
--- /dev/null
+++ b/tests/untried/neg/t639.check
@@ -0,0 +1,7 @@
+t639.scala:3: error: not found: object a
+import a._
+ ^
+t639.scala:5: error: not found: type B
+@B
+ ^
+two errors found
diff --git a/tests/untried/neg/t639.scala b/tests/untried/neg/t639.scala
new file mode 100644
index 000000000..eaeed944a
--- /dev/null
+++ b/tests/untried/neg/t639.scala
@@ -0,0 +1,6 @@
+package foo123
+
+import a._
+
+@B
+class C
diff --git a/tests/untried/neg/t6406-regextract.check b/tests/untried/neg/t6406-regextract.check
new file mode 100644
index 000000000..19425a68b
--- /dev/null
+++ b/tests/untried/neg/t6406-regextract.check
@@ -0,0 +1,6 @@
+t6406-regextract.scala:4: warning: method unapplySeq in class Regex is deprecated: Extracting a match result from anything but a CharSequence or Match is deprecated
+ List(1) collect { case r(i) => i }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t6406-regextract.flags b/tests/untried/neg/t6406-regextract.flags
new file mode 100644
index 000000000..7de3c0f3e
--- /dev/null
+++ b/tests/untried/neg/t6406-regextract.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -deprecation
diff --git a/tests/untried/neg/t6406-regextract.scala b/tests/untried/neg/t6406-regextract.scala
new file mode 100644
index 000000000..0f5dad908
--- /dev/null
+++ b/tests/untried/neg/t6406-regextract.scala
@@ -0,0 +1,5 @@
+
+object Test extends App {
+ val r = "(\\d+)".r
+ List(1) collect { case r(i) => i }
+}
diff --git a/tests/untried/neg/t6436.check b/tests/untried/neg/t6436.check
new file mode 100644
index 000000000..5cee6fb55
--- /dev/null
+++ b/tests/untried/neg/t6436.check
@@ -0,0 +1,10 @@
+t6436.scala:8: error: type mismatch;
+ found : StringContext
+ required: ?{def q: ?}
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method foo1 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
+ are possible conversion functions from StringContext to ?{def q: ?}
+ println(q"a")
+ ^
+one error found
diff --git a/tests/untried/neg/t6436.scala b/tests/untried/neg/t6436.scala
new file mode 100644
index 000000000..2c4050253
--- /dev/null
+++ b/tests/untried/neg/t6436.scala
@@ -0,0 +1,9 @@
+object quasiquotes {
+ implicit def foo1(ctx: StringContext) = new { def q = ??? }
+ implicit def foo2(ctx: StringContext) = new { def q = ??? }
+}
+
+object Test extends App {
+ import quasiquotes._
+ println(q"a")
+}
diff --git a/tests/untried/neg/t6436b.check b/tests/untried/neg/t6436b.check
new file mode 100644
index 000000000..21ab972b7
--- /dev/null
+++ b/tests/untried/neg/t6436b.check
@@ -0,0 +1,10 @@
+t6436b.scala:8: error: type mismatch;
+ found : StringContext
+ required: ?{def q: ?}
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method foo1 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
+ are possible conversion functions from StringContext to ?{def q: ?}
+ println(StringContext("a").q())
+ ^
+one error found
diff --git a/tests/untried/neg/t6436b.scala b/tests/untried/neg/t6436b.scala
new file mode 100644
index 000000000..8023329e9
--- /dev/null
+++ b/tests/untried/neg/t6436b.scala
@@ -0,0 +1,9 @@
+object quasiquotes {
+ implicit def foo1(ctx: StringContext) = new { def q = ??? }
+ implicit def foo2(ctx: StringContext) = new { def q = ??? }
+}
+
+object Test extends App {
+ import quasiquotes._
+ println(StringContext("a").q())
+}
diff --git a/tests/untried/neg/t6443c.check b/tests/untried/neg/t6443c.check
new file mode 100644
index 000000000..7b7f419f6
--- /dev/null
+++ b/tests/untried/neg/t6443c.check
@@ -0,0 +1,7 @@
+t6443c.scala:16: error: double definition:
+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 = ()
+ ^
+one error found
diff --git a/tests/untried/neg/t6443c.scala b/tests/untried/neg/t6443c.scala
new file mode 100644
index 000000000..817224e04
--- /dev/null
+++ b/tests/untried/neg/t6443c.scala
@@ -0,0 +1,21 @@
+trait A {
+ type D >: Null <: C
+ def foo(d: D)(a: Any, d2: d.type): Unit
+ trait C {
+ def bar: Unit = foo(null)(null, null)
+ }
+}
+object B extends A {
+ class D extends C
+
+ def foo(d: D)(a: Any, d2: d.type): Unit = () // Bridge method required here!
+
+ // No bridge method should be added, but we'll be happy enough if
+ // the "same type after erasure" error kicks in before the duplicated
+ // bridge causes a problem.
+ def foo(d: D)(a: Any)(d2: d.type): Unit = ()
+}
+
+object Test extends App {
+ new B.D().bar
+}
diff --git a/tests/untried/neg/t6446-additional.check b/tests/untried/neg/t6446-additional.check
new file mode 100755
index 000000000..a87af2f1e
--- /dev/null
+++ b/tests/untried/neg/t6446-additional.check
@@ -0,0 +1,39 @@
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ delambdafy 22 remove lambdas
+ icode 23 generate portable intermediate code
+#partest -optimise
+ inliner 24 optimization: do inlining
+inlinehandlers 25 optimization: inline exception handlers
+ closelim 26 optimization: eliminate uncalled closures
+ constopt 27 optimization: optimize null and other constants
+ dce 28 optimization: eliminate dead code
+ jvm 29 generate JVM bytecode
+ ploogin 30 A sample phase that does so many things it's kind of hard...
+ terminal 31 the last phase during a compilation run
+#partest !-optimise
+ jvm 24 generate JVM bytecode
+ ploogin 25 A sample phase that does so many things it's kind of hard...
+ terminal 26 the last phase during a compilation run
+#partest
diff --git a/tests/untried/neg/t6446-additional/ploogin_1.scala b/tests/untried/neg/t6446-additional/ploogin_1.scala
new file mode 100644
index 000000000..dbf433f9a
--- /dev/null
+++ b/tests/untried/neg/t6446-additional/ploogin_1.scala
@@ -0,0 +1,31 @@
+
+package t6446
+
+import scala.tools.nsc.{ Global, Phase }
+import scala.tools.nsc.plugins.{ Plugin, PluginComponent }
+import scala.reflect.io.Path
+import scala.reflect.io.File
+
+/** A test plugin. */
+class Ploogin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "ploogin"
+ val description = "A sample plugin for testing."
+ val components = List[PluginComponent](TestComponent)
+
+ private object TestComponent extends PluginComponent {
+ val global: Ploogin.this.global.type = Ploogin.this.global
+ //override val runsBefore = List("refchecks")
+ val runsAfter = List("jvm")
+ val phaseName = Ploogin.this.name
+ override def description = "A sample phase that does so many things it's kind of hard to describe briefly."
+ def newPhase(prev: Phase) = new TestPhase(prev)
+ class TestPhase(prev: Phase) extends StdPhase(prev) {
+ override def description = TestComponent.this.description
+ def apply(unit: CompilationUnit): Unit = {
+ // kewl kode
+ }
+ }
+ }
+}
diff --git a/tests/untried/neg/t6446-additional/sample_2.flags b/tests/untried/neg/t6446-additional/sample_2.flags
new file mode 100644
index 000000000..4d518c228
--- /dev/null
+++ b/tests/untried/neg/t6446-additional/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xshow-phases
diff --git a/tests/untried/neg/t6446-additional/sample_2.scala b/tests/untried/neg/t6446-additional/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t6446-additional/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t6446-additional/scalac-plugin.xml b/tests/untried/neg/t6446-additional/scalac-plugin.xml
new file mode 100644
index 000000000..e849bb591
--- /dev/null
+++ b/tests/untried/neg/t6446-additional/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+<name>sample-plugin</name>
+<classname>t6446.Ploogin</classname>
+</plugin>
diff --git a/tests/untried/neg/t6446-list.check b/tests/untried/neg/t6446-list.check
new file mode 100755
index 000000000..fa5c58194
--- /dev/null
+++ b/tests/untried/neg/t6446-list.check
@@ -0,0 +1 @@
+ploogin - A sample plugin for testing.
diff --git a/tests/untried/neg/t6446-list/ploogin_1.scala b/tests/untried/neg/t6446-list/ploogin_1.scala
new file mode 100644
index 000000000..dbf433f9a
--- /dev/null
+++ b/tests/untried/neg/t6446-list/ploogin_1.scala
@@ -0,0 +1,31 @@
+
+package t6446
+
+import scala.tools.nsc.{ Global, Phase }
+import scala.tools.nsc.plugins.{ Plugin, PluginComponent }
+import scala.reflect.io.Path
+import scala.reflect.io.File
+
+/** A test plugin. */
+class Ploogin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "ploogin"
+ val description = "A sample plugin for testing."
+ val components = List[PluginComponent](TestComponent)
+
+ private object TestComponent extends PluginComponent {
+ val global: Ploogin.this.global.type = Ploogin.this.global
+ //override val runsBefore = List("refchecks")
+ val runsAfter = List("jvm")
+ val phaseName = Ploogin.this.name
+ override def description = "A sample phase that does so many things it's kind of hard to describe briefly."
+ def newPhase(prev: Phase) = new TestPhase(prev)
+ class TestPhase(prev: Phase) extends StdPhase(prev) {
+ override def description = TestComponent.this.description
+ def apply(unit: CompilationUnit): Unit = {
+ // kewl kode
+ }
+ }
+ }
+}
diff --git a/tests/untried/neg/t6446-list/sample_2.flags b/tests/untried/neg/t6446-list/sample_2.flags
new file mode 100644
index 000000000..9cb323296
--- /dev/null
+++ b/tests/untried/neg/t6446-list/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-list
diff --git a/tests/untried/neg/t6446-list/sample_2.scala b/tests/untried/neg/t6446-list/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t6446-list/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t6446-list/scalac-plugin.xml b/tests/untried/neg/t6446-list/scalac-plugin.xml
new file mode 100644
index 000000000..e849bb591
--- /dev/null
+++ b/tests/untried/neg/t6446-list/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+<name>sample-plugin</name>
+<classname>t6446.Ploogin</classname>
+</plugin>
diff --git a/tests/untried/neg/t6446-missing.check b/tests/untried/neg/t6446-missing.check
new file mode 100755
index 000000000..029c8057c
--- /dev/null
+++ b/tests/untried/neg/t6446-missing.check
@@ -0,0 +1,38 @@
+Error: unable to load class: t6446.Ploogin
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ delambdafy 22 remove lambdas
+ icode 23 generate portable intermediate code
+#partest !-optimise
+ jvm 24 generate JVM bytecode
+ terminal 25 the last phase during a compilation run
+#partest -optimise
+ inliner 24 optimization: do inlining
+inlinehandlers 25 optimization: inline exception handlers
+ closelim 26 optimization: eliminate uncalled closures
+ constopt 27 optimization: optimize null and other constants
+ dce 28 optimization: eliminate dead code
+ jvm 29 generate JVM bytecode
+ terminal 30 the last phase during a compilation run
+#partest
diff --git a/tests/untried/neg/t6446-missing/sample_2.flags b/tests/untried/neg/t6446-missing/sample_2.flags
new file mode 100644
index 000000000..4d518c228
--- /dev/null
+++ b/tests/untried/neg/t6446-missing/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xshow-phases
diff --git a/tests/untried/neg/t6446-missing/sample_2.scala b/tests/untried/neg/t6446-missing/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t6446-missing/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t6446-missing/scalac-plugin.xml b/tests/untried/neg/t6446-missing/scalac-plugin.xml
new file mode 100644
index 000000000..9c34d63f8
--- /dev/null
+++ b/tests/untried/neg/t6446-missing/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+<name>missing-plugin</name>
+<classname>t6446.Ploogin</classname>
+</plugin>
diff --git a/tests/untried/neg/t6446-show-phases.check b/tests/untried/neg/t6446-show-phases.check
new file mode 100644
index 000000000..3ae3f96ef
--- /dev/null
+++ b/tests/untried/neg/t6446-show-phases.check
@@ -0,0 +1,37 @@
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ delambdafy 22 remove lambdas
+ icode 23 generate portable intermediate code
+#partest !-optimise
+ jvm 24 generate JVM bytecode
+ terminal 25 the last phase during a compilation run
+#partest -optimise
+ inliner 24 optimization: do inlining
+inlinehandlers 25 optimization: inline exception handlers
+ closelim 26 optimization: eliminate uncalled closures
+ constopt 27 optimization: optimize null and other constants
+ dce 28 optimization: eliminate dead code
+ jvm 29 generate JVM bytecode
+ terminal 30 the last phase during a compilation run
+#partest
diff --git a/tests/untried/neg/t6446-show-phases.flags b/tests/untried/neg/t6446-show-phases.flags
new file mode 100644
index 000000000..845666e10
--- /dev/null
+++ b/tests/untried/neg/t6446-show-phases.flags
@@ -0,0 +1 @@
+-Xshow-phases
diff --git a/tests/untried/neg/t6446-show-phases.scala b/tests/untried/neg/t6446-show-phases.scala
new file mode 100644
index 000000000..a9afb042d
--- /dev/null
+++ b/tests/untried/neg/t6446-show-phases.scala
@@ -0,0 +1,3 @@
+
+// testing compiler flag output only
+object Test extends App
diff --git a/tests/untried/neg/t6455.check b/tests/untried/neg/t6455.check
new file mode 100644
index 000000000..8f2aad0b9
--- /dev/null
+++ b/tests/untried/neg/t6455.check
@@ -0,0 +1,4 @@
+t6455.scala:5: error: value withFilter is not a member of object O
+ O.withFilter(f => true)
+ ^
+one error found
diff --git a/tests/untried/neg/t6455.flags b/tests/untried/neg/t6455.flags
new file mode 100644
index 000000000..112fc720a
--- /dev/null
+++ b/tests/untried/neg/t6455.flags
@@ -0,0 +1 @@
+-Xfuture \ No newline at end of file
diff --git a/tests/untried/neg/t6455.scala b/tests/untried/neg/t6455.scala
new file mode 100644
index 000000000..f62be3eb0
--- /dev/null
+++ b/tests/untried/neg/t6455.scala
@@ -0,0 +1,6 @@
+object O { def filter(p: Int => Boolean): O.type = this }
+
+class Test {
+ // should not compile because we no longer rewrite withFilter => filter under -Xfuture
+ O.withFilter(f => true)
+}
diff --git a/tests/untried/neg/t6483.check b/tests/untried/neg/t6483.check
new file mode 100644
index 000000000..66e350710
--- /dev/null
+++ b/tests/untried/neg/t6483.check
@@ -0,0 +1,9 @@
+t6483.scala:7: error: implementation restriction: qualified super reference is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ override def foo = super[T].foo // error
+ ^
+t6483.scala:20: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ class Inner extends T {
+ ^
+two errors found
diff --git a/tests/untried/neg/t6483.scala b/tests/untried/neg/t6483.scala
new file mode 100644
index 000000000..3d6713db4
--- /dev/null
+++ b/tests/untried/neg/t6483.scala
@@ -0,0 +1,24 @@
+trait T extends Any {
+ def foo = 1
+ type X
+}
+
+class C1(val a: Any) extends AnyVal with T {
+ override def foo = super[T].foo // error
+}
+
+class C2(val a: Int) extends AnyVal with T {
+ override def foo = super.foo + a // okay
+}
+
+class C3(val a: Int) extends AnyVal with T {
+ override def foo = C3.super.foo + a // okay
+}
+
+class C4(val a: Int) extends AnyVal with T {
+ def foo: Unit = {
+ class Inner extends T {
+ override def foo = super[T].foo + a // no (direct) error, other than that a nested class is currently illegal.
+ }
+ }
+}
diff --git a/tests/untried/neg/t649.check b/tests/untried/neg/t649.check
new file mode 100644
index 000000000..5a270d475
--- /dev/null
+++ b/tests/untried/neg/t649.check
@@ -0,0 +1,4 @@
+t649.scala:3: error: overloaded method foo needs result type
+ def foo[A] = foo[A]
+ ^
+one error found
diff --git a/tests/untried/neg/t649.scala b/tests/untried/neg/t649.scala
new file mode 100644
index 000000000..2519eb5cf
--- /dev/null
+++ b/tests/untried/neg/t649.scala
@@ -0,0 +1,4 @@
+object test {
+ def foo[A] = 0
+ def foo[A] = foo[A]
+}
diff --git a/tests/untried/neg/t650.check b/tests/untried/neg/t650.check
new file mode 100644
index 000000000..320ae6670
--- /dev/null
+++ b/tests/untried/neg/t650.check
@@ -0,0 +1,4 @@
+t650.scala:4: error: missing type arguments
+trait Test2 extends LinkedList;
+ ^
+one error found
diff --git a/tests/untried/neg/t650.scala b/tests/untried/neg/t650.scala
new file mode 100644
index 000000000..cdb4b3da4
--- /dev/null
+++ b/tests/untried/neg/t650.scala
@@ -0,0 +1,4 @@
+// test/Test2.scala
+package test;
+import scala.collection.mutable._;
+trait Test2 extends LinkedList;
diff --git a/tests/untried/neg/t6526.check b/tests/untried/neg/t6526.check
new file mode 100644
index 000000000..606c18c30
--- /dev/null
+++ b/tests/untried/neg/t6526.check
@@ -0,0 +1,16 @@
+t6526.scala:8: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ ^
+t6526.scala:14: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ ^
+t6526.scala:20: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ ^
+t6526.scala:30: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ ^
+t6526.scala:39: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ def inner(i: Int): Int = 1 + inner(i)
+ ^
+5 errors found
diff --git a/tests/untried/neg/t6526.scala b/tests/untried/neg/t6526.scala
new file mode 100644
index 000000000..0bc249aa9
--- /dev/null
+++ b/tests/untried/neg/t6526.scala
@@ -0,0 +1,41 @@
+import scala.annotation.tailrec
+
+class TailRec {
+ def bar(f: => Any) = ""
+
+ // transform the qualifier of a Select
+ bar {
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ inner(0)
+ }.length
+
+ // transform the body of a function
+ () => {
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ inner(0)
+ }
+
+ // transform the qualifier of a Select
+ {
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ inner(0)
+ ""
+ }.length
+
+ // The receiver of a tail recursive call must itself be transformed
+ object X {
+ @tailrec // okay, all other annotated methods should fail.
+ def foo: Any = {
+ {
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ inner(0)
+ this
+ }.foo
+ }
+ }
+
+ Some(new AnyRef) map { phooie =>
+ @tailrec
+ def inner(i: Int): Int = 1 + inner(i)
+ } getOrElse 42
+}
diff --git a/tests/untried/neg/t6534.check b/tests/untried/neg/t6534.check
new file mode 100644
index 000000000..c2e80b377
--- /dev/null
+++ b/tests/untried/neg/t6534.check
@@ -0,0 +1,10 @@
+t6534.scala:6: error: redefinition of equals method. See SIP-15, criterion 4. is not allowed in value class
+class Bippy3(val x: Int) extends AnyVal { override def equals(x: Any) = false } // error
+ ^
+t6534.scala:7: error: redefinition of hashCode method. See SIP-15, criterion 4. is not allowed in value class
+class Bippy4(val x: Int) extends AnyVal { override def hashCode = -1 } // error
+ ^
+t6534.scala:9: error: redefinition of equals method. See SIP-15, criterion 4. is not allowed in value class
+case class Bippy6(val x: Int) extends AnyVal { override def productPrefix = "Dingo" ; override def equals(x: Any) = false } // error
+ ^
+three errors found
diff --git a/tests/untried/neg/t6534.flags b/tests/untried/neg/t6534.flags
new file mode 100644
index 000000000..1008b0a70
--- /dev/null
+++ b/tests/untried/neg/t6534.flags
@@ -0,0 +1 @@
+-Xlint
diff --git a/tests/untried/neg/t6534.scala b/tests/untried/neg/t6534.scala
new file mode 100644
index 000000000..de588b69a
--- /dev/null
+++ b/tests/untried/neg/t6534.scala
@@ -0,0 +1,10 @@
+trait Foo extends Any { override def equals(x: Any) = false }
+trait Ding extends Any { override def hashCode = -1 }
+
+class Bippy1(val x: Int) extends AnyVal with Foo { } // warn
+class Bippy2(val x: Int) extends AnyVal with Ding { } // warn
+class Bippy3(val x: Int) extends AnyVal { override def equals(x: Any) = false } // error
+class Bippy4(val x: Int) extends AnyVal { override def hashCode = -1 } // error
+case class Bippy5(val x: Int) extends AnyVal { override def productPrefix = "Dingo" } // nothing
+case class Bippy6(val x: Int) extends AnyVal { override def productPrefix = "Dingo" ; override def equals(x: Any) = false } // error
+
diff --git a/tests/untried/neg/t6535.check b/tests/untried/neg/t6535.check
new file mode 100644
index 000000000..1225ea70d
--- /dev/null
+++ b/tests/untried/neg/t6535.check
@@ -0,0 +1,6 @@
+t6535.scala:2: error: encountered unrecoverable cycle resolving import.
+Note: this is often due in part to a class depending on a definition nested within its companion.
+If applicable, you may wish to try moving some members into another object.
+ import Bs.B._
+ ^
+one error found
diff --git a/tests/untried/neg/t6535.scala b/tests/untried/neg/t6535.scala
new file mode 100644
index 000000000..30a750311
--- /dev/null
+++ b/tests/untried/neg/t6535.scala
@@ -0,0 +1,15 @@
+object As {
+ import Bs.B._
+
+ object A
+ extends scala.AnyRef // needed for the cycle;
+ // replacing with a locally defined closs doesn't
+ // hit the locked import and hence doesn't cycle.
+}
+
+object Bs {
+ import As.A._
+
+ object B
+ extends scala.AnyRef // scala.Immutable, ...
+}
diff --git a/tests/untried/neg/t6539.check b/tests/untried/neg/t6539.check
new file mode 100644
index 000000000..8c94a8ad4
--- /dev/null
+++ b/tests/untried/neg/t6539.check
@@ -0,0 +1,16 @@
+Test_2.scala:2: error: cto may only be used as an argument to m
+ M.cto // error
+ ^
+Test_2.scala:3: error: cto may only be used as an argument to m
+ M.m(M.cto, ()) // error
+ ^
+Test_2.scala:5: error: cto may only be used as an argument to m
+ M.cto // error
+ ^
+Test_2.scala:9: error: splice must be enclosed within a reify {} block
+ val splice = expr.splice
+ ^
+Test_2.scala:10: error: cannot use value except for signatures of macro implementations
+ val value = expr.value
+ ^
+5 errors found
diff --git a/tests/untried/neg/t6539/Macro_1.scala b/tests/untried/neg/t6539/Macro_1.scala
new file mode 100644
index 000000000..60db669c4
--- /dev/null
+++ b/tests/untried/neg/t6539/Macro_1.scala
@@ -0,0 +1,10 @@
+import language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object M {
+ def m(a: Any, b: Any): Any = macro mImpl
+ def mImpl(c: Context)(a: c.Expr[Any], b: c.Expr[Any]) = c.universe.reify(println(a.splice))
+
+ @reflect.internal.annotations.compileTimeOnly("cto may only be used as an argument to " + "m")
+ def cto = 0
+}
diff --git a/tests/untried/neg/t6539/Test_2.scala b/tests/untried/neg/t6539/Test_2.scala
new file mode 100644
index 000000000..26f450422
--- /dev/null
+++ b/tests/untried/neg/t6539/Test_2.scala
@@ -0,0 +1,12 @@
+object Test {
+ M.cto // error
+ M.m(M.cto, ()) // error
+ M.m((), M.cto) // okay
+ M.cto // error
+
+ locally {
+ val expr = scala.reflect.runtime.universe.reify(2)
+ val splice = expr.splice
+ val value = expr.value
+ }
+}
diff --git a/tests/untried/neg/t6558.check b/tests/untried/neg/t6558.check
new file mode 100644
index 000000000..6ad3cecd5
--- /dev/null
+++ b/tests/untried/neg/t6558.check
@@ -0,0 +1,10 @@
+t6558.scala:4: error: not found: type classs
+ @classs
+ ^
+t6558.scala:7: error: not found: type typeparam
+ class D[@typeparam T]
+ ^
+t6558.scala:10: error: not found: type valueparam
+ @valueparam x: Any
+ ^
+three errors found
diff --git a/tests/untried/neg/t6558.scala b/tests/untried/neg/t6558.scala
new file mode 100644
index 000000000..b4304ff68
--- /dev/null
+++ b/tests/untried/neg/t6558.scala
@@ -0,0 +1,12 @@
+class AnnotNotFound {
+ def foo(a: Any) = ()
+
+ @classs
+ class C
+
+ class D[@typeparam T]
+
+ class E(
+ @valueparam x: Any
+ )
+}
diff --git a/tests/untried/neg/t6558b.check b/tests/untried/neg/t6558b.check
new file mode 100644
index 000000000..cfa384fc0
--- /dev/null
+++ b/tests/untried/neg/t6558b.check
@@ -0,0 +1,7 @@
+t6558b.scala:5: error: not found: type inargument
+ @inargument
+ ^
+t6558b.scala:11: error: not found: type infunction
+ @infunction
+ ^
+two errors found
diff --git a/tests/untried/neg/t6558b.scala b/tests/untried/neg/t6558b.scala
new file mode 100644
index 000000000..2aa06f69c
--- /dev/null
+++ b/tests/untried/neg/t6558b.scala
@@ -0,0 +1,15 @@
+class AnnotNotFound {
+ def foo(a: Any) = ()
+
+ foo {
+ @inargument
+ def foo = 0
+ foo
+ }
+
+ () => {
+ @infunction
+ def foo = 0
+ ()
+ }
+}
diff --git a/tests/untried/neg/t6563.check b/tests/untried/neg/t6563.check
new file mode 100644
index 000000000..75dca1507
--- /dev/null
+++ b/tests/untried/neg/t6563.check
@@ -0,0 +1,4 @@
+t6563.scala:4: error: not found: value e
+ e("f")
+ ^
+one error found
diff --git a/tests/untried/neg/t6563.scala b/tests/untried/neg/t6563.scala
new file mode 100644
index 000000000..33db51b0f
--- /dev/null
+++ b/tests/untried/neg/t6563.scala
@@ -0,0 +1,8 @@
+class A{
+ def b(c: => Unit): Unit = {}
+ b{
+ e("f")
+ new G()(){}
+ }
+}
+class G(h:String="i")()
diff --git a/tests/untried/neg/t6566a.check b/tests/untried/neg/t6566a.check
new file mode 100644
index 000000000..7668f9d2f
--- /dev/null
+++ b/tests/untried/neg/t6566a.check
@@ -0,0 +1,4 @@
+t6566a.scala:2: error: covariant type T occurs in invariant position in type T of type MyType
+ class TypeCheat[+T] { type MyType = T }
+ ^
+one error found
diff --git a/tests/untried/neg/t6566a.scala b/tests/untried/neg/t6566a.scala
new file mode 100644
index 000000000..74a0b38e5
--- /dev/null
+++ b/tests/untried/neg/t6566a.scala
@@ -0,0 +1,17 @@
+object WhatsYourTypeIsMyType {
+ class TypeCheat[+T] { type MyType = T }
+
+ class Foo {
+ val tc = new TypeCheat[Foo]
+ var x: tc.MyType = _
+ def setX() = x = new Foo
+ }
+ class Bar extends Foo {
+ override val tc = new TypeCheat[Bar]
+ def unsound = this
+
+ setX()
+ println(x.unsound)
+ }
+ def main(args: Array[String]): Unit = new Bar
+}
diff --git a/tests/untried/neg/t6566b.check b/tests/untried/neg/t6566b.check
new file mode 100644
index 000000000..fb3fe81fc
--- /dev/null
+++ b/tests/untried/neg/t6566b.check
@@ -0,0 +1,4 @@
+t6566b.scala:3: error: covariant type T occurs in invariant position in type T of type MyType
+ type MyType = T
+ ^
+one error found
diff --git a/tests/untried/neg/t6566b.scala b/tests/untried/neg/t6566b.scala
new file mode 100644
index 000000000..0d488dbe8
--- /dev/null
+++ b/tests/untried/neg/t6566b.scala
@@ -0,0 +1,19 @@
+object WhatsYourTypeIsMyType {
+ trait WithMyType[+T] {
+ type MyType = T
+ }
+
+ class Foo extends WithMyType[Foo] {
+ var x: MyType = _
+ def setX() = x = new Foo
+ }
+
+ class Bar extends Foo with WithMyType[Bar] {
+ def unsound: Unit = { println("iAmABar") }
+
+ setX()
+ println(x.unsound)
+ }
+
+ def main(args: Array[String]): Unit = new Bar
+}
diff --git a/tests/untried/neg/t6567.check b/tests/untried/neg/t6567.check
new file mode 100644
index 000000000..a733d7535
--- /dev/null
+++ b/tests/untried/neg/t6567.check
@@ -0,0 +1,9 @@
+t6567.scala:8: warning: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply.
+ Option[B](a)
+ ^
+t6567.scala:10: warning: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply.
+ val b: Option[B] = Option(a)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/t6567.flags b/tests/untried/neg/t6567.flags
new file mode 100644
index 000000000..e93641e93
--- /dev/null
+++ b/tests/untried/neg/t6567.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t6567.scala b/tests/untried/neg/t6567.scala
new file mode 100644
index 000000000..650e5e39a
--- /dev/null
+++ b/tests/untried/neg/t6567.scala
@@ -0,0 +1,11 @@
+class A
+class B
+
+object Test {
+ val a: A = null
+ implicit def a2b(a: A) = new B
+
+ Option[B](a)
+
+ val b: Option[B] = Option(a)
+}
diff --git a/tests/untried/neg/t6574.check b/tests/untried/neg/t6574.check
new file mode 100644
index 000000000..c67b4ed80
--- /dev/null
+++ b/tests/untried/neg/t6574.check
@@ -0,0 +1,7 @@
+t6574.scala:4: error: could not optimize @tailrec annotated method notTailPos$extension: it contains a recursive call not in tail position
+ println("tail")
+ ^
+t6574.scala:8: error: could not optimize @tailrec annotated method differentTypeArgs$extension: it is called recursively with different type arguments
+ {(); new Bad[String, Unit](0)}.differentTypeArgs
+ ^
+two errors found
diff --git a/tests/untried/neg/t6574.scala b/tests/untried/neg/t6574.scala
new file mode 100644
index 000000000..9e1d624e5
--- /dev/null
+++ b/tests/untried/neg/t6574.scala
@@ -0,0 +1,10 @@
+class Bad[X, Y](val v: Int) extends AnyVal {
+ @annotation.tailrec final def notTailPos[Z](a: Int)(b: String): Unit = {
+ this.notTailPos[Z](a)(b)
+ println("tail")
+ }
+
+ @annotation.tailrec final def differentTypeArgs {: Unit =
+ {(); new Bad[String, Unit](0)}.differentTypeArgs
+ }
+}
diff --git a/tests/untried/neg/t6597.check b/tests/untried/neg/t6597.check
new file mode 100644
index 000000000..1d52519d1
--- /dev/null
+++ b/tests/untried/neg/t6597.check
@@ -0,0 +1,4 @@
+t6597.scala:3: error: illegal combination of modifiers: implicit and case for: class Quux
+ implicit case class Quux(value: Int) extends AnyVal with T
+ ^
+one error found
diff --git a/tests/untried/neg/t6597.scala b/tests/untried/neg/t6597.scala
new file mode 100644
index 000000000..dde53bcc8
--- /dev/null
+++ b/tests/untried/neg/t6597.scala
@@ -0,0 +1,5 @@
+object Test {
+ trait T extends Any
+ implicit case class Quux(value: Int) extends AnyVal with T
+ object Quux
+}
diff --git a/tests/untried/neg/t6601.check b/tests/untried/neg/t6601.check
new file mode 100644
index 000000000..1410e1b11
--- /dev/null
+++ b/tests/untried/neg/t6601.check
@@ -0,0 +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/tests/untried/neg/t6601/AccessPrivateConstructor_2.scala b/tests/untried/neg/t6601/AccessPrivateConstructor_2.scala
new file mode 100644
index 000000000..816bc10d7
--- /dev/null
+++ b/tests/untried/neg/t6601/AccessPrivateConstructor_2.scala
@@ -0,0 +1,3 @@
+class AccessPrivateConstructor {
+ new PrivateConstructor("") // Scalac should forbid accessing to the private constructor!
+}
diff --git a/tests/untried/neg/t6601/PrivateConstructor_1.scala b/tests/untried/neg/t6601/PrivateConstructor_1.scala
new file mode 100644
index 000000000..f09d7ad06
--- /dev/null
+++ b/tests/untried/neg/t6601/PrivateConstructor_1.scala
@@ -0,0 +1 @@
+class PrivateConstructor private(val s: String) extends AnyVal
diff --git a/tests/untried/neg/t663.check b/tests/untried/neg/t663.check
new file mode 100644
index 000000000..633e27ee1
--- /dev/null
+++ b/tests/untried/neg/t663.check
@@ -0,0 +1,7 @@
+t663.scala:11: error: name clash between defined and inherited member:
+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/tests/untried/neg/t663.scala b/tests/untried/neg/t663.scala
new file mode 100644
index 000000000..797c4a300
--- /dev/null
+++ b/tests/untried/neg/t663.scala
@@ -0,0 +1,18 @@
+package test;
+trait Test {
+ type Matchable <: Node with MatchableImpl;
+ trait MatchableImpl extends NodeImpl {
+ def asMatch(node : Matchable) : Any;
+ }
+ type Node <: NodeImpl;
+ trait NodeImpl;
+ trait CoreIfImpl extends MatchableImpl {
+ // NO_CRASH: def asMatch(m : Matchable) = {
+ def asMatch(m : Node) : Any = {
+ if (m.isInstanceOf[MatchableImpl]) {
+ null;
+ } else null;
+ // NO_CRASH: null;
+ }
+ }
+}
diff --git a/tests/untried/neg/t664.check b/tests/untried/neg/t664.check
new file mode 100644
index 000000000..cbdf53dae
--- /dev/null
+++ b/tests/untried/neg/t664.check
@@ -0,0 +1,7 @@
+t664.scala:4: error: type Foo is not a member of test.Test
+ trait Foo extends super.Foo {
+ ^
+t664.scala:5: error: type Bar is not a member of AnyRef
+ trait Bar extends super.Bar;
+ ^
+two errors found
diff --git a/tests/untried/neg/t664.scala b/tests/untried/neg/t664.scala
new file mode 100644
index 000000000..f3b8d0605
--- /dev/null
+++ b/tests/untried/neg/t664.scala
@@ -0,0 +1,7 @@
+package test;
+abstract class Test;
+trait Test2 extends Test {
+ trait Foo extends super.Foo {
+ trait Bar extends super.Bar;
+ }
+}
diff --git a/tests/untried/neg/t6663.check b/tests/untried/neg/t6663.check
new file mode 100644
index 000000000..aa4faa4a4
--- /dev/null
+++ b/tests/untried/neg/t6663.check
@@ -0,0 +1,6 @@
+t6663.scala:16: error: type mismatch;
+ found : String
+ required: Int
+ var v = new C(42).foo[String].get :Int
+ ^
+one error found
diff --git a/tests/untried/neg/t6663.scala b/tests/untried/neg/t6663.scala
new file mode 100644
index 000000000..4a358dfbc
--- /dev/null
+++ b/tests/untried/neg/t6663.scala
@@ -0,0 +1,19 @@
+import language.dynamics
+
+class C(v: Any) extends Dynamic {
+ def selectDynamic[T](n: String): Option[T] = Option(v.asInstanceOf[T])
+ def applyDynamic[T](n: String)(): Option[T] = Option(v.asInstanceOf[T])
+}
+
+object Test extends App {
+ // this should be converted to
+ // C(42).selectDynamic[String]("foo").get
+ // causing a compile error.
+
+ // but, before fixing SI-6663, became
+ // C(42).selectDynamic("foo").get, ignoring
+ // the [String] type parameter
+ var v = new C(42).foo[String].get :Int
+ println(v)
+}
+
diff --git a/tests/untried/neg/t6666.check b/tests/untried/neg/t6666.check
new file mode 100644
index 000000000..43c825275
--- /dev/null
+++ b/tests/untried/neg/t6666.check
@@ -0,0 +1,37 @@
+t6666.scala:23: error: Implementation restriction: access of method x$2 in object O1 from <$anon: Function0>, would require illegal premature access to object O1
+ F.byname(x)
+ ^
+t6666.scala:30: error: Implementation restriction: access of value x$3 in object O2 from <$anon: Function0>, would require illegal premature access to object O2
+ F.byname(x)
+ ^
+t6666.scala:37: error: Implementation restriction: access of method x$4 in object O3 from <$anon: Function0>, would require illegal premature access to object O3
+ F.hof(() => x)
+ ^
+t6666.scala:50: error: Implementation restriction: access of method x$6 in class C1 from <$anon: Function0>, would require illegal premature access to the unconstructed `this` of class C1
+ F.byname(x)
+ ^
+t6666.scala:54: error: Implementation restriction: access of value x$7 in class C2 from <$anon: Function0>, would require illegal premature access to the unconstructed `this` of class C2
+ F.byname(x)
+ ^
+t6666.scala:58: error: Implementation restriction: access of method x$8 in class C3 from <$anon: Function0>, would require illegal premature access to the unconstructed `this` of class C3
+ F.hof(() => x)
+ ^
+t6666.scala:62: error: Implementation restriction: access of method x$9 in class C4 from object Nested$4, would require illegal premature access to the unconstructed `this` of class C4
+ object Nested { def xx = x}
+ ^
+t6666.scala:76: error: Implementation restriction: access of method x$11 in class C11 from <$anon: Function0>, would require illegal premature access to the unconstructed `this` of class C11
+ F.byname(x)
+ ^
+t6666.scala:95: error: Implementation restriction: access of method x$12 in class C13 from <$anon: Function0>, would require illegal premature access to the unconstructed `this` of class C13
+ F.hof(() => x)
+ ^
+t6666.scala:104: error: Implementation restriction: access of method x$13 in class C14 from object Nested$5, would require illegal premature access to the unconstructed `this` of class C14
+ object Nested { def xx = x}
+ ^
+t6666.scala:112: error: Implementation restriction: access of method foo$1 in class COuter from class CInner$1, would require illegal premature access to the unconstructed `this` of class COuter
+ class CInner extends C({foo})
+ ^
+t6666.scala:118: error: Implementation restriction: access of method x$14 in class CEarly from object Nested$6, would require illegal premature access to the unconstructed `this` of class CEarly
+ object Nested { def xx = x}
+ ^
+12 errors found
diff --git a/tests/untried/neg/t6666.flags b/tests/untried/neg/t6666.flags
new file mode 100644
index 000000000..2349d8294
--- /dev/null
+++ b/tests/untried/neg/t6666.flags
@@ -0,0 +1 @@
+-Ydelambdafy:inline
diff --git a/tests/untried/neg/t6666.scala b/tests/untried/neg/t6666.scala
new file mode 100644
index 000000000..2495c8727
--- /dev/null
+++ b/tests/untried/neg/t6666.scala
@@ -0,0 +1,121 @@
+class C(a: Any)
+object F {
+ def byname(a: => Any) = println(a)
+ def hof(a: () => Any) = println(a())
+}
+
+class COkay extends C(0) {
+ def this(a: Any) {
+ this()
+ def x = "".toString
+ F.byname(x)
+ }
+}
+
+//
+// The thunk's apply method accesses the MODULE$
+// field before it is set.
+//
+// 0: getstatic #23; //Field O1$.MODULE$:LO1$;
+// 3: invokevirtual #26; //Method O1$.O1$$x$1:()Ljava/lang/String;
+object O1 extends C({
+ def x = "".toString
+ F.byname(x)
+})
+
+// java.lang.NullPointerException
+// at O2$$anonfun$$init$$1.apply(<console>:11)
+object O2 extends C({
+ lazy val x = "".toString
+ F.byname(x)
+})
+
+// java.lang.NullPointerException
+// at O3$$anonfun$$init$$1.apply(<console>:11)
+object O3 extends C({
+ def x = "".toString
+ F.hof(() => x)
+})
+
+// Okay, the nested classes don't get an outer pointer passed,
+// just an extra param for `x: String`.
+object O6 extends C({
+ val x = "".toString
+ F.byname(x); F.hof(() => x); (new { val xx = x }.xx)
+})
+
+
+class C1 extends C({
+ def x = "".toString
+ F.byname(x)
+})
+class C2 extends C({
+ lazy val x = "".toString
+ F.byname(x)
+})
+class C3 extends C({
+ def x = "".toString
+ F.hof(() => x)
+})
+class C4 extends C({
+ def x = "".toString
+ object Nested { def xx = x}
+ Nested.xx
+})
+
+// okay, for same reason as O6
+class C6 extends C({
+ val x = "".toString
+ F.byname(x); F.hof(() => x); (new { val xx = x }.xx)
+})
+
+class C11(a: Any) {
+ def this() = {
+ this({
+ def x = "".toString
+ F.byname(x)
+ })
+ }
+}
+
+// Crashes earlier in lazyVals.
+// class C12(a: Any) {
+// def this() = {
+// this({
+// lazy val x = "".toString
+// F.byname(x)
+// })
+// }
+// }
+
+class C13(a: Any) {
+ def this() = {
+ this({
+ def x = "".toString
+ F.hof(() => x)
+ })
+ }
+}
+
+class C14(a: Any) {
+ def this() = {
+ this({
+ def x = "".toString
+ object Nested { def xx = x}
+ Nested.xx
+ })
+ }
+}
+
+class COuter extends C({
+ def foo = 0
+ class CInner extends C({foo})
+})
+
+
+class CEarly(a: Any) extends {
+ val early = {def x = "".toString
+ object Nested { def xx = x}
+ Nested.xx
+ }
+} with AnyRef
diff --git a/tests/untried/neg/t6666b.check b/tests/untried/neg/t6666b.check
new file mode 100644
index 000000000..c3ffc7cfa
--- /dev/null
+++ b/tests/untried/neg/t6666b.check
@@ -0,0 +1,7 @@
+t6666b.scala:11: error: Implementation restriction: access of method x$1 in class C5 from object Nested$3, would require illegal premature access to the unconstructed `this` of class C5
+ object Nested { def xx = x}
+ ^
+t6666b.scala:22: error: Implementation restriction: access of method x$2 in class C15 from object Nested$4, would require illegal premature access to the unconstructed `this` of class C15
+ object Nested { def xx = x}
+ ^
+two errors found
diff --git a/tests/untried/neg/t6666b.scala b/tests/untried/neg/t6666b.scala
new file mode 100644
index 000000000..205ded76e
--- /dev/null
+++ b/tests/untried/neg/t6666b.scala
@@ -0,0 +1,27 @@
+class C(a: Any)
+object F {
+ def byname(a: => Any) = println(a)
+ def hof(a: () => Any) = println(a())
+}
+
+
+class C5 extends C({
+ def x = "".toString
+ val y = {
+ object Nested { def xx = x}
+ Nested.xx
+ }
+})
+
+
+class C15(a: Any) {
+ def this() = {
+ this({
+ def x = "".toString
+ val y = {
+ object Nested { def xx = x}
+ Nested.xx
+ }
+ })
+ }
+}
diff --git a/tests/untried/neg/t6666c.check b/tests/untried/neg/t6666c.check
new file mode 100644
index 000000000..384e52a9f
--- /dev/null
+++ b/tests/untried/neg/t6666c.check
@@ -0,0 +1,10 @@
+t6666c.scala:2: error: Implementation restriction: access of method x$1 in class D from object X$4, would require illegal premature access to the unconstructed `this` of class D
+class D extends C({def x = 0; object X { x }})
+ ^
+t6666c.scala:5: error: Implementation restriction: access of method x$2 in class D1 from object X$5, would require illegal premature access to the unconstructed `this` of class D1
+class D1 extends C1({def x = 0; () => {object X { x }}})
+ ^
+t6666c.scala:8: error: Implementation restriction: access of method x$3 from object X$6, would require illegal premature access to the unconstructed `this` of <$anon: Function0>
+class D2 extends C2({def x = 0; object X { x }})
+ ^
+three errors found
diff --git a/tests/untried/neg/t6666c.flags b/tests/untried/neg/t6666c.flags
new file mode 100644
index 000000000..2349d8294
--- /dev/null
+++ b/tests/untried/neg/t6666c.flags
@@ -0,0 +1 @@
+-Ydelambdafy:inline
diff --git a/tests/untried/neg/t6666c.scala b/tests/untried/neg/t6666c.scala
new file mode 100644
index 000000000..76cc35830
--- /dev/null
+++ b/tests/untried/neg/t6666c.scala
@@ -0,0 +1,8 @@
+class C(a: Any)
+class D extends C({def x = 0; object X { x }})
+
+class C1(a: () => Any)
+class D1 extends C1({def x = 0; () => {object X { x }}})
+
+class C2(a: => Any)
+class D2 extends C2({def x = 0; object X { x }})
diff --git a/tests/untried/neg/t6666d.check b/tests/untried/neg/t6666d.check
new file mode 100644
index 000000000..b4785f012
--- /dev/null
+++ b/tests/untried/neg/t6666d.check
@@ -0,0 +1,4 @@
+t6666d.scala:7: error: Implementation restriction: access of object TreeOrd$1 from object TreeOrd$2, would require illegal premature access to the unconstructed `this` of class Test
+ implicit object TreeOrd extends Ordering[K](){
+ ^
+one error found
diff --git a/tests/untried/neg/t6666d.scala b/tests/untried/neg/t6666d.scala
new file mode 100644
index 000000000..49a688f91
--- /dev/null
+++ b/tests/untried/neg/t6666d.scala
@@ -0,0 +1,18 @@
+
+import scala.collection.immutable.TreeMap
+import scala.math.Ordering
+
+class Test[K](param:TreeMap[K,Int]){
+ def this() = this({
+ implicit object TreeOrd extends Ordering[K](){
+ def compare(a: K, b: K) = {
+ -1
+ }
+ }
+ new TreeMap[K, Int]()
+ })
+}
+
+object Test extends App {
+ new Test()
+}
diff --git a/tests/untried/neg/t6666e.check b/tests/untried/neg/t6666e.check
new file mode 100644
index 000000000..318961231
--- /dev/null
+++ b/tests/untried/neg/t6666e.check
@@ -0,0 +1,4 @@
+t6666e.scala:8: error: Implementation restriction: <$anon: Nothing => Unit> requires premature access to class Crash.
+ this(Nil.collect{case x =>})
+ ^
+one error found
diff --git a/tests/untried/neg/t6666e.scala b/tests/untried/neg/t6666e.scala
new file mode 100644
index 000000000..120a5878b
--- /dev/null
+++ b/tests/untried/neg/t6666e.scala
@@ -0,0 +1,9 @@
+
+import scala.collection.immutable.TreeMap
+import scala.math.Ordering
+
+
+class Crash(a: Any) {
+ def this() =
+ this(Nil.collect{case x =>})
+}
diff --git a/tests/untried/neg/t6667.check b/tests/untried/neg/t6667.check
new file mode 100644
index 000000000..43313fa4f
--- /dev/null
+++ b/tests/untried/neg/t6667.check
@@ -0,0 +1,13 @@
+t6667.scala:8: error: ambiguous implicit values:
+ both value inScope1 in object Test of type => C
+ and value inScope2 in object Test of type => C
+ match expected type C
+ implicitly[C]: Unit // C.companion was used; whereas the ambiguity should abort the implicit search.
+ ^
+t6667.scala:9: error: ambiguous implicit values:
+ both value inScope1 in object Test of type => C
+ and value inScope2 in object Test of type => C
+ match expected type C
+ implicitly[C] // ambiguity reported, rather than falling back to C.companion
+ ^
+two errors found
diff --git a/tests/untried/neg/t6667.scala b/tests/untried/neg/t6667.scala
new file mode 100644
index 000000000..fb857ebd3
--- /dev/null
+++ b/tests/untried/neg/t6667.scala
@@ -0,0 +1,10 @@
+class C
+object C {
+ implicit def companion = new C
+}
+
+object Test {
+ implicit val inScope1, inScope2 = new C
+ implicitly[C]: Unit // C.companion was used; whereas the ambiguity should abort the implicit search.
+ implicitly[C] // ambiguity reported, rather than falling back to C.companion
+}
diff --git a/tests/untried/neg/t6667b.check b/tests/untried/neg/t6667b.check
new file mode 100644
index 000000000..99cea9a47
--- /dev/null
+++ b/tests/untried/neg/t6667b.check
@@ -0,0 +1,13 @@
+t6667b.scala:16: 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()
+ ^
+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/tests/untried/neg/t6667b.scala b/tests/untried/neg/t6667b.scala
new file mode 100644
index 000000000..db31c0a9b
--- /dev/null
+++ b/tests/untried/neg/t6667b.scala
@@ -0,0 +1,25 @@
+object Test {
+ abstract class Box {
+ val value: Int
+ }
+
+ implicit val a: Box = new Box {
+ val value= 1
+ }
+
+ def main(args: Array[String]): Unit = {
+ implicit val b: Box= new Box {
+ val value= 2
+ }
+
+ new Object {
+ new Test()
+ }
+ // compare with:
+ new Test()
+ }
+}
+
+class Test()(implicit x: Test.Box) {
+ println(x.value)
+}
diff --git a/tests/untried/neg/t667.check b/tests/untried/neg/t667.check
new file mode 100644
index 000000000..e68c6dea0
--- /dev/null
+++ b/tests/untried/neg/t667.check
@@ -0,0 +1,4 @@
+t667.scala:8: error: illegal cyclic reference involving class Ni
+ class Ni extends super.Ni with Ni;
+ ^
+one error found
diff --git a/tests/untried/neg/t667.scala b/tests/untried/neg/t667.scala
new file mode 100644
index 000000000..a79bc272e
--- /dev/null
+++ b/tests/untried/neg/t667.scala
@@ -0,0 +1,10 @@
+package test;
+
+object test {
+ trait A {
+ trait Ni;
+ }
+ class B extends A {
+ class Ni extends super.Ni with Ni;
+ }
+}
diff --git a/tests/untried/neg/t6675.check b/tests/untried/neg/t6675.check
new file mode 100644
index 000000000..aecf04cb6
--- /dev/null
+++ b/tests/untried/neg/t6675.check
@@ -0,0 +1,6 @@
+t6675.scala:10: warning: object X expects 3 patterns to hold (Int, Int, Int) but crushing into 3-tuple to fit single pattern (SI-6675)
+ "" match { case X(b) => b } // should warn under -Xlint. Not an error because of SI-6111
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t6675.flags b/tests/untried/neg/t6675.flags
new file mode 100644
index 000000000..2843ea9ef
--- /dev/null
+++ b/tests/untried/neg/t6675.flags
@@ -0,0 +1 @@
+-deprecation -Xlint -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t6675.scala b/tests/untried/neg/t6675.scala
new file mode 100644
index 000000000..4d500b77b
--- /dev/null
+++ b/tests/untried/neg/t6675.scala
@@ -0,0 +1,13 @@
+object X {
+ def unapply(s: String): Option[(Int,Int,Int)] = Some((1,2,3))
+}
+
+object Y {
+ def unapplySeq(s: String): Option[Seq[(Int,Int,Int)]] = Some(Seq((1,2,3)))
+}
+
+object Test {
+ "" match { case X(b) => b } // should warn under -Xlint. Not an error because of SI-6111
+
+ "" match { case Y(b) => b } // no warning
+}
diff --git a/tests/untried/neg/t6675b.check b/tests/untried/neg/t6675b.check
new file mode 100644
index 000000000..77f6b3ccb
--- /dev/null
+++ b/tests/untried/neg/t6675b.check
@@ -0,0 +1,37 @@
+t6675b.scala:17: warning: object LeftOrRight expects 2 patterns to hold (Int, Int) but crushing into 2-tuple to fit single pattern (SI-6675)
+ def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight(a) => a } // warn
+ ^
+t6675b.scala:19: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2, T3)
+ required: (Int, Int)
+ def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b, c)) => a } // fail
+ ^
+t6675b.scala:24: warning: object LeftOrRight expects 2 patterns to hold (A, A) but crushing into 2-tuple to fit single pattern (SI-6675)
+ def f2[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight(a) => a } // warn
+ ^
+t6675b.scala:26: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2, T3)
+ required: (?A11, ?A12) where type ?A12 <: A (this is a GADT skolem), type ?A11 <: A (this is a GADT skolem)
+ def f4[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight((a, b, c)) => a } // fail
+ ^
+t6675b.scala:30: warning: object NativelyTwo expects 2 patterns to hold ((Int, Int), (Int, Int)) but crushing into 2-tuple to fit single pattern (SI-6675)
+ def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo(a) => a } // warn
+ ^
+t6675b.scala:32: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2, T3)
+ required: ((Int, Int), (Int, Int))
+ def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo((a, b, c)) => a } // fail
+ ^
+t6675b.scala:36: warning: object NativelyTwo expects 2 patterns to hold (A, A) but crushing into 2-tuple to fit single pattern (SI-6675)
+ def f1[A](x: A) = (Left(x): Either[A, A]) match { case NativelyTwo(a) => a } // warn
+ ^
+t6675b.scala:37: warning: object NativelyTwo expects 2 patterns to hold ((A, A), (A, A)) but crushing into 2-tuple to fit single pattern (SI-6675)
+ def f2[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo(a) => a } // warn
+ ^
+t6675b.scala:39: error: constructor cannot be instantiated to expected type;
+ found : (T1, T2, T3)
+ required: ((?A17, ?A18), (?A19, ?A20)) where type ?A20 <: A (this is a GADT skolem), type ?A19 <: A (this is a GADT skolem), type ?A18 <: A (this is a GADT skolem), type ?A17 <: A (this is a GADT skolem)
+ def f4[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo((a, b, c)) => a } // fail
+ ^
+5 warnings found
+four errors found
diff --git a/tests/untried/neg/t6675b.flags b/tests/untried/neg/t6675b.flags
new file mode 100644
index 000000000..2fcfa0cdd
--- /dev/null
+++ b/tests/untried/neg/t6675b.flags
@@ -0,0 +1 @@
+-deprecation -Xlint
diff --git a/tests/untried/neg/t6675b.scala b/tests/untried/neg/t6675b.scala
new file mode 100644
index 000000000..c86c9c395
--- /dev/null
+++ b/tests/untried/neg/t6675b.scala
@@ -0,0 +1,40 @@
+object LeftOrRight {
+ def unapply[A](value: Either[A, A]): Option[A] = value match {
+ case scala.Left(x) => Some(x)
+ case scala.Right(x) => Some(x)
+ }
+}
+
+object NativelyTwo {
+ def unapply[A](value: Either[A, A]): Option[(A, A)] = value match {
+ case scala.Left(x) => Some(x -> x)
+ case scala.Right(x) => Some(x -> x)
+ }
+}
+
+
+class A {
+ def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight(a) => a } // warn
+ def f2 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b)) => a } // no warn
+ def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b, c)) => a } // fail
+}
+
+class B {
+ def f1[A](x: A) = (Left(x): Either[A, A]) match { case LeftOrRight(a) => a } // no warn
+ def f2[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight(a) => a } // warn
+ def f3[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight((a, b)) => a } // no warn
+ def f4[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight((a, b, c)) => a } // fail
+}
+
+class C {
+ def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo(a) => a } // warn
+ def f2 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo((a, b)) => a } // no warn
+ def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo((a, b, c)) => a } // fail
+}
+
+class D {
+ def f1[A](x: A) = (Left(x): Either[A, A]) match { case NativelyTwo(a) => a } // warn
+ def f2[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo(a) => a } // warn
+ def f3[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo((a, b)) => a } // no warn
+ def f4[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo((a, b, c)) => a } // fail
+}
diff --git a/tests/untried/neg/t668.check b/tests/untried/neg/t668.check
new file mode 100644
index 000000000..b057ca793
--- /dev/null
+++ b/tests/untried/neg/t668.check
@@ -0,0 +1,4 @@
+t668.scala:1: error: type Iterable takes type parameters
+class Test extends Iterable
+ ^
+one error found
diff --git a/tests/untried/neg/t668.scala b/tests/untried/neg/t668.scala
new file mode 100644
index 000000000..3256037b1
--- /dev/null
+++ b/tests/untried/neg/t668.scala
@@ -0,0 +1 @@
+class Test extends Iterable
diff --git a/tests/untried/neg/t6680a.check b/tests/untried/neg/t6680a.check
new file mode 100644
index 000000000..03e4df10c
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t6680a.flags b/tests/untried/neg/t6680a.flags
new file mode 100644
index 000000000..19243266d
--- /dev/null
+++ b/tests/untried/neg/t6680a.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/tests/untried/neg/t6680a.scala b/tests/untried/neg/t6680a.scala
new file mode 100644
index 000000000..93b796438
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t6728.check b/tests/untried/neg/t6728.check
new file mode 100644
index 000000000..d853d6f72
--- /dev/null
+++ b/tests/untried/neg/t6728.check
@@ -0,0 +1,4 @@
+t6728.scala:4: error: '(' expected but '}' found.
+ }
+ ^
+one error found
diff --git a/tests/untried/neg/t6728.scala b/tests/untried/neg/t6728.scala
new file mode 100644
index 000000000..ba0b1a0fd
--- /dev/null
+++ b/tests/untried/neg/t6728.scala
@@ -0,0 +1,5 @@
+object X {
+ while(true) {
+ for
+ }
+}
diff --git a/tests/untried/neg/t6758.check b/tests/untried/neg/t6758.check
new file mode 100644
index 000000000..2cdd6b8ae
--- /dev/null
+++ b/tests/untried/neg/t6758.check
@@ -0,0 +1,28 @@
+t6758.scala:5: error: not found: type inargument
+ @inargument
+ ^
+t6758.scala:11: error: not found: type infunction
+ @infunction
+ ^
+t6758.scala:18: error: not found: type nested
+ @nested
+ ^
+t6758.scala:25: error: not found: type param
+ def func(@param x: Int): Int = 0
+ ^
+t6758.scala:28: error: not found: type typealias
+ @typealias
+ ^
+t6758.scala:32: error: not found: type classs
+ @classs
+ ^
+t6758.scala:35: error: not found: type module
+ @module
+ ^
+t6758.scala:38: error: not found: type typeparam
+ class D[@typeparam T]
+ ^
+t6758.scala:41: error: not found: type valueparam
+ @valueparam x: Any
+ ^
+9 errors found
diff --git a/tests/untried/neg/t6758.scala b/tests/untried/neg/t6758.scala
new file mode 100644
index 000000000..acf333bf9
--- /dev/null
+++ b/tests/untried/neg/t6758.scala
@@ -0,0 +1,43 @@
+class AnnotNotFound {
+ def foo(a: Any) = ()
+
+ foo {
+ @inargument
+ def foo = 0
+ foo
+ }
+
+ () => {
+ @infunction
+ def foo = 0
+ ()
+ }
+
+ () => {
+ val bar: Int = {
+ @nested
+ val bar2: Int = 2
+ 2
+ }
+ ()
+ }
+
+ def func(@param x: Int): Int = 0
+
+ abstract class A {
+ @typealias
+ type B = Int
+ }
+
+ @classs
+ class C
+
+ @module
+ object D
+
+ class D[@typeparam T]
+
+ class E(
+ @valueparam x: Any
+ )
+}
diff --git a/tests/untried/neg/t677.check b/tests/untried/neg/t677.check
new file mode 100644
index 000000000..122830a98
--- /dev/null
+++ b/tests/untried/neg/t677.check
@@ -0,0 +1,6 @@
+t677.scala:2: error: type mismatch;
+ found : () => Int
+ required: Nothing
+ val zx: Nothing = {() => 4}
+ ^
+one error found
diff --git a/tests/untried/neg/t677.scala b/tests/untried/neg/t677.scala
new file mode 100644
index 000000000..c65ee9640
--- /dev/null
+++ b/tests/untried/neg/t677.scala
@@ -0,0 +1,3 @@
+object ga {
+ val zx: Nothing = {() => 4}
+}
diff --git a/tests/untried/neg/t6771b.check b/tests/untried/neg/t6771b.check
new file mode 100644
index 000000000..ba99e9178
--- /dev/null
+++ b/tests/untried/neg/t6771b.check
@@ -0,0 +1,6 @@
+t6771b.scala:14: error: type mismatch;
+ found : x.type (with underlying type String)
+ required: Test.a.type
+ b = b match { case x => x }
+ ^
+one error found
diff --git a/tests/untried/neg/t6771b.scala b/tests/untried/neg/t6771b.scala
new file mode 100644
index 000000000..78f11f775
--- /dev/null
+++ b/tests/untried/neg/t6771b.scala
@@ -0,0 +1,16 @@
+// Currently, the pattern matcher widens the type of the
+// scrutinee, so this doesn't typecheck. This test just
+// confirms this behaviour, although it would be an improvement
+// to change this and make this a `pos` test.
+//
+// But, to the intrepid hacker who works on this, a few notes:
+// You'll have to look into places in the pattern matcher that
+// call `dealias`, and see if they need to be `dealiasWiden`.
+// For example, if `checkableType` used only `dealias`, `pos/t6671.scala`
+// would fail.
+object Test {
+ val a = ""; var b: a.type = a
+
+ b = b match { case x => x }
+}
+
diff --git a/tests/untried/neg/t6788.check b/tests/untried/neg/t6788.check
new file mode 100644
index 000000000..96a6f8b60
--- /dev/null
+++ b/tests/untried/neg/t6788.check
@@ -0,0 +1,5 @@
+t6788.scala:6: error: not found: value foo
+Error occurred in an application involving default arguments.
+ s.copy(b = foo)
+ ^
+one error found
diff --git a/tests/untried/neg/t6788.scala b/tests/untried/neg/t6788.scala
new file mode 100644
index 000000000..77949ed62
--- /dev/null
+++ b/tests/untried/neg/t6788.scala
@@ -0,0 +1,7 @@
+case class B[T](b: T, a: List[Int]) // need two args, B must be polymorphic
+
+class A {
+ var s: B[Int] = _ // has to be a var
+
+ s.copy(b = foo)
+}
diff --git a/tests/untried/neg/t6795.check b/tests/untried/neg/t6795.check
new file mode 100644
index 000000000..88ef3e9a5
--- /dev/null
+++ b/tests/untried/neg/t6795.check
@@ -0,0 +1,4 @@
+t6795.scala:3: error: `abstract override' modifier not allowed for type members
+trait T1 extends T { abstract override type U = Int }
+ ^
+one error found
diff --git a/tests/untried/neg/t6795.scala b/tests/untried/neg/t6795.scala
new file mode 100644
index 000000000..a523c89c8
--- /dev/null
+++ b/tests/untried/neg/t6795.scala
@@ -0,0 +1,3 @@
+trait T { type U }
+// "abstract override" shouldn't be allowed on types
+trait T1 extends T { abstract override type U = Int }
diff --git a/tests/untried/neg/t6815.check b/tests/untried/neg/t6815.check
new file mode 100644
index 000000000..fae3819be
--- /dev/null
+++ b/tests/untried/neg/t6815.check
@@ -0,0 +1,5 @@
+t6815.scala:15: error: stable identifier required, but Test.this.u.emptyValDef found.
+ Note that value emptyValDef is not stable because its type, Test.u.ValDef, is volatile.
+ case _: u.emptyValDef.T => // and, unlike in pos/t6185.scala, we shouldn't allow this.
+ ^
+one error found
diff --git a/tests/untried/neg/t6815.scala b/tests/untried/neg/t6815.scala
new file mode 100644
index 000000000..ff973a743
--- /dev/null
+++ b/tests/untried/neg/t6815.scala
@@ -0,0 +1,17 @@
+trait U {
+ trait ValOrDefDefApi {
+ def name: Any
+ }
+ type ValOrDefDef <: ValOrDefDefApi
+ type ValDef <: ValOrDefDef with ValDefApi { type T }
+ trait ValDefApi extends ValOrDefDefApi { this: ValDef => }
+ val emptyValDef: ValDef // the result type is volatile
+}
+
+object Test {
+ val u: U = ???
+
+ (null: Any) match {
+ case _: u.emptyValDef.T => // and, unlike in pos/t6185.scala, we shouldn't allow this.
+ }
+}
diff --git a/tests/untried/neg/t6829.check b/tests/untried/neg/t6829.check
new file mode 100644
index 000000000..914a1c926
--- /dev/null
+++ b/tests/untried/neg/t6829.check
@@ -0,0 +1,56 @@
+t6829.scala:35: error: type mismatch;
+ found : AgentSimulation.this.state.type (with underlying type G#State)
+ required: _9.State
+ lazy val actions: Map[G#Agent,G#Action] = agents.map(a => a -> a.chooseAction(state)).toMap
+ ^
+t6829.scala:45: error: trait AgentSimulation takes type parameters
+ pastHistory: List[G#State] = Nil) extends AgentSimulation
+ ^
+t6829.scala:47: error: class LearningSimulation takes type parameters
+ lazy val step: LearningSimulation = {
+ ^
+t6829.scala:49: error: not found: value actions
+ val (s,a,s2) = (state,actions(agent),nextState)
+ ^
+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)
+ 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 Any)
+ 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 Any)
+ 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)
+ required: _50.State
+ agent.learn(s,a,s2,r): G#Agent
+ ^
+t6829.scala:51: error: type mismatch;
+ found : a.type (with underlying type Any)
+ required: _50.Action
+ agent.learn(s,a,s2,r): G#Agent
+ ^
+t6829.scala:51: error: type mismatch;
+ found : s2.type (with underlying type Any)
+ 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)
+ ^
+t6829.scala:53: error: not found: value currentHistory
+Error occurred in an application involving default arguments.
+ copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory)
+ ^
+13 errors found
diff --git a/tests/untried/neg/t6829.scala b/tests/untried/neg/t6829.scala
new file mode 100644
index 000000000..7cbe3c954
--- /dev/null
+++ b/tests/untried/neg/t6829.scala
@@ -0,0 +1,64 @@
+package bugs
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: arya
+ * Date: 12/18/12
+ * Time: 4:17 PM
+ * To change this template use File | Settings | File Templates.
+ */
+object currenttype2 {
+
+ type Reward = Double
+
+ trait AbstractAgent[State,Action] {
+ type A = AbstractAgent[State,Action]
+ def chooseAction(s: State): Action
+ def startEpisode: A = this
+ def learn(s1: State, a: Action, s2: State, r: Reward): A
+ }
+
+ case class RewardFunction[State,Action](r: (State,Action,State) => Reward)
+
+ trait Rules[G<:GameDomain] {
+ def simulate(state: G#State, agentActions: List[(G#Agent,G#Action)]): G#State
+ }
+
+ trait AgentSimulation[G<:GameDomain] {
+ val agents: List[G#Agent]
+ val state: G#State
+ val rewards: Map[G#Agent,G#Rewards]
+ val rules: Rules[G]
+ val pastHistory: List[G#State]
+ lazy val currentHistory = state :: pastHistory
+
+ lazy val actions: Map[G#Agent,G#Action] = agents.map(a => a -> a.chooseAction(state)).toMap
+ lazy val nextState: G#State = rules.simulate(state, actions.toList)
+
+ def step: AgentSimulation[G]
+ }
+
+ case class LearningSimulation[G<:GameDomain](agents: List[G#Agent],
+ state: G#State,
+ rewards: Map[G#Agent,G#Rewards],
+ rules: Rules[G],
+ pastHistory: List[G#State] = Nil) extends AgentSimulation
+ {
+ lazy val step: LearningSimulation = {
+ val updatedAgents: List[G#Agent] = agents map { agent =>
+ val (s,a,s2) = (state,actions(agent),nextState)
+ val r = rewards(agent).r(s,a,s2)
+ agent.learn(s,a,s2,r): G#Agent
+ }
+ copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory)
+ }
+ }
+
+ trait GameDomain {
+ domain =>
+ type State
+ type Action
+ type Agent = AbstractAgent[State, Action] // agent supertype
+ type Rewards = RewardFunction[State,Action]
+ }
+ }
diff --git a/tests/untried/neg/t6844.check b/tests/untried/neg/t6844.check
new file mode 100644
index 000000000..1fc248552
--- /dev/null
+++ b/tests/untried/neg/t6844.check
@@ -0,0 +1,6 @@
+t6844.scala:4: error: type mismatch;
+ found : reflect.runtime.universe.TermName
+ required: reflect.runtime.universe.Tree
+ q"def foo($x)"
+ ^
+one error found
diff --git a/tests/untried/neg/t6844.scala b/tests/untried/neg/t6844.scala
new file mode 100644
index 000000000..809d9d0f9
--- /dev/null
+++ b/tests/untried/neg/t6844.scala
@@ -0,0 +1,5 @@
+import scala.reflect.runtime.universe._
+object Test extends App {
+ val x = TermName("x")
+ q"def foo($x)"
+}
diff --git a/tests/untried/neg/t6889.check b/tests/untried/neg/t6889.check
new file mode 100644
index 000000000..a77e8a010
--- /dev/null
+++ b/tests/untried/neg/t6889.check
@@ -0,0 +1,7 @@
+t6889.scala:16: error: the result type of an implicit conversion must be more specific than AnyRef
+ def f(x: Dingo): AnyRef = x // fail - no conversion to AnyRef
+ ^
+t6889.scala:17: error: an expression of type Null is ineligible for implicit conversion
+ var x: Int = null // fail - no conversion from Null
+ ^
+two errors found
diff --git a/tests/untried/neg/t6889.scala b/tests/untried/neg/t6889.scala
new file mode 100644
index 000000000..ef1963669
--- /dev/null
+++ b/tests/untried/neg/t6889.scala
@@ -0,0 +1,18 @@
+package bippy {
+ trait Bippy[A] extends Any
+}
+package foo {
+ package object unrelated {
+ implicit def bippyDingo[A](x: bippy.Bippy[A]): AnyRef = Nil
+ }
+ package unrelated {
+ trait Unrelated
+ }
+}
+
+object Test {
+ trait Dingo extends Any with bippy.Bippy[foo.unrelated.Unrelated]
+
+ def f(x: Dingo): AnyRef = x // fail - no conversion to AnyRef
+ var x: Int = null // fail - no conversion from Null
+}
diff --git a/tests/untried/neg/t6902.check b/tests/untried/neg/t6902.check
new file mode 100644
index 000000000..ed0ed7530
--- /dev/null
+++ b/tests/untried/neg/t6902.check
@@ -0,0 +1,12 @@
+t6902.scala:4: warning: unreachable code
+ case Some(b) => 3 // no warning was emitted
+ ^
+t6902.scala:9: warning: unreachable code
+ case Some(b) => 3 // no warning was emitted
+ ^
+t6902.scala:21: warning: unreachable code
+ case 1 => 3 // crash
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t6902.flags b/tests/untried/neg/t6902.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t6902.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t6902.scala b/tests/untried/neg/t6902.scala
new file mode 100644
index 000000000..ce5ff8b6f
--- /dev/null
+++ b/tests/untried/neg/t6902.scala
@@ -0,0 +1,23 @@
+object Test {
+ Some(Some(1)) collect {
+ case Some(a) => 2
+ case Some(b) => 3 // no warning was emitted
+ }
+
+ (Some(1): @ unchecked) match {
+ case Some(a) => 2
+ case Some(b) => 3 // no warning was emitted
+ }
+
+ // A variation of SI-6011, which eluded the fix
+ // in 2.10.0.
+ //
+ // duplicate keys in SWITCH, can't pick arbitrarily one of them to evict, see SI-6011.
+ // at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:50)
+ // at scala.tools.nsc.Global.abort(Global.scala:249)
+ // at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$jcode$.emitSWITCH(GenASM.scala:1850)
+ ((1: Byte): @unchecked @annotation.switch) match {
+ case 1 => 2
+ case 1 => 3 // crash
+ }
+}
diff --git a/tests/untried/neg/t691.check b/tests/untried/neg/t691.check
new file mode 100644
index 000000000..77ff7b1d0
--- /dev/null
+++ b/tests/untried/neg/t691.check
@@ -0,0 +1,4 @@
+t691.scala:27: error: ambiguous parent class qualifier
+ trait TiC extends super[Arrow].Ti2 with super[AssignArrow].Ti1;
+ ^
+one error found
diff --git a/tests/untried/neg/t691.scala b/tests/untried/neg/t691.scala
new file mode 100644
index 000000000..233476f65
--- /dev/null
+++ b/tests/untried/neg/t691.scala
@@ -0,0 +1,29 @@
+trait Base {
+ trait AssignArrow {
+ type T <: Ti0;
+ trait Ti0;
+ }
+ abstract class Arrow extends AssignArrow;
+ val arrow : Arrow;
+}
+
+trait Ext0 extends Base {
+ trait AssignArrow extends super.AssignArrow {
+ type T <: Ti1;
+ trait Ti1 extends super.Ti0;
+ }
+}
+trait Ext1 extends Base {
+ trait Arrow extends super.Arrow {
+ type T <: Ti2;
+ trait Ti2 extends super.Ti0;
+ trait TiXX extends Ti2;
+ }
+ val arrow : Arrow;
+}
+trait Composition extends Ext0 with Ext1 {
+ object arrow0 extends Arrow with AssignArrow {
+ type T = TiC
+ trait TiC extends super[Arrow].Ti2 with super[AssignArrow].Ti1;
+ }
+}
diff --git a/tests/untried/neg/t6912.check b/tests/untried/neg/t6912.check
new file mode 100644
index 000000000..137b65170
--- /dev/null
+++ b/tests/untried/neg/t6912.check
@@ -0,0 +1,4 @@
+t6912.scala:8: error: not found: type Xxxx
+ def test[T]: Xxxx = Foo1[T]
+ ^
+one error found
diff --git a/tests/untried/neg/t6912.scala b/tests/untried/neg/t6912.scala
new file mode 100644
index 000000000..f2540ee8c
--- /dev/null
+++ b/tests/untried/neg/t6912.scala
@@ -0,0 +1,9 @@
+object Foo1 {
+ def apply[T](a: Int = 0): Nothing = sys.error("")
+ def apply[T](z: String = ""): Nothing = sys.error("")
+}
+
+object Test {
+ // Triggered a cycle in Typers#adapt
+ def test[T]: Xxxx = Foo1[T]
+}
diff --git a/tests/untried/neg/t692.check b/tests/untried/neg/t692.check
new file mode 100644
index 000000000..0ca99717d
--- /dev/null
+++ b/tests/untried/neg/t692.check
@@ -0,0 +1,19 @@
+t692.scala:3: error: not found: type T
+ trait Type[T0] extends Type0[T];
+ ^
+t692.scala:10: error: class Foo takes type parameters
+ case class FooType() extends ClassType[Foo,AnyRef](ObjectType());
+ ^
+t692.scala:13: error: class Foo takes type parameters
+ case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType);
+ ^
+t692.scala:13: error: class Foo takes type parameters
+ case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType);
+ ^
+t692.scala:14: error: class Foo takes type parameters
+ implicit def typeOfBar[T4 <: Foo](implicit elem : RefType[T4]) : RefType[Bar[T4]] =
+ ^
+t692.scala:19: error: class Foo takes type parameters
+ class Bar[A <: Foo](implicit tpeA : Type[A]) extends Foo;
+ ^
+6 errors found
diff --git a/tests/untried/neg/t692.scala b/tests/untried/neg/t692.scala
new file mode 100644
index 000000000..24e1d2fea
--- /dev/null
+++ b/tests/untried/neg/t692.scala
@@ -0,0 +1,20 @@
+abstract class test3 {
+ trait Type0[+T0];
+ trait Type[T0] extends Type0[T];
+ trait ClassType0[+C <: AnyRef] extends Type0[C];
+ abstract class RefType[C <: AnyRef] extends Type[C];
+ case class ObjectType() extends RefType[AnyRef];
+ abstract class ClassType[C <: Z, Z <: AnyRef](zuper : RefType[Z]) extends RefType[C];
+
+
+ case class FooType() extends ClassType[Foo,AnyRef](ObjectType());
+ implicit def typeOfFoo = FooType();
+
+ case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType);
+ implicit def typeOfBar[T4 <: Foo](implicit elem : RefType[T4]) : RefType[Bar[T4]] =
+ BarType(elem);
+
+
+ class Foo[A <: AnyRef];
+ class Bar[A <: Foo](implicit tpeA : Type[A]) extends Foo;
+}
diff --git a/tests/untried/neg/t6920.check b/tests/untried/neg/t6920.check
new file mode 100644
index 000000000..ee4eafb83
--- /dev/null
+++ b/tests/untried/neg/t6920.check
@@ -0,0 +1,6 @@
+t6920.scala:9: error: too many arguments for method applyDynamicNamed: (values: Seq[(String, Any)])String
+error after rewriting to CompilerError.this.test.applyDynamicNamed("crushTheCompiler")(scala.Tuple2("a", 1), scala.Tuple2("b", 2))
+possible cause: maybe a wrong Dynamic method signature?
+ test.crushTheCompiler(a = 1, b = 2)
+ ^
+one error found
diff --git a/tests/untried/neg/t6920.scala b/tests/untried/neg/t6920.scala
new file mode 100644
index 000000000..25dc7b3b6
--- /dev/null
+++ b/tests/untried/neg/t6920.scala
@@ -0,0 +1,10 @@
+import scala.language.dynamics
+
+class DynTest extends Dynamic {
+ def applyDynamicNamed(name: String)(values: Seq[(String, Any)]) = "test"
+}
+
+class CompilerError {
+ val test = new DynTest
+ test.crushTheCompiler(a = 1, b = 2)
+}
diff --git a/tests/untried/neg/t6928.check b/tests/untried/neg/t6928.check
new file mode 100644
index 000000000..28b8e382d
--- /dev/null
+++ b/tests/untried/neg/t6928.check
@@ -0,0 +1,7 @@
+t6928.scala:2: error: super constructor cannot be passed a self reference unless parameter is declared by-name
+object B extends A(B)
+ ^
+t6928.scala:3: error: super constructor cannot be passed a self reference unless parameter is declared by-name
+object C extends A(null, null, C)
+ ^
+two errors found
diff --git a/tests/untried/neg/t6928.scala b/tests/untried/neg/t6928.scala
new file mode 100644
index 000000000..84bdcde45
--- /dev/null
+++ b/tests/untried/neg/t6928.scala
@@ -0,0 +1,10 @@
+abstract class A( val someAs: A* )
+object B extends A(B)
+object C extends A(null, null, C)
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ println(B.someAs)
+ println(C.someAs)
+ }
+}
diff --git a/tests/untried/neg/t693.check b/tests/untried/neg/t693.check
new file mode 100644
index 000000000..25bd14150
--- /dev/null
+++ b/tests/untried/neg/t693.check
@@ -0,0 +1,4 @@
+t693.scala:4: error: x is already defined as value x
+ val x : Int = 10;
+ ^
+one error found
diff --git a/tests/untried/neg/t693.scala b/tests/untried/neg/t693.scala
new file mode 100644
index 000000000..3a9e6247a
--- /dev/null
+++ b/tests/untried/neg/t693.scala
@@ -0,0 +1,5 @@
+abstract class test4 {
+ trait Type;
+ val x : Type = null;
+ val x : Int = 10;
+}
diff --git a/tests/untried/neg/t6931.check b/tests/untried/neg/t6931.check
new file mode 100644
index 000000000..7cf804a93
--- /dev/null
+++ b/tests/untried/neg/t6931.check
@@ -0,0 +1,10 @@
+Test_2.scala:3: error: 1
+ err"123"
+ ^
+Test_2.scala:3: error: 2
+ err"123"
+ ^
+Test_2.scala:3: error: 3
+ err"123"
+ ^
+three errors found
diff --git a/tests/untried/neg/t6931/Macros_1.scala b/tests/untried/neg/t6931/Macros_1.scala
new file mode 100644
index 000000000..9e167e61d
--- /dev/null
+++ b/tests/untried/neg/t6931/Macros_1.scala
@@ -0,0 +1,15 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ implicit class Error(ctx: StringContext) {
+ def err(args: Any*): Unit = macro impl
+ }
+
+ def impl(c: Context)(args: c.Tree*): c.Tree = {
+ import c.universe._
+ val q"Macros.Error(scala.StringContext.apply($arg)).err()" = c.macroApplication
+ for (i <- 1 to 3) c.error(arg.pos.withPoint(arg.pos.point + i - 1), i.toString)
+ q"()"
+ }
+}
diff --git a/tests/untried/neg/t6931/Test_2.scala b/tests/untried/neg/t6931/Test_2.scala
new file mode 100644
index 000000000..dbd7fc260
--- /dev/null
+++ b/tests/untried/neg/t6931/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ import Macros._
+ err"123"
+}
diff --git a/tests/untried/neg/t6952.check b/tests/untried/neg/t6952.check
new file mode 100644
index 000000000..1a591d02c
--- /dev/null
+++ b/tests/untried/neg/t6952.check
@@ -0,0 +1,13 @@
+t6952.scala:2: error: extension of type scala.Dynamic needs to be enabled
+by making the implicit value scala.language.dynamics visible.
+This can be achieved by adding the import clause 'import scala.language.dynamics'
+or by setting the compiler option -language:dynamics.
+See the Scala docs for value scala.language.dynamics for a discussion
+why the feature needs to be explicitly enabled.
+trait B extends Dynamic
+ ^
+t6952.scala:3: error: extension of type scala.Dynamic needs to be enabled
+by making the implicit value scala.language.dynamics visible.
+trait C extends A with Dynamic
+ ^
+two errors found
diff --git a/tests/untried/neg/t6952.scala b/tests/untried/neg/t6952.scala
new file mode 100644
index 000000000..257ea3be6
--- /dev/null
+++ b/tests/untried/neg/t6952.scala
@@ -0,0 +1,4 @@
+trait A
+trait B extends Dynamic
+trait C extends A with Dynamic
+trait D extends B
diff --git a/tests/untried/neg/t696.check b/tests/untried/neg/t696.check
new file mode 100644
index 000000000..b7bc5cdf9
--- /dev/null
+++ b/tests/untried/neg/t696.check
@@ -0,0 +1,9 @@
+t696.scala:5: error: diverging implicit expansion for type TypeUtil0.Type[Any]
+starting with method WithType in object TypeUtil0
+ as[Any](null)
+ ^
+t696.scala:6: error: diverging implicit expansion for type TypeUtil0.Type[X]
+starting with method WithType in object TypeUtil0
+ def foo[X]() = as[X](null)
+ ^
+two errors found
diff --git a/tests/untried/neg/t696.scala b/tests/untried/neg/t696.scala
new file mode 100644
index 000000000..ca76f7ef6
--- /dev/null
+++ b/tests/untried/neg/t696.scala
@@ -0,0 +1,7 @@
+object TypeUtil0 {
+ trait Type[+T]
+ implicit def WithType[S,T](implicit tpeS : Type[S], tpeT : Type[T]) : Type[S with T] = null
+ def as[T](x : Any)(implicit tpe : Type[T]) = null
+ as[Any](null)
+ def foo[X]() = as[X](null)
+}
diff --git a/tests/untried/neg/t6963a.check b/tests/untried/neg/t6963a.check
new file mode 100644
index 000000000..5858e7740
--- /dev/null
+++ b/tests/untried/neg/t6963a.check
@@ -0,0 +1,7 @@
+t6963a.scala:4: warning: method scanRight in trait TraversableLike has changed semantics in version 2.9.0:
+The behavior of `scanRight` has changed. The previous behavior can be reproduced with scanRight.reverse.
+ List(1,2,3,4,5).scanRight(0)(_+_)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t6963a.flags b/tests/untried/neg/t6963a.flags
new file mode 100644
index 000000000..4c61ed943
--- /dev/null
+++ b/tests/untried/neg/t6963a.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xmigration:2.7
diff --git a/tests/untried/neg/t6963a.scala b/tests/untried/neg/t6963a.scala
new file mode 100644
index 000000000..6808e541b
--- /dev/null
+++ b/tests/untried/neg/t6963a.scala
@@ -0,0 +1,5 @@
+object Test {
+ import scala.collection.mutable._
+
+ List(1,2,3,4,5).scanRight(0)(_+_)
+}
diff --git a/tests/untried/neg/t700.check b/tests/untried/neg/t700.check
new file mode 100644
index 000000000..4c0a2e5fd
--- /dev/null
+++ b/tests/untried/neg/t700.check
@@ -0,0 +1,4 @@
+t700.scala:6: error: method foobar in trait Foo is accessed from super. It may not be abstract unless it is overridden by a member declared `abstract' and `override'
+ def foobar: Unit = super.foobar
+ ^
+one error found
diff --git a/tests/untried/neg/t700.scala b/tests/untried/neg/t700.scala
new file mode 100644
index 000000000..b08c8b552
--- /dev/null
+++ b/tests/untried/neg/t700.scala
@@ -0,0 +1,10 @@
+trait Foo {
+ def foobar: Unit;
+}
+
+trait Bar extends Foo {
+ def foobar: Unit = super.foobar
+}
+
+// the following definition breaks the compiler
+abstract class Foobar extends Bar
diff --git a/tests/untried/neg/t7007.check b/tests/untried/neg/t7007.check
new file mode 100644
index 000000000..e22ecb9e4
--- /dev/null
+++ b/tests/untried/neg/t7007.check
@@ -0,0 +1,7 @@
+t7007.scala:5: error: Implementation restriction: <$anon: A => B> requires premature access to class Crash.
+ def this(a: Seq[A]) = this(a.collect{ case b: B => b}, a.collect{ case b: B => b})
+ ^
+t7007.scala:5: error: Implementation restriction: <$anon: A => B> requires premature access to class Crash.
+ def this(a: Seq[A]) = this(a.collect{ case b: B => b}, a.collect{ case b: B => b})
+ ^
+two errors found
diff --git a/tests/untried/neg/t7007.scala b/tests/untried/neg/t7007.scala
new file mode 100644
index 000000000..e41dccf55
--- /dev/null
+++ b/tests/untried/neg/t7007.scala
@@ -0,0 +1,14 @@
+class A
+class B extends A
+
+class Crash(b1: Seq[B], b2: Seq[B]) {
+ def this(a: Seq[A]) = this(a.collect{ case b: B => b}, a.collect{ case b: B => b})
+}
+
+object Main extends App {
+
+ // runtime exception with either constructor
+ val c1 = new Crash(Seq(new B, new B))
+ val c2 = new Crash(Seq(new B), Seq(new B))
+
+}
diff --git a/tests/untried/neg/t7020.check b/tests/untried/neg/t7020.check
new file mode 100644
index 000000000..76390b243
--- /dev/null
+++ b/tests/untried/neg/t7020.check
@@ -0,0 +1,19 @@
+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(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(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(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(5) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/t7020.flags b/tests/untried/neg/t7020.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t7020.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7020.scala b/tests/untried/neg/t7020.scala
new file mode 100644
index 000000000..cc5421bab
--- /dev/null
+++ b/tests/untried/neg/t7020.scala
@@ -0,0 +1,30 @@
+object Test {
+ // warning was non-deterministic
+ List(5) match {
+ case 1 :: Nil | 2 :: Nil =>
+ case (x@(4 | 5 | 6)) :: Nil =>
+ case 7 :: Nil =>
+ case Nil =>
+ }
+
+ List(5) match {
+ case 1 :: Nil | 2 :: Nil =>
+ case (x@(4 | 5 | 6)) :: Nil =>
+ case 7 :: Nil =>
+ case Nil =>
+ }
+
+ List(5) match {
+ case 1 :: Nil | 2 :: Nil =>
+ case (x@(4 | 5 | 6)) :: Nil =>
+ case 7 :: Nil =>
+ case Nil =>
+ }
+
+ List(5) match {
+ case 1 :: Nil | 2 :: Nil =>
+ case (x@(4 | 5 | 6)) :: Nil =>
+ case 7 :: Nil =>
+ case Nil =>
+ }
+}
diff --git a/tests/untried/neg/t708.check b/tests/untried/neg/t708.check
new file mode 100644
index 000000000..4983aab61
--- /dev/null
+++ b/tests/untried/neg/t708.check
@@ -0,0 +1,5 @@
+t708.scala:8: error: overriding type S in trait X with bounds <: A.this.T;
+ type S has incompatible type
+ override private[A] type S = Any;
+ ^
+one error found
diff --git a/tests/untried/neg/t708.scala b/tests/untried/neg/t708.scala
new file mode 100644
index 000000000..f86a00581
--- /dev/null
+++ b/tests/untried/neg/t708.scala
@@ -0,0 +1,12 @@
+trait A {
+ type T;
+ trait X {
+ private[A] type S <: T;
+ /*private[A]*/ def foo : S;
+ }
+ trait Y extends X {
+ override private[A] type S = Any;
+ override /*private[A]*/ def foo = null;
+ }
+}
+
diff --git a/tests/untried/neg/t7110.check b/tests/untried/neg/t7110.check
new file mode 100644
index 000000000..e484dc432
--- /dev/null
+++ b/tests/untried/neg/t7110.check
@@ -0,0 +1,6 @@
+t7110.scala:2: warning: A try without a catch or finally is equivalent to putting its body in a block; no exceptions are handled.
+ try { ??? } // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t7110.flags b/tests/untried/neg/t7110.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t7110.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7110.scala b/tests/untried/neg/t7110.scala
new file mode 100644
index 000000000..79ac32521
--- /dev/null
+++ b/tests/untried/neg/t7110.scala
@@ -0,0 +1,6 @@
+object Test {
+ try { ??? } // warn
+
+ try { ??? } finally ??? // no warn
+ try { ??? } catch { case _: Throwable => } // no warn
+}
diff --git a/tests/untried/neg/t712.check b/tests/untried/neg/t712.check
new file mode 100644
index 000000000..831e94306
--- /dev/null
+++ b/tests/untried/neg/t712.check
@@ -0,0 +1,5 @@
+t712.scala:10: error: value self is not a member of B.this.ParentImpl
+ Note: implicit method coerce is not applicable here because it comes after the application point and it lacks an explicit result type
+ implicit def coerce(p : ParentImpl) = p.self;
+ ^
+one error found
diff --git a/tests/untried/neg/t712.scala b/tests/untried/neg/t712.scala
new file mode 100644
index 000000000..6f2627743
--- /dev/null
+++ b/tests/untried/neg/t712.scala
@@ -0,0 +1,19 @@
+trait A {
+ type Node <: NodeImpl;
+ implicit def coerce(n : NodeImpl) = n.self;
+ trait NodeImpl {
+ def self : Node;
+ }
+}
+trait B extends A {
+ type Parent <: ParentImpl;
+ implicit def coerce(p : ParentImpl) = p.self;
+ trait ParentImpl;
+ type Symbol;
+ trait SymbolImpl {
+ def scope : Int;
+ }
+ implicit def coerceSym(sym : Symbol) : SymbolImpl;
+ var s : Symbol = _;
+ val s_scope = s.scope;
+}
diff --git a/tests/untried/neg/t715.check b/tests/untried/neg/t715.check
new file mode 100644
index 000000000..2c01047a6
--- /dev/null
+++ b/tests/untried/neg/t715.check
@@ -0,0 +1,4 @@
+t715.scala:12: error: method chilren in trait NodeImpl is accessed from super. It may not be abstract unless it is overridden by a member declared `abstract' and `override'
+ override def children = super.chilren;
+ ^
+one error found
diff --git a/tests/untried/neg/t715.scala b/tests/untried/neg/t715.scala
new file mode 100644
index 000000000..87b2525a6
--- /dev/null
+++ b/tests/untried/neg/t715.scala
@@ -0,0 +1,15 @@
+package test;
+trait B {
+ type Node <: NodeImpl;
+ trait NodeImpl {
+ def self : Node;
+ def chilren : List[Node];
+ }
+}
+trait C extends B {
+ type Node <: NodeImpl;
+ trait NodeImpl extends super.NodeImpl {
+ override def children = super.chilren;
+ children;
+ }
+}
diff --git a/tests/untried/neg/t7157.check b/tests/untried/neg/t7157.check
new file mode 100644
index 000000000..c6a7af9a2
--- /dev/null
+++ b/tests/untried/neg/t7157.check
@@ -0,0 +1,73 @@
+Test_2.scala:5: error: too many arguments for macro method m1_0_0: ()Unit
+ m1_0_0(1)
+ ^
+Test_2.scala:6: error: too many arguments for macro method m1_0_0: ()Unit
+ m1_0_0(1, 2)
+ ^
+Test_2.scala:7: error: too many arguments for macro method m1_0_0: ()Unit
+ m1_0_0(1, 2, 3)
+ ^
+Test_2.scala:9: error: macro applications do not support named and/or default arguments
+ m1_1_1()
+ ^
+Test_2.scala:11: error: too many arguments for macro method m1_1_1: (x: Int)Unit
+ m1_1_1(1, 2)
+ ^
+Test_2.scala:12: error: too many arguments for macro method m1_1_1: (x: Int)Unit
+ m1_1_1(1, 2, 3)
+ ^
+Test_2.scala:14: error: macro applications do not support named and/or default arguments
+ m1_2_2()
+ ^
+Test_2.scala:15: error: macro applications do not support named and/or default arguments
+ m1_2_2(1)
+ ^
+Test_2.scala:17: error: too many arguments for macro method m1_2_2: (x: Int, y: Int)Unit
+ m1_2_2(1, 2, 3)
+ ^
+Test_2.scala:24: error: macro applications do not support named and/or default arguments
+ m1_1_inf()
+ ^
+Test_2.scala:29: error: macro applications do not support named and/or default arguments
+ m1_2_inf()
+ ^
+Test_2.scala:30: error: macro applications do not support named and/or default arguments
+ m1_2_inf(1)
+ ^
+Test_2.scala:35: error: too many arguments for macro method m2_0_0: ()Unit
+ m2_0_0()(1)
+ ^
+Test_2.scala:36: error: too many arguments for macro method m2_0_0: ()Unit
+ m2_0_0()(1, 2)
+ ^
+Test_2.scala:37: error: too many arguments for macro method m2_0_0: ()Unit
+ m2_0_0()(1, 2, 3)
+ ^
+Test_2.scala:39: error: macro applications do not support named and/or default arguments
+ m2_1_1()()
+ ^
+Test_2.scala:41: error: too many arguments for macro method m2_1_1: (x: Int)Unit
+ m2_1_1()(1, 2)
+ ^
+Test_2.scala:42: error: too many arguments for macro method m2_1_1: (x: Int)Unit
+ m2_1_1()(1, 2, 3)
+ ^
+Test_2.scala:44: error: macro applications do not support named and/or default arguments
+ m2_2_2()()
+ ^
+Test_2.scala:45: error: macro applications do not support named and/or default arguments
+ m2_2_2()(1)
+ ^
+Test_2.scala:47: error: too many arguments for macro method m2_2_2: (x: Int, y: Int)Unit
+ m2_2_2()(1, 2, 3)
+ ^
+Test_2.scala:54: error: macro applications do not support named and/or default arguments
+ m2_1_inf()()
+ ^
+Test_2.scala:59: error: macro applications do not support named and/or default arguments
+ m2_2_inf()()
+ ^
+Test_2.scala:60: error: macro applications do not support named and/or default arguments
+ m2_2_inf()(1)
+ ^
+24 errors found
diff --git a/tests/untried/neg/t7157/Impls_Macros_1.scala b/tests/untried/neg/t7157/Impls_Macros_1.scala
new file mode 100644
index 000000000..e7a603006
--- /dev/null
+++ b/tests/untried/neg/t7157/Impls_Macros_1.scala
@@ -0,0 +1,32 @@
+import scala.reflect.macros.blackbox.Context
+import language.experimental.macros
+
+object Macros {
+ def impl1_0_0(c: Context)() = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ def impl1_1_1(c: Context)(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ def impl1_2_2(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ 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]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ def impl1_1_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ 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"""println("hello world")""") }
+ 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)()() = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ def impl2_1_1(c: Context)()(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ def impl2_2_2(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ 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]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ def impl2_1_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ 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"""println("hello world")""") }
+ 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/tests/untried/neg/t7157/Test_2.scala b/tests/untried/neg/t7157/Test_2.scala
new file mode 100644
index 000000000..faafb02a3
--- /dev/null
+++ b/tests/untried/neg/t7157/Test_2.scala
@@ -0,0 +1,63 @@
+import Macros._
+
+object Test extends App {
+ m1_0_0()
+ m1_0_0(1)
+ m1_0_0(1, 2)
+ m1_0_0(1, 2, 3)
+
+ m1_1_1()
+ m1_1_1(1)
+ m1_1_1(1, 2)
+ m1_1_1(1, 2, 3)
+
+ m1_2_2()
+ m1_2_2(1)
+ m1_2_2(1, 2)
+ m1_2_2(1, 2, 3)
+
+ m1_0_inf()
+ m1_0_inf(1)
+ m1_0_inf(1, 2)
+ m1_0_inf(1, 2, 3)
+
+ m1_1_inf()
+ m1_1_inf(1)
+ m1_1_inf(1, 2)
+ m1_1_inf(1, 2, 3)
+
+ m1_2_inf()
+ m1_2_inf(1)
+ m1_2_inf(1, 2)
+ m1_2_inf(1, 2, 3)
+
+ m2_0_0()()
+ m2_0_0()(1)
+ m2_0_0()(1, 2)
+ m2_0_0()(1, 2, 3)
+
+ m2_1_1()()
+ m2_1_1()(1)
+ m2_1_1()(1, 2)
+ m2_1_1()(1, 2, 3)
+
+ m2_2_2()()
+ m2_2_2()(1)
+ m2_2_2()(1, 2)
+ m2_2_2()(1, 2, 3)
+
+ m2_0_inf()()
+ m2_0_inf()(1)
+ m2_0_inf()(1, 2)
+ m2_0_inf()(1, 2, 3)
+
+ m2_1_inf()()
+ m2_1_inf()(1)
+ m2_1_inf()(1, 2)
+ m2_1_inf()(1, 2, 3)
+
+ m2_2_inf()()
+ m2_2_inf()(1)
+ m2_2_inf()(1, 2)
+ m2_2_inf()(1, 2, 3)
+}
diff --git a/tests/untried/neg/t7171.check b/tests/untried/neg/t7171.check
new file mode 100644
index 000000000..ecd768afd
--- /dev/null
+++ b/tests/untried/neg/t7171.check
@@ -0,0 +1,6 @@
+t7171.scala:2: warning: The outer reference in this type test cannot be checked at run time.
+ final case class A()
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t7171.flags b/tests/untried/neg/t7171.flags
new file mode 100644
index 000000000..464cc20ea
--- /dev/null
+++ b/tests/untried/neg/t7171.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -unchecked \ No newline at end of file
diff --git a/tests/untried/neg/t7171.scala b/tests/untried/neg/t7171.scala
new file mode 100644
index 000000000..534b2070a
--- /dev/null
+++ b/tests/untried/neg/t7171.scala
@@ -0,0 +1,11 @@
+trait T {
+ final case class A()
+
+ // Was:
+ // error: scrutinee is incompatible with pattern type;
+ // found : T.this.A
+ // required: T#A
+ def foo(a: T#A) = a match {
+ case _: A => true; case _ => false
+ }
+}
diff --git a/tests/untried/neg/t7171b.check b/tests/untried/neg/t7171b.check
new file mode 100644
index 000000000..bf695afea
--- /dev/null
+++ b/tests/untried/neg/t7171b.check
@@ -0,0 +1,6 @@
+t7171b.scala:2: warning: The outer reference in this type test cannot be checked at run time.
+ final case class A()
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t7171b.flags b/tests/untried/neg/t7171b.flags
new file mode 100644
index 000000000..464cc20ea
--- /dev/null
+++ b/tests/untried/neg/t7171b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -unchecked \ No newline at end of file
diff --git a/tests/untried/neg/t7171b.scala b/tests/untried/neg/t7171b.scala
new file mode 100644
index 000000000..53c7787f8
--- /dev/null
+++ b/tests/untried/neg/t7171b.scala
@@ -0,0 +1,15 @@
+trait T {
+ final case class A()
+}
+
+final class U extends T {
+ // this match should also not be deemed impossible
+ def foo(a: U#A) = a match {
+ case _: A => true; case _ => false
+ }
+
+ // this match should also not be deemed impossible
+ def bar(a: T#A) = a match {
+ case _: A => true; case _ => false
+ }
+}
diff --git a/tests/untried/neg/t7214neg.check b/tests/untried/neg/t7214neg.check
new file mode 100644
index 000000000..291af0457
--- /dev/null
+++ b/tests/untried/neg/t7214neg.check
@@ -0,0 +1,4 @@
+t7214neg.scala:28: error: not enough patterns for object Extractor offering Any: expected 1, found 0
+ case Extractor() =>
+ ^
+one error found
diff --git a/tests/untried/neg/t7214neg.scala b/tests/untried/neg/t7214neg.scala
new file mode 100644
index 000000000..ff1ea8082
--- /dev/null
+++ b/tests/untried/neg/t7214neg.scala
@@ -0,0 +1,57 @@
+// pattern matcher crashes here trying to synthesize an uneeded outer test.
+// no-symbol does not have an owner
+// at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49)
+// at scala.tools.nsc.Global.abort(Global.scala:253)
+// at scala.reflect.internal.Symbols$NoSymbol.owner(Symbols.scala:3248)
+// at scala.reflect.internal.Symbols$Symbol.effectiveOwner(Symbols.scala:678)
+// at scala.reflect.internal.Symbols$Symbol.isDefinedInPackage(Symbols.scala:664)
+// at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:188)
+// at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:124)
+// at scala.tools.nsc.ast.TreeDSL$CODE$.REF(TreeDSL.scala:308)
+// at scala.tools.nsc.typechecker.PatternMatching$TreeMakers$TypeTestTreeMaker$treeCondStrategy$.outerTest(PatternMatching.scala:1209)
+class Crash {
+ type Alias = C#T
+
+ val c = new C
+ val t = new c.T
+
+ // Crash via a Typed Pattern...
+ (t: Any) match {
+ case e: Alias =>
+ }
+
+ // ... or via a Typed Extractor Pattern.
+ object Extractor {
+ def unapply(a: Alias): Option[Any] = None
+ }
+ (t: Any) match {
+ case Extractor() =>
+ case _ =>
+ }
+
+ // checking that correct outer tests are applied when
+ // aliases for path dependent types are involved.
+ val c2 = new C
+ type CdotT = c.T
+ type C2dotT = c2.T
+
+ val outerField = t.getClass.getDeclaredFields.find(_.getName contains ("outer")).get
+ outerField.setAccessible(true)
+
+ (t: Any) match {
+ case _: C2dotT =>
+ println(s"!!! wrong match. t.outer=${outerField.get(t)} / c2 = $c2") // this matches on 2.10.0
+ case _: CdotT =>
+ case _ =>
+ println(s"!!! wrong match. t.outer=${outerField.get(t)} / c = $c")
+ }
+}
+
+class C {
+ class T
+}
+
+object Test extends App {
+ new Crash
+}
+
diff --git a/tests/untried/neg/t7235.check b/tests/untried/neg/t7235.check
new file mode 100644
index 000000000..357a3dfd8
--- /dev/null
+++ b/tests/untried/neg/t7235.check
@@ -0,0 +1,4 @@
+t7235.scala:9: error: implementation restriction: cannot reify refinement type trees with non-empty bodies
+ val Block(List(ValDef(_, _, tpt: CompoundTypeTree, _)), _) = reify{ val x: C { def x: Int } = ??? }.tree
+ ^
+one error found
diff --git a/tests/untried/neg/t7235.scala b/tests/untried/neg/t7235.scala
new file mode 100644
index 000000000..cfebad3fa
--- /dev/null
+++ b/tests/untried/neg/t7235.scala
@@ -0,0 +1,14 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+class C
+
+object Test extends App {
+ val Block(List(ValDef(_, _, tpt: CompoundTypeTree, _)), _) = reify{ val x: C { def x: Int } = ??? }.tree
+ println(tpt)
+ println(tpt.templ.parents)
+ println(tpt.templ.self)
+ println(tpt.templ.body)
+}
diff --git a/tests/untried/neg/t7238.check b/tests/untried/neg/t7238.check
new file mode 100644
index 000000000..b87f83ff6
--- /dev/null
+++ b/tests/untried/neg/t7238.check
@@ -0,0 +1,6 @@
+t7238.scala:6: error: type mismatch;
+ found : Seq[Any]
+ required: Seq[String]
+ c.c()(Seq[Any](): _*)
+ ^
+one error found
diff --git a/tests/untried/neg/t7238.scala b/tests/untried/neg/t7238.scala
new file mode 100644
index 000000000..d42dc8d38
--- /dev/null
+++ b/tests/untried/neg/t7238.scala
@@ -0,0 +1,7 @@
+trait Main {
+ trait C {
+ def c(x: Any = 0)(bs: String*)
+ }
+ def c: C
+ c.c()(Seq[Any](): _*)
+}
diff --git a/tests/untried/neg/t7239.check b/tests/untried/neg/t7239.check
new file mode 100644
index 000000000..80b14f8fc
--- /dev/null
+++ b/tests/untried/neg/t7239.check
@@ -0,0 +1,4 @@
+t7239.scala:10: error: not found: value foBar
+ fooBar = foBar.toInt
+ ^
+one error found
diff --git a/tests/untried/neg/t7239.scala b/tests/untried/neg/t7239.scala
new file mode 100644
index 000000000..f62cac0a4
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7251.check b/tests/untried/neg/t7251.check
new file mode 100644
index 000000000..8df8984d6
--- /dev/null
+++ b/tests/untried/neg/t7251.check
@@ -0,0 +1,4 @@
+B_2.scala:5: error: object s.Outer$Triple$ is not a value
+ println( s.Outer$Triple$ )
+ ^
+one error found
diff --git a/tests/untried/neg/t7251/A_1.scala b/tests/untried/neg/t7251/A_1.scala
new file mode 100644
index 000000000..d05373ed2
--- /dev/null
+++ b/tests/untried/neg/t7251/A_1.scala
@@ -0,0 +1,10 @@
+package s
+
+object Outer {
+ type Triple[+A, +B, +C] = Tuple3[A, B, C]
+ object Triple {
+ def apply[A, B, C](x: A, y: B, z: C) = Tuple3(x, y, z)
+ def unapply[A, B, C](x: Tuple3[A, B, C]): Option[Tuple3[A, B, C]] = Some(x)
+ }
+}
+
diff --git a/tests/untried/neg/t7251/B_2.scala b/tests/untried/neg/t7251/B_2.scala
new file mode 100644
index 000000000..eb59b3090
--- /dev/null
+++ b/tests/untried/neg/t7251/B_2.scala
@@ -0,0 +1,7 @@
+package s
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ println( s.Outer$Triple$ )
+ }
+}
diff --git a/tests/untried/neg/t7259.check b/tests/untried/neg/t7259.check
new file mode 100644
index 000000000..0ad627fc3
--- /dev/null
+++ b/tests/untried/neg/t7259.check
@@ -0,0 +1,7 @@
+t7259.scala:1: error: not found: type xxxxx
+@xxxxx // error: not found: type xxxx
+ ^
+t7259.scala:8: error: type xxxxx is not a member of package annotation
+@annotation.xxxxx // error: not found: type scala
+ ^
+two errors found
diff --git a/tests/untried/neg/t7259.scala b/tests/untried/neg/t7259.scala
new file mode 100644
index 000000000..0fdfe1882
--- /dev/null
+++ b/tests/untried/neg/t7259.scala
@@ -0,0 +1,9 @@
+@xxxxx // error: not found: type xxxx
+class Ok
+
+//
+// This had the wrong error message in 2.9 and 2.10.
+//
+
+@annotation.xxxxx // error: not found: type scala
+class WrongErrorMessage
diff --git a/tests/untried/neg/t7285.check b/tests/untried/neg/t7285.check
new file mode 100644
index 000000000..a38772bea
--- /dev/null
+++ b/tests/untried/neg/t7285.check
@@ -0,0 +1,15 @@
+t7285.scala:15: warning: match may not be exhaustive.
+It would fail on the following input: (Up, Down)
+ (d1, d2) match {
+ ^
+t7285.scala:33: warning: match may not be exhaustive.
+It would fail on the following input: Down
+ (d1) match {
+ ^
+t7285.scala:51: warning: match may not be exhaustive.
+It would fail on the following input: (Up, Down)
+ (d1, d2) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t7285.flags b/tests/untried/neg/t7285.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t7285.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7285.scala b/tests/untried/neg/t7285.scala
new file mode 100644
index 000000000..14121d92b
--- /dev/null
+++ b/tests/untried/neg/t7285.scala
@@ -0,0 +1,55 @@
+sealed abstract class Base
+
+
+object Test1 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base {
+ }
+
+ case object Up extends Base {
+ }
+
+ (d1: Base, d2: Base) =>
+ (d1, d2) match {
+ case (Up, Up) | (Down, Down) => false
+ case (Down, Up) => true
+ }
+ }
+}
+
+object Test2 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base {
+ }
+
+ case object Up extends Base {
+ }
+
+ (d1: Base, d2: Base) =>
+ (d1) match {
+ case Test2.Base.Up => false
+ }
+ }
+}
+
+
+object Test4 {
+ sealed abstract class Base
+
+ object Base {
+ case object Down extends Base
+
+ case object Up extends Base
+ }
+
+ import Test4.Base._
+ (d1: Base, d2: Base) =>
+ (d1, d2) match {
+ case (Up, Up) | (Down, Down) => false
+ case (Down, Test4.Base.Up) => true
+ }
+}
diff --git a/tests/untried/neg/t7289.check b/tests/untried/neg/t7289.check
new file mode 100644
index 000000000..e4aeebbc6
--- /dev/null
+++ b/tests/untried/neg/t7289.check
@@ -0,0 +1,4 @@
+t7289.scala:8: error: could not find implicit value for parameter e: Test.Schtroumpf[scala.collection.immutable.Nil.type]
+ implicitly[Schtroumpf[Nil.type]]
+ ^
+one error found
diff --git a/tests/untried/neg/t7289.scala b/tests/untried/neg/t7289.scala
new file mode 100644
index 000000000..ad9340055
--- /dev/null
+++ b/tests/untried/neg/t7289.scala
@@ -0,0 +1,39 @@
+object Test extends App {
+ trait Schtroumpf[T]
+
+ implicit def schtroumpf[T, U <: Coll[T], Coll[X] <: Traversable[X]]
+ (implicit minorSchtroumpf: Schtroumpf[T]): Schtroumpf[U] = ???
+
+ implicit val qoo: Schtroumpf[Int] = new Schtroumpf[Int]{}
+ implicitly[Schtroumpf[Nil.type]]
+}
+
+/*
+info1 = {scala.tools.nsc.typechecker.Implicits$ImplicitInfo@3468}"qoo: => Test.Schtroumpf[Int]"
+info2 = {scala.tools.nsc.typechecker.Implicits$ImplicitInfo@3469}"schtroumpf: [T, U <: Coll[T], Coll[_] <: Traversable[_]](implicit minorSchtroumpf: Test.Schtroumpf[T])Test.Schtroumpf[U]"
+isStrictlyMoreSpecific(info1, info2)
+ isSubType(Test.Schtroumpf[Int], Test.Schtroumpf[U] forSome { T; U <: Coll[T]; Coll[_] <: Traversable[_] })
+ isAsSpecificValueType(Test.Schtroumpf[Int], Test.Schtroumpf[U], undef2 = List(type T, type U, type Coll))
+
+ val et: ExistentialType = Test.Schtroumpf[U] forSome { T; U <: Coll[T]; Coll[_] <: Traversable[_] }
+ val tp1 = Test.Schtroumpf[Int]
+ et.withTypeVars(isSubType(tp1, _, depth))
+ solve()
+ tvars = tList(=?Nothing, =?Int, =?=?Int)
+
+
+[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
+[ create] ?U ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
+[ create] ?Coll ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
+[ setInst] Nothing ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Nothing )
+[ setInst] scala.collection.immutable.Nil.type( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], U=scala.collection.immutable.Nil.type )
+[ setInst] =?scala.collection.immutable.Nil.type( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], Coll==?scala.collection.immutable.Nil.type )
+[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
+[ setInst] Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Int )
+[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
+[ create] ?U ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
+[ create] ?Coll ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
+[ setInst] Nothing ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Nothing )
+[ setInst] Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], U=Int )
+[ setInst] =?Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], Coll==?Int )
+*/
diff --git a/tests/untried/neg/t7289_status_quo.check b/tests/untried/neg/t7289_status_quo.check
new file mode 100644
index 000000000..31c072e96
--- /dev/null
+++ b/tests/untried/neg/t7289_status_quo.check
@@ -0,0 +1,22 @@
+t7289_status_quo.scala:9: error: could not find implicit value for parameter e: Test1.Ext[List[Int]]
+ implicitly[Ext[List[Int]]] // fails - not found
+ ^
+t7289_status_quo.scala:11: error: could not find implicit value for parameter e: Test1.Ext[List[List[List[Int]]]]
+ implicitly[Ext[List[List[List[Int]]]]] // fails - not found
+ ^
+t7289_status_quo.scala:15: error: ambiguous implicit values:
+ both method f in object Test1 of type [A, Coll <: CC[A], CC[X] <: Traversable[X]](implicit xi: Test1.Ext[A])Test1.Ext[Coll]
+ and value m in object Test1 of type => Test1.Ext[List[List[Int]]]
+ match expected type Test1.Ext[_ <: List[List[Int]]]
+ implicitly[Ext[_ <: List[List[Int]]]] // fails - ambiguous
+ ^
+t7289_status_quo.scala:20: error: could not find implicit value for parameter e: Test1.ExtCov[List[Int]]
+ implicitly[ExtCov[List[Int]]] // fails - not found
+ ^
+t7289_status_quo.scala:21: error: could not find implicit value for parameter e: Test1.ExtCov[List[List[Int]]]
+ implicitly[ExtCov[List[List[Int]]]] // fails - not found
+ ^
+t7289_status_quo.scala:22: error: could not find implicit value for parameter e: Test1.ExtCov[List[List[List[Int]]]]
+ implicitly[ExtCov[List[List[List[Int]]]]] // fails - not found
+ ^
+6 errors found
diff --git a/tests/untried/neg/t7289_status_quo.scala b/tests/untried/neg/t7289_status_quo.scala
new file mode 100644
index 000000000..e1f9a9f8a
--- /dev/null
+++ b/tests/untried/neg/t7289_status_quo.scala
@@ -0,0 +1,23 @@
+// record the status quo after this fix
+// not clear to @adriaanm why an upper-bounded existential in an invariant position
+// is different from putting that upper bound in a covariant position
+object Test1 {
+ trait Ext[T]
+ implicit def f[A, Coll <: CC[A], CC[X] <: Traversable[X]](implicit xi: Ext[A]): Ext[Coll] = ???
+ implicit val m: Ext[List[List[Int]]] = new Ext[List[List[Int]]]{}
+
+ implicitly[Ext[List[Int]]] // fails - not found
+ implicitly[Ext[List[List[Int]]]] // compiles
+ implicitly[Ext[List[List[List[Int]]]]] // fails - not found
+
+ // Making Ext[+T] should incur the same behavior as these. (so says @paulp)
+ implicitly[Ext[_ <: List[Int]]] // compiles
+ implicitly[Ext[_ <: List[List[Int]]]] // fails - ambiguous
+ implicitly[Ext[_ <: List[List[List[Int]]]]] // compiles
+
+ // But, we currently get:
+ trait ExtCov[+T]
+ implicitly[ExtCov[List[Int]]] // fails - not found
+ implicitly[ExtCov[List[List[Int]]]] // fails - not found
+ implicitly[ExtCov[List[List[List[Int]]]]] // fails - not found
+}
diff --git a/tests/untried/neg/t729.check b/tests/untried/neg/t729.check
new file mode 100644
index 000000000..fb858dc09
--- /dev/null
+++ b/tests/untried/neg/t729.check
@@ -0,0 +1,6 @@
+t729.scala:20: error: type mismatch;
+ found : ScalaParserAutoEdit.this.NodeImpl(in trait Parser)
+ required: ScalaParserAutoEdit.this.NodeImpl(in trait ScalaParserAutoEdit)
+ val yyy : NodeImpl = link.from;
+ ^
+one error found
diff --git a/tests/untried/neg/t729.scala b/tests/untried/neg/t729.scala
new file mode 100644
index 000000000..83e7f4cd1
--- /dev/null
+++ b/tests/untried/neg/t729.scala
@@ -0,0 +1,23 @@
+trait Parser {
+ type Node <: NodeImpl;
+ implicit def coerce(n : NodeImpl) = n.self;
+ trait NodeImpl {
+ def self : Node;
+ }
+ trait Link {
+ def from : NodeImpl;
+ }
+}
+
+trait ScalaParserAutoEdit extends Parser {
+ type Node <: NodeImpl;
+ implicit def coerce(node : NodeImpl) = node.self;
+ trait NodeImpl extends super[Parser].NodeImpl {
+ def self : Node;
+ def foo = {
+ var link : Link = null;
+ val xxx : NodeImpl = coerce(link.from);
+ val yyy : NodeImpl = link.from;
+ }
+ }
+}
diff --git a/tests/untried/neg/t7290.check b/tests/untried/neg/t7290.check
new file mode 100644
index 000000000..ad2d0e25b
--- /dev/null
+++ b/tests/untried/neg/t7290.check
@@ -0,0 +1,12 @@
+t7290.scala:4: warning: Pattern contains duplicate alternatives: 0
+ case 0 | 0 => 0
+ ^
+t7290.scala:5: warning: Pattern contains duplicate alternatives: 2, 3
+ case 2 | 2 | 2 | 3 | 2 | 3 => 0
+ ^
+t7290.scala:6: warning: Pattern contains duplicate alternatives: 4
+ case 4 | (_ @ 4) => 0
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t7290.flags b/tests/untried/neg/t7290.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t7290.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7290.scala b/tests/untried/neg/t7290.scala
new file mode 100644
index 000000000..b9db7f7e8
--- /dev/null
+++ b/tests/untried/neg/t7290.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ val y = (0: Int) match {
+ case 1 => 1
+ case 0 | 0 => 0
+ case 2 | 2 | 2 | 3 | 2 | 3 => 0
+ case 4 | (_ @ 4) => 0
+ case _ => -1
+ }
+ assert(y == 0, y)
+}
diff --git a/tests/untried/neg/t7292-deprecation.check b/tests/untried/neg/t7292-deprecation.check
new file mode 100644
index 000000000..17f010dfd
--- /dev/null
+++ b/tests/untried/neg/t7292-deprecation.check
@@ -0,0 +1,12 @@
+t7292-deprecation.scala:2: warning: Octal escape literals are deprecated, use \u0000 instead.
+ val chr1 = '\0'
+ ^
+t7292-deprecation.scala:3: warning: Octal escape literals are deprecated, use \u0053 instead.
+ val str1 = "abc\123456"
+ ^
+t7292-deprecation.scala:4: warning: Octal escape literals are deprecated, use \n instead.
+ val lf = '\012'
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t7292-deprecation.flags b/tests/untried/neg/t7292-deprecation.flags
new file mode 100644
index 000000000..7de3c0f3e
--- /dev/null
+++ b/tests/untried/neg/t7292-deprecation.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -deprecation
diff --git a/tests/untried/neg/t7292-deprecation.scala b/tests/untried/neg/t7292-deprecation.scala
new file mode 100644
index 000000000..d857f0e1e
--- /dev/null
+++ b/tests/untried/neg/t7292-deprecation.scala
@@ -0,0 +1,5 @@
+object OctalEscapes {
+ val chr1 = '\0'
+ val str1 = "abc\123456"
+ val lf = '\012'
+}
diff --git a/tests/untried/neg/t7292-removal.check b/tests/untried/neg/t7292-removal.check
new file mode 100644
index 000000000..1cd59b099
--- /dev/null
+++ b/tests/untried/neg/t7292-removal.check
@@ -0,0 +1,10 @@
+t7292-removal.scala:2: error: Octal escape literals are unsupported, use \u0000 instead.
+ val chr1 = '\0'
+ ^
+t7292-removal.scala:3: error: Octal escape literals are unsupported, use \u0053 instead.
+ val str1 = "abc\123456"
+ ^
+t7292-removal.scala:4: error: Octal escape literals are unsupported, use \n instead.
+ val lf = '\012'
+ ^
+three errors found
diff --git a/tests/untried/neg/t7292-removal.flags b/tests/untried/neg/t7292-removal.flags
new file mode 100644
index 000000000..29f4ede37
--- /dev/null
+++ b/tests/untried/neg/t7292-removal.flags
@@ -0,0 +1 @@
+-Xfuture
diff --git a/tests/untried/neg/t7292-removal.scala b/tests/untried/neg/t7292-removal.scala
new file mode 100644
index 000000000..d857f0e1e
--- /dev/null
+++ b/tests/untried/neg/t7292-removal.scala
@@ -0,0 +1,5 @@
+object OctalEscapes {
+ val chr1 = '\0'
+ val str1 = "abc\123456"
+ val lf = '\012'
+}
diff --git a/tests/untried/neg/t7294.check b/tests/untried/neg/t7294.check
new file mode 100644
index 000000000..f15289c1c
--- /dev/null
+++ b/tests/untried/neg/t7294.check
@@ -0,0 +1,6 @@
+t7294.scala:4: warning: fruitless type test: a value of type (Int, Int) cannot also be a Seq[A]
+ (1, 2) match { case Seq() => 0; case _ => 1 }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t7294.flags b/tests/untried/neg/t7294.flags
new file mode 100644
index 000000000..3f3381a45
--- /dev/null
+++ b/tests/untried/neg/t7294.flags
@@ -0,0 +1 @@
+-Xfuture -Xfatal-warnings
diff --git a/tests/untried/neg/t7294.scala b/tests/untried/neg/t7294.scala
new file mode 100644
index 000000000..335d07112
--- /dev/null
+++ b/tests/untried/neg/t7294.scala
@@ -0,0 +1,5 @@
+object Test {
+ // Treat TupleN as final under -Xfuture for the for the purposes
+ // of the "fruitless type test" warning.
+ (1, 2) match { case Seq() => 0; case _ => 1 }
+}
diff --git a/tests/untried/neg/t7294b.check b/tests/untried/neg/t7294b.check
new file mode 100644
index 000000000..0033b7212
--- /dev/null
+++ b/tests/untried/neg/t7294b.check
@@ -0,0 +1,6 @@
+t7294b.scala:1: warning: inheritance from class Tuple2 in package scala is deprecated: Tuples will be made final in a future version.
+class C extends Tuple2[Int, Int](0, 0)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t7294b.flags b/tests/untried/neg/t7294b.flags
new file mode 100644
index 000000000..d1b831ea8
--- /dev/null
+++ b/tests/untried/neg/t7294b.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7294b.scala b/tests/untried/neg/t7294b.scala
new file mode 100644
index 000000000..deeed4fc7
--- /dev/null
+++ b/tests/untried/neg/t7294b.scala
@@ -0,0 +1 @@
+class C extends Tuple2[Int, Int](0, 0)
diff --git a/tests/untried/neg/t7299.check b/tests/untried/neg/t7299.check
new file mode 100644
index 000000000..74340c484
--- /dev/null
+++ b/tests/untried/neg/t7299.check
@@ -0,0 +1,7 @@
+t7299.scala:4: error: implementation restricts functions to 22 parameters
+ val eta1 = f _
+ ^
+t7299.scala:5: error: implementation restricts functions to 22 parameters
+ val eta2 = g[Any] _
+ ^
+two errors found
diff --git a/tests/untried/neg/t7299.scala b/tests/untried/neg/t7299.scala
new file mode 100644
index 000000000..f3aae5ce5
--- /dev/null
+++ b/tests/untried/neg/t7299.scala
@@ -0,0 +1,6 @@
+object Test {
+ def f(a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int, a7: Int, a8: Int, a9: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int) = 0
+ def g[A](a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int, a7: Int, a8: Int, a9: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int) = 0
+ val eta1 = f _
+ val eta2 = g[Any] _
+}
diff --git a/tests/untried/neg/t7324.check b/tests/untried/neg/t7324.check
new file mode 100644
index 000000000..586947d5e
--- /dev/null
+++ b/tests/untried/neg/t7324.check
@@ -0,0 +1,4 @@
+t7324.scala:2: error: Platform restriction: a parameter list's length cannot exceed 254.
+class Bar(
+ ^
+one error found
diff --git a/tests/untried/neg/t7324.scala b/tests/untried/neg/t7324.scala
new file mode 100644
index 000000000..81d7674d6
--- /dev/null
+++ b/tests/untried/neg/t7324.scala
@@ -0,0 +1,57 @@
+object Bar extends App
+class Bar(
+_1: Int, _2: Int, _3: Int, _4: Int, _5: Int, _6: Int, _7: Int, _8: Int, _9: Int, _10: Int,
+_11: Int, _12: Int, _13: Int, _14: Int, _15: Int, _16: Int, _17: Int, _18: Int, _19: Int, _20: Int,
+_21: Int, _22: Int, _23: Int, _24: Int, _25: Int, _26: Int, _27: Int, _28: Int, _29: Int, _30: Int,
+_31: Int, _32: Int, _33: Int, _34: Int, _35: Int, _36: Int, _37: Int, _38: Int, _39: Int, _40: Int,
+_41: Int, _42: Int, _43: Int, _44: Int, _45: Int, _46: Int, _47: Int, _48: Int, _49: Int, _50: Int,
+_51: Int, _52: Int, _53: Int, _54: Int, _55: Int, _56: Int, _57: Int, _58: Int, _59: Int, _60: Int,
+_61: Int, _62: Int, _63: Int, _64: Int, _65: Int, _66: Int, _67: Int, _68: Int, _69: Int, _70: Int,
+_71: Int, _72: Int, _73: Int, _74: Int, _75: Int, _76: Int, _77: Int, _78: Int, _79: Int, _80: Int,
+_81: Int, _82: Int, _83: Int, _84: Int, _85: Int, _86: Int, _87: Int, _88: Int, _89: Int, _90: Int,
+_91: Int, _92: Int, _93: Int, _94: Int, _95: Int, _96: Int, _97: Int, _98: Int, _99: Int, _100: Int,
+_101: Int, _102: Int, _103: Int, _104: Int, _105: Int, _106: Int, _107: Int, _108: Int, _109: Int, _110: Int,
+_111: Int, _112: Int, _113: Int, _114: Int, _115: Int, _116: Int, _117: Int, _118: Int, _119: Int, _120: Int,
+_121: Int, _122: Int, _123: Int, _124: Int, _125: Int, _126: Int, _127: Int, _128: Int, _129: Int, _130: Int,
+_131: Int, _132: Int, _133: Int, _134: Int, _135: Int, _136: Int, _137: Int, _138: Int, _139: Int, _140: Int,
+_141: Int, _142: Int, _143: Int, _144: Int, _145: Int, _146: Int, _147: Int, _148: Int, _149: Int, _150: Int,
+_151: Int, _152: Int, _153: Int, _154: Int, _155: Int, _156: Int, _157: Int, _158: Int, _159: Int, _160: Int,
+_161: Int, _162: Int, _163: Int, _164: Int, _165: Int, _166: Int, _167: Int, _168: Int, _169: Int, _170: Int,
+_171: Int, _172: Int, _173: Int, _174: Int, _175: Int, _176: Int, _177: Int, _178: Int, _179: Int, _180: Int,
+_181: Int, _182: Int, _183: Int, _184: Int, _185: Int, _186: Int, _187: Int, _188: Int, _189: Int, _190: Int,
+_191: Int, _192: Int, _193: Int, _194: Int, _195: Int, _196: Int, _197: Int, _198: Int, _199: Int, _200: Int,
+_201: Int, _202: Int, _203: Int, _204: Int, _205: Int, _206: Int, _207: Int, _208: Int, _209: Int, _210: Int,
+_211: Int, _212: Int, _213: Int, _214: Int, _215: Int, _216: Int, _217: Int, _218: Int, _219: Int, _220: Int,
+_221: Int, _222: Int, _223: Int, _224: Int, _225: Int, _226: Int, _227: Int, _228: Int, _229: Int, _230: Int,
+_231: Int, _232: Int, _233: Int, _234: Int, _235: Int, _236: Int, _237: Int, _238: Int, _239: Int, _240: Int,
+_241: Int, _242: Int, _243: Int, _244: Int, _245: Int, _246: Int, _247: Int, _248: Int, _249: Int, _250: Int,
+_251: Int, _252: Int, _253: Int, _254: Int, _255: Int
+)
+
+class BarOK(
+_1: Int, _2: Int, _3: Int, _4: Int, _5: Int, _6: Int, _7: Int, _8: Int, _9: Int, _10: Int,
+_11: Int, _12: Int, _13: Int, _14: Int, _15: Int, _16: Int, _17: Int, _18: Int, _19: Int, _20: Int,
+_21: Int, _22: Int, _23: Int, _24: Int, _25: Int, _26: Int, _27: Int, _28: Int, _29: Int, _30: Int,
+_31: Int, _32: Int, _33: Int, _34: Int, _35: Int, _36: Int, _37: Int, _38: Int, _39: Int, _40: Int,
+_41: Int, _42: Int, _43: Int, _44: Int, _45: Int, _46: Int, _47: Int, _48: Int, _49: Int, _50: Int,
+_51: Int, _52: Int, _53: Int, _54: Int, _55: Int, _56: Int, _57: Int, _58: Int, _59: Int, _60: Int,
+_61: Int, _62: Int, _63: Int, _64: Int, _65: Int, _66: Int, _67: Int, _68: Int, _69: Int, _70: Int,
+_71: Int, _72: Int, _73: Int, _74: Int, _75: Int, _76: Int, _77: Int, _78: Int, _79: Int, _80: Int,
+_81: Int, _82: Int, _83: Int, _84: Int, _85: Int, _86: Int, _87: Int, _88: Int, _89: Int, _90: Int,
+_91: Int, _92: Int, _93: Int, _94: Int, _95: Int, _96: Int, _97: Int, _98: Int, _99: Int, _100: Int,
+_101: Int, _102: Int, _103: Int, _104: Int, _105: Int, _106: Int, _107: Int, _108: Int, _109: Int, _110: Int,
+_111: Int, _112: Int, _113: Int, _114: Int, _115: Int, _116: Int, _117: Int, _118: Int, _119: Int, _120: Int,
+_121: Int, _122: Int, _123: Int, _124: Int, _125: Int, _126: Int, _127: Int, _128: Int, _129: Int, _130: Int,
+_131: Int, _132: Int, _133: Int, _134: Int, _135: Int, _136: Int, _137: Int, _138: Int, _139: Int, _140: Int,
+_141: Int, _142: Int, _143: Int, _144: Int, _145: Int, _146: Int, _147: Int, _148: Int, _149: Int, _150: Int,
+_151: Int, _152: Int, _153: Int, _154: Int, _155: Int, _156: Int, _157: Int, _158: Int, _159: Int, _160: Int,
+_161: Int, _162: Int, _163: Int, _164: Int, _165: Int, _166: Int, _167: Int, _168: Int, _169: Int, _170: Int,
+_171: Int, _172: Int, _173: Int, _174: Int, _175: Int, _176: Int, _177: Int, _178: Int, _179: Int, _180: Int,
+_181: Int, _182: Int, _183: Int, _184: Int, _185: Int, _186: Int, _187: Int, _188: Int, _189: Int, _190: Int,
+_191: Int, _192: Int, _193: Int, _194: Int, _195: Int, _196: Int, _197: Int, _198: Int, _199: Int, _200: Int,
+_201: Int, _202: Int, _203: Int, _204: Int, _205: Int, _206: Int, _207: Int, _208: Int, _209: Int, _210: Int,
+_211: Int, _212: Int, _213: Int, _214: Int, _215: Int, _216: Int, _217: Int, _218: Int, _219: Int, _220: Int,
+_221: Int, _222: Int, _223: Int, _224: Int, _225: Int, _226: Int, _227: Int, _228: Int, _229: Int, _230: Int,
+_231: Int, _232: Int, _233: Int, _234: Int, _235: Int, _236: Int, _237: Int, _238: Int, _239: Int, _240: Int,
+_241: Int, _242: Int, _243: Int, _244: Int, _245: Int, _246: Int, _247: Int, _248: Int, _249: Int, _250: Int,
+_251: Int, _252: Int, _253: Int, _254: Int)
diff --git a/tests/untried/neg/t7325.check b/tests/untried/neg/t7325.check
new file mode 100644
index 000000000..61c33f99b
--- /dev/null
+++ b/tests/untried/neg/t7325.check
@@ -0,0 +1,19 @@
+t7325.scala:2: error: Missing conversion operator in '%'; use %% for literal %, %n for newline
+ println(f"%")
+ ^
+t7325.scala:4: error: Missing conversion operator in '%'; use %% for literal %, %n for newline
+ println(f"%%%")
+ ^
+t7325.scala:6: error: Missing conversion operator in '%'; use %% for literal %, %n for newline
+ println(f"%%%%%")
+ ^
+t7325.scala:16: error: Missing conversion operator in '%'; use %% for literal %, %n for newline
+ println(f"${0}%")
+ ^
+t7325.scala:19: error: conversions must follow a splice; use %% for literal %, %n for newline
+ println(f"${0}%%%d")
+ ^
+t7325.scala:21: error: conversions must follow a splice; use %% for literal %, %n for newline
+ println(f"${0}%%%%%d")
+ ^
+6 errors found
diff --git a/tests/untried/neg/t7325.scala b/tests/untried/neg/t7325.scala
new file mode 100644
index 000000000..45a726d70
--- /dev/null
+++ b/tests/untried/neg/t7325.scala
@@ -0,0 +1,25 @@
+object Test extends App {
+ println(f"%")
+ println(f"%%")
+ println(f"%%%")
+ println(f"%%%%")
+ println(f"%%%%%")
+ println(f"%%%%%%")
+
+ println(f"%%n")
+ println(f"%%%n")
+ println(f"%%%%n")
+ println(f"%%%%%n")
+ println(f"%%%%%%n")
+ println(f"%%%%%%%n")
+
+ println(f"${0}%")
+ println(f"${0}%d")
+ println(f"${0}%%d")
+ println(f"${0}%%%d")
+ println(f"${0}%%%%d")
+ println(f"${0}%%%%%d")
+
+ println(f"${0}%n")
+ println(f"${0}%d%n")
+}
diff --git a/tests/untried/neg/t7330.check b/tests/untried/neg/t7330.check
new file mode 100644
index 000000000..b96d656d2
--- /dev/null
+++ b/tests/untried/neg/t7330.check
@@ -0,0 +1,5 @@
+t7330.scala:4: error: pattern must be a value: Y[_]
+Note: if you intended to match against the class, try `case _: Y[_]`
+ 0 match { case Y[_] => }
+ ^
+one error found
diff --git a/tests/untried/neg/t7330.scala b/tests/untried/neg/t7330.scala
new file mode 100644
index 000000000..2d1660fad
--- /dev/null
+++ b/tests/untried/neg/t7330.scala
@@ -0,0 +1,5 @@
+class Y[T]
+class Test {
+ // TypeTree is not a valid tree for a pattern
+ 0 match { case Y[_] => }
+}
diff --git a/tests/untried/neg/t7369.check b/tests/untried/neg/t7369.check
new file mode 100644
index 000000000..a4e99f496
--- /dev/null
+++ b/tests/untried/neg/t7369.check
@@ -0,0 +1,15 @@
+t7369.scala:6: warning: unreachable code
+ case Tuple1(X) => // unreachable
+ ^
+t7369.scala:13: warning: unreachable code
+ case Tuple1(true) => // unreachable
+ ^
+t7369.scala:31: warning: unreachable code
+ case Tuple1(X) => // unreachable
+ ^
+t7369.scala:40: warning: unreachable code
+ case Tuple1(null) => // unreachable
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/t7369.flags b/tests/untried/neg/t7369.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t7369.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7369.scala b/tests/untried/neg/t7369.scala
new file mode 100644
index 000000000..87ddfe98b
--- /dev/null
+++ b/tests/untried/neg/t7369.scala
@@ -0,0 +1,43 @@
+object Test {
+ val X, Y = true
+ (null: Tuple1[Boolean]) match {
+ case Tuple1(X) =>
+ case Tuple1(Y) =>
+ case Tuple1(X) => // unreachable
+ case _ =>
+ }
+
+ (null: Tuple1[Boolean]) match {
+ case Tuple1(true) =>
+ case Tuple1(false) =>
+ case Tuple1(true) => // unreachable
+ case _ =>
+ }
+}
+
+
+sealed abstract class B;
+case object True extends B;
+case object False extends B;
+
+object Test2 {
+
+ val X: B = True
+ val Y: B = False
+
+ (null: Tuple1[B]) match {
+ case Tuple1(X) =>
+ case Tuple1(Y) =>
+ case Tuple1(X) => // unreachable
+ case _ =>
+ }
+}
+
+object Test3 {
+ (null: Tuple1[B]) match {
+ case Tuple1(null) =>
+ case Tuple1(True) =>
+ case Tuple1(null) => // unreachable
+ case _ =>
+ }
+}
diff --git a/tests/untried/neg/t7385.check b/tests/untried/neg/t7385.check
new file mode 100644
index 000000000..70d3c3fb6
--- /dev/null
+++ b/tests/untried/neg/t7385.check
@@ -0,0 +1,10 @@
+t7385.scala:2: error: '(' expected but identifier found.
+ do { println("bippy") } while i<10
+ ^
+t7385.scala:6: error: '(' expected but identifier found.
+ while i<10 { () }
+ ^
+t7385.scala:7: error: illegal start of simple expression
+}
+^
+three errors found
diff --git a/tests/untried/neg/t7385.scala b/tests/untried/neg/t7385.scala
new file mode 100644
index 000000000..a7f801098
--- /dev/null
+++ b/tests/untried/neg/t7385.scala
@@ -0,0 +1,7 @@
+object Bar {
+ do { println("bippy") } while i<10
+}
+
+object Foo {
+ while i<10 { () }
+}
diff --git a/tests/untried/neg/t7388.check b/tests/untried/neg/t7388.check
new file mode 100644
index 000000000..0a29e0489
--- /dev/null
+++ b/tests/untried/neg/t7388.check
@@ -0,0 +1,4 @@
+t7388.scala:1: error: doesnotexist is not an enclosing class
+class Test private[doesnotexist]()
+ ^
+one error found
diff --git a/tests/untried/neg/t7388.scala b/tests/untried/neg/t7388.scala
new file mode 100644
index 000000000..9ce9ea11b
--- /dev/null
+++ b/tests/untried/neg/t7388.scala
@@ -0,0 +1 @@
+class Test private[doesnotexist]()
diff --git a/tests/untried/neg/t742.check b/tests/untried/neg/t742.check
new file mode 100644
index 000000000..d35571544
--- /dev/null
+++ b/tests/untried/neg/t742.check
@@ -0,0 +1,6 @@
+t742.scala:5: error: kinds of the type arguments (Crash._1,Crash._2,Any) do not conform to the expected kinds of the type parameters (type m,type n,type z).
+Crash._1's type parameters do not match type m's expected parameters:
+type s1 has one type parameter, but type n has two
+ type p = mul[_1, _2, Any] // mul[_1, _1, Any] needs -Yrecursion
+ ^
+one error found
diff --git a/tests/untried/neg/t742.scala b/tests/untried/neg/t742.scala
new file mode 100644
index 000000000..cc0d7063c
--- /dev/null
+++ b/tests/untried/neg/t742.scala
@@ -0,0 +1,8 @@
+object Crash {
+ type mul[m[n[s[_], z], z], n[s[_], z], z] = m[n, z]
+ type _1[s1[_], z1] = s1[z1]
+ type _2[s1[_], z1] = s1[z1]
+ type p = mul[_1, _2, Any] // mul[_1, _1, Any] needs -Yrecursion
+ // _1[_2, Zero]
+ // _2[Zero]
+}
diff --git a/tests/untried/neg/t7473.check b/tests/untried/neg/t7473.check
new file mode 100644
index 000000000..bc8c29d46
--- /dev/null
+++ b/tests/untried/neg/t7473.check
@@ -0,0 +1,7 @@
+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/tests/untried/neg/t7473.scala b/tests/untried/neg/t7473.scala
new file mode 100644
index 000000000..593231d5f
--- /dev/null
+++ b/tests/untried/neg/t7473.scala
@@ -0,0 +1,7 @@
+
+object Foo {
+ val i,j = 3
+ //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/tests/untried/neg/t7475c.check b/tests/untried/neg/t7475c.check
new file mode 100644
index 000000000..472808131
--- /dev/null
+++ b/tests/untried/neg/t7475c.check
@@ -0,0 +1,7 @@
+t7475c.scala:6: error: value a is not a member of A.this.B
+ println(this.a) // wait, what?
+ ^
+t7475c.scala:7: error: value b is not a member of A.this.B
+ println(this.b) // wait, what?
+ ^
+two errors found
diff --git a/tests/untried/neg/t7475c.scala b/tests/untried/neg/t7475c.scala
new file mode 100644
index 000000000..cd4a8762c
--- /dev/null
+++ b/tests/untried/neg/t7475c.scala
@@ -0,0 +1,9 @@
+class A {
+ private val a: Int = 0
+ private[this] val b: Int = 0
+ class B extends A {
+ def foo(a: A) = a.a // okay
+ println(this.a) // wait, what?
+ println(this.b) // wait, what?
+ }
+}
diff --git a/tests/untried/neg/t7475d.check b/tests/untried/neg/t7475d.check
new file mode 100644
index 000000000..6bd1da0d4
--- /dev/null
+++ b/tests/untried/neg/t7475d.check
@@ -0,0 +1,7 @@
+t7475d.scala:4: error: value priv is not a member of T.this.TT
+ (??? : TT).priv
+ ^
+t7475d.scala:10: error: value priv is not a member of U.this.UU
+ (??? : UU).priv
+ ^
+two errors found
diff --git a/tests/untried/neg/t7475e.check b/tests/untried/neg/t7475e.check
new file mode 100644
index 000000000..48af2be51
--- /dev/null
+++ b/tests/untried/neg/t7475e.check
@@ -0,0 +1,4 @@
+t7475e.scala:8: error: value priv is not a member of Base.this.TT
+ (??? : TT).priv
+ ^
+one error found
diff --git a/tests/untried/neg/t7475e.scala b/tests/untried/neg/t7475e.scala
new file mode 100644
index 000000000..e5c4877d6
--- /dev/null
+++ b/tests/untried/neg/t7475e.scala
@@ -0,0 +1,12 @@
+trait U {
+}
+
+trait Base {
+ private val priv = 0
+
+ type TT = U with T // should exclude `priv`
+ (??? : TT).priv
+}
+
+trait T extends Base {
+}
diff --git a/tests/untried/neg/t7475f.check b/tests/untried/neg/t7475f.check
new file mode 100644
index 000000000..a07a4480e
--- /dev/null
+++ b/tests/untried/neg/t7475f.check
@@ -0,0 +1,10 @@
+t7475f.scala:12: error: method c1 in class C cannot be accessed in C[T]
+ c1 // a member, but inaccessible.
+ ^
+t7475f.scala:13: error: not found: value c2
+ c2 // a member, but inaccessible.
+ ^
+t7475f.scala:26: error: value d2 is not a member of D[Any]
+ other.d2 // not a member
+ ^
+three errors found
diff --git a/tests/untried/neg/t7475f.scala b/tests/untried/neg/t7475f.scala
new file mode 100644
index 000000000..eaac4a2e1
--- /dev/null
+++ b/tests/untried/neg/t7475f.scala
@@ -0,0 +1,28 @@
+class C[T] extends D[T] {
+ private def c1 = 0
+ private[this] def c2 = 0
+}
+
+trait D[T] {
+ self: C[T] =>
+
+ private def d1 = 0
+ private[this] def d2 = 0
+
+ c1 // a member, but inaccessible.
+ c2 // a member, but inaccessible.
+
+ d1 // okay
+ d2 // okay
+
+
+ class C {
+ d1
+ d2
+ }
+
+ def x(other: D[Any]): Unit = {
+ other.d1
+ other.d2 // not a member
+ }
+}
diff --git a/tests/untried/neg/t7494-after-terminal.check b/tests/untried/neg/t7494-after-terminal.check
new file mode 100644
index 000000000..096efe09c
--- /dev/null
+++ b/tests/untried/neg/t7494-after-terminal.check
@@ -0,0 +1,2 @@
+error: [phase assembly, after dependency on terminal phase not allowed: afterterminal => terminal]
+one error found
diff --git a/tests/untried/neg/t7494-after-terminal/ThePlugin.scala b/tests/untried/neg/t7494-after-terminal/ThePlugin.scala
new file mode 100644
index 000000000..e8de8132e
--- /dev/null
+++ b/tests/untried/neg/t7494-after-terminal/ThePlugin.scala
@@ -0,0 +1,31 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "afterterminal"
+ val description = "Declares one plugin that wants to be after the terminal phase"
+ val components = List[PluginComponent](thePhase)
+
+ private object thePhase extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]("terminal")
+
+ val phaseName = ThePlugin.this.name
+
+ def newPhase(prev: Phase) = new ThePhase(prev)
+ }
+
+ private class ThePhase(prev: Phase) extends Phase(prev) {
+ def name = ThePlugin.this.name
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7494-after-terminal/sample_2.flags b/tests/untried/neg/t7494-after-terminal/sample_2.flags
new file mode 100644
index 000000000..b8a476e36
--- /dev/null
+++ b/tests/untried/neg/t7494-after-terminal/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:afterterminal
diff --git a/tests/untried/neg/t7494-after-terminal/sample_2.scala b/tests/untried/neg/t7494-after-terminal/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7494-after-terminal/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7494-after-terminal/scalac-plugin.xml b/tests/untried/neg/t7494-after-terminal/scalac-plugin.xml
new file mode 100644
index 000000000..2558d6fd0
--- /dev/null
+++ b/tests/untried/neg/t7494-after-terminal/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>ignored</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/tests/untried/neg/t7494-before-parser.check b/tests/untried/neg/t7494-before-parser.check
new file mode 100644
index 000000000..9a407923b
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser.check
@@ -0,0 +1,2 @@
+error: [phase assembly, before dependency on parser phase not allowed: parser => beforeparser]
+one error found
diff --git a/tests/untried/neg/t7494-before-parser/ThePlugin.scala b/tests/untried/neg/t7494-before-parser/ThePlugin.scala
new file mode 100644
index 000000000..bb335c9c9
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser/ThePlugin.scala
@@ -0,0 +1,32 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "beforeparser"
+ val description = "Declares one plugin that wants to be before the parser phase"
+ val components = List[PluginComponent](thePhase)
+
+ private object thePhase extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]()
+ override val runsBefore = List[String]("parser")
+
+ val phaseName = ThePlugin.this.name
+
+ def newPhase(prev: Phase) = new ThePhase(prev)
+ }
+
+ private class ThePhase(prev: Phase) extends Phase(prev) {
+ def name = ThePlugin.this.name
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7494-before-parser/sample_2.flags b/tests/untried/neg/t7494-before-parser/sample_2.flags
new file mode 100644
index 000000000..0c92fc8a0
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:beforeparser
diff --git a/tests/untried/neg/t7494-before-parser/sample_2.scala b/tests/untried/neg/t7494-before-parser/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7494-before-parser/scalac-plugin.xml b/tests/untried/neg/t7494-before-parser/scalac-plugin.xml
new file mode 100644
index 000000000..90ff27dc2
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>beforeparser</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/tests/untried/neg/t7494-multi-right-after.check b/tests/untried/neg/t7494-multi-right-after.check
new file mode 100644
index 000000000..151d17741
--- /dev/null
+++ b/tests/untried/neg/t7494-multi-right-after.check
@@ -0,0 +1 @@
+error: Multiple phases want to run right after explicitouter; followers: erasure,multi-rafter; created phase-order.dot
diff --git a/tests/untried/neg/t7494-multi-right-after/ThePlugin.scala b/tests/untried/neg/t7494-multi-right-after/ThePlugin.scala
new file mode 100644
index 000000000..cb9e86e90
--- /dev/null
+++ b/tests/untried/neg/t7494-multi-right-after/ThePlugin.scala
@@ -0,0 +1,31 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "multi-rafter"
+ val description = ""
+ val components = List[PluginComponent](thePhase)
+
+ private object thePhase extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]()
+ override val runsRightAfter = Some("explicitouter")
+ val phaseName = ThePlugin.this.name
+
+ def newPhase(prev: Phase) = new ThePhase(prev)
+ }
+
+ private class ThePhase(prev: Phase) extends Phase(prev) {
+ def name = ThePlugin.this.name
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7494-multi-right-after/sample_2.flags b/tests/untried/neg/t7494-multi-right-after/sample_2.flags
new file mode 100644
index 000000000..9273fb98d
--- /dev/null
+++ b/tests/untried/neg/t7494-multi-right-after/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:multi-rafter
diff --git a/tests/untried/neg/t7494-multi-right-after/sample_2.scala b/tests/untried/neg/t7494-multi-right-after/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7494-multi-right-after/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7494-multi-right-after/scalac-plugin.xml b/tests/untried/neg/t7494-multi-right-after/scalac-plugin.xml
new file mode 100644
index 000000000..2558d6fd0
--- /dev/null
+++ b/tests/untried/neg/t7494-multi-right-after/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>ignored</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/tests/untried/neg/t7494-no-options.check b/tests/untried/neg/t7494-no-options.check
new file mode 100644
index 000000000..e3316f590
--- /dev/null
+++ b/tests/untried/neg/t7494-no-options.check
@@ -0,0 +1,40 @@
+error: Error: ploogin takes no options
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ delambdafy 22 remove lambdas
+ icode 23 generate portable intermediate code
+#partest !-optimise
+ jvm 24 generate JVM bytecode
+ ploogin 25 A sample phase that does so many things it's kind of hard...
+ terminal 26 the last phase during a compilation run
+#partest -optimise
+ inliner 24 optimization: do inlining
+inlinehandlers 25 optimization: inline exception handlers
+ closelim 26 optimization: eliminate uncalled closures
+ constopt 27 optimization: optimize null and other constants
+ dce 28 optimization: eliminate dead code
+ jvm 29 generate JVM bytecode
+ ploogin 30 A sample phase that does so many things it's kind of hard...
+ terminal 31 the last phase during a compilation run
+#partest
diff --git a/tests/untried/neg/t7494-no-options/ploogin_1.scala b/tests/untried/neg/t7494-no-options/ploogin_1.scala
new file mode 100644
index 000000000..dbf433f9a
--- /dev/null
+++ b/tests/untried/neg/t7494-no-options/ploogin_1.scala
@@ -0,0 +1,31 @@
+
+package t6446
+
+import scala.tools.nsc.{ Global, Phase }
+import scala.tools.nsc.plugins.{ Plugin, PluginComponent }
+import scala.reflect.io.Path
+import scala.reflect.io.File
+
+/** A test plugin. */
+class Ploogin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "ploogin"
+ val description = "A sample plugin for testing."
+ val components = List[PluginComponent](TestComponent)
+
+ private object TestComponent extends PluginComponent {
+ val global: Ploogin.this.global.type = Ploogin.this.global
+ //override val runsBefore = List("refchecks")
+ val runsAfter = List("jvm")
+ val phaseName = Ploogin.this.name
+ override def description = "A sample phase that does so many things it's kind of hard to describe briefly."
+ def newPhase(prev: Phase) = new TestPhase(prev)
+ class TestPhase(prev: Phase) extends StdPhase(prev) {
+ override def description = TestComponent.this.description
+ def apply(unit: CompilationUnit): Unit = {
+ // kewl kode
+ }
+ }
+ }
+}
diff --git a/tests/untried/neg/t7494-no-options/sample_2.flags b/tests/untried/neg/t7494-no-options/sample_2.flags
new file mode 100644
index 000000000..7f0f7afe4
--- /dev/null
+++ b/tests/untried/neg/t7494-no-options/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xshow-phases -P:ploogin:inploog
diff --git a/tests/untried/neg/t7494-no-options/sample_2.scala b/tests/untried/neg/t7494-no-options/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7494-no-options/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7494-no-options/scalac-plugin.xml b/tests/untried/neg/t7494-no-options/scalac-plugin.xml
new file mode 100644
index 000000000..e849bb591
--- /dev/null
+++ b/tests/untried/neg/t7494-no-options/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+<name>sample-plugin</name>
+<classname>t6446.Ploogin</classname>
+</plugin>
diff --git a/tests/untried/neg/t7494-right-after-before.check b/tests/untried/neg/t7494-right-after-before.check
new file mode 100644
index 000000000..7e83daab4
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-before.check
@@ -0,0 +1 @@
+error: Phase erasure can't follow explicitouter, created phase-order.dot
diff --git a/tests/untried/neg/t7494-right-after-before/ThePlugin.scala b/tests/untried/neg/t7494-right-after-before/ThePlugin.scala
new file mode 100644
index 000000000..967c1fb30
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-before/ThePlugin.scala
@@ -0,0 +1,31 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "rafter-before-1"
+ val description = ""
+ val components = List[PluginComponent](thePhase1)
+
+ private object thePhase1 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]("refchecks")
+ override val runsBefore = List[String]("erasure")
+ val phaseName = ThePlugin.this.name
+
+ def newPhase(prev: Phase) = new ThePhase(prev)
+ }
+
+ private class ThePhase(prev: Phase) extends Phase(prev) {
+ def name = ThePlugin.this.name
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7494-right-after-before/sample_2.flags b/tests/untried/neg/t7494-right-after-before/sample_2.flags
new file mode 100644
index 000000000..97d0f5b5f
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-before/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:rafter-before-1
diff --git a/tests/untried/neg/t7494-right-after-before/sample_2.scala b/tests/untried/neg/t7494-right-after-before/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-before/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7494-right-after-before/scalac-plugin.xml b/tests/untried/neg/t7494-right-after-before/scalac-plugin.xml
new file mode 100644
index 000000000..2558d6fd0
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-before/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>ignored</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/tests/untried/neg/t7494-right-after-terminal.check b/tests/untried/neg/t7494-right-after-terminal.check
new file mode 100644
index 000000000..6fe4f63c8
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-terminal.check
@@ -0,0 +1,2 @@
+error: [phase assembly, right after dependency on terminal phase not allowed: rightafterterminal => terminal]
+one error found
diff --git a/tests/untried/neg/t7494-right-after-terminal/ThePlugin.scala b/tests/untried/neg/t7494-right-after-terminal/ThePlugin.scala
new file mode 100644
index 000000000..7c4d08458
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-terminal/ThePlugin.scala
@@ -0,0 +1,32 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "rightafterterminal"
+ val description = "Declares one plugin that wants to be right after the terminal phase"
+ val components = List[PluginComponent](thePhase)
+
+ private object thePhase extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]()
+ override val runsRightAfter = Some("terminal")
+
+ val phaseName = ThePlugin.this.name
+
+ def newPhase(prev: Phase) = new ThePhase(prev)
+ }
+
+ private class ThePhase(prev: Phase) extends Phase(prev) {
+ def name = ThePlugin.this.name
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7494-right-after-terminal/sample_2.flags b/tests/untried/neg/t7494-right-after-terminal/sample_2.flags
new file mode 100644
index 000000000..da046ba5f
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-terminal/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:rightafterterminal
diff --git a/tests/untried/neg/t7494-right-after-terminal/sample_2.scala b/tests/untried/neg/t7494-right-after-terminal/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-terminal/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7494-right-after-terminal/scalac-plugin.xml b/tests/untried/neg/t7494-right-after-terminal/scalac-plugin.xml
new file mode 100644
index 000000000..2558d6fd0
--- /dev/null
+++ b/tests/untried/neg/t7494-right-after-terminal/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>ignored</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/tests/untried/neg/t750.check b/tests/untried/neg/t750.check
new file mode 100644
index 000000000..c17ca334e
--- /dev/null
+++ b/tests/untried/neg/t750.check
@@ -0,0 +1,15 @@
+Test_2.scala:4: error: type mismatch;
+ found : Array[Int]
+ required: Array[? with Object]
+Note: Int >: ? with Object, but class Array is invariant in type T.
+You may wish to investigate a wildcard type such as `_ >: ? with Object`. (SLS 3.2.10)
+ AO_1.f(a)
+ ^
+Test_2.scala:5: error: type mismatch;
+ found : Array[Int]
+ required: Array[Int]
+Note: Int >: Int, but class Array is invariant in type T.
+You may wish to investigate a wildcard type such as `_ >: Int`. (SLS 3.2.10)
+ AO_1.f[Int](a)
+ ^
+two errors found
diff --git a/tests/untried/neg/t750/AO_1.java b/tests/untried/neg/t750/AO_1.java
new file mode 100644
index 000000000..4c7360ec6
--- /dev/null
+++ b/tests/untried/neg/t750/AO_1.java
@@ -0,0 +1,5 @@
+public class AO_1 {
+ public static <T> void f(T[] ar0) {
+ System.out.println(ar0);
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t750/Test_2.scala b/tests/untried/neg/t750/Test_2.scala
new file mode 100644
index 000000000..80977431c
--- /dev/null
+++ b/tests/untried/neg/t750/Test_2.scala
@@ -0,0 +1,6 @@
+// t750
+object Test extends App {
+ val a = Array(1, 2, 3)
+ AO_1.f(a)
+ AO_1.f[Int](a)
+}
diff --git a/tests/untried/neg/t7501.check b/tests/untried/neg/t7501.check
new file mode 100644
index 000000000..2ded07c7e
--- /dev/null
+++ b/tests/untried/neg/t7501.check
@@ -0,0 +1,7 @@
+t7501_2.scala:2: error: value name is not a member of A
+ def foo(a: A) = a.name
+ ^
+t7501_2.scala:4: error: not found: type X
+ type TP = X // already failed before this fix
+ ^
+two errors found
diff --git a/tests/untried/neg/t7501/t7501_1.scala b/tests/untried/neg/t7501/t7501_1.scala
new file mode 100644
index 000000000..323c32762
--- /dev/null
+++ b/tests/untried/neg/t7501/t7501_1.scala
@@ -0,0 +1,12 @@
+object Test2 {
+ def test[X](name: String) = 12
+}
+class strangeTest(x: Int) extends scala.annotation.StaticAnnotation
+
+trait A {
+ // When picking the type of `test`, the value parameter
+ // `x` was pickled with the owner `trait A`. On unpickling,
+ // it was taken to be a member!
+ @strangeTest(Test2.test("test"))
+ def test(x: String): Unit
+}
diff --git a/tests/untried/neg/t7501/t7501_2.scala b/tests/untried/neg/t7501/t7501_2.scala
new file mode 100644
index 000000000..044caea3c
--- /dev/null
+++ b/tests/untried/neg/t7501/t7501_2.scala
@@ -0,0 +1,5 @@
+object Test {
+ def foo(a: A) = a.name
+
+ type TP = X // already failed before this fix
+}
diff --git a/tests/untried/neg/t7507.check b/tests/untried/neg/t7507.check
new file mode 100644
index 000000000..de30fc705
--- /dev/null
+++ b/tests/untried/neg/t7507.check
@@ -0,0 +1,4 @@
+t7507.scala:6: error: not found: value bippy
+ locally(bippy)
+ ^
+one error found
diff --git a/tests/untried/neg/t7507.scala b/tests/untried/neg/t7507.scala
new file mode 100644
index 000000000..1b4756d95
--- /dev/null
+++ b/tests/untried/neg/t7507.scala
@@ -0,0 +1,7 @@
+trait Cake extends Slice {
+ private[this] val bippy = ()
+}
+
+trait Slice { self: Cake =>
+ locally(bippy)
+}
diff --git a/tests/untried/neg/t7509.check b/tests/untried/neg/t7509.check
new file mode 100644
index 000000000..eaa6303cf
--- /dev/null
+++ b/tests/untried/neg/t7509.check
@@ -0,0 +1,12 @@
+t7509.scala:3: error: inferred type arguments [Int] do not conform to method crash's type parameter bounds [R <: AnyRef]
+ crash(42)
+ ^
+t7509.scala:3: error: type mismatch;
+ found : Int(42)
+ required: R
+ crash(42)
+ ^
+t7509.scala:3: error: could not find implicit value for parameter ev: R
+ crash(42)
+ ^
+three errors found
diff --git a/tests/untried/neg/t7509.scala b/tests/untried/neg/t7509.scala
new file mode 100644
index 000000000..3cba801ea
--- /dev/null
+++ b/tests/untried/neg/t7509.scala
@@ -0,0 +1,4 @@
+object NMWE {
+ def crash[R <: AnyRef](f: R)(implicit ev: R): Any = ???
+ crash(42)
+}
diff --git a/tests/untried/neg/t750b.check b/tests/untried/neg/t750b.check
new file mode 100644
index 000000000..72a249191
--- /dev/null
+++ b/tests/untried/neg/t750b.check
@@ -0,0 +1,15 @@
+Test.scala:4: error: type mismatch;
+ found : Array[Int]
+ required: Array[? with Object]
+Note: Int >: ? with Object, but class Array is invariant in type T.
+You may wish to investigate a wildcard type such as `_ >: ? with Object`. (SLS 3.2.10)
+ AO.f(a)
+ ^
+Test.scala:5: error: type mismatch;
+ found : Array[Int]
+ required: Array[Int]
+Note: Int >: Int, but class Array is invariant in type T.
+You may wish to investigate a wildcard type such as `_ >: Int`. (SLS 3.2.10)
+ AO.f[Int](a)
+ ^
+two errors found
diff --git a/tests/untried/neg/t750b/AO.java b/tests/untried/neg/t750b/AO.java
new file mode 100644
index 000000000..060baf9a3
--- /dev/null
+++ b/tests/untried/neg/t750b/AO.java
@@ -0,0 +1,5 @@
+public class AO {
+ public static <T> void f(T[] ar0) {
+ System.out.println(ar0);
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t750b/Test.scala b/tests/untried/neg/t750b/Test.scala
new file mode 100644
index 000000000..5f792a7be
--- /dev/null
+++ b/tests/untried/neg/t750b/Test.scala
@@ -0,0 +1,6 @@
+// t750
+object Test extends App {
+ val a = Array(1, 2, 3)
+ AO.f(a)
+ AO.f[Int](a)
+}
diff --git a/tests/untried/neg/t7519-b.check b/tests/untried/neg/t7519-b.check
new file mode 100644
index 000000000..bc8500b2b
--- /dev/null
+++ b/tests/untried/neg/t7519-b.check
@@ -0,0 +1,6 @@
+Use_2.scala:8: error: type mismatch;
+ found : String
+ required: Q
+ val x: Q = ex.Mac.mac("asdf")
+ ^
+one error found
diff --git a/tests/untried/neg/t7519-b/Mac_1.scala b/tests/untried/neg/t7519-b/Mac_1.scala
new file mode 100644
index 000000000..55b583d24
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7519-b/Use_2.scala b/tests/untried/neg/t7519-b/Use_2.scala
new file mode 100644
index 000000000..0d63eeed5
--- /dev/null
+++ b/tests/untried/neg/t7519-b/Use_2.scala
@@ -0,0 +1,10 @@
+import scala.language.implicitConversions
+
+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/tests/untried/neg/t7519.check b/tests/untried/neg/t7519.check
new file mode 100644
index 000000000..df54abaa3
--- /dev/null
+++ b/tests/untried/neg/t7519.check
@@ -0,0 +1,11 @@
+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: 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/tests/untried/neg/t7519.scala b/tests/untried/neg/t7519.scala
new file mode 100644
index 000000000..aea0f35d8
--- /dev/null
+++ b/tests/untried/neg/t7519.scala
@@ -0,0 +1,18 @@
+class C {
+ implicit def conversion(m: Int)(implicit nada: Nothing): String = ???
+
+ class C { // rename class to get correct error, can't find implicit: Nothing.
+ locally(0 : String) // was: "value conversion is not a member of C.this.C"
+ }
+}
+
+object Test2 {
+ trait T; trait U
+ new T {
+ implicit def conversion(m: Int)(implicit nada: Nothing): String = ???
+
+ new U { // nested anonymous classes also share a name.
+ locally(0 : String) // was: "value conversion is not a member of U"
+ }
+ }
+}
diff --git a/tests/untried/neg/t752.check b/tests/untried/neg/t752.check
new file mode 100644
index 000000000..a91bba46e
--- /dev/null
+++ b/tests/untried/neg/t752.check
@@ -0,0 +1,6 @@
+t752.scala:6: error: type mismatch;
+ found : String => Unit
+ required: Int => Unit
+ f(g _)
+ ^
+one error found
diff --git a/tests/untried/neg/t752.scala b/tests/untried/neg/t752.scala
new file mode 100644
index 000000000..00f45e323
--- /dev/null
+++ b/tests/untried/neg/t752.scala
@@ -0,0 +1,8 @@
+object Test
+{
+ def f(x : Int => Unit) : Unit = ()
+ def g(x : String) : Unit = ()
+ def main(argv : Array[String]) = {
+ f(g _)
+ }
+}
diff --git a/tests/untried/neg/t7605-deprecation.check b/tests/untried/neg/t7605-deprecation.check
new file mode 100644
index 000000000..6db94613a
--- /dev/null
+++ b/tests/untried/neg/t7605-deprecation.check
@@ -0,0 +1,15 @@
+t7605-deprecation.scala:2: warning: Procedure syntax is deprecated. Convert procedure `bar` to method by adding `: Unit =`.
+ def bar {}
+ ^
+t7605-deprecation.scala:3: warning: Procedure syntax is deprecated. Convert procedure `baz` to method by adding `: Unit`.
+ def baz
+ ^
+t7605-deprecation.scala:4: warning: Procedure syntax is deprecated. Convert procedure `boo` to method by adding `: Unit`.
+ def boo(i: Int, l: Long)
+ ^
+t7605-deprecation.scala:5: warning: Procedure syntax is deprecated. Convert procedure `boz` to method by adding `: Unit =`.
+ def boz(i: Int, l: Long) {}
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/t7605-deprecation.flags b/tests/untried/neg/t7605-deprecation.flags
new file mode 100644
index 000000000..0a7cb7d20
--- /dev/null
+++ b/tests/untried/neg/t7605-deprecation.flags
@@ -0,0 +1 @@
+-deprecation -Xfuture -Xfatal-warnings
diff --git a/tests/untried/neg/t7605-deprecation.scala b/tests/untried/neg/t7605-deprecation.scala
new file mode 100644
index 000000000..30cd21bd6
--- /dev/null
+++ b/tests/untried/neg/t7605-deprecation.scala
@@ -0,0 +1,8 @@
+abstract class Foo {
+ def bar: Unit = {}
+ def baz
+ def boo(i: Int, l: Long)
+ def boz(i: Int, l: Long): Unit = {}
+ def this(i: Int) { this() } // Don't complain here!
+ def foz: Unit // Don't complain here!
+}
diff --git a/tests/untried/neg/t7622-cyclic-dependency.check b/tests/untried/neg/t7622-cyclic-dependency.check
new file mode 100644
index 000000000..3546964f5
--- /dev/null
+++ b/tests/untried/neg/t7622-cyclic-dependency.check
@@ -0,0 +1 @@
+error: Cycle in phase dependencies detected at cyclicdependency1, created phase-cycle.dot
diff --git a/tests/untried/neg/t7622-cyclic-dependency/ThePlugin.scala b/tests/untried/neg/t7622-cyclic-dependency/ThePlugin.scala
new file mode 100644
index 000000000..8074966bb
--- /dev/null
+++ b/tests/untried/neg/t7622-cyclic-dependency/ThePlugin.scala
@@ -0,0 +1,40 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "cyclicdependency"
+ val description = "Declares two phases that have a cyclic dependency"
+ val components = List[PluginComponent](thePhase1,thePhase2)
+
+ private object thePhase1 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]("tailcalls","cyclicdependency2")
+
+ val phaseName = ThePlugin.this.name + "1"
+
+ def newPhase(prev: Phase) = new ThePhase(prev, phaseName)
+ }
+
+ private object thePhase2 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]("dce","cyclicdependency1")
+
+ val phaseName = ThePlugin.this.name + "2"
+
+ def newPhase(prev: Phase) = new ThePhase(prev, phaseName)
+ }
+
+ private class ThePhase(prev: Phase, val name: String) extends Phase(prev) {
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7622-cyclic-dependency/sample_2.flags b/tests/untried/neg/t7622-cyclic-dependency/sample_2.flags
new file mode 100644
index 000000000..db25b88a1
--- /dev/null
+++ b/tests/untried/neg/t7622-cyclic-dependency/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:cyclicdependency
diff --git a/tests/untried/neg/t7622-cyclic-dependency/sample_2.scala b/tests/untried/neg/t7622-cyclic-dependency/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7622-cyclic-dependency/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7622-cyclic-dependency/scalac-plugin.xml b/tests/untried/neg/t7622-cyclic-dependency/scalac-plugin.xml
new file mode 100644
index 000000000..2558d6fd0
--- /dev/null
+++ b/tests/untried/neg/t7622-cyclic-dependency/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>ignored</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/tests/untried/neg/t7622-missing-dependency.check b/tests/untried/neg/t7622-missing-dependency.check
new file mode 100644
index 000000000..a0d0e3087
--- /dev/null
+++ b/tests/untried/neg/t7622-missing-dependency.check
@@ -0,0 +1,2 @@
+error: Phase 'myplugin' requires: List(missing)
+one error found
diff --git a/tests/untried/neg/t7622-missing-dependency/ThePlugin.scala b/tests/untried/neg/t7622-missing-dependency/ThePlugin.scala
new file mode 100644
index 000000000..0fcbc6309
--- /dev/null
+++ b/tests/untried/neg/t7622-missing-dependency/ThePlugin.scala
@@ -0,0 +1,33 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "myplugin"
+ val description = "Declares one plugin with a missing requirement"
+ val components = List[PluginComponent](thePhase)
+
+ private object thePhase extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]("typer")
+
+ val phaseName = ThePlugin.this.name
+
+ override val requires = List("missing")
+
+ def newPhase(prev: Phase) = new ThePhase(prev)
+ }
+
+ private class ThePhase(prev: Phase) extends Phase(prev) {
+ def name = thePhase.phaseName
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7622-missing-dependency/sample_2.flags b/tests/untried/neg/t7622-missing-dependency/sample_2.flags
new file mode 100644
index 000000000..d69035100
--- /dev/null
+++ b/tests/untried/neg/t7622-missing-dependency/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:myplugin
diff --git a/tests/untried/neg/t7622-missing-dependency/sample_2.scala b/tests/untried/neg/t7622-missing-dependency/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7622-missing-dependency/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7622-missing-dependency/scalac-plugin.xml b/tests/untried/neg/t7622-missing-dependency/scalac-plugin.xml
new file mode 100644
index 000000000..3c14061dc
--- /dev/null
+++ b/tests/untried/neg/t7622-missing-dependency/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>myplugin</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/tests/untried/neg/t7622-missing-required.check b/tests/untried/neg/t7622-missing-required.check
new file mode 100644
index 000000000..598217858
--- /dev/null
+++ b/tests/untried/neg/t7622-missing-required.check
@@ -0,0 +1,2 @@
+error: Missing required plugin: special-plugin
+one error found
diff --git a/tests/untried/neg/t7622-missing-required.flags b/tests/untried/neg/t7622-missing-required.flags
new file mode 100644
index 000000000..65deac6fe
--- /dev/null
+++ b/tests/untried/neg/t7622-missing-required.flags
@@ -0,0 +1 @@
+-Xplugin-require:special-plugin
diff --git a/tests/untried/neg/t7622-missing-required.scala b/tests/untried/neg/t7622-missing-required.scala
new file mode 100644
index 000000000..a0ba487b2
--- /dev/null
+++ b/tests/untried/neg/t7622-missing-required.scala
@@ -0,0 +1,4 @@
+
+// the amazing features of this trait
+// are unlocked by compiling with a special plugin.
+trait Amazing
diff --git a/tests/untried/neg/t7622-multi-followers.check b/tests/untried/neg/t7622-multi-followers.check
new file mode 100644
index 000000000..d123853a5
--- /dev/null
+++ b/tests/untried/neg/t7622-multi-followers.check
@@ -0,0 +1 @@
+error: Multiple phases want to run right after parser; followers: multi1,multi2; created phase-order.dot
diff --git a/tests/untried/neg/t7622-multi-followers/ThePlugin.scala b/tests/untried/neg/t7622-multi-followers/ThePlugin.scala
new file mode 100644
index 000000000..36ee84f94
--- /dev/null
+++ b/tests/untried/neg/t7622-multi-followers/ThePlugin.scala
@@ -0,0 +1,44 @@
+package scala.test.plugins
+
+import scala.tools.nsc
+import nsc.Global
+import nsc.Phase
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+class ThePlugin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "multi"
+ val description = "Declares two phases that both follow parser"
+ val components = List[PluginComponent](thePhase1,thePhase2)
+
+ private object thePhase1 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]()
+
+ override val runsRightAfter = Some("parser")
+
+ val phaseName = ThePlugin.this.name + "1"
+
+ def newPhase(prev: Phase) = new ThePhase(prev, phaseName)
+ }
+
+ private object thePhase2 extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]()
+
+ override val runsRightAfter = Some("parser")
+
+ val phaseName = ThePlugin.this.name + "2"
+
+ def newPhase(prev: Phase) = new ThePhase(prev, phaseName)
+ }
+
+ private class ThePhase(prev: Phase, val name: String) extends Phase(prev) {
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7622-multi-followers/sample_2.flags b/tests/untried/neg/t7622-multi-followers/sample_2.flags
new file mode 100644
index 000000000..d2e83e972
--- /dev/null
+++ b/tests/untried/neg/t7622-multi-followers/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:multi
diff --git a/tests/untried/neg/t7622-multi-followers/sample_2.scala b/tests/untried/neg/t7622-multi-followers/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7622-multi-followers/sample_2.scala
@@ -0,0 +1,6 @@
+
+package sample
+
+// just a sample that is compiled with the sample plugin enabled
+object Sample extends App {
+}
diff --git a/tests/untried/neg/t7622-multi-followers/scalac-plugin.xml b/tests/untried/neg/t7622-multi-followers/scalac-plugin.xml
new file mode 100644
index 000000000..2558d6fd0
--- /dev/null
+++ b/tests/untried/neg/t7622-multi-followers/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>ignored</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+
diff --git a/tests/untried/neg/t7629-view-bounds-deprecation.check b/tests/untried/neg/t7629-view-bounds-deprecation.check
new file mode 100644
index 000000000..ed77c15c5
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7629-view-bounds-deprecation.flags b/tests/untried/neg/t7629-view-bounds-deprecation.flags
new file mode 100644
index 000000000..43a25d4cc
--- /dev/null
+++ b/tests/untried/neg/t7629-view-bounds-deprecation.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings -Xfuture
diff --git a/tests/untried/neg/t7629-view-bounds-deprecation.scala b/tests/untried/neg/t7629-view-bounds-deprecation.scala
new file mode 100644
index 000000000..a6ede1fcc
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7636.check b/tests/untried/neg/t7636.check
new file mode 100644
index 000000000..f70d50bee
--- /dev/null
+++ b/tests/untried/neg/t7636.check
@@ -0,0 +1,10 @@
+t7636.scala:3: error: illegal inheritance;
+ self-type Main.C does not conform to Main.ResultTable[_$3]'s selftype Main.ResultTable[_$3]
+ class C extends ResultTable(Left(5):Either[_,_])(5)
+ ^
+t7636.scala:3: error: type mismatch;
+ found : Either[_$2,_$3(in constructor C)] where type _$3(in constructor C), type _$2
+ required: Either[_, _$3(in object Main)] where type _$3(in object Main)
+ class C extends ResultTable(Left(5):Either[_,_])(5)
+ ^
+two errors found
diff --git a/tests/untried/neg/t7636.scala b/tests/untried/neg/t7636.scala
new file mode 100644
index 000000000..e801beacc
--- /dev/null
+++ b/tests/untried/neg/t7636.scala
@@ -0,0 +1,7 @@
+object Main extends App{
+ class ResultTable[E]( query : Either[_,E] )( columns : Int )
+ class C extends ResultTable(Left(5):Either[_,_])(5)
+}
+// Inference of the existential type for the parent type argument
+// E still fails. That looks tricky to fix, see the comments in SI-7636.
+// But we at least prevent a cascading NPE.
diff --git a/tests/untried/neg/t765.check b/tests/untried/neg/t765.check
new file mode 100644
index 000000000..5a5f60325
--- /dev/null
+++ b/tests/untried/neg/t765.check
@@ -0,0 +1,4 @@
+t765.scala:3: error: not found: type Bar123
+ val bar = new Bar123
+ ^
+one error found
diff --git a/tests/untried/neg/t765.scala b/tests/untried/neg/t765.scala
new file mode 100644
index 000000000..3e5371b53
--- /dev/null
+++ b/tests/untried/neg/t765.scala
@@ -0,0 +1,7 @@
+object test {
+ for (e <- List()) { //required
+ val bar = new Bar123
+ val res = bar.f //required
+ ()
+ }
+}
diff --git a/tests/untried/neg/t766.check b/tests/untried/neg/t766.check
new file mode 100644
index 000000000..92039ed1f
--- /dev/null
+++ b/tests/untried/neg/t766.check
@@ -0,0 +1,4 @@
+t766.scala:5: error: not found: value badIdentifier
+ val p = badIdentifier
+ ^
+one error found
diff --git a/tests/untried/neg/t766.scala b/tests/untried/neg/t766.scala
new file mode 100644
index 000000000..b4b04d964
--- /dev/null
+++ b/tests/untried/neg/t766.scala
@@ -0,0 +1,9 @@
+object B
+{
+ def a = {
+ for (n <- Nil; m <- Nil) {
+ val p = badIdentifier
+ false
+ }
+ }
+}
diff --git a/tests/untried/neg/t7669.check b/tests/untried/neg/t7669.check
new file mode 100644
index 000000000..c090ed18c
--- /dev/null
+++ b/tests/untried/neg/t7669.check
@@ -0,0 +1,7 @@
+t7669.scala:9: warning: match may not be exhaustive.
+It would fail on the following input: NotHandled(_)
+ def exhausto(expr: Expr): Unit = expr match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t7669.flags b/tests/untried/neg/t7669.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t7669.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t7669.scala b/tests/untried/neg/t7669.scala
new file mode 100644
index 000000000..12441ec05
--- /dev/null
+++ b/tests/untried/neg/t7669.scala
@@ -0,0 +1,13 @@
+object Test {
+
+ sealed abstract class Expr
+ // Change type of `arg` to `Any` and the exhaustiveness warning
+ // is issued below
+ case class Op(arg: Expr) extends Expr
+ case class NotHandled(num: Double) extends Expr
+
+ def exhausto(expr: Expr): Unit = expr match {
+ case Op(Op(_)) =>
+ case Op(_) =>
+ }
+}
diff --git a/tests/untried/neg/t771.check b/tests/untried/neg/t771.check
new file mode 100644
index 000000000..c0d1e002f
--- /dev/null
+++ b/tests/untried/neg/t771.check
@@ -0,0 +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/tests/untried/neg/t771.scala b/tests/untried/neg/t771.scala
new file mode 100755
index 000000000..26bf44164
--- /dev/null
+++ b/tests/untried/neg/t771.scala
@@ -0,0 +1,5 @@
+class Foo {
+ def a = c(b)
+ def b[List[AnyRef]] = new java.util.Iterator[List[Object]] { }
+ def c[A](it:java.util.Iterator[A]) = new scala.Iterator[A]
+}
diff --git a/tests/untried/neg/t7715.check b/tests/untried/neg/t7715.check
new file mode 100644
index 000000000..4ee6b6c95
--- /dev/null
+++ b/tests/untried/neg/t7715.check
@@ -0,0 +1,13 @@
+t7715.scala:8: error: error in interpolated string: identifier or block expected
+ days map s"On the $_th day of Christmas" foreach println
+ ^
+t7715.scala:10: error: error in interpolated string: identifier or block expected
+ val rf = (n: Int) => s"\\*{$_}"(n).r
+ ^
+t7715.scala:17: error: unbound placeholder parameter
+ days zip days map s"${_: Int} by ${_: Int}".tupled foreach println
+ ^
+t7715.scala:17: error: unbound placeholder parameter
+ days zip days map s"${_: Int} by ${_: Int}".tupled foreach println
+ ^
+four errors found
diff --git a/tests/untried/neg/t7715.scala b/tests/untried/neg/t7715.scala
new file mode 100644
index 000000000..637ab8df6
--- /dev/null
+++ b/tests/untried/neg/t7715.scala
@@ -0,0 +1,18 @@
+
+import PartialFunction.cond
+import util._
+
+object Test extends App {
+ val days = (1 to 12).toList
+
+ days map s"On the $_th day of Christmas" foreach println
+
+ val rf = (n: Int) => s"\\*{$_}"(n).r
+ def stars(n: Int)(s: String) = {
+ val r = rf(n)
+ cond(s) { case r(_*) => true }
+ }
+ Console println stars(5)("*****")
+
+ days zip days map s"${_: Int} by ${_: Int}".tupled foreach println
+}
diff --git a/tests/untried/neg/t7721.check b/tests/untried/neg/t7721.check
new file mode 100644
index 000000000..ade1ca3b2
--- /dev/null
+++ b/tests/untried/neg/t7721.check
@@ -0,0 +1,27 @@
+t7721.scala:11: warning: abstract type pattern A.this.Foo is unchecked since it is eliminated by erasure
+ case x: Foo with Concrete => x.bippy + x.conco
+ ^
+t7721.scala:15: warning: abstract type pattern A.this.Foo is unchecked since it is eliminated by erasure
+ case x: Concrete with Foo => x.bippy + x.conco
+ ^
+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
+ ^
+t7721.scala:43: warning: abstract type pattern B.this.Foo is unchecked since it is eliminated by erasure
+ case x: Concrete with Foo => x.bippy + x.dingo + x.conco
+ ^
+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.
+8 warnings found
+one error found
diff --git a/tests/untried/neg/t7721.flags b/tests/untried/neg/t7721.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t7721.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7721.scala b/tests/untried/neg/t7721.scala
new file mode 100644
index 000000000..9ac7b60f0
--- /dev/null
+++ b/tests/untried/neg/t7721.scala
@@ -0,0 +1,140 @@
+import scala.language.reflectiveCalls
+
+trait A {
+ trait Concrete { def conco: Int = 1 }
+ type Foo <: { def bippy: Int }
+ type Bar <: { def barry: Int }
+
+ implicit def barTag: scala.reflect.ClassTag[Bar]
+
+ def f1(x: Any) = x match {
+ case x: Foo with Concrete => x.bippy + x.conco
+ case _ => -1
+ }
+ def f2(x: Any) = x match {
+ case x: Concrete with Foo => x.bippy + x.conco
+ case _ => -1
+ }
+ def f3(x: Any) = x match {
+ case x: Foo with Bar => x.bippy + x.barry
+ case _ => -1
+ }
+ def f4(x: Any) = x match {
+ case x: (Foo @unchecked) => x.bippy // warns, suppressed
+ case _ => -1
+ }
+ def f5(x: Any) = x match {
+ case x: (Bar @unchecked) => x.barry // warns (but about the "outer reference"), suppressed
+ case _ => -1
+ }
+}
+
+trait B extends A {
+ type Foo <: { def bippy: Int ; def dingo: Int }
+ type Bar <: { def barry: Int ; def bongo: Int }
+
+ override implicit def barTag: scala.reflect.ClassTag[Bar]
+
+ override def f1(x: Any) = x match {
+ case x: Foo with Concrete => x.bippy + x.dingo + x.conco
+ case _ => -1
+ }
+ override def f2(x: Any) = x match {
+ case x: Concrete with Foo => x.bippy + x.dingo + x.conco
+ case _ => -1
+ }
+ override def f3(x: Any) = x match {
+ case x: Foo with Bar with Concrete => x.bippy + x.barry + x.dingo + x.conco + x.bongo
+ case _ => -1
+ }
+ override def f4(x: Any) = x match {
+ case x: (Foo @unchecked) => x.bippy + x.dingo // warns, suppressed
+ case _ => -1
+ }
+ override def f5(x: Any) = x match {
+ case x: (Bar @unchecked) => x.barry + x.bongo // warns (but about the "outer reference"), suppressed
+ case _ => -1
+ }
+}
+
+object Test {
+ abstract class Base extends A {
+ trait Foo {
+ def bippy = 2
+ def dingo = 3
+ }
+ trait Bar {
+ def barry = 2
+ def bongo = 3
+ }
+ implicit def barTag: scala.reflect.ClassTag[Bar] = scala.reflect.ClassTag(classOf[Bar])
+
+ def run(): Unit = {
+ println("f1")
+ wrap(f1(new Concrete {}))
+ wrap(f1(new Foo {}))
+ wrap(f1(new Bar {}))
+ wrap(f1(new Foo with Concrete {}))
+ wrap(f1(new Concrete with Foo {}))
+
+ println("\nf2")
+ wrap(f2(new Concrete {}))
+ wrap(f2(new Foo {}))
+ wrap(f2(new Bar {}))
+ wrap(f2(new Foo with Concrete {}))
+ wrap(f2(new Concrete with Foo {}))
+ wrap(f2(new Bar with Concrete {}))
+ wrap(f2(new Concrete with Bar {}))
+ wrap(f2(new Concrete with Foo with Bar {}))
+ wrap(f2(new Foo with Bar with Concrete {}))
+
+ println("\nf3")
+ wrap(f3(new Concrete {}))
+ wrap(f3(new Foo {}))
+ wrap(f3(new Bar {}))
+ wrap(f3(new Foo with Concrete {}))
+ wrap(f3(new Concrete with Foo {}))
+ wrap(f3(new Bar with Concrete {}))
+ wrap(f3(new Concrete with Bar {}))
+ wrap(f3(new Concrete with Foo with Bar {}))
+ wrap(f3(new Foo with Bar with Concrete {}))
+
+ println("\nf4")
+ wrap(f4(new Concrete {}))
+ wrap(f4(new Foo {}))
+ wrap(f4(new Bar {}))
+ wrap(f4(new Foo with Concrete {}))
+ wrap(f4(new Concrete with Foo {}))
+ wrap(f4(new Bar with Concrete {}))
+ wrap(f4(new Concrete with Bar {}))
+ wrap(f4(new Concrete with Foo with Bar {}))
+ wrap(f4(new Foo with Bar with Concrete {}))
+
+ println("\nf5")
+ wrap(f5(new Concrete {}))
+ wrap(f5(new Foo {}))
+ wrap(f5(new Bar {}))
+ wrap(f5(new Foo with Concrete {}))
+ wrap(f5(new Concrete with Foo {}))
+ wrap(f5(new Bar with Concrete {}))
+ wrap(f5(new Concrete with Bar {}))
+ wrap(f5(new Concrete with Foo with Bar {}))
+ wrap(f5(new Foo with Bar with Concrete {}))
+ }
+ }
+
+ object ao extends Base
+ object bo extends Base with B
+
+ private def wrap(body: => Any): Unit = {
+ try println(body)
+ catch { case ex: NoSuchMethodException => println(ex) }
+ }
+
+ def main(args: Array[String]): Unit = {
+ ao.run()
+ bo.run()
+ }
+}
+
+// java.lang.NoSuchMethodException: Test$$anon$1.bippy()
diff --git a/tests/untried/neg/t7752.check b/tests/untried/neg/t7752.check
new file mode 100644
index 000000000..0a015d3f3
--- /dev/null
+++ b/tests/untried/neg/t7752.check
@@ -0,0 +1,27 @@
+t7752.scala:25: error: overloaded method value foo with alternatives:
+ [A](heading: String, rows: A*)(A,) <and>
+ [A, B](heading: (String, String), rows: (A, B)*)(A, B) <and>
+ [A, B, C](heading: (String, String, String), rows: (A, B, C)*)(A, B, C) <and>
+ [A, B, C, D](heading: (String, String, String, String), rows: (A, B, C, D)*)(A, B, C, D) <and>
+ [A, B, C, D, E](heading: (String, String, String, String, String), rows: (A, B, C, D, E)*)(A, B, C, D, E) <and>
+ [A, B, C, D, E, F](heading: (String, String, String, String, String, String), rows: (A, B, C, D, E, F)*)(A, B, C, D, E, F) <and>
+ [A, B, C, D, E, F, G](heading: (String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G)*)(A, B, C, D, E, F, G) <and>
+ [A, B, C, D, E, F, G, H](heading: (String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H)*)(A, B, C, D, E, F, G, H) <and>
+ [A, B, C, D, E, F, G, H, I](heading: (String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I)*)(A, B, C, D, E, F, G, H, I) <and>
+ [A, B, C, D, E, F, G, H, I, J](heading: (String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J)*)(A, B, C, D, E, F, G, H, I, J) <and>
+ [A, B, C, D, E, F, G, H, I, J, K](heading: (String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K)*)(A, B, C, D, E, F, G, H, I, J, K) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L](heading: (String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L)*)(A, B, C, D, E, F, G, H, I, J, K, L) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M)*)(A, B, C, D, E, F, G, H, I, J, K, L, M) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)
+ cannot be applied to (Int)
+ foo((1))
+ ^
+one error found
diff --git a/tests/untried/neg/t7752.scala b/tests/untried/neg/t7752.scala
new file mode 100644
index 000000000..342a2ca34
--- /dev/null
+++ b/tests/untried/neg/t7752.scala
@@ -0,0 +1,26 @@
+object Test {
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)*): Tuple22[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)*): Tuple21[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)*): Tuple20[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)*): Tuple19[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)*): Tuple18[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)*): Tuple17[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)*): Tuple16[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)*): Tuple15[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N)*): Tuple14[A,B,C,D,E,F,G,H,I,J,K,L,M,N] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M)*): Tuple13[A,B,C,D,E,F,G,H,I,J,K,L,M] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L](heading: (String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L)*): Tuple12[A,B,C,D,E,F,G,H,I,J,K,L] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K](heading: (String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K)*): Tuple11[A,B,C,D,E,F,G,H,I,J,K] = null
+ def foo[A, B, C, D, E, F, G, H, I, J](heading: (String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J)*): Tuple10[A,B,C,D,E,F,G,H,I,J] = null
+ def foo[A, B, C, D, E, F, G, H, I](heading: (String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I)*): Tuple9[A,B,C,D,E,F,G,H,I] = null
+ def foo[A, B, C, D, E, F, G, H](heading: (String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H)*): Tuple8[A,B,C,D,E,F,G,H] = null
+ def foo[A, B, C, D, E, F, G](heading: (String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G)*): Tuple7[A,B,C,D,E,F,G] = null
+ def foo[A, B, C, D, E, F](heading: (String, String, String, String, String, String), rows: (A, B, C, D, E, F)*): Tuple6[A,B,C,D,E,F] = null
+ def foo[A, B, C, D, E](heading: (String, String, String, String, String), rows: (A, B, C, D, E)*): Tuple5[A,B,C,D,E] = null
+ def foo[A, B, C, D](heading: (String, String, String, String), rows: (A, B, C, D)*): Tuple4[A,B,C,D] = null
+ def foo[A, B, C](heading: (String, String, String), rows: (A, B, C)*): Tuple3[A,B,C] = null
+ def foo[A, B](heading: (String, String), rows: (A, B)*): Tuple2[A,B] = null
+ def foo[A](heading: String, rows: A*): Tuple1[A] = null
+
+ foo((1))
+}
diff --git a/tests/untried/neg/t7756a.check b/tests/untried/neg/t7756a.check
new file mode 100644
index 000000000..8d42717e4
--- /dev/null
+++ b/tests/untried/neg/t7756a.check
@@ -0,0 +1,7 @@
+t7756a.scala:7: error: type arguments [Object] do not conform to trait TA's type parameter bounds [X <: CharSequence]
+ locally(null: TA[Object])
+ ^
+t7756a.scala:7: error: type arguments [Object] do not conform to trait TA's type parameter bounds [X <: CharSequence]
+ locally(null: TA[Object])
+ ^
+two errors found
diff --git a/tests/untried/neg/t7756a.scala b/tests/untried/neg/t7756a.scala
new file mode 100644
index 000000000..4453e8496
--- /dev/null
+++ b/tests/untried/neg/t7756a.scala
@@ -0,0 +1,11 @@
+object Test {
+ def test: Unit = {
+ trait TA[X <: CharSequence]
+ 0 match {
+ case _ =>
+ // the bounds violation isn't reported. RefChecks seems to be too broadly disabled under virtpatmat: see 65340ed4ad2e
+ locally(null: TA[Object])
+ ()
+ }
+ }
+}
diff --git a/tests/untried/neg/t7756b.check b/tests/untried/neg/t7756b.check
new file mode 100644
index 000000000..2817a7e23
--- /dev/null
+++ b/tests/untried/neg/t7756b.check
@@ -0,0 +1,6 @@
+t7756b.scala:3: warning: comparing values of types Int and String using `==' will always yield false
+ case _ => 0 == ""
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t7756b.flags b/tests/untried/neg/t7756b.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/t7756b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/t7756b.scala b/tests/untried/neg/t7756b.scala
new file mode 100644
index 000000000..a2de29c8e
--- /dev/null
+++ b/tests/untried/neg/t7756b.scala
@@ -0,0 +1,5 @@
+object Test {
+ 0 match {
+ case _ => 0 == ""
+ }
+}
diff --git a/tests/untried/neg/t7757a.check b/tests/untried/neg/t7757a.check
new file mode 100644
index 000000000..de24e2300
--- /dev/null
+++ b/tests/untried/neg/t7757a.check
@@ -0,0 +1,4 @@
+t7757a.scala:1: error: ';' expected but '@' found.
+trait Foo @annot
+ ^
+one error found
diff --git a/tests/untried/neg/t7757a.scala b/tests/untried/neg/t7757a.scala
new file mode 100644
index 000000000..77168b145
--- /dev/null
+++ b/tests/untried/neg/t7757a.scala
@@ -0,0 +1 @@
+trait Foo @annot
diff --git a/tests/untried/neg/t7757b.check b/tests/untried/neg/t7757b.check
new file mode 100644
index 000000000..3e5a0f1fa
--- /dev/null
+++ b/tests/untried/neg/t7757b.check
@@ -0,0 +1,4 @@
+t7757b.scala:2: error: expected start of definition
+@annot2
+ ^
+one error found
diff --git a/tests/untried/neg/t7757b.scala b/tests/untried/neg/t7757b.scala
new file mode 100644
index 000000000..e9a537dba
--- /dev/null
+++ b/tests/untried/neg/t7757b.scala
@@ -0,0 +1,2 @@
+trait Foo2
+@annot2 \ No newline at end of file
diff --git a/tests/untried/neg/t7783.check b/tests/untried/neg/t7783.check
new file mode 100644
index 000000000..647cfee12
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7783.flags b/tests/untried/neg/t7783.flags
new file mode 100644
index 000000000..d1b831ea8
--- /dev/null
+++ b/tests/untried/neg/t7783.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7783.scala b/tests/untried/neg/t7783.scala
new file mode 100644
index 000000000..995b644a0
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t779.check b/tests/untried/neg/t779.check
new file mode 100644
index 000000000..65f463c19
--- /dev/null
+++ b/tests/untried/neg/t779.check
@@ -0,0 +1,4 @@
+t779.scala:6: error: method ast has return statement; needs result type
+ override def ast = return null
+ ^
+one error found
diff --git a/tests/untried/neg/t779.scala b/tests/untried/neg/t779.scala
new file mode 100644
index 000000000..cc92f9062
--- /dev/null
+++ b/tests/untried/neg/t779.scala
@@ -0,0 +1,8 @@
+abstract class Foo {
+ trait Node {
+ def ast: AnyRef = null
+ }
+ trait Something extends Node {
+ override def ast = return null
+ }
+}
diff --git a/tests/untried/neg/t783.check b/tests/untried/neg/t783.check
new file mode 100644
index 000000000..37610a50f
--- /dev/null
+++ b/tests/untried/neg/t783.check
@@ -0,0 +1,6 @@
+t783.scala:12: error: type mismatch;
+ found : Contexts.this.Global#Template
+ required: Contexts.this.global.Template
+ globalInit0.Template(10, 20);
+ ^
+one error found
diff --git a/tests/untried/neg/t783.scala b/tests/untried/neg/t783.scala
new file mode 100644
index 000000000..59f7c7f97
--- /dev/null
+++ b/tests/untried/neg/t783.scala
@@ -0,0 +1,29 @@
+package test;
+
+object Main extends App {
+ class Global {
+ case class Template(x : Int, y : Int) {
+ Console.println("outer: " + Global.this);
+ }
+ }
+ trait Contexts { self: Analyzer =>
+ val xxx : global.Template = {
+ assert(globalInit0 != null);
+ globalInit0.Template(10, 20);
+ }
+ }
+ abstract class Analyzer extends Contexts {
+ type Global <: Main.Global;
+ final val global : Global = globalInit;
+ def globalInit : Global;
+ final def globalInit0 = globalInit.asInstanceOf[global.type];
+ }
+
+ object global0 extends Global {
+ object analyzer extends Analyzer {
+ type Global = global0.type;
+ override def globalInit = global0;
+ }
+ }
+ Console.println(global0.analyzer.xxx);
+}
diff --git a/tests/untried/neg/t7834neg.check b/tests/untried/neg/t7834neg.check
new file mode 100644
index 000000000..569df4b8c
--- /dev/null
+++ b/tests/untried/neg/t7834neg.check
@@ -0,0 +1,41 @@
+t7834neg.scala:48: error: type mismatch;
+ found : C.super.q.type (with underlying type M2)
+ required: C.super.q.type
+ x1 = x2 // fail
+ ^
+t7834neg.scala:50: error: type mismatch;
+ found : C.super.q.type (with underlying type M1)
+ required: C.super.q.type
+ x2 = x1 // fail
+ ^
+t7834neg.scala:53: error: type mismatch;
+ found : C.super.q.type (with underlying type M1)
+ required: C.this.q.type
+ x3 = x1 // fail
+ ^
+t7834neg.scala:54: error: type mismatch;
+ found : C.super.q.type (with underlying type M2)
+ required: C.this.q.type
+ x3 = x2 // fail
+ ^
+t7834neg.scala:69: error: type mismatch;
+ found : C.super.q.type (with underlying type M2)
+ required: C.super.q.type
+ x1 = super[S2].q // fail
+ ^
+t7834neg.scala:71: error: type mismatch;
+ found : C.super.q.type (with underlying type M1)
+ required: C.super.q.type
+ x2 = super[S1].q // fail
+ ^
+t7834neg.scala:74: error: type mismatch;
+ found : C.super.q.type (with underlying type M1)
+ required: C.this.q.type
+ x3 = super[S1].q // fail
+ ^
+t7834neg.scala:75: error: type mismatch;
+ found : C.super.q.type (with underlying type M2)
+ required: C.this.q.type
+ x3 = super[S2].q // fail
+ ^
+8 errors found
diff --git a/tests/untried/neg/t7834neg.scala b/tests/untried/neg/t7834neg.scala
new file mode 100644
index 000000000..d35a84ead
--- /dev/null
+++ b/tests/untried/neg/t7834neg.scala
@@ -0,0 +1,76 @@
+class M1
+class M2 extends M1
+class M3 extends M2
+
+trait S1 { val q = new M1 ; val q1: q.type = q }
+trait S2 { val q = new M2 ; val q2: q.type = q }
+
+class B extends S1 with S2 {
+ override val q = new M3
+ val q3: q.type = q
+
+ var x1: B.super[S1].q1.type = null
+ var x2: B.super[S2].q2.type = null
+ var x3: B.this.q3.type = null
+
+ x1 = x1
+ x1 = x2
+ x1 = x3
+ x2 = x1
+ x2 = x2
+ x2 = x3
+ x3 = x1
+ x3 = x2
+ x3 = x3
+
+ x1 = q1
+ x1 = q2
+ x1 = q3
+ x2 = q1
+ x2 = q2
+ x2 = q3
+ x3 = q1
+ x3 = q2
+ x3 = x3
+}
+
+class C extends S1 with S2 {
+ override val q = new M3
+ val q3: q.type = q
+
+ // x1's type and x2's type are incompatible
+ // x3's is assignable to x1 or x2, but not vice versa
+ var x1: C.super[S1].q.type = null
+ var x2: C.super[S2].q.type = null
+ var x3: C.this.q.type = null
+
+ x1 = x1
+ x1 = x2 // fail
+ x1 = x3
+ x2 = x1 // fail
+ x2 = x2
+ x2 = x3
+ x3 = x1 // fail
+ x3 = x2 // fail
+ x3 = x3
+
+ x1 = q1
+ x1 = q2
+ x1 = q3
+ x2 = q1
+ x2 = q2
+ x2 = q3
+ x3 = q1
+ x3 = q2
+ x3 = x3
+
+ x1 = q
+ x1 = super[S1].q
+ x1 = super[S2].q // fail
+ x2 = q
+ x2 = super[S1].q // fail
+ x2 = super[S2].q
+ x3 = q
+ x3 = super[S1].q // fail
+ x3 = super[S2].q // fail
+}
diff --git a/tests/untried/neg/t7848-interp-warn.check b/tests/untried/neg/t7848-interp-warn.check
new file mode 100644
index 000000000..b7df6d8ce
--- /dev/null
+++ b/tests/untried/neg/t7848-interp-warn.check
@@ -0,0 +1,12 @@
+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: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.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t7848-interp-warn.flags b/tests/untried/neg/t7848-interp-warn.flags
new file mode 100644
index 000000000..7949c2afa
--- /dev/null
+++ b/tests/untried/neg/t7848-interp-warn.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings
diff --git a/tests/untried/neg/t7848-interp-warn.scala b/tests/untried/neg/t7848-interp-warn.scala
new file mode 100644
index 000000000..3887aff8d
--- /dev/null
+++ b/tests/untried/neg/t7848-interp-warn.scala
@@ -0,0 +1,18 @@
+
+package test
+
+object Test {
+ def bar = "bar"
+ def f = {
+ val foo = "bar"
+ "An important $foo message!"
+ }
+ def g = {
+ 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/tests/untried/neg/t7850.check b/tests/untried/neg/t7850.check
new file mode 100644
index 000000000..317be2bbc
--- /dev/null
+++ b/tests/untried/neg/t7850.check
@@ -0,0 +1,7 @@
+t7850.scala:11: error: an unapply result must have a member `def isEmpty: Boolean (found: def isEmpty: Casey)
+ val Casey(x1) = new Casey(1)
+ ^
+t7850.scala:12: error: an unapply result must have a member `def isEmpty: Boolean
+ val Dingy(x2) = new Dingy(1)
+ ^
+two errors found
diff --git a/tests/untried/neg/t7850.scala b/tests/untried/neg/t7850.scala
new file mode 100644
index 000000000..794ce2eb0
--- /dev/null
+++ b/tests/untried/neg/t7850.scala
@@ -0,0 +1,16 @@
+// isEmpty returns non-boolean
+class Casey(a: Int) { def isEmpty = this; def get = this }
+object Casey { def unapply(a: Casey) = a }
+
+// no isEmpty method at all
+class Dingy(a: Int) { def get = this }
+object Dingy { def unapply(a: Dingy) = a }
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val Casey(x1) = new Casey(1)
+ val Dingy(x2) = new Dingy(1)
+ println(s"$x1 $x2")
+ }
+}
+
diff --git a/tests/untried/neg/t7859.check b/tests/untried/neg/t7859.check
new file mode 100644
index 000000000..5789e2a12
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7859/A_1.scala b/tests/untried/neg/t7859/A_1.scala
new file mode 100644
index 000000000..e5b32d1c9
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7859/B_2.scala b/tests/untried/neg/t7859/B_2.scala
new file mode 100644
index 000000000..2e0556bc7
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7870.check b/tests/untried/neg/t7870.check
new file mode 100644
index 000000000..d9db911ac
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7870.scala b/tests/untried/neg/t7870.scala
new file mode 100644
index 000000000..5d48d43b3
--- /dev/null
+++ b/tests/untried/neg/t7870.scala
@@ -0,0 +1,3 @@
+class C(a: Int = 0, b: Any) {
+ def this(a: Int = 0) = this(???, ???)
+}
diff --git a/tests/untried/neg/t7872.check b/tests/untried/neg/t7872.check
new file mode 100644
index 000000000..57d9772ab
--- /dev/null
+++ b/tests/untried/neg/t7872.check
@@ -0,0 +1,10 @@
+t7872.scala:6: error: contravariant type a occurs in covariant position in type [-a]Cov[a] of type l
+ type x = {type l[-a] = Cov[a]}
+ ^
+t7872.scala:8: error: covariant type a occurs in contravariant position in type [+a]Inv[a] of type l
+ foo[({type l[+a] = Inv[a]})#l]
+ ^
+t7872.scala:5: error: contravariant type a occurs in covariant position in type [-a]Cov[a] of type l
+ type l[-a] = Cov[a]
+ ^
+three errors found
diff --git a/tests/untried/neg/t7872.scala b/tests/untried/neg/t7872.scala
new file mode 100644
index 000000000..66d22a071
--- /dev/null
+++ b/tests/untried/neg/t7872.scala
@@ -0,0 +1,9 @@
+trait Cov[+A]
+trait Inv[-A]
+
+object varianceExploit {
+ type l[-a] = Cov[a]
+ type x = {type l[-a] = Cov[a]}
+ def foo[M[_]] = ()
+ foo[({type l[+a] = Inv[a]})#l]
+}
diff --git a/tests/untried/neg/t7872b.check b/tests/untried/neg/t7872b.check
new file mode 100644
index 000000000..0dc4e7630
--- /dev/null
+++ b/tests/untried/neg/t7872b.check
@@ -0,0 +1,7 @@
+t7872b.scala:8: error: contravariant type a occurs in covariant position in type [-a]List[a] of type l
+ def oops1 = down[({type l[-a] = List[a]})#l](List('whatever: Object)).head + "oops"
+ ^
+t7872b.scala:19: error: covariant type a occurs in contravariant position in type [+a]coinv.Stringer[a] of type l
+ def oops2 = up[({type l[+a] = Stringer[a]})#l]("printed: " + _)
+ ^
+two errors found
diff --git a/tests/untried/neg/t7872b.scala b/tests/untried/neg/t7872b.scala
new file mode 100644
index 000000000..307a1470c
--- /dev/null
+++ b/tests/untried/neg/t7872b.scala
@@ -0,0 +1,23 @@
+object coinv {
+ def up[F[+_]](fa: F[String]): F[Object] = fa
+ def down[F[-_]](fa: F[Object]): F[String] = fa
+
+ up(List("hi"))
+
+ // should not compile; `l' is unsound
+ def oops1 = down[({type l[-a] = List[a]})#l](List('whatever: Object)).head + "oops"
+ // scala> oops1
+ // java.lang.ClassCastException: scala.Symbol cannot be cast to java.lang.String
+ // at com.nocandysw.coinv$.oops1(coinv.scala:12)
+
+ type Stringer[-A] = A => String
+ down[Stringer](_.toString)
+ // [error] type A is contravariant, but type _ is declared covariant
+ // up[Stringer]("printed: " + _)
+
+ // should not compile; `l' is unsound
+ def oops2 = up[({type l[+a] = Stringer[a]})#l]("printed: " + _)
+ // scala> oops2(Some(33))
+ // java.lang.ClassCastException: scala.Some cannot be cast to java.lang.String
+ // at com.nocandysw.coinv$$anonfun$oops2$1.apply(coinv.scala:20)
+}
diff --git a/tests/untried/neg/t7872c.check b/tests/untried/neg/t7872c.check
new file mode 100644
index 000000000..469449dbd
--- /dev/null
+++ b/tests/untried/neg/t7872c.check
@@ -0,0 +1,11 @@
+t7872c.scala:7: error: inferred kinds of the type arguments (List) do not conform to the expected kinds of the type parameters (type F).
+List's type parameters do not match type F's expected parameters:
+type A is covariant, but type _ is declared contravariant
+ down(List('whatever: Object))
+ ^
+t7872c.scala:7: error: type mismatch;
+ found : List[Object]
+ required: F[Object]
+ down(List('whatever: Object))
+ ^
+two errors found
diff --git a/tests/untried/neg/t7872c.scala b/tests/untried/neg/t7872c.scala
new file mode 100644
index 000000000..fa12a523b
--- /dev/null
+++ b/tests/untried/neg/t7872c.scala
@@ -0,0 +1,8 @@
+object coinv {
+ def up[F[+_]](fa: F[String]): F[Object] = fa
+ def down[F[-_]](fa: F[Object]): F[String] = fa
+
+ up(List("hi"))
+ // [error] type A is covariant, but type _ is declared contravariant
+ down(List('whatever: Object))
+}
diff --git a/tests/untried/neg/t7877.check b/tests/untried/neg/t7877.check
new file mode 100644
index 000000000..7f7f83246
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7877.scala b/tests/untried/neg/t7877.scala
new file mode 100644
index 000000000..52e167f3b
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7895.check b/tests/untried/neg/t7895.check
new file mode 100644
index 000000000..1a58e24b7
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7895.scala b/tests/untried/neg/t7895.scala
new file mode 100644
index 000000000..87a586a82
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7895b.check b/tests/untried/neg/t7895b.check
new file mode 100644
index 000000000..87ea72704
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7895b.scala b/tests/untried/neg/t7895b.scala
new file mode 100644
index 000000000..160302744
--- /dev/null
+++ b/tests/untried/neg/t7895b.scala
@@ -0,0 +1,5 @@
+object Test {
+ def foo(a: Any*) = ()
+
+ foo(a, b)
+}
diff --git a/tests/untried/neg/t7895c.check b/tests/untried/neg/t7895c.check
new file mode 100644
index 000000000..d4745b1f4
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7895c.scala b/tests/untried/neg/t7895c.scala
new file mode 100644
index 000000000..53d2a8672
--- /dev/null
+++ b/tests/untried/neg/t7895c.scala
@@ -0,0 +1,3 @@
+class A {
+ def booboo = bong + booble + bippity - bazingo
+}
diff --git a/tests/untried/neg/t7897.check b/tests/untried/neg/t7897.check
new file mode 100644
index 000000000..48eff511c
--- /dev/null
+++ b/tests/untried/neg/t7897.check
@@ -0,0 +1,4 @@
+t7897.scala:19: error: value length is not a member of p0.Single
+ case p0.Single(x) => println(s"`$x` has ${x.length} chars")
+ ^
+one error found
diff --git a/tests/untried/neg/t7897.scala b/tests/untried/neg/t7897.scala
new file mode 100644
index 000000000..87c966b1e
--- /dev/null
+++ b/tests/untried/neg/t7897.scala
@@ -0,0 +1,23 @@
+package p0 {
+ class Single(val x: Any) extends AnyRef with Product1[String] {
+ private def s = "" + x
+ override def canEqual(x: Any) = this eq x.asInstanceOf[AnyRef]
+ def isEmpty = false
+ def get = this
+ def _1 = s + " only"
+
+ override def toString = s"Single(${_1})"
+ }
+
+ object Single {
+ def unapply(x: Any): Single = new Single(x)
+ }
+}
+object Test {
+ def main(args: Array[String]): Unit = {
+ "catdog" match {
+ case p0.Single(x) => println(s"`$x` has ${x.length} chars")
+ case x => println("fail: " + x)
+ }
+ }
+}
diff --git a/tests/untried/neg/t7899.check b/tests/untried/neg/t7899.check
new file mode 100644
index 000000000..febfe76b8
--- /dev/null
+++ b/tests/untried/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/tests/untried/neg/t7899.scala b/tests/untried/neg/t7899.scala
new file mode 100644
index 000000000..279f24b9c
--- /dev/null
+++ b/tests/untried/neg/t7899.scala
@@ -0,0 +1,7 @@
+object Test {
+ def foo[B](f: (=> Int) => B): () => B = () => f(0)
+
+ def main(args: Array[String]): Unit = {
+ foo(identity)()
+ }
+}
diff --git a/tests/untried/neg/t7967.check b/tests/untried/neg/t7967.check
new file mode 100644
index 000000000..cde950dcd
--- /dev/null
+++ b/tests/untried/neg/t7967.check
@@ -0,0 +1,9 @@
+t7967.scala:6: error: illegal inheritance;
+ self-type C does not conform to C's selftype C with B
+ new C {} // fails
+ ^
+t7967.scala:8: error: illegal inheritance;
+ self-type Test.CC does not conform to Test.CC's selftype Test.CC
+ new CC {} // should fail, doesn't
+ ^
+two errors found
diff --git a/tests/untried/neg/t7967.scala b/tests/untried/neg/t7967.scala
new file mode 100644
index 000000000..4f1334794
--- /dev/null
+++ b/tests/untried/neg/t7967.scala
@@ -0,0 +1,9 @@
+
+trait B
+trait C {self: B =>}
+
+object Test {
+ new C {} // fails
+ type CC = C
+ new CC {} // should fail, doesn't
+}
diff --git a/tests/untried/neg/t798.check b/tests/untried/neg/t798.check
new file mode 100644
index 000000000..b120f3a40
--- /dev/null
+++ b/tests/untried/neg/t798.check
@@ -0,0 +1,4 @@
+t798.scala:2: error: cyclic aliasing or subtyping involving type Bracks
+trait Test[Bracks <: Bracks] {
+ ^
+one error found
diff --git a/tests/untried/neg/t798.scala b/tests/untried/neg/t798.scala
new file mode 100644
index 000000000..a2bf66d19
--- /dev/null
+++ b/tests/untried/neg/t798.scala
@@ -0,0 +1,8 @@
+package test;
+trait Test[Bracks <: Bracks] {
+ def f(list : Any) = null;
+ class C[T]
+ val bracks : Bracks;
+ val singletons = f(bracks);
+
+}
diff --git a/tests/untried/neg/t7980.check b/tests/untried/neg/t7980.check
new file mode 100644
index 000000000..031c23dbe
--- /dev/null
+++ b/tests/untried/neg/t7980.check
@@ -0,0 +1,4 @@
+t7980.scala:7: error: Can't unquote Nothing, bottom type values often indicate programmer mistake
+ println(q"class ${Name(X)} { }")
+ ^
+one error found
diff --git a/tests/untried/neg/t7980.scala b/tests/untried/neg/t7980.scala
new file mode 100644
index 000000000..b21907de5
--- /dev/null
+++ b/tests/untried/neg/t7980.scala
@@ -0,0 +1,8 @@
+object Test extends App {
+ import scala.reflect.runtime.universe._
+ def Name[T:TypeTag](name:String): T = implicitly[TypeTag[T]] match {
+ case t => newTypeName(name).asInstanceOf[T]
+ }
+ val X = "ASDF"
+ println(q"class ${Name(X)} { }")
+}
diff --git a/tests/untried/neg/t7984.check b/tests/untried/neg/t7984.check
new file mode 100644
index 000000000..0cfd7d161
--- /dev/null
+++ b/tests/untried/neg/t7984.check
@@ -0,0 +1,6 @@
+t7984.scala:4: warning: non-variable type argument Int in type pattern List[Int] (the underlying of Test.this.ListInt) is unchecked since it is eliminated by erasure
+ case is: ListInt => is.head
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t7984.flags b/tests/untried/neg/t7984.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/t7984.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/t7984.scala b/tests/untried/neg/t7984.scala
new file mode 100644
index 000000000..ca09a89fc
--- /dev/null
+++ b/tests/untried/neg/t7984.scala
@@ -0,0 +1,7 @@
+class Test {
+ type ListInt = List[Int]
+ List[Any]("") match {
+ case is: ListInt => is.head
+ case _ =>
+ }
+}
diff --git a/tests/untried/neg/t800.check b/tests/untried/neg/t800.check
new file mode 100644
index 000000000..8ba95fddd
--- /dev/null
+++ b/tests/untried/neg/t800.check
@@ -0,0 +1,16 @@
+t800.scala:4: error: qualification is already defined as value qualification
+ val qualification = false;
+ ^
+t800.scala:8: error: method qualification is defined twice
+ conflicting symbols both originated in file 't800.scala'
+ val qualification = false;
+ ^
+t800.scala:12: error: value qualification is defined twice
+ conflicting symbols both originated in file 't800.scala'
+ var qualification = false;
+ ^
+t800.scala:16: error: method qualification is defined twice
+ conflicting symbols both originated in file 't800.scala'
+ var qualification = false;
+ ^
+four errors found
diff --git a/tests/untried/neg/t800.scala b/tests/untried/neg/t800.scala
new file mode 100644
index 000000000..388574d42
--- /dev/null
+++ b/tests/untried/neg/t800.scala
@@ -0,0 +1,17 @@
+package test;
+trait Test1 {
+ val qualification : String;
+ val qualification = false;
+}
+trait Test2 {
+ var qualification : String;
+ val qualification = false;
+}
+trait Test3 {
+ val qualification : String;
+ var qualification = false;
+}
+trait Test4 {
+ var qualification : String;
+ var qualification = false;
+}
diff --git a/tests/untried/neg/t8006.check b/tests/untried/neg/t8006.check
new file mode 100644
index 000000000..fbac26e3a
--- /dev/null
+++ b/tests/untried/neg/t8006.check
@@ -0,0 +1,6 @@
+t8006.scala:3: error: too many arguments for method applyDynamicNamed: (value: (String, Any))String
+error after rewriting to X.this.d.applyDynamicNamed("meth")(scala.Tuple2("value1", 10), scala.Tuple2("value2", 100))
+possible cause: maybe a wrong Dynamic method signature?
+ d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed
+ ^
+one error found
diff --git a/tests/untried/neg/t8006.scala b/tests/untried/neg/t8006.scala
new file mode 100644
index 000000000..8dc60697d
--- /dev/null
+++ b/tests/untried/neg/t8006.scala
@@ -0,0 +1,8 @@
+object X {
+ val d = new D
+ d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed
+}
+import language.dynamics
+class D extends Dynamic {
+ def applyDynamicNamed(name: String)(value: (String, Any)) = name
+}
diff --git a/tests/untried/neg/t8015-ffa.check b/tests/untried/neg/t8015-ffa.check
new file mode 100644
index 000000000..0f28be7fe
--- /dev/null
+++ b/tests/untried/neg/t8015-ffa.check
@@ -0,0 +1,6 @@
+t8015-ffa.scala:7: error: type mismatch;
+ found : String("3")
+ required: Int
+ val i: Int = "3" // error line 7 (was 8)
+ ^
+one error found
diff --git a/tests/untried/neg/t8015-ffa.scala b/tests/untried/neg/t8015-ffa.scala
new file mode 100644
index 000000000..60876d913
--- /dev/null
+++ b/tests/untried/neg/t8015-ffa.scala
@@ -0,0 +1,8 @@
+
+package foo
+
+//------- object Next
+
+trait F {
+ val i: Int = "3" // error line 7 (was 8)
+}
diff --git a/tests/untried/neg/t8015-ffb.check b/tests/untried/neg/t8015-ffb.check
new file mode 100644
index 000000000..9b2171ea4
--- /dev/null
+++ b/tests/untried/neg/t8015-ffb.check
@@ -0,0 +1,6 @@
+t8015-ffb.scala:10: warning: side-effecting nullary methods are discouraged: suggest defining as `def w()` instead
+ def w = { x\u000c() } // ^L is colored blue on this screen, hardly visible
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/t8015-ffb.flags b/tests/untried/neg/t8015-ffb.flags
new file mode 100644
index 000000000..7949c2afa
--- /dev/null
+++ b/tests/untried/neg/t8015-ffb.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings
diff --git a/tests/untried/neg/t8015-ffb.scala b/tests/untried/neg/t8015-ffb.scala
new file mode 100644
index 000000000..dbdd94255
--- /dev/null
+++ b/tests/untried/neg/t8015-ffb.scala
@@ -0,0 +1,11 @@
+
+trait G {
+ val c: Char = '\u000a' // disallowed!
+ def x\u000d\u000a = 9 // as nl
+ def y() = x
+ def z() = {
+ y()\u000a() // was Int does not take parameters
+ }
+ def v = y()\u000c() // was Int does not take parameters
+ def w = { x () } // ^L is colored blue on this screen, hardly visible
+}
diff --git a/tests/untried/neg/t8024.check b/tests/untried/neg/t8024.check
new file mode 100644
index 000000000..bd551aa59
--- /dev/null
+++ b/tests/untried/neg/t8024.check
@@ -0,0 +1,6 @@
+t8024.scala:13: error: reference to sqrt is ambiguous;
+it is both defined in package object p and imported subsequently by
+import java.lang.Math.sqrt
+ sqrt(0d)
+ ^
+one error found
diff --git a/tests/untried/neg/t8024.scala b/tests/untried/neg/t8024.scala
new file mode 100644
index 000000000..b4c2c5ebb
--- /dev/null
+++ b/tests/untried/neg/t8024.scala
@@ -0,0 +1,14 @@
+package p
+
+trait NRoot[A]
+
+object `package` {
+ final def sqrt(x: Double): Double = Math.sqrt(x)
+ final def sqrt[A](a: A)(implicit ev: NRoot[A]): A = ???
+}
+
+object FastComplex {
+ import java.lang.Math.sqrt
+
+ sqrt(0d)
+}
diff --git a/tests/untried/neg/t8024b.check b/tests/untried/neg/t8024b.check
new file mode 100644
index 000000000..9cd89bca5
--- /dev/null
+++ b/tests/untried/neg/t8024b.check
@@ -0,0 +1,6 @@
+t8024b.scala:15: error: reference to sqrt is ambiguous;
+it is both defined in object FastComplex and imported subsequently by
+import java.lang.Math.sqrt
+ sqrt(0d)
+ ^
+one error found
diff --git a/tests/untried/neg/t8024b.scala b/tests/untried/neg/t8024b.scala
new file mode 100644
index 000000000..cf3d49636
--- /dev/null
+++ b/tests/untried/neg/t8024b.scala
@@ -0,0 +1,17 @@
+package p
+
+trait NRoot[A]
+
+object FastComplex {
+ final def sqrt(x: Double): Double = Math.sqrt(x)
+ final def sqrt[A](a: A)(implicit ev: NRoot[A]): A = ???
+
+ object Inner {
+ import java.lang.Math.sqrt
+
+ // wrong message:
+ // error: reference to sqrt is ambiguous;
+ // it is both defined in object FastComplex and imported subsequently by
+ sqrt(0d)
+ }
+}
diff --git a/tests/untried/neg/t8035-deprecated.check b/tests/untried/neg/t8035-deprecated.check
new file mode 100644
index 000000000..01f27e531
--- /dev/null
+++ b/tests/untried/neg/t8035-deprecated.check
@@ -0,0 +1,21 @@
+t8035-deprecated.scala:2: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want.
+ signature: GenSetLike.apply(elem: A): Boolean
+ given arguments: <none>
+ after adaptation: GenSetLike((): Unit)
+ List(1,2,3).toSet()
+ ^
+t8035-deprecated.scala:5: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want.
+ signature: A(x: T): Foo.A[T]
+ given arguments: <none>
+ after adaptation: new A((): Unit)
+ new A
+ ^
+t8035-deprecated.scala:9: warning: Adaptation of argument list by inserting () has been deprecated: leaky (Object-receiving) target makes this especially dangerous.
+ signature: Format.format(x$1: Any): String
+ given arguments: <none>
+ after adaptation: Format.format((): Unit)
+ sdf.format()
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/t8035-deprecated.flags b/tests/untried/neg/t8035-deprecated.flags
new file mode 100644
index 000000000..c6bfaf1f6
--- /dev/null
+++ b/tests/untried/neg/t8035-deprecated.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/tests/untried/neg/t8035-deprecated.scala b/tests/untried/neg/t8035-deprecated.scala
new file mode 100644
index 000000000..642315753
--- /dev/null
+++ b/tests/untried/neg/t8035-deprecated.scala
@@ -0,0 +1,10 @@
+object Foo {
+ List(1,2,3).toSet()
+
+ class A[T](val x: T)
+ new A
+
+ import java.text.SimpleDateFormat
+ val sdf = new SimpleDateFormat("yyyyMMdd-HH0000")
+ sdf.format()
+}
diff --git a/tests/untried/neg/t8035-removed.check b/tests/untried/neg/t8035-removed.check
new file mode 100644
index 000000000..e24a0b4e6
--- /dev/null
+++ b/tests/untried/neg/t8035-removed.check
@@ -0,0 +1,16 @@
+t8035-removed.scala:2: error: Adaptation of argument list by inserting () has been removed.
+ signature: GenSetLike.apply(elem: A): Boolean
+ given arguments: <none>
+ List(1,2,3).toSet()
+ ^
+t8035-removed.scala:5: error: Adaptation of argument list by inserting () has been removed.
+ signature: A(x: T): Foo.A[T]
+ given arguments: <none>
+ new A
+ ^
+t8035-removed.scala:9: error: Adaptation of argument list by inserting () has been removed.
+ signature: Format.format(x$1: Any): String
+ given arguments: <none>
+ sdf.format()
+ ^
+three errors found
diff --git a/tests/untried/neg/t8035-removed.flags b/tests/untried/neg/t8035-removed.flags
new file mode 100644
index 000000000..29f4ede37
--- /dev/null
+++ b/tests/untried/neg/t8035-removed.flags
@@ -0,0 +1 @@
+-Xfuture
diff --git a/tests/untried/neg/t8035-removed.scala b/tests/untried/neg/t8035-removed.scala
new file mode 100644
index 000000000..642315753
--- /dev/null
+++ b/tests/untried/neg/t8035-removed.scala
@@ -0,0 +1,10 @@
+object Foo {
+ List(1,2,3).toSet()
+
+ class A[T](val x: T)
+ new A
+
+ import java.text.SimpleDateFormat
+ val sdf = new SimpleDateFormat("yyyyMMdd-HH0000")
+ sdf.format()
+}
diff --git a/tests/untried/neg/t8072.check b/tests/untried/neg/t8072.check
new file mode 100644
index 000000000..926701013
--- /dev/null
+++ b/tests/untried/neg/t8072.check
@@ -0,0 +1,4 @@
+t8072.scala:4: error: value ifParSeq is not a member of List[Int]
+ val y = x.ifParSeq[Int](throw new Exception).otherwise(0) // Shouldn't compile
+ ^
+one error found
diff --git a/tests/untried/neg/t8072.scala b/tests/untried/neg/t8072.scala
new file mode 100644
index 000000000..dddb8c5f2
--- /dev/null
+++ b/tests/untried/neg/t8072.scala
@@ -0,0 +1,6 @@
+class NoIfParSeq {
+ import collection.parallel._
+ val x = List(1,2)
+ val y = x.ifParSeq[Int](throw new Exception).otherwise(0) // Shouldn't compile
+ val z = x.toParArray
+}
diff --git a/tests/untried/neg/t8104.check b/tests/untried/neg/t8104.check
new file mode 100644
index 000000000..69b3461bd
--- /dev/null
+++ b/tests/untried/neg/t8104.check
@@ -0,0 +1,4 @@
+Test_2.scala:20: error: could not find implicit value for parameter e: Generic.Aux[Test.C,(Int, Int)]
+ implicitly[Generic.Aux[C, (Int, Int)]]
+ ^
+one error found
diff --git a/tests/untried/neg/t8104/Macros_1.scala b/tests/untried/neg/t8104/Macros_1.scala
new file mode 100644
index 000000000..129c8db16
--- /dev/null
+++ b/tests/untried/neg/t8104/Macros_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.whitebox.Context
+
+object Macros {
+ def impl[T](c: Context)(implicit T: c.WeakTypeTag[T]) = {
+ import c.universe._
+ import definitions._
+ val fields = T.tpe.decls.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+ val Repr = appliedType(TupleClass(fields.length).asType.toType, fields.map(_.info))
+ q"new Generic[$T]{ type Repr = $Repr }"
+ }
+}
diff --git a/tests/untried/neg/t8104/Test_2.scala b/tests/untried/neg/t8104/Test_2.scala
new file mode 100644
index 000000000..a3bd94018
--- /dev/null
+++ b/tests/untried/neg/t8104/Test_2.scala
@@ -0,0 +1,21 @@
+trait Generic[T] { type Repr }
+object Generic {
+ type Aux[T, Repr0] = Generic[T] { type Repr = Repr0 }
+ import scala.language.experimental.macros
+ implicit def materializeGeneric[T]: Generic[T] = macro Macros.impl[T]
+}
+
+object Test extends App {
+ case class C(x: Int, y: Int)
+
+ import scala.reflect.runtime.universe._
+ def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: WeakTypeTag[Repr]) = println(tag)
+ reprify(C(40, 2))
+
+ // this is a compilation error at the moment as explained in SI-8104
+ // because matchesPt in implicit search says that depoly(<type of materializeGeneric>) isn't a subtype of Generic.Aux[C, (Int, Int)]
+ // which is rightfully so, because depoly only replaces type parameters, not type members with wildcard types
+ // however in the future we might want to relax the matchesPt check, so this might start compiling
+ // therefore, if you've broken this test, then you should be happy, because most likely you've just enabled an interesting use case!
+ implicitly[Generic.Aux[C, (Int, Int)]]
+}
diff --git a/tests/untried/neg/t8143a.check b/tests/untried/neg/t8143a.check
new file mode 100644
index 000000000..4e11000a2
--- /dev/null
+++ b/tests/untried/neg/t8143a.check
@@ -0,0 +1,5 @@
+t8143a.scala:2: error: overriding method f in class Foo of type => Int;
+ method f has weaker access privileges; it should not be private
+class Bar extends Foo { private def f = 10 }
+ ^
+one error found
diff --git a/tests/untried/neg/t8143a.scala b/tests/untried/neg/t8143a.scala
new file mode 100644
index 000000000..6abe35e33
--- /dev/null
+++ b/tests/untried/neg/t8143a.scala
@@ -0,0 +1,15 @@
+class Foo { def f = 5 }
+class Bar extends Foo { private def f = 10 }
+
+
+class Foo1 { private def f = 5 }
+class Bar1 extends Foo1 { def f = 10 } // okay
+
+class Foo2 { private def f = 5 }
+class Bar2 extends Foo2 { private def f = 10 } // okay
+
+class Foo3 { private[this] def f = 5 }
+class Bar3 extends Foo3 { private def f = 10 } // okay
+
+class Foo4 { private def f = 5 }
+class Bar4 extends Foo4 { private[this] def f = 10 } // okay
diff --git a/tests/untried/neg/t8146-non-finitary-2.check b/tests/untried/neg/t8146-non-finitary-2.check
new file mode 100644
index 000000000..8c2e1436c
--- /dev/null
+++ b/tests/untried/neg/t8146-non-finitary-2.check
@@ -0,0 +1,9 @@
+t8146-non-finitary-2.scala:5: error: class graph is not finitary because type parameter X is expansively recursive
+trait C[X] extends N[N[C[D[X]]]]
+ ^
+t8146-non-finitary-2.scala:7: error: type mismatch;
+ found : C[Int]
+ required: N[C[Int]]
+ def foo(c: C[Int]): N[C[Int]] = c
+ ^
+two errors found
diff --git a/tests/untried/neg/t8146-non-finitary-2.scala b/tests/untried/neg/t8146-non-finitary-2.scala
new file mode 100644
index 000000000..c12f5f8f4
--- /dev/null
+++ b/tests/untried/neg/t8146-non-finitary-2.scala
@@ -0,0 +1,8 @@
+// Example 3 from "On Decidability of Nominal Subtyping with Variance" (Pierce, Kennedy)
+// http://research.microsoft.com/pubs/64041/fool2007.pdf
+trait N[-Z]
+trait D[Y]
+trait C[X] extends N[N[C[D[X]]]]
+object Test {
+ def foo(c: C[Int]): N[C[Int]] = c
+}
diff --git a/tests/untried/neg/t8146-non-finitary.check b/tests/untried/neg/t8146-non-finitary.check
new file mode 100644
index 000000000..8363b750c
--- /dev/null
+++ b/tests/untried/neg/t8146-non-finitary.check
@@ -0,0 +1,9 @@
+t8146-non-finitary.scala:4: error: class graph is not finitary because type parameter A is expansively recursive
+trait C[A] extends N[N[C[C[A]]]]
+ ^
+t8146-non-finitary.scala:6: error: type mismatch;
+ found : C[Int]
+ required: N[C[Int]]
+ def foo(c: C[Int]): N[C[Int]] = c
+ ^
+two errors found
diff --git a/tests/untried/neg/t8146-non-finitary.scala b/tests/untried/neg/t8146-non-finitary.scala
new file mode 100644
index 000000000..3d8a3074c
--- /dev/null
+++ b/tests/untried/neg/t8146-non-finitary.scala
@@ -0,0 +1,7 @@
+// Example 3 from "On Decidability of Nominal Subtyping with Variance" (Pierce, Kennedy)
+// http://research.microsoft.com/pubs/64041/fool2007.pdf
+trait N[-A]
+trait C[A] extends N[N[C[C[A]]]]
+object Test {
+ def foo(c: C[Int]): N[C[Int]] = c
+}
diff --git a/tests/untried/neg/t8157.check b/tests/untried/neg/t8157.check
new file mode 100644
index 000000000..9a21a49a0
--- /dev/null
+++ b/tests/untried/neg/t8157.check
@@ -0,0 +1,4 @@
+t8157.scala:1: error: in object Test, multiple overloaded alternatives of method foo define default arguments.
+object Test {
+ ^
+one error found
diff --git a/tests/untried/neg/t8157.scala b/tests/untried/neg/t8157.scala
new file mode 100644
index 000000000..462d4fa3f
--- /dev/null
+++ b/tests/untried/neg/t8157.scala
@@ -0,0 +1,4 @@
+object Test {
+ def foo(printer: Any, question: => String, show: Boolean = false)(op: => Any): Any = ???
+ def foo[T](question: => String, show: Boolean)(op: => Any = ()): Any = ???
+}
diff --git a/tests/untried/neg/t8158.check b/tests/untried/neg/t8158.check
new file mode 100644
index 000000000..fa6b744ba
--- /dev/null
+++ b/tests/untried/neg/t8158.check
@@ -0,0 +1,4 @@
+Test_2.scala:10: error: not enough patterns for <$anon: AnyRef> offering AnyRef{def isEmpty: Boolean; def get: $anon; def unapply(x: String): $anon}: expected 1, found 0
+ case X() =>
+ ^
+one error found
diff --git a/tests/untried/neg/t8158/Macros_1.scala b/tests/untried/neg/t8158/Macros_1.scala
new file mode 100644
index 000000000..b84e3ed8d
--- /dev/null
+++ b/tests/untried/neg/t8158/Macros_1.scala
@@ -0,0 +1,34 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+object Max {
+ def impl(c: Context)(any: c.Expr[Any]): c.Expr[Any] = {
+ import c.universe._
+ def fail(msg: String) = c.abort(c.enclosingPosition, msg)
+ val t = c.macroApplication match {
+ case q"$_.unapply($unargs)" =>
+ /* hangs
+ */
+ q"""
+ new {
+ def isEmpty = false
+ def get = this
+ def unapply(x: String) = this
+ }.unapply($unargs)
+ """
+ /*
+ if get returns Unit or Boolean:
+ wrong number of patterns for <$anon: AnyRef> offering Unit: expected 1, found 0
+ */
+ /* straightforward
+ q"""
+ new {
+ def unapply(x: String) = true
+ }.unapply($unargs)
+ """
+ */
+ case _ => fail("bad appl")
+ }
+ c.Expr[Any](t)
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t8158/Test_2.scala b/tests/untried/neg/t8158/Test_2.scala
new file mode 100644
index 000000000..f5ac6616b
--- /dev/null
+++ b/tests/untried/neg/t8158/Test_2.scala
@@ -0,0 +1,14 @@
+import scala.language.experimental.macros
+
+object X {
+ def unapply(any: Any): Any = macro Max.impl
+}
+
+class BugTest {
+ def bug(): Unit = {
+ "any" match {
+ case X() =>
+ case _ => ???
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/untried/neg/t8177a.check b/tests/untried/neg/t8177a.check
new file mode 100644
index 000000000..0d01206e0
--- /dev/null
+++ b/tests/untried/neg/t8177a.check
@@ -0,0 +1,6 @@
+t8177a.scala:5: error: type mismatch;
+ found : A{type Result = Int}
+ required: A{type Result = String}
+ : A { type Result = String} = x
+ ^
+one error found
diff --git a/tests/untried/neg/t8177a.scala b/tests/untried/neg/t8177a.scala
new file mode 100644
index 000000000..0347541ea
--- /dev/null
+++ b/tests/untried/neg/t8177a.scala
@@ -0,0 +1,6 @@
+trait A { type Result }
+
+class PolyTests {
+ def wrong(x: A { type Result = Int })
+ : A { type Result = String} = x
+}
diff --git a/tests/untried/neg/t8182.check b/tests/untried/neg/t8182.check
new file mode 100644
index 000000000..a156d7088
--- /dev/null
+++ b/tests/untried/neg/t8182.check
@@ -0,0 +1,22 @@
+t8182.scala:4: error: illegal start of simple pattern
+}
+^
+t8182.scala:7: error: illegal start of simple pattern
+}
+^
+t8182.scala:6: error: type application is not allowed in pattern
+ val a b[B] // error then continue as for X
+ ^
+t8182.scala:10: error: illegal start of simple pattern
+ case a b[B] => // bumpy recovery
+ ^
+t8182.scala:10: error: type application is not allowed in pattern
+ case a b[B] => // bumpy recovery
+ ^
+t8182.scala:11: error: '=>' expected but '}' found.
+ }
+ ^
+t8182.scala:16: error: type application is not allowed in pattern
+ case a B[T] b =>
+ ^
+7 errors found
diff --git a/tests/untried/neg/t8182.scala b/tests/untried/neg/t8182.scala
new file mode 100644
index 000000000..1b3bc9821
--- /dev/null
+++ b/tests/untried/neg/t8182.scala
@@ -0,0 +1,18 @@
+
+trait X {
+ val a b // something missing
+}
+trait Y {
+ val a b[B] // error then continue as for X
+}
+trait Z {
+ (null: Any) match {
+ case a b[B] => // bumpy recovery
+ }
+}
+object B { def unapply[W](a: Any) = Some((1,2)) }
+trait Z {
+ (null: Any) match {
+ case a B[T] b =>
+ }
+}
diff --git a/tests/untried/neg/t8207.check b/tests/untried/neg/t8207.check
new file mode 100644
index 000000000..59facd897
--- /dev/null
+++ b/tests/untried/neg/t8207.check
@@ -0,0 +1,7 @@
+t8207.scala:1: error: '.' expected but '}' found.
+class C { import C.this.toString }
+ ^
+t8207.scala:3: error: '.' expected but '}' found.
+class D { import D.this.toString }
+ ^
+two errors found
diff --git a/tests/untried/neg/t8207.scala b/tests/untried/neg/t8207.scala
new file mode 100644
index 000000000..738ce381f
--- /dev/null
+++ b/tests/untried/neg/t8207.scala
@@ -0,0 +1,3 @@
+class C { import C.this.toString }
+
+class D { import D.this.toString }
diff --git a/tests/untried/neg/t8219-any-any-ref-equals.check b/tests/untried/neg/t8219-any-any-ref-equals.check
new file mode 100644
index 000000000..95d2536fb
--- /dev/null
+++ b/tests/untried/neg/t8219-any-any-ref-equals.check
@@ -0,0 +1,10 @@
+t8219-any-any-ref-equals.scala:5: error: method ==: (x$1: Any)Boolean does not take type parameters.
+ "".==[Int]
+ ^
+t8219-any-any-ref-equals.scala:6: error: method ==: (x$1: Any)Boolean does not take type parameters.
+ ("": AnyRef).==[Int]
+ ^
+t8219-any-any-ref-equals.scala:7: error: method ==: (x$1: Any)Boolean does not take type parameters.
+ ("": Object).==[Int]
+ ^
+three errors found
diff --git a/tests/untried/neg/t8219-any-any-ref-equals.scala b/tests/untried/neg/t8219-any-any-ref-equals.scala
new file mode 100644
index 000000000..f1b81fa73
--- /dev/null
+++ b/tests/untried/neg/t8219-any-any-ref-equals.scala
@@ -0,0 +1,8 @@
+object Test {
+ // The error message tells us that AnyRef#== and Any#== are overloaded.
+ // A real class couldn't define such an overload, why do we allow AnyRef
+ // to do so?
+ "".==[Int]
+ ("": AnyRef).==[Int]
+ ("": Object).==[Int]
+}
diff --git a/tests/untried/neg/t8228.check b/tests/untried/neg/t8228.check
new file mode 100644
index 000000000..02eff4b1b
--- /dev/null
+++ b/tests/untried/neg/t8228.check
@@ -0,0 +1,4 @@
+t8228.scala:4: error: recursive value foo needs type
+ val foo = foo(null)
+ ^
+one error found
diff --git a/tests/untried/neg/t8228.scala b/tests/untried/neg/t8228.scala
new file mode 100644
index 000000000..19d71aeab
--- /dev/null
+++ b/tests/untried/neg/t8228.scala
@@ -0,0 +1,7 @@
+object X {
+ def bar = {
+ def foo(x: Any) = ""
+ val foo = foo(null)
+ foo(null) // cycle in isApplicableBasedOnArity
+ }
+}
diff --git a/tests/untried/neg/t8229.check b/tests/untried/neg/t8229.check
new file mode 100644
index 000000000..cc504fa34
--- /dev/null
+++ b/tests/untried/neg/t8229.check
@@ -0,0 +1,4 @@
+t8229.scala:5: error: value + is not a member of Object
+ o + ""
+ ^
+one error found
diff --git a/tests/untried/neg/t8229.scala b/tests/untried/neg/t8229.scala
new file mode 100644
index 000000000..91966311e
--- /dev/null
+++ b/tests/untried/neg/t8229.scala
@@ -0,0 +1,6 @@
+import Predef.{any2stringadd => _, _}
+
+object Test {
+ val o = new Object()
+ o + ""
+}
diff --git a/tests/untried/neg/t8237-default.check b/tests/untried/neg/t8237-default.check
new file mode 100644
index 000000000..59fe21ed0
--- /dev/null
+++ b/tests/untried/neg/t8237-default.check
@@ -0,0 +1,13 @@
+t8237-default.scala:5: error: no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T[?T[List[?T[X forSome { type X }]]]]
+ test4(test4$default$1)
+ ^
+t8237-default.scala:5: error: type mismatch;
+ found : List[Int]
+ required: T[T[List[T[X forSome { type X }]]]]
+ test4(test4$default$1)
+ ^
+two errors found
diff --git a/tests/untried/neg/t8237-default.scala b/tests/untried/neg/t8237-default.scala
new file mode 100644
index 000000000..f695aa523
--- /dev/null
+++ b/tests/untried/neg/t8237-default.scala
@@ -0,0 +1,29 @@
+// This test case was extracte from `names-defaults-neg.scala`
+// It pinpoints an improvement an error message that results from
+// a type inference failure
+object Test extends App {
+ test4(test4$default$1)
+
+ def test4[T[P]](x: T[T[List[T[X forSome { type X }]]]]) = ???
+ def test4$default$1[T[P]]: List[Int] = ???
+}
+
+/*
+OLD:
+ no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T
+ test4(test4$default$1)
+ ^
+
+NEW:
+
+no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T[?T[List[?T[X forSome { type X }]]]
+ test4(test4$default$1)
+*/
diff --git a/tests/untried/neg/t8244.check b/tests/untried/neg/t8244.check
new file mode 100644
index 000000000..90b2bf6f4
--- /dev/null
+++ b/tests/untried/neg/t8244.check
@@ -0,0 +1,4 @@
+Test_2.scala:9: error: value exxx is not a member of ?0
+ raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X
+ ^
+one error found
diff --git a/tests/untried/neg/t8244/Raw_1.java b/tests/untried/neg/t8244/Raw_1.java
new file mode 100644
index 000000000..0c667f110
--- /dev/null
+++ b/tests/untried/neg/t8244/Raw_1.java
@@ -0,0 +1,4 @@
+public abstract class Raw_1<T>{
+ public Raw_1 raw() { return new Raw_1<String>() { public String t() { return ""; } }; }
+ public abstract T t();
+}
diff --git a/tests/untried/neg/t8244/Test_2.scala b/tests/untried/neg/t8244/Test_2.scala
new file mode 100644
index 000000000..152bb0b87
--- /dev/null
+++ b/tests/untried/neg/t8244/Test_2.scala
@@ -0,0 +1,12 @@
+class X extends Raw_1[X] {
+ override def t = this
+ def exxx = 0
+}
+
+object Test extends App {
+ def c(s: X) = {
+ val raw = s.raw
+ raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X
+ }
+ c(new X())
+}
diff --git a/tests/untried/neg/t8244b.check b/tests/untried/neg/t8244b.check
new file mode 100644
index 000000000..f6cbf99eb
--- /dev/null
+++ b/tests/untried/neg/t8244b.check
@@ -0,0 +1,4 @@
+t8244b.scala:15: error: value exxx is not a member of _$1
+ raw.t.exxx
+ ^
+one error found
diff --git a/tests/untried/neg/t8244b.scala b/tests/untried/neg/t8244b.scala
new file mode 100644
index 000000000..2fb4f451a
--- /dev/null
+++ b/tests/untried/neg/t8244b.scala
@@ -0,0 +1,18 @@
+class Raw_1[T]{
+ def raw(): Raw_1[_] = { new Raw_1[String] { def t() = "" } }
+ def t(): T
+}
+
+
+class X extends Raw_1[X] {
+ override def t = this
+ def exxx = 0
+}
+
+object Test extends App {
+ def c(s: X) = {
+ val raw = s.raw
+ raw.t.exxx
+ }
+ c(new X())
+}
diff --git a/tests/untried/neg/t8244c.check b/tests/untried/neg/t8244c.check
new file mode 100644
index 000000000..fd58a5847
--- /dev/null
+++ b/tests/untried/neg/t8244c.check
@@ -0,0 +1,4 @@
+t8244c.scala:15: error: value exxx is not a member of _$1
+ raw.t.exxx
+ ^
+one error found
diff --git a/tests/untried/neg/t8244c.scala b/tests/untried/neg/t8244c.scala
new file mode 100644
index 000000000..2fb4f451a
--- /dev/null
+++ b/tests/untried/neg/t8244c.scala
@@ -0,0 +1,18 @@
+class Raw_1[T]{
+ def raw(): Raw_1[_] = { new Raw_1[String] { def t() = "" } }
+ def t(): T
+}
+
+
+class X extends Raw_1[X] {
+ override def t = this
+ def exxx = 0
+}
+
+object Test extends App {
+ def c(s: X) = {
+ val raw = s.raw
+ raw.t.exxx
+ }
+ c(new X())
+}
diff --git a/tests/untried/neg/t8244e.check b/tests/untried/neg/t8244e.check
new file mode 100644
index 000000000..ebd74036e
--- /dev/null
+++ b/tests/untried/neg/t8244e.check
@@ -0,0 +1,4 @@
+Test.scala:9: error: value exxx is not a member of ?0
+ raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X
+ ^
+one error found
diff --git a/tests/untried/neg/t8244e/Raw.java b/tests/untried/neg/t8244e/Raw.java
new file mode 100644
index 000000000..53202e319
--- /dev/null
+++ b/tests/untried/neg/t8244e/Raw.java
@@ -0,0 +1,4 @@
+public abstract class Raw<T>{
+ public Raw raw() { return new Raw<String>() { public String t() { return ""; } }; }
+ public abstract T t();
+}
diff --git a/tests/untried/neg/t8244e/Test.scala b/tests/untried/neg/t8244e/Test.scala
new file mode 100644
index 000000000..ca2a90583
--- /dev/null
+++ b/tests/untried/neg/t8244e/Test.scala
@@ -0,0 +1,12 @@
+class X extends Raw[X] {
+ override def t = this
+ def exxx = 0
+}
+
+object Test extends App {
+ def c(s: X) = {
+ val raw = s.raw
+ raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X
+ }
+ c(new X())
+}
diff --git a/tests/untried/neg/t8266-invalid-interp.check b/tests/untried/neg/t8266-invalid-interp.check
new file mode 100644
index 000000000..70dd4081b
--- /dev/null
+++ b/tests/untried/neg/t8266-invalid-interp.check
@@ -0,0 +1,10 @@
+t8266-invalid-interp.scala:4: error: Trailing '\' escapes nothing.
+ f"a\",
+ ^
+t8266-invalid-interp.scala:5: error: invalid escape character at index 1 in "a\xc"
+ f"a\xc",
+ ^
+t8266-invalid-interp.scala:7: error: invalid escape character at index 1 in "a\vc"
+ f"a\vc"
+ ^
+three errors found
diff --git a/tests/untried/neg/t8266-invalid-interp.scala b/tests/untried/neg/t8266-invalid-interp.scala
new file mode 100644
index 000000000..4b2654688
--- /dev/null
+++ b/tests/untried/neg/t8266-invalid-interp.scala
@@ -0,0 +1,9 @@
+
+trait X {
+ def f = Seq(
+ f"a\",
+ f"a\xc",
+ // following could suggest \u000b for vertical tab, similar for \a alert
+ f"a\vc"
+ )
+}
diff --git a/tests/untried/neg/t8300-overloading.check b/tests/untried/neg/t8300-overloading.check
new file mode 100644
index 000000000..edd34d44b
--- /dev/null
+++ b/tests/untried/neg/t8300-overloading.check
@@ -0,0 +1,7 @@
+t8300-overloading.scala:15: error: double definition:
+def foo(name: Test.u.Name): Nothing at line 14 and
+def foo(name: Test.u.TermName): Nothing at line 15
+have same type after erasure: (name: Universe#NameApi)Nothing
+ def foo(name: TermName) = ???
+ ^
+one error found
diff --git a/tests/untried/neg/t8300-overloading.scala b/tests/untried/neg/t8300-overloading.scala
new file mode 100644
index 000000000..0f4eee7b4
--- /dev/null
+++ b/tests/untried/neg/t8300-overloading.scala
@@ -0,0 +1,16 @@
+// cf. pos/t8300-overloading.scala
+trait Universe {
+ type Name >: Null <: AnyRef with NameApi
+ trait NameApi
+
+ type TermName >: Null <: Name with TermNameApi
+ trait TermNameApi extends NameApi
+}
+
+object Test extends App {
+ val u: Universe = ???
+ import u._
+
+ def foo(name: Name) = ???
+ def foo(name: TermName) = ???
+}
diff --git a/tests/untried/neg/t835.check b/tests/untried/neg/t835.check
new file mode 100644
index 000000000..6ad18d302
--- /dev/null
+++ b/tests/untried/neg/t835.check
@@ -0,0 +1,9 @@
+t835.scala:2: error: no `: _*' annotation allowed here
+(such annotations are only allowed in arguments to *-parameters)
+ Console.println(List(List(1, 2, 3) : _*, List(4, 5, 6) : _*))
+ ^
+t835.scala:2: error: no `: _*' annotation allowed here
+(such annotations are only allowed in arguments to *-parameters)
+ Console.println(List(List(1, 2, 3) : _*, List(4, 5, 6) : _*))
+ ^
+two errors found
diff --git a/tests/untried/neg/t835.scala b/tests/untried/neg/t835.scala
new file mode 100644
index 000000000..553d2c1be
--- /dev/null
+++ b/tests/untried/neg/t835.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Console.println(List(List(1, 2, 3) : _*, List(4, 5, 6) : _*))
+}
diff --git a/tests/untried/neg/t836.check b/tests/untried/neg/t836.check
new file mode 100644
index 000000000..cf2faf926
--- /dev/null
+++ b/tests/untried/neg/t836.check
@@ -0,0 +1,7 @@
+t836.scala:9: error: type mismatch;
+ found : Any
+ required: A.this.S
+ (which expands to) A.this.MyObj#S
+ val some: S = any // compiles => type X is set to scala.Any
+ ^
+one error found
diff --git a/tests/untried/neg/t836.scala b/tests/untried/neg/t836.scala
new file mode 100644
index 000000000..3633b816c
--- /dev/null
+++ b/tests/untried/neg/t836.scala
@@ -0,0 +1,16 @@
+abstract class Obj { type S }
+class ObjImpl extends Obj { type S = String }
+
+abstract class A {
+ type MyObj <: Obj
+ type S = MyObj#S
+
+ val any: Any = 0
+ val some: S = any // compiles => type X is set to scala.Any
+}
+
+class B extends A {
+ type MyObj = ObjImpl
+ val myString: S = "hello"
+ val realString: String = myString // error: type missmatch
+}
diff --git a/tests/untried/neg/t8372.check b/tests/untried/neg/t8372.check
new file mode 100644
index 000000000..6a6424a83
--- /dev/null
+++ b/tests/untried/neg/t8372.check
@@ -0,0 +1,7 @@
+t8372.scala:7: error: No ClassTag available for T1
+ def unzip[T1, T2](a: Array[(T1, T2)]) = a.unzip
+ ^
+t8372.scala:9: error: No ClassTag available for T1
+ def unzip3[T1, T2, T3](a: Array[(T1, T2, T3)]): (Array[T1], Array[T2], Array[T3]) = a.unzip3
+ ^
+two errors found
diff --git a/tests/untried/neg/t8372.scala b/tests/untried/neg/t8372.scala
new file mode 100644
index 000000000..60a674f4d
--- /dev/null
+++ b/tests/untried/neg/t8372.scala
@@ -0,0 +1,10 @@
+class t8372 {
+ // failed with "error: tpe T1 is an unresolved spliceable type"; that was caused by
+ // misguided type inference of type parameters in ArrayOps.unzip
+ // the type inference failed because the order of implicit arguments was wrong
+ // the evidence that T <: (T1, T2) came as last argument so it couldn't guide the
+ // type inference early enough
+ def unzip[T1, T2](a: Array[(T1, T2)]) = a.unzip
+ // the same as above
+ def unzip3[T1, T2, T3](a: Array[(T1, T2, T3)]): (Array[T1], Array[T2], Array[T3]) = a.unzip3
+}
diff --git a/tests/untried/neg/t8376.check b/tests/untried/neg/t8376.check
new file mode 100644
index 000000000..22ed942d5
--- /dev/null
+++ b/tests/untried/neg/t8376.check
@@ -0,0 +1,7 @@
+S.scala:2: error: overloaded method value m with alternatives:
+ (a: J*)Unit <and>
+ (a: String*)Unit
+ cannot be applied to (Int)
+ J.m(0)
+ ^
+one error found
diff --git a/tests/untried/neg/t8376/J.java b/tests/untried/neg/t8376/J.java
new file mode 100644
index 000000000..29aa23da8
--- /dev/null
+++ b/tests/untried/neg/t8376/J.java
@@ -0,0 +1,4 @@
+class J {
+ public static void m(String... a) { }
+ public static void m(J... a) { }
+}
diff --git a/tests/untried/neg/t8376/S.scala b/tests/untried/neg/t8376/S.scala
new file mode 100644
index 000000000..a19f0d3c0
--- /dev/null
+++ b/tests/untried/neg/t8376/S.scala
@@ -0,0 +1,4 @@
+object S {
+ J.m(0)
+ // the error message should show `T*` in the method signatures rather than `<repeated>[T]`
+}
diff --git a/tests/untried/neg/t845.check b/tests/untried/neg/t845.check
new file mode 100644
index 000000000..07ed7e417
--- /dev/null
+++ b/tests/untried/neg/t845.check
@@ -0,0 +1,4 @@
+t845.scala:4: error: only classes can have declared but undefined members
+ type Bar;
+ ^
+one error found
diff --git a/tests/untried/neg/t845.scala b/tests/untried/neg/t845.scala
new file mode 100644
index 000000000..ddf6a16f3
--- /dev/null
+++ b/tests/untried/neg/t845.scala
@@ -0,0 +1,16 @@
+package test;
+
+object Test extends App {
+ type Bar;
+ trait FooImpl;
+
+ trait Bob {
+ def bar : Bar with FooImpl;
+ }
+ def ifn[A,B](a : A)(f : A => B) =
+ if (a != null) f(a) else null;
+
+ val bob : Bob = null;
+ val bar = ifn(bob)(_.bar);
+ assert(bar == null);
+}
diff --git a/tests/untried/neg/t846.check b/tests/untried/neg/t846.check
new file mode 100644
index 000000000..242a8001f
--- /dev/null
+++ b/tests/untried/neg/t846.check
@@ -0,0 +1,6 @@
+t846.scala:9: error: type mismatch;
+ found : Null(null)
+ required: B
+ if (a != null) f(a) else null
+ ^
+one error found
diff --git a/tests/untried/neg/t846.scala b/tests/untried/neg/t846.scala
new file mode 100644
index 000000000..acf846203
--- /dev/null
+++ b/tests/untried/neg/t846.scala
@@ -0,0 +1,13 @@
+package test;
+trait Test {
+ type Bar;
+ trait FooImpl;
+ trait Bob {
+ def bar : Bar with FooImpl;
+ }
+ def ifn[A,B](a : A)(f : A => B): B =
+ if (a != null) f(a) else null
+ val bob : Bob = null;
+ val bar = ifn(bob)(_.bar);
+ assert(bar == null);
+}
diff --git a/tests/untried/neg/t856.check b/tests/untried/neg/t856.check
new file mode 100644
index 000000000..fb93f96d9
--- /dev/null
+++ b/tests/untried/neg/t856.check
@@ -0,0 +1,14 @@
+t856.scala:3: error: class ComplexRect needs to be abstract, since:
+it has 2 unimplemented members.
+/** As seen from class ComplexRect, the missing signatures are as follows.
+ * For convenience, these are usable as stub implementations.
+ */
+ // Members declared in scala.Equals
+ def canEqual(that: Any): Boolean = ???
+
+ // Members declared in scala.Product2
+ def _2: Double = ???
+
+class ComplexRect(val _1:Double, _2:Double) extends Complex {
+ ^
+one error found
diff --git a/tests/untried/neg/t856.scala b/tests/untried/neg/t856.scala
new file mode 100644
index 000000000..fea216bfa
--- /dev/null
+++ b/tests/untried/neg/t856.scala
@@ -0,0 +1,11 @@
+trait Complex extends Product2[Double,Double]
+
+class ComplexRect(val _1:Double, _2:Double) extends Complex {
+ override def toString = "ComplexRect("+_1+","+_2+")"
+}
+
+object Test {
+ def main(args:Array[String]) = {
+ new ComplexRect(1,1)._2
+ }
+}
diff --git a/tests/untried/neg/t875.check b/tests/untried/neg/t875.check
new file mode 100644
index 000000000..406edcf50
--- /dev/null
+++ b/tests/untried/neg/t875.check
@@ -0,0 +1,17 @@
+t875.scala:3: error: no `: _*' annotation allowed here
+(such annotations are only allowed in arguments to *-parameters)
+ val ys = List(1, 2, 3, xs: _*)
+ ^
+t875.scala:6: error: no `: _*' annotation allowed here
+(such annotations are only allowed in arguments to *-parameters)
+ mkList1(xs: _*)
+ ^
+t875.scala:15: error: no `: _*' annotation allowed here
+(such annotations are only allowed in arguments to *-parameters)
+ f(true, 1, xs: _*)
+ ^
+t875.scala:16: error: no `: _*' annotation allowed here
+(such annotations are only allowed in arguments to *-parameters)
+ g(1, xs:_*)
+ ^
+four errors found
diff --git a/tests/untried/neg/t875.scala b/tests/untried/neg/t875.scala
new file mode 100644
index 000000000..841b2aec3
--- /dev/null
+++ b/tests/untried/neg/t875.scala
@@ -0,0 +1,18 @@
+object Test extends App {
+ val xs = List(4, 5, 6)
+ val ys = List(1, 2, 3, xs: _*)
+ def mkList1(x: Int) = List(x)
+ def mkList2(x: Boolean) = List(x)
+ mkList1(xs: _*)
+
+
+ def f(x: Int*) = List(x: _*)
+
+ def f(x: Boolean, y: Int*) = List(y: _*)
+
+ def g[a](x: a*) = List(x: _*)
+
+ f(true, 1, xs: _*)
+ g(1, xs:_*)
+
+}
diff --git a/tests/untried/neg/t876.check b/tests/untried/neg/t876.check
new file mode 100644
index 000000000..04c5c8f22
--- /dev/null
+++ b/tests/untried/neg/t876.check
@@ -0,0 +1,4 @@
+t876.scala:25: error: too many arguments for method apply: (key: AssertionError.A)manager.B in class HashMap
+ assert(manager.map(A2) == List(manager.map(A2, A1)))
+ ^
+one error found
diff --git a/tests/untried/neg/t876.scala b/tests/untried/neg/t876.scala
new file mode 100644
index 000000000..981d48d8b
--- /dev/null
+++ b/tests/untried/neg/t876.scala
@@ -0,0 +1,28 @@
+import scala.collection.mutable.HashMap
+
+object AssertionError extends AnyRef with App
+{
+ abstract class A {}
+
+ object A1 extends A {}
+
+ object A2 extends A {}
+
+ class Manager
+ {
+ final class B {}
+
+ val map = new HashMap[A, B]
+ }
+
+
+ def test[T](f: => T): Unit = { f }
+
+ test {
+ val manager = new Manager
+
+ // This line is illegal and causes a compiler crash with Scala 2.3.1
+ assert(manager.map(A2) == List(manager.map(A2, A1)))
+ }
+
+}
diff --git a/tests/untried/neg/t877.check b/tests/untried/neg/t877.check
new file mode 100644
index 000000000..c3d4ab658
--- /dev/null
+++ b/tests/untried/neg/t877.check
@@ -0,0 +1,7 @@
+t877.scala:3: error: Invalid literal number
+trait Foo extends A(22A, Bug!) {}
+ ^
+t877.scala:3: error: ')' expected but eof found.
+trait Foo extends A(22A, Bug!) {}
+ ^
+two errors found
diff --git a/tests/untried/neg/t877.scala b/tests/untried/neg/t877.scala
new file mode 100644
index 000000000..5e132a1dd
--- /dev/null
+++ b/tests/untried/neg/t877.scala
@@ -0,0 +1,3 @@
+class A
+
+trait Foo extends A(22A, Bug!) {}
diff --git a/tests/untried/neg/t882.check b/tests/untried/neg/t882.check
new file mode 100644
index 000000000..a906778a1
--- /dev/null
+++ b/tests/untried/neg/t882.check
@@ -0,0 +1,4 @@
+t882.scala:2: error: traits cannot have type parameters with context bounds `: ...' nor view bounds `<% ...'
+trait SortedSet[A <% Ordered[A]] {
+ ^
+one error found
diff --git a/tests/untried/neg/t882.scala b/tests/untried/neg/t882.scala
new file mode 100644
index 000000000..5a8908bef
--- /dev/null
+++ b/tests/untried/neg/t882.scala
@@ -0,0 +1,6 @@
+package test;
+trait SortedSet[A <% Ordered[A]] {
+ def first : A;
+ def last : A;
+ assert(first.compare(last) < 0);
+}
diff --git a/tests/untried/neg/t900.check b/tests/untried/neg/t900.check
new file mode 100644
index 000000000..6fe26a31a
--- /dev/null
+++ b/tests/untried/neg/t900.check
@@ -0,0 +1,9 @@
+t900.scala:4: error: type mismatch;
+ found : Foo.this.x.type (with underlying type Foo.this.bar)
+ required: AnyRef
+Note that bar is unbounded, which means AnyRef is not a known parent.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ def break(): x.type
+ ^
+one error found
diff --git a/tests/untried/neg/t900.scala b/tests/untried/neg/t900.scala
new file mode 100644
index 000000000..2d2c85757
--- /dev/null
+++ b/tests/untried/neg/t900.scala
@@ -0,0 +1,5 @@
+trait Foo {
+ type bar
+ val x : bar
+ def break(): x.type
+}
diff --git a/tests/untried/neg/t908.check b/tests/untried/neg/t908.check
new file mode 100644
index 000000000..2c723a700
--- /dev/null
+++ b/tests/untried/neg/t908.check
@@ -0,0 +1,4 @@
+t908.scala:8: error: not found: value makeA
+ this(makeA)
+ ^
+one error found
diff --git a/tests/untried/neg/t908.scala b/tests/untried/neg/t908.scala
new file mode 100644
index 000000000..97f3c5058
--- /dev/null
+++ b/tests/untried/neg/t908.scala
@@ -0,0 +1,11 @@
+abstract class A[T <% Ordered[T]] {
+ def makeA = new Object
+// case object default extends Object
+}
+
+class C[T <% Ordered[T]](foo: Object) extends A[T] {
+ def this() = {
+ this(makeA)
+ // this(default)
+ }
+}
diff --git a/tests/untried/neg/t909.check b/tests/untried/neg/t909.check
new file mode 100644
index 000000000..e7a42bd24
--- /dev/null
+++ b/tests/untried/neg/t909.check
@@ -0,0 +1,6 @@
+t909.scala:6: error: type mismatch;
+ found : String("Hello")
+ required: Int
+ case Foo("Hello") =>
+ ^
+one error found
diff --git a/tests/untried/neg/t909.scala b/tests/untried/neg/t909.scala
new file mode 100644
index 000000000..63dd88adf
--- /dev/null
+++ b/tests/untried/neg/t909.scala
@@ -0,0 +1,9 @@
+case class Foo(x:Int)
+
+object Bar {
+ def main(args:Array[String]): Unit = {
+ Foo(2) match {
+ case Foo("Hello") =>
+ }
+ }
+}
diff --git a/tests/untried/neg/t910.check b/tests/untried/neg/t910.check
new file mode 100644
index 000000000..45420f8e3
--- /dev/null
+++ b/tests/untried/neg/t910.check
@@ -0,0 +1,6 @@
+t910.scala:4: error: type mismatch;
+ found : Seq[Char]
+ required: Seq[Int]
+ val y: Seq[Int] = rest
+ ^
+one error found
diff --git a/tests/untried/neg/t910.scala b/tests/untried/neg/t910.scala
new file mode 100644
index 000000000..cc47104d1
--- /dev/null
+++ b/tests/untried/neg/t910.scala
@@ -0,0 +1,7 @@
+object RegExpTest1 extends App {
+ def co(x: Seq[Char]) = x match {
+ case Seq('s','c','a','l','a', rest @ _*) =>
+ val y: Seq[Int] = rest
+ y
+ }
+}
diff --git a/tests/untried/neg/t935.check b/tests/untried/neg/t935.check
new file mode 100644
index 000000000..af634a263
--- /dev/null
+++ b/tests/untried/neg/t935.check
@@ -0,0 +1,7 @@
+t935.scala:7: error: type arguments [Test3.B] do not conform to class E's type parameter bounds [T <: String]
+ @E[B](new B) val b = "hi"
+ ^
+t935.scala:13: error: type arguments [Test4.B] do not conform to class E's type parameter bounds [T <: String]
+ val b: String @E[B](new B) = "hi"
+ ^
+two errors found
diff --git a/tests/untried/neg/t935.scala b/tests/untried/neg/t935.scala
new file mode 100644
index 000000000..299062adb
--- /dev/null
+++ b/tests/untried/neg/t935.scala
@@ -0,0 +1,14 @@
+import annotation.Annotation
+
+object Test3 {
+ class E[T >: Nothing <: String](s: T) extends Annotation
+ class B
+ // val a = new E[B](new B)
+ @E[B](new B) val b = "hi"
+}
+
+object Test4 {
+ class E[T <: String](s: T) extends Annotation
+ class B
+ val b: String @E[B](new B) = "hi"
+}
diff --git a/tests/untried/neg/t944.check b/tests/untried/neg/t944.check
new file mode 100644
index 000000000..1fc0a1220
--- /dev/null
+++ b/tests/untried/neg/t944.check
@@ -0,0 +1,4 @@
+t944.scala:5: error: implementation restricts functions to 22 parameters
+ a23:Int) => 1
+ ^
+one error found
diff --git a/tests/untried/neg/t944.scala b/tests/untried/neg/t944.scala
new file mode 100644
index 000000000..dc80e5f49
--- /dev/null
+++ b/tests/untried/neg/t944.scala
@@ -0,0 +1,6 @@
+object TooManyArgsFunction {
+ val f = (a1:Int, a2:Int, a3:Int, a4:Int, a5:Int, a6:Int, a7:Int, a8:Int,
+ a9:Int, a10:Int, a11:Int, a12:Int, a13:Int, a14:Int, a15:Int,
+ a16:Int, a17:Int, a18:Int, a19:Int, a20:Int, a21:Int, a22:Int,
+ a23:Int) => 1
+}
diff --git a/tests/untried/neg/t961.check b/tests/untried/neg/t961.check
new file mode 100644
index 000000000..14d39b0f4
--- /dev/null
+++ b/tests/untried/neg/t961.check
@@ -0,0 +1,4 @@
+t961.scala:11: error: Temp.B.type does not take parameters
+ B() match {
+ ^
+one error found
diff --git a/tests/untried/neg/t961.scala b/tests/untried/neg/t961.scala
new file mode 100644
index 000000000..088bddd7e
--- /dev/null
+++ b/tests/untried/neg/t961.scala
@@ -0,0 +1,14 @@
+object Temp {
+ abstract class A
+ object B {
+ private case class B_inner() extends A
+ def apply: A = B_inner()
+ def unapply(a: A) = a match {
+ case B_inner() => true
+ case _ => false
+ }
+ }
+ B() match {
+ case B() => Console.println("match")
+ }
+}
diff --git a/tests/untried/neg/t963.check b/tests/untried/neg/t963.check
new file mode 100644
index 000000000..4dc202c7b
--- /dev/null
+++ b/tests/untried/neg/t963.check
@@ -0,0 +1,12 @@
+t963.scala:14: error: stable identifier required, but Test.this.y3.x found.
+ val w3 : y3.x.type = y3.x
+ ^
+t963.scala:17: error: stable identifier required, but Test.this.y4.x found.
+ val w4 : y4.x.type = y4.x
+ ^
+t963.scala:10: error: type mismatch;
+ found : AnyRef{def x: Integer}
+ required: AnyRef{val x: Integer}
+ val y2 : { val x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) }
+ ^
+three errors found
diff --git a/tests/untried/neg/t963.scala b/tests/untried/neg/t963.scala
new file mode 100644
index 000000000..0cc203429
--- /dev/null
+++ b/tests/untried/neg/t963.scala
@@ -0,0 +1,18 @@
+import scala.util.Random
+
+// Only y1 (val/val) should actually compile.
+object Test {
+ val r = new Random()
+
+ val y1 : { val x : java.lang.Integer } = new { val x = new java.lang.Integer(r.nextInt) }
+ val w1 : y1.x.type = y1.x
+
+ val y2 : { val x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) }
+ val w2 : y2.x.type = y2.x
+
+ val y3 : { def x : java.lang.Integer } = new { val x = new java.lang.Integer(r.nextInt) }
+ val w3 : y3.x.type = y3.x
+
+ val y4 : { def x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) }
+ val w4 : y4.x.type = y4.x
+}
diff --git a/tests/untried/neg/t963b.check b/tests/untried/neg/t963b.check
new file mode 100644
index 000000000..9918a98c4
--- /dev/null
+++ b/tests/untried/neg/t963b.check
@@ -0,0 +1,6 @@
+t963b.scala:25: error: type mismatch;
+ found : B.type
+ required: AnyRef{val y: A}
+ B.f(B)
+ ^
+one error found
diff --git a/tests/untried/neg/t963b.scala b/tests/untried/neg/t963b.scala
new file mode 100644
index 000000000..3442f46c4
--- /dev/null
+++ b/tests/untried/neg/t963b.scala
@@ -0,0 +1,26 @@
+// Soundness bug, at #963 and dup at #2079.
+trait A {
+ type T
+ var v : T
+}
+
+object B {
+ def f(x : { val y : A }): Unit = { x.y.v = x.y.v }
+
+ var a : A = _
+ var b : Boolean = false
+ def y : A = {
+ if(b) {
+ a = new A { type T = Int; var v = 1 }
+ a
+ } else {
+ a = new A { type T = String; var v = "" }
+ b = true
+ a
+ }
+ }
+}
+
+object Test extends App {
+ B.f(B)
+}
diff --git a/tests/untried/neg/t987.check b/tests/untried/neg/t987.check
new file mode 100644
index 000000000..90ab70ba1
--- /dev/null
+++ b/tests/untried/neg/t987.check
@@ -0,0 +1,19 @@
+t987.scala:15: error: illegal inheritance;
+ class E inherits different type instances of trait B:
+B[D] and B[C]
+class E extends D
+ ^
+t987.scala:20: error: illegal inheritance;
+ class F inherits different type instances of trait B:
+B[D] and B[C]
+class F extends D
+ ^
+t987.scala:25: error: illegal inheritance;
+ class D inherits different type instances of trait B:
+B[D] and B[C]
+abstract class D extends C with B[D] {}
+ ^
+t987.scala:25: error: type arguments [D] do not conform to trait B's type parameter bounds [T <: B[T]]
+abstract class D extends C with B[D] {}
+ ^
+four errors found
diff --git a/tests/untried/neg/t987.scala b/tests/untried/neg/t987.scala
new file mode 100644
index 000000000..1fedf12eb
--- /dev/null
+++ b/tests/untried/neg/t987.scala
@@ -0,0 +1,25 @@
+// tested using Scala compiler version 2.4.0-RC1 -- (c) 2002-2011 LAMP/EPFL
+
+// Many thanks to all at LAMP for the work that goes into Scala.
+
+
+class A {}
+
+trait B[T <: B[T]] { self: T => }
+
+abstract class C extends A with B[C]
+{
+ protected val data: List[Int]
+}
+
+class E extends D
+{
+ val data = Nil
+}
+
+class F extends D
+{
+ val data = Nil
+}
+
+abstract class D extends C with B[D] {}
diff --git a/tests/untried/neg/t997.check b/tests/untried/neg/t997.check
new file mode 100644
index 000000000..b11879222
--- /dev/null
+++ b/tests/untried/neg/t997.check
@@ -0,0 +1,4 @@
+t997.scala:13: error: too many patterns for object Foo offering (String, String): expected 2, found 3
+"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
+ ^
+one error found
diff --git a/tests/untried/neg/t997.scala b/tests/untried/neg/t997.scala
new file mode 100644
index 000000000..1198738f2
--- /dev/null
+++ b/tests/untried/neg/t997.scala
@@ -0,0 +1,15 @@
+// An extractor with 2 results
+object Foo { def unapply(x : String) = Some((x, x)) }
+
+object Test extends App {
+
+// Prints '(x, x)'. Should compile as per SI-6111.
+"x" match { case Foo(a) => Console.println(a) }
+
+// Prints '(x,x)' as expected.
+"x" match { case Foo(a, b) => Console.println((a,b)) }
+
+// Gives confusing error 'not found: value c'.
+"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
+
+}
diff --git a/tests/untried/neg/tailrec-2.check b/tests/untried/neg/tailrec-2.check
new file mode 100644
index 000000000..1daad6922
--- /dev/null
+++ b/tests/untried/neg/tailrec-2.check
@@ -0,0 +1,7 @@
+tailrec-2.scala:8: error: could not optimize @tailrec annotated method f: it contains a recursive call targeting a supertype
+ @annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = (null: Super[A]).f(mem)
+ ^
+tailrec-2.scala:9: error: @tailrec annotated method contains no recursive calls
+ @annotation.tailrec final def f1[B >: A](mem: List[B]): List[B] = this.g(mem)
+ ^
+two errors found
diff --git a/tests/untried/neg/tailrec-2.scala b/tests/untried/neg/tailrec-2.scala
new file mode 100644
index 000000000..d6b8b1355
--- /dev/null
+++ b/tests/untried/neg/tailrec-2.scala
@@ -0,0 +1,29 @@
+sealed abstract class Super[+A] {
+ def f[B >: A](mem: List[B]) : List[B]
+ def g(mem: List[_]) = ???
+}
+// This one should fail, target is a supertype
+class Bop1[+A](val element: A) extends Super[A] {
+
+ @annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = (null: Super[A]).f(mem)
+ @annotation.tailrec final def f1[B >: A](mem: List[B]): List[B] = this.g(mem)
+}
+// These succeed
+class Bop2[+A](val element: A) extends Super[A] {
+ @annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = (null: Bop2[A]).f(mem)
+}
+object Bop3 extends Super[Nothing] {
+ @annotation.tailrec final def f[B](mem: List[B]): List[B] = (null: Bop3.type).f(mem)
+}
+class Bop4[+A](val element: A) extends Super[A] {
+ @annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = Other.f[A].f(mem)
+}
+
+object Other {
+ def f[T] : Bop4[T] = sys.error("")
+}
+
+object Bop {
+ def m1[A] : Super[A] = sys.error("")
+ def m2[A] : Bop2[A] = sys.error("")
+}
diff --git a/tests/untried/neg/tailrec-3.check b/tests/untried/neg/tailrec-3.check
new file mode 100644
index 000000000..a3542fb56
--- /dev/null
+++ b/tests/untried/neg/tailrec-3.check
@@ -0,0 +1,10 @@
+tailrec-3.scala:4: error: could not optimize @tailrec annotated method quux: it contains a recursive call not in tail position
+ @tailrec private def quux(xs: List[String]): List[String] = quux(quux(xs))
+ ^
+tailrec-3.scala:6: error: could not optimize @tailrec annotated method quux2: it contains a recursive call not in tail position
+ case x1 :: x2 :: rest => quux2(x1 :: quux2(rest))
+ ^
+tailrec-3.scala:10: error: could not optimize @tailrec annotated method quux3: it contains a recursive call not in tail position
+ case x :: xs if quux3(List("abc")) => quux3(xs)
+ ^
+three errors found
diff --git a/tests/untried/neg/tailrec-3.scala b/tests/untried/neg/tailrec-3.scala
new file mode 100644
index 000000000..20361658e
--- /dev/null
+++ b/tests/untried/neg/tailrec-3.scala
@@ -0,0 +1,14 @@
+import annotation.tailrec
+
+object Test {
+ @tailrec private def quux(xs: List[String]): List[String] = quux(quux(xs))
+ @tailrec private def quux2(xs: List[String]): List[String] = xs match {
+ case x1 :: x2 :: rest => quux2(x1 :: quux2(rest))
+ case _ => Nil
+ }
+ @tailrec private def quux3(xs: List[String]): Boolean = xs match {
+ case x :: xs if quux3(List("abc")) => quux3(xs)
+ case _ => false
+ }
+}
+
diff --git a/tests/untried/neg/tailrec.check b/tests/untried/neg/tailrec.check
new file mode 100644
index 000000000..946d3421e
--- /dev/null
+++ b/tests/untried/neg/tailrec.check
@@ -0,0 +1,16 @@
+tailrec.scala:45: error: could not optimize @tailrec annotated method facfail: it contains a recursive call not in tail position
+ else n * facfail(n - 1)
+ ^
+tailrec.scala:50: error: could not optimize @tailrec annotated method fail1: it is neither private nor final so can be overridden
+ @tailrec def fail1(x: Int): Int = fail1(x)
+ ^
+tailrec.scala:53: error: could not optimize @tailrec annotated method fail2: it contains a recursive call not in tail position
+ @tailrec final def fail2[T](xs: List[T]): List[T] = xs match {
+ ^
+tailrec.scala:59: error: could not optimize @tailrec annotated method fail3: it is called recursively with different type arguments
+ @tailrec final def fail3[T](x: Int): Int = fail3(x - 1)
+ ^
+tailrec.scala:63: error: could not optimize @tailrec annotated method fail4: it changes type of 'this' on a polymorphic recursive call
+ @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1)
+ ^
+5 errors found
diff --git a/tests/untried/neg/tailrec.scala b/tests/untried/neg/tailrec.scala
new file mode 100644
index 000000000..83a0c1a9e
--- /dev/null
+++ b/tests/untried/neg/tailrec.scala
@@ -0,0 +1,65 @@
+import scala.annotation.tailrec
+
+// putting @tailrec through the paces
+object Winners {
+ @tailrec
+ def facsucc(n: Int, acc: Int): Int =
+ if (n == 0) acc
+ else facsucc(n - 1, n * acc)
+
+ @tailrec def loopsucc1(x: Int): Int = loopsucc1(x - 1)
+ @tailrec def loopsucc2[T](x: Int): Int = loopsucc2[T](x - 1)
+
+ def ding(): Unit = {
+ object dong {
+ @tailrec def loopsucc3(x: Int): Int = loopsucc3(x)
+ }
+ ()
+ }
+
+ def inner(q: Int) = {
+ @tailrec
+ def loopsucc4(x: Int): Int = loopsucc4(x + 1)
+
+ loopsucc4(q)
+ }
+
+ object innerBob {
+ @tailrec def loopsucc5(x: Int): Int = loopsucc5(x)
+ }
+}
+
+class Winners {
+ @tailrec private def succ1(x: Int): Int = succ1(x)
+ @tailrec final def succ2(x: Int): Int = succ2(x)
+ @tailrec final def succ3[T](in: List[T], acc: List[T]): List[T] = in match {
+ case Nil => Nil
+ case x :: xs => succ3(xs, x :: acc)
+ }
+}
+
+object Failures {
+ @tailrec
+ def facfail(n: Int): Int =
+ if (n == 0) 1
+ else n * facfail(n - 1)
+}
+
+class Failures {
+ // not private, not final
+ @tailrec def fail1(x: Int): Int = fail1(x)
+
+ // a typical between-chair-and-keyboard error
+ @tailrec final def fail2[T](xs: List[T]): List[T] = xs match {
+ case Nil => Nil
+ case x :: xs => x :: fail2[T](xs)
+ }
+
+ // unsafe
+ @tailrec final def fail3[T](x: Int): Int = fail3(x - 1)
+
+ // unsafe
+ class Tom[T](x: Int) {
+ @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1)
+ }
+}
diff --git a/tests/untried/neg/tcpoly_bounds.check b/tests/untried/neg/tcpoly_bounds.check
new file mode 100644
index 000000000..8b65c8d7f
--- /dev/null
+++ b/tests/untried/neg/tcpoly_bounds.check
@@ -0,0 +1,4 @@
+tcpoly_bounds.scala:3: error: type arguments [List] do not conform to class A's type parameter bounds [m[x] <: Option[x]]
+object b extends A[List]
+ ^
+one error found
diff --git a/tests/untried/neg/tcpoly_bounds.scala b/tests/untried/neg/tcpoly_bounds.scala
new file mode 100644
index 000000000..b444c59b3
--- /dev/null
+++ b/tests/untried/neg/tcpoly_bounds.scala
@@ -0,0 +1,3 @@
+class A[m[x] <: Option[x]]
+object a extends A[Some]
+object b extends A[List]
diff --git a/tests/untried/neg/tcpoly_infer_ticket1162.check b/tests/untried/neg/tcpoly_infer_ticket1162.check
new file mode 100644
index 000000000..67b79e7f3
--- /dev/null
+++ b/tests/untried/neg/tcpoly_infer_ticket1162.check
@@ -0,0 +1,4 @@
+tcpoly_infer_ticket1162.scala:6: error: wrong number of type parameters for method apply: [A, B, F[_]]()Test.Lift[A,B,F] in object Lift
+ def simplify[A,B]: Expression[A,B] = Lift[A,B]()
+ ^
+one error found
diff --git a/tests/untried/neg/tcpoly_infer_ticket1162.scala b/tests/untried/neg/tcpoly_infer_ticket1162.scala
new file mode 100644
index 000000000..0552b42a2
--- /dev/null
+++ b/tests/untried/neg/tcpoly_infer_ticket1162.scala
@@ -0,0 +1,8 @@
+object Test {
+ trait Expression[A,B]
+
+ case class Lift[A,B,F[_]]() extends Expression[F[A],F[B]]
+
+ def simplify[A,B]: Expression[A,B] = Lift[A,B]()
+}
+
diff --git a/tests/untried/neg/tcpoly_override.check b/tests/untried/neg/tcpoly_override.check
new file mode 100644
index 000000000..dbc3ff946
--- /dev/null
+++ b/tests/untried/neg/tcpoly_override.check
@@ -0,0 +1,6 @@
+tcpoly_override.scala:9: error: The kind of type T does not conform to the expected kind of type T[_] in trait A.
+C.this.T's type parameters do not match type T's expected parameters:
+type T (in class C) has no type parameters, but type T (in trait A) has one
+ type T = B // This compiles well (@M: ... but it shouldn't)
+ ^
+one error found
diff --git a/tests/untried/neg/tcpoly_override.scala b/tests/untried/neg/tcpoly_override.scala
new file mode 100644
index 000000000..dd043b47e
--- /dev/null
+++ b/tests/untried/neg/tcpoly_override.scala
@@ -0,0 +1,10 @@
+// t1231: reported by Vladimir Reshetnikov on 19 July 2007
+trait A {
+ type T[_]
+}
+
+trait B // First-order type
+
+class C extends A {
+ type T = B // This compiles well (@M: ... but it shouldn't)
+}
diff --git a/tests/untried/neg/tcpoly_ticket2101.check b/tests/untried/neg/tcpoly_ticket2101.check
new file mode 100644
index 000000000..ad0fd8bda
--- /dev/null
+++ b/tests/untried/neg/tcpoly_ticket2101.check
@@ -0,0 +1,4 @@
+tcpoly_ticket2101.scala:2: error: type arguments [T2,X] do not conform to class T's type parameter bounds [A[Y] <: T[A,B],B]
+class T2[X] extends T[T2, X] // ill-typed
+ ^
+one error found
diff --git a/tests/untried/neg/tcpoly_ticket2101.scala b/tests/untried/neg/tcpoly_ticket2101.scala
new file mode 100644
index 000000000..68f061ce7
--- /dev/null
+++ b/tests/untried/neg/tcpoly_ticket2101.scala
@@ -0,0 +1,28 @@
+class T[A[Y] <: T[A, B], B]
+class T2[X] extends T[T2, X] // ill-typed
+// because this bound is not met:
+// Forall Y. T2[Y] <: T[T2, X]
+
+// debugging before fix:
+// def isSubType0 -->
+// case (PolyType(tparams1, res1), PolyType(tparams2, res2)) => println("<:<PT: "+((tparams1, res1), (tparams2, res2))) //@MDEBUG
+// (tparams1.length == tparams2.length &&
+// List.forall2(tparams1, tparams2)
+// ((p1, p2) => p2.info.substSym(tparams2, tparams1) <:< p1.info) &&
+// res1 <:< res2.substSym(tparams2, tparams1))
+
+// generates output:
+// <:<PT: ((List(type Y),A[Y]),(List(type Y),T[A,B]))
+// <:<PT: ((List(type X),T2[X]),(List(type Y),T[T2,X]))
+
+// however, last check should have been:
+// <:<PT: ((List(type X1),T2[X1]),(List(type Y1),T[T2,X]))
+
+// case (PolyType(tparams1, res1), PolyType(tparams2, res2)) => println("<:<PT: "+((tparams1, res1), (tparams2, res2))) //@MDEBUG
+// (tparams1.length == tparams2.length &&
+// {
+// val tpsFresh = cloneSymbols(tparams1) // @M cloneSymbols(tparams2) should be equivalent -- TODO: check
+// List.forall2(tparams1, tparams2)
+// ((p1, p2) => p2.info.substSym(tparams2, tpsFresh) <:< p1.info.substSym(tparams1, tpsFresh)) &&
+// res1.substSym(tparams1, tpsFresh) <:< res2.substSym(tparams2, tpsFresh)
+// })
diff --git a/tests/untried/neg/tcpoly_typealias.check b/tests/untried/neg/tcpoly_typealias.check
new file mode 100644
index 000000000..4beac0e44
--- /dev/null
+++ b/tests/untried/neg/tcpoly_typealias.check
@@ -0,0 +1,16 @@
+tcpoly_typealias.scala:37: error: The kind of type m does not conform to the expected kind of type m[+x] in trait A.
+BInv.this.m's type parameters do not match type m's expected parameters:
+type x (in trait BInv) is invariant, but type x (in trait A) is declared covariant
+ type m[x] = FooCov[x] // error: invariant x in alias def
+ ^
+tcpoly_typealias.scala:41: error: The kind of type m does not conform to the expected kind of type m[+x] in trait A.
+BCon.this.m's type parameters do not match type m's expected parameters:
+type x (in trait BCon) is contravariant, but type x (in trait A) is declared covariant
+ type m[-x] = FooCon[x] // error: contravariant x
+ ^
+tcpoly_typealias.scala:45: error: The kind of type m does not conform to the expected kind of type m[+x] in trait A.
+BBound.this.m's type parameters do not match type m's expected parameters:
+type x (in trait BBound)'s bounds <: String are stricter than type x (in trait A)'s declared bounds >: Nothing <: Any
+ type m[+x <: String] = FooBound[x] // error: x with stricter bound
+ ^
+three errors found
diff --git a/tests/untried/neg/tcpoly_typealias.scala b/tests/untried/neg/tcpoly_typealias.scala
new file mode 100644
index 000000000..6c7f80cc0
--- /dev/null
+++ b/tests/untried/neg/tcpoly_typealias.scala
@@ -0,0 +1,47 @@
+trait A {
+ type m[+x]
+}
+
+trait A2 {
+ type m[+x <: String]
+}
+
+trait A3 {
+ type m[x]
+}
+
+trait FooCov[+x]
+trait FooCon[-x]
+trait FooBound[+x <: String]
+
+trait BOk1 extends A {
+ type m[+x] = FooCov[x]
+}
+
+trait BOk2 extends A2 {
+ type m[+x <: String] = FooBound[x]
+}
+
+trait BOk3 extends A2 {
+ type m[+x] = FooCov[x] // weaker bound
+}
+
+trait BOk4 extends A3 {
+ type m[+x] = FooCov[x] // weaker variance
+}
+
+// there are two aspects to check:
+ // does type alias signature (not considering RHS) correspond to abstract type member in super class
+ // does RHS correspond to the type alias sig
+trait BInv extends A{
+ type m[x] = FooCov[x] // error: invariant x in alias def
+}
+
+trait BCon extends A{
+ type m[-x] = FooCon[x] // error: contravariant x
+}
+
+trait BBound extends A{
+ type m[+x <: String] = FooBound[x] // error: x with stricter bound
+}
+
diff --git a/tests/untried/neg/tcpoly_variance.check b/tests/untried/neg/tcpoly_variance.check
new file mode 100644
index 000000000..c0dfcac2d
--- /dev/null
+++ b/tests/untried/neg/tcpoly_variance.check
@@ -0,0 +1,5 @@
+tcpoly_variance.scala:6: error: overriding method str in class A of type => m[Object];
+ method str has incompatible type
+ override def str: m[String] = sys.error("foo") // since x in m[x] is invariant, ! m[String] <: m[Object]
+ ^
+one error found
diff --git a/tests/untried/neg/tcpoly_variance.scala b/tests/untried/neg/tcpoly_variance.scala
new file mode 100644
index 000000000..4b9bd50e0
--- /dev/null
+++ b/tests/untried/neg/tcpoly_variance.scala
@@ -0,0 +1,7 @@
+class A[m[x]] {
+ def str: m[Object] = sys.error("foo")
+}
+
+class B[m[x]] extends A[m] {
+ override def str: m[String] = sys.error("foo") // since x in m[x] is invariant, ! m[String] <: m[Object]
+}
diff --git a/tests/untried/neg/tcpoly_variance_enforce.check b/tests/untried/neg/tcpoly_variance_enforce.check
new file mode 100644
index 000000000..3299cc343
--- /dev/null
+++ b/tests/untried/neg/tcpoly_variance_enforce.check
@@ -0,0 +1,57 @@
+tcpoly_variance_enforce.scala:15: error: kinds of the type arguments (FooInvar) do not conform to the expected kinds of the type parameters (type m) in trait coll.
+FooInvar's type parameters do not match type m's expected parameters:
+type x (in class FooInvar) is invariant, but type x is declared covariant
+object fcollinv extends coll[FooInvar] // error
+ ^
+tcpoly_variance_enforce.scala:16: error: kinds of the type arguments (FooContra) do not conform to the expected kinds of the type parameters (type m) in trait coll.
+FooContra's type parameters do not match type m's expected parameters:
+type x (in class FooContra) is contravariant, but type x is declared covariant
+object fcollcon extends coll[FooContra] // error
+ ^
+tcpoly_variance_enforce.scala:17: error: kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll.
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds >: Nothing <: Any
+object fcollwb extends coll[FooString] // error
+ ^
+tcpoly_variance_enforce.scala:19: error: kinds of the type arguments (FooCov) do not conform to the expected kinds of the type parameters (type m) in trait coll2.
+FooCov's type parameters do not match type m's expected parameters:
+type x (in class FooCov) is covariant, but type x is declared contravariant
+object fcoll2ok extends coll2[FooCov] // error
+ ^
+tcpoly_variance_enforce.scala:20: error: kinds of the type arguments (FooInvar) do not conform to the expected kinds of the type parameters (type m) in trait coll2.
+FooInvar's type parameters do not match type m's expected parameters:
+type x (in class FooInvar) is invariant, but type x is declared contravariant
+object fcoll2inv extends coll2[FooInvar] // error
+ ^
+tcpoly_variance_enforce.scala:22: error: kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll2.
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString) is covariant, but type x is declared contravariant
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds >: Nothing <: Any
+object fcoll2wb extends coll2[FooString] // error
+ ^
+tcpoly_variance_enforce.scala:27: error: kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll3.
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds >: Nothing <: Any
+object fcoll3wb extends coll3[FooString] // error
+ ^
+tcpoly_variance_enforce.scala:30: error: kinds of the type arguments (FooString,Int) do not conform to the expected kinds of the type parameters (type m,type y) in trait coll4.
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds <: y
+object fcoll4_1 extends coll4[FooString, Int] // error
+ ^
+tcpoly_variance_enforce.scala:31: error: kinds of the type arguments (FooString,Any) do not conform to the expected kinds of the type parameters (type m,type y) in trait coll4.
+FooString's type parameters do not match type m's expected parameters:
+type x (in class FooString)'s bounds <: String are stricter than type x's declared bounds <: y
+object fcoll4_2 extends coll4[FooString, Any] // error
+ ^
+tcpoly_variance_enforce.scala:37: error: kinds of the type arguments (FooInvar) do not conform to the expected kinds of the type parameters (type m) in trait coll.
+FooInvar's type parameters do not match type m's expected parameters:
+type x (in class FooInvar) is invariant, but type x is declared covariant
+ def x: coll[FooInvar] = sys.error("foo") // error
+ ^
+tcpoly_variance_enforce.scala:38: error: kinds of the type arguments (FooContra) do not conform to the expected kinds of the type parameters (type m) in trait coll.
+FooContra's type parameters do not match type m's expected parameters:
+type x (in class FooContra) is contravariant, but type x is declared covariant
+ def y: coll[FooContra] = sys.error("foo") // error
+ ^
+11 errors found
diff --git a/tests/untried/neg/tcpoly_variance_enforce.scala b/tests/untried/neg/tcpoly_variance_enforce.scala
new file mode 100644
index 000000000..ddff0e9f9
--- /dev/null
+++ b/tests/untried/neg/tcpoly_variance_enforce.scala
@@ -0,0 +1,42 @@
+trait coll[m[+x]]
+
+trait coll2[m[-x]]
+
+trait coll3[m[x]]
+
+trait coll4[m[x <: y], y]
+
+class FooInvar[x]
+class FooContra[-x]
+class FooCov[+x]
+class FooString[+x <: String]
+
+object fcollok extends coll[FooCov]
+object fcollinv extends coll[FooInvar] // error
+object fcollcon extends coll[FooContra] // error
+object fcollwb extends coll[FooString] // error
+
+object fcoll2ok extends coll2[FooCov] // error
+object fcoll2inv extends coll2[FooInvar] // error
+object fcoll2con extends coll2[FooContra]
+object fcoll2wb extends coll2[FooString] // error
+
+object fcoll3ok extends coll3[FooCov]
+object fcoll3inv extends coll3[FooInvar]
+object fcoll3con extends coll3[FooContra]
+object fcoll3wb extends coll3[FooString] // error
+
+object fcoll4ok extends coll4[FooString, String]
+object fcoll4_1 extends coll4[FooString, Int] // error
+object fcoll4_2 extends coll4[FooString, Any] // error
+
+
+object test {
+ var ok: coll[FooCov] = _
+
+ def x: coll[FooInvar] = sys.error("foo") // error
+ def y: coll[FooContra] = sys.error("foo") // error
+}
+
+
+// TODO: need test for rank N with N >: 2
diff --git a/tests/untried/neg/ticket513.check b/tests/untried/neg/ticket513.check
new file mode 100644
index 000000000..899426926
--- /dev/null
+++ b/tests/untried/neg/ticket513.check
@@ -0,0 +1,4 @@
+ticket513.scala:6: error: type arguments [NotThatBound] do not conform to trait T's type parameter bounds [A <: Bound]
+object Wrong extends Wrap[T[NotThatBound]]
+ ^
+one error found
diff --git a/tests/untried/neg/ticket513.scala b/tests/untried/neg/ticket513.scala
new file mode 100644
index 000000000..5aecc7a05
--- /dev/null
+++ b/tests/untried/neg/ticket513.scala
@@ -0,0 +1,6 @@
+class Bound
+class NotThatBound
+trait T[A <: Bound]
+trait Wrap[X]
+
+object Wrong extends Wrap[T[NotThatBound]]
diff --git a/tests/untried/neg/type-diagnostics.check b/tests/untried/neg/type-diagnostics.check
new file mode 100644
index 000000000..c5e6dec3f
--- /dev/null
+++ b/tests/untried/neg/type-diagnostics.check
@@ -0,0 +1,21 @@
+type-diagnostics.scala:4: error: type mismatch;
+ found : scala.collection.Set[String]
+ required: scala.collection.immutable.Set[String]
+ def f = Calculator("Hello", binding.keySet: collection.Set[String])
+ ^
+type-diagnostics.scala:13: error: type mismatch;
+ found : List[a(in method f2)]
+ required: List[a(in method f1)]
+ y match { case y1: List[a] => f3(x, y1) }
+ ^
+type-diagnostics.scala:17: error: type mismatch;
+ found : String(in method f2)
+ required: java.lang.String
+ def f2[String](s: String) = strings(List(s))
+ ^
+type-diagnostics.scala:21: error: missing parameter type for expanded function
+The argument types of an anonymous function must be fully known. (SLS 8.5)
+Expected type was: ?
+ val f = { case 5 => 10 }
+ ^
+four errors found
diff --git a/tests/untried/neg/type-diagnostics.scala b/tests/untried/neg/type-diagnostics.scala
new file mode 100644
index 000000000..366e6e7ac
--- /dev/null
+++ b/tests/untried/neg/type-diagnostics.scala
@@ -0,0 +1,22 @@
+object SetVsSet {
+ case class Calculator[+T](name: String, parameters: Set[String])
+ val binding = Map.empty[String, String]
+ def f = Calculator("Hello", binding.keySet: collection.Set[String])
+}
+
+object TParamConfusion {
+ def strings(xs: List[String]) = xs
+
+ def f1[a <% Ordered[a]](x: List[a]) = {
+ def f2[b >: List[a] <% Ordered[b]](x: List[a], y: b): Int = {
+ def f3(xs: List[a], ys: List[a]) = -1
+ y match { case y1: List[a] => f3(x, y1) }
+ }
+ }
+
+ def f2[String](s: String) = strings(List(s))
+}
+
+object PartialInfer {
+ val f = { case 5 => 10 }
+}
diff --git a/tests/untried/neg/typeerror.check b/tests/untried/neg/typeerror.check
new file mode 100644
index 000000000..f117e702f
--- /dev/null
+++ b/tests/untried/neg/typeerror.check
@@ -0,0 +1,11 @@
+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)
+ ^
+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/tests/untried/neg/typeerror.scala b/tests/untried/neg/typeerror.scala
new file mode 100644
index 000000000..158ad1793
--- /dev/null
+++ b/tests/untried/neg/typeerror.scala
@@ -0,0 +1,7 @@
+object Test {
+ def add2(x:Long,y:Long): Long = x + y
+
+ def add[Long](x: List[Long], y: List[Long]): List[Long] =
+ if (x.isEmpty || y.isEmpty) Nil
+ else add2(x.head, y.head) :: add(x.tail, y.tail)
+}
diff --git a/tests/untried/neg/unchecked-abstract.check b/tests/untried/neg/unchecked-abstract.check
new file mode 100644
index 000000000..72019082a
--- /dev/null
+++ b/tests/untried/neg/unchecked-abstract.check
@@ -0,0 +1,27 @@
+unchecked-abstract.scala:16: warning: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Contravariant[H]])
+ ^
+unchecked-abstract.scala:21: warning: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Contravariant[H]])
+ ^
+unchecked-abstract.scala:27: warning: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[T]])
+ ^
+unchecked-abstract.scala:28: warning: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[L]])
+ ^
+unchecked-abstract.scala:31: warning: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[H]])
+ ^
+unchecked-abstract.scala:33: warning: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[L]])
+ ^
+unchecked-abstract.scala:36: warning: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[H]])
+ ^
+unchecked-abstract.scala:37: warning: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[T]])
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+8 warnings found
+one error found
diff --git a/tests/untried/neg/unchecked-abstract.flags b/tests/untried/neg/unchecked-abstract.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/unchecked-abstract.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/unchecked-abstract.scala b/tests/untried/neg/unchecked-abstract.scala
new file mode 100644
index 000000000..23c8281ca
--- /dev/null
+++ b/tests/untried/neg/unchecked-abstract.scala
@@ -0,0 +1,93 @@
+trait Contravariant[-X]
+trait Invariant[X]
+trait Covariant[+X]
+
+abstract class M {
+ type H
+ type L <: H
+ type T >: L <: H
+
+ def h1(x: Contravariant[H]) = {
+ /* nowarn */ println(x.isInstanceOf[Contravariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[L]])
+ }
+ def h2(x: Contravariant[T]) = {
+ /* warn */ println(x.isInstanceOf[Contravariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[L]])
+ }
+ def h3(x: Contravariant[L]) = {
+ /* warn */ println(x.isInstanceOf[Contravariant[H]])
+ /* warn */ println(x.isInstanceOf[Contravariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[L]])
+ }
+ def h4(x: Invariant[H]) = {
+ /* nowarn */ println(x.isInstanceOf[Invariant[H]])
+ /* warn */ println(x.isInstanceOf[Invariant[T]])
+ /* warn */ println(x.isInstanceOf[Invariant[L]])
+ }
+ def h5(x: Invariant[T]) = {
+ /* warn */ println(x.isInstanceOf[Invariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Invariant[T]])
+ /* warn */ println(x.isInstanceOf[Invariant[L]])
+ }
+ def h6(x: Invariant[L]) = {
+ /* warn */ println(x.isInstanceOf[Invariant[H]])
+ /* warn */ println(x.isInstanceOf[Invariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Invariant[L]])
+ }
+ def h7(x: Covariant[H]) = {
+ /* nowarn */ println(x.isInstanceOf[Covariant[H]])
+ /* warn */ println(x.isInstanceOf[Covariant[T]])
+ /* warn */ println(x.isInstanceOf[Covariant[L]])
+ }
+ def h8(x: Covariant[T]) = {
+ /* nowarn */ println(x.isInstanceOf[Covariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Covariant[T]])
+ /* warn */ println(x.isInstanceOf[Covariant[L]])
+ }
+ def h9(x: Covariant[L]) = {
+ /* nowarn */ println(x.isInstanceOf[Covariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Covariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Covariant[L]])
+ }
+}
+
+object Test extends M {
+ type H = Any
+ type T = Int
+ type L = Nothing
+
+ val conh = new Contravariant[H] { }
+ val cont = new Contravariant[T] { }
+ val conl = new Contravariant[L] { }
+
+ val invh = new Invariant[H] { }
+ val invt = new Invariant[T] { }
+ val invl = new Invariant[L] { }
+
+ val covh = new Covariant[H] { }
+ val covt = new Covariant[T] { }
+ val covl = new Covariant[L] { }
+
+ def main(args: Array[String]): Unit = {
+ h1(conh)
+ h2(conh)
+ h2(cont)
+ h3(conh)
+ h3(cont)
+ h3(conl)
+
+ h4(invh)
+ h5(invt)
+ h6(invl)
+
+ h7(covh)
+ h7(covt)
+ h7(covl)
+ h8(covt)
+ h8(covl)
+ h9(covl)
+ }
+}
diff --git a/tests/untried/neg/unchecked-impossible.check b/tests/untried/neg/unchecked-impossible.check
new file mode 100644
index 000000000..d150a5a85
--- /dev/null
+++ b/tests/untried/neg/unchecked-impossible.check
@@ -0,0 +1,10 @@
+unchecked-impossible.scala:5: warning: fruitless type test: a value of type T2[Int,Int] cannot also be a Seq[A]
+ case Seq(x) =>
+ ^
+unchecked-impossible.scala:5: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: T2[Int,Int]
+ case Seq(x) =>
+ ^
+one warning found
+one error found
diff --git a/tests/untried/neg/unchecked-impossible.flags b/tests/untried/neg/unchecked-impossible.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/unchecked-impossible.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/unchecked-impossible.scala b/tests/untried/neg/unchecked-impossible.scala
new file mode 100644
index 000000000..985a2d0b0
--- /dev/null
+++ b/tests/untried/neg/unchecked-impossible.scala
@@ -0,0 +1,16 @@
+final case class T2[+A, +B](a: A, b: B)
+
+class A {
+ def f1 = T2(1, 2) match {
+ case Seq(x) =>
+ case _ =>
+ }
+ def f2 = T2(1, 2) match {
+ case _: T2[Int, Int] => /* nowarn */
+ case _ =>
+ }
+ def f3 = T2(1, 2) match {
+ case _: T2[_, Int] => /* nowarn */
+ case _ =>
+ }
+}
diff --git a/tests/untried/neg/unchecked-knowable.check b/tests/untried/neg/unchecked-knowable.check
new file mode 100644
index 000000000..327a5f202
--- /dev/null
+++ b/tests/untried/neg/unchecked-knowable.check
@@ -0,0 +1,9 @@
+unchecked-knowable.scala:18: warning: fruitless type test: a value of type Bippy cannot also be a A1
+ /* warn */ (new Bippy).isInstanceOf[A1]
+ ^
+unchecked-knowable.scala:19: warning: fruitless type test: a value of type Bippy cannot also be a B1
+ /* warn */ (new Bippy).isInstanceOf[B1]
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/tests/untried/neg/unchecked-knowable.flags b/tests/untried/neg/unchecked-knowable.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/unchecked-knowable.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/unchecked-knowable.scala b/tests/untried/neg/unchecked-knowable.scala
new file mode 100644
index 000000000..21624c4fb
--- /dev/null
+++ b/tests/untried/neg/unchecked-knowable.scala
@@ -0,0 +1,22 @@
+/** Knowable - only final leaves */
+sealed abstract class A1
+sealed abstract class A2 extends A1
+final class A3 extends A1
+final class A4 extends A2
+
+/** Unknowable */
+sealed abstract class B1
+sealed abstract class B2 extends B1
+sealed trait B2B extends B1
+final class B3 extends B1
+trait B4 extends B2
+
+class Bippy
+trait Dingus
+
+class A {
+ /* warn */ (new Bippy).isInstanceOf[A1]
+ /* warn */ (new Bippy).isInstanceOf[B1]
+ /* nowarn */ (null: Dingus).isInstanceOf[B1]
+ /* nowarn */ ((new Bippy): Any).isInstanceOf[A1]
+}
diff --git a/tests/untried/neg/unchecked-refinement.check b/tests/untried/neg/unchecked-refinement.check
new file mode 100644
index 000000000..e85a51f44
--- /dev/null
+++ b/tests/untried/neg/unchecked-refinement.check
@@ -0,0 +1,15 @@
+unchecked-refinement.scala:17: warning: abstract type U in type pattern Foo[U,U,V] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Foo[U, U, V] if b => ()
+ ^
+unchecked-refinement.scala:19: warning: non-variable type argument Any in type pattern Foo[Any,U,V] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Foo[Any, U, V] if b => ()
+ ^
+unchecked-refinement.scala:23: warning: a pattern match on a refinement type is unchecked
+ /* nowarn - todo */ case x: AnyRef { def bippy: Int } if b => x.bippy // this could/should do an instance check and not warn
+ ^
+unchecked-refinement.scala:24: warning: a pattern match on a refinement type is unchecked
+ /* nowarn - todo */ case x: AnyRef { def size: Int } if b => x.size // this could/should do a static conformance test and not warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/unchecked-refinement.flags b/tests/untried/neg/unchecked-refinement.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/unchecked-refinement.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/unchecked-refinement.scala b/tests/untried/neg/unchecked-refinement.scala
new file mode 100644
index 000000000..79ed7f13c
--- /dev/null
+++ b/tests/untried/neg/unchecked-refinement.scala
@@ -0,0 +1,27 @@
+// a.scala
+// Thu Sep 27 09:42:16 PDT 2012
+
+trait Bar[-T1, T2, +T3] { }
+trait Foo[-T1, T2, +T3] extends Bar[T1, T2, T3]
+
+class A {
+ var b = true
+
+ def f1(x: Foo[Int, Int, Int]) = x match {
+ /* nowarn */ case _: Foo[Nothing, Int, Any] => true
+ }
+ def f2[T, U, V](x: Foo[T, U, V]) = x match {
+ /* nowarn */ case _: Foo[Nothing, U, Any] => true
+ }
+ def f3[T, U, V](x: Foo[T, U, V]) = x match {
+ /* warn */ case _: Foo[U, U, V] if b => ()
+ /* nowarn */ case _: Foo[Nothing, U, V] if b => ()
+ /* warn */ case _: Foo[Any, U, V] if b => ()
+ }
+
+ def f4(xs: List[Int]) = xs match {
+ /* nowarn - todo */ case x: AnyRef { def bippy: Int } if b => x.bippy // this could/should do an instance check and not warn
+ /* nowarn - todo */ case x: AnyRef { def size: Int } if b => x.size // this could/should do a static conformance test and not warn
+ /* nowarn */ case x: ((AnyRef { def size: Int }) @unchecked) if b => x.size
+ }
+}
diff --git a/tests/untried/neg/unchecked-suppress.check b/tests/untried/neg/unchecked-suppress.check
new file mode 100644
index 000000000..d3dc86014
--- /dev/null
+++ b/tests/untried/neg/unchecked-suppress.check
@@ -0,0 +1,12 @@
+unchecked-suppress.scala:4: warning: non-variable type argument Int in type pattern scala.collection.immutable.Set[Int] (the underlying of Set[Int]) is unchecked since it is eliminated by erasure
+ case xs: Set[Int] => xs.head // unchecked
+ ^
+unchecked-suppress.scala:5: warning: non-variable type argument String in type pattern scala.collection.immutable.Map[String @unchecked,String] (the underlying of Map[String @unchecked,String]) is unchecked since it is eliminated by erasure
+ case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay
+ ^
+unchecked-suppress.scala:7: warning: non-variable type argument Int in type pattern (Int, Int) => Int is unchecked since it is eliminated by erasure
+ case f: ((Int, Int) => Int) => // unchecked
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/unchecked-suppress.flags b/tests/untried/neg/unchecked-suppress.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/unchecked-suppress.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/unchecked-suppress.scala b/tests/untried/neg/unchecked-suppress.scala
new file mode 100644
index 000000000..7bd61a2a4
--- /dev/null
+++ b/tests/untried/neg/unchecked-suppress.scala
@@ -0,0 +1,10 @@
+class A {
+ def f(x: Any) = x match {
+ case xs: List[String @unchecked] => xs.head // okay
+ case xs: Set[Int] => xs.head // unchecked
+ case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay
+ case f: ((Int @unchecked) => (Int @unchecked)) => f(5) // okay
+ case f: ((Int, Int) => Int) => // unchecked
+ case _ => ""
+ }
+}
diff --git a/tests/untried/neg/unchecked.check b/tests/untried/neg/unchecked.check
new file mode 100644
index 000000000..033cffb18
--- /dev/null
+++ b/tests/untried/neg/unchecked.check
@@ -0,0 +1,21 @@
+unchecked.scala:18: warning: non-variable type argument String in type pattern Iterable[String] (the underlying of Iterable[String]) is unchecked since it is eliminated by erasure
+ case xs: Iterable[String] => xs.head // unchecked
+ ^
+unchecked.scala:22: warning: non-variable type argument Any in type pattern scala.collection.immutable.Set[Any] (the underlying of Set[Any]) is unchecked since it is eliminated by erasure
+ case xs: Set[Any] => xs.head // unchecked
+ ^
+unchecked.scala:26: warning: non-variable type argument Any in type pattern scala.collection.immutable.Map[Any,Any] (the underlying of Map[Any,Any]) is unchecked since it is eliminated by erasure
+ case xs: Map[Any, Any] => xs.head // unchecked
+ ^
+unchecked.scala:35: warning: non-variable type argument List[Nothing] in type pattern Test.Contra[List[Nothing]] is unchecked since it is eliminated by erasure
+ case xs: Contra[List[Nothing]] => xs.head // unchecked
+ ^
+unchecked.scala:50: warning: non-variable type argument String in type pattern Test.Exp[String] is unchecked since it is eliminated by erasure
+ case ArrayApply(x: Exp[Array[T]], _, j: Exp[String]) => x // unchecked
+ ^
+unchecked.scala:55: warning: non-variable type argument Array[T] in type pattern Test.Exp[Array[T]] is unchecked since it is eliminated by erasure
+ case ArrayApply(x: Exp[Array[T]], _, _) => x // unchecked
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+6 warnings found
+one error found
diff --git a/tests/untried/neg/unchecked.flags b/tests/untried/neg/unchecked.flags
new file mode 100644
index 000000000..464cc20ea
--- /dev/null
+++ b/tests/untried/neg/unchecked.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -unchecked \ No newline at end of file
diff --git a/tests/untried/neg/unchecked.scala b/tests/untried/neg/unchecked.scala
new file mode 100644
index 000000000..e491b253b
--- /dev/null
+++ b/tests/untried/neg/unchecked.scala
@@ -0,0 +1,74 @@
+import language.existentials
+
+object Test {
+ class Def[T]
+ class Exp[T]
+ class Contra[-T] { def head[T1 <: T] : T1 = ??? }
+ class Cov[+T] { }
+
+ case class ArrayApply[T](x: Exp[Array[T]], i: Exp[Int], j: Exp[_]) extends Def[T]
+
+ val IntArrayApply = ArrayApply[Int](new Exp[Array[Int]], new Exp[Int], new Exp[Int])
+
+ def f(x: Any) = x match {
+ case xs: Iterable[Any] => xs.head // okay
+ case _ => 0
+ }
+ def f2(x: Any) = x match {
+ case xs: Iterable[String] => xs.head // unchecked
+ case _ => 0
+ }
+ def f3(x: Any) = x match {
+ case xs: Set[Any] => xs.head // unchecked
+ case _ => 0
+ }
+ def f4(x: Any) = x match {
+ case xs: Map[Any, Any] => xs.head // unchecked
+ case _ => 0
+ }
+
+ def cf1(x: Any) = x match {
+ case xs: Contra[Nothing] => xs.head // okay
+ case _ => 0
+ }
+ def cf2(x: Any) = x match {
+ case xs: Contra[List[Nothing]] => xs.head // unchecked
+ case _ => 0
+ }
+
+ def co1(x: List[Cov[List[Int]]]) = x match {
+ case _: Seq[Cov[Seq[Any]]] => true // okay
+ case _ => false
+ }
+
+ def g[T](x: Def[T]) = x match {
+ case ArrayApply(x: Exp[Array[T]], i: Exp[Int], _) => x // okay
+ case _ => 0
+ }
+
+ def g2[T](x: Def[T]) = x match {
+ case ArrayApply(x: Exp[Array[T]], _, j: Exp[String]) => x // unchecked
+ case _ => 0
+ }
+
+ def g3[T](x: Any) = x match {
+ case ArrayApply(x: Exp[Array[T]], _, _) => x // unchecked
+ case _ => 0
+ }
+
+ def g4 = IntArrayApply match {
+ case ArrayApply(x: Exp[Array[Int]], _, _) => x // okay
+ case _ => ()
+ }
+ def g5[T](x: ArrayApply[Int]) = x match {
+ case ArrayApply(x: Exp[Array[Int]], _, _) => x // okay
+ case _ => 0
+ }
+
+ // Nope
+ //
+ // def g5 = IntArrayApply match {
+ // case ArrayApply(x: Exp[Array[String]], _, _) => x // nope
+ // case _ => ()
+ // }
+}
diff --git a/tests/untried/neg/unchecked2.check b/tests/untried/neg/unchecked2.check
new file mode 100644
index 000000000..a7b839185
--- /dev/null
+++ b/tests/untried/neg/unchecked2.check
@@ -0,0 +1,45 @@
+unchecked2.scala:4: warning: fruitless type test: a value of type Some[List[Int]] cannot also be a Option[List[String]] (but still might match its erasure)
+ /* warn */ Some(List(1)).isInstanceOf[Option[List[String]]]
+ ^
+unchecked2.scala:5: warning: non-variable type argument Option[_] in type Option[Option[_]] is unchecked since it is eliminated by erasure
+ /* warn */ Some(123).isInstanceOf[Option[Option[_]]]
+ ^
+unchecked2.scala:6: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[String] (but still might match its erasure)
+ /* warn */ Some(123).isInstanceOf[Option[String]]
+ ^
+unchecked2.scala:7: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[List[String]] (but still might match its erasure)
+ /* warn */ Some(123).isInstanceOf[Option[List[String]]]
+ ^
+unchecked2.scala:8: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[List[Int => String]] (but still might match its erasure)
+ /* warn */ Some(123).isInstanceOf[Option[List[Int => String]]]
+ ^
+unchecked2.scala:9: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[(String, Double)] (but still might match its erasure)
+ /* warn */ Some(123).isInstanceOf[Option[(String, Double)]]
+ ^
+unchecked2.scala:10: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[String => Double] (but still might match its erasure)
+ /* warn */ Some(123).isInstanceOf[Option[String => Double]]
+ ^
+unchecked2.scala:14: warning: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure
+ /* warn */ (Some(List(1)): Any).isInstanceOf[Option[List[String]]]
+ ^
+unchecked2.scala:15: warning: non-variable type argument Int in type Option[Int] is unchecked since it is eliminated by erasure
+ /* warn */ (Some(123): Any).isInstanceOf[Option[Int]]
+ ^
+unchecked2.scala:16: warning: non-variable type argument String in type Option[String] is unchecked since it is eliminated by erasure
+ /* warn */ (Some(123): Any).isInstanceOf[Option[String]]
+ ^
+unchecked2.scala:17: warning: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure
+ /* warn */ (Some(123): Any).isInstanceOf[Option[List[String]]]
+ ^
+unchecked2.scala:18: warning: non-variable type argument List[Int => String] in type Option[List[Int => String]] is unchecked since it is eliminated by erasure
+ /* warn */ (Some(123): Any).isInstanceOf[Option[List[Int => String]]]
+ ^
+unchecked2.scala:19: warning: non-variable type argument (String, Double) in type Option[(String, Double)] is unchecked since it is eliminated by erasure
+ /* warn */ (Some(123): Any).isInstanceOf[Option[(String, Double)]]
+ ^
+unchecked2.scala:20: warning: non-variable type argument String => Double in type Option[String => Double] is unchecked since it is eliminated by erasure
+ /* warn */ (Some(123): Any).isInstanceOf[Option[String => Double]]
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+14 warnings found
+one error found
diff --git a/tests/untried/neg/unchecked2.flags b/tests/untried/neg/unchecked2.flags
new file mode 100644
index 000000000..144ddac9d
--- /dev/null
+++ b/tests/untried/neg/unchecked2.flags
@@ -0,0 +1 @@
+-unchecked -Xfatal-warnings
diff --git a/tests/untried/neg/unchecked2.scala b/tests/untried/neg/unchecked2.scala
new file mode 100644
index 000000000..616b05aad
--- /dev/null
+++ b/tests/untried/neg/unchecked2.scala
@@ -0,0 +1,33 @@
+object Test {
+ // These warn because it can be statically shown they won't match.
+
+ /* warn */ Some(List(1)).isInstanceOf[Option[List[String]]]
+ /* warn */ Some(123).isInstanceOf[Option[Option[_]]]
+ /* warn */ Some(123).isInstanceOf[Option[String]]
+ /* warn */ Some(123).isInstanceOf[Option[List[String]]]
+ /* warn */ Some(123).isInstanceOf[Option[List[Int => String]]]
+ /* warn */ Some(123).isInstanceOf[Option[(String, Double)]]
+ /* warn */ Some(123).isInstanceOf[Option[String => Double]]
+
+ // These warn because you can't check at runtime.
+
+ /* warn */ (Some(List(1)): Any).isInstanceOf[Option[List[String]]]
+ /* warn */ (Some(123): Any).isInstanceOf[Option[Int]]
+ /* warn */ (Some(123): Any).isInstanceOf[Option[String]]
+ /* warn */ (Some(123): Any).isInstanceOf[Option[List[String]]]
+ /* warn */ (Some(123): Any).isInstanceOf[Option[List[Int => String]]]
+ /* warn */ (Some(123): Any).isInstanceOf[Option[(String, Double)]]
+ /* warn */ (Some(123): Any).isInstanceOf[Option[String => Double]]
+
+ // These don't warn.
+
+ /* nowarn */ Some(List(1)).isInstanceOf[Option[List[Int]]]
+ /* nowarn */ Some(123).isInstanceOf[Option[Int]]
+ /* nowarn */ Some(123).isInstanceOf[Some[Int]]
+ /* nowarn */ Some(123).isInstanceOf[AnyRef]
+
+ /* nowarn */ (Some(List(1)): Any).isInstanceOf[Option[_]]
+ /* nowarn */ (Some(123): Any).isInstanceOf[Option[_]]
+ /* nowarn */ (Some(123): Any).isInstanceOf[Some[_]]
+ /* nowarn */ (Some(123): Any).isInstanceOf[AnyRef]
+}
diff --git a/tests/untried/neg/unchecked3.check b/tests/untried/neg/unchecked3.check
new file mode 100644
index 000000000..0a526050f
--- /dev/null
+++ b/tests/untried/neg/unchecked3.check
@@ -0,0 +1,42 @@
+unchecked3.scala:24: warning: non-variable type argument Double in type pattern E1[Double] is unchecked since it is eliminated by erasure
+ /* warn */ def peerTypes2(x: B1[Int]) = x match { case _: E1[Double] => true }
+ ^
+unchecked3.scala:25: warning: non-variable type argument Double in type pattern F1[Double] is unchecked since it is eliminated by erasure
+ /* warn */ def peerTypes3(x: B1[_]) = x match { case _: F1[Double] => true }
+ ^
+unchecked3.scala:28: warning: non-variable type argument Int in type pattern A2[Int] is unchecked since it is eliminated by erasure
+ /* warn */ def twotypes1[T](x: B2[T, Int]) = x match { case _: A2[Int] => true }
+ ^
+unchecked3.scala:32: warning: non-variable type argument Int in type pattern B2[_,Int] is unchecked since it is eliminated by erasure
+ /* warn */ def twotypes5[T](x: A2[T]) = x match { case _: B2[_, Int] => true }
+ ^
+unchecked3.scala:40: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Array[List[String]] => ()
+ ^
+unchecked3.scala:43: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Array[Array[List[String]]] => ()
+ ^
+unchecked3.scala:50: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Array[List[String]] => ()
+ ^
+unchecked3.scala:53: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Array[Array[List[String]]] => ()
+ ^
+unchecked3.scala:60: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Array[List[String]] => ()
+ ^
+unchecked3.scala:62: warning: non-variable type argument Array[String] in type pattern Array[List[Array[String]]] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Array[List[Array[String]]] => ()
+ ^
+unchecked3.scala:63: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure
+ /* warn */ case _: Array[Array[List[String]]] => ()
+ ^
+unchecked3.scala:75: warning: abstract type A in type pattern scala.collection.immutable.Set[Q.this.A] (the underlying of Set[Q.this.A]) is unchecked since it is eliminated by erasure
+ /* warn */ case xs: Set[A] => xs.head
+ ^
+unchecked3.scala:62: warning: unreachable code
+ /* warn */ case _: Array[List[Array[String]]] => ()
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+13 warnings found
+one error found
diff --git a/tests/untried/neg/unchecked3.flags b/tests/untried/neg/unchecked3.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/unchecked3.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/unchecked3.scala b/tests/untried/neg/unchecked3.scala
new file mode 100644
index 000000000..7b8c13e8f
--- /dev/null
+++ b/tests/untried/neg/unchecked3.scala
@@ -0,0 +1,83 @@
+sealed trait A2[T1]
+final class B2[T1, T2] extends A2[T1]
+
+sealed trait A[T]
+final class B[T] extends A[T]
+
+sealed trait A1[T]
+trait B1[T] extends A1[T]
+trait C1[T] extends A1[T]
+trait D1[T] extends A1[Int]
+trait E1[T] extends B1[Int]
+trait F1[T] extends B1[T]
+
+object MiscUnchecked {
+ /* nowarn */ def knownType1(x: A[Int]) = x match { case _: B[Int] if true => 1 }
+ /* nowarn */ def knownType2(x: B[Int]) = x match { case _: A[Int] if true => 1 }
+ /* nowarn */ def tparamLeakage1(x: Any) = x match { case Array() => 1 }
+ /* nowarn */ def tparamLeakage2(x: Any) = x match { case List() => 1 }
+
+ // E1[Double] implies B1[Int], but B1[Int] does not imply E1[Double], even if .isInstanceOf[E1[_]]
+ // F1[Int] implies B1[Int], and B1[Int] implies F1[Int]
+
+ /* nowarn */ def peerTypes1(x: B1[Int]) = x match { case _: C1[Int] => true }
+ /* warn */ def peerTypes2(x: B1[Int]) = x match { case _: E1[Double] => true }
+ /* warn */ def peerTypes3(x: B1[_]) = x match { case _: F1[Double] => true }
+ /* nowarn */ def peerTypes4(x: B1[Int]) = x match { case _: F1[Int] => true }
+
+ /* warn */ def twotypes1[T](x: B2[T, Int]) = x match { case _: A2[Int] => true }
+ /* nowarn */ def twotypes2[T](x: B2[Int, T]) = x match { case _: A2[Int] => true }
+ /* nowarn */ def twotypes3(x: A2[Int]) = x match { case _: B2[Int, _] => true }
+ /* nowarn */ def twotypes4[T](x: A2[T]) = x match { case _: B2[T, _] => true }
+ /* warn */ def twotypes5[T](x: A2[T]) = x match { case _: B2[_, Int] => true }
+}
+
+object Arrays {
+ def f1(x: Any) = x match {
+ /* nowarn */ case _: Array[Int] => ()
+ /* nowarn */ case _: Array[Boolean] => ()
+ /* nowarn */ case _: Array[String] => ()
+ /* warn */ case _: Array[List[String]] => ()
+ /* nowarn */ case _: Array[Array[String]] => ()
+ /* nowarn */ case _: Array[Array[Array[String]]] => ()
+ /* warn */ case _: Array[Array[List[String]]] => ()
+ }
+
+ def f2(x: Array[_]) = x match {
+ /* nowarn */ case _: Array[Int] => ()
+ /* nowarn */ case _: Array[Boolean] => ()
+ /* nowarn */ case _: Array[String] => ()
+ /* warn */ case _: Array[List[String]] => ()
+ /* nowarn */ case _: Array[Array[String]] => ()
+ /* nowarn */ case _: Array[Array[Array[String]]] => ()
+ /* warn */ case _: Array[Array[List[String]]] => ()
+ }
+
+ def f3[T](x: Array[T]) = x match {
+ /* nowarn */ case _: Array[Int] => ()
+ /* nowarn */ case _: Array[Boolean] => ()
+ /* nowarn */ case _: Array[String] => ()
+ /* warn */ case _: Array[List[String]] => ()
+ /* nowarn */ case _: Array[Array[String]] => ()
+ /* warn */ case _: Array[List[Array[String]]] => ()
+ /* warn */ case _: Array[Array[List[String]]] => ()
+ }
+}
+
+object Matching {
+ class Q {
+ type A
+ type B <: A
+
+ def f(xs: Traversable[B]) = xs match {
+ /* nowarn */ case xs: List[A] => xs.head
+ /* nowarn */ case xs: Seq[B] => xs.head
+ /* warn */ case xs: Set[A] => xs.head
+ }
+ def f2[T <: B](xs: Traversable[T]) = xs match {
+ /* nowarn */ case xs: List[B with T] => xs.head
+ /* nowarn */ case xs: Seq[A] => xs.head
+ /* nowarn */ case xs: Set[T] => xs.head
+ }
+ }
+}
diff --git a/tests/untried/neg/unicode-unterminated-quote.check b/tests/untried/neg/unicode-unterminated-quote.check
new file mode 100644
index 000000000..166488710
--- /dev/null
+++ b/tests/untried/neg/unicode-unterminated-quote.check
@@ -0,0 +1,7 @@
+unicode-unterminated-quote.scala:2: error: unclosed string literal
+ val x = \u0022
+ ^
+unicode-unterminated-quote.scala:2: error: '}' expected but eof found.
+ val x = \u0022
+ ^
+two errors found
diff --git a/tests/untried/neg/unicode-unterminated-quote.scala b/tests/untried/neg/unicode-unterminated-quote.scala
new file mode 100644
index 000000000..bb6eab667
--- /dev/null
+++ b/tests/untried/neg/unicode-unterminated-quote.scala
@@ -0,0 +1,2 @@
+class A {
+ val x = \u0022 \ No newline at end of file
diff --git a/tests/untried/neg/unit-returns-value.check b/tests/untried/neg/unit-returns-value.check
new file mode 100644
index 000000000..f30a506eb
--- /dev/null
+++ b/tests/untried/neg/unit-returns-value.check
@@ -0,0 +1,15 @@
+unit-returns-value.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ if (b) return 5
+ ^
+unit-returns-value.scala:4: warning: enclosing method f has result type Unit: return value discarded
+ if (b) return 5
+ ^
+unit-returns-value.scala:22: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ i1 // warn
+ ^
+unit-returns-value.scala:23: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ i2 // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/unit-returns-value.flags b/tests/untried/neg/unit-returns-value.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/unit-returns-value.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/unit-returns-value.scala b/tests/untried/neg/unit-returns-value.scala
new file mode 100644
index 000000000..1c125f0da
--- /dev/null
+++ b/tests/untried/neg/unit-returns-value.scala
@@ -0,0 +1,32 @@
+object Test {
+ def f: Unit = {
+ var b = false
+ if (b) return 5
+ }
+
+ // no warning
+ def g: Unit = {
+ return println("hello")
+ }
+}
+
+class UnusedValues {
+ var i1 = 2
+ val i2 = 2
+ lazy val i3 = 2
+ object i4 { }
+ def i5 = 2
+ final def i6 = 2
+
+ def x = {
+ i1 // warn
+ i2 // warn
+ i3 // no warn
+ i4 // no warn
+ i5 // no warn
+ i6 // could warn someday, if i6 returned 2.type instead of Int
+
+ 5
+ }
+}
+
diff --git a/tests/untried/neg/unit2anyref.check b/tests/untried/neg/unit2anyref.check
new file mode 100644
index 000000000..6d1146170
--- /dev/null
+++ b/tests/untried/neg/unit2anyref.check
@@ -0,0 +1,6 @@
+unit2anyref.scala:2: error: type mismatch;
+ found : Unit
+ required: AnyRef
+ val x: AnyRef = () // this should not succeed.
+ ^
+one error found
diff --git a/tests/untried/neg/unit2anyref.scala b/tests/untried/neg/unit2anyref.scala
new file mode 100644
index 000000000..1e9cdbf78
--- /dev/null
+++ b/tests/untried/neg/unit2anyref.scala
@@ -0,0 +1,3 @@
+object Test {
+ val x: AnyRef = () // this should not succeed.
+}
diff --git a/tests/untried/neg/unreachablechar.check b/tests/untried/neg/unreachablechar.check
new file mode 100644
index 000000000..a621196c5
--- /dev/null
+++ b/tests/untried/neg/unreachablechar.check
@@ -0,0 +1,12 @@
+unreachablechar.scala:4: warning: patterns after a variable pattern cannot match (SLS 8.1.1)
+ case _ => println("stuff");
+ ^
+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.
+three warnings found
+one error found
diff --git a/tests/untried/neg/unreachablechar.flags b/tests/untried/neg/unreachablechar.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/unreachablechar.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/unreachablechar.scala b/tests/untried/neg/unreachablechar.scala
new file mode 100644
index 000000000..ed04c5cd3
--- /dev/null
+++ b/tests/untried/neg/unreachablechar.scala
@@ -0,0 +1,8 @@
+object Foo extends App{
+ 'f' match {
+ case 'o'|'c'|'b' => println("Oooo");
+ case _ => println("stuff");
+ case 'f' => println("not stuff?");
+ }
+
+}
diff --git a/tests/untried/neg/valueclasses-doubledefs.check b/tests/untried/neg/valueclasses-doubledefs.check
new file mode 100644
index 000000000..ec513aca6
--- /dev/null
+++ b/tests/untried/neg/valueclasses-doubledefs.check
@@ -0,0 +1,7 @@
+valueclasses-doubledefs.scala:5: error: double definition:
+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
+ ^
+one error found
diff --git a/tests/untried/neg/valueclasses-doubledefs.scala b/tests/untried/neg/valueclasses-doubledefs.scala
new file mode 100644
index 000000000..87bcf8fee
--- /dev/null
+++ b/tests/untried/neg/valueclasses-doubledefs.scala
@@ -0,0 +1,6 @@
+class Meter(val x: Double) extends AnyVal
+
+class Foo {
+ def apply(x: Double) = x.toString
+ def apply(x: Meter) = x.toString
+}
diff --git a/tests/untried/neg/valueclasses-impl-restrictions.check b/tests/untried/neg/valueclasses-impl-restrictions.check
new file mode 100644
index 000000000..0af9173f7
--- /dev/null
+++ b/tests/untried/neg/valueclasses-impl-restrictions.check
@@ -0,0 +1,13 @@
+valueclasses-impl-restrictions.scala:3: error: implementation restriction: nested object is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ object X
+ ^
+valueclasses-impl-restrictions.scala:9: error: implementation restriction: nested trait is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ trait I2 {
+ ^
+valueclasses-impl-restrictions.scala:23: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ private[this] class I2(val q: String)
+ ^
+three errors found
diff --git a/tests/untried/neg/valueclasses-impl-restrictions.scala b/tests/untried/neg/valueclasses-impl-restrictions.scala
new file mode 100644
index 000000000..f0577a94a
--- /dev/null
+++ b/tests/untried/neg/valueclasses-impl-restrictions.scala
@@ -0,0 +1,29 @@
+class M(val t: Int) extends AnyVal {
+ def lazyString = {
+ object X
+ () => X
+ }
+}
+
+class X1(val s: String) extends AnyVal {
+ trait I2 {
+ val q: String
+ def z = s + q
+ }
+
+ def y(x: X1) = {
+ val i2 = new I2 { val q = x.s } // allowed as of SI-7571
+ i2.z
+
+ { case x => x } : PartialFunction[Int, Int] // allowed
+ }
+}
+
+class X2(val s: String) extends AnyVal {
+ private[this] class I2(val q: String)
+
+ def y(i: Int) = {
+ val i2 = new I2(i.toString)
+ i2.q + s
+ }
+}
diff --git a/tests/untried/neg/valueclasses-pavlov.check b/tests/untried/neg/valueclasses-pavlov.check
new file mode 100644
index 000000000..17102a0c6
--- /dev/null
+++ b/tests/untried/neg/valueclasses-pavlov.check
@@ -0,0 +1,7 @@
+valueclasses-pavlov.scala:8: error: double definition:
+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"
+ ^
+one error found
diff --git a/tests/untried/neg/valueclasses-pavlov.scala b/tests/untried/neg/valueclasses-pavlov.scala
new file mode 100644
index 000000000..d0c1ed59b
--- /dev/null
+++ b/tests/untried/neg/valueclasses-pavlov.scala
@@ -0,0 +1,23 @@
+trait Foo[T <: AnyVal] extends Any {
+ def foo(x: String): String
+ def foo(x: T): String
+}
+
+class Box1(val value: String) extends AnyVal with Foo[Box2] {
+ def foo(x: String) = "foo(String): ok"
+ def foo(x: Box2) = "foo(Box2): ok"
+}
+
+class Box2(val value: String) extends AnyVal
+
+
+object test2a {
+
+ def main(args: Array[String]): Unit = {
+ val b1 = new Box1(null)
+ val b2 = new Box2(null)
+ val f: Foo[Box2] = b1
+ println(f.foo(""))
+ println(f.foo(b2))
+ }
+}
diff --git a/tests/untried/neg/valueclasses.check b/tests/untried/neg/valueclasses.check
new file mode 100644
index 000000000..35d38aae6
--- /dev/null
+++ b/tests/untried/neg/valueclasses.check
@@ -0,0 +1,46 @@
+valueclasses.scala:3: error: only classes (not traits) are allowed to extend AnyVal
+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: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: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: 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 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 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
+ ^
+15 errors found
diff --git a/tests/untried/neg/valueclasses.scala b/tests/untried/neg/valueclasses.scala
new file mode 100644
index 000000000..7ccf9680f
--- /dev/null
+++ b/tests/untried/neg/valueclasses.scala
@@ -0,0 +1,36 @@
+package test
+
+trait T extends AnyVal // fail
+
+class Foo {
+ class Bar(x: Int) extends AnyVal // fail
+ def foo(): Unit = {
+ class Baz(x: Int) extends AnyVal // fail
+ }
+}
+
+class V1 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
+class V8(var x: Int) extends AnyVal // fail
+
+class V9(val x: Int) extends AnyVal {
+ val y = x // fail
+}
+
+class V10[T](val x: T) extends AnyVal // ok
+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/tests/untried/neg/varargs.check b/tests/untried/neg/varargs.check
new file mode 100644
index 000000000..424e24403
--- /dev/null
+++ b/tests/untried/neg/varargs.check
@@ -0,0 +1,10 @@
+varargs.scala:16: error: A method with a varargs annotation produces a forwarder method with the same signature (a: Int, b: Array[String])Int as an existing method.
+ @varargs def v1(a: Int, b: String*) = a + b.length
+ ^
+varargs.scala:19: error: A method without repeated parameters cannot be annotated with the `varargs` annotation.
+ @varargs def nov(a: Int) = 0
+ ^
+varargs.scala:21: error: A method with a varargs annotation produces a forwarder method with the same signature (a: Int, b: Array[String])Int as an existing method.
+ @varargs def v2(a: Int, b: String*) = 0
+ ^
+three errors found
diff --git a/tests/untried/neg/varargs.scala b/tests/untried/neg/varargs.scala
new file mode 100644
index 000000000..ce7f0d71f
--- /dev/null
+++ b/tests/untried/neg/varargs.scala
@@ -0,0 +1,27 @@
+
+
+
+import annotation.varargs
+
+
+
+// Failing varargs annotation
+object Test {
+
+ trait A {
+ def v1(a: Int, b: Array[String]) = a
+ }
+
+ trait B extends A {
+ @varargs def v1(a: Int, b: String*) = a + b.length
+ }
+
+ @varargs def nov(a: Int) = 0
+ @varargs def v(a: Int, b: String*) = a + b.length
+ @varargs def v2(a: Int, b: String*) = 0
+ def v2(a: Int, b: Array[String]) = 0
+
+ def main(args: Array[String]): Unit = {
+ }
+
+}
diff --git a/tests/untried/neg/variances-refinement.check b/tests/untried/neg/variances-refinement.check
new file mode 100644
index 000000000..2bed3ffa6
--- /dev/null
+++ b/tests/untried/neg/variances-refinement.check
@@ -0,0 +1,22 @@
+variances-refinement.scala:17: error: contravariant type A occurs in covariant position in type ()AnyRef{def f0(x: A): A} of method fail1
+ def fail1() = { object O { def f0(x: A): A = ??? } ; O } // fail
+ ^
+variances-refinement.scala:18: error: covariant type B occurs in contravariant position in type ()AnyRef{def f0(x: B): A} of method fail2
+ def fail2() = { object O { def f0(x: B): A = ??? } ; O } // fail
+ ^
+variances-refinement.scala:19: error: covariant type B occurs in contravariant position in type ()AnyRef{def f0(x: B): B} of method fail3
+ def fail3() = { object O { def f0(x: B): B = ??? } ; O } // fail
+ ^
+variances-refinement.scala:20: error: covariant type B occurs in contravariant position in type ()AnyRef{def f0(x: B): C} of method fail4
+ def fail4() = { object O { def f0(x: B): C = ??? } ; O } // fail
+ ^
+variances-refinement.scala:21: error: contravariant type A occurs in covariant position in type ()AnyRef{def f0(x: C): A} of method fail5
+ def fail5() = { object O { def f0(x: C): A = ??? } ; O } // fail
+ ^
+variances-refinement.scala:23: error: contravariant type A occurs in covariant position in type ()O1.type forSome { val O1: AnyRef with O0; type O0 <: AnyRef{def f0(x: A): A; def f1(x: A): B; def f2(x: A): C} } of method fail6
+ def fail6() = { // fail
+ ^
+variances-refinement.scala:32: error: contravariant type A occurs in covariant position in type ()AnyRef{def f0(x: A): A; def f1(x: A): B; def f2(x: A): C} of method fail7
+ def fail7() = { // fail
+ ^
+7 errors found
diff --git a/tests/untried/neg/variances-refinement.scala b/tests/untried/neg/variances-refinement.scala
new file mode 100644
index 000000000..6bfd336ce
--- /dev/null
+++ b/tests/untried/neg/variances-refinement.scala
@@ -0,0 +1,40 @@
+trait Trait[-A, +B, C] {
+ def ok() = { // ok
+ object O {
+ private def f0(x: A): A = ???
+ def f1(x: A): B = ???
+ def f2(x: A): C = ???
+ private def f3(x: B): A = ???
+ private def f4(x: B): B = ???
+ private def f5(x: B): C = ???
+ private def f6(x: C): A = ???
+ def f7(x: C): B = ???
+ def f8(x: C): C = ???
+ }
+ O
+ }
+
+ def fail1() = { object O { def f0(x: A): A = ??? } ; O } // fail
+ def fail2() = { object O { def f0(x: B): A = ??? } ; O } // fail
+ def fail3() = { object O { def f0(x: B): B = ??? } ; O } // fail
+ def fail4() = { object O { def f0(x: B): C = ??? } ; O } // fail
+ def fail5() = { object O { def f0(x: C): A = ??? } ; O } // fail
+
+ def fail6() = { // fail
+ trait O0 {
+ def f0(x: A): A = ???
+ def f1(x: A): B = ???
+ def f2(x: A): C = ???
+ }
+ object O1 extends O0
+ O1
+ }
+ def fail7() = { // fail
+ trait O0 {
+ def f0(x: A): A = ???
+ def f1(x: A): B = ???
+ def f2(x: A): C = ???
+ }
+ new O0 { }
+ }
+}
diff --git a/tests/untried/neg/variances.check b/tests/untried/neg/variances.check
new file mode 100644
index 000000000..cb1a60a63
--- /dev/null
+++ b/tests/untried/neg/variances.check
@@ -0,0 +1,25 @@
+variances.scala:4: error: covariant type A occurs in contravariant position in type test.Vector[A] of value x
+ def append(x: Vector[A]): Vector[A]
+ ^
+variances.scala:75: error: covariant type A occurs in contravariant position in type => A => A of value m
+ val m: A => A
+ ^
+variances.scala:18: error: covariant type A occurs in contravariant position in type A of value a
+ private def setA3(a : A) = this.a = a
+ ^
+variances.scala:19: error: covariant type A occurs in contravariant position in type A of value a
+ protected def setA4(a : A) = this.a = a
+ ^
+variances.scala:21: error: covariant type A occurs in invariant position in supertype test.C[A] of object Baz
+ object Baz extends C[A]
+ ^
+variances.scala:74: error: covariant type A occurs in contravariant position in type => test.Covariant.T[A]{val m: A => A} of value x
+ val x: T[A] {
+ ^
+variances.scala:89: error: covariant type T occurs in invariant position in type T of type A
+ type A = T
+ ^
+variances.scala:90: error: covariant type T occurs in contravariant position in type => test.TestAlias.B[C.this.A] of method foo
+ def foo: B[A]
+ ^
+8 errors found
diff --git a/tests/untried/neg/variances.scala b/tests/untried/neg/variances.scala
new file mode 100644
index 000000000..01c95be04
--- /dev/null
+++ b/tests/untried/neg/variances.scala
@@ -0,0 +1,92 @@
+package test
+
+trait Vector[+A] {
+ def append(x: Vector[A]): Vector[A]
+ private[this] def append3(x: Vector[A]): Vector[A] = append(x)
+}
+
+class C[T]
+
+object Covariant {
+ class Foo[+A] {
+ private[this] var a : A = _
+ def getA : A = a
+ // allowed
+ private[this] def setA1(a : A) = this.a = a
+ protected[this] def setA2(a : A) = this.a = a
+ // forbidden
+ private def setA3(a : A) = this.a = a
+ protected def setA4(a : A) = this.a = a
+
+ object Baz extends C[A]
+ trait Convert[B] {
+ def b2a(b : B) : A
+ def doit1(b : B) = setA1(b2a(b))
+ def doit2(b : B) = setA2(b2a(b))
+ def doit3(b : B) = setA3(b2a(b))
+ def doit4(b : B) = setA4(b2a(b))
+ }
+ }
+ class Foo2[+A] {
+ private[this] var a : A = _
+ def getA : A = a
+ private[this] def setA(a : A) = this.a = a
+
+ {
+ trait Convert[B] {
+ def b2a(b : B) : A
+ def doit(b : B) = setA(b2a(b))
+ }
+ println("")
+ }
+ }
+ class Foo3[+A] {
+ private[this] var a : A = _
+ def getA : A = a
+ private[this] def setA(a : A) = this.a = a
+
+ private[this] trait Convert[B] {
+ def b2a(b : B) : A
+ def doit(b : B) = setA(b2a(b))
+ }
+ }
+ abstract class AbstractTest {
+ val a : Foo[AnyRef]
+ val c = new a.Convert[Int] {
+ def b2a(b : Int) : AnyRef = "hello"
+ }
+ val b : Int = 42
+ }
+ class Test extends AbstractTest {
+ val a : Foo[java.lang.Character] = new Foo[java.lang.Character]
+ }
+ def main(args : Array[String]): Unit = {
+ val test = new Test
+ test.c.doit1(test.b)
+ test.c.doit2(test.b)
+ test.c.doit3(test.b)
+ test.c.doit4(test.b)
+ val x : java.lang.Character = test.a.getA
+ Console.println("XXX " + x)
+ }
+
+ abstract class T[+A] {
+ val x: T[A] {
+ val m: A => A
+ }
+ }
+ object ST extends T[String] {
+ val x: T[String] { val m: String => String } = ST
+ val m: String => String = (_.substring(1))
+ }
+ val t: T[Any] = ST
+ t.x.m(new Object)
+}
+
+object TestAlias {
+ class B[-T]
+ trait C[+T] {
+ type A = T
+ def foo: B[A]
+ }
+}
diff --git a/tests/untried/neg/variances2.check b/tests/untried/neg/variances2.check
new file mode 100644
index 000000000..433cc125a
--- /dev/null
+++ b/tests/untried/neg/variances2.check
@@ -0,0 +1,229 @@
+variances2.scala:9: error: covariant type B occurs in contravariant position in type B of value x
+ def f1(x: B): Unit = ()
+ ^
+variances2.scala:12: error: covariant type E occurs in contravariant position in type E of value x
+ def f4(x: E): Unit = ()
+ ^
+variances2.scala:15: error: contravariant type A occurs in covariant position in type ()A of method f6
+ def f6(): A = ???
+ ^
+variances2.scala:18: error: contravariant type D occurs in covariant position in type ()D of method f9
+ def f9(): D = ???
+ ^
+variances2.scala:22: error: contravariant type A occurs in covariant position in type A => A of value f
+ def f12(f: A => A): Unit = ()
+ ^
+variances2.scala:23: error: contravariant type A occurs in covariant position in type A => B of value f
+ def f13(f: A => B): Unit = ()
+ ^
+variances2.scala:24: error: contravariant type A occurs in covariant position in type A => C of value f
+ def f14(f: A => C): Unit = ()
+ ^
+variances2.scala:25: error: contravariant type A occurs in covariant position in type A => D of value f
+ def f15(f: A => D): Unit = ()
+ ^
+variances2.scala:26: error: contravariant type A occurs in covariant position in type A => E of value f
+ def f16(f: A => E): Unit = ()
+ ^
+variances2.scala:27: error: contravariant type A occurs in covariant position in type A => F of value f
+ def f17(f: A => F): Unit = ()
+ ^
+variances2.scala:29: error: covariant type B occurs in contravariant position in type B => B of value f
+ def f19(f: B => B): Unit = ()
+ ^
+variances2.scala:32: error: covariant type E occurs in contravariant position in type B => E of value f
+ def f22(f: B => E): Unit = ()
+ ^
+variances2.scala:35: error: covariant type B occurs in contravariant position in type C => B of value f
+ def f25(f: C => B): Unit = ()
+ ^
+variances2.scala:38: error: covariant type E occurs in contravariant position in type C => E of value f
+ def f28(f: C => E): Unit = ()
+ ^
+variances2.scala:40: error: contravariant type D occurs in covariant position in type D => A of value f
+ def f30(f: D => A): Unit = ()
+ ^
+variances2.scala:41: error: contravariant type D occurs in covariant position in type D => B of value f
+ def f31(f: D => B): Unit = ()
+ ^
+variances2.scala:42: error: contravariant type D occurs in covariant position in type D => C of value f
+ def f32(f: D => C): Unit = ()
+ ^
+variances2.scala:43: error: contravariant type D occurs in covariant position in type D => D of value f
+ def f33(f: D => D): Unit = ()
+ ^
+variances2.scala:44: error: contravariant type D occurs in covariant position in type D => E of value f
+ def f34(f: D => E): Unit = ()
+ ^
+variances2.scala:45: error: contravariant type D occurs in covariant position in type D => F of value f
+ def f35(f: D => F): Unit = ()
+ ^
+variances2.scala:47: error: covariant type B occurs in contravariant position in type E => B of value f
+ def f37(f: E => B): Unit = ()
+ ^
+variances2.scala:50: error: covariant type E occurs in contravariant position in type E => E of value f
+ def f40(f: E => E): Unit = ()
+ ^
+variances2.scala:53: error: covariant type B occurs in contravariant position in type F => B of value f
+ def f43(f: F => B): Unit = ()
+ ^
+variances2.scala:56: error: covariant type E occurs in contravariant position in type F => E of value f
+ def f46(f: F => E): Unit = ()
+ ^
+variances2.scala:59: error: contravariant type A occurs in covariant position in type ()A => A of method f48
+ def f48(): A => A = null
+ ^
+variances2.scala:62: error: contravariant type D occurs in covariant position in type ()A => D of method f51
+ def f51(): A => D = null
+ ^
+variances2.scala:65: error: covariant type B occurs in contravariant position in type ()B => A of method f54
+ def f54(): B => A = null
+ ^
+variances2.scala:66: error: covariant type B occurs in contravariant position in type ()B => B of method f55
+ def f55(): B => B = null
+ ^
+variances2.scala:67: error: covariant type B occurs in contravariant position in type ()B => C of method f56
+ def f56(): B => C = null
+ ^
+variances2.scala:68: error: covariant type B occurs in contravariant position in type ()B => D of method f57
+ def f57(): B => D = null
+ ^
+variances2.scala:69: error: covariant type B occurs in contravariant position in type ()B => E of method f58
+ def f58(): B => E = null
+ ^
+variances2.scala:70: error: covariant type B occurs in contravariant position in type ()B => F of method f59
+ def f59(): B => F = null
+ ^
+variances2.scala:71: error: contravariant type A occurs in covariant position in type ()C => A of method f60
+ def f60(): C => A = null
+ ^
+variances2.scala:74: error: contravariant type D occurs in covariant position in type ()C => D of method f63
+ def f63(): C => D = null
+ ^
+variances2.scala:77: error: contravariant type A occurs in covariant position in type ()D => A of method f66
+ def f66(): D => A = null
+ ^
+variances2.scala:80: error: contravariant type D occurs in covariant position in type ()D => D of method f69
+ def f69(): D => D = null
+ ^
+variances2.scala:83: error: covariant type E occurs in contravariant position in type ()E => A of method f72
+ def f72(): E => A = null
+ ^
+variances2.scala:84: error: covariant type E occurs in contravariant position in type ()E => B of method f73
+ def f73(): E => B = null
+ ^
+variances2.scala:85: error: covariant type E occurs in contravariant position in type ()E => C of method f74
+ def f74(): E => C = null
+ ^
+variances2.scala:86: error: covariant type E occurs in contravariant position in type ()E => D of method f75
+ def f75(): E => D = null
+ ^
+variances2.scala:87: error: covariant type E occurs in contravariant position in type ()E => E of method f76
+ def f76(): E => E = null
+ ^
+variances2.scala:88: error: covariant type E occurs in contravariant position in type ()E => F of method f77
+ def f77(): E => F = null
+ ^
+variances2.scala:89: error: contravariant type A occurs in covariant position in type ()F => A of method f78
+ def f78(): F => A = null
+ ^
+variances2.scala:92: error: contravariant type D occurs in covariant position in type ()F => D of method f81
+ def f81(): F => D = null
+ ^
+variances2.scala:96: error: contravariant type A occurs in covariant position in type (x: A)A of method f84
+ def f84(x: A): A = ???
+ ^
+variances2.scala:99: error: contravariant type D occurs in covariant position in type (x: A)D of method f87
+ def f87(x: A): D = ???
+ ^
+variances2.scala:102: error: contravariant type A occurs in covariant position in type (x: B)A of method f90
+ def f90(x: B): A = ???
+ ^
+variances2.scala:102: error: covariant type B occurs in contravariant position in type B of value x
+ def f90(x: B): A = ???
+ ^
+variances2.scala:103: error: covariant type B occurs in contravariant position in type B of value x
+ def f91(x: B): B = ???
+ ^
+variances2.scala:104: error: covariant type B occurs in contravariant position in type B of value x
+ def f92(x: B): C = ???
+ ^
+variances2.scala:105: error: contravariant type D occurs in covariant position in type (x: B)D of method f93
+ def f93(x: B): D = ???
+ ^
+variances2.scala:105: error: covariant type B occurs in contravariant position in type B of value x
+ def f93(x: B): D = ???
+ ^
+variances2.scala:106: error: covariant type B occurs in contravariant position in type B of value x
+ def f94(x: B): E = ???
+ ^
+variances2.scala:107: error: covariant type B occurs in contravariant position in type B of value x
+ def f95(x: B): F = ???
+ ^
+variances2.scala:108: error: contravariant type A occurs in covariant position in type (x: C)A of method f96
+ def f96(x: C): A = ???
+ ^
+variances2.scala:111: error: contravariant type D occurs in covariant position in type (x: C)D of method f99
+ def f99(x: C): D = ???
+ ^
+variances2.scala:114: error: contravariant type A occurs in covariant position in type (x: D)A of method f102
+ def f102(x: D): A = ???
+ ^
+variances2.scala:117: error: contravariant type D occurs in covariant position in type (x: D)D of method f105
+ def f105(x: D): D = ???
+ ^
+variances2.scala:120: error: contravariant type A occurs in covariant position in type (x: E)A of method f108
+ def f108(x: E): A = ???
+ ^
+variances2.scala:120: error: covariant type E occurs in contravariant position in type E of value x
+ def f108(x: E): A = ???
+ ^
+variances2.scala:121: error: covariant type E occurs in contravariant position in type E of value x
+ def f109(x: E): B = ???
+ ^
+variances2.scala:122: error: covariant type E occurs in contravariant position in type E of value x
+ def f110(x: E): C = ???
+ ^
+variances2.scala:123: error: contravariant type D occurs in covariant position in type (x: E)D of method f111
+ def f111(x: E): D = ???
+ ^
+variances2.scala:123: error: covariant type E occurs in contravariant position in type E of value x
+ def f111(x: E): D = ???
+ ^
+variances2.scala:124: error: covariant type E occurs in contravariant position in type E of value x
+ def f112(x: E): E = ???
+ ^
+variances2.scala:125: error: covariant type E occurs in contravariant position in type E of value x
+ def f113(x: E): F = ???
+ ^
+variances2.scala:126: error: contravariant type A occurs in covariant position in type (x: F)A of method f114
+ def f114(x: F): A = ???
+ ^
+variances2.scala:129: error: contravariant type D occurs in covariant position in type (x: F)D of method f117
+ def f117(x: F): D = ???
+ ^
+variances2.scala:133: error: contravariant type A occurs in covariant position in supertype Cov[A] of object O1
+ object O1 extends Cov[A]
+ ^
+variances2.scala:136: error: contravariant type D occurs in covariant position in supertype Cov[D] of object O4
+ object O4 extends Cov[D]
+ ^
+variances2.scala:140: error: covariant type B occurs in contravariant position in supertype Con[B] of object O8
+ object O8 extends Con[B]
+ ^
+variances2.scala:143: error: covariant type E occurs in contravariant position in supertype Con[E] of object O11
+ object O11 extends Con[E]
+ ^
+variances2.scala:145: error: contravariant type A occurs in invariant position in supertype Inv[A] of object O13
+ object O13 extends Inv[A]
+ ^
+variances2.scala:146: error: covariant type B occurs in invariant position in supertype Inv[B] of object O14
+ object O14 extends Inv[B]
+ ^
+variances2.scala:148: error: contravariant type D occurs in invariant position in supertype Inv[D] of object O16
+ object O16 extends Inv[D]
+ ^
+variances2.scala:149: error: covariant type E occurs in invariant position in supertype Inv[E] of object O17
+ object O17 extends Inv[E]
+ ^
+76 errors found
diff --git a/tests/untried/neg/variances2.scala b/tests/untried/neg/variances2.scala
new file mode 100644
index 000000000..0a57f8120
--- /dev/null
+++ b/tests/untried/neg/variances2.scala
@@ -0,0 +1,303 @@
+trait Cov[+A]
+trait Con[-A]
+trait Inv[A]
+
+trait Trait[-A, +B, C] {
+ // trait Inner[-D <: C, +E >: C, F] {
+ trait Inner[-D <: C, +E >: C, F] {
+ def f0(x: A): Unit = ()
+ def f1(x: B): Unit = ()
+ def f2(x: C): Unit = ()
+ def f3(x: D): Unit = ()
+ def f4(x: E): Unit = ()
+ def f5(x: F): Unit = ()
+
+ def f6(): A = ???
+ def f7(): B = ???
+ def f8(): C = ???
+ def f9(): D = ???
+ def f10(): E = ???
+ def f11(): F = ???
+
+ def f12(f: A => A): Unit = ()
+ def f13(f: A => B): Unit = ()
+ def f14(f: A => C): Unit = ()
+ def f15(f: A => D): Unit = ()
+ def f16(f: A => E): Unit = ()
+ def f17(f: A => F): Unit = ()
+ def f18(f: B => A): Unit = ()
+ def f19(f: B => B): Unit = ()
+ def f20(f: B => C): Unit = ()
+ def f21(f: B => D): Unit = ()
+ def f22(f: B => E): Unit = ()
+ def f23(f: B => F): Unit = ()
+ def f24(f: C => A): Unit = ()
+ def f25(f: C => B): Unit = ()
+ def f26(f: C => C): Unit = ()
+ def f27(f: C => D): Unit = ()
+ def f28(f: C => E): Unit = ()
+ def f29(f: C => F): Unit = ()
+ def f30(f: D => A): Unit = ()
+ def f31(f: D => B): Unit = ()
+ def f32(f: D => C): Unit = ()
+ def f33(f: D => D): Unit = ()
+ def f34(f: D => E): Unit = ()
+ def f35(f: D => F): Unit = ()
+ def f36(f: E => A): Unit = ()
+ def f37(f: E => B): Unit = ()
+ def f38(f: E => C): Unit = ()
+ def f39(f: E => D): Unit = ()
+ def f40(f: E => E): Unit = ()
+ def f41(f: E => F): Unit = ()
+ def f42(f: F => A): Unit = ()
+ def f43(f: F => B): Unit = ()
+ def f44(f: F => C): Unit = ()
+ def f45(f: F => D): Unit = ()
+ def f46(f: F => E): Unit = ()
+ def f47(f: F => F): Unit = ()
+
+ def f48(): A => A = null
+ def f49(): A => B = null
+ def f50(): A => C = null
+ def f51(): A => D = null
+ def f52(): A => E = null
+ def f53(): A => F = null
+ def f54(): B => A = null
+ def f55(): B => B = null
+ def f56(): B => C = null
+ def f57(): B => D = null
+ def f58(): B => E = null
+ def f59(): B => F = null
+ def f60(): C => A = null
+ def f61(): C => B = null
+ def f62(): C => C = null
+ def f63(): C => D = null
+ def f64(): C => E = null
+ def f65(): C => F = null
+ def f66(): D => A = null
+ def f67(): D => B = null
+ def f68(): D => C = null
+ def f69(): D => D = null
+ def f70(): D => E = null
+ def f71(): D => F = null
+ def f72(): E => A = null
+ def f73(): E => B = null
+ def f74(): E => C = null
+ def f75(): E => D = null
+ def f76(): E => E = null
+ def f77(): E => F = null
+ def f78(): F => A = null
+ def f79(): F => B = null
+ def f80(): F => C = null
+ def f81(): F => D = null
+ def f82(): F => E = null
+ def f83(): F => F = null
+
+ def f84(x: A): A = ???
+ def f85(x: A): B = ???
+ def f86(x: A): C = ???
+ def f87(x: A): D = ???
+ def f88(x: A): E = ???
+ def f89(x: A): F = ???
+ def f90(x: B): A = ???
+ def f91(x: B): B = ???
+ def f92(x: B): C = ???
+ def f93(x: B): D = ???
+ def f94(x: B): E = ???
+ def f95(x: B): F = ???
+ def f96(x: C): A = ???
+ def f97(x: C): B = ???
+ def f98(x: C): C = ???
+ def f99(x: C): D = ???
+ def f100(x: C): E = ???
+ def f101(x: C): F = ???
+ def f102(x: D): A = ???
+ def f103(x: D): B = ???
+ def f104(x: D): C = ???
+ def f105(x: D): D = ???
+ def f106(x: D): E = ???
+ def f107(x: D): F = ???
+ def f108(x: E): A = ???
+ def f109(x: E): B = ???
+ def f110(x: E): C = ???
+ def f111(x: E): D = ???
+ def f112(x: E): E = ???
+ def f113(x: E): F = ???
+ def f114(x: F): A = ???
+ def f115(x: F): B = ???
+ def f116(x: F): C = ???
+ def f117(x: F): D = ???
+ def f118(x: F): E = ???
+ def f119(x: F): F = ???
+
+ object O1 extends Cov[A]
+ object O2 extends Cov[B]
+ object O3 extends Cov[C]
+ object O4 extends Cov[D]
+ object O5 extends Cov[E]
+ object O6 extends Cov[F]
+ object O7 extends Con[A]
+ object O8 extends Con[B]
+ object O9 extends Con[C]
+ object O10 extends Con[D]
+ object O11 extends Con[E]
+ object O12 extends Con[F]
+ object O13 extends Inv[A]
+ object O14 extends Inv[B]
+ object O15 extends Inv[C]
+ object O16 extends Inv[D]
+ object O17 extends Inv[E]
+ object O18 extends Inv[F]
+ }
+}
+
+trait Trait2[-A, +B, C] {
+ // trait Inner[-D <: C, +E >: C, F] {
+ def method[D <: A, E >: B, F](): Unit = {
+ def f0(x: A): Unit = ()
+ def f1(x: B): Unit = ()
+ def f2(x: C): Unit = ()
+ def f3(x: D): Unit = ()
+ def f4(x: E): Unit = ()
+ def f5(x: F): Unit = ()
+
+ def f6(): A = ???
+ def f7(): B = ???
+ def f8(): C = ???
+ def f9(): D = ???
+ def f10(): E = ???
+ def f11(): F = ???
+
+ def f12(f: A => A): Unit = ()
+ def f13(f: A => B): Unit = ()
+ def f14(f: A => C): Unit = ()
+ def f15(f: A => D): Unit = ()
+ def f16(f: A => E): Unit = ()
+ def f17(f: A => F): Unit = ()
+ def f18(f: B => A): Unit = ()
+ def f19(f: B => B): Unit = ()
+ def f20(f: B => C): Unit = ()
+ def f21(f: B => D): Unit = ()
+ def f22(f: B => E): Unit = ()
+ def f23(f: B => F): Unit = ()
+ def f24(f: C => A): Unit = ()
+ def f25(f: C => B): Unit = ()
+ def f26(f: C => C): Unit = ()
+ def f27(f: C => D): Unit = ()
+ def f28(f: C => E): Unit = ()
+ def f29(f: C => F): Unit = ()
+ def f30(f: D => A): Unit = ()
+ def f31(f: D => B): Unit = ()
+ def f32(f: D => C): Unit = ()
+ def f33(f: D => D): Unit = ()
+ def f34(f: D => E): Unit = ()
+ def f35(f: D => F): Unit = ()
+ def f36(f: E => A): Unit = ()
+ def f37(f: E => B): Unit = ()
+ def f38(f: E => C): Unit = ()
+ def f39(f: E => D): Unit = ()
+ def f40(f: E => E): Unit = ()
+ def f41(f: E => F): Unit = ()
+ def f42(f: F => A): Unit = ()
+ def f43(f: F => B): Unit = ()
+ def f44(f: F => C): Unit = ()
+ def f45(f: F => D): Unit = ()
+ def f46(f: F => E): Unit = ()
+ def f47(f: F => F): Unit = ()
+
+ def f48(): A => A = null
+ def f49(): A => B = null
+ def f50(): A => C = null
+ def f51(): A => D = null
+ def f52(): A => E = null
+ def f53(): A => F = null
+ def f54(): B => A = null
+ def f55(): B => B = null
+ def f56(): B => C = null
+ def f57(): B => D = null
+ def f58(): B => E = null
+ def f59(): B => F = null
+ def f60(): C => A = null
+ def f61(): C => B = null
+ def f62(): C => C = null
+ def f63(): C => D = null
+ def f64(): C => E = null
+ def f65(): C => F = null
+ def f66(): D => A = null
+ def f67(): D => B = null
+ def f68(): D => C = null
+ def f69(): D => D = null
+ def f70(): D => E = null
+ def f71(): D => F = null
+ def f72(): E => A = null
+ def f73(): E => B = null
+ def f74(): E => C = null
+ def f75(): E => D = null
+ def f76(): E => E = null
+ def f77(): E => F = null
+ def f78(): F => A = null
+ def f79(): F => B = null
+ def f80(): F => C = null
+ def f81(): F => D = null
+ def f82(): F => E = null
+ def f83(): F => F = null
+
+ def f84(x: A): A = ???
+ def f85(x: A): B = ???
+ def f86(x: A): C = ???
+ def f87(x: A): D = ???
+ def f88(x: A): E = ???
+ def f89(x: A): F = ???
+ def f90(x: B): A = ???
+ def f91(x: B): B = ???
+ def f92(x: B): C = ???
+ def f93(x: B): D = ???
+ def f94(x: B): E = ???
+ def f95(x: B): F = ???
+ def f96(x: C): A = ???
+ def f97(x: C): B = ???
+ def f98(x: C): C = ???
+ def f99(x: C): D = ???
+ def f100(x: C): E = ???
+ def f101(x: C): F = ???
+ def f102(x: D): A = ???
+ def f103(x: D): B = ???
+ def f104(x: D): C = ???
+ def f105(x: D): D = ???
+ def f106(x: D): E = ???
+ def f107(x: D): F = ???
+ def f108(x: E): A = ???
+ def f109(x: E): B = ???
+ def f110(x: E): C = ???
+ def f111(x: E): D = ???
+ def f112(x: E): E = ???
+ def f113(x: E): F = ???
+ def f114(x: F): A = ???
+ def f115(x: F): B = ???
+ def f116(x: F): C = ???
+ def f117(x: F): D = ???
+ def f118(x: F): E = ???
+ def f119(x: F): F = ???
+
+ object O1 extends Cov[A]
+ object O2 extends Cov[B]
+ object O3 extends Cov[C]
+ object O4 extends Cov[D]
+ object O5 extends Cov[E]
+ object O6 extends Cov[F]
+ object O7 extends Con[A]
+ object O8 extends Con[B]
+ object O9 extends Con[C]
+ object O10 extends Con[D]
+ object O11 extends Con[E]
+ object O12 extends Con[F]
+ object O13 extends Inv[A]
+ object O14 extends Inv[B]
+ object O15 extends Inv[C]
+ object O16 extends Inv[D]
+ object O17 extends Inv[E]
+ object O18 extends Inv[F]
+
+ ()
+ }
+}
diff --git a/tests/untried/neg/viewtest.check b/tests/untried/neg/viewtest.check
new file mode 100644
index 000000000..21ed93a01
--- /dev/null
+++ b/tests/untried/neg/viewtest.check
@@ -0,0 +1,6 @@
+viewtest.scala:43: error: type mismatch;
+ found : List[a(in method compareTo)]
+ required: List[a(in method view3)]
+ case y1: List[a] => compareLists(x, y1)
+ ^
+one error found
diff --git a/tests/untried/neg/viewtest.scala b/tests/untried/neg/viewtest.scala
new file mode 100644
index 000000000..5e7d624d2
--- /dev/null
+++ b/tests/untried/neg/viewtest.scala
@@ -0,0 +1,116 @@
+package test
+
+/** A trait for totally ordered data.
+ */
+trait Ordered[+a] {
+
+ /** Result of comparing `this' with operand `that'.
+ * returns `x' where
+ * x < 0 iff this < that
+ * x == 0 iff this == that
+ * x > 0 iff this > that
+ */
+ def compareTo [b >: a <% Ordered[b]](that: b): Int
+
+ def < [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) < 0
+
+ def > [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) > 0
+
+ def <= [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) <= 0
+
+ def >= [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) >= 0
+}
+
+
+object O {
+
+ implicit def view1(x: String): Ordered[String] = new Ordered[String] {
+ def compareTo [b >: String <% Ordered[b]](y: b): Int = y match {
+ case y1: String => x compareTo y1
+ case _ => -(y compareTo x)
+ }
+ }
+ implicit def view2(x: Char): Ordered[Char] = new Ordered[Char] {
+ def compareTo [b >: Char <% Ordered[b]](y: b): Int = y match {
+ case y1: Char => x - y1
+ case _ => -(y compareTo x)
+ }
+ }
+
+ implicit def view3[a <% Ordered[a]](x: List[a]): Ordered[List[a]] =
+ new Ordered[List[a]] {
+ def compareTo [b >: List[a] <% Ordered[b]](y: b): Int = y match {
+ case y1: List[a] => compareLists(x, y1)
+ case _ => -(y compareTo x)
+ }
+ private def compareLists(xs: List[a], ys: List[a]): Int = {
+ if (xs.isEmpty && ys.isEmpty) 0
+ else if (xs.isEmpty) -1
+ else if (ys.isEmpty) 1
+ else {
+ val s = xs.head compareTo ys.head
+ if (s != 0) s
+ else compareLists(xs.tail, ys.tail)
+ }
+ }
+ }
+ implicit def view4[a](x: a): a = x
+}
+
+abstract class Tree[+a <% Ordered[a]] {
+ def insert[b >: a <% Ordered[b]](x: b): Tree[b]
+ def elements: List[a]
+}
+
+object Empty extends Tree[Nothing] {
+ def insert[b >: Nothing <% Ordered[b]](x: b): Tree[b] = new Node(x, Empty, Empty)
+ def elements: List[Nothing] = List()
+}
+
+class Node[a <% Ordered[a]](elem: a, l: Tree[a], r: Tree[a]) extends Tree[a] {
+ def insert[b >: a <% Ordered[b]](x: b): Tree[b] =
+ if (x == elem) this
+ else if (x < elem) new Node(elem, l insert x, r)
+ else new Node(elem, l, r insert x)
+ def elements: List[a] =
+ l.elements ::: List(elem) ::: r.elements
+}
+
+case class Str(elem: String) extends Ordered[Str] {
+ def compareTo[b >: Str <% Ordered[b]](that: b): Int = that match {
+ case that1: Str => this.elem compareTo that1.elem
+ case _ => -(that compareTo this)
+ }
+}
+
+object Test {
+ import O._
+
+ private def toCharList(s: String): List[Char] =
+ if (s.length() == 0) List()
+ else s.charAt(0) :: toCharList(s.substring(1))
+
+ def main(args: Array[String]) = {
+ {
+ var t: Tree[String] = Empty
+ for (s <- args) {
+ t = t insert s
+ }
+ Console.println(t.elements)
+ }
+ {
+ var t: Tree[Str] = Empty
+ for (s <- args) {
+ t = t insert Str(s)
+ }
+ Console.println(t.elements)
+ }
+ {
+ var t: Tree[List[Char]] = Empty
+ for (s <- args) {
+ t = t insert toCharList(s)
+ }
+ Console.println(t.elements)
+ }
+ }
+}
diff --git a/tests/untried/neg/virtpatmat_reach_null.check b/tests/untried/neg/virtpatmat_reach_null.check
new file mode 100644
index 000000000..e0c36c8c5
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_reach_null.check
@@ -0,0 +1,6 @@
+virtpatmat_reach_null.scala:13: warning: unreachable code
+ case _ => // unreachable
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/virtpatmat_reach_null.flags b/tests/untried/neg/virtpatmat_reach_null.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_reach_null.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/virtpatmat_reach_null.scala b/tests/untried/neg/virtpatmat_reach_null.scala
new file mode 100644
index 000000000..6314a5b1d
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_reach_null.scala
@@ -0,0 +1,19 @@
+sealed abstract class Const {
+ final def excludes(other: Const) =
+ (this, other) match {
+ case (_, NullConst) =>
+ case (NullConst, _) =>
+ case (_: ValueConst, _: ValueConst) =>
+ case (_: ValueConst, _: TypeConst) =>
+ case (_: TypeConst, _: ValueConst) =>
+ case (_: TypeConst, _: TypeConst) =>
+ case (null, _) =>
+ case (_, null) =>
+ case null =>
+ case _ => // unreachable
+ }
+}
+
+sealed class TypeConst extends Const
+sealed class ValueConst extends Const
+case object NullConst extends Const
diff --git a/tests/untried/neg/virtpatmat_reach_sealed_unsealed.check b/tests/untried/neg/virtpatmat_reach_sealed_unsealed.check
new file mode 100644
index 000000000..064a12bca
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_reach_sealed_unsealed.check
@@ -0,0 +1,16 @@
+virtpatmat_reach_sealed_unsealed.scala:16: warning: match may not be exhaustive.
+It would fail on the following input: false
+ (true: Boolean) match { case true => } // not exhaustive, but reachable
+ ^
+virtpatmat_reach_sealed_unsealed.scala:18: warning: unreachable code
+ (true: Boolean) match { case true => case false => case _ => } // exhaustive, last case is unreachable
+ ^
+virtpatmat_reach_sealed_unsealed.scala:19: warning: unreachable code
+ (true: Boolean) match { case true => case false => case _: Boolean => } // exhaustive, last case is unreachable
+ ^
+virtpatmat_reach_sealed_unsealed.scala:20: warning: unreachable code
+ (true: Boolean) match { case true => case false => case _: Any => } // exhaustive, last case is unreachable
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/tests/untried/neg/virtpatmat_reach_sealed_unsealed.flags b/tests/untried/neg/virtpatmat_reach_sealed_unsealed.flags
new file mode 100644
index 000000000..e8fb65d50
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_reach_sealed_unsealed.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/tests/untried/neg/virtpatmat_reach_sealed_unsealed.scala b/tests/untried/neg/virtpatmat_reach_sealed_unsealed.scala
new file mode 100644
index 000000000..26ab5da71
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_reach_sealed_unsealed.scala
@@ -0,0 +1,21 @@
+sealed abstract class X
+sealed case class A(x: Int) extends X
+
+// test reachability on mixed sealed / non-sealed matches
+object Test extends App {
+ val B: X = A(0)
+ val C: X = A(1)
+
+ // all cases are reachable and the match is exhaustive
+ (C: X) match {
+ case B =>
+ case C =>
+ case A(_) =>
+ }
+
+ (true: Boolean) match { case true => } // not exhaustive, but reachable
+ (true: Boolean) match { case true => case false => } // exhaustive, reachable
+ (true: Boolean) match { case true => case false => case _ => } // exhaustive, last case is unreachable
+ (true: Boolean) match { case true => case false => case _: Boolean => } // exhaustive, last case is unreachable
+ (true: Boolean) match { case true => case false => case _: Any => } // exhaustive, last case is unreachable
+}
diff --git a/tests/untried/neg/virtpatmat_unreach_select.check b/tests/untried/neg/virtpatmat_unreach_select.check
new file mode 100644
index 000000000..4fc78cd41
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_unreach_select.check
@@ -0,0 +1,6 @@
+virtpatmat_unreach_select.scala:10: warning: unreachable code
+ case WARNING.id => // unreachable
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/tests/untried/neg/virtpatmat_unreach_select.flags b/tests/untried/neg/virtpatmat_unreach_select.flags
new file mode 100644
index 000000000..85d8eb2ba
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_unreach_select.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/tests/untried/neg/virtpatmat_unreach_select.scala b/tests/untried/neg/virtpatmat_unreach_select.scala
new file mode 100644
index 000000000..c46ff1545
--- /dev/null
+++ b/tests/untried/neg/virtpatmat_unreach_select.scala
@@ -0,0 +1,12 @@
+class Test {
+ object severity extends Enumeration
+ class Severity(val id: Int) extends severity.Value
+ val INFO = new Severity(0)
+ val WARNING = new Severity(1)
+
+ (0: Int) match {
+ case WARNING.id =>
+ case INFO.id => // reachable
+ case WARNING.id => // unreachable
+ }
+}
diff --git a/tests/untried/neg/volatile-intersection.check b/tests/untried/neg/volatile-intersection.check
new file mode 100644
index 000000000..ef983994a
--- /dev/null
+++ b/tests/untried/neg/volatile-intersection.check
@@ -0,0 +1,4 @@
+volatile-intersection.scala:8: error: illegal type selection from volatile type C.this.D with C.this.U
+ val y: (D with U)#T = new B { }
+ ^
+one error found
diff --git a/tests/untried/neg/volatile-intersection.scala b/tests/untried/neg/volatile-intersection.scala
new file mode 100644
index 000000000..209d13bae
--- /dev/null
+++ b/tests/untried/neg/volatile-intersection.scala
@@ -0,0 +1,21 @@
+object Test extends App {
+ trait A
+ trait B extends A
+
+ trait C {
+ type U
+ trait D { type T >: B <: A }
+ val y: (D with U)#T = new B { }
+ }
+
+ class D extends C {
+ trait E
+ trait F { type T = E }
+ type U = F
+ def frob(arg : E) : E = arg
+ frob(y)
+ }
+
+ new D
+}
+
diff --git a/tests/untried/neg/volatile.check b/tests/untried/neg/volatile.check
new file mode 100644
index 000000000..b90428412
--- /dev/null
+++ b/tests/untried/neg/volatile.check
@@ -0,0 +1,7 @@
+volatile.scala:11: error: Inferred type C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E
+ var sneak = { () => y.x }
+ ^
+volatile.scala:11: error: Inferred type () => C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E
+ var sneak = { () => y.x }
+ ^
+two errors found
diff --git a/tests/untried/neg/volatile.scala b/tests/untried/neg/volatile.scala
new file mode 100644
index 000000000..829286315
--- /dev/null
+++ b/tests/untried/neg/volatile.scala
@@ -0,0 +1,24 @@
+object Test extends App {
+ trait A
+ trait B extends A
+
+ class C {
+ type D
+ trait E { type T >: B <: A; val x : T }
+ // This is currently correctly disallowed
+ // val y : (D with E)#T = y
+ val y : D with E = y
+ var sneak = { () => y.x }
+ sneak = { () => new B { } }
+ }
+
+ class F extends C {
+ trait G
+ trait H { type T = G }
+ type D = H
+ def frob(arg : G) : G = arg
+ frob(sneak())
+ }
+
+ new F
+}
diff --git a/tests/untried/neg/volatile_no_override.check b/tests/untried/neg/volatile_no_override.check
new file mode 100644
index 000000000..a9a60ab69
--- /dev/null
+++ b/tests/untried/neg/volatile_no_override.check
@@ -0,0 +1,5 @@
+volatile_no_override.scala:13: error: overriding value x in class A of type Volatile.this.D;
+ value x has a volatile type; cannot override a member with non-volatile type
+ val x: A with D = null
+ ^
+one error found
diff --git a/tests/untried/neg/volatile_no_override.scala b/tests/untried/neg/volatile_no_override.scala
new file mode 100644
index 000000000..9fad082a9
--- /dev/null
+++ b/tests/untried/neg/volatile_no_override.scala
@@ -0,0 +1,14 @@
+class B
+class C(x: String) extends B
+
+abstract class A {
+ class D { type T >: C <: B }
+ val x: D
+ var y: x.T = new C("abc")
+}
+
+class Volatile extends A {
+ type A >: Null
+ // test (1.4), pt 2 in RefChecks
+ val x: A with D = null
+}
diff --git a/tests/untried/neg/warn-inferred-any.check b/tests/untried/neg/warn-inferred-any.check
new file mode 100644
index 000000000..4628033e5
--- /dev/null
+++ b/tests/untried/neg/warn-inferred-any.check
@@ -0,0 +1,12 @@
+warn-inferred-any.scala:8: warning: a type was inferred to be `Any`; this may indicate a programming error.
+ { List(1, 2, 3) contains "a" } // only this warns
+ ^
+warn-inferred-any.scala:16: warning: a type was inferred to be `AnyVal`; this may indicate a programming error.
+ { 1l to 5l contains 5 }
+ ^
+warn-inferred-any.scala:17: warning: a type was inferred to be `AnyVal`; this may indicate a programming error.
+ { 1l to 5l contains 5d }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/tests/untried/neg/warn-inferred-any.flags b/tests/untried/neg/warn-inferred-any.flags
new file mode 100644
index 000000000..a3127d392
--- /dev/null
+++ b/tests/untried/neg/warn-inferred-any.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Ywarn-infer-any
diff --git a/tests/untried/neg/warn-inferred-any.scala b/tests/untried/neg/warn-inferred-any.scala
new file mode 100644
index 000000000..b853e6e5a
--- /dev/null
+++ b/tests/untried/neg/warn-inferred-any.scala
@@ -0,0 +1,19 @@
+trait Foo[-A <: AnyRef, +B <: AnyRef] {
+ def run[U](x: A)(action: B => U): Boolean = ???
+
+ { run(_: A)(_: B => String) }
+}
+
+trait Xs[+A] {
+ { List(1, 2, 3) contains "a" } // only this warns
+ { List(1, 2, 3) contains 1 }
+ { identity(List(1, 2, 3) contains 1) }
+ { List("a") foreach println }
+}
+
+trait Ys[+A] {
+ { 1 to 5 contains 5l }
+ { 1l to 5l contains 5 }
+ { 1l to 5l contains 5d }
+ { 1l to 5l contains 5l }
+}
diff --git a/tests/untried/neg/warn-unused-imports.check b/tests/untried/neg/warn-unused-imports.check
new file mode 100644
index 000000000..36c6dd03c
--- /dev/null
+++ b/tests/untried/neg/warn-unused-imports.check
@@ -0,0 +1,33 @@
+warn-unused-imports.scala:57: warning: Unused import
+ import p1.A // warn
+ ^
+warn-unused-imports.scala:62: warning: Unused import
+ import p1.{ A, B } // warn on A
+ ^
+warn-unused-imports.scala:67: warning: Unused import
+ import p1.{ A, B } // warn on both
+ ^
+warn-unused-imports.scala:67: warning: Unused import
+ import p1.{ A, B } // warn on both
+ ^
+warn-unused-imports.scala:73: warning: Unused import
+ import c._ // warn
+ ^
+warn-unused-imports.scala:78: warning: Unused import
+ import p1._ // warn
+ ^
+warn-unused-imports.scala:85: warning: Unused import
+ import c._ // warn
+ ^
+warn-unused-imports.scala:91: warning: Unused import
+ import p1.c._ // warn
+ ^
+warn-unused-imports.scala:98: warning: Unused import
+ import p1._ // warn
+ ^
+warn-unused-imports.scala:118: warning: Unused import
+ import p1.A // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+10 warnings found
+one error found
diff --git a/tests/untried/neg/warn-unused-imports.flags b/tests/untried/neg/warn-unused-imports.flags
new file mode 100644
index 000000000..24db705df
--- /dev/null
+++ b/tests/untried/neg/warn-unused-imports.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Ywarn-unused-import
diff --git a/tests/untried/neg/warn-unused-imports.scala b/tests/untried/neg/warn-unused-imports.scala
new file mode 100644
index 000000000..b7a2f1c41
--- /dev/null
+++ b/tests/untried/neg/warn-unused-imports.scala
@@ -0,0 +1,125 @@
+class Bippo {
+ def length: Int = 123
+ class Tree
+}
+
+package object p1 {
+ class A
+ implicit class B(val s: String) { def bippy = s }
+ val c: Bippo = new Bippo
+ type D = String
+}
+package object p2 {
+ class A
+ implicit class B(val s: String) { def bippy = s }
+ val c: Bippo = new Bippo
+ type D = Int
+}
+
+trait NoWarn {
+ {
+ import p1._ // no warn
+ println("abc".bippy)
+ }
+
+ {
+ import p1._ // no warn
+ println(new A)
+ }
+
+ {
+ import p1.B // no warn
+ println("abc".bippy)
+ }
+
+ {
+ import p1._ // no warn
+ import c._ // no warn
+ println(length)
+ }
+
+ {
+ import p1._ // no warn
+ import c._ // no warn
+ val x: Tree = null
+ println(x)
+ }
+
+ {
+ import p1.D // no warn
+ val x: D = null
+ println(x)
+ }
+}
+
+trait Warn {
+ {
+ import p1.A // warn
+ println(123)
+ }
+
+ {
+ import p1.{ A, B } // warn on A
+ println("abc".bippy)
+ }
+
+ {
+ import p1.{ A, B } // warn on both
+ println(123)
+ }
+
+ {
+ import p1._ // no warn (technically this could warn, but not worth the effort to unroll unusedness transitively)
+ import c._ // warn
+ println(123)
+ }
+
+ {
+ import p1._ // warn
+ println(123)
+ }
+
+ {
+ class Tree
+ import p1._ // no warn
+ import c._ // warn
+ val x: Tree = null
+ println(x)
+ }
+
+ {
+ import p1.c._ // warn
+ println(123)
+ }
+}
+
+trait Nested {
+ {
+ import p1._ // warn
+ trait Warn { // warn about unused local trait for good measure
+ import p2._
+ println(new A)
+ println("abc".bippy)
+ }
+ println("")
+ }
+
+ {
+ import p1._ // no warn
+ trait NoWarn {
+ import p2.B // no warn
+ println("abc".bippy)
+ println(new A)
+ }
+ println(new NoWarn { })
+ }
+
+ {
+ import p1.A // warn
+ trait Warn {
+ import p2.A
+ println(new A)
+ }
+ println(new Warn { })
+ }
+}
diff --git a/tests/untried/neg/warn-unused-privates.check b/tests/untried/neg/warn-unused-privates.check
new file mode 100644
index 000000000..d012869c9
--- /dev/null
+++ b/tests/untried/neg/warn-unused-privates.check
@@ -0,0 +1,66 @@
+warn-unused-privates.scala:2: warning: private constructor in class Bippy is never used
+ private def this(c: Int) = this(c, c) // warn
+ ^
+warn-unused-privates.scala:4: warning: private method in class Bippy is never used
+ private def boop(x: Int) = x+a+b // warn
+ ^
+warn-unused-privates.scala:6: warning: private val in class Bippy is never used
+ final private val MILLIS2: Int = 1000 // warn
+ ^
+warn-unused-privates.scala:13: warning: private val in object Bippy is never used
+ private val HEY_INSTANCE: Int = 1000 // warn
+ ^
+warn-unused-privates.scala:35: warning: private val in class Boppy is never used
+ private val hummer = "def" // warn
+ ^
+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
+ ^
+warn-unused-privates.scala:44: warning: private var in trait Accessors is never used
+ private var v3: Int = 0 // warn, never got
+ ^
+warn-unused-privates.scala:56: warning: private default argument in trait DefaultArgs is never used
+ private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3
+ ^
+warn-unused-privates.scala:56: warning: private default argument in trait DefaultArgs is never used
+ private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3
+ ^
+warn-unused-privates.scala:67: warning: local var in method f0 is never used
+ var x = 1 // warn
+ ^
+warn-unused-privates.scala:74: warning: local val in method f1 is never used
+ val b = new Outer // warn
+ ^
+warn-unused-privates.scala:84: warning: private object in object Types is never used
+ private object Dongo { def f = this } // warn
+ ^
+warn-unused-privates.scala:94: warning: local object in method l1 is never used
+ object HiObject { def f = this } // warn
+ ^
+warn-unused-privates.scala:78: warning: local var x in method f2 is never set - it could be a val
+ var x = 100 // warn about it being a var
+ ^
+warn-unused-privates.scala:85: warning: private class Bar1 in object Types is never used
+ private class Bar1 // warn
+ ^
+warn-unused-privates.scala:87: warning: private type Alias1 in object Types is never used
+ private type Alias1 = String // warn
+ ^
+warn-unused-privates.scala:95: warning: local class Hi is never used
+ class Hi { // warn
+ ^
+warn-unused-privates.scala:99: warning: local class DingDongDoobie is never used
+ class DingDongDoobie // warn
+ ^
+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.
+21 warnings found
+one error found
diff --git a/tests/untried/neg/warn-unused-privates.flags b/tests/untried/neg/warn-unused-privates.flags
new file mode 100644
index 000000000..25474aefb
--- /dev/null
+++ b/tests/untried/neg/warn-unused-privates.flags
@@ -0,0 +1 @@
+-Ywarn-unused -Xfatal-warnings
diff --git a/tests/untried/neg/warn-unused-privates.scala b/tests/untried/neg/warn-unused-privates.scala
new file mode 100644
index 000000000..cb6e946a3
--- /dev/null
+++ b/tests/untried/neg/warn-unused-privates.scala
@@ -0,0 +1,105 @@
+class Bippy(a: Int, b: Int) {
+ private def this(c: Int) = this(c, c) // warn
+ private def bippy(x: Int): Int = bippy(x) // TODO: could warn
+ private def boop(x: Int) = x+a+b // warn
+ final private val MILLIS1 = 2000 // no warn, might have been inlined
+ final private val MILLIS2: Int = 1000 // warn
+ final private val HI_COMPANION: Int = 500 // no warn, accessed from companion
+ def hi() = Bippy.HI_INSTANCE
+}
+object Bippy {
+ def hi(x: Bippy) = x.HI_COMPANION
+ private val HI_INSTANCE: Int = 500 // no warn, accessed from instance
+ private val HEY_INSTANCE: Int = 1000 // warn
+}
+
+class A(val msg: String)
+class B1(msg: String) extends A(msg)
+class B2(msg0: String) extends A(msg0)
+class B3(msg0: String) extends A("msg")
+
+/*** Early defs warnings disabled primarily due to SI-6595.
+ * The test case is here to assure we aren't issuing false positives;
+ * the ones labeled "warn" don't warn.
+ ***/
+class Boppy extends {
+ private val hmm: String = "abc" // no warn, used in early defs
+ private val hom: String = "def" // no warn, used in body
+ private final val him = "ghi" // no warn, might have been (was) inlined
+ final val him2 = "ghi" // no warn, same
+ final val himinline = him
+ private val hum: String = "jkl" // warn
+ final val ding = hmm.length
+} with Mutable {
+ val dinger = hom
+ private val hummer = "def" // warn
+
+ private final val bum = "ghi" // no warn, might have been (was) inlined
+ final val bum2 = "ghi" // no warn, same
+}
+
+trait Accessors {
+ private var v1: Int = 0 // warn
+ private var v2: Int = 0 // warn, never set
+ private var v3: Int = 0 // warn, never got
+ private var v4: Int = 0 // no warn
+
+ def bippy(): Int = {
+ v3 = 5
+ v4 = 6
+ v2 + v4
+ }
+}
+
+trait DefaultArgs {
+ // warn about default getters for x2 and x3
+ private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3
+
+ def boppy() = bippy(5, 100, 200)
+}
+
+class Outer {
+ class Inner
+}
+
+trait Locals {
+ def f0 = {
+ var x = 1 // warn
+ var y = 2
+ y = 3
+ y + y
+ }
+ def f1 = {
+ val a = new Outer // no warn
+ val b = new Outer // warn
+ new a.Inner
+ }
+ def f2 = {
+ var x = 100 // warn about it being a var
+ x
+ }
+}
+
+object Types {
+ private object Dongo { def f = this } // warn
+ private class Bar1 // warn
+ private class Bar2 // no warn
+ private type Alias1 = String // warn
+ private type Alias2 = String // no warn
+ def bippo = (new Bar2).toString
+
+ def f(x: Alias2) = x.length
+
+ def l1() = {
+ object HiObject { def f = this } // warn
+ class Hi { // warn
+ def f1: Hi = new Hi
+ def f2(x: Hi) = x
+ }
+ class DingDongDoobie // warn
+ class Bippy // no warn
+ type Something = Bippy // no warn
+ type OtherThing = String // warn
+ (new Bippy): Something
+ }
+}
diff --git a/tests/untried/neg/wellkinded_app.check b/tests/untried/neg/wellkinded_app.check
new file mode 100644
index 000000000..d57a0e4b5
--- /dev/null
+++ b/tests/untried/neg/wellkinded_app.check
@@ -0,0 +1,4 @@
+wellkinded_app.scala:3: error: x does not take type parameters
+ type t = x[x]
+ ^
+one error found
diff --git a/tests/untried/neg/wellkinded_app.scala b/tests/untried/neg/wellkinded_app.scala
new file mode 100644
index 000000000..7fa3f95a9
--- /dev/null
+++ b/tests/untried/neg/wellkinded_app.scala
@@ -0,0 +1,4 @@
+// test well-kindedness checks
+class WellKinded[x] {
+ type t = x[x]
+}
diff --git a/tests/untried/neg/wellkinded_app2.check b/tests/untried/neg/wellkinded_app2.check
new file mode 100644
index 000000000..20a177ea5
--- /dev/null
+++ b/tests/untried/neg/wellkinded_app2.check
@@ -0,0 +1,4 @@
+wellkinded_app2.scala:3: error: s does not take type parameters
+ val foo: s[Int]
+ ^
+one error found
diff --git a/tests/untried/neg/wellkinded_app2.scala b/tests/untried/neg/wellkinded_app2.scala
new file mode 100644
index 000000000..7bb4c87f6
--- /dev/null
+++ b/tests/untried/neg/wellkinded_app2.scala
@@ -0,0 +1,4 @@
+// test well-kindedness checks
+class WellKinded[s <: Throwable] {
+ val foo: s[Int]
+}
diff --git a/tests/untried/neg/wellkinded_bounds.check b/tests/untried/neg/wellkinded_bounds.check
new file mode 100644
index 000000000..806eb09a7
--- /dev/null
+++ b/tests/untried/neg/wellkinded_bounds.check
@@ -0,0 +1,4 @@
+wellkinded_bounds.scala:2: error: type List takes type parameters
+class WellKindedWrongSyntax[s <: List] { // must be s[x] <: List[x]
+ ^
+one error found
diff --git a/tests/untried/neg/wellkinded_bounds.scala b/tests/untried/neg/wellkinded_bounds.scala
new file mode 100644
index 000000000..cfa5e74c1
--- /dev/null
+++ b/tests/untried/neg/wellkinded_bounds.scala
@@ -0,0 +1,3 @@
+// test well-kindedness checks -- syntax error
+class WellKindedWrongSyntax[s <: List] { // must be s[x] <: List[x]
+}
diff --git a/tests/untried/neg/wellkinded_wrongarity.check b/tests/untried/neg/wellkinded_wrongarity.check
new file mode 100644
index 000000000..b9f033b45
--- /dev/null
+++ b/tests/untried/neg/wellkinded_wrongarity.check
@@ -0,0 +1,4 @@
+wellkinded_wrongarity.scala:5: error: Tuple2 takes two type parameters, expected: one
+object mp extends Monad[Tuple2]
+ ^
+one error found
diff --git a/tests/untried/neg/wellkinded_wrongarity.scala b/tests/untried/neg/wellkinded_wrongarity.scala
new file mode 100644
index 000000000..39c7601d5
--- /dev/null
+++ b/tests/untried/neg/wellkinded_wrongarity.scala
@@ -0,0 +1,5 @@
+// test well-kindedness checks -- arity error
+
+class Monad[m[x]]
+
+object mp extends Monad[Tuple2]
diff --git a/tests/untried/neg/wellkinded_wrongarity2.check b/tests/untried/neg/wellkinded_wrongarity2.check
new file mode 100644
index 000000000..922f73381
--- /dev/null
+++ b/tests/untried/neg/wellkinded_wrongarity2.check
@@ -0,0 +1,13 @@
+wellkinded_wrongarity2.scala:5: error: String takes no type parameters, expected: one
+trait ms1 extends Monad[String] // wrong
+ ^
+wellkinded_wrongarity2.scala:6: error: t takes no type parameters, expected: one
+trait ms2[t] extends Monad[t] // wrong
+ ^
+wellkinded_wrongarity2.scala:7: error: m[t] takes no type parameters, expected: one
+trait ms3[m[_], t] extends Monad[m[t]] // wrong -- added to check regression on bug
+ ^
+wellkinded_wrongarity2.scala:12: error: type m takes type parameters
+trait Bar2[m[_]] extends Foo[m] // check that m is properly recognized as kind *->*, while * is expected
+ ^
+four errors found
diff --git a/tests/untried/neg/wellkinded_wrongarity2.scala b/tests/untried/neg/wellkinded_wrongarity2.scala
new file mode 100644
index 000000000..aac617bd8
--- /dev/null
+++ b/tests/untried/neg/wellkinded_wrongarity2.scala
@@ -0,0 +1,12 @@
+// test well-kindedness checks
+
+// expecting types of kind *->*
+class Monad[m[x]]
+trait ms1 extends Monad[String] // wrong
+trait ms2[t] extends Monad[t] // wrong
+trait ms3[m[_], t] extends Monad[m[t]] // wrong -- added to check regression on bug
+
+// expecting types of kind *
+trait Foo[x]
+trait Bar1[m[_]] extends Foo[m[Int]] // check that m[Int] is properly recognized as kind-*
+trait Bar2[m[_]] extends Foo[m] // check that m is properly recognized as kind *->*, while * is expected
diff --git a/tests/untried/neg/wrong-args-for-none.check b/tests/untried/neg/wrong-args-for-none.check
new file mode 100644
index 000000000..d3b2d572a
--- /dev/null
+++ b/tests/untried/neg/wrong-args-for-none.check
@@ -0,0 +1,4 @@
+wrong-args-for-none.scala:5: error: wrong number of arguments for pattern Test.Foo(x: Int,y: Int)
+ def f(x: Any) = x match { case Bar(Foo(5)) => }
+ ^
+one error found
diff --git a/tests/untried/neg/wrong-args-for-none.scala b/tests/untried/neg/wrong-args-for-none.scala
new file mode 100644
index 000000000..1caa4782a
--- /dev/null
+++ b/tests/untried/neg/wrong-args-for-none.scala
@@ -0,0 +1,6 @@
+object Test {
+ case class Foo(x: Int, y: Int)
+ case class Bar(x: AnyRef)
+
+ def f(x: Any) = x match { case Bar(Foo(5)) => }
+}
diff --git a/tests/untried/neg/xmlcorner.check b/tests/untried/neg/xmlcorner.check
new file mode 100644
index 000000000..8791829e5
--- /dev/null
+++ b/tests/untried/neg/xmlcorner.check
@@ -0,0 +1,7 @@
+xmlcorner.scala:2: error: illegal start of simple expression
+ val wrong = <:bla/>
+ ^
+xmlcorner.scala:5: error: in XML literal: name cannot end in ':'
+ val wrong = <bla: />
+ ^
+two errors found
diff --git a/tests/untried/neg/xmlcorner.scala b/tests/untried/neg/xmlcorner.scala
new file mode 100644
index 000000000..042ec05e6
--- /dev/null
+++ b/tests/untried/neg/xmlcorner.scala
@@ -0,0 +1,22 @@
+class foo {
+ val wrong = <:bla/>
+}
+class bar {
+ val wrong = <bla: />
+}
+
+// this "pos" test is only included as a parser test
+object pos
+{
+ def wrap(f : Int => Unit) = f(5)
+
+ wrap({ v =>
+ if(v == 5) {
+ val n = {
+ val m = (<a>{}</a>)
+ <div>{ v }</div>
+ }
+ ()
+ }
+ })
+}
diff --git a/tests/untried/neg/xmltruncated1.check b/tests/untried/neg/xmltruncated1.check
new file mode 100644
index 000000000..36daa342e
--- /dev/null
+++ b/tests/untried/neg/xmltruncated1.check
@@ -0,0 +1,4 @@
+xmltruncated1.scala:2: error: input ended while parsing XML
+ val stuff = <a>
+ ^
+one error found
diff --git a/tests/untried/neg/xmltruncated1.scala b/tests/untried/neg/xmltruncated1.scala
new file mode 100644
index 000000000..f64573cc7
--- /dev/null
+++ b/tests/untried/neg/xmltruncated1.scala
@@ -0,0 +1,2 @@
+object Main {
+ val stuff = <a>
diff --git a/tests/untried/neg/xmltruncated2.check b/tests/untried/neg/xmltruncated2.check
new file mode 100644
index 000000000..f1de059f8
--- /dev/null
+++ b/tests/untried/neg/xmltruncated2.check
@@ -0,0 +1,4 @@
+xmltruncated2.scala:2: error: input ended while parsing XML
+ val stuff = <![CDATA[aoeu
+ ^
+one error found
diff --git a/tests/untried/neg/xmltruncated2.scala b/tests/untried/neg/xmltruncated2.scala
new file mode 100644
index 000000000..de9c7bb4a
--- /dev/null
+++ b/tests/untried/neg/xmltruncated2.scala
@@ -0,0 +1,2 @@
+object Main {
+ val stuff = <![CDATA[aoeu
diff --git a/tests/untried/neg/xmltruncated3.check b/tests/untried/neg/xmltruncated3.check
new file mode 100644
index 000000000..76851bd36
--- /dev/null
+++ b/tests/untried/neg/xmltruncated3.check
@@ -0,0 +1,4 @@
+xmltruncated3.scala:2: error: input ended while parsing XML
+ val stuff = <a unclosedattr="aaaa
+ ^
+one error found
diff --git a/tests/untried/neg/xmltruncated3.scala b/tests/untried/neg/xmltruncated3.scala
new file mode 100644
index 000000000..76c894aed
--- /dev/null
+++ b/tests/untried/neg/xmltruncated3.scala
@@ -0,0 +1,2 @@
+object Main {
+ val stuff = <a unclosedattr="aaaa
diff --git a/tests/untried/neg/xmltruncated4.check b/tests/untried/neg/xmltruncated4.check
new file mode 100644
index 000000000..4a3265d27
--- /dev/null
+++ b/tests/untried/neg/xmltruncated4.check
@@ -0,0 +1,4 @@
+xmltruncated4.scala:2: error: input ended while parsing XML
+ val stuff = <!-- comment starts but never ends...
+ ^
+one error found
diff --git a/tests/untried/neg/xmltruncated4.scala b/tests/untried/neg/xmltruncated4.scala
new file mode 100644
index 000000000..229a843c3
--- /dev/null
+++ b/tests/untried/neg/xmltruncated4.scala
@@ -0,0 +1,2 @@
+object Main {
+ val stuff = <!-- comment starts but never ends...
diff --git a/tests/untried/neg/xmltruncated5.check b/tests/untried/neg/xmltruncated5.check
new file mode 100644
index 000000000..cd13200b8
--- /dev/null
+++ b/tests/untried/neg/xmltruncated5.check
@@ -0,0 +1,4 @@
+xmltruncated5.scala:3: error: input ended while parsing XML
+ case <a>
+ ^
+one error found
diff --git a/tests/untried/neg/xmltruncated5.scala b/tests/untried/neg/xmltruncated5.scala
new file mode 100644
index 000000000..3ff8c9fc0
--- /dev/null
+++ b/tests/untried/neg/xmltruncated5.scala
@@ -0,0 +1,3 @@
+object Main {
+ <a/> match {
+ case <a>
diff --git a/tests/untried/neg/xmltruncated6.check b/tests/untried/neg/xmltruncated6.check
new file mode 100644
index 000000000..f638f2f09
--- /dev/null
+++ b/tests/untried/neg/xmltruncated6.check
@@ -0,0 +1,4 @@
+xmltruncated6.scala:2: error: in XML literal: expected end of Scala block
+ val stuff = <a>{ "no closing brace"
+ ^
+one error found
diff --git a/tests/untried/neg/xmltruncated6.scala b/tests/untried/neg/xmltruncated6.scala
new file mode 100644
index 000000000..c53faedb2
--- /dev/null
+++ b/tests/untried/neg/xmltruncated6.scala
@@ -0,0 +1,2 @@
+object Main {
+ val stuff = <a>{ "no closing brace"
diff --git a/tests/untried/neg/xmltruncated7.check b/tests/untried/neg/xmltruncated7.check
new file mode 100644
index 000000000..67e7bd4b1
--- /dev/null
+++ b/tests/untried/neg/xmltruncated7.check
@@ -0,0 +1,7 @@
+xmltruncated7.scala:2: error: in XML literal: in XML content, please use '}}' to express '}'
+ <p>foo}: </p>
+ ^
+xmltruncated7.scala:2: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed <p>
+ <p>foo}: </p>
+ ^
+two errors found
diff --git a/tests/untried/neg/xmltruncated7.scala b/tests/untried/neg/xmltruncated7.scala
new file mode 100644
index 000000000..7e296a910
--- /dev/null
+++ b/tests/untried/neg/xmltruncated7.scala
@@ -0,0 +1,3 @@
+object Test {
+ <p>foo}: </p>
+} \ No newline at end of file