summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/abstract-inaccessible.check2
-rw-r--r--test/files/neg/abstract-inaccessible.flags2
-rw-r--r--test/files/neg/abstract-inaccessible.scala2
-rw-r--r--test/files/neg/ambiguous-same.check6
-rw-r--r--test/files/neg/ambiguous-same.scala15
-rw-r--r--test/files/neg/anytrait.check5
-rw-r--r--test/files/neg/beanInfoDeprecation.check6
-rw-r--r--test/files/neg/beanInfoDeprecation.flags1
-rw-r--r--test/files/neg/beanInfoDeprecation.scala2
-rw-r--r--test/files/neg/case-collision.check6
-rw-r--r--test/files/neg/case-collision.flags2
-rw-r--r--test/files/neg/case-collision2.flags2
-rw-r--r--test/files/neg/checksensible.check2
-rw-r--r--test/files/neg/choices.check3
-rw-r--r--test/files/neg/classmanifests_new_deprecations.check16
-rw-r--r--test/files/neg/compile-time-only-a.check8
-rw-r--r--test/files/neg/constrs.check2
-rw-r--r--test/files/neg/delayed-init-ref.check3
-rw-r--r--test/files/neg/deprecated-target.check4
-rw-r--r--test/files/neg/deprecated-target.flags1
-rw-r--r--test/files/neg/deprecated-target.scala1
-rw-r--r--test/files/neg/eta-expand-star-deprecation.check4
-rw-r--r--test/files/neg/eta-expand-star-deprecation.flags1
-rw-r--r--test/files/neg/eta-expand-star-deprecation.scala8
-rw-r--r--test/files/neg/eta-expand-star.check4
-rw-r--r--test/files/neg/forgot-interpolator.flags2
-rw-r--r--test/files/neg/hkgadt.check31
-rw-r--r--test/files/neg/hkgadt.scala35
-rw-r--r--test/files/neg/implicit-ambiguous-2.check4
-rw-r--r--test/files/neg/implicit-ambiguous-2.scala11
-rw-r--r--test/files/neg/implicit-ambiguous-invalid.check7
-rw-r--r--test/files/neg/implicit-ambiguous-invalid.flags (renamed from test/files/neg/t6375.flags)0
-rw-r--r--test/files/neg/implicit-ambiguous-invalid.scala6
-rw-r--r--test/files/neg/implicit-ambiguous.check4
-rw-r--r--test/files/neg/implicit-ambiguous.scala11
-rw-r--r--test/files/neg/inlineIndyLambdaPrivate.check16
-rw-r--r--test/files/neg/inlineIndyLambdaPrivate.flags1
-rw-r--r--test/files/neg/inlineIndyLambdaPrivate/A_1.java9
-rw-r--r--test/files/neg/inlineIndyLambdaPrivate/Test_2.scala3
-rw-r--r--test/files/neg/inlineMaxSize.flags2
-rw-r--r--test/files/neg/literals.check14
-rw-r--r--test/files/neg/literals.scala13
-rw-r--r--test/files/neg/logImplicits.check4
-rw-r--r--test/files/neg/lub-from-hell-2.check7
-rw-r--r--test/files/neg/lub-from-hell-2.scala13
-rw-r--r--test/files/neg/macro-invalidret.check2
-rw-r--r--test/files/neg/macro-invalidusage-badargs.check4
-rw-r--r--test/files/neg/maxerrs.check16
-rw-r--r--test/files/neg/maxerrs.flags1
-rw-r--r--test/files/neg/maxerrs.scala32
-rw-r--r--test/files/neg/maxwarns.check12
-rw-r--r--test/files/neg/maxwarns.flags1
-rw-r--r--test/files/neg/maxwarns.scala32
-rw-r--r--test/files/neg/missing-arg-list.check7
-rw-r--r--test/files/neg/missing-arg-list.scala3
-rw-r--r--test/files/neg/multi-array.check4
-rw-r--r--test/files/neg/names-defaults-neg-warn.check4
-rw-r--r--test/files/neg/names-defaults-neg.check58
-rw-r--r--test/files/neg/names-defaults-neg.scala4
-rw-r--r--test/files/neg/nested-fn-print.check2
-rw-r--r--test/files/neg/no-predef.check8
-rw-r--r--test/files/neg/optimiseDeprecated.check4
-rw-r--r--test/files/neg/optimiseDeprecated.flags1
-rw-r--r--test/files/neg/optimiseDeprecated.scala1
-rw-r--r--test/files/neg/outer-ref-checks.check24
-rw-r--r--test/files/neg/outer-ref-checks.flags1
-rw-r--r--test/files/neg/outer-ref-checks.scala106
-rw-r--r--test/files/neg/overloaded-implicit.flags2
-rw-r--r--test/files/neg/overloaded-unapply.check4
-rw-r--r--test/files/neg/override-object-no.check10
-rw-r--r--test/files/neg/override-object-no.scala11
-rw-r--r--test/files/neg/partestInvalidFlag.check4
-rw-r--r--test/files/neg/partestInvalidFlag.flags2
-rw-r--r--test/files/neg/protected-constructors.check21
-rw-r--r--test/files/neg/quasiquotes-syntax-error-position.check3
-rw-r--r--test/files/neg/sabin2.check2
-rw-r--r--test/files/neg/saferJavaConversions.scala6
-rw-r--r--test/files/neg/sammy_disabled.check4
-rw-r--r--test/files/neg/sammy_disabled.flags1
-rw-r--r--test/files/neg/sammy_disabled.scala3
-rw-r--r--test/files/neg/sammy_error.check4
-rw-r--r--test/files/neg/sammy_error.scala7
-rw-r--r--test/files/neg/sammy_error_exist_no_crash.check4
-rw-r--r--test/files/neg/sammy_error_exist_no_crash.flags1
-rw-r--r--test/files/neg/sammy_error_exist_no_crash.scala4
-rw-r--r--test/files/neg/sammy_expected.check6
-rw-r--r--test/files/neg/sammy_expected.scala5
-rw-r--r--test/files/neg/sammy_overload.check7
-rw-r--r--test/files/neg/sammy_overload.scala15
-rw-r--r--test/files/neg/sammy_restrictions.check47
-rw-r--r--test/files/neg/sammy_restrictions.flags1
-rw-r--r--test/files/neg/sammy_restrictions.scala26
-rw-r--r--test/files/neg/sammy_wrong_arity.flags1
-rw-r--r--test/files/neg/scopes.check2
-rw-r--r--test/files/neg/sd128.check17
-rw-r--r--test/files/neg/sd128/A.java3
-rw-r--r--test/files/neg/sd128/Test.scala19
-rw-r--r--test/files/neg/sealed-final-neg.check13
-rw-r--r--test/files/neg/sealed-final-neg.flags2
-rw-r--r--test/files/neg/sealed-final-neg.scala2
-rw-r--r--test/files/neg/specification-scopes.check18
-rw-r--r--test/files/neg/specification-scopes/P_1.scala9
-rw-r--r--test/files/neg/specification-scopes/P_2.scala43
-rw-r--r--test/files/neg/stmt-expr-discard.check4
-rw-r--r--test/files/neg/t10066.check7
-rw-r--r--test/files/neg/t10066.scala38
-rw-r--r--test/files/neg/t10068.check13
-rw-r--r--test/files/neg/t10068.flags1
-rw-r--r--test/files/neg/t10068.scala9
-rw-r--r--test/files/neg/t10097.check10
-rw-r--r--test/files/neg/t10097.flags1
-rw-r--r--test/files/neg/t10097.scala4
-rw-r--r--test/files/neg/t10097b.check6
-rw-r--r--test/files/neg/t10097b.flags1
-rw-r--r--test/files/neg/t10097b.scala3
-rw-r--r--test/files/neg/t1010.check2
-rwxr-xr-xtest/files/neg/t10207.check4
-rw-r--r--test/files/neg/t10207.scala16
-rw-r--r--test/files/neg/t1112.check4
-rw-r--r--test/files/neg/t1181.check6
-rw-r--r--test/files/neg/t1523.check4
-rw-r--r--test/files/neg/t1838.check6
-rw-r--r--test/files/neg/t1960.check11
-rw-r--r--test/files/neg/t1960.scala7
-rw-r--r--test/files/neg/t1980.flags2
-rw-r--r--test/files/neg/t200.check4
-rw-r--r--test/files/neg/t2102.check4
-rw-r--r--test/files/neg/t2712.flags1
-rw-r--r--test/files/neg/t2779.check4
-rw-r--r--test/files/neg/t278.check4
-rw-r--r--test/files/neg/t3234.check6
-rw-r--r--test/files/neg/t3234.flags1
-rw-r--r--test/files/neg/t3234.scala19
-rw-r--r--test/files/neg/t3772.check7
-rw-r--r--test/files/neg/t3772.scala17
-rw-r--r--test/files/neg/t3871.check2
-rw-r--r--test/files/neg/t4158.check6
-rw-r--r--test/files/neg/t4425.flags1
-rw-r--r--test/files/neg/t4460a.check2
-rw-r--r--test/files/neg/t4460b.check2
-rw-r--r--test/files/neg/t4541.check2
-rw-r--r--test/files/neg/t4541b.check2
-rw-r--r--test/files/neg/t4851.check12
-rw-r--r--test/files/neg/t4877.flags1
-rw-r--r--test/files/neg/t5120.check2
-rw-r--r--test/files/neg/t5148.check10
-rw-r--r--test/files/neg/t5429.check2
-rw-r--r--test/files/neg/t5580b.scala2
-rw-r--r--test/files/neg/t5639b.flags1
-rw-r--r--test/files/neg/t565.check2
-rw-r--r--test/files/neg/t5761.check2
-rw-r--r--test/files/neg/t591.check4
-rw-r--r--test/files/neg/t591.scala3
-rw-r--r--test/files/neg/t6120.check4
-rw-r--r--test/files/neg/t6162-inheritance.check2
-rw-r--r--test/files/neg/t6162-overriding.check2
-rw-r--r--test/files/neg/t6214.check7
-rw-r--r--test/files/neg/t6289.check6
-rw-r--r--test/files/neg/t6323a.check6
-rw-r--r--test/files/neg/t6335.check8
-rw-r--r--test/files/neg/t6375.check27
-rw-r--r--test/files/neg/t6375.scala67
-rw-r--r--test/files/neg/t6406-regextract.check2
-rw-r--r--test/files/neg/t6446-additional.check30
-rw-r--r--test/files/neg/t6446-missing.check27
-rw-r--r--test/files/neg/t6446-show-phases.check27
-rw-r--r--test/files/neg/t6455.flags1
-rw-r--r--test/files/neg/t6455.scala4
-rw-r--r--test/files/neg/t6567.flags2
-rw-r--r--test/files/neg/t6666.check4
-rw-r--r--test/files/neg/t6675.flags2
-rw-r--r--test/files/neg/t6810.check28
-rw-r--r--test/files/neg/t6810.scala26
-rw-r--r--test/files/neg/t6829.check14
-rw-r--r--test/files/neg/t6920.check4
-rw-r--r--test/files/neg/t7014.check5
-rw-r--r--test/files/neg/t7014.flags1
-rw-r--r--test/files/neg/t7014/ThreadSafetyLevel_1.java8
-rw-r--r--test/files/neg/t7014/ThreadSafety_1.java9
-rw-r--r--test/files/neg/t7014/t7014_2.scala3
-rw-r--r--test/files/neg/t712.check3
-rw-r--r--test/files/neg/t7157.check48
-rw-r--r--test/files/neg/t7171.check5
-rw-r--r--test/files/neg/t7171b.check8
-rw-r--r--test/files/neg/t7187.check6
-rw-r--r--test/files/neg/t7187.flags1
-rw-r--r--test/files/neg/t7187.scala6
-rw-r--r--test/files/neg/t7294.check6
-rw-r--r--test/files/neg/t7294.flags1
-rw-r--r--test/files/neg/t7294b.check4
-rw-r--r--test/files/neg/t7294b.flags1
-rw-r--r--test/files/neg/t7475d.check7
-rw-r--r--test/files/neg/t7494-no-options.check30
-rw-r--r--test/files/neg/t7602.check4
-rw-r--r--test/files/neg/t7622-cyclic-dependency.check2
-rw-r--r--test/files/neg/t7622-cyclic-dependency/ThePlugin.scala2
-rw-r--r--test/files/neg/t7848-interp-warn.check28
-rw-r--r--test/files/neg/t7848-interp-warn.scala29
-rw-r--r--test/files/neg/t7860.check9
-rw-r--r--test/files/neg/t7860.flags1
-rw-r--r--test/files/neg/t7860.scala42
-rw-r--r--test/files/neg/t800.check12
-rw-r--r--test/files/neg/t8002-nested-scope.check4
-rw-r--r--test/files/neg/t8002-nested-scope.scala12
-rw-r--r--test/files/neg/t8006.check4
-rw-r--r--test/files/neg/t8035-deprecated.check6
-rw-r--r--test/files/neg/t8035-no-adapted-args.check4
-rw-r--r--test/files/neg/t8044-b.check4
-rw-r--r--test/files/neg/t8044-b.scala4
-rw-r--r--test/files/neg/t8044.check4
-rw-r--r--test/files/neg/t8044.scala4
-rw-r--r--test/files/neg/t8079a.check4
-rw-r--r--test/files/neg/t8079a.scala4
-rw-r--r--test/files/neg/t8217-local-alias-requires-rhs.check10
-rw-r--r--test/files/neg/t8417.check15
-rw-r--r--test/files/neg/t8417.flags1
-rw-r--r--test/files/neg/t8417.scala6
-rw-r--r--test/files/neg/t8667.check91
-rw-r--r--test/files/neg/t8667.scala37
-rw-r--r--test/files/neg/t8685.check48
-rw-r--r--test/files/neg/t8685.flags1
-rw-r--r--test/files/neg/t8685.scala54
-rw-r--r--test/files/neg/t8700a.check11
-rw-r--r--test/files/neg/t8700a.flags1
-rw-r--r--test/files/neg/t8700a/Bar.scala9
-rw-r--r--test/files/neg/t8700a/Baz.java11
-rw-r--r--test/files/neg/t8700a/Foo.java4
-rw-r--r--test/files/neg/t8700b.check11
-rw-r--r--test/files/neg/t8700b.flags1
-rw-r--r--test/files/neg/t8700b/Bar_2.scala9
-rw-r--r--test/files/neg/t8700b/Baz_1.java11
-rw-r--r--test/files/neg/t8700b/Foo_1.java4
-rw-r--r--test/files/neg/t8704.check11
-rw-r--r--test/files/neg/t8704.flags1
-rw-r--r--test/files/neg/t8704.scala7
-rw-r--r--test/files/neg/t876.check4
-rw-r--r--test/files/neg/t8764.check6
-rw-r--r--test/files/neg/t8764.flags1
-rw-r--r--test/files/neg/t8764.scala9
-rw-r--r--test/files/neg/t8849.check7
-rw-r--r--test/files/neg/t8849.scala10
-rw-r--r--test/files/neg/t9045.check7
-rw-r--r--test/files/neg/t9045.scala8
-rw-r--r--test/files/neg/t9361.check11
-rw-r--r--test/files/neg/t9361.scala5
-rw-r--r--test/files/neg/t9382.check10
-rw-r--r--test/files/neg/t9382.scala6
-rw-r--r--test/files/neg/t9398.check7
-rw-r--r--test/files/neg/t9398.flags1
-rw-r--r--test/files/neg/t9398/data.scala5
-rw-r--r--test/files/neg/t9398/match.scala6
-rw-r--r--test/files/neg/t9527a.check7
-rw-r--r--test/files/neg/t9527a.scala8
-rw-r--r--test/files/neg/t9527b.check4
-rw-r--r--test/files/neg/t9527b.scala9
-rw-r--r--test/files/neg/t9535.check7
-rw-r--r--test/files/neg/t9535.scala7
-rw-r--r--test/files/neg/t9629.check17
-rw-r--r--test/files/neg/t9629.scala12
-rw-r--r--test/files/neg/t963.check10
-rw-r--r--test/files/neg/t9636.check6
-rw-r--r--test/files/neg/t9636.flags1
-rw-r--r--test/files/neg/t9636.scala17
-rw-r--r--test/files/neg/t9675.check27
-rw-r--r--test/files/neg/t9675.flags1
-rw-r--r--test/files/neg/t9675.scala24
-rw-r--r--test/files/neg/t9684.check9
-rw-r--r--test/files/neg/t9684.flags1
-rw-r--r--test/files/neg/t9684.scala9
-rw-r--r--test/files/neg/t9684b.check7
-rw-r--r--test/files/neg/t9684b.scala14
-rw-r--r--test/files/neg/t9781.check4
-rw-r--r--test/files/neg/t9781.scala4
-rw-r--r--test/files/neg/t9847.check45
-rw-r--r--test/files/neg/t9847.flags1
-rw-r--r--test/files/neg/t9847.scala23
-rw-r--r--test/files/neg/t9849.check7
-rw-r--r--test/files/neg/t9849.scala16
-rw-r--r--test/files/neg/t9953.check6
-rw-r--r--test/files/neg/t9953.flags1
-rw-r--r--test/files/neg/t9953.scala13
-rw-r--r--test/files/neg/trailing-commas.check130
-rw-r--r--test/files/neg/trailing-commas.scala56
-rw-r--r--test/files/neg/trait-defaults-super.check4
-rw-r--r--test/files/neg/trait-defaults-super.scala21
-rw-r--r--test/files/neg/trait-no-native.check4
-rw-r--r--test/files/neg/trait-no-native.scala4
-rw-r--r--test/files/neg/trait_fields_conflicts.check273
-rw-r--r--test/files/neg/trait_fields_conflicts.scala87
-rw-r--r--test/files/neg/trait_fields_deprecated_overriding.check6
-rw-r--r--test/files/neg/trait_fields_deprecated_overriding.flags1
-rw-r--r--test/files/neg/trait_fields_deprecated_overriding.scala11
-rw-r--r--test/files/neg/trait_fields_var_override.check5
-rw-r--r--test/files/neg/trait_fields_var_override.scala2
-rw-r--r--test/files/neg/type-diagnostics.check4
-rw-r--r--test/files/neg/unit-returns-value.check6
-rw-r--r--test/files/neg/val_infer.check6
-rw-r--r--test/files/neg/val_infer.scala4
-rw-r--r--test/files/neg/val_sig_infer_match.check4
-rw-r--r--test/files/neg/val_sig_infer_match.scala22
-rw-r--r--test/files/neg/val_sig_infer_struct.check4
-rw-r--r--test/files/neg/val_sig_infer_struct.scala8
-rw-r--r--test/files/neg/variances.check2
-rw-r--r--test/files/neg/warn-inferred-any.check2
-rw-r--r--test/files/neg/warn-unused-implicits.check9
-rw-r--r--test/files/neg/warn-unused-implicits.flags1
-rw-r--r--test/files/neg/warn-unused-implicits.scala32
-rw-r--r--test/files/neg/warn-unused-imports.check5
-rw-r--r--test/files/neg/warn-unused-imports.flags2
-rw-r--r--test/files/neg/warn-unused-imports/sample_1.scala15
-rw-r--r--test/files/neg/warn-unused-imports/warn-unused-imports_2.scala6
-rw-r--r--test/files/neg/warn-unused-params.check18
-rw-r--r--test/files/neg/warn-unused-params.flags1
-rw-r--r--test/files/neg/warn-unused-params.scala69
-rw-r--r--test/files/neg/warn-unused-patvars.check12
-rw-r--r--test/files/neg/warn-unused-patvars.flags1
-rw-r--r--test/files/neg/warn-unused-patvars.scala53
-rw-r--r--test/files/neg/warn-unused-privates.check99
-rw-r--r--test/files/neg/warn-unused-privates.scala120
319 files changed, 3154 insertions, 605 deletions
diff --git a/test/files/neg/abstract-inaccessible.check b/test/files/neg/abstract-inaccessible.check
index d56f5691be..739620a4ce 100644
--- a/test/files/neg/abstract-inaccessible.check
+++ b/test/files/neg/abstract-inaccessible.check
@@ -8,7 +8,7 @@ Classes which cannot access Bippy may be unable to override overrideMe.
^
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
+ def overrideMeAlso(x: Map[Int, Set[Bippy]]) = x.keys.head
^
error: No warnings can be incurred under -Xfatal-warnings.
three warnings found
diff --git a/test/files/neg/abstract-inaccessible.flags b/test/files/neg/abstract-inaccessible.flags
index 6c1dd108ae..ea7773e255 100644
--- a/test/files/neg/abstract-inaccessible.flags
+++ b/test/files/neg/abstract-inaccessible.flags
@@ -1 +1 @@
--Xfatal-warnings -Xlint \ No newline at end of file
+-Xfatal-warnings -Xlint:inaccessible
diff --git a/test/files/neg/abstract-inaccessible.scala b/test/files/neg/abstract-inaccessible.scala
index 3c80f30522..02b458016f 100644
--- a/test/files/neg/abstract-inaccessible.scala
+++ b/test/files/neg/abstract-inaccessible.scala
@@ -4,6 +4,6 @@ package foo {
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
+ def overrideMeAlso(x: Map[Int, Set[Bippy]]) = x.keys.head
}
}
diff --git a/test/files/neg/ambiguous-same.check b/test/files/neg/ambiguous-same.check
new file mode 100644
index 0000000000..58f4e60ece
--- /dev/null
+++ b/test/files/neg/ambiguous-same.check
@@ -0,0 +1,6 @@
+ambiguous-same.scala:13: error: reference to x is ambiguous;
+it is both defined in object X and imported subsequently by
+import X.x
+ x
+ ^
+one error found
diff --git a/test/files/neg/ambiguous-same.scala b/test/files/neg/ambiguous-same.scala
new file mode 100644
index 0000000000..50dba71f67
--- /dev/null
+++ b/test/files/neg/ambiguous-same.scala
@@ -0,0 +1,15 @@
+
+// When faced with ambiguities between imports,
+// an attempt is made to see if the imports intend
+// identical types.
+//
+// Here, no attempt is made to notice that x
+// names the same thing.
+//
+object X {
+ val x = 42
+ def f = {
+ import X.x
+ x
+ }
+}
diff --git a/test/files/neg/anytrait.check b/test/files/neg/anytrait.check
index fabe74d379..6d9d681d60 100644
--- a/test/files/neg/anytrait.check
+++ b/test/files/neg/anytrait.check
@@ -4,4 +4,7 @@ anytrait.scala:3: error: field definition is not allowed in universal trait exte
anytrait.scala:5: error: this statement is not allowed in universal trait extending from class Any
{ x += 1 }
^
-two errors found
+anytrait.scala:9: error: field definition is not allowed in universal trait extending from class Any
+ val y: T
+ ^
+three errors found
diff --git a/test/files/neg/beanInfoDeprecation.check b/test/files/neg/beanInfoDeprecation.check
new file mode 100644
index 0000000000..a91cdabae2
--- /dev/null
+++ b/test/files/neg/beanInfoDeprecation.check
@@ -0,0 +1,6 @@
+beanInfoDeprecation.scala:2: warning: class BeanInfo in package beans is deprecated (since 2.12.0): the generation of BeanInfo classes is no longer supported
+class C
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/beanInfoDeprecation.flags b/test/files/neg/beanInfoDeprecation.flags
new file mode 100644
index 0000000000..c6bfaf1f64
--- /dev/null
+++ b/test/files/neg/beanInfoDeprecation.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/beanInfoDeprecation.scala b/test/files/neg/beanInfoDeprecation.scala
new file mode 100644
index 0000000000..c7e3a86202
--- /dev/null
+++ b/test/files/neg/beanInfoDeprecation.scala
@@ -0,0 +1,2 @@
+@scala.beans.BeanInfo
+class C
diff --git a/test/files/neg/case-collision.check b/test/files/neg/case-collision.check
index 22cf105a4f..7360833a7d 100644
--- a/test/files/neg/case-collision.check
+++ b/test/files/neg/case-collision.check
@@ -1,12 +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
^
+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
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
three warnings found
one error found
diff --git a/test/files/neg/case-collision.flags b/test/files/neg/case-collision.flags
index 14c1069dee..85d8eb2ba2 100644
--- a/test/files/neg/case-collision.flags
+++ b/test/files/neg/case-collision.flags
@@ -1 +1 @@
--Ybackend:GenASM -Xfatal-warnings
+-Xfatal-warnings
diff --git a/test/files/neg/case-collision2.flags b/test/files/neg/case-collision2.flags
index bea46902c9..85d8eb2ba2 100644
--- a/test/files/neg/case-collision2.flags
+++ b/test/files/neg/case-collision2.flags
@@ -1 +1 @@
--Ybackend:GenBCode -Xfatal-warnings
+-Xfatal-warnings
diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check
index 7de22fef54..a6e9176c69 100644
--- a/test/files/neg/checksensible.check
+++ b/test/files/neg/checksensible.check
@@ -97,7 +97,7 @@ checksensible.scala:84: warning: comparing values of types EqEqRefTest.this.C3 a
checksensible.scala:95: warning: comparing values of types Unit and Int using `!=' will always yield true
while ((c = in.read) != -1)
^
-warning: there were three deprecation warnings; re-run with -deprecation for details
+warning: there were three deprecation warnings (since 2.11.0); re-run with -deprecation for details
error: No warnings can be incurred under -Xfatal-warnings.
34 warnings found
one error found
diff --git a/test/files/neg/choices.check b/test/files/neg/choices.check
index df4f23461f..2449cadcd6 100644
--- a/test/files/neg/choices.check
+++ b/test/files/neg/choices.check
@@ -1,5 +1,4 @@
-error: Usage: -Yresolve-term-conflict:<strategy>
- where <strategy> choices are package, object, error (default: error)
+error: Usage: -Yresolve-term-conflict:<strategy> where <strategy> choices are package, object, error (default: error).
error: bad option: '-Yresolve-term-conflict'
error: bad options: -Yresolve-term-conflict
error: flags file may only contain compiler options, found: -Yresolve-term-conflict
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check
index fd1e2728c3..ed6f42d00c 100644
--- a/test/files/neg/classmanifests_new_deprecations.check
+++ b/test/files/neg/classmanifests_new_deprecations.check
@@ -1,25 +1,25 @@
-classmanifests_new_deprecations.scala:2: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
+classmanifests_new_deprecations.scala:2: warning: type ClassManifest in object Predef is deprecated (since 2.10.0): 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
+classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object Predef is deprecated (since 2.10.0): 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
+classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated (since 2.10.0): 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
+classmanifests_new_deprecations.scala:6: warning: type ClassManifest in package reflect is deprecated (since 2.10.0): 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
+classmanifests_new_deprecations.scala:7: warning: type ClassManifest in package reflect is deprecated (since 2.10.0): 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
+classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated (since 2.10.0): 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
+classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object Predef is deprecated (since 2.10.0): 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
+classmanifests_new_deprecations.scala:15: warning: type ClassManifest in package reflect is deprecated (since 2.10.0): use scala.reflect.ClassTag instead
type RCM[T] = scala.reflect.ClassManifest[T]
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/compile-time-only-a.check b/test/files/neg/compile-time-only-a.check
index b1ed1d24c2..a10f8b6489 100644
--- a/test/files/neg/compile-time-only-a.check
+++ b/test/files/neg/compile-time-only-a.check
@@ -13,9 +13,15 @@ compile-time-only-a.scala:36: error: C2
compile-time-only-a.scala:38: error: C3
new C3(2)
^
+compile-time-only-a.scala:39: error: C3
+ C3(2)
+ ^
compile-time-only-a.scala:41: error: C4
new C4(2)
^
+compile-time-only-a.scala:42: error: C4
+ C4(2)
+ ^
compile-time-only-a.scala:45: error: C5
2.ext
^
@@ -73,4 +79,4 @@ compile-time-only-a.scala:75: error: placebo
compile-time-only-a.scala:75: error: placebo
@placebo def x = (2: @placebo)
^
-25 errors found
+27 errors found
diff --git a/test/files/neg/constrs.check b/test/files/neg/constrs.check
index 4f4a12bc13..8a5bd97ae3 100644
--- a/test/files/neg/constrs.check
+++ b/test/files/neg/constrs.check
@@ -7,7 +7,7 @@ constrs.scala:6: error: value u is not a member of object test
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
+constrs.scala:12: error: constructor invokes itself
def this(x: Boolean) = this(x)
^
constrs.scala:16: error: type mismatch;
diff --git a/test/files/neg/delayed-init-ref.check b/test/files/neg/delayed-init-ref.check
index 90bc027969..2913b1858f 100644
--- a/test/files/neg/delayed-init-ref.check
+++ b/test/files/neg/delayed-init-ref.check
@@ -4,8 +4,7 @@ delayed-init-ref.scala:17: warning: Selecting value vall from object O, which ex
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
+delayed-init-ref.scala:28: warning: trait DelayedInit in package scala is deprecated (since 2.11.0): 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
diff --git a/test/files/neg/deprecated-target.check b/test/files/neg/deprecated-target.check
new file mode 100644
index 0000000000..307d3d25ab
--- /dev/null
+++ b/test/files/neg/deprecated-target.check
@@ -0,0 +1,4 @@
+warning: -target is deprecated: -target:jvm-1.7 is deprecated, forcing use of jvm-1.8
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/deprecated-target.flags b/test/files/neg/deprecated-target.flags
new file mode 100644
index 0000000000..458ded8123
--- /dev/null
+++ b/test/files/neg/deprecated-target.flags
@@ -0,0 +1 @@
+-target:jvm-1.7 -deprecation -Xfatal-warnings
diff --git a/test/files/neg/deprecated-target.scala b/test/files/neg/deprecated-target.scala
new file mode 100644
index 0000000000..9dccdd5e59
--- /dev/null
+++ b/test/files/neg/deprecated-target.scala
@@ -0,0 +1 @@
+class C \ No newline at end of file
diff --git a/test/files/neg/eta-expand-star-deprecation.check b/test/files/neg/eta-expand-star-deprecation.check
deleted file mode 100644
index a79f0df76c..0000000000
--- a/test/files/neg/eta-expand-star-deprecation.check
+++ /dev/null
@@ -1,4 +0,0 @@
-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/test/files/neg/eta-expand-star-deprecation.flags b/test/files/neg/eta-expand-star-deprecation.flags
deleted file mode 100644
index 5ac8b638e4..0000000000
--- a/test/files/neg/eta-expand-star-deprecation.flags
+++ /dev/null
@@ -1 +0,0 @@
--Yeta-expand-keeps-star -deprecation -Xfatal-warnings
diff --git a/test/files/neg/eta-expand-star-deprecation.scala b/test/files/neg/eta-expand-star-deprecation.scala
deleted file mode 100644
index 5749692522..0000000000
--- a/test/files/neg/eta-expand-star-deprecation.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-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/test/files/neg/eta-expand-star.check b/test/files/neg/eta-expand-star.check
index 6765d504fc..eba1721014 100644
--- a/test/files/neg/eta-expand-star.check
+++ b/test/files/neg/eta-expand-star.check
@@ -1,4 +1,4 @@
-eta-expand-star.scala:6: error: too many arguments for method apply: (v1: Seq[T])Unit in trait Function1
+eta-expand-star.scala:6: error: too many arguments (2) for method apply: (v1: Seq[T])Unit in trait Function1
g(1, 2)
- ^
+ ^
one error found
diff --git a/test/files/neg/forgot-interpolator.flags b/test/files/neg/forgot-interpolator.flags
index 7949c2afa2..b0d7bc25cb 100644
--- a/test/files/neg/forgot-interpolator.flags
+++ b/test/files/neg/forgot-interpolator.flags
@@ -1 +1 @@
--Xlint -Xfatal-warnings
+-Xlint:missing-interpolator -Xfatal-warnings
diff --git a/test/files/neg/hkgadt.check b/test/files/neg/hkgadt.check
new file mode 100644
index 0000000000..ef302a9abf
--- /dev/null
+++ b/test/files/neg/hkgadt.check
@@ -0,0 +1,31 @@
+hkgadt.scala:7: error: type mismatch;
+ found : scala.collection.immutable.Set[Int]
+ required: F[Int]
+ case Bar() => Set(1)
+ ^
+hkgadt.scala:13: error: type mismatch;
+ found : Boolean(true)
+ required: A
+ case Bar1() => true
+ ^
+hkgadt.scala:24: error: type mismatch;
+ found : scala.collection.immutable.Set[Int]
+ required: F[Int]
+ case Bar() => Set(1)
+ ^
+hkgadt.scala:25: error: type mismatch;
+ found : List[Int]
+ required: F[Int]
+ case Baz() => List(1)
+ ^
+hkgadt.scala:32: error: type mismatch;
+ found : Boolean(true)
+ required: A
+ case Bar1() => true
+ ^
+hkgadt.scala:33: error: type mismatch;
+ found : Int(1)
+ required: A
+ case Baz1() => 1
+ ^
+6 errors found
diff --git a/test/files/neg/hkgadt.scala b/test/files/neg/hkgadt.scala
new file mode 100644
index 0000000000..0107d2bdde
--- /dev/null
+++ b/test/files/neg/hkgadt.scala
@@ -0,0 +1,35 @@
+object HKGADT {
+ sealed trait Foo[F[_]]
+ final case class Bar() extends Foo[List]
+
+ def frob[F[_]](foo: Foo[F]): F[Int] =
+ foo match {
+ case Bar() => Set(1)
+ }
+
+ sealed trait Foo1[F]
+ final case class Bar1() extends Foo1[Int]
+ def frob1[A](foo: Foo1[A]): A = foo match {
+ case Bar1() => true
+ }
+}
+
+object HKGADT2 {
+ sealed trait Foo[F[_]]
+ final case class Bar() extends Foo[List]
+ final case class Baz() extends Foo[Set]
+
+ def frob[F[_]](foo: Foo[F]): F[Int] =
+ foo match {
+ case Bar() => Set(1)
+ case Baz() => List(1)
+ }
+
+ sealed trait Foo1[F]
+ final case class Bar1() extends Foo1[Int]
+ final case class Baz1() extends Foo1[Boolean]
+ def frob1[A](foo: Foo1[A]): A = foo match {
+ case Bar1() => true
+ case Baz1() => 1
+ }
+}
diff --git a/test/files/neg/implicit-ambiguous-2.check b/test/files/neg/implicit-ambiguous-2.check
new file mode 100644
index 0000000000..4a10b0dd65
--- /dev/null
+++ b/test/files/neg/implicit-ambiguous-2.check
@@ -0,0 +1,4 @@
+implicit-ambiguous-2.scala:10: error: Could not prove Int =!= Int
+ implicitly[Int =!= Int]
+ ^
+one error found
diff --git a/test/files/neg/implicit-ambiguous-2.scala b/test/files/neg/implicit-ambiguous-2.scala
new file mode 100644
index 0000000000..563c8c583f
--- /dev/null
+++ b/test/files/neg/implicit-ambiguous-2.scala
@@ -0,0 +1,11 @@
+object Test {
+ trait =!=[C, D]
+
+ implicit def neq[E, F] : E =!= F = null
+
+ implicit def neqAmbig1[G, H, J] : J =!= J = null
+ @annotation.implicitAmbiguous("Could not prove ${I} =!= ${I}")
+ implicit def neqAmbig2[I] : I =!= I = null
+
+ implicitly[Int =!= Int]
+}
diff --git a/test/files/neg/implicit-ambiguous-invalid.check b/test/files/neg/implicit-ambiguous-invalid.check
new file mode 100644
index 0000000000..68b607c4c2
--- /dev/null
+++ b/test/files/neg/implicit-ambiguous-invalid.check
@@ -0,0 +1,7 @@
+implicit-ambiguous-invalid.scala:5: warning: Invalid implicitAmbiguous message for method neqAmbig1 in object Test:
+The type parameter B referenced in the message of the @implicitAmbiguous annotation is not defined by method neqAmbig1.
+ implicit def neqAmbig1[A] : A =!= A = null
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t6375.flags b/test/files/neg/implicit-ambiguous-invalid.flags
index 85d8eb2ba2..85d8eb2ba2 100644
--- a/test/files/neg/t6375.flags
+++ b/test/files/neg/implicit-ambiguous-invalid.flags
diff --git a/test/files/neg/implicit-ambiguous-invalid.scala b/test/files/neg/implicit-ambiguous-invalid.scala
new file mode 100644
index 0000000000..f8f9da655f
--- /dev/null
+++ b/test/files/neg/implicit-ambiguous-invalid.scala
@@ -0,0 +1,6 @@
+object Test {
+ trait =!=[C, D]
+
+ @annotation.implicitAmbiguous("Could not prove ${A} =!= ${B}")
+ implicit def neqAmbig1[A] : A =!= A = null
+}
diff --git a/test/files/neg/implicit-ambiguous.check b/test/files/neg/implicit-ambiguous.check
new file mode 100644
index 0000000000..0b3cebcb6f
--- /dev/null
+++ b/test/files/neg/implicit-ambiguous.check
@@ -0,0 +1,4 @@
+implicit-ambiguous.scala:10: error: Could not prove Int =!= Int
+ implicitly[Int =!= Int]
+ ^
+one error found
diff --git a/test/files/neg/implicit-ambiguous.scala b/test/files/neg/implicit-ambiguous.scala
new file mode 100644
index 0000000000..79b1297915
--- /dev/null
+++ b/test/files/neg/implicit-ambiguous.scala
@@ -0,0 +1,11 @@
+object Test {
+ trait =!=[C, D]
+
+ implicit def neq[E, F] : E =!= F = null
+
+ @annotation.implicitAmbiguous("Could not prove ${J} =!= ${J}")
+ implicit def neqAmbig1[G, H, J] : J =!= J = null
+ implicit def neqAmbig2[I] : I =!= I = null
+
+ implicitly[Int =!= Int]
+}
diff --git a/test/files/neg/inlineIndyLambdaPrivate.check b/test/files/neg/inlineIndyLambdaPrivate.check
new file mode 100644
index 0000000000..dbd142f59e
--- /dev/null
+++ b/test/files/neg/inlineIndyLambdaPrivate.check
@@ -0,0 +1,16 @@
+Test_2.scala:2: warning: A_1::test()Ljava/lang/String; could not be inlined:
+The callee A_1::test()Ljava/lang/String; contains the instruction INVOKEDYNAMIC m()LA_1$Fun; [
+ // handle kind 0x6 : INVOKESTATIC
+ java/lang/invoke/LambdaMetafactory.metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
+ // arguments:
+ (Ljava/lang/String;)Ljava/lang/String;,
+ // handle kind 0x6 : INVOKESTATIC
+ A_1.lambda$test$0(Ljava/lang/String;)Ljava/lang/String;,
+ (Ljava/lang/String;)Ljava/lang/String;
+ ]
+that would cause an IllegalAccessError when inlined into class Test.
+ def foo = A_1.test
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/inlineIndyLambdaPrivate.flags b/test/files/neg/inlineIndyLambdaPrivate.flags
new file mode 100644
index 0000000000..b38f5b8411
--- /dev/null
+++ b/test/files/neg/inlineIndyLambdaPrivate.flags
@@ -0,0 +1 @@
+-opt:l:classpath -Yopt-inline-heuristics:everything -opt-warnings:_ -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/inlineIndyLambdaPrivate/A_1.java b/test/files/neg/inlineIndyLambdaPrivate/A_1.java
new file mode 100644
index 0000000000..a9144a9fa6
--- /dev/null
+++ b/test/files/neg/inlineIndyLambdaPrivate/A_1.java
@@ -0,0 +1,9 @@
+public class A_1 {
+ interface Fun {
+ String m(String s);
+ }
+ public static final String test() {
+ Fun f = s -> s.trim();
+ return f.m(" eh ");
+ }
+}
diff --git a/test/files/neg/inlineIndyLambdaPrivate/Test_2.scala b/test/files/neg/inlineIndyLambdaPrivate/Test_2.scala
new file mode 100644
index 0000000000..dd59c05176
--- /dev/null
+++ b/test/files/neg/inlineIndyLambdaPrivate/Test_2.scala
@@ -0,0 +1,3 @@
+class Test {
+ def foo = A_1.test
+}
diff --git a/test/files/neg/inlineMaxSize.flags b/test/files/neg/inlineMaxSize.flags
index 9c6b811622..e765b66af2 100644
--- a/test/files/neg/inlineMaxSize.flags
+++ b/test/files/neg/inlineMaxSize.flags
@@ -1 +1 @@
--Ybackend:GenBCode -Ydelambdafy:method -Yopt:l:classpath -Yopt-warnings -Xfatal-warnings \ No newline at end of file
+-Ydelambdafy:method -opt:l:classpath -opt-warnings -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/literals.check b/test/files/neg/literals.check
index 148a9346c5..79b6d47782 100644
--- a/test/files/neg/literals.check
+++ b/test/files/neg/literals.check
@@ -19,6 +19,18 @@ literals.scala:23: error: missing integer number
literals.scala:27: error: Decimal integer literals may not have a leading zero. (Octal syntax is obsolete.)
def tooManyZeros: Int = 00 // line 26: no leading zero
^
+literals.scala:40: error: floating point number too small
+ def tooTiny: Float = { 0.7e-45f } // floating point number too small
+ ^
+literals.scala:42: error: double precision floating point number too small
+ def twoTiny: Double = { 2.0e-324 } // double precision floating point number too small
+ ^
+literals.scala:44: error: floating point number too large
+ def tooHuge: Float = { 3.4028236E38f } // floating point number too large
+ ^
+literals.scala:46: error: double precision floating point number too large
+ def twoHuge: Double = { 1.7976931348623159e308 } // double precision floating point number too large
+ ^
literals.scala:14: error: identifier expected but '}' found.
def orphanDot: Int = { 9. } // line 12: ident expected
^
@@ -37,4 +49,4 @@ literals.scala:29: error: ';' expected but 'def' found.
literals.scala:33: error: identifier expected but 'def' found.
def zeroOfNineDot: Int = 09. // line 32: malformed integer, ident expected
^
-13 errors found
+17 errors found
diff --git a/test/files/neg/literals.scala b/test/files/neg/literals.scala
index 3df7f0b408..22d5d9acd1 100644
--- a/test/files/neg/literals.scala
+++ b/test/files/neg/literals.scala
@@ -1,6 +1,6 @@
/* This took me literally all day.
-*/
+ */
trait RejectedLiterals {
def missingHex: Int = { 0x } // line 4: was: not reported, taken as zero
@@ -34,3 +34,14 @@ trait Braceless {
def noHexFloat: Double = 0x1.2 // line 34: ';' expected but double literal found.
}
+
+trait MoreSadness {
+
+ def tooTiny: Float = { 0.7e-45f } // floating point number too small
+
+ def twoTiny: Double = { 2.0e-324 } // double precision floating point number too small
+
+ def tooHuge: Float = { 3.4028236E38f } // floating point number too large
+
+ def twoHuge: Double = { 1.7976931348623159e308 } // double precision floating point number too large
+}
diff --git a/test/files/neg/logImplicits.check b/test/files/neg/logImplicits.check
index 270882b71a..913b116ac3 100644
--- a/test/files/neg/logImplicits.check
+++ b/test/files/neg/logImplicits.check
@@ -1,10 +1,10 @@
-logImplicits.scala:2: applied implicit conversion from xs.type to ?{def size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps[Byte]
+logImplicits.scala:2: applied implicit conversion from xs.type to ?{def size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps.ofByte
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
+logImplicits.scala:15: inferred view from String("abc") to Int via C.this.convert: (p: String)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]
diff --git a/test/files/neg/lub-from-hell-2.check b/test/files/neg/lub-from-hell-2.check
new file mode 100644
index 0000000000..3ef935f93b
--- /dev/null
+++ b/test/files/neg/lub-from-hell-2.check
@@ -0,0 +1,7 @@
+lub-from-hell-2.scala:3: error: type arguments [Any,Iterable[Any] with Int => Any with scala.collection.generic.Subtractable[Any,Iterable[Any] with Int => Any with scala.collection.generic.Subtractable[Any,Iterable[Any] with Int => Any]{def seq: Iterable[Any] with Int => Any}]{def seq: Iterable[Any] with Int => Any{def seq: Iterable[Any] with Int => Any}}] do not conform to trait Subtractable's type parameter bounds [A,+Repr <: scala.collection.generic.Subtractable[A,Repr]]
+ def foo(a: Boolean, b: collection.mutable.Set[Any], c: collection.mutable.ListBuffer[Any]) = if (a) b else c
+ ^
+lub-from-hell-2.scala:4: error: type arguments [Any,scala.collection.mutable.Iterable[Any] with scala.collection.mutable.Cloneable[scala.collection.mutable.Iterable[Any] with scala.collection.mutable.Cloneable[scala.collection.mutable.Iterable[Any] with Cloneable with Int => Any] with Int => Any{def seq: scala.collection.mutable.Iterable[Any] with Cloneable with Int => Any}] with scala.collection.generic.Growable[Any] with Int => Any with scala.collection.generic.Shrinkable[Any] with scala.collection.generic.Subtractable[Any,Iterable[Any] with Int => Any with scala.collection.generic.Subtractable[Any,Iterable[Any] with Int => Any]{def seq: Iterable[Any] with Int => Any}] with scala.collection.script.Scriptable[Any]] do not conform to trait Subtractable's type parameter bounds [A,+Repr <: scala.collection.generic.Subtractable[A,Repr]]
+ def bar(a: Boolean, b: scala.collection.mutable.SetLike[Any,scala.collection.mutable.Set[Any]], c: scala.collection.mutable.Buffer[Any]) = if (a) b else c
+ ^
+two errors found
diff --git a/test/files/neg/lub-from-hell-2.scala b/test/files/neg/lub-from-hell-2.scala
new file mode 100644
index 0000000000..18c99dfada
--- /dev/null
+++ b/test/files/neg/lub-from-hell-2.scala
@@ -0,0 +1,13 @@
+class Test {
+ trait Tree
+ def foo(a: Boolean, b: collection.mutable.Set[Any], c: collection.mutable.ListBuffer[Any]) = if (a) b else c
+ def bar(a: Boolean, b: scala.collection.mutable.SetLike[Any,scala.collection.mutable.Set[Any]], c: scala.collection.mutable.Buffer[Any]) = if (a) b else c
+ // bar produces an ill-bounded LUB in 2.11.8. After this commit, which fixes a bug in existential+refinement lubs, foo also fails.
+}
+// This test case minimizes a case that stated to fail compile after my fixes in SI-5294.
+// `foo` used to compile for the wrong reason, `mergePrefixAndArgs` failed to transpose a
+// ragged matrix and skipped to the next level of the base type sequences to find a common type symbol.
+//
+// My changes fixed the root cause of the ragged matrix, which uncovered the latent bug.
+// For comparison, `bar` failed to compile before _and_ after my changes for the same reason:
+// f-bounded types involved in LUBs can sometimes produce an ill-bounded LUB.
diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check
index ebdc8ec7da..a4d4fc6f34 100644
--- a/test/files/neg/macro-invalidret.check
+++ b/test/files/neg/macro-invalidret.check
@@ -27,7 +27,7 @@ java.lang.NullPointerException
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
+Macros_Test_2.scala:17: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
foo6
^
two warnings found
diff --git a/test/files/neg/macro-invalidusage-badargs.check b/test/files/neg/macro-invalidusage-badargs.check
index 19ac6528d3..ee549c45cb 100644
--- a/test/files/neg/macro-invalidusage-badargs.check
+++ b/test/files/neg/macro-invalidusage-badargs.check
@@ -13,7 +13,7 @@ Macros_Test_2.scala:8: error: not enough arguments for macro method foo: (x: Int
Unspecified value parameter x.
foo()
^
-Macros_Test_2.scala:9: error: too many arguments for macro method foo: (x: Int)Int
+Macros_Test_2.scala:9: error: too many arguments (2) for macro method foo: (x: Int)Int
foo(4, 2)
- ^
+ ^
5 errors found
diff --git a/test/files/neg/maxerrs.check b/test/files/neg/maxerrs.check
new file mode 100644
index 0000000000..5eaedad487
--- /dev/null
+++ b/test/files/neg/maxerrs.check
@@ -0,0 +1,16 @@
+maxerrs.scala:22: error: type mismatch;
+ found : String("")
+ required: Int
+ def F = f("")
+ ^
+maxerrs.scala:24: error: type mismatch;
+ found : String("")
+ required: Int
+ def g = f("")
+ ^
+maxerrs.scala:26: error: type mismatch;
+ found : String("")
+ required: Int
+ def h = f("")
+ ^
+5 errors found
diff --git a/test/files/neg/maxerrs.flags b/test/files/neg/maxerrs.flags
new file mode 100644
index 0000000000..6629ef62b6
--- /dev/null
+++ b/test/files/neg/maxerrs.flags
@@ -0,0 +1 @@
+-Xmaxerrs 3 -Xfatal-warnings -deprecation
diff --git a/test/files/neg/maxerrs.scala b/test/files/neg/maxerrs.scala
new file mode 100644
index 0000000000..43b725de7a
--- /dev/null
+++ b/test/files/neg/maxerrs.scala
@@ -0,0 +1,32 @@
+
+object X {
+ @deprecated("just to annoy people", since="forever")
+ def x = 42
+
+ def f(i: Int) = i
+}
+
+trait T {
+ import X._
+
+ def a = x
+
+ def b = x
+
+ def c = x
+
+ def d = x
+
+ def e = x
+
+ def F = f("")
+
+ def g = f("")
+
+ def h = f("")
+
+ def i = f("")
+
+ def j = f("")
+}
+
diff --git a/test/files/neg/maxwarns.check b/test/files/neg/maxwarns.check
new file mode 100644
index 0000000000..f4c8d907bd
--- /dev/null
+++ b/test/files/neg/maxwarns.check
@@ -0,0 +1,12 @@
+maxwarns.scala:12: warning: method x in object X is deprecated (since forever): just to annoy people
+ def a = x
+ ^
+maxwarns.scala:14: warning: method x in object X is deprecated (since forever): just to annoy people
+ def b = x
+ ^
+maxwarns.scala:16: warning: method x in object X is deprecated (since forever): just to annoy people
+ def c = x
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+5 warnings found
+one error found
diff --git a/test/files/neg/maxwarns.flags b/test/files/neg/maxwarns.flags
new file mode 100644
index 0000000000..d5d6e533e9
--- /dev/null
+++ b/test/files/neg/maxwarns.flags
@@ -0,0 +1 @@
+-Xmaxwarns 3 -Xfatal-warnings -deprecation
diff --git a/test/files/neg/maxwarns.scala b/test/files/neg/maxwarns.scala
new file mode 100644
index 0000000000..decb8a7866
--- /dev/null
+++ b/test/files/neg/maxwarns.scala
@@ -0,0 +1,32 @@
+
+object X {
+ @deprecated("just to annoy people", since="forever")
+ def x = 42
+
+ def f(i: String) = i
+}
+
+trait T {
+ import X._
+
+ def a = x
+
+ def b = x
+
+ def c = x
+
+ def d = x
+
+ def e = x
+
+ def F = f("")
+
+ def g = f("")
+
+ def h = f("")
+
+ def i = f("")
+
+ def j = f("")
+}
+
diff --git a/test/files/neg/missing-arg-list.check b/test/files/neg/missing-arg-list.check
index 5a011c36f2..229baac177 100644
--- a/test/files/neg/missing-arg-list.check
+++ b/test/files/neg/missing-arg-list.check
@@ -18,4 +18,9 @@ Unapplied methods are only converted to functions when a function type is expect
You can make this conversion explicit by writing `h _` or `h(_,_,_)(_)` instead of `h`.
val z = h
^
-four errors found
+missing-arg-list.scala:15: error: missing argument list for method + in trait T
+Unapplied methods are only converted to functions when a function type is expected.
+You can make this conversion explicit by writing `+ _` or `+(_)` instead of `+`.
+ val p = +
+ ^
+5 errors found
diff --git a/test/files/neg/missing-arg-list.scala b/test/files/neg/missing-arg-list.scala
index c422dd32fe..44b83e429d 100644
--- a/test/files/neg/missing-arg-list.scala
+++ b/test/files/neg/missing-arg-list.scala
@@ -10,4 +10,7 @@ trait T {
val x = f
val y = g
val z = h
+
+ def +(i: Int) = i + 42
+ val p = +
}
diff --git a/test/files/neg/multi-array.check b/test/files/neg/multi-array.check
index 511caa126f..06ffdc9fbc 100644
--- a/test/files/neg/multi-array.check
+++ b/test/files/neg/multi-array.check
@@ -1,4 +1,4 @@
-multi-array.scala:7: error: too many arguments for constructor Array: (_length: Int)Array[T]
+multi-array.scala:7: error: too many arguments (2) for constructor Array: (_length: Int)Array[T]
val a: Array[Int] = new Array(10, 10)
- ^
+ ^
one error found
diff --git a/test/files/neg/names-defaults-neg-warn.check b/test/files/neg/names-defaults-neg-warn.check
index 0f4edef84e..3ff7d67cc3 100644
--- a/test/files/neg/names-defaults-neg-warn.check
+++ b/test/files/neg/names-defaults-neg-warn.check
@@ -1,7 +1,7 @@
-names-defaults-neg-warn.scala:11: warning: the parameter name s has been deprecated. Use x instead.
+names-defaults-neg-warn.scala:11: warning: the parameter name s is 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.
+names-defaults-neg-warn.scala:12: warning: the parameter name x is deprecated: use s instead
deprNam2.g(x = "dlkjf")
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check
index a43bf66811..af164d90ea 100644
--- a/test/files/neg/names-defaults-neg.check
+++ b/test/files/neg/names-defaults-neg.check
@@ -1,7 +1,3 @@
-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
@@ -81,6 +77,10 @@ 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")) // ambiguous reference
^
+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:69: error: wrong number of arguments for pattern A1(x: Int,y: String)
A1() match { case A1(_) => () }
^
@@ -112,74 +112,80 @@ names-defaults-neg.scala:90: error: deprecated parameter name x has to be distin
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.
+names-defaults-neg.scala:93: warning: the parameter name y is 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
+names-defaults-neg.scala:96: warning: naming parameter deprNam4Arg is deprecated.
+ deprNam4(deprNam4Arg = null)
+ ^
+names-defaults-neg.scala:98: warning: naming parameter deprNam5Arg is deprecated.
+ deprNam5(deprNam5Arg = null)
+ ^
+names-defaults-neg.scala:102: 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.
+names-defaults-neg.scala:135: 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)
+names-defaults-neg.scala:138: error: missing parameter type for expanded function ((x$1: <error>) => a = x$1)
val taf2: Int => Unit = testAnnFun(a = _, b = get("+"))
^
-names-defaults-neg.scala:134: error: not found: value a
+names-defaults-neg.scala:138: error: not found: value a
val taf2: Int => Unit = testAnnFun(a = _, b = get("+"))
^
-names-defaults-neg.scala:134: error: not found: value get
+names-defaults-neg.scala:138: 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
+names-defaults-neg.scala:139: 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)))
+names-defaults-neg.scala:140: error: missing parameter type for expanded function ((x$3: <error>) => 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)
+names-defaults-neg.scala:140: error: missing parameter type for expanded function ((x$4: <error>) => b = x$4)
val taf4: (Int, String) => Unit = testAnnFun(_, b = _)
^
-names-defaults-neg.scala:136: error: not found: value b
+names-defaults-neg.scala:140: 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.
+names-defaults-neg.scala:148: 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.
+names-defaults-neg.scala:151: 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: failed to determine if 'x = ...' is a named argument or an assignment expression.
+names-defaults-neg.scala:151: warning: failed to determine if 'x = ...' is a named argument or an assignment expression.
an explicit type is required for the definition mentioned in the error message above.
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.
+names-defaults-neg.scala:154: 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: failed to determine if 'x = ...' is a named argument or an assignment expression.
+names-defaults-neg.scala:154: warning: failed to determine if 'x = ...' is a named argument or an assignment expression.
an explicit type is required for the definition mentioned in the error message above.
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.
+names-defaults-neg.scala:168: 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.
+names-defaults-neg.scala:171: 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.
+names-defaults-neg.scala:174: 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.
+names-defaults-neg.scala:181: 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: failed to determine if 'x = ...' is a named argument or an assignment expression.
+names-defaults-neg.scala:181: warning: failed to determine if 'x = ...' is a named argument or an assignment expression.
an explicit type is required for the definition mentioned in the error message above.
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.
+names-defaults-neg.scala:184: 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
+6 warnings found
46 errors found
diff --git a/test/files/neg/names-defaults-neg.scala b/test/files/neg/names-defaults-neg.scala
index a97b590bf2..b326d3b5bd 100644
--- a/test/files/neg/names-defaults-neg.scala
+++ b/test/files/neg/names-defaults-neg.scala
@@ -92,6 +92,10 @@ object Test extends App {
def deprNam3(@deprecatedName('x) a: Int, @deprecatedName('y) b: Int) = a + b
deprNam3(y = 10, b = 2)
+ def deprNam4(@deprecatedName('deprNam4Arg) deprNam4Arg: String) = 0
+ deprNam4(deprNam4Arg = null)
+ def deprNam5(@deprecatedName deprNam5Arg: String) = 0
+ deprNam5(deprNam5Arg = null)
// t3818
def f3818(x: Int = 1, y: Int, z: Int = 1) = 0
diff --git a/test/files/neg/nested-fn-print.check b/test/files/neg/nested-fn-print.check
index ea278554d4..feeac0733f 100644
--- a/test/files/neg/nested-fn-print.check
+++ b/test/files/neg/nested-fn-print.check
@@ -1,4 +1,4 @@
-nested-fn-print.scala:4: error: only classes can have declared but undefined members
+nested-fn-print.scala:4: error: only traits and abstract classes can have declared but undefined members
(Note that variables need to be initialized to be defined)
var x3: Int => Double
^
diff --git a/test/files/neg/no-predef.check b/test/files/neg/no-predef.check
index a63d8c5ba5..f5c2e82fe1 100644
--- a/test/files/neg/no-predef.check
+++ b/test/files/neg/no-predef.check
@@ -1,11 +1,11 @@
no-predef.scala:2: error: type mismatch;
- found : scala.Long(5L)
- required: java.lang.Long
+ found : Long (in scala)
+ required: Long (in java.lang)
def f1 = 5L: java.lang.Long
^
no-predef.scala:3: error: type mismatch;
- found : java.lang.Long
- required: scala.Long
+ found : Long (in java.lang)
+ required: Long (in scala)
def f2 = new java.lang.Long(5) : Long
^
no-predef.scala:4: error: value map is not a member of String
diff --git a/test/files/neg/optimiseDeprecated.check b/test/files/neg/optimiseDeprecated.check
new file mode 100644
index 0000000000..16ab3bbf1a
--- /dev/null
+++ b/test/files/neg/optimiseDeprecated.check
@@ -0,0 +1,4 @@
+warning: -optimise is deprecated: In 2.12, -optimise enables -opt:l:classpath. Check -opt:help for using the Scala 2.12 optimizer.
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/optimiseDeprecated.flags b/test/files/neg/optimiseDeprecated.flags
new file mode 100644
index 0000000000..42fca6d836
--- /dev/null
+++ b/test/files/neg/optimiseDeprecated.flags
@@ -0,0 +1 @@
+-optimise -deprecation -Xfatal-warnings
diff --git a/test/files/neg/optimiseDeprecated.scala b/test/files/neg/optimiseDeprecated.scala
new file mode 100644
index 0000000000..826a1a5bc2
--- /dev/null
+++ b/test/files/neg/optimiseDeprecated.scala
@@ -0,0 +1 @@
+class C
diff --git a/test/files/neg/outer-ref-checks.check b/test/files/neg/outer-ref-checks.check
new file mode 100644
index 0000000000..bba7118d79
--- /dev/null
+++ b/test/files/neg/outer-ref-checks.check
@@ -0,0 +1,24 @@
+outer-ref-checks.scala:5: warning: The outer reference in this type test cannot be checked at run time.
+ final case class Inner(val s: String) // unchecked warning
+ ^
+outer-ref-checks.scala:8: warning: The outer reference in this type test cannot be checked at run time.
+ case Inner(s) => // unchecked warning
+ ^
+outer-ref-checks.scala:18: warning: The outer reference in this type test cannot be checked at run time.
+ case Inner(s) => // unchecked warning
+ ^
+outer-ref-checks.scala:19: warning: The outer reference in this type test cannot be checked at run time.
+ case O.Inner(s) => // unchecked warning
+ ^
+outer-ref-checks.scala:41: warning: The outer reference in this type test cannot be checked at run time.
+ case Inner(s) => // unchecked warning
+ ^
+outer-ref-checks.scala:46: warning: The outer reference in this type test cannot be checked at run time.
+ case _: Inner => // unchecked warning
+ ^
+outer-ref-checks.scala:56: warning: The outer reference in this type test cannot be checked at run time.
+ case _: (Inner @uncheckedVariance) => // unchecked warning
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+7 warnings found
+one error found
diff --git a/test/files/neg/outer-ref-checks.flags b/test/files/neg/outer-ref-checks.flags
new file mode 100644
index 0000000000..464cc20ea6
--- /dev/null
+++ b/test/files/neg/outer-ref-checks.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -unchecked \ No newline at end of file
diff --git a/test/files/neg/outer-ref-checks.scala b/test/files/neg/outer-ref-checks.scala
new file mode 100644
index 0000000000..35983fe92b
--- /dev/null
+++ b/test/files/neg/outer-ref-checks.scala
@@ -0,0 +1,106 @@
+import scala.annotation.unchecked.uncheckedVariance
+
+class Outer {
+ // A final class gets no outer ref, so we expect to see warnings where an outer ref check should be performed
+ final case class Inner(val s: String) // unchecked warning
+
+ def belongs(a: Any): Unit = a match {
+ case Inner(s) => // unchecked warning
+ case _ =>
+ }
+
+ def belongsStaticSameOuter(a: Inner): Unit = a match {
+ case Inner(s) => // no need for outer check
+ // match is exhaustive, no default case needed
+ }
+
+ def belongsOtherOuter(a: Outer#Inner): Unit = a match {
+ case Inner(s) => // unchecked warning
+ case O.Inner(s) => // unchecked warning
+ case _ =>
+ }
+}
+
+object O extends Outer {
+ def belongsStaticSameOuter2(a: Inner): Unit = a match {
+ case Inner(s) => // no need for outer check
+ // match is exhaustive, no default case needed
+ }
+
+ def belongsStaticSameOuter3(a: Inner): Unit = a match {
+ case _: Inner => // no need for outer check
+ // match is exhaustive, no default case needed
+ }
+
+ def belongsStaticSameOuter4(a: Inner): Unit = a match {
+ case _: (Inner @uncheckedVariance) => // no need for outer check
+ // match is exhaustive, no default case needed
+ }
+
+ def belongsOtherOuter2(a: Outer#Inner): Unit = a match {
+ case Inner(s) => // unchecked warning
+ case _ =>
+ }
+
+ def belongsOtherOuter3(a: Outer#Inner): Unit = a match {
+ case _: Inner => // unchecked warning
+ case _ =>
+ }
+
+ def belongsOtherOuter4(a: Outer#Inner): Unit = a match {
+ case _: (Inner @unchecked) => // warning supressed
+ case _ =>
+ }
+
+ def belongsOtherOuter5(a: Outer#Inner): Unit = a match {
+ case _: (Inner @uncheckedVariance) => // unchecked warning
+ case _ =>
+ }
+
+ def nested: Unit = {
+ final case class I(s: String)
+
+ def check1(a: Any): Unit = a match {
+ case I(s) => // no need for outer check
+ case _ =>
+ }
+
+ def check2(a: I): Unit = a match {
+ case I(s) => // no need for outer check
+ // match is exhaustive, no default case needed
+ }
+ }
+}
+
+class O2 {
+ def nested: Unit = {
+ final case class I(s: String)
+
+ def check1(a: Any): Unit = a match {
+ case I(s) => // no need for outer check (is this correct?)
+ case _ =>
+ }
+
+ def check2(a: I): Unit = a match {
+ case I(s) => // no need for outer check (is this correct?)
+ // match is exhaustive, no default case needed
+ }
+ }
+}
+
+package p {
+ object T {
+ case class C(x: Int)
+ }
+}
+
+object U {
+ val T = p.T
+}
+
+class Test {
+ def m(a: Any) = a match {
+ case U.T.C(1) => 1 // used to warn
+ case _ => 1
+ }
+}
diff --git a/test/files/neg/overloaded-implicit.flags b/test/files/neg/overloaded-implicit.flags
index 9c1e74e4ef..e04a4228ba 100644
--- a/test/files/neg/overloaded-implicit.flags
+++ b/test/files/neg/overloaded-implicit.flags
@@ -1 +1 @@
--Xlint -Xfatal-warnings -Xdev
+-Xlint:poly-implicit-overload -Xfatal-warnings -Xdev
diff --git a/test/files/neg/overloaded-unapply.check b/test/files/neg/overloaded-unapply.check
index 68a826bac2..3951166de5 100644
--- a/test/files/neg/overloaded-unapply.check
+++ b/test/files/neg/overloaded-unapply.check
@@ -7,8 +7,8 @@ match argument types (List[a])
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'
+overloaded-unapply.scala:12: error: method unapply is defined twice;
+ the conflicting method unapply was defined at line 7:7
def unapply[a](xs: List[a]): Option[Null] = xs match {
^
three errors found
diff --git a/test/files/neg/override-object-no.check b/test/files/neg/override-object-no.check
index 9cfda80fc3..972a719b3b 100644
--- a/test/files/neg/override-object-no.check
+++ b/test/files/neg/override-object-no.check
@@ -20,4 +20,12 @@ an overriding object must conform to the overridden object's class bound;
required: case2.Bar[Traversable[String]]
override object A extends Bar[List[String]] // err
^
-four errors found
+override-object-no.scala:52: error: overriding method x in trait A of type => SI9574.Foo.type;
+ method x has incompatible type
+ trait B extends A { def x: Bar.type } // should not compile (SI-9574)
+ ^
+override-object-no.scala:53: error: overriding method x in trait A of type => SI9574.Foo.type;
+ object x has incompatible type
+ trait C extends A { override object x }
+ ^
+6 errors found
diff --git a/test/files/neg/override-object-no.scala b/test/files/neg/override-object-no.scala
index 745cdb2332..517408886d 100644
--- a/test/files/neg/override-object-no.scala
+++ b/test/files/neg/override-object-no.scala
@@ -43,3 +43,14 @@ package case2 {
override object A extends Bar[List[String]] // err
}
}
+
+// Both overridden and overriding members must be objects, not vals with a module type
+object SI9574 {
+ object Foo
+ object Bar
+ trait A { def x: Foo.type }
+ trait B extends A { def x: Bar.type } // should not compile (SI-9574)
+ trait C extends A { override object x }
+ trait D { object x; def y = x }
+ trait E extends D { override val x: super.x.type = y } // OK but doesn't need object subtyping exception
+}
diff --git a/test/files/neg/partestInvalidFlag.check b/test/files/neg/partestInvalidFlag.check
index 812191dc22..7a54e3aa43 100644
--- a/test/files/neg/partestInvalidFlag.check
+++ b/test/files/neg/partestInvalidFlag.check
@@ -1,4 +1,4 @@
error: bad option: '-badCompilerFlag'
-error: bad options: -badCompilerFlag notAFlag -Yopt:badChoice
-error: flags file may only contain compiler options, found: -badCompilerFlag notAFlag -Yopt:badChoice
+error: bad options: -badCompilerFlag notAFlag -opt:badChoice
+error: flags file may only contain compiler options, found: -badCompilerFlag notAFlag -opt:badChoice
three errors found
diff --git a/test/files/neg/partestInvalidFlag.flags b/test/files/neg/partestInvalidFlag.flags
index 68884532b9..d45fd31809 100644
--- a/test/files/neg/partestInvalidFlag.flags
+++ b/test/files/neg/partestInvalidFlag.flags
@@ -1 +1 @@
--badCompilerFlag notAFlag -Yopt:badChoice
+-badCompilerFlag notAFlag -opt:badChoice
diff --git a/test/files/neg/protected-constructors.check b/test/files/neg/protected-constructors.check
index f44d7db9b9..4f076ec993 100644
--- a/test/files/neg/protected-constructors.check
+++ b/test/files/neg/protected-constructors.check
@@ -1,6 +1,15 @@
-protected-constructors.scala:17: error: too many arguments for constructor Foo1: ()dingus.Foo1
+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")
+ ^
+protected-constructors.scala:15: error: no arguments allowed for nullary constructor Object: ()Object
+ class Bar3 extends Ding.Foo3("abc")
+ ^
+protected-constructors.scala:17: error: no arguments allowed for nullary 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
@@ -13,10 +22,4 @@ protected-constructors.scala:19: error: class Foo3 in object Ding cannot be acce
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
+5 errors found
diff --git a/test/files/neg/quasiquotes-syntax-error-position.check b/test/files/neg/quasiquotes-syntax-error-position.check
index 9fd6ce0417..b12a7d13d6 100644
--- a/test/files/neg/quasiquotes-syntax-error-position.check
+++ b/test/files/neg/quasiquotes-syntax-error-position.check
@@ -16,8 +16,7 @@ quasiquotes-syntax-error-position.scala:9: error: '{' expected but end of quote
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.
+quasiquotes-syntax-error-position.scala:11: error: case classes must have a parameter list; try 'case class A()' or 'case object A'
q"case class A"
^
quasiquotes-syntax-error-position.scala:12: error: identifier expected but ']' found.
diff --git a/test/files/neg/sabin2.check b/test/files/neg/sabin2.check
index 8a09361069..cd6fde4608 100644
--- a/test/files/neg/sabin2.check
+++ b/test/files/neg/sabin2.check
@@ -1,6 +1,6 @@
sabin2.scala:22: error: type mismatch;
found : Test.Base#T
- required: _7.T where val _7: Test.Base
+ required: _1.T where val _1: Test.Base
a.set(b.get()) // Error
^
one error found
diff --git a/test/files/neg/saferJavaConversions.scala b/test/files/neg/saferJavaConversions.scala
index f0611204e6..b70a918404 100644
--- a/test/files/neg/saferJavaConversions.scala
+++ b/test/files/neg/saferJavaConversions.scala
@@ -3,17 +3,17 @@ case class Foo(s: String)
object Test {
def f1 = {
- import scala.collection.JavaConversions._
+ import scala.collection.convert.ImplicitConversions._
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._
+ import scala.collection.convert.ImplicitConversionsToScala._
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._
+ import scala.collection.convert.ImplicitConversionsToJava._
val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b")
val v = map.get("a")
}
diff --git a/test/files/neg/sammy_disabled.check b/test/files/neg/sammy_disabled.check
new file mode 100644
index 0000000000..66db9dd5f2
--- /dev/null
+++ b/test/files/neg/sammy_disabled.check
@@ -0,0 +1,4 @@
+sammy_disabled.scala:3: error: missing parameter type
+class C { val f: F = x => "a" }
+ ^
+one error found
diff --git a/test/files/neg/sammy_disabled.flags b/test/files/neg/sammy_disabled.flags
new file mode 100644
index 0000000000..cf42e9f940
--- /dev/null
+++ b/test/files/neg/sammy_disabled.flags
@@ -0,0 +1 @@
+-Xsource:2.11
diff --git a/test/files/neg/sammy_disabled.scala b/test/files/neg/sammy_disabled.scala
new file mode 100644
index 0000000000..12000a3e12
--- /dev/null
+++ b/test/files/neg/sammy_disabled.scala
@@ -0,0 +1,3 @@
+trait F { def apply(x: Int): String }
+
+class C { val f: F = x => "a" }
diff --git a/test/files/neg/sammy_error.check b/test/files/neg/sammy_error.check
new file mode 100644
index 0000000000..f14ac7e3a2
--- /dev/null
+++ b/test/files/neg/sammy_error.check
@@ -0,0 +1,4 @@
+sammy_error.scala:6: error: missing parameter type
+ foo(x => x) // should result in only one error (the second one stemmed from adapting to SAM when the tree was erroneous)
+ ^
+one error found
diff --git a/test/files/neg/sammy_error.scala b/test/files/neg/sammy_error.scala
new file mode 100644
index 0000000000..dbddebf325
--- /dev/null
+++ b/test/files/neg/sammy_error.scala
@@ -0,0 +1,7 @@
+trait F1[A, B] { def apply(a: A): B }
+
+class Test {
+ def foo[A](f1: F1[A, A]) = f1
+
+ foo(x => x) // should result in only one error (the second one stemmed from adapting to SAM when the tree was erroneous)
+}
diff --git a/test/files/neg/sammy_error_exist_no_crash.check b/test/files/neg/sammy_error_exist_no_crash.check
index a0d2237ce0..944b6471fd 100644
--- a/test/files/neg/sammy_error_exist_no_crash.check
+++ b/test/files/neg/sammy_error_exist_no_crash.check
@@ -1,6 +1,4 @@
-sammy_error_exist_no_crash.scala:5: error: Could not derive subclass of F[? >: String]
- (with SAM `def method apply(s: String)Int`)
- based on: ((x$1: String) => x$1.<parseInt: error>).
+sammy_error_exist_no_crash.scala:5: error: value parseInt is not a member of String
bar(_.parseInt)
^
one error found
diff --git a/test/files/neg/sammy_error_exist_no_crash.flags b/test/files/neg/sammy_error_exist_no_crash.flags
deleted file mode 100644
index e1b37447c9..0000000000
--- a/test/files/neg/sammy_error_exist_no_crash.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xexperimental \ No newline at end of file
diff --git a/test/files/neg/sammy_error_exist_no_crash.scala b/test/files/neg/sammy_error_exist_no_crash.scala
index da7e47206f..667b4db763 100644
--- a/test/files/neg/sammy_error_exist_no_crash.scala
+++ b/test/files/neg/sammy_error_exist_no_crash.scala
@@ -1,6 +1,6 @@
-abstract class F[T] { def apply(s: T): Int }
+trait F[T] { def apply(s: T): Int }
object NeedsNiceError {
def bar(x: F[_ >: String]) = ???
bar(_.parseInt)
-} \ No newline at end of file
+}
diff --git a/test/files/neg/sammy_expected.check b/test/files/neg/sammy_expected.check
new file mode 100644
index 0000000000..3b76aabdd2
--- /dev/null
+++ b/test/files/neg/sammy_expected.check
@@ -0,0 +1,6 @@
+sammy_expected.scala:4: error: type mismatch;
+ found : String => Int
+ required: F[Object,Int]
+ def wrong: F[Object, Int] = (x: String) => 1
+ ^
+one error found
diff --git a/test/files/neg/sammy_expected.scala b/test/files/neg/sammy_expected.scala
new file mode 100644
index 0000000000..8fc1f66ff7
--- /dev/null
+++ b/test/files/neg/sammy_expected.scala
@@ -0,0 +1,5 @@
+trait F[A, B] { def apply(x: A): B }
+
+class MustMeetExpected {
+ def wrong: F[Object, Int] = (x: String) => 1
+} \ No newline at end of file
diff --git a/test/files/neg/sammy_overload.check b/test/files/neg/sammy_overload.check
new file mode 100644
index 0000000000..87b198f4f0
--- /dev/null
+++ b/test/files/neg/sammy_overload.check
@@ -0,0 +1,7 @@
+sammy_overload.scala:14: error: overloaded method value m with alternatives:
+ (x: ToString)Int <and>
+ (x: Int => String)Int
+ cannot be applied to (Int => Int)
+ O.m(x => x) // error expected: m cannot be applied to Int => Int
+ ^
+one error found
diff --git a/test/files/neg/sammy_overload.scala b/test/files/neg/sammy_overload.scala
new file mode 100644
index 0000000000..548e9d2d2e
--- /dev/null
+++ b/test/files/neg/sammy_overload.scala
@@ -0,0 +1,15 @@
+trait ToString { def convert(x: Int): String }
+
+class ExplicitSamType {
+ object O {
+ def m(x: Int => String): Int = 0 // (1)
+ def m(x: ToString): Int = 1 // (2)
+ }
+
+ O.m((x: Int) => x.toString) // ok, function type takes precedence, because (1) is more specific than (2),
+ // because (1) is as specific as (2): (2) can be applied to a value of type Int => String (well, assuming it's a function literal)
+ // but (2) is not as specific as (1): (1) cannot be applied to a value of type ToString
+
+ O.m(_.toString) // ok: overloading resolution pushes through `Int` as the argument type, so this type checks
+ O.m(x => x) // error expected: m cannot be applied to Int => Int
+}
diff --git a/test/files/neg/sammy_restrictions.check b/test/files/neg/sammy_restrictions.check
index 8cc49f9aa9..0225c61ac1 100644
--- a/test/files/neg/sammy_restrictions.check
+++ b/test/files/neg/sammy_restrictions.check
@@ -1,49 +1,62 @@
-sammy_restrictions.scala:31: error: type mismatch;
+sammy_restrictions.scala:38: error: type mismatch;
found : () => Int
required: NoAbstract
(() => 0) : NoAbstract
^
-sammy_restrictions.scala:32: error: type mismatch;
+sammy_restrictions.scala:39: 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;
+sammy_restrictions.scala:40: 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;
+sammy_restrictions.scala:41: error: type mismatch;
found : Int => Int
required: MultipleConstructorLists
((x: Int) => 0): MultipleConstructorLists
^
-sammy_restrictions.scala:39: error: type mismatch;
+sammy_restrictions.scala:42: error: type mismatch;
+ found : Int => Int
+ required: OneEmptySecondaryConstructor
+ ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call.
+ ^
+sammy_restrictions.scala:43: error: type mismatch;
found : Int => Int
required: MultipleMethodLists
((x: Int) => 0): MultipleMethodLists
^
-sammy_restrictions.scala:40: error: type mismatch;
+sammy_restrictions.scala:44: error: type mismatch;
found : Int => Int
required: ImplicitConstructorParam
((x: Int) => 0): ImplicitConstructorParam
^
-sammy_restrictions.scala:41: error: type mismatch;
+sammy_restrictions.scala:45: error: type mismatch;
found : Int => Int
required: ImplicitMethodParam
((x: Int) => 0): ImplicitMethodParam
^
-sammy_restrictions.scala:44: error: type mismatch;
+sammy_restrictions.scala:46: error: type mismatch;
found : Int => Int
required: PolyMethod
((x: Int) => 0): PolyMethod
^
-10 errors found
+sammy_restrictions.scala:47: error: type mismatch;
+ found : Int => Int
+ required: SelfTp
+ ((x: Int) => 0): SelfTp
+ ^
+sammy_restrictions.scala:48: error: type mismatch;
+ found : Int => Int
+ required: T1 with U1
+ ((x: Int) => 0): T1 with U1
+ ^
+sammy_restrictions.scala:49: error: type mismatch;
+ found : Int => Int
+ required: Test.NonClassTypeRefinement
+ (which expands to) DerivedOneAbstract with OneAbstract
+ ((x: Int) => 0): NonClassTypeRefinement
+ ^
+12 errors found
diff --git a/test/files/neg/sammy_restrictions.flags b/test/files/neg/sammy_restrictions.flags
deleted file mode 100644
index 48fd867160..0000000000
--- a/test/files/neg/sammy_restrictions.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xexperimental
diff --git a/test/files/neg/sammy_restrictions.scala b/test/files/neg/sammy_restrictions.scala
index d003cfaf36..dee4f1f247 100644
--- a/test/files/neg/sammy_restrictions.scala
+++ b/test/files/neg/sammy_restrictions.scala
@@ -24,22 +24,34 @@ abstract class PolyMethod { def ap[T](a: T): T }
abstract class OneAbstract { def ap(a: Int): Any }
abstract class DerivedOneAbstract extends OneAbstract
+abstract class SelfTp { self: NoAbstract => def ap(a: Int): Any }
+abstract class SelfVar { self => def ap(a: Int): Any }
+
+trait T1 { def t(a: Int): Int }; trait U1
+
object Test {
implicit val s: String = ""
- type NonClassType = DerivedOneAbstract with OneAbstract
+ type NonClassTypeRefinement = DerivedOneAbstract with OneAbstract
+ type NonClassType = DerivedOneAbstract
+ // errors:
(() => 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): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call.
((x: Int) => 0): MultipleMethodLists
((x: Int) => 0): ImplicitConstructorParam
((x: Int) => 0): ImplicitMethodParam
-
- ((x: Int) => 0): PolyClass[Int] // okay
((x: Int) => 0): PolyMethod
+ ((x: Int) => 0): SelfTp
+ ((x: Int) => 0): T1 with U1
+ ((x: Int) => 0): NonClassTypeRefinement
+
+ // allowed:
+ ((x: Int) => 0): OneEmptyConstructor
+ ((x: Int) => 0): DerivedOneAbstract
+ ((x: Int) => 0): NonClassType // we also allow type aliases in instantiation expressions, if they resolve to a class type
+ ((x: Int) => 0): PolyClass[Int]
+ ((x: Int) => 0): SelfVar
}
diff --git a/test/files/neg/sammy_wrong_arity.flags b/test/files/neg/sammy_wrong_arity.flags
deleted file mode 100644
index 48fd867160..0000000000
--- a/test/files/neg/sammy_wrong_arity.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xexperimental
diff --git a/test/files/neg/scopes.check b/test/files/neg/scopes.check
index f8e8c3758a..2db9678185 100644
--- a/test/files/neg/scopes.check
+++ b/test/files/neg/scopes.check
@@ -7,7 +7,7 @@ scopes.scala:5: error: x is already defined as value x
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:6: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
{
^
scopes.scala:11: error: x is already defined as value x
diff --git a/test/files/neg/sd128.check b/test/files/neg/sd128.check
new file mode 100644
index 0000000000..8f6fcb1213
--- /dev/null
+++ b/test/files/neg/sd128.check
@@ -0,0 +1,17 @@
+Test.scala:4: error: class C1 inherits conflicting members:
+ method f in trait A of type ()Int and
+ method f in trait T of type => Int
+(Note: this can be resolved by declaring an override in class C1.)
+class C1 extends A with T // error
+ ^
+Test.scala:5: error: class C2 inherits conflicting members:
+ method f in trait T of type => Int and
+ method f in trait A of type ()Int
+(Note: this can be resolved by declaring an override in class C2.)
+class C2 extends T with A // error
+ ^
+Test.scala:14: error: overriding method f in trait A of type ()Int;
+ method f needs `override' modifier
+ def f() = 9999 // need override modifier
+ ^
+three errors found
diff --git a/test/files/neg/sd128/A.java b/test/files/neg/sd128/A.java
new file mode 100644
index 0000000000..6774deba2e
--- /dev/null
+++ b/test/files/neg/sd128/A.java
@@ -0,0 +1,3 @@
+interface A {
+ default int f() { return -10; }
+}
diff --git a/test/files/neg/sd128/Test.scala b/test/files/neg/sd128/Test.scala
new file mode 100644
index 0000000000..66ca3d0940
--- /dev/null
+++ b/test/files/neg/sd128/Test.scala
@@ -0,0 +1,19 @@
+trait T {
+ def f = 99
+}
+class C1 extends A with T // error
+class C2 extends T with A // error
+
+trait U extends A {
+ override def f = 999
+}
+class D1 extends A with U // OK
+class D2 extends U with A // OK
+
+class E1 extends A {
+ def f() = 9999 // need override modifier
+}
+
+class E2 extends A {
+ override def f() = 9999 // OK
+}
diff --git a/test/files/neg/sealed-final-neg.check b/test/files/neg/sealed-final-neg.check
index 500d23f49a..5e47c69ed8 100644
--- a/test/files/neg/sealed-final-neg.check
+++ b/test/files/neg/sealed-final-neg.check
@@ -1,4 +1,11 @@
-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."
-^
+sealed-final-neg.scala:17: warning: neg1/Foo::bar(I)I is annotated @inline but could not be inlined:
+The method is not final and may be overridden.
+ def f = Foo.mkFoo() bar 10
+ ^
+sealed-final-neg.scala:37: warning: neg2/Foo::bar(I)I is annotated @inline but could not be inlined:
+The method is not final and may be overridden.
+ def f = Foo.mkFoo() bar 10
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
one error found
diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags
index cfabf7a5b4..f2f36c1771 100644
--- a/test/files/neg/sealed-final-neg.flags
+++ b/test/files/neg/sealed-final-neg.flags
@@ -1 +1 @@
--Xfatal-warnings -Yinline-warnings -optimise \ No newline at end of file
+-Xfatal-warnings -opt:l:project -opt-warnings \ No newline at end of file
diff --git a/test/files/neg/sealed-final-neg.scala b/test/files/neg/sealed-final-neg.scala
index bc25330e13..ec3b199819 100644
--- a/test/files/neg/sealed-final-neg.scala
+++ b/test/files/neg/sealed-final-neg.scala
@@ -37,5 +37,3 @@ package neg2 {
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/test/files/neg/specification-scopes.check b/test/files/neg/specification-scopes.check
index ab986135e5..49cdbf9232 100644
--- a/test/files/neg/specification-scopes.check
+++ b/test/files/neg/specification-scopes.check
@@ -1,12 +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;
+P_2.scala:15: error: reference to x is ambiguous;
+it is both defined in value <local Y> and imported subsequently by
+import q.X._
+ println(s"L15: $x") // reference to `x' is ambiguous here
+ ^
+P_2.scala:21: error: reference to y is ambiguous;
it is imported twice in the same scope by
-import P.X._
+import p.X._
and import X.y
- println("L19: "+y) // reference to 'y' is ambiguous here
- ^
+ println(s"L21: $y") // reference to `y' is ambiguous here
+ ^
two errors found
diff --git a/test/files/neg/specification-scopes/P_1.scala b/test/files/neg/specification-scopes/P_1.scala
index 3b11f1167d..50c306fd67 100644
--- a/test/files/neg/specification-scopes/P_1.scala
+++ b/test/files/neg/specification-scopes/P_1.scala
@@ -1,6 +1,7 @@
-package P {
- object X { val x = 1; val y = 2; }
+package p {
+ object X { val x = 1; val y = 2 }
}
-package Q {
- object X { val x = true; val y = "" }
+
+package q {
+ object X { val x = true; val y = false }
}
diff --git a/test/files/neg/specification-scopes/P_2.scala b/test/files/neg/specification-scopes/P_2.scala
index d59f82e90d..856e58c6fb 100644
--- a/test/files/neg/specification-scopes/P_2.scala
+++ b/test/files/neg/specification-scopes/P_2.scala
@@ -1,21 +1,24 @@
-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
+package p { // `X' bound by package clause
+import Console._ // `println' bound by wildcard import
+object Y {
+ println(s"L4: $X") // `X' refers to `p.X' here
+ locally {
+ import q._ // `X' bound by wildcard import
+ println(s"L7: $X") // `X' refers to `q.X' here
+ import X._ // `x' and `y' bound by wildcard import
+ println(s"L9: $x") // `x' refers to `q.X.x' here
+ locally {
+ val x = 3 // `x' bound by local definition
+ println(s"L12: $x") // `x' refers to constant `3' here
+ locally {
+ import q.X._ // `x' and `y' bound by wildcard import
+ println(s"L15: $x") // reference to `x' is ambiguous here
+ import X.y // `y' bound by explicit import
+ println(s"L17: $y") // `y' refers to `q.X.y' here
+ locally {
+ val x = "abc" // `x' bound by local definition
+ import p.X._ // `x' and `y' bound by wildcard import
+ println(s"L21: $y") // reference to `y' is ambiguous here
+ println(s"L22: $x") // `x' refers to string "abc" here
}}}}}}
+
diff --git a/test/files/neg/stmt-expr-discard.check b/test/files/neg/stmt-expr-discard.check
index 1207e6da50..4a80765365 100644
--- a/test/files/neg/stmt-expr-discard.check
+++ b/test/files/neg/stmt-expr-discard.check
@@ -1,7 +1,7 @@
-stmt-expr-discard.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+stmt-expr-discard.scala:3: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
+ 2
^
-stmt-expr-discard.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+stmt-expr-discard.scala:4: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
- 4
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/t10066.check b/test/files/neg/t10066.check
new file mode 100644
index 0000000000..3555205d83
--- /dev/null
+++ b/test/files/neg/t10066.check
@@ -0,0 +1,7 @@
+t10066.scala:33: error: could not find implicit value for parameter extractor: dynamicrash.Extractor[String]
+ println(storage.foo[String])
+ ^
+t10066.scala:37: error: could not find implicit value for parameter extractor: dynamicrash.Extractor[A]
+ println(storage.foo)
+ ^
+two errors found
diff --git a/test/files/neg/t10066.scala b/test/files/neg/t10066.scala
new file mode 100644
index 0000000000..ef52f333dd
--- /dev/null
+++ b/test/files/neg/t10066.scala
@@ -0,0 +1,38 @@
+package dynamicrash
+
+import scala.language.dynamics
+
+class Config
+
+trait Extractor[A] {
+ def extract(config: Config, name: String): A
+}
+
+object Extractor {
+ // note missing "implicit"
+ val stringExtractor = new Extractor[String] {
+ override def extract(config: Config, name: String): String = ???
+ }
+}
+
+class Workspace extends Dynamic {
+ val config: Config = new Config
+
+ def selectDynamic[A](name: String)(implicit extractor: Extractor[A]): A =
+ extractor.extract(config, name)
+}
+
+object Main {
+ val storage = new Workspace
+
+ // this line works fine
+ // val a = storage.foo
+
+ // this line crashes the compiler ("head of empty list")
+ // in ContextErrors$InferencerContextErrors$InferErrorGen$.NotWithinBoundsErrorMessage
+ println(storage.foo[String])
+
+ // this line crashes the compiler in different way ("unknown type")
+ // in the backend, warning: an unexpected type representation reached the compiler backend while compiling Test.scala: <error>
+ println(storage.foo)
+}
diff --git a/test/files/neg/t10068.check b/test/files/neg/t10068.check
new file mode 100644
index 0000000000..2bb27c4fd8
--- /dev/null
+++ b/test/files/neg/t10068.check
@@ -0,0 +1,13 @@
+t10068.scala:5: error: i : Only methods can be marked @elidable.
+ @elidable(INFO) val i: Int = 42
+ ^
+t10068.scala:6: error: j: Only methods can be marked @elidable.
+ @elidable(INFO) lazy val j: Int = 42
+ ^
+t10068.scala:7: error: k : Only methods can be marked @elidable.
+ @elidable(INFO) var k: Int = 42
+ ^
+t10068.scala:9: error: D: Only methods can be marked @elidable.
+@elidable(INFO) class D
+ ^
+four errors found
diff --git a/test/files/neg/t10068.flags b/test/files/neg/t10068.flags
new file mode 100644
index 0000000000..2b18795468
--- /dev/null
+++ b/test/files/neg/t10068.flags
@@ -0,0 +1 @@
+-Xelide-below WARNING -Xsource:2.13
diff --git a/test/files/neg/t10068.scala b/test/files/neg/t10068.scala
new file mode 100644
index 0000000000..a45ee5dac4
--- /dev/null
+++ b/test/files/neg/t10068.scala
@@ -0,0 +1,9 @@
+
+import annotation._, elidable._
+
+class C {
+ @elidable(INFO) val i: Int = 42
+ @elidable(INFO) lazy val j: Int = 42
+ @elidable(INFO) var k: Int = 42
+}
+@elidable(INFO) class D
diff --git a/test/files/neg/t10097.check b/test/files/neg/t10097.check
new file mode 100644
index 0000000000..1f70546b57
--- /dev/null
+++ b/test/files/neg/t10097.check
@@ -0,0 +1,10 @@
+t10097.scala:2: error: case classes must have a non-implicit parameter list; try 'case class C()(...)'
+case class C(implicit val c: Int)
+ ^
+t10097.scala:4: error: case classes must have a non-implicit parameter list; try 'case class D()(...)(...)'
+case class D(implicit c: Int)(s: String)
+ ^
+t10097.scala:4: error: an implicit parameter section must be last
+case class D(implicit c: Int)(s: String)
+ ^
+three errors found
diff --git a/test/files/neg/t10097.flags b/test/files/neg/t10097.flags
new file mode 100644
index 0000000000..714bbf5125
--- /dev/null
+++ b/test/files/neg/t10097.flags
@@ -0,0 +1 @@
+-Xsource:2.13
diff --git a/test/files/neg/t10097.scala b/test/files/neg/t10097.scala
new file mode 100644
index 0000000000..b2f05e2972
--- /dev/null
+++ b/test/files/neg/t10097.scala
@@ -0,0 +1,4 @@
+
+case class C(implicit val c: Int)
+
+case class D(implicit c: Int)(s: String)
diff --git a/test/files/neg/t10097b.check b/test/files/neg/t10097b.check
new file mode 100644
index 0000000000..14535fee34
--- /dev/null
+++ b/test/files/neg/t10097b.check
@@ -0,0 +1,6 @@
+t10097b.scala:2: warning: case classes should have a non-implicit parameter list; adapting to 'case class C()(...)'
+case class C(implicit val c: Int)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t10097b.flags b/test/files/neg/t10097b.flags
new file mode 100644
index 0000000000..c6bfaf1f64
--- /dev/null
+++ b/test/files/neg/t10097b.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/t10097b.scala b/test/files/neg/t10097b.scala
new file mode 100644
index 0000000000..f166db6792
--- /dev/null
+++ b/test/files/neg/t10097b.scala
@@ -0,0 +1,3 @@
+
+case class C(implicit val c: Int)
+
diff --git a/test/files/neg/t1010.check b/test/files/neg/t1010.check
index 2cc8f9d986..d412d8ac1e 100644
--- a/test/files/neg/t1010.check
+++ b/test/files/neg/t1010.check
@@ -1,6 +1,6 @@
t1010.scala:14: error: type mismatch;
found : MailBox#Message
- required: _3.in.Message where val _3: Actor
+ required: _1.in.Message where val _1: 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/test/files/neg/t10207.check b/test/files/neg/t10207.check
new file mode 100755
index 0000000000..3330db44a5
--- /dev/null
+++ b/test/files/neg/t10207.check
@@ -0,0 +1,4 @@
+t10207.scala:14: error: too many arguments (2) for method apply: (key: Int)scala.collection.mutable.ArrayBuffer[String] in trait MapLike
+ m(1, (_ => empty)) ++= AB("eins", "uno")
+ ^
+one error found
diff --git a/test/files/neg/t10207.scala b/test/files/neg/t10207.scala
new file mode 100644
index 0000000000..2dfc5d75c9
--- /dev/null
+++ b/test/files/neg/t10207.scala
@@ -0,0 +1,16 @@
+
+// Was:
+// warning: an unexpected type representation reached the compiler backend
+// Now:
+// error: too many arguments (2) for method apply: (key: Int)scala.collection.mutable.ArrayBuffer[String] in trait MapLike
+
+trait Test {
+ import collection.mutable.{Map=>MMap, ArrayBuffer=>AB}
+
+ val m = MMap((1 -> AB("one")))
+
+ val empty = AB[String]()
+
+ m(1, (_ => empty)) ++= AB("eins", "uno")
+}
+
diff --git a/test/files/neg/t1112.check b/test/files/neg/t1112.check
index 5e3821b153..e6058bf176 100644
--- a/test/files/neg/t1112.check
+++ b/test/files/neg/t1112.check
@@ -1,4 +1,4 @@
-t1112.scala:12: error: too many arguments for method call: (p: Int)(f: => Test.this.Type1)Unit
+t1112.scala:12: error: too many arguments (2) for method call: (p: Int)(f: => Test.this.Type1)Unit
call(0,() => System.out.println("here we are"))
- ^
+ ^
one error found
diff --git a/test/files/neg/t1181.check b/test/files/neg/t1181.check
index 13b73d5381..a9c102853d 100644
--- a/test/files/neg/t1181.check
+++ b/test/files/neg/t1181.check
@@ -1,10 +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)
^
+t1181.scala:8: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
+ case (Nil, Nil) => map
+ ^
one warning found
one error found
diff --git a/test/files/neg/t1523.check b/test/files/neg/t1523.check
index d2489f2602..273d0f8cf7 100644
--- a/test/files/neg/t1523.check
+++ b/test/files/neg/t1523.check
@@ -1,4 +1,4 @@
-t1523.scala:4: error: too many arguments for method bug: (x: Any)Any
+t1523.scala:4: error: 25 more arguments than can be applied to 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/test/files/neg/t1838.check b/test/files/neg/t1838.check
index a476158c7b..af811a3810 100644
--- a/test/files/neg/t1838.check
+++ b/test/files/neg/t1838.check
@@ -1,7 +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
^
+t1838.scala:6: error: `sealed' modifier can be used only for classes
+ sealed val v = 0
+ ^
two errors found
diff --git a/test/files/neg/t1960.check b/test/files/neg/t1960.check
index 5238141c4e..bb6d3d3548 100644
--- a/test/files/neg/t1960.check
+++ b/test/files/neg/t1960.check
@@ -1,4 +1,7 @@
-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
+t1960.scala:2: error: parameter 'vr' requires field but conflicts with variable vr in trait T
+class C(vr: Int, vl: Int) extends T { def ref = vr + vl }
+ ^
+t1960.scala:2: error: parameter 'vl' requires field but conflicts with value vl in trait T
+class C(vr: Int, vl: Int) extends T { def ref = vr + vl }
+ ^
+two errors found
diff --git a/test/files/neg/t1960.scala b/test/files/neg/t1960.scala
index 5311940b5a..f4fdb341c6 100644
--- a/test/files/neg/t1960.scala
+++ b/test/files/neg/t1960.scala
@@ -1,5 +1,2 @@
-object ClassFormatErrorExample extends App { new Aclass(1) }
-
-trait TBase { var p:Int = 0; def f(p1: Int) {} }
-
-class Aclass (p: Int) extends TBase { def g() { f(p) } }
+trait T { var vr: Int = 0 ; val vl: Int = 0 }
+class C(vr: Int, vl: Int) extends T { def ref = vr + vl }
diff --git a/test/files/neg/t1980.flags b/test/files/neg/t1980.flags
index 7949c2afa2..cdc464a47d 100644
--- a/test/files/neg/t1980.flags
+++ b/test/files/neg/t1980.flags
@@ -1 +1 @@
--Xlint -Xfatal-warnings
+-Xlint:by-name-right-associative -Xfatal-warnings
diff --git a/test/files/neg/t200.check b/test/files/neg/t200.check
index b6b1a32267..f0c5e77772 100644
--- a/test/files/neg/t200.check
+++ b/test/files/neg/t200.check
@@ -1,5 +1,5 @@
-t200.scala:7: error: method foo is defined twice
- conflicting symbols both originated in file 't200.scala'
+t200.scala:7: error: method foo is defined twice;
+ the conflicting method foo was defined at line 6:7
def foo: Int;
^
one error found
diff --git a/test/files/neg/t2102.check b/test/files/neg/t2102.check
index b4f91a5319..6f70839d22 100644
--- a/test/files/neg/t2102.check
+++ b/test/files/neg/t2102.check
@@ -1,6 +1,6 @@
t2102.scala:2: error: type mismatch;
- found : java.util.Iterator[Int]
- required: scala.collection.Iterator[_]
+ found : Iterator[Int] (in java.util)
+ required: Iterator[_] (in scala.collection)
val x: Iterator[_] = new java.util.ArrayList[Int]().iterator
^
one error found
diff --git a/test/files/neg/t2712.flags b/test/files/neg/t2712.flags
deleted file mode 100644
index 41565c7e32..0000000000
--- a/test/files/neg/t2712.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ypartial-unification
diff --git a/test/files/neg/t2779.check b/test/files/neg/t2779.check
index 0ab4c50d0f..9881d5182c 100644
--- a/test/files/neg/t2779.check
+++ b/test/files/neg/t2779.check
@@ -1,5 +1,5 @@
-t2779.scala:16: error: method f is defined twice
- conflicting symbols both originated in file 't2779.scala'
+t2779.scala:16: error: method f is defined twice;
+ the conflicting method f was defined at line 15:18
override def f = List(M1)
^
one error found
diff --git a/test/files/neg/t278.check b/test/files/neg/t278.check
index 405f7d225c..940b8edcef 100644
--- a/test/files/neg/t278.check
+++ b/test/files/neg/t278.check
@@ -4,8 +4,8 @@ t278.scala:5: error: overloaded method value a with alternatives:
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'
+t278.scala:4: error: method a is defined twice;
+ the conflicting method a was defined at line 3:7
def a = (p:A) => ()
^
two errors found
diff --git a/test/files/neg/t3234.check b/test/files/neg/t3234.check
deleted file mode 100644
index 8f0d624ed9..0000000000
--- a/test/files/neg/t3234.check
+++ /dev/null
@@ -1,6 +0,0 @@
-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/test/files/neg/t3234.flags b/test/files/neg/t3234.flags
deleted file mode 100644
index 406231bd96..0000000000
--- a/test/files/neg/t3234.flags
+++ /dev/null
@@ -1 +0,0 @@
--Yinline -Yinline-warnings -Xfatal-warnings -Ybackend:GenASM
diff --git a/test/files/neg/t3234.scala b/test/files/neg/t3234.scala
deleted file mode 100644
index 1553f1fa05..0000000000
--- a/test/files/neg/t3234.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-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))
- }
-} \ No newline at end of file
diff --git a/test/files/neg/t3772.check b/test/files/neg/t3772.check
new file mode 100644
index 0000000000..d1ed39d8b6
--- /dev/null
+++ b/test/files/neg/t3772.check
@@ -0,0 +1,7 @@
+t3772.scala:7: error: value inner is not a member of object CC
+ CC.inner
+ ^
+t3772.scala:14: error: value outer is not a member of object CC
+ CC.outer
+ ^
+two errors found
diff --git a/test/files/neg/t3772.scala b/test/files/neg/t3772.scala
new file mode 100644
index 0000000000..cac4932d4a
--- /dev/null
+++ b/test/files/neg/t3772.scala
@@ -0,0 +1,17 @@
+class Test {
+ def m = {
+ case class CC(c: Int)
+ if ("".isEmpty) {
+ object CC { def inner = 42}
+ }
+ CC.inner
+ }
+ def n = {
+ object CC { val outer = 42 }
+ if ("".isEmpty) {
+ case class CC(c: Int)
+ CC(0).c
+ CC.outer
+ }
+ }
+}
diff --git a/test/files/neg/t3871.check b/test/files/neg/t3871.check
index b920357ee6..c9667abfb6 100644
--- a/test/files/neg/t3871.check
+++ b/test/files/neg/t3871.check
@@ -1,5 +1,5 @@
t3871.scala:4: error: variable foo in class Sub2 cannot be accessed in Sub2
- Access to protected method foo not permitted because
+ Access to protected variable foo not permitted because
enclosing class Base is not a subclass of
class Sub2 where target is defined
s.foo = true
diff --git a/test/files/neg/t4158.check b/test/files/neg/t4158.check
index af281c52cd..7bac6558f7 100644
--- a/test/files/neg/t4158.check
+++ b/test/files/neg/t4158.check
@@ -1,7 +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
^
+t4158.scala:3: error: an expression of type Null is ineligible for implicit conversion
+ var y = null: Int
+ ^
two errors found
diff --git a/test/files/neg/t4425.flags b/test/files/neg/t4425.flags
deleted file mode 100644
index 1182725e86..0000000000
--- a/test/files/neg/t4425.flags
+++ /dev/null
@@ -1 +0,0 @@
--optimize \ No newline at end of file
diff --git a/test/files/neg/t4460a.check b/test/files/neg/t4460a.check
index b711e7acb1..7a7618a114 100644
--- a/test/files/neg/t4460a.check
+++ b/test/files/neg/t4460a.check
@@ -1,4 +1,4 @@
-t4460a.scala:6: error: called constructor's definition must precede calling constructor's definition
+t4460a.scala:6: error: constructor invokes itself
def this() = this() // was binding to Predef.<init> !!
^
one error found
diff --git a/test/files/neg/t4460b.check b/test/files/neg/t4460b.check
index f0e703fd10..9a621dbd5c 100644
--- a/test/files/neg/t4460b.check
+++ b/test/files/neg/t4460b.check
@@ -1,4 +1,4 @@
-t4460b.scala:7: error: called constructor's definition must precede calling constructor's definition
+t4460b.scala:7: error: constructor invokes itself
def this() = this() // was binding to Predef.<init> !!
^
one error found
diff --git a/test/files/neg/t4541.check b/test/files/neg/t4541.check
index 7bd8ff78f9..7ee0cc6414 100644
--- a/test/files/neg/t4541.check
+++ b/test/files/neg/t4541.check
@@ -1,5 +1,5 @@
t4541.scala:11: error: variable data in class Sparse cannot be accessed in Sparse[Int]
- Access to protected method data not permitted because
+ Access to protected variable data not permitted because
prefix type Sparse[Int] does not conform to
class Sparse$mcI$sp where the access take place
that.data
diff --git a/test/files/neg/t4541b.check b/test/files/neg/t4541b.check
index 8a52fd97f4..2aae95f6b9 100644
--- a/test/files/neg/t4541b.check
+++ b/test/files/neg/t4541b.check
@@ -1,5 +1,5 @@
t4541b.scala:13: error: variable data in class SparseArray cannot be accessed in SparseArray[Int]
- Access to protected method data not permitted because
+ Access to protected variable 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)
diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check
index d5711a889b..721923e0ba 100644
--- a/test/files/neg/t4851.check
+++ b/test/files/neg/t4851.check
@@ -1,10 +1,10 @@
-S.scala:2: warning: Adaptation of argument list by inserting () has been deprecated: leaky (Object-receiving) target makes this especially dangerous.
+S.scala:2: warning: Adaptation of argument list by inserting () is 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.
+S.scala:3: warning: Adaptation of argument list by inserting () is deprecated: leaky (Object-receiving) target makes this especially dangerous.
signature: J(x: Any): J
given arguments: <none>
after adaptation: new J((): Unit)
@@ -17,24 +17,24 @@ S.scala:4: warning: Adapting argument list by creating a 5-tuple: this may not b
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]
+ signature: Some.apply[A](value: 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]
+ signature: Some(value: 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.
+S.scala:9: warning: Adaptation of argument list by inserting () is deprecated: this is unlikely to be what you want.
signature: J2(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.
+S.scala:10: warning: Adaptation of argument list by inserting () is deprecated: this is unlikely to be what you want.
signature: J2(x: T): J2[T]
given arguments: <none>
after adaptation: new J2((): Unit)
diff --git a/test/files/neg/t4877.flags b/test/files/neg/t4877.flags
deleted file mode 100644
index 7ccd56103a..0000000000
--- a/test/files/neg/t4877.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xlint \ No newline at end of file
diff --git a/test/files/neg/t5120.check b/test/files/neg/t5120.check
index 34d4ebde31..b6a3cb96aa 100644
--- a/test/files/neg/t5120.check
+++ b/test/files/neg/t5120.check
@@ -6,7 +6,7 @@ t5120.scala:11: error: type mismatch;
t5120.scala:25: error: type mismatch;
found : Thread
required: h.T
- (which expands to) _2
+ (which expands to) _1
List(str, num).foreach(h => h.f1 = new Thread())
^
two errors found
diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check
index da0ef0fc2e..8c895d7b47 100644
--- a/test/files/neg/t5148.check
+++ b/test/files/neg/t5148.check
@@ -1,7 +1,13 @@
+t5148.scala:4: error: Symbol 'term scala.tools.nsc.interpreter.IMain.memberHandlers' is missing from the classpath.
+This symbol is required by 'method scala.tools.nsc.interpreter.Imports.allReqAndHandlers'.
+Make sure that term memberHandlers is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
+A full rebuild may help if 'Imports.class' was compiled against an incompatible version of scala.tools.nsc.interpreter.IMain.
+class IMain extends Imports
+ ^
t5148.scala:4: error: Symbol 'type <none>.Request.Wrapper' is missing from the classpath.
This symbol is required by 'value scala.tools.nsc.interpreter.Imports.wrapper'.
Make sure that type Wrapper is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'Imports.class' was compiled against an incompatible version of <none>.Request.
class IMain extends Imports
- ^
-one error found
+ ^
+two errors found
diff --git a/test/files/neg/t5429.check b/test/files/neg/t5429.check
index 4350696bc8..fb2d9c2e47 100644
--- a/test/files/neg/t5429.check
+++ b/test/files/neg/t5429.check
@@ -134,7 +134,7 @@ 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.
+t5429.scala:91: error: lazy 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
diff --git a/test/files/neg/t5580b.scala b/test/files/neg/t5580b.scala
index 2161da4584..98b493e803 100644
--- a/test/files/neg/t5580b.scala
+++ b/test/files/neg/t5580b.scala
@@ -1,5 +1,5 @@
import scala.collection.mutable.WeakHashMap
-import scala.collection.JavaConversions._
+import scala.collection.JavaConverters._
class bar { }
diff --git a/test/files/neg/t5639b.flags b/test/files/neg/t5639b.flags
new file mode 100644
index 0000000000..90b87663af
--- /dev/null
+++ b/test/files/neg/t5639b.flags
@@ -0,0 +1 @@
+-Xsource:2.11 \ No newline at end of file
diff --git a/test/files/neg/t565.check b/test/files/neg/t565.check
index 136cc94b6f..d7657c0f5d 100644
--- a/test/files/neg/t565.check
+++ b/test/files/neg/t565.check
@@ -1,4 +1,4 @@
-t565.scala:2: error: only classes can have declared but undefined members
+t565.scala:2: error: only traits and abstract classes can have declared but undefined members
(Note that variables need to be initialized to be defined)
var s0: String
^
diff --git a/test/files/neg/t5761.check b/test/files/neg/t5761.check
index 2d66af26f6..15c0bc7634 100644
--- a/test/files/neg/t5761.check
+++ b/test/files/neg/t5761.check
@@ -13,7 +13,7 @@ Unspecified value parameter x.
t5761.scala:13: error: not found: type Tread
new Tread("sth") { }.run()
^
-t5761.scala:13: error: value run is not a member of AnyRef
+t5761.scala:13: error: value run is not a member of <error>
new Tread("sth") { }.run()
^
5 errors found
diff --git a/test/files/neg/t591.check b/test/files/neg/t591.check
index d33f6d7a2f..c0bade0814 100644
--- a/test/files/neg/t591.check
+++ b/test/files/neg/t591.check
@@ -1,5 +1,5 @@
-t591.scala:38: error: method input_= is defined twice
- conflicting symbols both originated in file 't591.scala'
+t591.scala:40: error: method input_= is defined twice;
+ the conflicting variable input was defined at line 35:18
def input_=(in : Input) = {}
^
one error found
diff --git a/test/files/neg/t591.scala b/test/files/neg/t591.scala
index 0f0b02395c..14fb256a69 100644
--- a/test/files/neg/t591.scala
+++ b/test/files/neg/t591.scala
@@ -35,7 +35,8 @@ trait BaseFlow extends BaseList {
private var input : Input = _;
private var output : Output = _;
+ // the error message is a bit confusing, as it points here,
+ // but the symbol it reports is `input`'s actual setter (the one we synthesized)
def input_=(in : Input) = {}
-
}
}
diff --git a/test/files/neg/t6120.check b/test/files/neg/t6120.check
index f432fde32f..b7a5d8bf17 100644
--- a/test/files/neg/t6120.check
+++ b/test/files/neg/t6120.check
@@ -6,13 +6,13 @@ See the Scaladoc 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
+t6120.scala:5: warning: method bippy in class BooleanOps is deprecated (since 2.11.0): 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
+t6120.scala:6: warning: method bippy in class BooleanOps is deprecated (since 2.11.0): bobo
def g = true.bippy
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/t6162-inheritance.check b/test/files/neg/t6162-inheritance.check
index c9f4ddaec1..9b0a8990da 100644
--- a/test/files/neg/t6162-inheritance.check
+++ b/test/files/neg/t6162-inheritance.check
@@ -1,4 +1,4 @@
-usage.scala:3: warning: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version.
+usage.scala:3: warning: inheritance from class Foo in package t6126 is deprecated (since 2.10.0): `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
diff --git a/test/files/neg/t6162-overriding.check b/test/files/neg/t6162-overriding.check
index 6bff75d88d..586bfb4b35 100644
--- a/test/files/neg/t6162-overriding.check
+++ b/test/files/neg/t6162-overriding.check
@@ -1,4 +1,4 @@
-t6162-overriding.scala:14: warning: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version.
+t6162-overriding.scala:14: warning: overriding method bar in class Bar is deprecated (since 2.10.0): `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
diff --git a/test/files/neg/t6214.check b/test/files/neg/t6214.check
index 6349a3e71c..9d746351d1 100644
--- a/test/files/neg/t6214.check
+++ b/test/files/neg/t6214.check
@@ -1,4 +1,7 @@
-t6214.scala:5: error: missing parameter type
+t6214.scala:5: error: ambiguous reference to overloaded definition,
+both method m in object Test of type (f: Int => Unit)Int
+and method m in object Test of type (f: String => Unit)Int
+match argument types (Any => Unit)
m { s => case class Foo() }
- ^
+ ^
one error found
diff --git a/test/files/neg/t6289.check b/test/files/neg/t6289.check
index 989932750f..7b2b4b2d32 100644
--- a/test/files/neg/t6289.check
+++ b/test/files/neg/t6289.check
@@ -1,9 +1,3 @@
-#partest java6
-t6289/J.java:2: method does not override or implement a method from a supertype
- @Override public void foo() { }
- ^
-1 error
-#partest !java6
t6289/J.java:2: error: method does not override or implement a method from a supertype
@Override public void foo() { }
^
diff --git a/test/files/neg/t6323a.check b/test/files/neg/t6323a.check
index 261a60ef3c..c4e92d93f0 100644
--- a/test/files/neg/t6323a.check
+++ b/test/files/neg/t6323a.check
@@ -1,10 +1,10 @@
-t6323a.scala:10: materializing requested scala.reflect.type.ClassTag[Test] using `package`.this.materializeClassTag[Test]()
+t6323a.scala:10: materializing requested scala.reflect.type.ClassTag[Test] using scala.reflect.`package`.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)
+t6323a.scala:11: materializing requested reflect.runtime.universe.type.TypeTag[Test] using scala.reflect.api.`package`.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:
+t6323a.scala:11: scala.reflect.api.`package`.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]
diff --git a/test/files/neg/t6335.check b/test/files/neg/t6335.check
index 1727a05eb2..d118440f75 100644
--- a/test/files/neg/t6335.check
+++ b/test/files/neg/t6335.check
@@ -1,9 +1,9 @@
-t6335.scala:6: error: method Z is defined twice
- conflicting symbols both originated in file 't6335.scala'
+t6335.scala:6: error: method Z is defined twice;
+ the conflicting method Z was defined at line 5:7
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'
+t6335.scala:3: error: method X is defined twice;
+ the conflicting method X was defined at line 2:7
implicit class X(val x: Int) { def xx = x }
^
two errors found
diff --git a/test/files/neg/t6375.check b/test/files/neg/t6375.check
deleted file mode 100644
index 89d7d8060f..0000000000
--- a/test/files/neg/t6375.check
+++ /dev/null
@@ -1,27 +0,0 @@
-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/test/files/neg/t6375.scala b/test/files/neg/t6375.scala
deleted file mode 100644
index 21634df688..0000000000
--- a/test/files/neg/t6375.scala
+++ /dev/null
@@ -1,67 +0,0 @@
-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/test/files/neg/t6406-regextract.check b/test/files/neg/t6406-regextract.check
index 19425a68b0..41b362f455 100644
--- a/test/files/neg/t6406-regextract.check
+++ b/test/files/neg/t6406-regextract.check
@@ -1,4 +1,4 @@
-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
+t6406-regextract.scala:4: warning: method unapplySeq in class Regex is deprecated (since 2.11.0): 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.
diff --git a/test/files/neg/t6446-additional.check b/test/files/neg/t6446-additional.check
index a87af2f1e5..9d4af37b98 100644
--- a/test/files/neg/t6446-additional.check
+++ b/test/files/neg/t6446-additional.check
@@ -10,30 +10,18 @@ superaccessors 6 add super accessors in traits and nested 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
+ fields 11 synthesize accessors and fields, add bitmaps for lazy vals
+ tailcalls 12 replace tail calls by jumps
+ specialize 13 @specialized-driven class and method specialization
+ explicitouter 14 this refs to outer pointers
+ erasure 15 erase types, add interfaces for traits
+ posterasure 16 clean up erased inline classes
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
+ jvm 23 generate JVM bytecode
+ ploogin 24 A sample phase that does so many things it's kind of hard...
+ terminal 25 the last phase during a compilation run
diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check
index 029c8057c3..65b5e5dc09 100644
--- a/test/files/neg/t6446-missing.check
+++ b/test/files/neg/t6446-missing.check
@@ -11,28 +11,17 @@ superaccessors 6 add super accessors in traits and nested 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
+ fields 11 synthesize accessors and fields, add bitmaps for lazy vals
+ tailcalls 12 replace tail calls by jumps
+ specialize 13 @specialized-driven class and method specialization
+ explicitouter 14 this refs to outer pointers
+ erasure 15 erase types, add interfaces for traits
+ posterasure 16 clean up erased inline classes
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
+ jvm 23 generate JVM bytecode
+ terminal 24 the last phase during a compilation run
diff --git a/test/files/neg/t6446-show-phases.check b/test/files/neg/t6446-show-phases.check
index 3ae3f96ef2..373f63e5b2 100644
--- a/test/files/neg/t6446-show-phases.check
+++ b/test/files/neg/t6446-show-phases.check
@@ -10,28 +10,17 @@ superaccessors 6 add super accessors in traits and nested 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
+ fields 11 synthesize accessors and fields, add bitmaps for lazy vals
+ tailcalls 12 replace tail calls by jumps
+ specialize 13 @specialized-driven class and method specialization
+ explicitouter 14 this refs to outer pointers
+ erasure 15 erase types, add interfaces for traits
+ posterasure 16 clean up erased inline classes
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
+ jvm 23 generate JVM bytecode
+ terminal 24 the last phase during a compilation run
diff --git a/test/files/neg/t6455.flags b/test/files/neg/t6455.flags
deleted file mode 100644
index 112fc720a0..0000000000
--- a/test/files/neg/t6455.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfuture \ No newline at end of file
diff --git a/test/files/neg/t6455.scala b/test/files/neg/t6455.scala
index ebbb37f1cd..22e4c30fdd 100644
--- a/test/files/neg/t6455.scala
+++ b/test/files/neg/t6455.scala
@@ -1,6 +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
+ // should not compile because we no longer rewrite withFilter => filter
O.withFilter(f => true)
-} \ No newline at end of file
+}
diff --git a/test/files/neg/t6567.flags b/test/files/neg/t6567.flags
index e93641e931..076333a011 100644
--- a/test/files/neg/t6567.flags
+++ b/test/files/neg/t6567.flags
@@ -1 +1 @@
--Xlint -Xfatal-warnings \ No newline at end of file
+-Xlint:option-implicit -Xfatal-warnings
diff --git a/test/files/neg/t6666.check b/test/files/neg/t6666.check
index 43c8252753..bae948fe56 100644
--- a/test/files/neg/t6666.check
+++ b/test/files/neg/t6666.check
@@ -1,7 +1,7 @@
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
+t6666.scala:30: error: Implementation restriction: access of lazy 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
@@ -10,7 +10,7 @@ t6666.scala:37: error: Implementation restriction: access of method x$4 in objec
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
+t6666.scala:54: error: Implementation restriction: access of lazy 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
diff --git a/test/files/neg/t6675.flags b/test/files/neg/t6675.flags
index 2843ea9efc..c6bfaf1f64 100644
--- a/test/files/neg/t6675.flags
+++ b/test/files/neg/t6675.flags
@@ -1 +1 @@
--deprecation -Xlint -Xfatal-warnings \ No newline at end of file
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/t6810.check b/test/files/neg/t6810.check
new file mode 100644
index 0000000000..497ef35070
--- /dev/null
+++ b/test/files/neg/t6810.check
@@ -0,0 +1,28 @@
+t6810.scala:4: error: unclosed character literal
+ val y = '
+ ^
+t6810.scala:5: error: unclosed character literal
+' // but not embedded EOL sequences not represented as escapes
+^
+t6810.scala:9: error: unclosed string literal
+ val Y = "
+ ^
+t6810.scala:10: error: unclosed string literal
+" // obviously not
+^
+t6810.scala:20: error: unclosed quoted identifier
+ val `
+ ^
+t6810.scala:21: error: unclosed quoted identifier
+` = EOL // not raw string literals aka triple-quoted, multiline strings
+^
+t6810.scala:24: error: unclosed character literal
+ val b = '
+ ^
+t6810.scala:25: error: unclosed character literal
+' // CR seen as EOL by scanner
+^
+t6810.scala:24: error: '=' expected but ';' found.
+ val b = '
+^
+9 errors found
diff --git a/test/files/neg/t6810.scala b/test/files/neg/t6810.scala
new file mode 100644
index 0000000000..50c305d70c
--- /dev/null
+++ b/test/files/neg/t6810.scala
@@ -0,0 +1,26 @@
+
+trait t6810 {
+ val x = '\u000A' // char literals accept arbitrary unicode escapes
+ val y = '
+' // but not embedded EOL sequences not represented as escapes
+ val z = '\n' // normally, expect this escape
+
+ val X = "\u000A" // it's the same as ordinary string literals
+ val Y = "
+" // obviously not
+ val Z = "\n" // normally, expect this escape
+
+ val A = """
+""" // which is what these are for
+ val B = s"""
+""" // or the same for interpolated strings
+
+ import scala.compat.Platform.EOL
+ val `\u000A` = EOL // backquoted identifiers are arbitrary string literals
+ val `
+` = EOL // not raw string literals aka triple-quoted, multiline strings
+
+ val a = '\u000D' // similar treatment of CR
+ val b = ' ' // CR seen as EOL by scanner
+ val c = '\r' // traditionally
+}
diff --git a/test/files/neg/t6829.check b/test/files/neg/t6829.check
index 914a1c9260..5ccd531be1 100644
--- a/test/files/neg/t6829.check
+++ b/test/files/neg/t6829.check
@@ -1,6 +1,6 @@
t6829.scala:35: error: type mismatch;
found : AgentSimulation.this.state.type (with underlying type G#State)
- required: _9.State
+ required: _1.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
@@ -17,32 +17,32 @@ t6829.scala:49: error: not found: value nextState
^
t6829.scala:50: error: type mismatch;
found : s.type (with underlying type Any)
- required: _53.State where val _53: G
+ required: _1.State where val _1: 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
+ required: _1.Action where val _1: 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
+ required: _1.State where val _1: 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
+ required: _1.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
+ required: _1.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
+ required: _1.State
agent.learn(s,a,s2,r): G#Agent
^
t6829.scala:53: error: not found: value nextState
diff --git a/test/files/neg/t6920.check b/test/files/neg/t6920.check
index ee4eafb83e..d10abff03c 100644
--- a/test/files/neg/t6920.check
+++ b/test/files/neg/t6920.check
@@ -1,6 +1,6 @@
-t6920.scala:9: error: too many arguments for method applyDynamicNamed: (values: Seq[(String, Any)])String
+t6920.scala:9: error: too many arguments (2) 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/test/files/neg/t7014.check b/test/files/neg/t7014.check
new file mode 100644
index 0000000000..c68c170835
--- /dev/null
+++ b/test/files/neg/t7014.check
@@ -0,0 +1,5 @@
+warning: While parsing annotations in t7014-neg.obj/t7014/ThreadSafetyLevel_1.class, could not find COMPLETELY_THREADSAFE in enum object ThreadSafetyLevel_1.
+This is likely due to an implementation restriction: an annotation argument cannot refer to a member of the annotated class (SI-7014).
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t7014.flags b/test/files/neg/t7014.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t7014.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t7014/ThreadSafetyLevel_1.java b/test/files/neg/t7014/ThreadSafetyLevel_1.java
new file mode 100644
index 0000000000..eeca65366b
--- /dev/null
+++ b/test/files/neg/t7014/ThreadSafetyLevel_1.java
@@ -0,0 +1,8 @@
+package t7014; // package needed due to other bug in scalac's java parser
+
+// since we parse eagerly, we have not yet parsed the classfile when parsing the annotation,
+// and on doing so, fail to find a symbol for the COMPLETELY_THREADSAFE reference
+// from the annotation's argument to the enum's member
+// for now, let's just not crash -- should implement lazy completing at some point
+@ThreadSafety_1(level=ThreadSafetyLevel_1.COMPLETELY_THREADSAFE)
+public enum ThreadSafetyLevel_1 { COMPLETELY_THREADSAFE }
diff --git a/test/files/neg/t7014/ThreadSafety_1.java b/test/files/neg/t7014/ThreadSafety_1.java
new file mode 100644
index 0000000000..e68b103d1f
--- /dev/null
+++ b/test/files/neg/t7014/ThreadSafety_1.java
@@ -0,0 +1,9 @@
+package t7014;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME) // must be exactly RUNTIME retention (those we parse)
+public @interface ThreadSafety_1 {
+ ThreadSafetyLevel_1 level();
+} \ No newline at end of file
diff --git a/test/files/neg/t7014/t7014_2.scala b/test/files/neg/t7014/t7014_2.scala
new file mode 100644
index 0000000000..4845fc9a5d
--- /dev/null
+++ b/test/files/neg/t7014/t7014_2.scala
@@ -0,0 +1,3 @@
+package t7014
+
+import ThreadSafetyLevel_1.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed
diff --git a/test/files/neg/t712.check b/test/files/neg/t712.check
index 831e943063..3f02b4b294 100644
--- a/test/files/neg/t712.check
+++ b/test/files/neg/t712.check
@@ -1,5 +1,4 @@
-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
+t712.scala:10: error: overloaded method coerce needs result type
implicit def coerce(p : ParentImpl) = p.self;
^
one error found
diff --git a/test/files/neg/t7157.check b/test/files/neg/t7157.check
index 3988460d4b..0b81394946 100644
--- a/test/files/neg/t7157.check
+++ b/test/files/neg/t7157.check
@@ -1,22 +1,22 @@
-Test_2.scala:5: error: too many arguments for macro method m1_0_0: ()Unit
+Test_2.scala:5: error: no arguments allowed for nullary 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
+ ^
+Test_2.scala:6: error: no arguments allowed for nullary 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
+ ^
+Test_2.scala:7: error: no arguments allowed for nullary macro method m1_0_0: ()Unit
m1_0_0(1, 2, 3)
- ^
+ ^
Test_2.scala:9: error: not enough arguments for macro method m1_1_1: (x: Int)Unit.
Unspecified value parameter x.
m1_1_1()
^
-Test_2.scala:11: error: too many arguments for macro method m1_1_1: (x: Int)Unit
+Test_2.scala:11: error: too many arguments (2) 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
+ ^
+Test_2.scala:12: error: too many arguments (3) for macro method m1_1_1: (x: Int)Unit
m1_1_1(1, 2, 3)
- ^
+ ^
Test_2.scala:14: error: not enough arguments for macro method m1_2_2: (x: Int, y: Int)Unit.
Unspecified value parameters x, y.
m1_2_2()
@@ -25,9 +25,9 @@ Test_2.scala:15: error: not enough arguments for macro method m1_2_2: (x: Int, y
Unspecified value parameter y.
m1_2_2(1)
^
-Test_2.scala:17: error: too many arguments for macro method m1_2_2: (x: Int, y: Int)Unit
+Test_2.scala:17: error: too many arguments (3) for macro method m1_2_2: (x: Int, y: Int)Unit
m1_2_2(1, 2, 3)
- ^
+ ^
Test_2.scala:24: error: not enough arguments for macro method m1_1_inf: (x: Int, y: Int*)Unit.
Unspecified value parameters x, y.
m1_1_inf()
@@ -40,25 +40,25 @@ Test_2.scala:30: error: not enough arguments for macro method m1_2_inf: (x: Int,
Unspecified value parameters y, z.
m1_2_inf(1)
^
-Test_2.scala:35: error: too many arguments for macro method m2_0_0: ()Unit
+Test_2.scala:35: error: no arguments allowed for nullary 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
+ ^
+Test_2.scala:36: error: no arguments allowed for nullary 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
+ ^
+Test_2.scala:37: error: no arguments allowed for nullary macro method m2_0_0: ()Unit
m2_0_0()(1, 2, 3)
- ^
+ ^
Test_2.scala:39: error: not enough arguments for macro method m2_1_1: (x: Int)Unit.
Unspecified value parameter x.
m2_1_1()()
^
-Test_2.scala:41: error: too many arguments for macro method m2_1_1: (x: Int)Unit
+Test_2.scala:41: error: too many arguments (2) 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
+ ^
+Test_2.scala:42: error: too many arguments (3) for macro method m2_1_1: (x: Int)Unit
m2_1_1()(1, 2, 3)
- ^
+ ^
Test_2.scala:44: error: not enough arguments for macro method m2_2_2: (x: Int, y: Int)Unit.
Unspecified value parameters x, y.
m2_2_2()()
@@ -67,9 +67,9 @@ Test_2.scala:45: error: not enough arguments for macro method m2_2_2: (x: Int, y
Unspecified value parameter y.
m2_2_2()(1)
^
-Test_2.scala:47: error: too many arguments for macro method m2_2_2: (x: Int, y: Int)Unit
+Test_2.scala:47: error: too many arguments (3) for macro method m2_2_2: (x: Int, y: Int)Unit
m2_2_2()(1, 2, 3)
- ^
+ ^
Test_2.scala:54: error: not enough arguments for macro method m2_1_inf: (x: Int, y: Int*)Unit.
Unspecified value parameters x, y.
m2_1_inf()()
diff --git a/test/files/neg/t7171.check b/test/files/neg/t7171.check
index ecd768afda..2de9151483 100644
--- a/test/files/neg/t7171.check
+++ b/test/files/neg/t7171.check
@@ -1,6 +1,9 @@
t7171.scala:2: warning: The outer reference in this type test cannot be checked at run time.
final case class A()
^
+t7171.scala:9: warning: The outer reference in this type test cannot be checked at run time.
+ case _: A => true; case _ => false
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-one warning found
+two warnings found
one error found
diff --git a/test/files/neg/t7171b.check b/test/files/neg/t7171b.check
index bf695afea7..6b05b6fa63 100644
--- a/test/files/neg/t7171b.check
+++ b/test/files/neg/t7171b.check
@@ -1,6 +1,12 @@
t7171b.scala:2: warning: The outer reference in this type test cannot be checked at run time.
final case class A()
^
+t7171b.scala:8: warning: The outer reference in this type test cannot be checked at run time.
+ case _: A => true; case _ => false
+ ^
+t7171b.scala:13: warning: The outer reference in this type test cannot be checked at run time.
+ case _: A => true; case _ => false
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-one warning found
+three warnings found
one error found
diff --git a/test/files/neg/t7187.check b/test/files/neg/t7187.check
new file mode 100644
index 0000000000..a30803c746
--- /dev/null
+++ b/test/files/neg/t7187.check
@@ -0,0 +1,6 @@
+t7187.scala:3: warning: Eta-expansion of zero-argument method values is deprecated. Did you intend to write EtaExpandZeroArg.this.foo()?
+ val f: () => Any = foo
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t7187.flags b/test/files/neg/t7187.flags
new file mode 100644
index 0000000000..c6bfaf1f64
--- /dev/null
+++ b/test/files/neg/t7187.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/t7187.scala b/test/files/neg/t7187.scala
new file mode 100644
index 0000000000..45d33f06af
--- /dev/null
+++ b/test/files/neg/t7187.scala
@@ -0,0 +1,6 @@
+class EtaExpandZeroArg {
+ def foo(): () => String = () => ""
+ val f: () => Any = foo
+
+ // f() would evaluate to <function0> instead of ""
+}
diff --git a/test/files/neg/t7294.check b/test/files/neg/t7294.check
index f15289c1c0..a308f2457d 100644
--- a/test/files/neg/t7294.check
+++ b/test/files/neg/t7294.check
@@ -1,6 +1,10 @@
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.
+t7294.scala:4: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: (Int, Int)
+ (1, 2) match { case Seq() => 0; case _ => 1 }
+ ^
one warning found
one error found
diff --git a/test/files/neg/t7294.flags b/test/files/neg/t7294.flags
deleted file mode 100644
index 3f3381a45b..0000000000
--- a/test/files/neg/t7294.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfuture -Xfatal-warnings
diff --git a/test/files/neg/t7294b.check b/test/files/neg/t7294b.check
index 0033b72125..3390cb7278 100644
--- a/test/files/neg/t7294b.check
+++ b/test/files/neg/t7294b.check
@@ -1,6 +1,4 @@
-t7294b.scala:1: warning: inheritance from class Tuple2 in package scala is deprecated: Tuples will be made final in a future version.
+t7294b.scala:1: error: illegal inheritance from final class Tuple2
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/test/files/neg/t7294b.flags b/test/files/neg/t7294b.flags
deleted file mode 100644
index d1b831ea87..0000000000
--- a/test/files/neg/t7294b.flags
+++ /dev/null
@@ -1 +0,0 @@
--deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7475d.check b/test/files/neg/t7475d.check
deleted file mode 100644
index 6bd1da0d44..0000000000
--- a/test/files/neg/t7475d.check
+++ /dev/null
@@ -1,7 +0,0 @@
-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/test/files/neg/t7494-no-options.check b/test/files/neg/t7494-no-options.check
index e3316f590a..1bf5c23711 100644
--- a/test/files/neg/t7494-no-options.check
+++ b/test/files/neg/t7494-no-options.check
@@ -11,30 +11,18 @@ superaccessors 6 add super accessors in traits and nested 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
+ fields 11 synthesize accessors and fields, add bitmaps for lazy vals
+ tailcalls 12 replace tail calls by jumps
+ specialize 13 @specialized-driven class and method specialization
+ explicitouter 14 this refs to outer pointers
+ erasure 15 erase types, add interfaces for traits
+ posterasure 16 clean up erased inline classes
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
+ jvm 23 generate JVM bytecode
+ ploogin 24 A sample phase that does so many things it's kind of hard...
+ terminal 25 the last phase during a compilation run
diff --git a/test/files/neg/t7602.check b/test/files/neg/t7602.check
index 5bb1450d7d..5ce3776790 100644
--- a/test/files/neg/t7602.check
+++ b/test/files/neg/t7602.check
@@ -1,5 +1,5 @@
-t7602.scala:16: error: method foo is defined twice
- conflicting symbols both originated in file 't7602.scala'
+t7602.scala:16: error: method foo is defined twice;
+ the conflicting method foo was defined at line 15:7
def foo : Device
^
one error found
diff --git a/test/files/neg/t7622-cyclic-dependency.check b/test/files/neg/t7622-cyclic-dependency.check
index 3546964f5f..81e3ecc6a4 100644
--- a/test/files/neg/t7622-cyclic-dependency.check
+++ b/test/files/neg/t7622-cyclic-dependency.check
@@ -1 +1 @@
-error: Cycle in phase dependencies detected at cyclicdependency1, created phase-cycle.dot
+error: Cycle in phase dependencies detected at cyclicdependency2, created phase-cycle.dot
diff --git a/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala
index 35c0ff8f53..0734863e64 100644
--- a/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala
+++ b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala
@@ -26,7 +26,7 @@ class ThePlugin(val global: Global) extends Plugin {
private object thePhase2 extends PluginComponent {
val global = ThePlugin.this.global
- val runsAfter = List[String]("dce","cyclicdependency1")
+ val runsAfter = List[String]("jvm","cyclicdependency1")
val phaseName = ThePlugin.this.name + "2"
diff --git a/test/files/neg/t7848-interp-warn.check b/test/files/neg/t7848-interp-warn.check
index 637fc8941a..cc94cc81de 100644
--- a/test/files/neg/t7848-interp-warn.check
+++ b/test/files/neg/t7848-interp-warn.check
@@ -1,15 +1,27 @@
-t7848-interp-warn.scala:8: warning: possible missing interpolator: detected interpolated identifier `$foo`
- "An important $foo message!"
+t7848-interp-warn.scala:18: warning: possible missing interpolator: detected interpolated identifier `$foo`
+ "An important $foo message!" // warn on ident in scope
^
-t7848-interp-warn.scala:12: warning: possible missing interpolator: detected an interpolated expression
- "A doubly important ${foo * 2} message!"
+t7848-interp-warn.scala:22: warning: possible missing interpolator: detected an interpolated expression
+ "A doubly important ${foo * 2} message!" // warn on some expr, see below
^
-t7848-interp-warn.scala:15: warning: possible missing interpolator: detected interpolated identifier `$bar`
- def i = s"Try using '${ "$bar" }' instead." // was: no warn on space test
+t7848-interp-warn.scala:25: warning: possible missing interpolator: detected interpolated identifier `$bar`
+ def i = s"Try using '${ "$bar" }' instead." // was: no warn on space test
^
-t7848-interp-warn.scala:16: warning: possible missing interpolator: detected interpolated identifier `$bar`
+t7848-interp-warn.scala:26: warning: possible missing interpolator: detected interpolated identifier `$bar`
def j = s"Try using '${ "something like $bar" }' instead." // warn
^
+t7848-interp-warn.scala:32: warning: possible missing interpolator: detected an interpolated expression
+ def v = "${baz}${bar}" // warn on second expr
+ ^
+t7848-interp-warn.scala:33: warning: possible missing interpolator: detected an interpolated expression
+ def w = "${ op_* }" // warn, only cheap ident parsing
+ ^
+t7848-interp-warn.scala:34: warning: possible missing interpolator: detected an interpolated expression
+ def x = "${ bar }" // warn, a cheap ident in scope
+ ^
+t7848-interp-warn.scala:36: warning: possible missing interpolator: detected an interpolated expression
+ def z = "${ baz * 3}" // warn, no expr parsing
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-four warnings found
+8 warnings found
one error found
diff --git a/test/files/neg/t7848-interp-warn.scala b/test/files/neg/t7848-interp-warn.scala
index a76141041d..ceaf6c7d67 100644
--- a/test/files/neg/t7848-interp-warn.scala
+++ b/test/files/neg/t7848-interp-warn.scala
@@ -1,18 +1,37 @@
package test
+package pancake { }
+
object Test {
+ type NonVal = Int
+
+ def ok = "Don't warn on $nosymbol interpolated."
+
+ def pass = "Don't warn on $pancake package names."
+
+ def types = "Or $NonVal type symbols either."
+
def bar = "bar"
def f = {
val foo = "bar"
- "An important $foo message!"
+ "An important $foo message!" // warn on ident in scope
}
def g = {
val foo = "bar"
- "A doubly important ${foo * 2} message!"
+ "A doubly important ${foo * 2} message!" // warn on some expr, see below
}
- def h = s"Try using '$$bar' instead." // no warn
- def i = s"Try using '${ "$bar" }' instead." // was: no warn on space test
+ def h = s"Try using '$$bar' instead." // no warn
+ def i = s"Try using '${ "$bar" }' instead." // was: 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
+ def k = f"Try using '$bar' instead." // no warn on other std interps
+ def p = "Template ${} {}" // no warn on unlikely or empty expressions
+ def q = "${}$bar" // disables subsequent checks! (a feature)
+ def r = "${}${bar}" // disables subsequent checks! (a feature)
+
+ def v = "${baz}${bar}" // warn on second expr
+ def w = "${ op_* }" // warn, only cheap ident parsing
+ def x = "${ bar }" // warn, a cheap ident in scope
+ def y = "${ baz }" // no warn, cheap ident not in scope
+ def z = "${ baz * 3}" // warn, no expr parsing
}
diff --git a/test/files/neg/t7860.check b/test/files/neg/t7860.check
new file mode 100644
index 0000000000..9b9d86c89d
--- /dev/null
+++ b/test/files/neg/t7860.check
@@ -0,0 +1,9 @@
+t7860.scala:5: warning: private class for your eyes only in object Test is never used
+ private implicit class `for your eyes only`(i: Int) { // warn
+ ^
+t7860.scala:31: warning: private class C in object Test3 is never used
+ private implicit class C(val i: Int) extends AnyVal { // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/test/files/neg/t7860.flags b/test/files/neg/t7860.flags
new file mode 100644
index 0000000000..6ff0dea0b2
--- /dev/null
+++ b/test/files/neg/t7860.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Ywarn-unused:privates
diff --git a/test/files/neg/t7860.scala b/test/files/neg/t7860.scala
new file mode 100644
index 0000000000..6cc0d3e7f5
--- /dev/null
+++ b/test/files/neg/t7860.scala
@@ -0,0 +1,42 @@
+
+class Test
+
+object Test {
+ private implicit class `for your eyes only`(i: Int) { // warn
+ def f = i
+ }
+}
+
+class Test2 {
+ import Test2._
+ println(5.toStr)
+}
+
+object Test2 {
+ // was: warning: private object in object Test2 is never used
+ // i.e. synthetic object C
+ private implicit class C(val i: Int) extends AnyVal { // no warn
+ def toStr = i.toString
+ }
+}
+
+class Test3 {
+ import Test3._
+ //println(5.toStr)
+}
+
+object Test3 {
+ // was: warning: private object in object Test2 is never used
+ // i.e. synthetic object C
+ private implicit class C(val i: Int) extends AnyVal { // warn
+ def toStr = i.toString
+ }
+}
+
+object Test4 {
+ class A { class B }
+
+ private val a: A = new A
+
+ def b = (new a.B).##
+}
diff --git a/test/files/neg/t800.check b/test/files/neg/t800.check
index 8ba95fddde..238b8dd27d 100644
--- a/test/files/neg/t800.check
+++ b/test/files/neg/t800.check
@@ -1,16 +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'
+t800.scala:8: error: value qualification is defined twice;
+ the conflicting variable qualification was defined at line 7:7
val qualification = false;
^
-t800.scala:12: error: value qualification is defined twice
- conflicting symbols both originated in file 't800.scala'
+t800.scala:12: error: variable qualification is defined twice;
+ the conflicting value qualification was defined at line 11:7
var qualification = false;
^
-t800.scala:16: error: method qualification is defined twice
- conflicting symbols both originated in file 't800.scala'
+t800.scala:16: error: variable qualification is defined twice;
+ the conflicting variable qualification was defined at line 15:7
var qualification = false;
^
four errors found
diff --git a/test/files/neg/t8002-nested-scope.check b/test/files/neg/t8002-nested-scope.check
new file mode 100644
index 0000000000..f66249e432
--- /dev/null
+++ b/test/files/neg/t8002-nested-scope.check
@@ -0,0 +1,4 @@
+t8002-nested-scope.scala:8: error: method x in class C cannot be accessed in C
+ new C().x
+ ^
+one error found
diff --git a/test/files/neg/t8002-nested-scope.scala b/test/files/neg/t8002-nested-scope.scala
new file mode 100644
index 0000000000..44704a12b1
--- /dev/null
+++ b/test/files/neg/t8002-nested-scope.scala
@@ -0,0 +1,12 @@
+class C {
+ def foo = {
+ class C { private def x = 0 }
+
+ {
+ val a = 0
+ object C {
+ new C().x
+ }
+ }
+ }
+}
diff --git a/test/files/neg/t8006.check b/test/files/neg/t8006.check
index fbac26e3ad..6152d0fba3 100644
--- a/test/files/neg/t8006.check
+++ b/test/files/neg/t8006.check
@@ -1,6 +1,6 @@
-t8006.scala:3: error: too many arguments for method applyDynamicNamed: (value: (String, Any))String
+t8006.scala:3: error: too many arguments (2) 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/test/files/neg/t8035-deprecated.check b/test/files/neg/t8035-deprecated.check
index 01f27e5310..35aba5551d 100644
--- a/test/files/neg/t8035-deprecated.check
+++ b/test/files/neg/t8035-deprecated.check
@@ -1,16 +1,16 @@
-t8035-deprecated.scala:2: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want.
+t8035-deprecated.scala:2: warning: Adaptation of argument list by inserting () is 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.
+t8035-deprecated.scala:5: warning: Adaptation of argument list by inserting () is 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.
+t8035-deprecated.scala:9: warning: Adaptation of argument list by inserting () is deprecated: leaky (Object-receiving) target makes this especially dangerous.
signature: Format.format(x$1: Any): String
given arguments: <none>
after adaptation: Format.format((): Unit)
diff --git a/test/files/neg/t8035-no-adapted-args.check b/test/files/neg/t8035-no-adapted-args.check
index 43637b2c1f..0115dddc91 100644
--- a/test/files/neg/t8035-no-adapted-args.check
+++ b/test/files/neg/t8035-no-adapted-args.check
@@ -4,9 +4,9 @@ t8035-no-adapted-args.scala:4: warning: No automatic adaptation here: use explic
after adaptation: Test.f((1, 2, 3): (Int, Int, Int))
f(1, 2, 3)
^
-t8035-no-adapted-args.scala:4: error: too many arguments for method f: (x: (Int, Int, Int))Int
+t8035-no-adapted-args.scala:4: error: too many arguments (3) for method f: (x: (Int, Int, Int))Int
f(1, 2, 3)
- ^
+ ^
t8035-no-adapted-args.scala:5: warning: No automatic adaptation here: use explicit parentheses.
signature: Test.f[T](x: T): Int
given arguments: <none>
diff --git a/test/files/neg/t8044-b.check b/test/files/neg/t8044-b.check
new file mode 100644
index 0000000000..4a93e9a772
--- /dev/null
+++ b/test/files/neg/t8044-b.check
@@ -0,0 +1,4 @@
+t8044-b.scala:3: error: Pattern variables must start with a lower-case letter. (SLS 8.1.1.)
+ def g = 42 match { case `Oops` : Int => } // must be varish
+ ^
+one error found
diff --git a/test/files/neg/t8044-b.scala b/test/files/neg/t8044-b.scala
new file mode 100644
index 0000000000..fb2e921ac9
--- /dev/null
+++ b/test/files/neg/t8044-b.scala
@@ -0,0 +1,4 @@
+
+trait T {
+ def g = 42 match { case `Oops` : Int => } // must be varish
+}
diff --git a/test/files/neg/t8044.check b/test/files/neg/t8044.check
new file mode 100644
index 0000000000..678bf8c700
--- /dev/null
+++ b/test/files/neg/t8044.check
@@ -0,0 +1,4 @@
+t8044.scala:3: error: not found: value _
+ def f = 42 match { case `_` : Int => `_` } // doesn't leak quoted underscore
+ ^
+one error found
diff --git a/test/files/neg/t8044.scala b/test/files/neg/t8044.scala
new file mode 100644
index 0000000000..930c30c5a5
--- /dev/null
+++ b/test/files/neg/t8044.scala
@@ -0,0 +1,4 @@
+
+trait T {
+ def f = 42 match { case `_` : Int => `_` } // doesn't leak quoted underscore
+}
diff --git a/test/files/neg/t8079a.check b/test/files/neg/t8079a.check
new file mode 100644
index 0000000000..6bbe78afa6
--- /dev/null
+++ b/test/files/neg/t8079a.check
@@ -0,0 +1,4 @@
+t8079a.scala:3: error: contravariant type I occurs in covariant position in type C.this.X of value b
+ def f2(b: X): Unit
+ ^
+one error found
diff --git a/test/files/neg/t8079a.scala b/test/files/neg/t8079a.scala
new file mode 100644
index 0000000000..4997ea282e
--- /dev/null
+++ b/test/files/neg/t8079a.scala
@@ -0,0 +1,4 @@
+trait C[-I] {
+ private[this] type X = C[I]
+ def f2(b: X): Unit
+}
diff --git a/test/files/neg/t8217-local-alias-requires-rhs.check b/test/files/neg/t8217-local-alias-requires-rhs.check
index 0d4f0864ba..383b1f8d63 100644
--- a/test/files/neg/t8217-local-alias-requires-rhs.check
+++ b/test/files/neg/t8217-local-alias-requires-rhs.check
@@ -1,10 +1,10 @@
-t8217-local-alias-requires-rhs.scala:6: error: only classes can have declared but undefined members
- type B
- ^
-t8217-local-alias-requires-rhs.scala:3: error: only classes can have declared but undefined members
+t8217-local-alias-requires-rhs.scala:3: error: only traits and abstract classes can have declared but undefined members
type A
^
-t8217-local-alias-requires-rhs.scala:14: error: only classes can have declared but undefined members
+t8217-local-alias-requires-rhs.scala:6: error: only traits and abstract classes can have declared but undefined members
+ type B
+ ^
+t8217-local-alias-requires-rhs.scala:14: error: only traits and abstract classes can have declared but undefined members
def this(a: Any) = { this(); type C }
^
three errors found
diff --git a/test/files/neg/t8417.check b/test/files/neg/t8417.check
new file mode 100644
index 0000000000..6ec9e1d14d
--- /dev/null
+++ b/test/files/neg/t8417.check
@@ -0,0 +1,15 @@
+t8417.scala:5: warning: Adapting argument list by creating a 2-tuple: this may not be what you want.
+ signature: T.f(x: Any)(y: Any): String
+ given arguments: "hello", "world"
+ after adaptation: T.f(("hello", "world"): (String, String))
+ def g = f("hello", "world")("holy", "moly")
+ ^
+t8417.scala:5: warning: Adapting argument list by creating a 2-tuple: this may not be what you want.
+ signature: T.f(x: Any)(y: Any): String
+ given arguments: "holy", "moly"
+ after adaptation: T.f(("holy", "moly"): (String, String))
+ def g = f("hello", "world")("holy", "moly")
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/test/files/neg/t8417.flags b/test/files/neg/t8417.flags
new file mode 100644
index 0000000000..26b215ff2d
--- /dev/null
+++ b/test/files/neg/t8417.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Ywarn-adapted-args
diff --git a/test/files/neg/t8417.scala b/test/files/neg/t8417.scala
new file mode 100644
index 0000000000..fb6449c2d1
--- /dev/null
+++ b/test/files/neg/t8417.scala
@@ -0,0 +1,6 @@
+
+
+trait T {
+ def f(x: Any)(y: Any) = "" + x + y
+ def g = f("hello", "world")("holy", "moly")
+}
diff --git a/test/files/neg/t8667.check b/test/files/neg/t8667.check
new file mode 100644
index 0000000000..82451ee5d6
--- /dev/null
+++ b/test/files/neg/t8667.check
@@ -0,0 +1,91 @@
+t8667.scala:6: error: too many arguments (3) for constructor C: (a: Int, b: Int)C
+Note that 'c' is not a parameter name of the invoked method.
+ def c2 = new C(a = 42, b = 17, c = 5)
+ ^
+t8667.scala:7: error: unknown parameter name: c
+ def c3 = new C(b = 42, a = 17, c = 5)
+ ^
+t8667.scala:7: error: too many arguments (3) for constructor C: (a: Int, b: Int)C
+ def c3 = new C(b = 42, a = 17, c = 5)
+ ^
+t8667.scala:8: error: positional after named argument.
+ def c4 = new C(b = 42, a = 17, 5)
+ ^
+t8667.scala:8: error: too many arguments (3) for constructor C: (a: Int, b: Int)C
+ def c4 = new C(b = 42, a = 17, 5)
+ ^
+t8667.scala:9: error: not found: value c
+ def c5 = new C(a = 42, c = 17)
+ ^
+t8667.scala:10: error: parameter 'b' is already specified at parameter position 2
+Note that 'c' is not a parameter name of the invoked method.
+ def c6 = new C(a = 42, c = 17, b = 5)
+ ^
+t8667.scala:10: error: too many arguments (3) for constructor C: (a: Int, b: Int)C
+Note that 'c' is not a parameter name of the invoked method.
+ def c6 = new C(a = 42, c = 17, b = 5)
+ ^
+t8667.scala:11: error: parameter 'a' is already specified at parameter position 1
+Note that 'c' is not a parameter name of the invoked method.
+ def c7 = new C(c = 42, a = 17, b = 5)
+ ^
+t8667.scala:11: error: too many arguments (3) for constructor C: (a: Int, b: Int)C
+Note that 'c' is not a parameter name of the invoked method.
+ def c7 = new C(c = 42, a = 17, b = 5)
+ ^
+t8667.scala:12: error: parameter 'b' is already specified at parameter position 2
+ def c8 = new C(42, 17, b = 5)
+ ^
+t8667.scala:12: error: too many arguments (3) for constructor C: (a: Int, b: Int)C
+ def c8 = new C(42, 17, b = 5)
+ ^
+t8667.scala:13: error: parameter 'b' is already specified at parameter position 2
+Note that 'c' is not a parameter name of the invoked method.
+ def c9 = new C(a = 42, c = 17, d = 3, b = 5)
+ ^
+t8667.scala:13: error: too many arguments (4) for constructor C: (a: Int, b: Int)C
+Note that 'c', 'd' are not parameter names of the invoked method.
+ def c9 = new C(a = 42, c = 17, d = 3, b = 5)
+ ^
+t8667.scala:14: error: too many arguments (4) for constructor C: (a: Int, b: Int)C
+Note that 'd', 'c' are not parameter names of the invoked method.
+ def c0 = new C(42, 17, d = 3, c = 5)
+ ^
+t8667.scala:25: error: no arguments allowed for nullary method f0: ()Int
+ f0(1)
+ ^
+t8667.scala:26: error: too many arguments (2) for method f1: (i: Int)Int
+ f1(1, 2)
+ ^
+t8667.scala:27: error: too many arguments (3) for method f1: (i: Int)Int
+ f1(1, 2, 3)
+ ^
+t8667.scala:28: error: 3 more arguments than can be applied to method f1: (i: Int)Int
+ f1(1, 2, 3, 4)
+ ^
+t8667.scala:29: error: 3 more arguments than can be applied to method f1: (i: Int)Int
+Note that 'j' is not a parameter name of the invoked method.
+ f1(1, j = 2, 3, 4)
+ ^
+t8667.scala:30: error: 3 more arguments than can be applied to method f1: (i: Int)Int
+Note that 'j', 'k' are not parameter names of the invoked method.
+ f1(1, j = 2, k = 3, 4)
+ ^
+t8667.scala:31: error: parameter 'i' is already specified at parameter position 1
+Note that 'k' is not a parameter name of the invoked method.
+ f2(k = 1, i = 2, j = 3)
+ ^
+t8667.scala:31: error: too many arguments (3) for method f2: (i: Int, j: Int)Int
+Note that 'k' is not a parameter name of the invoked method.
+ f2(k = 1, i = 2, j = 3)
+ ^
+t8667.scala:32: error: one more argument than can be applied to method f6: (i: Int, j: Int, k: Int, l: Int, m: Int, n: Int)Int
+ f6(1, 2, 3, 4, 5, 6, 7)
+ ^
+t8667.scala:33: error: 2 more arguments than can be applied to method f6: (i: Int, j: Int, k: Int, l: Int, m: Int, n: Int)Int
+ f6(1, 2, 3, 4, 5, 6, 7, 8)
+ ^
+t8667.scala:34: error: 15 arguments but expected 12 for method f12: (i: Int, j: Int, k: Int, l: Int, m: Int, n: Int, o: Int, p: Int, q: Int, r: Int, s: Int, t: Int)Int
+ f12(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
+ ^
+26 errors found
diff --git a/test/files/neg/t8667.scala b/test/files/neg/t8667.scala
new file mode 100644
index 0000000000..d55582ca6b
--- /dev/null
+++ b/test/files/neg/t8667.scala
@@ -0,0 +1,37 @@
+
+class C(a: Int, b: Int)
+
+trait T {
+ def c1 = new C(a = 42, b = 17)
+ def c2 = new C(a = 42, b = 17, c = 5)
+ def c3 = new C(b = 42, a = 17, c = 5)
+ def c4 = new C(b = 42, a = 17, 5)
+ def c5 = new C(a = 42, c = 17)
+ def c6 = new C(a = 42, c = 17, b = 5)
+ def c7 = new C(c = 42, a = 17, b = 5)
+ def c8 = new C(42, 17, b = 5)
+ def c9 = new C(a = 42, c = 17, d = 3, b = 5)
+ def c0 = new C(42, 17, d = 3, c = 5)
+}
+
+trait X {
+ def f0() = 42
+ def f1(i: Int) = 42
+ def f2(i: Int, j: Int) = 42
+ def f6(i: Int, j: Int, k: Int, l: Int, m: Int, n: Int) = 42
+ def f12(i: Int, j: Int, k: Int, l: Int, m: Int, n: Int, o: Int, p: Int, q: Int, r: Int, s: Int, t: Int) = 42
+
+ def g() = {
+ f0(1)
+ f1(1, 2)
+ f1(1, 2, 3)
+ f1(1, 2, 3, 4)
+ f1(1, j = 2, 3, 4)
+ f1(1, j = 2, k = 3, 4)
+ f2(k = 1, i = 2, j = 3)
+ f6(1, 2, 3, 4, 5, 6, 7)
+ f6(1, 2, 3, 4, 5, 6, 7, 8)
+ f12(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
+ ()
+ }
+}
diff --git a/test/files/neg/t8685.check b/test/files/neg/t8685.check
new file mode 100644
index 0000000000..a31e2e265a
--- /dev/null
+++ b/test/files/neg/t8685.check
@@ -0,0 +1,48 @@
+t8685.scala:6: warning: constructor D in class D is deprecated (since now): ctor D is depr
+case class D @deprecated("ctor D is depr", since="now") (i: Int)
+ ^
+t8685.scala:35: warning: class C is deprecated (since now): class C is depr
+ def f = C(42)
+ ^
+t8685.scala:36: warning: constructor D in class D is deprecated (since now): ctor D is depr
+ def g = D(42)
+ ^
+t8685.scala:37: warning: object E is deprecated (since now): module E is depr
+ def h = E(42)
+ ^
+t8685.scala:37: warning: class E is deprecated (since now): class E is depr
+ def h = E(42)
+ ^
+t8685.scala:38: warning: object F is deprecated (since now): module F is depr
+ def i = F.G(42)
+ ^
+t8685.scala:39: warning: object F in object Extra is deprecated (since now): Extra module F is depr
+ def j = Extra.F.G(42)
+ ^
+t8685.scala:43: warning: value gg in trait Applies is deprecated (since now): member gg
+ def k = this.gg.H(0)
+ ^
+t8685.scala:45: warning: class K in object J is deprecated (since now): Inner K is depr
+ def l = J.K(42)
+ ^
+t8685.scala:48: warning: class C is deprecated (since now): class C is depr
+ def f = new C(42)
+ ^
+t8685.scala:49: warning: constructor D in class D is deprecated (since now): ctor D is depr
+ def g = new D(42)
+ ^
+t8685.scala:50: warning: class E is deprecated (since now): class E is depr
+ def h = new E(42)
+ ^
+t8685.scala:51: warning: object F is deprecated (since now): module F is depr
+ def i = new F.G(42)
+ ^
+t8685.scala:52: warning: object F in object Extra is deprecated (since now): Extra module F is depr
+ def j = new Extra.F.G(42)
+ ^
+t8685.scala:53: warning: class K in object J is deprecated (since now): Inner K is depr
+ def l = new J.K(42)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+15 warnings found
+one error found
diff --git a/test/files/neg/t8685.flags b/test/files/neg/t8685.flags
new file mode 100644
index 0000000000..c6bfaf1f64
--- /dev/null
+++ b/test/files/neg/t8685.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/t8685.scala b/test/files/neg/t8685.scala
new file mode 100644
index 0000000000..711680ecbd
--- /dev/null
+++ b/test/files/neg/t8685.scala
@@ -0,0 +1,54 @@
+
+
+@deprecated("class C is depr", since="now")
+case class C(i: Int)
+
+case class D @deprecated("ctor D is depr", since="now") (i: Int)
+
+@deprecated("class E is depr", since="now")
+case class E(i: Int)
+@deprecated("module E is depr", since="now")
+object E
+
+@deprecated("module F is depr", since="now")
+object F {
+ case class G(i: Int)
+}
+
+object G {
+ case class H(i: Int)
+}
+
+object Extra {
+ @deprecated("Extra module F is depr", since="now")
+ object F {
+ case class G(i: Int)
+ }
+}
+
+object J {
+ @deprecated("Inner K is depr", since="now")
+ case class K(i: Int)
+}
+
+trait Applies {
+ def f = C(42)
+ def g = D(42)
+ def h = E(42)
+ def i = F.G(42)
+ def j = Extra.F.G(42)
+
+ @deprecated("member gg", since="now")
+ val gg = G
+ def k = this.gg.H(0)
+
+ def l = J.K(42)
+}
+trait News {
+ def f = new C(42)
+ def g = new D(42)
+ def h = new E(42)
+ def i = new F.G(42)
+ def j = new Extra.F.G(42)
+ def l = new J.K(42)
+}
diff --git a/test/files/neg/t8700a.check b/test/files/neg/t8700a.check
new file mode 100644
index 0000000000..ce7945a3fc
--- /dev/null
+++ b/test/files/neg/t8700a.check
@@ -0,0 +1,11 @@
+Bar.scala:2: warning: match may not be exhaustive.
+It would fail on the following input: B
+ def bar1(foo: Foo) = foo match {
+ ^
+Bar.scala:6: warning: match may not be exhaustive.
+It would fail on the following input: B
+ def bar2(foo: Baz) = foo match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/test/files/neg/t8700a.flags b/test/files/neg/t8700a.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t8700a.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t8700a/Bar.scala b/test/files/neg/t8700a/Bar.scala
new file mode 100644
index 0000000000..33ad8e9877
--- /dev/null
+++ b/test/files/neg/t8700a/Bar.scala
@@ -0,0 +1,9 @@
+object Bar {
+ def bar1(foo: Foo) = foo match {
+ case Foo.A => 1
+ }
+
+ def bar2(foo: Baz) = foo match {
+ case Baz.A => 1
+ }
+}
diff --git a/test/files/neg/t8700a/Baz.java b/test/files/neg/t8700a/Baz.java
new file mode 100644
index 0000000000..f85ad40802
--- /dev/null
+++ b/test/files/neg/t8700a/Baz.java
@@ -0,0 +1,11 @@
+public enum Baz {
+ A {
+ public void baz1() {}
+ },
+ B {
+ public void baz1() {}
+ };
+
+ public abstract void baz1();
+ public void baz2() {}
+}
diff --git a/test/files/neg/t8700a/Foo.java b/test/files/neg/t8700a/Foo.java
new file mode 100644
index 0000000000..cc8e9daf1f
--- /dev/null
+++ b/test/files/neg/t8700a/Foo.java
@@ -0,0 +1,4 @@
+public enum Foo {
+ A,
+ B
+}
diff --git a/test/files/neg/t8700b.check b/test/files/neg/t8700b.check
new file mode 100644
index 0000000000..3bff78dd29
--- /dev/null
+++ b/test/files/neg/t8700b.check
@@ -0,0 +1,11 @@
+Bar_2.scala:2: warning: match may not be exhaustive.
+It would fail on the following input: B
+ def bar1(foo: Foo_1) = foo match {
+ ^
+Bar_2.scala:6: warning: match may not be exhaustive.
+It would fail on the following input: B
+ def bar2(foo: Baz_1) = foo match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/test/files/neg/t8700b.flags b/test/files/neg/t8700b.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t8700b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t8700b/Bar_2.scala b/test/files/neg/t8700b/Bar_2.scala
new file mode 100644
index 0000000000..97ba16df27
--- /dev/null
+++ b/test/files/neg/t8700b/Bar_2.scala
@@ -0,0 +1,9 @@
+object Bar {
+ def bar1(foo: Foo_1) = foo match {
+ case Foo_1.A => 1
+ }
+
+ def bar2(foo: Baz_1) = foo match {
+ case Baz_1.A => 1
+ }
+}
diff --git a/test/files/neg/t8700b/Baz_1.java b/test/files/neg/t8700b/Baz_1.java
new file mode 100644
index 0000000000..6a057c2c9c
--- /dev/null
+++ b/test/files/neg/t8700b/Baz_1.java
@@ -0,0 +1,11 @@
+public enum Baz_1 {
+ A {
+ public void baz1() {}
+ },
+ B {
+ public void baz1() {}
+ };
+
+ public abstract void baz1();
+ public void baz2() {}
+}
diff --git a/test/files/neg/t8700b/Foo_1.java b/test/files/neg/t8700b/Foo_1.java
new file mode 100644
index 0000000000..22656bdedd
--- /dev/null
+++ b/test/files/neg/t8700b/Foo_1.java
@@ -0,0 +1,4 @@
+public enum Foo_1 {
+ A,
+ B
+}
diff --git a/test/files/neg/t8704.check b/test/files/neg/t8704.check
new file mode 100644
index 0000000000..b567a8bb17
--- /dev/null
+++ b/test/files/neg/t8704.check
@@ -0,0 +1,11 @@
+t8704.scala:7: warning: 2 parameter sections are effectively implicit
+class D(private implicit val i: Int)(implicit s: String)
+ ^
+t8704.scala:3: error: an implicit parameter section must be last
+class C(i: Int)(implicit j: Int)(implicit k: Int)(n: Int) {
+ ^
+t8704.scala:3: error: multiple implicit parameter sections are not allowed
+class C(i: Int)(implicit j: Int)(implicit k: Int)(n: Int) {
+ ^
+one warning found
+two errors found
diff --git a/test/files/neg/t8704.flags b/test/files/neg/t8704.flags
new file mode 100644
index 0000000000..f175a06c74
--- /dev/null
+++ b/test/files/neg/t8704.flags
@@ -0,0 +1 @@
+-Ywarn-extra-implicit
diff --git a/test/files/neg/t8704.scala b/test/files/neg/t8704.scala
new file mode 100644
index 0000000000..db43bfcaa5
--- /dev/null
+++ b/test/files/neg/t8704.scala
@@ -0,0 +1,7 @@
+
+
+class C(i: Int)(implicit j: Int)(implicit k: Int)(n: Int) {
+ def f = n
+}
+
+class D(private implicit val i: Int)(implicit s: String)
diff --git a/test/files/neg/t876.check b/test/files/neg/t876.check
index 04c5c8f22e..7df2e126a6 100644
--- a/test/files/neg/t876.check
+++ b/test/files/neg/t876.check
@@ -1,4 +1,4 @@
-t876.scala:25: error: too many arguments for method apply: (key: AssertionError.A)manager.B in class HashMap
+t876.scala:25: error: too many arguments (2) 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/test/files/neg/t8764.check b/test/files/neg/t8764.check
deleted file mode 100644
index 6d89ebe106..0000000000
--- a/test/files/neg/t8764.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t8764.scala:8: error: type mismatch;
- found : AnyVal
- required: Double
- val d: Double = a.productElement(0)
- ^
-one error found
diff --git a/test/files/neg/t8764.flags b/test/files/neg/t8764.flags
deleted file mode 100644
index 48fd867160..0000000000
--- a/test/files/neg/t8764.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xexperimental
diff --git a/test/files/neg/t8764.scala b/test/files/neg/t8764.scala
deleted file mode 100644
index dc5bfb0160..0000000000
--- a/test/files/neg/t8764.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-object Main {
-
- case class IntAndDouble(i: Int, d: Double)
-
- // a.productElement used to be Int => Double
- // now: Int => AnyVal
- val a = IntAndDouble(1, 5.0)
- val d: Double = a.productElement(0)
-}
diff --git a/test/files/neg/t8849.check b/test/files/neg/t8849.check
new file mode 100644
index 0000000000..1d5b4164b2
--- /dev/null
+++ b/test/files/neg/t8849.check
@@ -0,0 +1,7 @@
+t8849.scala:8: error: ambiguous implicit values:
+ both lazy value global in object Implicits of type => scala.concurrent.ExecutionContext
+ and value dummy of type scala.concurrent.ExecutionContext
+ match expected type scala.concurrent.ExecutionContext
+ require(implicitly[ExecutionContext] eq dummy)
+ ^
+one error found
diff --git a/test/files/neg/t8849.scala b/test/files/neg/t8849.scala
new file mode 100644
index 0000000000..336f16b40f
--- /dev/null
+++ b/test/files/neg/t8849.scala
@@ -0,0 +1,10 @@
+import scala.concurrent.ExecutionContext
+import ExecutionContext.Implicits.global
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ implicit val dummy: ExecutionContext = null
+ require(scala.concurrent.ExecutionContext.Implicits.global ne null)
+ require(implicitly[ExecutionContext] eq dummy)
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t9045.check b/test/files/neg/t9045.check
new file mode 100644
index 0000000000..07d0e2dd74
--- /dev/null
+++ b/test/files/neg/t9045.check
@@ -0,0 +1,7 @@
+t9045.scala:3: error: constructor invokes itself
+ def this(axes: Array[Int]) = this(axes)
+ ^
+t9045.scala:6: error: called constructor's definition must precede calling constructor's definition
+ def this(d: Double) = this(d.toLong)
+ ^
+two errors found
diff --git a/test/files/neg/t9045.scala b/test/files/neg/t9045.scala
new file mode 100644
index 0000000000..e6710ab324
--- /dev/null
+++ b/test/files/neg/t9045.scala
@@ -0,0 +1,8 @@
+
+case class AffineImageShape(axes: Seq[Int]) {
+ def this(axes: Array[Int]) = this(axes)
+}
+class X(i: Int) {
+ def this(d: Double) = this(d.toLong)
+ def this(n: Long) = this(n.toInt)
+}
diff --git a/test/files/neg/t9361.check b/test/files/neg/t9361.check
new file mode 100644
index 0000000000..847d137f7d
--- /dev/null
+++ b/test/files/neg/t9361.check
@@ -0,0 +1,11 @@
+t9361.scala:4: error: type mismatch;
+ found : Tc[_$2] where type _$2
+ required: Nothing[]
+ new Foo { def tc = null.asInstanceOf[Tc[_]] }
+ ^
+t9361.scala:4: error: type mismatch;
+ found : Foo[Nothing]
+ required: Foo[Tc]{type T = Nothing}
+ new Foo { def tc = null.asInstanceOf[Tc[_]] }
+ ^
+two errors found
diff --git a/test/files/neg/t9361.scala b/test/files/neg/t9361.scala
new file mode 100644
index 0000000000..b689461e4d
--- /dev/null
+++ b/test/files/neg/t9361.scala
@@ -0,0 +1,5 @@
+abstract class Foo[Tc[_]] { def tc: Tc[_] }
+object Foo {
+ def foo[Tc[_]](): Foo[Tc] { type T = Nothing } =
+ new Foo { def tc = null.asInstanceOf[Tc[_]] }
+}
diff --git a/test/files/neg/t9382.check b/test/files/neg/t9382.check
new file mode 100644
index 0000000000..93bf48926a
--- /dev/null
+++ b/test/files/neg/t9382.check
@@ -0,0 +1,10 @@
+t9382.scala:3: error: value x is not a member of (List[Int], List[Int])
+ def f = (List(1,2,3), List(4,5,6)).x
+ ^
+t9382.scala:4: error: value x is not a member of (List[Int], List[Int], List[Int])
+ def g = (List(1,2,3), List(4,5,6), List(7,8,9)).x
+ ^
+t9382.scala:5: error: value x is not a member of (Int, Int)
+ def huh = (1,2).x
+ ^
+three errors found
diff --git a/test/files/neg/t9382.scala b/test/files/neg/t9382.scala
new file mode 100644
index 0000000000..19703525e4
--- /dev/null
+++ b/test/files/neg/t9382.scala
@@ -0,0 +1,6 @@
+
+trait T {
+ def f = (List(1,2,3), List(4,5,6)).x
+ def g = (List(1,2,3), List(4,5,6), List(7,8,9)).x
+ def huh = (1,2).x
+}
diff --git a/test/files/neg/t9398.check b/test/files/neg/t9398.check
new file mode 100644
index 0000000000..f0c464daa1
--- /dev/null
+++ b/test/files/neg/t9398.check
@@ -0,0 +1,7 @@
+match.scala:3: warning: match may not be exhaustive.
+It would fail on the following input: CC(B2)
+ def test(c: CC): Unit = c match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t9398.flags b/test/files/neg/t9398.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t9398.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t9398/data.scala b/test/files/neg/t9398/data.scala
new file mode 100644
index 0000000000..7a98c0e8e8
--- /dev/null
+++ b/test/files/neg/t9398/data.scala
@@ -0,0 +1,5 @@
+sealed abstract class TB
+case object B extends TB
+case object B2 extends TB
+
+case class CC(tb: TB)
diff --git a/test/files/neg/t9398/match.scala b/test/files/neg/t9398/match.scala
new file mode 100644
index 0000000000..e110c6a96a
--- /dev/null
+++ b/test/files/neg/t9398/match.scala
@@ -0,0 +1,6 @@
+class Test {
+ // Should warn that CC(B2) isn't matched
+ def test(c: CC): Unit = c match {
+ case CC(B) => ()
+ }
+}
diff --git a/test/files/neg/t9527a.check b/test/files/neg/t9527a.check
new file mode 100644
index 0000000000..e756518bed
--- /dev/null
+++ b/test/files/neg/t9527a.check
@@ -0,0 +1,7 @@
+t9527a.scala:5: error: ambiguous implicit values:
+ both method f in class C of type (x: Int)String
+ and method g in class C of type (x: Int)String
+ match expected type Int => String
+ implicitly[Int => String]
+ ^
+one error found
diff --git a/test/files/neg/t9527a.scala b/test/files/neg/t9527a.scala
new file mode 100644
index 0000000000..35c58fc9a6
--- /dev/null
+++ b/test/files/neg/t9527a.scala
@@ -0,0 +1,8 @@
+class C {
+ implicit def f(x: Int): String = "f was here"
+ implicit def g(x: Int): String = "f was here"
+ def test: Unit = {
+ implicitly[Int => String]
+ }
+}
+
diff --git a/test/files/neg/t9527b.check b/test/files/neg/t9527b.check
new file mode 100644
index 0000000000..4529ec83ea
--- /dev/null
+++ b/test/files/neg/t9527b.check
@@ -0,0 +1,4 @@
+t9527b.scala:6: error: msg A=Nothing
+ implicitly[Int => String]
+ ^
+one error found
diff --git a/test/files/neg/t9527b.scala b/test/files/neg/t9527b.scala
new file mode 100644
index 0000000000..b40a4dca9e
--- /dev/null
+++ b/test/files/neg/t9527b.scala
@@ -0,0 +1,9 @@
+class C {
+ @annotation.implicitAmbiguous("msg A=${A}")
+ implicit def f[A](x: Int): String = "f was here"
+ implicit def g(x: Int): String = "f was here"
+ def test: Unit = {
+ implicitly[Int => String]
+ }
+}
+
diff --git a/test/files/neg/t9535.check b/test/files/neg/t9535.check
new file mode 100644
index 0000000000..5c3e3ea8e6
--- /dev/null
+++ b/test/files/neg/t9535.check
@@ -0,0 +1,7 @@
+t9535.scala:4: error: not found: type E1
+ @throws[E1] def f[E1 <: Exception] = 1
+ ^
+t9535.scala:6: error: class type required but E found
+ @throws(classOf[E]) def g: E = ??? // neg test: classOf requires class type
+ ^
+two errors found
diff --git a/test/files/neg/t9535.scala b/test/files/neg/t9535.scala
new file mode 100644
index 0000000000..37253804ce
--- /dev/null
+++ b/test/files/neg/t9535.scala
@@ -0,0 +1,7 @@
+class C[E <: Exception] {
+ // cannot be expressed in Scala (it's allowed in Java)
+ // https://issues.scala-lang.org/browse/SI-7066
+ @throws[E1] def f[E1 <: Exception] = 1
+
+ @throws(classOf[E]) def g: E = ??? // neg test: classOf requires class type
+}
diff --git a/test/files/neg/t9629.check b/test/files/neg/t9629.check
new file mode 100644
index 0000000000..4eafa84236
--- /dev/null
+++ b/test/files/neg/t9629.check
@@ -0,0 +1,17 @@
+t9629.scala:4: error: pattern must be a value: Option[Int]
+Note: if you intended to match against the class, try `case _: Option[_]`
+ case Option[Int] => // error was issued before
+ ^
+t9629.scala:5: error: pattern must be a value: Option[Int]
+Note: if you intended to match against the class, try `case _: Option[_]`
+ case Some(Option[Int]) => // error was skipped, patmat issued an internal error
+ ^
+t9629.scala:8: error: pattern must be a value: Option[Int]
+Note: if you intended to match against the class, try `case _: Option[_]`
+ case (_, Option[Int]) =>
+ ^
+t9629.scala:9: error: pattern must be a value: Option[Int]
+Note: if you intended to match against the class, try `case _: Option[_]`
+ case x @ (y @ Option[Int]) =>
+ ^
+four errors found
diff --git a/test/files/neg/t9629.scala b/test/files/neg/t9629.scala
new file mode 100644
index 0000000000..2be2b039f2
--- /dev/null
+++ b/test/files/neg/t9629.scala
@@ -0,0 +1,12 @@
+class Test {
+ def foo(a: Any) {
+ a match {
+ case Option[Int] => // error was issued before
+ case Some(Option[Int]) => // error was skipped, patmat issued an internal error
+
+ // variations
+ case (_, Option[Int]) =>
+ case x @ (y @ Option[Int]) =>
+ }
+ }
+}
diff --git a/test/files/neg/t963.check b/test/files/neg/t963.check
index 483e53c77d..85b64b0bb5 100644
--- a/test/files/neg/t963.check
+++ b/test/files/neg/t963.check
@@ -1,12 +1,12 @@
+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) }
+ ^
t963.scala:14: error: stable identifier required, but y3.x.type found.
val w3 : y3.x.type = y3.x
^
t963.scala:17: error: stable identifier required, but y4.x.type 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/test/files/neg/t9636.check b/test/files/neg/t9636.check
new file mode 100644
index 0000000000..f36d1d32b2
--- /dev/null
+++ b/test/files/neg/t9636.check
@@ -0,0 +1,6 @@
+t9636.scala:11: warning: a type was inferred to be `AnyVal`; this may indicate a programming error.
+ if (signature.sameElements(Array(0x1F, 0x8B))) {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t9636.flags b/test/files/neg/t9636.flags
new file mode 100644
index 0000000000..7949c2afa2
--- /dev/null
+++ b/test/files/neg/t9636.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings
diff --git a/test/files/neg/t9636.scala b/test/files/neg/t9636.scala
new file mode 100644
index 0000000000..7ad5fb3e9e
--- /dev/null
+++ b/test/files/neg/t9636.scala
@@ -0,0 +1,17 @@
+
+import java.io._
+import java.util.zip._
+
+class C {
+ def isWrapper(is: FileInputStream): InputStream = {
+ val pb = new PushbackInputStream(is, 2)
+ val signature = new Array[Byte](2)
+ pb.read(signature)
+ pb.unread(signature)
+ if (signature.sameElements(Array(0x1F, 0x8B))) {
+ new GZIPInputStream(new BufferedInputStream(pb))
+ } else {
+ pb
+ }
+ }
+}
diff --git a/test/files/neg/t9675.check b/test/files/neg/t9675.check
new file mode 100644
index 0000000000..255477499c
--- /dev/null
+++ b/test/files/neg/t9675.check
@@ -0,0 +1,27 @@
+t9675.scala:4: warning: comparing values of types Test.A and String using `!=' will always yield true
+ val func1 = (x: A) => { x != "x" }
+ ^
+t9675.scala:6: warning: comparing values of types Test.A and String using `!=' will always yield true
+ val func2 = (x: A) => { x != "x" }: Boolean
+ ^
+t9675.scala:8: warning: comparing values of types Test.A and String using `!=' will always yield true
+ val func3: Function1[A, Boolean] = (x) => { x != "x" }
+ ^
+t9675.scala:11: warning: comparing values of types Test.A and String using `!=' will always yield true
+ def apply(x: A): Boolean = { x != "x" }
+ ^
+t9675.scala:14: warning: comparing values of types Test.A and String using `!=' will always yield true
+ def method(x: A): Boolean = { x != "x" }
+ ^
+t9675.scala:18: warning: comparing values of types Test.A and String using `!=' will always yield true
+ A("x") != "x"
+ ^
+t9675.scala:20: warning: comparing values of types Test.A and String using `!=' will always yield true
+ val func5: Function1[A, Boolean] = (x) => { x != "x" }
+ ^
+t9675.scala:22: warning: comparing values of types Test.A and String using `!=' will always yield true
+ List(A("x")).foreach((item: A) => item != "x")
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+8 warnings found
+one error found
diff --git a/test/files/neg/t9675.flags b/test/files/neg/t9675.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t9675.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t9675.scala b/test/files/neg/t9675.scala
new file mode 100644
index 0000000000..f76b74b6ac
--- /dev/null
+++ b/test/files/neg/t9675.scala
@@ -0,0 +1,24 @@
+object Test {
+ case class A(x: String)
+
+ val func1 = (x: A) => { x != "x" }
+
+ val func2 = (x: A) => { x != "x" }: Boolean
+
+ val func3: Function1[A, Boolean] = (x) => { x != "x" }
+
+ val func4 = new Function1[A, Boolean] {
+ def apply(x: A): Boolean = { x != "x" }
+ }
+
+ def method(x: A): Boolean = { x != "x" }
+ case class PersonInfo(rankPayEtc: Unit)
+
+ def main(args: Array[String]) {
+ A("x") != "x"
+
+ val func5: Function1[A, Boolean] = (x) => { x != "x" }
+
+ List(A("x")).foreach((item: A) => item != "x")
+ }
+}
diff --git a/test/files/neg/t9684.check b/test/files/neg/t9684.check
new file mode 100644
index 0000000000..bb5669733d
--- /dev/null
+++ b/test/files/neg/t9684.check
@@ -0,0 +1,9 @@
+t9684.scala:6: warning: object JavaConversions in package collection is deprecated (since 2.12.0): use JavaConverters
+ null.asInstanceOf[java.util.List[Int]] : Buffer[Int]
+ ^
+t9684.scala:8: warning: object JavaConversions in package collection is deprecated (since 2.12.0): use JavaConverters
+ null.asInstanceOf[Iterable[Int]] : java.util.Collection[Int]
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/test/files/neg/t9684.flags b/test/files/neg/t9684.flags
new file mode 100644
index 0000000000..c6bfaf1f64
--- /dev/null
+++ b/test/files/neg/t9684.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/t9684.scala b/test/files/neg/t9684.scala
new file mode 100644
index 0000000000..f7ece269e6
--- /dev/null
+++ b/test/files/neg/t9684.scala
@@ -0,0 +1,9 @@
+
+import scala.collection.JavaConversions._
+import scala.collection.mutable.Buffer
+
+trait Test {
+ null.asInstanceOf[java.util.List[Int]] : Buffer[Int]
+
+ null.asInstanceOf[Iterable[Int]] : java.util.Collection[Int]
+}
diff --git a/test/files/neg/t9684b.check b/test/files/neg/t9684b.check
new file mode 100644
index 0000000000..5f328abd43
--- /dev/null
+++ b/test/files/neg/t9684b.check
@@ -0,0 +1,7 @@
+t9684b.scala:6: error: reference to asScalaIterator is ambiguous;
+it is imported twice in the same scope by
+import scala.collection.JavaConversions._
+and import scala.collection.JavaConverters._
+ asScalaIterator(null) // fails: asScalaIterator is imported twice.
+ ^
+one error found
diff --git a/test/files/neg/t9684b.scala b/test/files/neg/t9684b.scala
new file mode 100644
index 0000000000..010e9d1b5d
--- /dev/null
+++ b/test/files/neg/t9684b.scala
@@ -0,0 +1,14 @@
+trait T1 {
+ import scala.collection.JavaConverters._
+ import scala.collection.JavaConversions._
+
+ null.asInstanceOf[java.util.Iterator[String]]: Iterator[String] // works
+ asScalaIterator(null) // fails: asScalaIterator is imported twice.
+}
+
+trait T2 {
+ import scala.collection.JavaConversions.asScalaIterator
+
+ null.asInstanceOf[java.util.Iterator[String]]: Iterator[String] // works
+ asScalaIterator(null) // works
+}
diff --git a/test/files/neg/t9781.check b/test/files/neg/t9781.check
new file mode 100644
index 0000000000..422c51013a
--- /dev/null
+++ b/test/files/neg/t9781.check
@@ -0,0 +1,4 @@
+t9781.scala:3: error: not found: value undefinedSymbol
+ c(undefinedSymbol) += 1
+ ^
+one error found
diff --git a/test/files/neg/t9781.scala b/test/files/neg/t9781.scala
new file mode 100644
index 0000000000..70234dcca5
--- /dev/null
+++ b/test/files/neg/t9781.scala
@@ -0,0 +1,4 @@
+object T9781 {
+ val c: collection.mutable.Map[Int, Int] = ???
+ c(undefinedSymbol) += 1
+}
diff --git a/test/files/neg/t9847.check b/test/files/neg/t9847.check
new file mode 100644
index 0000000000..e55109b3ef
--- /dev/null
+++ b/test/files/neg/t9847.check
@@ -0,0 +1,45 @@
+t9847.scala:4: warning: discarded non-Unit value
+ def f(): Unit = 42
+ ^
+t9847.scala:4: warning: a pure expression does nothing in statement position
+ def f(): Unit = 42
+ ^
+t9847.scala:5: warning: discarded non-Unit value
+ def g = (42: Unit)
+ ^
+t9847.scala:5: warning: a pure expression does nothing in statement position
+ def g = (42: Unit)
+ ^
+t9847.scala:7: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
+ 1
+ ^
+t9847.scala:12: warning: discarded non-Unit value
+ + 1
+ ^
+t9847.scala:12: warning: a pure expression does nothing in statement position
+ + 1
+ ^
+t9847.scala:11: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
+ 1
+ ^
+t9847.scala:12: warning: multiline expressions might require enclosing parentheses; a value can be silently discarded when Unit is expected
+ + 1
+ ^
+t9847.scala:16: warning: discarded non-Unit value
+ x + 1
+ ^
+t9847.scala:19: warning: discarded non-Unit value
+ def j(): Unit = x + 1
+ ^
+t9847.scala:21: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
+ class C { 42 }
+ ^
+t9847.scala:22: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
+ class D { 42 ; 17 }
+ ^
+t9847.scala:22: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
+ class D { 42 ; 17 }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+14 warnings found
+one error found
diff --git a/test/files/neg/t9847.flags b/test/files/neg/t9847.flags
new file mode 100644
index 0000000000..065e3ca61e
--- /dev/null
+++ b/test/files/neg/t9847.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Ywarn-value-discard
diff --git a/test/files/neg/t9847.scala b/test/files/neg/t9847.scala
new file mode 100644
index 0000000000..51c16d815f
--- /dev/null
+++ b/test/files/neg/t9847.scala
@@ -0,0 +1,23 @@
+
+trait T {
+
+ def f(): Unit = 42
+ def g = (42: Unit)
+ def h = {
+ 1
+ + 1
+ }
+ def hh(): Unit = {
+ 1
+ + 1
+ }
+ def i(): Unit = {
+ val x = 1
+ x + 1
+ }
+ def x = 42
+ def j(): Unit = x + 1
+
+ class C { 42 }
+ class D { 42 ; 17 }
+}
diff --git a/test/files/neg/t9849.check b/test/files/neg/t9849.check
new file mode 100644
index 0000000000..7b47150846
--- /dev/null
+++ b/test/files/neg/t9849.check
@@ -0,0 +1,7 @@
+t9849.scala:14: error: method h in object O cannot be accessed in object p.O
+ O.h()
+ ^
+t9849.scala:15: error: method h$default$1 in object O cannot be accessed in object p.O
+ O.h$default$1
+ ^
+two errors found
diff --git a/test/files/neg/t9849.scala b/test/files/neg/t9849.scala
new file mode 100644
index 0000000000..bcd18b6916
--- /dev/null
+++ b/test/files/neg/t9849.scala
@@ -0,0 +1,16 @@
+package p
+
+object O {
+ protected[p] def f(x: Int = 1) = x
+ private[p] def g(x: Int = 1) = x
+ private def h(x: Int = 1) = x
+}
+
+object Test {
+ O.f()
+ O.f$default$1
+ O.g()
+ O.g$default$1
+ O.h()
+ O.h$default$1
+}
diff --git a/test/files/neg/t9953.check b/test/files/neg/t9953.check
new file mode 100644
index 0000000000..f5dcbcacee
--- /dev/null
+++ b/test/files/neg/t9953.check
@@ -0,0 +1,6 @@
+t9953.scala:10: warning: Object and X are unrelated: they will never compare equal
+ def b = y == x // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t9953.flags b/test/files/neg/t9953.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t9953.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t9953.scala b/test/files/neg/t9953.scala
new file mode 100644
index 0000000000..faaee86d50
--- /dev/null
+++ b/test/files/neg/t9953.scala
@@ -0,0 +1,13 @@
+
+class X(val v: Int) extends AnyVal
+trait T extends Any
+object Y extends T
+
+class C {
+ val x = new X(42)
+ val y = new Object
+ val a: T = null
+ def b = y == x // warn
+ def c = y == a // no warn
+ def d = Y == a // no warn
+}
diff --git a/test/files/neg/trailing-commas.check b/test/files/neg/trailing-commas.check
new file mode 100644
index 0000000000..e2677dc3f5
--- /dev/null
+++ b/test/files/neg/trailing-commas.check
@@ -0,0 +1,130 @@
+trailing-commas.scala:10: error: illegal start of simple expression
+trait ArgumentExprs1 { f(23, "bar", )(Ev0, Ev1) }
+ ^
+trailing-commas.scala:10: error: ')' expected but '}' found.
+trait ArgumentExprs1 { f(23, "bar", )(Ev0, Ev1) }
+ ^
+trailing-commas.scala:11: error: illegal start of simple expression
+trait ArgumentExprs2 { f(23, "bar")(Ev0, Ev1, ) }
+ ^
+trailing-commas.scala:11: error: ')' expected but '}' found.
+trait ArgumentExprs2 { f(23, "bar")(Ev0, Ev1, ) }
+ ^
+trailing-commas.scala:12: error: illegal start of simple expression
+trait ArgumentExprs3 { new C(23, "bar", )(Ev0, Ev1) }
+ ^
+trailing-commas.scala:12: error: ')' expected but '}' found.
+trait ArgumentExprs3 { new C(23, "bar", )(Ev0, Ev1) }
+ ^
+trailing-commas.scala:13: error: illegal start of simple expression
+trait ArgumentExprs4 { new C(23, "bar")(Ev0, Ev1, ) }
+ ^
+trailing-commas.scala:13: error: ')' expected but '}' found.
+trait ArgumentExprs4 { new C(23, "bar")(Ev0, Ev1, ) }
+ ^
+trailing-commas.scala:15: error: identifier expected but ')' found.
+trait Params1 { def f(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1, ) = 1 }
+ ^
+trailing-commas.scala:15: error: ':' expected but '}' found.
+trait Params1 { def f(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1, ) = 1 }
+ ^
+trailing-commas.scala:16: error: identifier expected but ')' found.
+trait Params2 { def f(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1, ) = 1 }
+ ^
+trailing-commas.scala:16: error: ':' expected but '}' found.
+trait Params2 { def f(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1, ) = 1 }
+ ^
+trailing-commas.scala:17: error: identifier expected but ')' found.
+trait ClassParams1 { final class C(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1) }
+ ^
+trailing-commas.scala:17: error: ':' expected but '}' found.
+trait ClassParams1 { final class C(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1) }
+ ^
+trailing-commas.scala:18: error: identifier expected but ')' found.
+trait ClassParams2 { final class C(foo: Int, bar: String)(implicit ev0: Ev0, ev1: Ev1, ) }
+ ^
+trailing-commas.scala:18: error: ':' expected but '}' found.
+trait ClassParams2 { final class C(foo: Int, bar: String)(implicit ev0: Ev0, ev1: Ev1, ) }
+ ^
+trailing-commas.scala:20: error: illegal start of simple expression
+trait SimpleExpr { (23, "bar", ) }
+ ^
+trailing-commas.scala:20: error: ')' expected but '}' found.
+trait SimpleExpr { (23, "bar", ) }
+ ^
+trailing-commas.scala:22: error: identifier expected but ']' found.
+trait TypeArgs { def f: C[Int, String, ] }
+ ^
+trailing-commas.scala:22: error: ']' expected but '}' found.
+trait TypeArgs { def f: C[Int, String, ] }
+ ^
+trailing-commas.scala:23: error: identifier expected but ']' found.
+trait TypeParamClause { type C[A, B, ] }
+ ^
+trailing-commas.scala:23: error: ']' expected but '}' found.
+trait TypeParamClause { type C[A, B, ] }
+ ^
+trailing-commas.scala:24: error: identifier expected but ']' found.
+trait FunTypeParamClause { def f[A, B, ] }
+ ^
+trailing-commas.scala:24: error: ']' expected but '}' found.
+trait FunTypeParamClause { def f[A, B, ] }
+ ^
+trailing-commas.scala:26: error: identifier expected but ')' found.
+trait SimpleType { def f: (Int, String, ) }
+ ^
+trailing-commas.scala:26: error: ')' expected but '}' found.
+trait SimpleType { def f: (Int, String, ) }
+ ^
+trailing-commas.scala:27: error: identifier expected but ')' found.
+trait FunctionArgTypes { def f: (Int, String, ) => Boolean }
+ ^
+trailing-commas.scala:27: error: ')' expected but '}' found.
+trait FunctionArgTypes { def f: (Int, String, ) => Boolean }
+ ^
+trailing-commas.scala:29: error: illegal start of simple pattern
+trait SimplePattern { val (foo, bar, ) = null: Any }
+ ^
+trailing-commas.scala:31: error: identifier expected but '}' found.
+trait ImportSelectors { import foo.{ Ev0, Ev1, } }
+ ^
+trailing-commas.scala:33: error: identifier expected but '}' found.
+trait Import { import foo.Ev0, foo.Ev1, }
+ ^
+trailing-commas.scala:35: error: illegal start of simple pattern
+trait ValDcl { val foo, bar, = 23 }
+ ^
+trailing-commas.scala:35: error: '=' expected but '}' found.
+trait ValDcl { val foo, bar, = 23 }
+ ^
+trailing-commas.scala:36: error: illegal start of simple pattern
+trait VarDcl { var foo, bar, = 23 }
+ ^
+trailing-commas.scala:36: error: '=' expected but '}' found.
+trait VarDcl { var foo, bar, = 23 }
+ ^
+trailing-commas.scala:37: error: illegal start of simple pattern
+trait VarDef { var foo, bar, = _ }
+ ^
+trailing-commas.scala:37: error: '=' expected but '}' found.
+trait VarDef { var foo, bar, = _ }
+ ^
+trailing-commas.scala:38: error: illegal start of simple pattern
+trait PatDef { val Foo(foo), Bar(bar), = bippy }
+ ^
+trailing-commas.scala:38: error: '=' expected but '}' found.
+trait PatDef { val Foo(foo), Bar(bar), = bippy }
+ ^
+trailing-commas.scala:45: error: illegal start of simple expression
+trait SimpleExpr2 { (23, ) }
+ ^
+trailing-commas.scala:45: error: ')' expected but '}' found.
+trait SimpleExpr2 { (23, ) }
+ ^
+trailing-commas.scala:48: error: identifier expected but ')' found.
+trait SimpleType2 { def f: (Int, ) }
+ ^
+trailing-commas.scala:48: error: ')' expected but '}' found.
+trait SimpleType2 { def f: (Int, ) }
+ ^
+43 errors found
diff --git a/test/files/neg/trailing-commas.scala b/test/files/neg/trailing-commas.scala
new file mode 100644
index 0000000000..a873cb1e39
--- /dev/null
+++ b/test/files/neg/trailing-commas.scala
@@ -0,0 +1,56 @@
+package foo
+
+// Note: Using traits to get distinct errors
+// (instead of sharing one single "')' expected but '}' found." at the end)
+
+
+
+//// Multi-line only cases: make sure trailing commas are only supported when multi-line
+
+trait ArgumentExprs1 { f(23, "bar", )(Ev0, Ev1) }
+trait ArgumentExprs2 { f(23, "bar")(Ev0, Ev1, ) }
+trait ArgumentExprs3 { new C(23, "bar", )(Ev0, Ev1) }
+trait ArgumentExprs4 { new C(23, "bar")(Ev0, Ev1, ) }
+
+trait Params1 { def f(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1, ) = 1 }
+trait Params2 { def f(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1, ) = 1 }
+trait ClassParams1 { final class C(foo: Int, bar: String, )(implicit ev0: Ev0, ev1: Ev1) }
+trait ClassParams2 { final class C(foo: Int, bar: String)(implicit ev0: Ev0, ev1: Ev1, ) }
+
+trait SimpleExpr { (23, "bar", ) }
+
+trait TypeArgs { def f: C[Int, String, ] }
+trait TypeParamClause { type C[A, B, ] }
+trait FunTypeParamClause { def f[A, B, ] }
+
+trait SimpleType { def f: (Int, String, ) }
+trait FunctionArgTypes { def f: (Int, String, ) => Boolean }
+
+trait SimplePattern { val (foo, bar, ) = null: Any }
+
+trait ImportSelectors { import foo.{ Ev0, Ev1, } }
+
+trait Import { import foo.Ev0, foo.Ev1, }
+
+trait ValDcl { val foo, bar, = 23 }
+trait VarDcl { var foo, bar, = 23 }
+trait VarDef { var foo, bar, = _ }
+trait PatDef { val Foo(foo), Bar(bar), = bippy }
+
+
+
+//// The Tuple 1 cases
+
+// the Tuple1 value case: make sure that the possible "(23, )" syntax for Tuple1 doesn't compile to "23"
+trait SimpleExpr2 { (23, ) }
+
+// the Tuple1 type case: make sure that the possible "(Int, )" syntax for Tuple1[Int] doesn't compile to "Int"
+trait SimpleType2 { def f: (Int, ) }
+
+
+
+//// Test utilities
+object `package` {
+ sealed trait Ev0; implicit object Ev0 extends Ev0
+ sealed trait Ev1; implicit object Ev1 extends Ev1
+}
diff --git a/test/files/neg/trait-defaults-super.check b/test/files/neg/trait-defaults-super.check
new file mode 100644
index 0000000000..2b19402828
--- /dev/null
+++ b/test/files/neg/trait-defaults-super.check
@@ -0,0 +1,4 @@
+trait-defaults-super.scala:14: error: Unable to implement a super accessor required by trait T unless Iterable[String] is directly extended by class C.
+class C extends T
+ ^
+one error found
diff --git a/test/files/neg/trait-defaults-super.scala b/test/files/neg/trait-defaults-super.scala
new file mode 100644
index 0000000000..def271e8e7
--- /dev/null
+++ b/test/files/neg/trait-defaults-super.scala
@@ -0,0 +1,21 @@
+trait T extends java.lang.Iterable[String] {
+
+ override def spliterator(): java.util.Spliterator[String] = {
+ super[Iterable].spliterator
+ super.spliterator
+ null
+ }
+ def foo = {
+ super[Iterable].spliterator
+ super.spliterator
+ }
+ def iterator(): java.util.Iterator[String] = java.util.Collections.emptyList().iterator()
+}
+class C extends T
+object Test {
+ def main(args: Array[String]): Unit = {
+ val t: T = new C
+ t.spliterator
+ t.foo
+ }
+}
diff --git a/test/files/neg/trait-no-native.check b/test/files/neg/trait-no-native.check
new file mode 100644
index 0000000000..12bce4042d
--- /dev/null
+++ b/test/files/neg/trait-no-native.check
@@ -0,0 +1,4 @@
+trait-no-native.scala:3: error: A trait cannot define a native method.
+ @native def foo = ???
+ ^
+one error found
diff --git a/test/files/neg/trait-no-native.scala b/test/files/neg/trait-no-native.scala
new file mode 100644
index 0000000000..463e604a48
--- /dev/null
+++ b/test/files/neg/trait-no-native.scala
@@ -0,0 +1,4 @@
+trait T {
+ // should not compile, because it would result in a VerifyError
+ @native def foo = ???
+}
diff --git a/test/files/neg/trait_fields_conflicts.check b/test/files/neg/trait_fields_conflicts.check
new file mode 100644
index 0000000000..696d0284c1
--- /dev/null
+++ b/test/files/neg/trait_fields_conflicts.check
@@ -0,0 +1,273 @@
+trait_fields_conflicts.scala:5: error: overriding value x in trait Val of type Int;
+ value x needs `override' modifier
+trait ValForVal extends Val { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:6: error: overriding value x in trait Val of type Int;
+ variable x needs `override' modifier
+trait VarForVal extends Val { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:7: error: overriding value x in trait Val of type Int;
+ method x needs `override' modifier
+trait DefForVal extends Val { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:8: error: overriding variable x in trait Var of type Int;
+ value x needs `override' modifier
+trait ValForVar extends Var { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:9: error: overriding variable x in trait Var of type Int;
+ variable x needs `override' modifier
+trait VarForVar extends Var { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:10: error: overriding variable x in trait Var of type Int;
+ method x needs `override' modifier
+trait DefForVar extends Var { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:11: error: overriding lazy value x in trait Lazy of type Int;
+ value x needs `override' modifier
+trait ValForLazy extends Lazy { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:12: error: overriding lazy value x in trait Lazy of type Int;
+ variable x needs `override' modifier
+trait VarForLazy extends Lazy { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:13: error: overriding lazy value x in trait Lazy of type Int;
+ method x needs `override' modifier
+trait DefForLazy extends Lazy { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:16: error: overriding value x in trait Val of type Int;
+ variable x needs to be a stable, immutable value
+trait VarForValOvr extends Val { override var x: Int = 1 } // bad override
+ ^
+trait_fields_conflicts.scala:17: error: overriding value x in trait Val of type Int;
+ method x needs to be a stable, immutable value
+trait DefForValOvr extends Val { override def x: Int = 1 } // bad override
+ ^
+trait_fields_conflicts.scala:18: error: overriding variable x in trait Var of type Int;
+ value x cannot override a mutable variable
+trait ValForVarOvr extends Var { override val x: Int = 1 } // bad override -- unsound if used in path and var changes
+ ^
+trait_fields_conflicts.scala:19: error: overriding variable x in trait Var of type Int;
+ variable x cannot override a mutable variable
+trait VarForVarOvr extends Var { override var x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:20: error: overriding variable x in trait Var of type Int;
+ method x cannot override a mutable variable
+trait DefForVarOvr extends Var { override def x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:21: error: overriding lazy value x in trait Lazy of type Int;
+ value x must be declared lazy to override a concrete lazy value
+trait ValForLazyOvr extends Lazy { override val x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:22: error: overriding lazy value x in trait Lazy of type Int;
+ variable x needs to be a stable, immutable value
+trait VarForLazyOvr extends Lazy { override var x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:23: error: overriding lazy value x in trait Lazy of type Int;
+ method x needs to be a stable, immutable value
+trait DefForLazyOvr extends Lazy { override def x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:25: error: overriding value x in trait Val of type Int;
+ value x needs `override' modifier
+class CValForVal extends Val { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:26: error: overriding value x in trait Val of type Int;
+ variable x needs `override' modifier
+class CVarForVal extends Val { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:27: error: overriding value x in trait Val of type Int;
+ method x needs `override' modifier
+class CDefForVal extends Val { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:28: error: overriding variable x in trait Var of type Int;
+ value x needs `override' modifier
+class CValForVar extends Var { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:29: error: overriding variable x in trait Var of type Int;
+ variable x needs `override' modifier
+class CVarForVar extends Var { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:30: error: overriding variable x in trait Var of type Int;
+ method x needs `override' modifier
+class CDefForVar extends Var { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:31: error: overriding lazy value x in trait Lazy of type Int;
+ value x needs `override' modifier
+class CValForLazy extends Lazy { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:32: error: overriding lazy value x in trait Lazy of type Int;
+ variable x needs `override' modifier
+class CVarForLazy extends Lazy { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:33: error: overriding lazy value x in trait Lazy of type Int;
+ method x needs `override' modifier
+class CDefForLazy extends Lazy { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:36: error: overriding value x in trait Val of type Int;
+ variable x needs to be a stable, immutable value
+class CVarForValOvr extends Val { override var x: Int = 1 } // bad override
+ ^
+trait_fields_conflicts.scala:37: error: overriding value x in trait Val of type Int;
+ method x needs to be a stable, immutable value
+class CDefForValOvr extends Val { override def x: Int = 1 } // bad override
+ ^
+trait_fields_conflicts.scala:38: error: overriding variable x in trait Var of type Int;
+ value x cannot override a mutable variable
+class CValForVarOvr extends Var { override val x: Int = 1 } // bad override -- unsound if used in path and var changes
+ ^
+trait_fields_conflicts.scala:39: error: overriding variable x in trait Var of type Int;
+ variable x cannot override a mutable variable
+class CVarForVarOvr extends Var { override var x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:40: error: overriding variable x in trait Var of type Int;
+ method x cannot override a mutable variable
+class CDefForVarOvr extends Var { override def x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:41: error: overriding lazy value x in trait Lazy of type Int;
+ value x must be declared lazy to override a concrete lazy value
+class CValForLazyOvr extends Lazy { override val x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:42: error: overriding lazy value x in trait Lazy of type Int;
+ variable x needs to be a stable, immutable value
+class CVarForLazyOvr extends Lazy { override var x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:43: error: overriding lazy value x in trait Lazy of type Int;
+ method x needs to be a stable, immutable value
+class CDefForLazyOvr extends Lazy { override def x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:49: error: overriding value x in class CVal of type Int;
+ value x needs `override' modifier
+trait ValForCVal extends CVal { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:50: error: overriding value x in class CVal of type Int;
+ variable x needs `override' modifier
+trait VarForCVal extends CVal { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:51: error: overriding value x in class CVal of type Int;
+ method x needs `override' modifier
+trait DefForCVal extends CVal { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:52: error: overriding variable x in class CVar of type Int;
+ value x needs `override' modifier
+trait ValForCVar extends CVar { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:53: error: overriding variable x in class CVar of type Int;
+ variable x needs `override' modifier
+trait VarForCVar extends CVar { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:54: error: overriding variable x in class CVar of type Int;
+ method x needs `override' modifier
+trait DefForCVar extends CVar { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:55: error: overriding lazy value x in class CLazy of type Int;
+ value x needs `override' modifier
+trait ValForCLazy extends CLazy { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:56: error: overriding lazy value x in class CLazy of type Int;
+ variable x needs `override' modifier
+trait VarForCLazy extends CLazy { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:57: error: overriding lazy value x in class CLazy of type Int;
+ method x needs `override' modifier
+trait DefForCLazy extends CLazy { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:60: error: overriding value x in class CVal of type Int;
+ variable x needs to be a stable, immutable value
+trait VarForCValOvr extends CVal { override var x: Int = 1 } // bad override
+ ^
+trait_fields_conflicts.scala:61: error: overriding value x in class CVal of type Int;
+ method x needs to be a stable, immutable value
+trait DefForCValOvr extends CVal { override def x: Int = 1 } // bad override
+ ^
+trait_fields_conflicts.scala:62: error: overriding variable x in class CVar of type Int;
+ value x cannot override a mutable variable
+trait ValForCVarOvr extends CVar { override val x: Int = 1 } // bad override -- unsound if used in path and var changes
+ ^
+trait_fields_conflicts.scala:63: error: overriding variable x in class CVar of type Int;
+ variable x cannot override a mutable variable
+trait VarForCVarOvr extends CVar { override var x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:64: error: overriding variable x in class CVar of type Int;
+ method x cannot override a mutable variable
+trait DefForCVarOvr extends CVar { override def x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:65: error: overriding lazy value x in class CLazy of type Int;
+ value x must be declared lazy to override a concrete lazy value
+trait ValForCLazyOvr extends CLazy { override val x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:66: error: overriding lazy value x in class CLazy of type Int;
+ variable x needs to be a stable, immutable value
+trait VarForCLazyOvr extends CLazy { override var x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:67: error: overriding lazy value x in class CLazy of type Int;
+ method x needs to be a stable, immutable value
+trait DefForCLazyOvr extends CLazy { override def x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:69: error: overriding value x in class CVal of type Int;
+ value x needs `override' modifier
+class CValForCVal extends CVal { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:70: error: overriding value x in class CVal of type Int;
+ variable x needs `override' modifier
+class CVarForCVal extends CVal { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:71: error: overriding value x in class CVal of type Int;
+ method x needs `override' modifier
+class CDefForCVal extends CVal { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:72: error: overriding variable x in class CVar of type Int;
+ value x needs `override' modifier
+class CValForCVar extends CVar { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:73: error: overriding variable x in class CVar of type Int;
+ variable x needs `override' modifier
+class CVarForCVar extends CVar { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:74: error: overriding variable x in class CVar of type Int;
+ method x needs `override' modifier
+class CDefForCVar extends CVar { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:75: error: overriding lazy value x in class CLazy of type Int;
+ value x needs `override' modifier
+class CValForCLazy extends CLazy { val x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:76: error: overriding lazy value x in class CLazy of type Int;
+ variable x needs `override' modifier
+class CVarForCLazy extends CLazy { var x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:77: error: overriding lazy value x in class CLazy of type Int;
+ method x needs `override' modifier
+class CDefForCLazy extends CLazy { def x: Int = 1 } // needs override
+ ^
+trait_fields_conflicts.scala:80: error: overriding value x in class CVal of type Int;
+ variable x needs to be a stable, immutable value
+class CVarForCValOvr extends CVal { override var x: Int = 1 } // bad override
+ ^
+trait_fields_conflicts.scala:81: error: overriding value x in class CVal of type Int;
+ method x needs to be a stable, immutable value
+class CDefForCValOvr extends CVal { override def x: Int = 1 } // bad override
+ ^
+trait_fields_conflicts.scala:82: error: overriding variable x in class CVar of type Int;
+ value x cannot override a mutable variable
+class CValForCVarOvr extends CVar { override val x: Int = 1 } // bad override -- unsound if used in path and var changes
+ ^
+trait_fields_conflicts.scala:83: error: overriding variable x in class CVar of type Int;
+ variable x cannot override a mutable variable
+class CVarForCVarOvr extends CVar { override var x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:84: error: overriding variable x in class CVar of type Int;
+ method x cannot override a mutable variable
+class CDefForCVarOvr extends CVar { override def x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:85: error: overriding lazy value x in class CLazy of type Int;
+ value x must be declared lazy to override a concrete lazy value
+class CValForCLazyOvr extends CLazy { override val x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:86: error: overriding lazy value x in class CLazy of type Int;
+ variable x needs to be a stable, immutable value
+class CVarForCLazyOvr extends CLazy { override var x: Int = 1 } // bad override -- why?
+ ^
+trait_fields_conflicts.scala:87: error: overriding lazy value x in class CLazy of type Int;
+ method x needs to be a stable, immutable value
+class CDefForCLazyOvr extends CLazy { override def x: Int = 1 } // bad override -- why?
+ ^
+68 errors found
diff --git a/test/files/neg/trait_fields_conflicts.scala b/test/files/neg/trait_fields_conflicts.scala
new file mode 100644
index 0000000000..92fc106e44
--- /dev/null
+++ b/test/files/neg/trait_fields_conflicts.scala
@@ -0,0 +1,87 @@
+trait Val { val x: Int = 123 }
+trait Var { var x: Int = 123 }
+trait Lazy { lazy val x: Int = 123 }
+
+trait ValForVal extends Val { val x: Int = 1 } // needs override
+trait VarForVal extends Val { var x: Int = 1 } // needs override
+trait DefForVal extends Val { def x: Int = 1 } // needs override
+trait ValForVar extends Var { val x: Int = 1 } // needs override
+trait VarForVar extends Var { var x: Int = 1 } // needs override
+trait DefForVar extends Var { def x: Int = 1 } // needs override
+trait ValForLazy extends Lazy { val x: Int = 1 } // needs override
+trait VarForLazy extends Lazy { var x: Int = 1 } // needs override
+trait DefForLazy extends Lazy { def x: Int = 1 } // needs override
+
+trait ValForValOvr extends Val { override val x: Int = 1 } // override ok
+trait VarForValOvr extends Val { override var x: Int = 1 } // bad override
+trait DefForValOvr extends Val { override def x: Int = 1 } // bad override
+trait ValForVarOvr extends Var { override val x: Int = 1 } // bad override -- unsound if used in path and var changes
+trait VarForVarOvr extends Var { override var x: Int = 1 } // bad override -- why?
+trait DefForVarOvr extends Var { override def x: Int = 1 } // bad override -- why?
+trait ValForLazyOvr extends Lazy { override val x: Int = 1 } // bad override -- why?
+trait VarForLazyOvr extends Lazy { override var x: Int = 1 } // bad override -- why?
+trait DefForLazyOvr extends Lazy { override def x: Int = 1 } // bad override -- why?
+
+class CValForVal extends Val { val x: Int = 1 } // needs override
+class CVarForVal extends Val { var x: Int = 1 } // needs override
+class CDefForVal extends Val { def x: Int = 1 } // needs override
+class CValForVar extends Var { val x: Int = 1 } // needs override
+class CVarForVar extends Var { var x: Int = 1 } // needs override
+class CDefForVar extends Var { def x: Int = 1 } // needs override
+class CValForLazy extends Lazy { val x: Int = 1 } // needs override
+class CVarForLazy extends Lazy { var x: Int = 1 } // needs override
+class CDefForLazy extends Lazy { def x: Int = 1 } // needs override
+
+class CValForValOvr extends Val { override val x: Int = 1 } // override ok
+class CVarForValOvr extends Val { override var x: Int = 1 } // bad override
+class CDefForValOvr extends Val { override def x: Int = 1 } // bad override
+class CValForVarOvr extends Var { override val x: Int = 1 } // bad override -- unsound if used in path and var changes
+class CVarForVarOvr extends Var { override var x: Int = 1 } // bad override -- why?
+class CDefForVarOvr extends Var { override def x: Int = 1 } // bad override -- why?
+class CValForLazyOvr extends Lazy { override val x: Int = 1 } // bad override -- why?
+class CVarForLazyOvr extends Lazy { override var x: Int = 1 } // bad override -- why?
+class CDefForLazyOvr extends Lazy { override def x: Int = 1 } // bad override -- why?
+
+class CVal { val x: Int = 123 }
+class CVar { var x: Int = 123 }
+class CLazy { lazy val x: Int = 123 }
+
+trait ValForCVal extends CVal { val x: Int = 1 } // needs override
+trait VarForCVal extends CVal { var x: Int = 1 } // needs override
+trait DefForCVal extends CVal { def x: Int = 1 } // needs override
+trait ValForCVar extends CVar { val x: Int = 1 } // needs override
+trait VarForCVar extends CVar { var x: Int = 1 } // needs override
+trait DefForCVar extends CVar { def x: Int = 1 } // needs override
+trait ValForCLazy extends CLazy { val x: Int = 1 } // needs override
+trait VarForCLazy extends CLazy { var x: Int = 1 } // needs override
+trait DefForCLazy extends CLazy { def x: Int = 1 } // needs override
+
+trait ValForCValOvr extends CVal { override val x: Int = 1 } // override ok
+trait VarForCValOvr extends CVal { override var x: Int = 1 } // bad override
+trait DefForCValOvr extends CVal { override def x: Int = 1 } // bad override
+trait ValForCVarOvr extends CVar { override val x: Int = 1 } // bad override -- unsound if used in path and var changes
+trait VarForCVarOvr extends CVar { override var x: Int = 1 } // bad override -- why?
+trait DefForCVarOvr extends CVar { override def x: Int = 1 } // bad override -- why?
+trait ValForCLazyOvr extends CLazy { override val x: Int = 1 } // bad override -- why?
+trait VarForCLazyOvr extends CLazy { override var x: Int = 1 } // bad override -- why?
+trait DefForCLazyOvr extends CLazy { override def x: Int = 1 } // bad override -- why?
+
+class CValForCVal extends CVal { val x: Int = 1 } // needs override
+class CVarForCVal extends CVal { var x: Int = 1 } // needs override
+class CDefForCVal extends CVal { def x: Int = 1 } // needs override
+class CValForCVar extends CVar { val x: Int = 1 } // needs override
+class CVarForCVar extends CVar { var x: Int = 1 } // needs override
+class CDefForCVar extends CVar { def x: Int = 1 } // needs override
+class CValForCLazy extends CLazy { val x: Int = 1 } // needs override
+class CVarForCLazy extends CLazy { var x: Int = 1 } // needs override
+class CDefForCLazy extends CLazy { def x: Int = 1 } // needs override
+
+class CValForCValOvr extends CVal { override val x: Int = 1 } // override ok
+class CVarForCValOvr extends CVal { override var x: Int = 1 } // bad override
+class CDefForCValOvr extends CVal { override def x: Int = 1 } // bad override
+class CValForCVarOvr extends CVar { override val x: Int = 1 } // bad override -- unsound if used in path and var changes
+class CVarForCVarOvr extends CVar { override var x: Int = 1 } // bad override -- why?
+class CDefForCVarOvr extends CVar { override def x: Int = 1 } // bad override -- why?
+class CValForCLazyOvr extends CLazy { override val x: Int = 1 } // bad override -- why?
+class CVarForCLazyOvr extends CLazy { override var x: Int = 1 } // bad override -- why?
+class CDefForCLazyOvr extends CLazy { override def x: Int = 1 } // bad override -- why?
diff --git a/test/files/neg/trait_fields_deprecated_overriding.check b/test/files/neg/trait_fields_deprecated_overriding.check
new file mode 100644
index 0000000000..89dfa5c295
--- /dev/null
+++ b/test/files/neg/trait_fields_deprecated_overriding.check
@@ -0,0 +1,6 @@
+trait_fields_deprecated_overriding.scala:8: warning: overriding value x in trait DeprecatedOverriding is deprecated
+ override val x = 2
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/trait_fields_deprecated_overriding.flags b/test/files/neg/trait_fields_deprecated_overriding.flags
new file mode 100644
index 0000000000..c6bfaf1f64
--- /dev/null
+++ b/test/files/neg/trait_fields_deprecated_overriding.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/trait_fields_deprecated_overriding.scala b/test/files/neg/trait_fields_deprecated_overriding.scala
new file mode 100644
index 0000000000..e7d722c92f
--- /dev/null
+++ b/test/files/neg/trait_fields_deprecated_overriding.scala
@@ -0,0 +1,11 @@
+package scala
+
+trait DeprecatedOverriding {
+ @deprecatedOverriding val x = 1
+}
+
+class COverride extends DeprecatedOverriding {
+ override val x = 2
+}
+
+class CSynthImpl extends DeprecatedOverriding \ No newline at end of file
diff --git a/test/files/neg/trait_fields_var_override.check b/test/files/neg/trait_fields_var_override.check
new file mode 100644
index 0000000000..7245c78b09
--- /dev/null
+++ b/test/files/neg/trait_fields_var_override.check
@@ -0,0 +1,5 @@
+trait_fields_var_override.scala:2: error: overriding variable end in trait SizeChangeEvent of type Int;
+ variable end cannot override a mutable variable
+class BackedUpListIterator[E](override protected var end: Int) extends SizeChangeEvent
+ ^
+one error found
diff --git a/test/files/neg/trait_fields_var_override.scala b/test/files/neg/trait_fields_var_override.scala
new file mode 100644
index 0000000000..f61ba09eec
--- /dev/null
+++ b/test/files/neg/trait_fields_var_override.scala
@@ -0,0 +1,2 @@
+trait SizeChangeEvent { protected var end: Int = 1 }
+class BackedUpListIterator[E](override protected var end: Int) extends SizeChangeEvent
diff --git a/test/files/neg/type-diagnostics.check b/test/files/neg/type-diagnostics.check
index c5e6dec3f8..fd327bcb66 100644
--- a/test/files/neg/type-diagnostics.check
+++ b/test/files/neg/type-diagnostics.check
@@ -1,6 +1,6 @@
type-diagnostics.scala:4: error: type mismatch;
- found : scala.collection.Set[String]
- required: scala.collection.immutable.Set[String]
+ found : Set[String] (in scala.collection)
+ required: Set[String] (in scala.collection.immutable)
def f = Calculator("Hello", binding.keySet: collection.Set[String])
^
type-diagnostics.scala:13: error: type mismatch;
diff --git a/test/files/neg/unit-returns-value.check b/test/files/neg/unit-returns-value.check
index f30a506ebe..7ebfbfde29 100644
--- a/test/files/neg/unit-returns-value.check
+++ b/test/files/neg/unit-returns-value.check
@@ -1,13 +1,13 @@
-unit-returns-value.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+unit-returns-value.scala:4: warning: a pure expression does nothing in statement position
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
+unit-returns-value.scala:22: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
i1 // warn
^
-unit-returns-value.scala:23: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+unit-returns-value.scala:23: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
i2 // warn
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/neg/val_infer.check b/test/files/neg/val_infer.check
new file mode 100644
index 0000000000..711450add9
--- /dev/null
+++ b/test/files/neg/val_infer.check
@@ -0,0 +1,6 @@
+val_infer.scala:3: error: type mismatch;
+ found : String("")
+ required: Int
+ trait Sub extends Base { def foo = "" }
+ ^
+one error found
diff --git a/test/files/neg/val_infer.scala b/test/files/neg/val_infer.scala
new file mode 100644
index 0000000000..7fe8393749
--- /dev/null
+++ b/test/files/neg/val_infer.scala
@@ -0,0 +1,4 @@
+class Test {
+ trait Base { def foo: Int }
+ trait Sub extends Base { def foo = "" }
+} \ No newline at end of file
diff --git a/test/files/neg/val_sig_infer_match.check b/test/files/neg/val_sig_infer_match.check
new file mode 100644
index 0000000000..704c99cf84
--- /dev/null
+++ b/test/files/neg/val_sig_infer_match.check
@@ -0,0 +1,4 @@
+val_sig_infer_match.scala:21: error: value y is not a member of A
+ def m = f.y // doesn't compile anymore
+ ^
+one error found
diff --git a/test/files/neg/val_sig_infer_match.scala b/test/files/neg/val_sig_infer_match.scala
new file mode 100644
index 0000000000..fb8aa66d56
--- /dev/null
+++ b/test/files/neg/val_sig_infer_match.scala
@@ -0,0 +1,22 @@
+class A
+
+class B extends A {
+ def y: Int = 0
+}
+
+class B1 extends B
+class B2 extends B
+
+class C {
+ def f: A = null
+}
+
+class D extends C {
+ def s = ""
+ override final val f = s match {
+ case "" => new B1
+ case _ => new B2
+ }
+
+ def m = f.y // doesn't compile anymore
+} \ No newline at end of file
diff --git a/test/files/neg/val_sig_infer_struct.check b/test/files/neg/val_sig_infer_struct.check
new file mode 100644
index 0000000000..26efbbc3f4
--- /dev/null
+++ b/test/files/neg/val_sig_infer_struct.check
@@ -0,0 +1,4 @@
+val_sig_infer_struct.scala:7: error: value foo is not a member of Object
+ def bar = f.foo
+ ^
+one error found
diff --git a/test/files/neg/val_sig_infer_struct.scala b/test/files/neg/val_sig_infer_struct.scala
new file mode 100644
index 0000000000..e88340337c
--- /dev/null
+++ b/test/files/neg/val_sig_infer_struct.scala
@@ -0,0 +1,8 @@
+class C {
+ def f: Object = this
+}
+
+class D extends C {
+ override val f = new Object { def foo = 1 }
+ def bar = f.foo
+} \ No newline at end of file
diff --git a/test/files/neg/variances.check b/test/files/neg/variances.check
index cb1a60a632..3c1545a375 100644
--- a/test/files/neg/variances.check
+++ b/test/files/neg/variances.check
@@ -19,7 +19,7 @@ variances.scala:74: error: covariant type A occurs in contravariant position in
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
+variances.scala:90: error: covariant type A 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/test/files/neg/warn-inferred-any.check b/test/files/neg/warn-inferred-any.check
index 8ad81d1529..2b321a83c9 100644
--- a/test/files/neg/warn-inferred-any.check
+++ b/test/files/neg/warn-inferred-any.check
@@ -9,7 +9,7 @@ warn-inferred-any.scala:17: warning: a type was inferred to be `AnyVal`; this ma
^
warn-inferred-any.scala:25: warning: a type was inferred to be `Any`; this may indicate a programming error.
def za = f(1, "one")
- ^
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
four warnings found
one error found
diff --git a/test/files/neg/warn-unused-implicits.check b/test/files/neg/warn-unused-implicits.check
new file mode 100644
index 0000000000..4cc5836800
--- /dev/null
+++ b/test/files/neg/warn-unused-implicits.check
@@ -0,0 +1,9 @@
+warn-unused-implicits.scala:11: warning: parameter value s in method f is never used
+ )(implicit s: String): Int = { // warn
+ ^
+warn-unused-implicits.scala:31: warning: parameter value s in method i is never used
+ def i(implicit s: String, t: Int) = t // yes, warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found
diff --git a/test/files/neg/warn-unused-implicits.flags b/test/files/neg/warn-unused-implicits.flags
new file mode 100644
index 0000000000..18169f3218
--- /dev/null
+++ b/test/files/neg/warn-unused-implicits.flags
@@ -0,0 +1 @@
+-Ywarn-unused:implicits -Xfatal-warnings
diff --git a/test/files/neg/warn-unused-implicits.scala b/test/files/neg/warn-unused-implicits.scala
new file mode 100644
index 0000000000..54f924eac0
--- /dev/null
+++ b/test/files/neg/warn-unused-implicits.scala
@@ -0,0 +1,32 @@
+
+trait InterFace {
+ /** Call something. */
+ def call(a: Int, b: String, c: Double)(implicit s: String): Int
+}
+
+trait BadAPI extends InterFace {
+ def f(a: Int,
+ b: String,
+ c: Double
+ )(implicit s: String): Int = { // warn
+ println(b + c)
+ a
+ }
+ @deprecated ("no warn in deprecated API", since="yesterday")
+ def g(a: Int,
+ b: String,
+ c: Double
+ )(implicit s: String): Int = { // no warn
+ println(b + c)
+ a
+ }
+ override def call(a: Int,
+ b: String,
+ c: Double
+ )(implicit s: String): Int = { // no warn, required by superclass
+ println(b + c)
+ a
+ }
+
+ def i(implicit s: String, t: Int) = t // yes, warn
+}
diff --git a/test/files/neg/warn-unused-imports.check b/test/files/neg/warn-unused-imports.check
index 0a53d7a9cd..29d73a6264 100644
--- a/test/files/neg/warn-unused-imports.check
+++ b/test/files/neg/warn-unused-imports.check
@@ -51,5 +51,8 @@ warn-unused-imports_2.scala:149: warning: Unused import
warn-unused-imports_2.scala:150: warning: Unused import
import p1.A // warn
^
-16 warnings found
+warn-unused-imports_2.scala:158: warning: Unused import
+ def x = Macro.f // warn, not crash
+ ^
+17 warnings found
one error found
diff --git a/test/files/neg/warn-unused-imports.flags b/test/files/neg/warn-unused-imports.flags
index 24db705df1..c4e11e7fe7 100644
--- a/test/files/neg/warn-unused-imports.flags
+++ b/test/files/neg/warn-unused-imports.flags
@@ -1 +1 @@
--Xfatal-warnings -Ywarn-unused-import
+-Xfatal-warnings -Ywarn-unused:imports
diff --git a/test/files/neg/warn-unused-imports/sample_1.scala b/test/files/neg/warn-unused-imports/sample_1.scala
index d2f86239db..eea4d0eb4c 100644
--- a/test/files/neg/warn-unused-imports/sample_1.scala
+++ b/test/files/neg/warn-unused-imports/sample_1.scala
@@ -15,3 +15,18 @@ object Sample {
def f(x: X) = ???
def g(y: Y) = ???
}
+
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macro {
+ def f: Int = macro fImpl
+ def fImpl(c: Context): c.Tree = {
+ import c.universe._
+
+ q"""
+ import scala.util.Random
+ 42 // TODO randomize
+ """
+ }
+}
diff --git a/test/files/neg/warn-unused-imports/warn-unused-imports_2.scala b/test/files/neg/warn-unused-imports/warn-unused-imports_2.scala
index ded1186209..58fe0131d9 100644
--- a/test/files/neg/warn-unused-imports/warn-unused-imports_2.scala
+++ b/test/files/neg/warn-unused-imports/warn-unused-imports_2.scala
@@ -96,7 +96,7 @@ trait Warn {
trait Nested {
{
import p1._ // warn
- trait Warn { // warn about unused local trait for good measure
+ trait Warn { // don't warn about unused local trait with -Ywarn-unused:imports
import p2._
println(new A)
println("abc".bippy)
@@ -153,3 +153,7 @@ trait Outsiders {
//Future("abc".bippy)
}
}
+
+class MacroClient {
+ def x = Macro.f // warn, not crash
+}
diff --git a/test/files/neg/warn-unused-params.check b/test/files/neg/warn-unused-params.check
new file mode 100644
index 0000000000..373417ce08
--- /dev/null
+++ b/test/files/neg/warn-unused-params.check
@@ -0,0 +1,18 @@
+warn-unused-params.scala:9: warning: parameter value b in method f is never used
+ b: String, // warn
+ ^
+warn-unused-params.scala:32: warning: parameter value s in method i is never used
+ def i(implicit s: String) = 42 // yes, warn
+ ^
+warn-unused-params.scala:49: warning: parameter value u in class Unusing is never used
+class Unusing(u: Int) { // warn
+ ^
+warn-unused-params.scala:59: warning: parameter value s in class CaseyAtTheBat is never used
+case class CaseyAtTheBat(k: Int)(s: String) // warn
+ ^
+warn-unused-params.scala:62: warning: parameter value readResolve in method f is never used
+ def f(readResolve: Int) = 42 // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+5 warnings found
+one error found
diff --git a/test/files/neg/warn-unused-params.flags b/test/files/neg/warn-unused-params.flags
new file mode 100644
index 0000000000..795fb74272
--- /dev/null
+++ b/test/files/neg/warn-unused-params.flags
@@ -0,0 +1 @@
+-Ywarn-unused:params -Xfatal-warnings
diff --git a/test/files/neg/warn-unused-params.scala b/test/files/neg/warn-unused-params.scala
new file mode 100644
index 0000000000..b166e8fae6
--- /dev/null
+++ b/test/files/neg/warn-unused-params.scala
@@ -0,0 +1,69 @@
+
+trait InterFace {
+ /** Call something. */
+ def call(a: Int, b: String, c: Double): Int
+}
+
+trait BadAPI extends InterFace {
+ def f(a: Int,
+ b: String, // warn
+ c: Double): Int = {
+ println(c)
+ a
+ }
+ @deprecated ("no warn in deprecated API", since="yesterday")
+ def g(a: Int,
+ b: String, // no warn
+ c: Double): Int = {
+ println(c)
+ a
+ }
+ override def call(a: Int,
+ b: String, // no warn, required by superclass
+ c: Double): Int = {
+ println(c)
+ a
+ }
+
+ def meth(x: Int) = x
+
+ override def equals(other: Any): Boolean = true // no warn
+
+ def i(implicit s: String) = 42 // yes, warn
+
+ /*
+ def future(x: Int): Int = {
+ val y = 42
+ val x = y // maybe option to warn only if shadowed
+ x
+ }
+ */
+}
+
+// mustn't alter warnings in super
+trait PoorClient extends BadAPI {
+ override def meth(x: Int) = ??? // no warn
+ override def f(a: Int, b: String, c: Double): Int = a + b.toInt + c.toInt
+}
+
+class Unusing(u: Int) { // warn
+ def f = ???
+}
+
+class Valuing(val u: Int) // no warn
+
+class Revaluing(u: Int) { def f = u } // no warn
+
+case class CaseyKasem(k: Int) // no warn
+
+case class CaseyAtTheBat(k: Int)(s: String) // warn
+
+trait Ignorance {
+ def f(readResolve: Int) = 42 // warn
+}
+
+class Reusing(u: Int) extends Unusing(u) // no warn
+
+class Main {
+ def main(args: Array[String]): Unit = println("hello, args") // no warn
+}
diff --git a/test/files/neg/warn-unused-patvars.check b/test/files/neg/warn-unused-patvars.check
new file mode 100644
index 0000000000..2665126a36
--- /dev/null
+++ b/test/files/neg/warn-unused-patvars.check
@@ -0,0 +1,12 @@
+warn-unused-patvars.scala:9: warning: private val x in trait Boundings is never used
+ private val x = 42 // warn, sanity check
+ ^
+warn-unused-patvars.scala:28: warning: local val x in method v is never used
+ val D(x) = d // warn, fixme
+ ^
+warn-unused-patvars.scala:32: warning: local val x in method w is never used
+ val D(x @ _) = d // warn, fixme (valdef pos is different)
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/test/files/neg/warn-unused-patvars.flags b/test/files/neg/warn-unused-patvars.flags
new file mode 100644
index 0000000000..d5bd86a658
--- /dev/null
+++ b/test/files/neg/warn-unused-patvars.flags
@@ -0,0 +1 @@
+-Ywarn-unused:-patvars,_ -Xfatal-warnings
diff --git a/test/files/neg/warn-unused-patvars.scala b/test/files/neg/warn-unused-patvars.scala
new file mode 100644
index 0000000000..3d35dfedd6
--- /dev/null
+++ b/test/files/neg/warn-unused-patvars.scala
@@ -0,0 +1,53 @@
+
+// verify no warning when -Ywarn-unused:-patvars
+
+case class C(a: Int, b: String, c: Option[String])
+case class D(a: Int)
+
+trait Boundings {
+
+ private val x = 42 // warn, sanity check
+
+ def c = C(42, "hello", Some("world"))
+ def d = D(42)
+
+ def f() = {
+ val C(x, y, Some(z)) = c // no warn
+ 17
+ }
+ def g() = {
+ val C(x @ _, y @ _, Some(z @ _)) = c // no warn
+ 17
+ }
+ def h() = {
+ val C(x @ _, y @ _, z @ Some(_)) = c // no warn for z?
+ 17
+ }
+
+ def v() = {
+ val D(x) = d // warn, fixme
+ 17
+ }
+ def w() = {
+ val D(x @ _) = d // warn, fixme (valdef pos is different)
+ 17
+ }
+
+}
+
+trait Forever {
+ def f = {
+ val t = Option((17, 42))
+ for {
+ ns <- t
+ (i, j) = ns // no warn
+ } yield (i + j)
+ }
+ def g = {
+ val t = Option((17, 42))
+ for {
+ ns <- t
+ (i, j) = ns // no warn
+ } yield 42
+ }
+}
diff --git a/test/files/neg/warn-unused-privates.check b/test/files/neg/warn-unused-privates.check
index 4876ed8fc2..2a88d3e6c3 100644
--- a/test/files/neg/warn-unused-privates.check
+++ b/test/files/neg/warn-unused-privates.check
@@ -1,69 +1,120 @@
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
+warn-unused-privates.scala:4: warning: private method boop 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
+warn-unused-privates.scala:6: warning: private val MILLIS2 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
+warn-unused-privates.scala:13: warning: private val HEY_INSTANCE in object Bippy is never used
private val HEY_INSTANCE: Int = 1000 // warn
^
-warn-unused-privates.scala:14: warning: private val in object Bippy is never used
+warn-unused-privates.scala:14: warning: private val BOOL in object Bippy is never used
private lazy val BOOL: Boolean = true // warn
^
-warn-unused-privates.scala:36: warning: private val in class Boppy is never used
+warn-unused-privates.scala:36: warning: private val hummer in class Boppy is never used
private val hummer = "def" // warn
^
-warn-unused-privates.scala:43: warning: private var in trait Accessors is never used
+warn-unused-privates.scala:43: warning: private var v1 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 v1: Int = 0 // warn
- ^
-warn-unused-privates.scala:44: warning: private setter in trait Accessors is never used
+warn-unused-privates.scala:44: warning: private var v2 in trait Accessors is never used
private var v2: Int = 0 // warn, never set
^
-warn-unused-privates.scala:45: warning: private var in trait Accessors is never used
+warn-unused-privates.scala:45: warning: private var v3 in trait Accessors is never used
private var v3: Int = 0 // warn, never got
^
-warn-unused-privates.scala:57: warning: private default argument in trait DefaultArgs is never used
+warn-unused-privates.scala:56: warning: private var s1 in class StableAccessors is never used
+ private var s1: Int = 0 // warn
+ ^
+warn-unused-privates.scala:57: warning: private setter of s2 in class StableAccessors is never used
+ private var s2: Int = 0 // warn, never set
+ ^
+warn-unused-privates.scala:58: warning: private var s3 in class StableAccessors is never used
+ private var s3: Int = 0 // warn, never got
+ ^
+warn-unused-privates.scala:70: 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:57: warning: private default argument in trait DefaultArgs is never used
+warn-unused-privates.scala:70: 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:68: warning: local var in method f0 is never used
+warn-unused-privates.scala:86: warning: local var x in method f0 is never used
var x = 1 // warn
^
-warn-unused-privates.scala:75: warning: local val in method f1 is never used
+warn-unused-privates.scala:93: warning: local val b in method f1 is never used
val b = new Outer // warn
^
-warn-unused-privates.scala:85: warning: private object in object Types is never used
+warn-unused-privates.scala:103: warning: private object Dongo in object Types is never used
private object Dongo { def f = this } // warn
^
-warn-unused-privates.scala:95: warning: local object in method l1 is never used
+warn-unused-privates.scala:113: warning: local object HiObject in method l1 is never used
object HiObject { def f = this } // warn
^
-warn-unused-privates.scala:79: warning: local var x in method f2 is never set - it could be a val
+warn-unused-privates.scala:136: warning: private method x_= in class OtherNames is never used
+ private def x_=(i: Int): Unit = ???
+ ^
+warn-unused-privates.scala:137: warning: private method x in class OtherNames is never used
+ private def x: Int = 42
+ ^
+warn-unused-privates.scala:138: warning: private method y_= in class OtherNames is never used
+ private def y_=(i: Int): Unit = ???
+ ^
+warn-unused-privates.scala:153: warning: local val x in method f is never used
+ val C(x, y, Some(z)) = c // warn
+ ^
+warn-unused-privates.scala:153: warning: local val y in method f is never used
+ val C(x, y, Some(z)) = c // warn
+ ^
+warn-unused-privates.scala:153: warning: local val z in method f is never used
+ val C(x, y, Some(z)) = c // warn
+ ^
+warn-unused-privates.scala:161: warning: local val z in method h is never used
+ val C(x @ _, y @ _, z @ Some(_)) = c // warn for z?
+ ^
+warn-unused-privates.scala:166: warning: local val x in method v is never used
+ val D(x) = d // warn
+ ^
+warn-unused-privates.scala:170: warning: local val x in method w is never used
+ val D(x @ _) = d // warn, fixme (valdef pos is different)
+ ^
+warn-unused-privates.scala:97: warning: local var x in method f2 is never set: consider using immutable val
var x = 100 // warn about it being a var
^
-warn-unused-privates.scala:86: warning: private class Bar1 in object Types is never used
+warn-unused-privates.scala:104: warning: private class Bar1 in object Types is never used
private class Bar1 // warn
^
-warn-unused-privates.scala:88: warning: private type Alias1 in object Types is never used
+warn-unused-privates.scala:106: warning: private type Alias1 in object Types is never used
private type Alias1 = String // warn
^
-warn-unused-privates.scala:96: warning: local class Hi is never used
+warn-unused-privates.scala:114: warning: local class Hi is never used
class Hi { // warn
^
-warn-unused-privates.scala:100: warning: local class DingDongDoobie is never used
+warn-unused-privates.scala:118: warning: local class DingDongDoobie is never used
class DingDongDoobie // warn
^
-warn-unused-privates.scala:103: warning: local type OtherThing is never used
+warn-unused-privates.scala:121: warning: local type OtherThing is never used
type OtherThing = String // warn
^
+warn-unused-privates.scala:216: warning: private class for your eyes only in object not even using companion privates is never used
+ private implicit class `for your eyes only`(i: Int) { // warn
+ ^
+warn-unused-privates.scala:201: warning: pattern var z in method f is never used; `z@_' suppresses this warning
+ case z => "warn"
+ ^
+warn-unused-privates.scala:208: warning: pattern var z in method f is never used; `z@_' suppresses this warning
+ case Some(z) => "warn"
+ ^
+warn-unused-privates.scala:20: warning: parameter value msg0 in class B3 is never used
+class B3(msg0: String) extends A("msg")
+ ^
+warn-unused-privates.scala:136: warning: parameter value i in method x_= is never used
+ private def x_=(i: Int): Unit = ???
+ ^
+warn-unused-privates.scala:138: warning: parameter value i in method y_= is never used
+ private def y_=(i: Int): Unit = ???
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-22 warnings found
+39 warnings found
one error found
diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala
index 2eda280d40..f7640927fb 100644
--- a/test/files/neg/warn-unused-privates.scala
+++ b/test/files/neg/warn-unused-privates.scala
@@ -52,6 +52,19 @@ trait Accessors {
}
}
+class StableAccessors {
+ private var s1: Int = 0 // warn
+ private var s2: Int = 0 // warn, never set
+ private var s3: Int = 0 // warn, never got
+ private var s4: Int = 0 // no warn
+
+ def bippy(): Int = {
+ s3 = 5
+ s4 = 6
+ s2 + s4
+ }
+}
+
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
@@ -59,6 +72,11 @@ trait DefaultArgs {
def boppy() = bippy(5, 100, 200)
}
+/* SI-7707 Both usages warn default arg because using PrivateRyan.apply, not new.
+case class PrivateRyan private (ryan: Int = 42) { def f = PrivateRyan() }
+object PrivateRyan { def f = PrivateRyan() }
+*/
+
class Outer {
class Inner
}
@@ -104,3 +122,105 @@ object Types {
(new Bippy): Something
}
}
+
+trait Underwarn {
+ def f(): Seq[Int]
+
+ def g() = {
+ val Seq(_, _) = f() // no warn
+ true
+ }
+}
+
+class OtherNames {
+ private def x_=(i: Int): Unit = ???
+ private def x: Int = 42
+ private def y_=(i: Int): Unit = ???
+ private def y: Int = 42
+
+ def f = y
+}
+
+case class C(a: Int, b: String, c: Option[String])
+case class D(a: Int)
+
+trait Boundings {
+
+ def c = C(42, "hello", Some("world"))
+ def d = D(42)
+
+ def f() = {
+ val C(x, y, Some(z)) = c // warn
+ 17
+ }
+ def g() = {
+ val C(x @ _, y @ _, Some(z @ _)) = c // no warn
+ 17
+ }
+ def h() = {
+ val C(x @ _, y @ _, z @ Some(_)) = c // warn for z?
+ 17
+ }
+
+ def v() = {
+ val D(x) = d // warn
+ 17
+ }
+ def w() = {
+ val D(x @ _) = d // warn, fixme (valdef pos is different)
+ 17
+ }
+
+}
+
+trait Forever {
+ def f = {
+ val t = Option((17, 42))
+ for {
+ ns <- t
+ (i, j) = ns // no warn
+ } yield (i + j)
+ }
+ def g = {
+ val t = Option((17, 42))
+ for {
+ ns <- t
+ (i, j) = ns // warn, fixme
+ } yield 42 // val emitted only if needed, hence nothing unused
+ }
+}
+
+trait Ignorance {
+ private val readResolve = 42 // ignore
+}
+
+trait CaseyKasem {
+ def f = 42 match {
+ case x if x < 25 => "no warn"
+ case y if toString.nonEmpty => "no warn" + y
+ case z => "warn"
+ }
+}
+trait CaseyAtTheBat {
+ def f = Option(42) match {
+ case Some(x) if x < 25 => "no warn"
+ case Some(y @ _) if toString.nonEmpty => "no warn"
+ case Some(z) => "warn"
+ case None => "no warn"
+ }
+}
+
+class `not even using companion privates`
+
+object `not even using companion privates` {
+ private implicit class `for your eyes only`(i: Int) { // warn
+ def f = i
+ }
+}
+
+class `no warn in patmat anonfun isDefinedAt` {
+ def f(pf: PartialFunction[String, Int]) = pf("42")
+ def g = f {
+ case s => s.length // no warn (used to warn case s => true in isDefinedAt)
+ }
+}