summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/disabled/run/t7843-jsr223-service.scala18
-rw-r--r--test/files/neg/forgot-interpolator.check5
-rw-r--r--test/files/neg/forgot-interpolator.scala2
-rw-r--r--test/files/neg/literate_existentials.check4
-rw-r--r--test/files/neg/literate_existentials.scala224
-rw-r--r--test/files/neg/macro-bundle-ambiguous.check5
-rw-r--r--test/files/neg/macro-bundle-ambiguous.scala14
-rw-r--r--test/files/neg/macro-bundle-priority-bundle.check8
-rw-r--r--test/files/neg/macro-bundle-priority-bundle.scala14
-rw-r--r--test/files/neg/macro-bundle-priority-nonbundle.check8
-rw-r--r--test/files/neg/macro-bundle-priority-nonbundle.scala14
-rw-r--r--test/files/neg/macro-quasiquotes.check2
-rw-r--r--test/files/neg/name-lookup-stable.check11
-rw-r--r--test/files/neg/name-lookup-stable.scala20
-rw-r--r--test/files/neg/names-defaults-neg.check2
-rw-r--r--test/files/neg/package-ob-case.check10
-rw-r--r--test/files/neg/package-ob-case.flags1
-rw-r--r--test/files/neg/t0764.check2
-rw-r--r--test/files/neg/t0764.scala41
-rw-r--r--test/files/neg/t0764b.check47
-rw-r--r--test/files/neg/t0764b.scala63
-rw-r--r--test/files/neg/t3873.check4
-rw-r--r--test/files/neg/t3873.scala2
-rw-r--r--test/files/neg/t4749.check6
-rw-r--r--test/files/neg/t4818.check2
-rw-r--r--test/files/neg/t5189.check2
-rw-r--r--test/files/neg/t5760-pkgobj-warn.check4
-rw-r--r--test/files/neg/t5954.check18
-rw-r--r--test/files/neg/t5954.scala46
-rw-r--r--test/files/neg/t6260-named.check13
-rw-r--r--test/files/neg/t6260-named.scala15
-rw-r--r--test/files/neg/t6260.check13
-rw-r--r--test/files/neg/t6260b.check7
-rw-r--r--test/files/neg/t6680a.flags1
-rw-r--r--test/files/neg/t6829.check12
-rw-r--r--test/files/neg/t7475c.check7
-rw-r--r--test/files/neg/t7475c.scala9
-rw-r--r--test/files/neg/t7475d.check7
-rw-r--r--test/files/neg/t7475e.check4
-rw-r--r--test/files/neg/t7475e.scala12
-rw-r--r--test/files/neg/t7475f.check10
-rw-r--r--test/files/neg/t7475f.scala28
-rw-r--r--test/files/neg/t7507.check2
-rw-r--r--test/files/neg/t7886.check6
-rw-r--r--test/files/neg/t8104/Test_2.scala2
-rw-r--r--test/files/neg/t8177a.check6
-rw-r--r--test/files/neg/t8177a.scala6
-rw-r--r--test/files/neg/t8207.check7
-rw-r--r--test/files/neg/t8207.scala3
-rw-r--r--test/files/neg/t8219-any-any-ref-equals.check10
-rw-r--r--test/files/neg/t8219-any-any-ref-equals.scala8
-rw-r--r--test/files/neg/t8237-default.check13
-rw-r--r--test/files/neg/t8237-default.scala29
-rw-r--r--test/files/neg/t8244.check4
-rw-r--r--test/files/neg/t8244/Raw_1.java4
-rw-r--r--test/files/neg/t8244/Test_2.scala12
-rw-r--r--test/files/neg/t8244b.check4
-rw-r--r--test/files/neg/t8244b.scala18
-rw-r--r--test/files/neg/t8244c.check4
-rw-r--r--test/files/neg/t8244c.scala18
-rw-r--r--test/files/neg/t8244e.check4
-rw-r--r--test/files/neg/t8244e/Raw.java4
-rw-r--r--test/files/neg/t8244e/Test.scala12
-rw-r--r--test/files/neg/t8266-invalid-interp.check10
-rw-r--r--test/files/neg/t8266-invalid-interp.scala9
-rw-r--r--test/files/pos/delambdafy_t6260_method.check (renamed from test/files/neg/delambdafy_t6260_method.check)0
-rw-r--r--test/files/pos/delambdafy_t6260_method.flags (renamed from test/files/neg/delambdafy_t6260_method.flags)0
-rw-r--r--test/files/pos/delambdafy_t6260_method.scala (renamed from test/files/neg/delambdafy_t6260_method.scala)0
-rw-r--r--test/files/pos/existential-java-case-class/Client.scala3
-rw-r--r--test/files/pos/existential-java-case-class/J.java1
-rw-r--r--test/files/pos/macro-bundle-disambiguate-bundle.check0
-rw-r--r--test/files/pos/macro-bundle-disambiguate-bundle.scala14
-rw-r--r--test/files/pos/macro-bundle-disambiguate-nonbundle.check0
-rw-r--r--test/files/pos/macro-bundle-disambiguate-nonbundle.scala14
-rw-r--r--test/files/pos/package-ob-case.flags (renamed from test/files/neg/t5954.flags)0
-rw-r--r--test/files/pos/package-ob-case/A_1.scala (renamed from test/files/neg/package-ob-case.scala)0
-rw-r--r--test/files/pos/package-ob-case/B_2.scala5
-rw-r--r--test/files/pos/t1786-counter.scala38
-rw-r--r--test/files/pos/t1786-cycle.scala57
-rw-r--r--test/files/pos/t261-ab.scala9
-rw-r--r--test/files/pos/t261-ba.scala9
-rw-r--r--test/files/pos/t3452f.scala10
-rw-r--r--test/files/pos/t5760-pkgobj-warn/stalepkg_1.scala (renamed from test/files/neg/t5760-pkgobj-warn/stalepkg_1.scala)0
-rw-r--r--test/files/pos/t5760-pkgobj-warn/stalepkg_2.scala (renamed from test/files/neg/t5760-pkgobj-warn/stalepkg_2.scala)0
-rw-r--r--test/files/pos/t5900a.scala9
-rw-r--r--test/files/pos/t5954a/A_1.scala6
-rw-r--r--test/files/pos/t5954a/B_2.scala6
-rw-r--r--test/files/pos/t5954b/A_1.scala6
-rw-r--r--test/files/pos/t5954b/B_2.scala5
-rw-r--r--test/files/pos/t5954c.flags1
-rw-r--r--test/files/pos/t5954c/A_1.scala18
-rw-r--r--test/files/pos/t5954c/B_2.scala18
-rw-r--r--test/files/pos/t5954d.flags1
-rw-r--r--test/files/pos/t5954d/A_1.scala6
-rw-r--r--test/files/pos/t5954d/B_2.scala7
-rw-r--r--test/files/pos/t6169/Exist.java4
-rw-r--r--test/files/pos/t6169/ExistF.java4
-rw-r--r--test/files/pos/t6169/ExistIndir.java4
-rw-r--r--test/files/pos/t6169/OP.java1
-rw-r--r--test/files/pos/t6169/Skin.java1
-rw-r--r--test/files/pos/t6169/Skinnable.java3
-rw-r--r--test/files/pos/t6169/skinnable.scala14
-rw-r--r--test/files/pos/t6169/t6169.scala7
-rw-r--r--test/files/pos/t6260.flags (renamed from test/files/neg/t6260.flags)0
-rw-r--r--test/files/pos/t6260.scala (renamed from test/files/neg/t6260.scala)0
-rw-r--r--test/files/pos/t6260b.scala (renamed from test/files/neg/t6260b.scala)0
-rw-r--r--test/files/pos/t6948.scala10
-rw-r--r--test/files/pos/t7475a.scala11
-rw-r--r--test/files/pos/t7475b.scala8
-rw-r--r--test/files/pos/t7475d.scala11
-rw-r--r--test/files/pos/t7475e.scala13
-rw-r--r--test/files/pos/t7753.scala36
-rw-r--r--test/files/pos/t8134/A_1.scala4
-rw-r--r--test/files/pos/t8134/B_2.scala4
-rw-r--r--test/files/pos/t8177.scala12
-rw-r--r--test/files/pos/t8177a.scala9
-rw-r--r--test/files/pos/t8177b.scala13
-rw-r--r--test/files/pos/t8177d.scala12
-rw-r--r--test/files/pos/t8177e.scala3
-rw-r--r--test/files/pos/t8177g.scala11
-rw-r--r--test/files/pos/t8177h.scala5
-rw-r--r--test/files/pos/t8207.scala6
-rw-r--r--test/files/pos/t8209a.check0
-rw-r--r--test/files/pos/t8209a/Macros_1.scala17
-rw-r--r--test/files/pos/t8209a/Test_2.scala4
-rw-r--r--test/files/pos/t8209b.check0
-rw-r--r--test/files/pos/t8209b/Macros_1.scala17
-rw-r--r--test/files/pos/t8209b/Test_2.scala4
-rw-r--r--test/files/pos/t8219.scala15
-rw-r--r--test/files/pos/t8219b.scala49
-rw-r--r--test/files/pos/t8223.scala29
-rw-r--r--test/files/pos/t8237.scala29
-rw-r--r--test/files/pos/t8237b.scala10
-rw-r--r--test/files/pos/t8244d/InodeBase_1.java6
-rw-r--r--test/files/pos/t8244d/Test_2.scala3
-rw-r--r--test/files/presentation/callcc-interpreter.check4
-rw-r--r--test/files/presentation/completion-implicit-chained.check4
-rw-r--r--test/files/presentation/ide-bug-1000349.check4
-rw-r--r--test/files/presentation/ide-bug-1000475.check12
-rw-r--r--test/files/presentation/ide-bug-1000531.check4
-rw-r--r--test/files/presentation/implicit-member.check4
-rw-r--r--test/files/presentation/ping-pong.check8
-rw-r--r--test/files/presentation/scope-completion-3.check28
-rw-r--r--test/files/presentation/scope-completion-import.check16
-rw-r--r--test/files/presentation/t5708.check4
-rw-r--r--test/files/presentation/visibility.check21
-rw-r--r--test/files/run/inferred-type-constructors.check56
-rw-r--r--test/files/run/inferred-type-constructors.scala125
-rw-r--r--test/files/run/mixin-signatures.check59
-rw-r--r--test/files/run/mixin-signatures.scala105
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.check7
-rw-r--r--test/files/run/reflection-sorted-members.check1
-rw-r--r--test/files/run/t261.check2
-rw-r--r--test/files/run/t261.scala11
-rw-r--r--test/files/run/t3452.check1
-rw-r--r--test/files/run/t3452.scala21
-rw-r--r--test/files/run/t3452a.check1
-rw-r--r--test/files/run/t3452a/J_2.java5
-rw-r--r--test/files/run/t3452a/S_1.scala24
-rw-r--r--test/files/run/t3452a/S_3.scala5
-rw-r--r--test/files/run/t3452b-bcode.check2
-rw-r--r--test/files/run/t3452b-bcode.flags1
-rw-r--r--test/files/run/t3452b-bcode/J_2.java6
-rw-r--r--test/files/run/t3452b-bcode/S_1.scala17
-rw-r--r--test/files/run/t3452b-bcode/S_3.scala5
-rw-r--r--test/files/run/t3452b.check2
-rw-r--r--test/files/run/t3452b/J_2.java6
-rw-r--r--test/files/run/t3452b/S_1.scala17
-rw-r--r--test/files/run/t3452b/S_3.scala5
-rw-r--r--test/files/run/t3452c.check8
-rw-r--r--test/files/run/t3452c.scala113
-rw-r--r--test/files/run/t3452d/A.scala7
-rw-r--r--test/files/run/t3452d/Test.java12
-rw-r--r--test/files/run/t3452e/A.scala4
-rw-r--r--test/files/run/t3452e/B.java2
-rw-r--r--test/files/run/t3452e/Test.scala3
-rw-r--r--test/files/run/t3452f.scala19
-rw-r--r--test/files/run/t3452g/A.scala9
-rw-r--r--test/files/run/t3452g/Test.java14
-rw-r--r--test/files/run/t3452h.scala8
-rw-r--r--test/files/run/t6260-delambdafy.check4
-rw-r--r--test/files/run/t6260-delambdafy.flags1
-rw-r--r--test/files/run/t6260-delambdafy.scala12
-rw-r--r--test/files/run/t6260c.check5
-rw-r--r--test/files/run/t6260c.scala17
-rw-r--r--test/files/run/t6411a.check96
-rw-r--r--test/files/run/t6411a.scala81
-rw-r--r--test/files/run/t6411b.check1
-rw-r--r--test/files/run/t6411b.scala12
-rw-r--r--test/files/run/t6554.check1
-rw-r--r--test/files/run/t6554.scala11
-rw-r--r--test/files/run/t6632.check2
-rw-r--r--test/files/run/t6632.scala29
-rw-r--r--test/files/run/t6908.scala6
-rw-r--r--test/files/run/t6992.check1
-rw-r--r--test/files/run/t6992/Test_2.scala4
-rw-r--r--test/files/run/t7185.check4
-rw-r--r--test/files/run/t7319.check2
-rw-r--r--test/files/run/t7328.check4
-rw-r--r--test/files/run/t7328.scala18
-rw-r--r--test/files/run/t7374.check3
-rw-r--r--test/files/run/t7374/Some.scala3
-rw-r--r--test/files/run/t7374/Test.java7
-rw-r--r--test/files/run/t7475b.check2
-rw-r--r--test/files/run/t7475b.scala11
-rw-r--r--test/files/run/t7507.scala4
-rw-r--r--test/files/run/t7570a.check1
-rw-r--r--test/files/run/t7570a.scala11
-rw-r--r--test/files/run/t7570b.check1
-rw-r--r--test/files/run/t7570b.scala17
-rw-r--r--test/files/run/t7570c.check2
-rw-r--r--test/files/run/t7570c.scala13
-rw-r--r--test/files/run/t7711-script-args.check2
-rw-r--r--test/files/run/t7711-script-args.scala7
-rw-r--r--test/files/run/t7711-script-args.script12
-rw-r--r--test/files/run/t7843-jsr223-service.check (renamed from test/disabled/run/t7843-jsr223-service.check)0
-rw-r--r--test/files/run/t7843-jsr223-service.scala8
-rw-r--r--test/files/run/t7933.check2
-rw-r--r--test/files/run/t7933.scala11
-rw-r--r--test/files/run/t8104.check3
-rw-r--r--test/files/run/t8104/Test_2.scala5
-rw-r--r--test/files/run/t8153.check1
-rw-r--r--test/files/run/t8153.scala14
-rw-r--r--test/files/run/t8177f.scala20
-rw-r--r--test/files/run/t8188.scala25
-rw-r--r--test/files/run/t8245.scala14
-rw-r--r--test/files/run/t8266-octal-interp.check30
-rw-r--r--test/files/run/t8266-octal-interp.flags1
-rw-r--r--test/files/run/t8266-octal-interp.scala16
-rw-r--r--test/files/run/t8280.check9
-rw-r--r--test/files/run/t8280.scala82
-rw-r--r--test/files/run/typecheck.check0
-rw-r--r--test/files/run/typecheck/Macros_1.scala12
-rw-r--r--test/files/run/typecheck/Test_2.scala10
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala72
-rw-r--r--test/files/scalacheck/quasiquotes/LiftableProps.scala1
-rw-r--r--test/files/scalacheck/quasiquotes/PatternConstructionProps.scala6
-rw-r--r--test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala5
-rw-r--r--test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala2
-rw-r--r--test/files/scalacheck/quasiquotes/TermConstructionProps.scala5
-rw-r--r--test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala5
-rw-r--r--test/files/scalacheck/quasiquotes/TypeConstructionProps.scala5
-rw-r--r--test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala5
-rw-r--r--test/files/scalacheck/quasiquotes/UnliftableProps.scala2
-rw-r--r--test/files/scalacheck/range.scala3
-rw-r--r--test/junit/scala/collection/NumericRangeTest.scala19
-rw-r--r--test/junit/scala/collection/SetMapConsistencyTest.scala28
-rw-r--r--test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala1
-rw-r--r--test/pending/neg/t7886.scala (renamed from test/files/neg/t7886.scala)0
-rw-r--r--test/pending/neg/t7886b.scala23
-rw-r--r--test/pending/pos/pattern-typing.scala (renamed from test/files/pos/pattern-typing.scala)0
-rw-r--r--test/pending/pos/t1786.scala (renamed from test/files/pos/t1786.scala)8
-rw-r--r--test/pending/pos/t5459.scala (renamed from test/files/pos/t5459.scala)0
-rw-r--r--test/support/java-tests.txt97
254 files changed, 3003 insertions, 310 deletions
diff --git a/test/disabled/run/t7843-jsr223-service.scala b/test/disabled/run/t7843-jsr223-service.scala
deleted file mode 100644
index e2ea850698..0000000000
--- a/test/disabled/run/t7843-jsr223-service.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-/*DISABLED:
- For Paul, it steals focus when it runs.
-
- For me, it fails with some platform specific extra output:
-
- -ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider apple.applescript.AppleScriptEngin
- n: Object = 10
- 12345678910
-*/
-import javax.script._
-import scala.tools.nsc.interpreter.IMain
-
-object Test extends App {
- val engine = new ScriptEngineManager getEngineByName "scala"
- engine.asInstanceOf[IMain].settings.usejavacp.value = true
- engine put ("n", 10)
- engine eval "1 to n.asInstanceOf[Int] foreach print"
-}
diff --git a/test/files/neg/forgot-interpolator.check b/test/files/neg/forgot-interpolator.check
index 157cbb4802..8988458982 100644
--- a/test/files/neg/forgot-interpolator.check
+++ b/test/files/neg/forgot-interpolator.check
@@ -10,9 +10,6 @@ forgot-interpolator.scala:30: warning: `$beppo` looks like an interpolated ident
forgot-interpolator.scala:34: warning: `$aleppo` looks like an interpolated identifier! Did you forget the interpolator?
def f = "$aleppo is a pepper and a city." // warn 4
^
-forgot-interpolator.scala:42: warning: `$bar` looks like an interpolated identifier! Did you forget the interpolator?
- def f = "$bar is private, shall we warn just in case?" // warn 5
- ^
forgot-interpolator.scala:47: warning: `$hippo` looks like an interpolated identifier! Did you forget the interpolator?
def h = "$hippo takes an implicit" // warn 6
^
@@ -26,5 +23,5 @@ forgot-interpolator.scala:90: warning: `$calico` looks like an interpolated iden
def f4 = "I also salute $calico" // warn 9
^
error: No warnings can be incurred under -Xfatal-warnings.
-9 warnings found
+8 warnings found
one error found
diff --git a/test/files/neg/forgot-interpolator.scala b/test/files/neg/forgot-interpolator.scala
index 34a7c7aef4..a53054d890 100644
--- a/test/files/neg/forgot-interpolator.scala
+++ b/test/files/neg/forgot-interpolator.scala
@@ -39,7 +39,7 @@ package test {
if (bar > 8) ??? // use it to avoid extra warning
}
class Baz extends Bar {
- def f = "$bar is private, shall we warn just in case?" // warn 5
+ def f = "$bar is private, shall we warn just in case?" // no longer a warning, private members aren't inherited!
}
class G {
def g = "$greppo takes an arg" // no warn
diff --git a/test/files/neg/literate_existentials.check b/test/files/neg/literate_existentials.check
new file mode 100644
index 0000000000..c98f976f79
--- /dev/null
+++ b/test/files/neg/literate_existentials.check
@@ -0,0 +1,4 @@
+literate_existentials.scala:189: error: Cannot prove that Int <:< M forSome { type M <: String }.
+ implicitly[Int <:< (M forSome { type M >: Nothing <: String })] // fails
+ ^
+one error found
diff --git a/test/files/neg/literate_existentials.scala b/test/files/neg/literate_existentials.scala
new file mode 100644
index 0000000000..8580347bf9
--- /dev/null
+++ b/test/files/neg/literate_existentials.scala
@@ -0,0 +1,224 @@
+
+object LiterateExistentials {
+
+// Let's play with Scala's type system a bit.
+//
+// From adriaanm, we have the following substitution rule, which allows us to
+// determine whether a type is a subtype of an existential in Scala:
+//
+//
+// T <: subst(U) for all i: subst(Li) <: Vi /\ Vi <: subst(Hi)
+// --------------------------------------------------------------
+// T <: U forSome {type X1 :> L1 <: H1; ...; type Xn :> Ln <: Hn}
+//
+// where subst(T) = T.subst(Xi, Vi) // Vi fresh type variables
+//
+// T is a subtype of some existential if all constraints of the existential hold
+// after substituting Vi for the existentially quantified type variables Xi,
+// and T is a subtype of the underlying type U with the same substitution applied.
+//
+//
+// Since we are not a formal substitution system, we will actually be using
+// this rule 'backward' in order to determine whether it allows us to
+// truthfully make claims; In each example, we will start with the proposition
+// that a type is a subtype of an existential. Then, we will fit the
+// proposition into the form on the bottom rule by creating a set of bindings
+// which allow one to be transformed into the other. Next, we will express the
+// top of the substitution rule in terms of a series of constraints. We will
+// simplify those constraints until simple inspection can determine whether
+// they are consistent. From this, we can conclude whether the type system /
+// environment admit the top of the substitution rule (and thus, the bottom). If
+// they do, we can say that the proposition is true.
+
+
+// In each case, we will also probe the compiler to see whether _it_ thinks that
+// the proposition holds, using an uncommented implicitly[_ <:< _] line.
+
+
+
+
+// Proposition: Nothing :< (A forSome { type A >: String <: Any })
+//
+//
+// Bindings:
+// T := Nothing
+// U := A
+// X1 := A
+// L1 := String
+// H1 := Any
+//
+// We need:
+//
+// Nothing <: V1 // (U, which is "A", which V1 substituted for all instances of A)
+// String <: V1
+// V1 <: Any
+//
+// Which simplify to:
+// V1 >: String <: Any
+//
+// That's not inconsistent, so we can say that:
+// T <: U forSome { type X1 >: L1 <: H1 }
+// which means (under our mappings):
+// Nothing <: A forSome { type A >: String <: Any }
+
+// Now to ask the compiler:
+
+ implicitly[Nothing <:< (A forSome { type A >: String <: Any })]
+
+
+// Let's try another:
+//
+// Proposition: Int :< (M forSome { type M >: String <: Any })
+//
+// Bindings:
+// T := Int
+// U := M
+// X1 := M
+// L1 := String
+// H1 := Any
+//
+// We need:
+//
+// Int <: V1
+// String <: V1
+// V1 <: Any
+//
+// Which simplify to:
+//
+// V1 >: lub(Int, String) <: Any
+//
+// V1 >: Any <: Any
+//
+// We have demonstrated consistency! We can say that:
+// T :< (U forSome { type U >: L1 <: H1 })
+// Under our bindings, this is:
+// Int :< (M forSome { type M >: String <: Any })
+
+ implicitly[Int <:< (M forSome { type M >: String <: Any })]
+
+
+
+// Now, let's do a more complicated one:
+//
+// Proposition: (Nothing, List[String]) <: ((A, B) forSome { type A >: String <: AnyRef; type B >: Null <: List[A] })
+//
+// Bindings:
+// T := (Nothing, List[String])
+// U := (A, B)
+// X1 := A
+// X2 := B
+// L1 := String
+// H1 := AnyRef
+// L2 := Null
+// H2 := List[A]
+//
+// We need:
+//
+// (Nothing, List[String]) <: (V1, V2)
+// String <: V1
+// V1 <: AnyRef
+// Null <: V2
+// V2 <: List[V1]
+//
+// Of course, we can split the first line to make:
+//
+// Nothing <: V1
+// List[String]) <: V2
+// String <: V1
+// V1 <: AnyRef
+// Null <: V2
+// V2 <: List[V1]
+//
+// Which reorder to:
+//
+// Nothing <: V1
+// String <: V1
+// V1 <: AnyRef
+// List[String]) <: V2
+// Null <: V2
+// V2 <: List[V1]
+//
+// Which simplify to:
+//
+// String <: V1
+// V1 <: AnyRef
+// List[String]) <: V2
+// V2 <: List[V1]
+//
+// String <: V1
+// V1 <: AnyRef
+// String <: V1
+//
+// V1 >: String <: AnyRef
+//
+// Consistency demonstrated! We can say that:
+// T <: U forSome {type X1 :> L1 <: H1; type X2 :> L2 <: H2}
+// meaning:
+// (Nothing, List[String]) <: ((A, B) forSome { type A >: String <: AnyRef; type B >: Null <: List[A] })
+
+ implicitly[
+ (Nothing, List[String]) <:< ((A, B) forSome { type A >: String <: AnyRef; type B >: Null <: List[A] })
+ ]
+
+
+
+// Now let's try one that isn't true:
+//
+// Proposition: Int :< (M forSome { type M >: Nothing <: String })
+//
+// Bindings:
+// T := Int
+// U := M
+// X1 := M
+// L1 := Nothing
+// H1 := String
+//
+// We need:
+//
+// Int <: V1
+// Nothing <: V1
+// V1 <: String
+//
+// V1 >: Int <: String
+//
+// Alas! These are inconsistent! There is no supertype of Int that is a
+// subtype of String! Our substitution rule does not allow us to claim that our
+// proposition is true.
+//
+
+ implicitly[Int <:< (M forSome { type M >: Nothing <: String })] // fails
+// The preceeding line causes the compiler to generate an error message.
+
+
+
+// Let's look at one final example, courtesy of paulp.
+// Proposition: String :< X forSome { type X >: Nothing <: String }
+//
+// Bindings:
+// T := String
+// U := X
+// X1 := X
+// L1 := Nothing
+// H1 := String
+//
+// We need:
+//
+// String <: V1
+// Nothing <: V1
+// V1 <: String
+//
+// Which simplify to:
+//
+// String <: V1
+// V1 <: String
+//
+// V1 >: String <: String
+//
+// So, we can say:
+// T <: U forSome { type X1 >: L1 <: H1 }
+// which means:
+// String :< X forSome { type X >: Nothing <: String }
+
+ implicitly[String <:< (X forSome { type X >: Nothing <: String })]
+
+}
diff --git a/test/files/neg/macro-bundle-ambiguous.check b/test/files/neg/macro-bundle-ambiguous.check
new file mode 100644
index 0000000000..8430496455
--- /dev/null
+++ b/test/files/neg/macro-bundle-ambiguous.check
@@ -0,0 +1,5 @@
+macro-bundle-ambiguous.scala:13: error: macro implementation reference is ambiguous: makes sense both as
+a macro bundle method reference and a vanilla object method reference
+ def foo: Unit = macro Macros.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-ambiguous.scala b/test/files/neg/macro-bundle-ambiguous.scala
new file mode 100644
index 0000000000..92c359d9a9
--- /dev/null
+++ b/test/files/neg/macro-bundle-ambiguous.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: Context) {
+ def impl = ???
+}
+
+object Macros {
+ def impl(c: Context) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-priority-bundle.check b/test/files/neg/macro-bundle-priority-bundle.check
new file mode 100644
index 0000000000..c6cea72ba6
--- /dev/null
+++ b/test/files/neg/macro-bundle-priority-bundle.check
@@ -0,0 +1,8 @@
+macro-bundle-priority-bundle.scala:13: error: bundle implementation has incompatible shape:
+ required: : Macros.this.c.Expr[Unit]
+ or : : Macros.this.c.Tree
+ found : (x: Macros.this.c.Tree): Nothing
+number of parameter sections differ
+ def foo: Unit = macro Macros.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-priority-bundle.scala b/test/files/neg/macro-bundle-priority-bundle.scala
new file mode 100644
index 0000000000..ce831a7121
--- /dev/null
+++ b/test/files/neg/macro-bundle-priority-bundle.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: Context) {
+ def impl(x: c.Tree) = ???
+}
+
+object Macros {
+ def impl(c: Context)(x: c.Tree) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-priority-nonbundle.check b/test/files/neg/macro-bundle-priority-nonbundle.check
new file mode 100644
index 0000000000..0d03b5074b
--- /dev/null
+++ b/test/files/neg/macro-bundle-priority-nonbundle.check
@@ -0,0 +1,8 @@
+macro-bundle-priority-nonbundle.scala:13: error: macro implementation has incompatible shape:
+ required: (c: scala.reflect.macros.whitebox.Context): c.Expr[Unit]
+ or : (c: scala.reflect.macros.whitebox.Context): c.Tree
+ found : (c: scala.reflect.macros.whitebox.Context)(x: c.Tree): Nothing
+number of parameter sections differ
+ def foo: Unit = macro Macros.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-priority-nonbundle.scala b/test/files/neg/macro-bundle-priority-nonbundle.scala
new file mode 100644
index 0000000000..8dc00f6dd3
--- /dev/null
+++ b/test/files/neg/macro-bundle-priority-nonbundle.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: scala.reflect.api.Universe) {
+ def impl(x: c.Tree) = ???
+}
+
+object Macros {
+ def impl(c: Context)(x: c.Tree) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check
index c690b61fe1..a985aee156 100644
--- a/test/files/neg/macro-quasiquotes.check
+++ b/test/files/neg/macro-quasiquotes.check
@@ -1,4 +1,4 @@
-Macros_1.scala:14: error: macro implementation has incompatible shape:
+Macros_1.scala:14: error: bundle implementation has incompatible shape:
required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Unit]
or : (x: Impls.this.c.Tree): Impls.this.c.Tree
found : (x: Impls.this.c.universe.Block): Impls.this.c.Tree
diff --git a/test/files/neg/name-lookup-stable.check b/test/files/neg/name-lookup-stable.check
new file mode 100644
index 0000000000..751df9505e
--- /dev/null
+++ b/test/files/neg/name-lookup-stable.check
@@ -0,0 +1,11 @@
+name-lookup-stable.scala:15: error: reference to PrimaryKey is ambiguous;
+it is both defined in class A and imported subsequently by
+import ColumnOption._
+ (null: Any) match { case PrimaryKey => }
+ ^
+name-lookup-stable.scala:17: error: reference to PrimaryKey is ambiguous;
+it is both defined in class A and imported subsequently by
+import ColumnOption._
+ PrimaryKey // was already ambigious in 2.10.3
+ ^
+two errors found
diff --git a/test/files/neg/name-lookup-stable.scala b/test/files/neg/name-lookup-stable.scala
new file mode 100644
index 0000000000..0d862f06e1
--- /dev/null
+++ b/test/files/neg/name-lookup-stable.scala
@@ -0,0 +1,20 @@
+// This used to compile under 2.10.3 but the ambiguity is now noticed
+// in 2.11.x (after a70c8219). I think the new behaviour is correct;
+// we shouldn't discard names based on "expected stability" before
+// evaluating ambiguity.
+object ColumnOption {
+ object PrimaryKey
+}
+
+class A {
+ def PrimaryKey: Any = ???
+
+ {
+ import ColumnOption._
+
+ (null: Any) match { case PrimaryKey => }
+
+ PrimaryKey // was already ambigious in 2.10.3
+ }
+}
+
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check
index 880ddc4327..20ddd55f1f 100644
--- a/test/files/neg/names-defaults-neg.check
+++ b/test/files/neg/names-defaults-neg.check
@@ -88,7 +88,7 @@ names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T
--- because ---
argument expression's type is not compatible with formal parameter type;
found : List[Int]
- required: ?T
+ required: ?T[?T[List[?T[X forSome { type X }]]]]
Error occurred in an application involving default arguments.
test4()
^
diff --git a/test/files/neg/package-ob-case.check b/test/files/neg/package-ob-case.check
deleted file mode 100644
index 9b0ede1c6d..0000000000
--- a/test/files/neg/package-ob-case.check
+++ /dev/null
@@ -1,10 +0,0 @@
-package-ob-case.scala:3: warning: it is not recommended to define classes/objects inside of package objects.
-If possible, define class X in package foo instead.
- case class X(z: Int) { }
- ^
-package-ob-case.scala:3: warning: class X should be placed directly in package foo instead of package object foo. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954.
- case class X(z: Int) { }
- ^
-error: No warnings can be incurred under -Xfatal-warnings.
-two warnings found
-one error found
diff --git a/test/files/neg/package-ob-case.flags b/test/files/neg/package-ob-case.flags
deleted file mode 100644
index 6c1dd108ae..0000000000
--- a/test/files/neg/package-ob-case.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings -Xlint \ No newline at end of file
diff --git a/test/files/neg/t0764.check b/test/files/neg/t0764.check
index 6156b52712..0c7cff1e1e 100644
--- a/test/files/neg/t0764.check
+++ b/test/files/neg/t0764.check
@@ -2,6 +2,6 @@ t0764.scala:13: error: type mismatch;
found : Node{type T = _1.type} where val _1: Node{type T = NextType}
required: Node{type T = Main.this.AType}
(which expands to) Node{type T = Node{type T = NextType}}
- new Main[AType]( (value: AType).prepend )
+ new Main[AType]( (value: AType).prepend )
^
one error found
diff --git a/test/files/neg/t0764.scala b/test/files/neg/t0764.scala
index f2cc65cf7d..9f77a59414 100644
--- a/test/files/neg/t0764.scala
+++ b/test/files/neg/t0764.scala
@@ -1,14 +1,45 @@
class Top[A] {
- type AType = A
+ type AType = A
}
trait Node { outer =>
- type T <: Node
- def prepend = new Node { type T = outer.type }
+ type T <: Node
+ def prepend = new Node { type T = outer.type }
}
class Main[NextType <: Node](value: Node { type T = NextType })
- extends Top[Node { type T = NextType }] {
+ extends Top[Node { type T = NextType }] {
- new Main[AType]( (value: AType).prepend )
+ new Main[AType]( (value: AType).prepend )
}
+
+/* we've been back-and-forth on this one -- see PRs on SI-8177 for the reasoning
+I think it should compile and that the following error is due to broken =:= on existentials
+ found : Node{type T = _1.type} where val _1: Node{type T = NextType}
+ required: Node{type T = Main.this.AType}
+ (which expands to) Node{type T = Node{type T = NextType}}
+
+I claim (omitting the forSome for brevity, even though the premature skolemization is probably the issue)
+_1.type =:= Main.this.AType
+because
+(1) _1.type <:< Main.this.AType and (2) Main.this.AType <:< _1.type
+(1), because:
+_1.type <:< Node{type T = NextType} (because skolemization and _1's upper bound)
+(2), because:
+Node{type T = NextType} <:< _1.type forSome val _1: Node{type T = NextType}
+because:
+Node{type T = NextType} <:< T forSome {type T <: Node{type T = NextType} with Singleton}
+because
+Node{type T = NextType} <:< Node{type T = NextType} with Singleton
+
+hmmm.. might the with Singleton be throwing a wrench in our existential house?
+
+Behold the equivalent program which type checks without the fix for SI-8177.
+(Expand type alias, convert type member to type param;
+note the covariance to encode subtyping on type members.)
+
+class Node[+T <: Node[_]] { def prepend = new Node[this.type] }
+class Main[NextType <: Node[_]](value: Node[NextType]) {
+ new Main(value.prepend)
+}
+*/ \ No newline at end of file
diff --git a/test/files/neg/t0764b.check b/test/files/neg/t0764b.check
new file mode 100644
index 0000000000..4040954e7c
--- /dev/null
+++ b/test/files/neg/t0764b.check
@@ -0,0 +1,47 @@
+t0764b.scala:27: error: type mismatch;
+ found : p1.t0764.Node{type T = p1.t0764.<refinement>.type}
+ required: p1.t0764.NodeAlias[p1.t0764.NodeAlias[A]]
+ (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}}
+ private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail
+ ^
+t0764b.scala:28: error: type mismatch;
+ found : p1.t0764.Node{type T = p1.t0764.<refinement>.type}
+ required: p1.t0764.NodeAlias[p1.t0764.Node{type T = A}]
+ (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}}
+ private[this] def f3 = new Main1[Node { type T = A }](v.prepend) // fail
+ ^
+t0764b.scala:34: error: type mismatch;
+ found : p1.t0764.Node{type T = p1.t0764.<refinement>.type}
+ required: p1.t0764.Node{type T = p1.t0764.NodeAlias[A]}
+ (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}}
+ private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail
+ ^
+t0764b.scala:35: error: type mismatch;
+ found : p1.t0764.Node{type T = p1.t0764.<refinement>.type}
+ required: p1.t0764.Node{type T = p1.t0764.Node{type T = A}}
+ private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail
+ ^
+t0764b.scala:51: error: type mismatch;
+ found : p2.t0764.Node{type T = p2.t0764.<refinement>.type}
+ required: p2.t0764.NodeAlias[p2.t0764.NodeAlias[A]]
+ (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}}
+ private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail
+ ^
+t0764b.scala:52: error: type mismatch;
+ found : p2.t0764.Node{type T = p2.t0764.<refinement>.type}
+ required: p2.t0764.NodeAlias[p2.t0764.Node{type T = A}]
+ (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}}
+ private[this] def f3 = new Main1[Node { type T = A }](v.prepend) // fail
+ ^
+t0764b.scala:58: error: type mismatch;
+ found : p2.t0764.Node{type T = p2.t0764.<refinement>.type}
+ required: p2.t0764.Node{type T = p2.t0764.NodeAlias[A]}
+ (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}}
+ private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail
+ ^
+t0764b.scala:59: error: type mismatch;
+ found : p2.t0764.Node{type T = p2.t0764.<refinement>.type}
+ required: p2.t0764.Node{type T = p2.t0764.Node{type T = A}}
+ private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail
+ ^
+8 errors found
diff --git a/test/files/neg/t0764b.scala b/test/files/neg/t0764b.scala
new file mode 100644
index 0000000000..14c623c67a
--- /dev/null
+++ b/test/files/neg/t0764b.scala
@@ -0,0 +1,63 @@
+// see neg/t0764 why this should probably be a pos/ test -- alas something's wrong with existential subtyping (?)
+
+// In all cases when calling "prepend" the receiver 'v'
+// has static type NodeAlias[A] or (equivalently) Node { type T = A }.
+// Since prepend explicitly returns the singleton type of the receiver,
+// the return type of prepend in all cases is "v.type", and so the call
+// to "new Main" can be parameterized with any of the following, in order
+// of decreasing specificity with a tie for second place:
+//
+// new Main[v.type](v.prepend)
+// new Main[NodeAlias[A]](v.prepend)
+// new Main[Node { type T = A }](v.prepend)
+// new Main(v.prepend)
+
+// the `fail` comments below denote what didn't compile before SI-8177 fixed all of them
+
+package p1 {
+ object t0764 {
+ type NodeAlias[A] = Node { type T = A }
+ trait Node { outer =>
+ type T <: Node
+ def prepend: Node { type T = outer.type } = ???
+ }
+
+ class Main1[A <: Node](v: NodeAlias[A]) {
+ private[this] def f1 = new Main1(v.prepend) // fail
+ private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail
+ private[this] def f3 = new Main1[Node { type T = A }](v.prepend) // fail
+ private[this] def f4 = new Main1[v.type](v.prepend) // ok
+ }
+
+ class Main2[A <: Node](v: Node { type T = A }) {
+ private[this] def f1 = new Main2(v.prepend) // fail
+ private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail
+ private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail
+ private[this] def f4 = new Main2[v.type](v.prepend) // ok
+ }
+ }
+}
+
+package p2 {
+ object t0764 {
+ type NodeAlias[A] = Node { type T = A }
+ trait Node { outer =>
+ type T <: Node
+ def prepend: NodeAlias[outer.type] = ???
+ }
+
+ class Main1[A <: Node](v: NodeAlias[A]) {
+ private[this] def f1 = new Main1(v.prepend) // ok! <<========== WOT
+ private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail
+ private[this] def f3 = new Main1[Node { type T = A }](v.prepend) // fail
+ private[this] def f4 = new Main1[v.type](v.prepend) // ok
+ }
+
+ class Main2[A <: Node](v: Node { type T = A }) {
+ private[this] def f1 = new Main2(v.prepend) // fail
+ private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail
+ private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail
+ private[this] def f4 = new Main2[v.type](v.prepend) // ok
+ }
+ }
+}
diff --git a/test/files/neg/t3873.check b/test/files/neg/t3873.check
index 54d6abdf63..f9f413aeaf 100644
--- a/test/files/neg/t3873.check
+++ b/test/files/neg/t3873.check
@@ -1,6 +1,6 @@
t3873.scala:11: error: type mismatch;
found : Test.a.B
- required: a.B
- wrongf(new A)(a.b) // should not compile -- TODO: improve error message? the "a" is ambiguous
+ required: a.B where val a: A
+ wrongf(new A)(a.b) // should not compile
^
one error found
diff --git a/test/files/neg/t3873.scala b/test/files/neg/t3873.scala
index e7815f0937..b27b4e9c9d 100644
--- a/test/files/neg/t3873.scala
+++ b/test/files/neg/t3873.scala
@@ -8,5 +8,5 @@ object Test {
val a = new A
wrongf(a)(a.b)
- wrongf(new A)(a.b) // should not compile -- TODO: improve error message? the "a" is ambiguous
+ wrongf(new A)(a.b) // should not compile
} \ No newline at end of file
diff --git a/test/files/neg/t4749.check b/test/files/neg/t4749.check
index 63d5c21532..3539140954 100644
--- a/test/files/neg/t4749.check
+++ b/test/files/neg/t4749.check
@@ -25,6 +25,10 @@ t4749.scala:26: warning: Fail6 has a main method with parameter type Array[Strin
object Fail6 {
^
+t4749.scala:42: warning: Win3 has a main method with parameter type Array[String], but bippy.Win3 will not be a runnable program.
+ Reason: main method must have exact signature (Array[String])Unit
+ object Win3 extends WinBippy[Unit] { }
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-6 warnings found
+7 warnings found
one error found
diff --git a/test/files/neg/t4818.check b/test/files/neg/t4818.check
index 8a2c024b30..a5e15e456b 100644
--- a/test/files/neg/t4818.check
+++ b/test/files/neg/t4818.check
@@ -1,6 +1,6 @@
t4818.scala:4: error: type mismatch;
found : Int(5)
- required: A
+ required: Nothing
def f(x: Any) = x match { case Fn(f) => f(5) }
^
one error found
diff --git a/test/files/neg/t5189.check b/test/files/neg/t5189.check
index aecc1d11c4..4885de99cd 100644
--- a/test/files/neg/t5189.check
+++ b/test/files/neg/t5189.check
@@ -1,5 +1,5 @@
t5189.scala:3: error: type mismatch;
- found : T => U
+ found : Nothing => Any
required: Any => Any
def f(x: Any): Any => Any = x match { case Foo(bar) => bar }
^
diff --git a/test/files/neg/t5760-pkgobj-warn.check b/test/files/neg/t5760-pkgobj-warn.check
deleted file mode 100644
index a89398c3f7..0000000000
--- a/test/files/neg/t5760-pkgobj-warn.check
+++ /dev/null
@@ -1,4 +0,0 @@
-stalepkg_2.scala:6: error: Foo is already defined as class Foo in package object stalepkg
- class Foo
- ^
-one error found
diff --git a/test/files/neg/t5954.check b/test/files/neg/t5954.check
deleted file mode 100644
index 3950d14e4e..0000000000
--- a/test/files/neg/t5954.check
+++ /dev/null
@@ -1,18 +0,0 @@
-t5954.scala:36: warning: class D should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954.
- case class D()
- ^
-t5954.scala:35: warning: object C should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954.
- object C
- ^
-t5954.scala:34: warning: trait C should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954.
- trait C
- ^
-t5954.scala:33: warning: object B should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954.
- object B
- ^
-t5954.scala:32: warning: class B should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954.
- class B
- ^
-error: No warnings can be incurred under -Xfatal-warnings.
-5 warnings found
-one error found
diff --git a/test/files/neg/t5954.scala b/test/files/neg/t5954.scala
deleted file mode 100644
index 3ccb5ed3ff..0000000000
--- a/test/files/neg/t5954.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-// if you ever think you've fixed the underlying reason for the warning
-// imposed by SI-5954, then here's a test that should pass with two "succes"es
-//
-//import scala.tools.partest._
-//
-//object Test extends DirectTest {
-// def code = ???
-//
-// def problemCode = """
-// package object A {
-// class B
-// object B
-// case class C()
-// }
-// """
-//
-// def compileProblemCode() = {
-// val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
-// compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(problemCode)
-// }
-//
-// def show() : Unit = {
-// for (i <- 0 until 2) {
-// compileProblemCode()
-// println(s"success ${i + 1}")
-// }
-// }
-//}
-
-package object A {
- // these should be prevented by the implementation restriction
- class B
- object B
- trait C
- object C
- case class D()
- // all the rest of these should be ok
- class E
- object F
- val g = "omg"
- var h = "wtf"
- def i = "lol"
- type j = String
- class K(val k : Int) extends AnyVal
- implicit class L(val l : Int)
-}
diff --git a/test/files/neg/t6260-named.check b/test/files/neg/t6260-named.check
new file mode 100644
index 0000000000..ed6ab5e76f
--- /dev/null
+++ b/test/files/neg/t6260-named.check
@@ -0,0 +1,13 @@
+t6260-named.scala:12: error: bridge generated for member method apply: (a: C[Any])C[Any] in object O
+which overrides method apply: (v1: T1)R in trait Function1
+clashes with definition of the member itself;
+both have erased type (v1: Object)Object
+ def apply(a: C[Any]) = a
+ ^
+t6260-named.scala:14: error: bridge generated for member method apply: (a: C[Any])C[Any] in class X
+which overrides method apply: (a: A)A in trait T
+clashes with definition of the member itself;
+both have erased type (a: Object)Object
+ class X extends T[C[Any]] { def apply(a: C[Any]) = a }
+ ^
+two errors found
diff --git a/test/files/neg/t6260-named.scala b/test/files/neg/t6260-named.scala
new file mode 100644
index 0000000000..7cd9ce8473
--- /dev/null
+++ b/test/files/neg/t6260-named.scala
@@ -0,0 +1,15 @@
+class C[A](private val a: Any) extends AnyVal
+trait T[A] {
+ def apply(a: A): A
+}
+
+object Test {
+ (x: C[Any]) => {println(s"f($x)"); x} // okay
+ new T[C[Any]] { def apply(a: C[Any]) = a } // okay
+
+ // we can't rename the specific apply method to avoid the clash
+ object O extends Function1[C[Any], C[Any]] {
+ def apply(a: C[Any]) = a
+ }
+ class X extends T[C[Any]] { def apply(a: C[Any]) = a }
+}
diff --git a/test/files/neg/t6260.check b/test/files/neg/t6260.check
deleted file mode 100644
index 60c4add143..0000000000
--- a/test/files/neg/t6260.check
+++ /dev/null
@@ -1,13 +0,0 @@
-t6260.scala:3: error: bridge generated for member method apply: (bx: Box[X])Box[Y] in <$anon: Box[X] => Box[Y]>
-which overrides method apply: (v1: T1)R in trait Function1
-clashes with definition of the member itself;
-both have erased type (v1: Object)Object
- ((bx: Box[X]) => new Box(f(bx.x)))(this)
- ^
-t6260.scala:8: error: bridge generated for member method apply: (bx: Box[X])Box[Y] in <$anon: Box[X] => Box[Y]>
-which overrides method apply: (v1: T1)R in trait Function1
-clashes with definition of the member itself;
-both have erased type (v1: Object)Object
- ((bx: Box[X]) => new Box(f(bx.x)))(self)
- ^
-two errors found
diff --git a/test/files/neg/t6260b.check b/test/files/neg/t6260b.check
deleted file mode 100644
index 3a7e8947aa..0000000000
--- a/test/files/neg/t6260b.check
+++ /dev/null
@@ -1,7 +0,0 @@
-t6260b.scala:3: error: bridge generated for member method apply: ()X in <$anon: () => X>
-which overrides method apply: ()R in trait Function0
-clashes with definition of the member itself;
-both have erased type ()Object
-class Y { def f = new X("") or new X("") }
- ^
-one error found
diff --git a/test/files/neg/t6680a.flags b/test/files/neg/t6680a.flags
new file mode 100644
index 0000000000..19243266d1
--- /dev/null
+++ b/test/files/neg/t6680a.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/test/files/neg/t6829.check b/test/files/neg/t6829.check
index a0b43e3b52..914a1c9260 100644
--- a/test/files/neg/t6829.check
+++ b/test/files/neg/t6829.check
@@ -16,32 +16,32 @@ t6829.scala:49: error: not found: value nextState
val (s,a,s2) = (state,actions(agent),nextState)
^
t6829.scala:50: error: type mismatch;
- found : s.type (with underlying type T1)
+ found : s.type (with underlying type Any)
required: _53.State where val _53: G
val r = rewards(agent).r(s,a,s2)
^
t6829.scala:50: error: type mismatch;
- found : a.type (with underlying type T2)
+ found : a.type (with underlying type Any)
required: _53.Action where val _53: G
val r = rewards(agent).r(s,a,s2)
^
t6829.scala:50: error: type mismatch;
- found : s2.type (with underlying type T3)
+ found : s2.type (with underlying type Any)
required: _53.State where val _53: G
val r = rewards(agent).r(s,a,s2)
^
t6829.scala:51: error: type mismatch;
- found : s.type (with underlying type T1)
+ found : s.type (with underlying type Any)
required: _50.State
agent.learn(s,a,s2,r): G#Agent
^
t6829.scala:51: error: type mismatch;
- found : a.type (with underlying type T2)
+ found : a.type (with underlying type Any)
required: _50.Action
agent.learn(s,a,s2,r): G#Agent
^
t6829.scala:51: error: type mismatch;
- found : s2.type (with underlying type T3)
+ found : s2.type (with underlying type Any)
required: _50.State
agent.learn(s,a,s2,r): G#Agent
^
diff --git a/test/files/neg/t7475c.check b/test/files/neg/t7475c.check
new file mode 100644
index 0000000000..472808131a
--- /dev/null
+++ b/test/files/neg/t7475c.check
@@ -0,0 +1,7 @@
+t7475c.scala:6: error: value a is not a member of A.this.B
+ println(this.a) // wait, what?
+ ^
+t7475c.scala:7: error: value b is not a member of A.this.B
+ println(this.b) // wait, what?
+ ^
+two errors found
diff --git a/test/files/neg/t7475c.scala b/test/files/neg/t7475c.scala
new file mode 100644
index 0000000000..cd4a8762ca
--- /dev/null
+++ b/test/files/neg/t7475c.scala
@@ -0,0 +1,9 @@
+class A {
+ private val a: Int = 0
+ private[this] val b: Int = 0
+ class B extends A {
+ def foo(a: A) = a.a // okay
+ println(this.a) // wait, what?
+ println(this.b) // wait, what?
+ }
+}
diff --git a/test/files/neg/t7475d.check b/test/files/neg/t7475d.check
new file mode 100644
index 0000000000..6bd1da0d44
--- /dev/null
+++ b/test/files/neg/t7475d.check
@@ -0,0 +1,7 @@
+t7475d.scala:4: error: value priv is not a member of T.this.TT
+ (??? : TT).priv
+ ^
+t7475d.scala:10: error: value priv is not a member of U.this.UU
+ (??? : UU).priv
+ ^
+two errors found
diff --git a/test/files/neg/t7475e.check b/test/files/neg/t7475e.check
new file mode 100644
index 0000000000..48af2be51a
--- /dev/null
+++ b/test/files/neg/t7475e.check
@@ -0,0 +1,4 @@
+t7475e.scala:8: error: value priv is not a member of Base.this.TT
+ (??? : TT).priv
+ ^
+one error found
diff --git a/test/files/neg/t7475e.scala b/test/files/neg/t7475e.scala
new file mode 100644
index 0000000000..e5c4877d6e
--- /dev/null
+++ b/test/files/neg/t7475e.scala
@@ -0,0 +1,12 @@
+trait U {
+}
+
+trait Base {
+ private val priv = 0
+
+ type TT = U with T // should exclude `priv`
+ (??? : TT).priv
+}
+
+trait T extends Base {
+}
diff --git a/test/files/neg/t7475f.check b/test/files/neg/t7475f.check
new file mode 100644
index 0000000000..a07a4480e2
--- /dev/null
+++ b/test/files/neg/t7475f.check
@@ -0,0 +1,10 @@
+t7475f.scala:12: error: method c1 in class C cannot be accessed in C[T]
+ c1 // a member, but inaccessible.
+ ^
+t7475f.scala:13: error: not found: value c2
+ c2 // a member, but inaccessible.
+ ^
+t7475f.scala:26: error: value d2 is not a member of D[Any]
+ other.d2 // not a member
+ ^
+three errors found
diff --git a/test/files/neg/t7475f.scala b/test/files/neg/t7475f.scala
new file mode 100644
index 0000000000..6c5feadf19
--- /dev/null
+++ b/test/files/neg/t7475f.scala
@@ -0,0 +1,28 @@
+class C[T] extends D[T] {
+ private def c1 = 0
+ private[this] def c2 = 0
+}
+
+trait D[T] {
+ self: C[T] =>
+
+ private def d1 = 0
+ private[this] def d2 = 0
+
+ c1 // a member, but inaccessible.
+ c2 // a member, but inaccessible.
+
+ d1 // okay
+ d2 // okay
+
+
+ class C {
+ d1
+ d2
+ }
+
+ def x(other: D[Any]) {
+ other.d1
+ other.d2 // not a member
+ }
+}
diff --git a/test/files/neg/t7507.check b/test/files/neg/t7507.check
index d402869fd4..de30fc7057 100644
--- a/test/files/neg/t7507.check
+++ b/test/files/neg/t7507.check
@@ -1,4 +1,4 @@
-t7507.scala:6: error: value bippy in trait Cake cannot be accessed in Cake
+t7507.scala:6: error: not found: value bippy
locally(bippy)
^
one error found
diff --git a/test/files/neg/t7886.check b/test/files/neg/t7886.check
deleted file mode 100644
index 338eee9708..0000000000
--- a/test/files/neg/t7886.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t7886.scala:10: error: type mismatch;
- found : Contra[A]
- required: Contra[Any]
- case Unravel(m, msg) => g(m)
- ^
-one error found
diff --git a/test/files/neg/t8104/Test_2.scala b/test/files/neg/t8104/Test_2.scala
index 585f76c00f..a3bd940188 100644
--- a/test/files/neg/t8104/Test_2.scala
+++ b/test/files/neg/t8104/Test_2.scala
@@ -9,7 +9,7 @@ object Test extends App {
case class C(x: Int, y: Int)
import scala.reflect.runtime.universe._
- def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: TypeTag[Repr]) = println(tag)
+ def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: WeakTypeTag[Repr]) = println(tag)
reprify(C(40, 2))
// this is a compilation error at the moment as explained in SI-8104
diff --git a/test/files/neg/t8177a.check b/test/files/neg/t8177a.check
new file mode 100644
index 0000000000..0d01206e0c
--- /dev/null
+++ b/test/files/neg/t8177a.check
@@ -0,0 +1,6 @@
+t8177a.scala:5: error: type mismatch;
+ found : A{type Result = Int}
+ required: A{type Result = String}
+ : A { type Result = String} = x
+ ^
+one error found
diff --git a/test/files/neg/t8177a.scala b/test/files/neg/t8177a.scala
new file mode 100644
index 0000000000..d1e47f8c1e
--- /dev/null
+++ b/test/files/neg/t8177a.scala
@@ -0,0 +1,6 @@
+trait A { type Result }
+
+class PolyTests {
+ def wrong(x: A { type Result = Int })
+ : A { type Result = String} = x
+} \ No newline at end of file
diff --git a/test/files/neg/t8207.check b/test/files/neg/t8207.check
new file mode 100644
index 0000000000..59facd897a
--- /dev/null
+++ b/test/files/neg/t8207.check
@@ -0,0 +1,7 @@
+t8207.scala:1: error: '.' expected but '}' found.
+class C { import C.this.toString }
+ ^
+t8207.scala:3: error: '.' expected but '}' found.
+class D { import D.this.toString }
+ ^
+two errors found
diff --git a/test/files/neg/t8207.scala b/test/files/neg/t8207.scala
new file mode 100644
index 0000000000..738ce381f4
--- /dev/null
+++ b/test/files/neg/t8207.scala
@@ -0,0 +1,3 @@
+class C { import C.this.toString }
+
+class D { import D.this.toString }
diff --git a/test/files/neg/t8219-any-any-ref-equals.check b/test/files/neg/t8219-any-any-ref-equals.check
new file mode 100644
index 0000000000..95d2536fba
--- /dev/null
+++ b/test/files/neg/t8219-any-any-ref-equals.check
@@ -0,0 +1,10 @@
+t8219-any-any-ref-equals.scala:5: error: method ==: (x$1: Any)Boolean does not take type parameters.
+ "".==[Int]
+ ^
+t8219-any-any-ref-equals.scala:6: error: method ==: (x$1: Any)Boolean does not take type parameters.
+ ("": AnyRef).==[Int]
+ ^
+t8219-any-any-ref-equals.scala:7: error: method ==: (x$1: Any)Boolean does not take type parameters.
+ ("": Object).==[Int]
+ ^
+three errors found
diff --git a/test/files/neg/t8219-any-any-ref-equals.scala b/test/files/neg/t8219-any-any-ref-equals.scala
new file mode 100644
index 0000000000..f1b81fa734
--- /dev/null
+++ b/test/files/neg/t8219-any-any-ref-equals.scala
@@ -0,0 +1,8 @@
+object Test {
+ // The error message tells us that AnyRef#== and Any#== are overloaded.
+ // A real class couldn't define such an overload, why do we allow AnyRef
+ // to do so?
+ "".==[Int]
+ ("": AnyRef).==[Int]
+ ("": Object).==[Int]
+}
diff --git a/test/files/neg/t8237-default.check b/test/files/neg/t8237-default.check
new file mode 100644
index 0000000000..59fe21ed03
--- /dev/null
+++ b/test/files/neg/t8237-default.check
@@ -0,0 +1,13 @@
+t8237-default.scala:5: error: no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T[?T[List[?T[X forSome { type X }]]]]
+ test4(test4$default$1)
+ ^
+t8237-default.scala:5: error: type mismatch;
+ found : List[Int]
+ required: T[T[List[T[X forSome { type X }]]]]
+ test4(test4$default$1)
+ ^
+two errors found
diff --git a/test/files/neg/t8237-default.scala b/test/files/neg/t8237-default.scala
new file mode 100644
index 0000000000..f695aa523f
--- /dev/null
+++ b/test/files/neg/t8237-default.scala
@@ -0,0 +1,29 @@
+// This test case was extracte from `names-defaults-neg.scala`
+// It pinpoints an improvement an error message that results from
+// a type inference failure
+object Test extends App {
+ test4(test4$default$1)
+
+ def test4[T[P]](x: T[T[List[T[X forSome { type X }]]]]) = ???
+ def test4$default$1[T[P]]: List[Int] = ???
+}
+
+/*
+OLD:
+ no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T
+ test4(test4$default$1)
+ ^
+
+NEW:
+
+no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T[?T[List[?T[X forSome { type X }]]]
+ test4(test4$default$1)
+*/
diff --git a/test/files/neg/t8244.check b/test/files/neg/t8244.check
new file mode 100644
index 0000000000..90b2bf6f46
--- /dev/null
+++ b/test/files/neg/t8244.check
@@ -0,0 +1,4 @@
+Test_2.scala:9: error: value exxx is not a member of ?0
+ raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X
+ ^
+one error found
diff --git a/test/files/neg/t8244/Raw_1.java b/test/files/neg/t8244/Raw_1.java
new file mode 100644
index 0000000000..0c667f1106
--- /dev/null
+++ b/test/files/neg/t8244/Raw_1.java
@@ -0,0 +1,4 @@
+public abstract class Raw_1<T>{
+ public Raw_1 raw() { return new Raw_1<String>() { public String t() { return ""; } }; }
+ public abstract T t();
+}
diff --git a/test/files/neg/t8244/Test_2.scala b/test/files/neg/t8244/Test_2.scala
new file mode 100644
index 0000000000..152bb0b870
--- /dev/null
+++ b/test/files/neg/t8244/Test_2.scala
@@ -0,0 +1,12 @@
+class X extends Raw_1[X] {
+ override def t = this
+ def exxx = 0
+}
+
+object Test extends App {
+ def c(s: X) = {
+ val raw = s.raw
+ raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X
+ }
+ c(new X())
+}
diff --git a/test/files/neg/t8244b.check b/test/files/neg/t8244b.check
new file mode 100644
index 0000000000..f6cbf99eb5
--- /dev/null
+++ b/test/files/neg/t8244b.check
@@ -0,0 +1,4 @@
+t8244b.scala:15: error: value exxx is not a member of _$1
+ raw.t.exxx
+ ^
+one error found
diff --git a/test/files/neg/t8244b.scala b/test/files/neg/t8244b.scala
new file mode 100644
index 0000000000..2fb4f451a1
--- /dev/null
+++ b/test/files/neg/t8244b.scala
@@ -0,0 +1,18 @@
+class Raw_1[T]{
+ def raw(): Raw_1[_] = { new Raw_1[String] { def t() = "" } }
+ def t(): T
+}
+
+
+class X extends Raw_1[X] {
+ override def t = this
+ def exxx = 0
+}
+
+object Test extends App {
+ def c(s: X) = {
+ val raw = s.raw
+ raw.t.exxx
+ }
+ c(new X())
+}
diff --git a/test/files/neg/t8244c.check b/test/files/neg/t8244c.check
new file mode 100644
index 0000000000..fd58a5847c
--- /dev/null
+++ b/test/files/neg/t8244c.check
@@ -0,0 +1,4 @@
+t8244c.scala:15: error: value exxx is not a member of _$1
+ raw.t.exxx
+ ^
+one error found
diff --git a/test/files/neg/t8244c.scala b/test/files/neg/t8244c.scala
new file mode 100644
index 0000000000..2fb4f451a1
--- /dev/null
+++ b/test/files/neg/t8244c.scala
@@ -0,0 +1,18 @@
+class Raw_1[T]{
+ def raw(): Raw_1[_] = { new Raw_1[String] { def t() = "" } }
+ def t(): T
+}
+
+
+class X extends Raw_1[X] {
+ override def t = this
+ def exxx = 0
+}
+
+object Test extends App {
+ def c(s: X) = {
+ val raw = s.raw
+ raw.t.exxx
+ }
+ c(new X())
+}
diff --git a/test/files/neg/t8244e.check b/test/files/neg/t8244e.check
new file mode 100644
index 0000000000..ebd74036e5
--- /dev/null
+++ b/test/files/neg/t8244e.check
@@ -0,0 +1,4 @@
+Test.scala:9: error: value exxx is not a member of ?0
+ raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X
+ ^
+one error found
diff --git a/test/files/neg/t8244e/Raw.java b/test/files/neg/t8244e/Raw.java
new file mode 100644
index 0000000000..53202e319d
--- /dev/null
+++ b/test/files/neg/t8244e/Raw.java
@@ -0,0 +1,4 @@
+public abstract class Raw<T>{
+ public Raw raw() { return new Raw<String>() { public String t() { return ""; } }; }
+ public abstract T t();
+}
diff --git a/test/files/neg/t8244e/Test.scala b/test/files/neg/t8244e/Test.scala
new file mode 100644
index 0000000000..ca2a90583f
--- /dev/null
+++ b/test/files/neg/t8244e/Test.scala
@@ -0,0 +1,12 @@
+class X extends Raw[X] {
+ override def t = this
+ def exxx = 0
+}
+
+object Test extends App {
+ def c(s: X) = {
+ val raw = s.raw
+ raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X
+ }
+ c(new X())
+}
diff --git a/test/files/neg/t8266-invalid-interp.check b/test/files/neg/t8266-invalid-interp.check
new file mode 100644
index 0000000000..70dd4081b0
--- /dev/null
+++ b/test/files/neg/t8266-invalid-interp.check
@@ -0,0 +1,10 @@
+t8266-invalid-interp.scala:4: error: Trailing '\' escapes nothing.
+ f"a\",
+ ^
+t8266-invalid-interp.scala:5: error: invalid escape character at index 1 in "a\xc"
+ f"a\xc",
+ ^
+t8266-invalid-interp.scala:7: error: invalid escape character at index 1 in "a\vc"
+ f"a\vc"
+ ^
+three errors found
diff --git a/test/files/neg/t8266-invalid-interp.scala b/test/files/neg/t8266-invalid-interp.scala
new file mode 100644
index 0000000000..4b26546880
--- /dev/null
+++ b/test/files/neg/t8266-invalid-interp.scala
@@ -0,0 +1,9 @@
+
+trait X {
+ def f = Seq(
+ f"a\",
+ f"a\xc",
+ // following could suggest \u000b for vertical tab, similar for \a alert
+ f"a\vc"
+ )
+}
diff --git a/test/files/neg/delambdafy_t6260_method.check b/test/files/pos/delambdafy_t6260_method.check
index f5cd6947d1..f5cd6947d1 100644
--- a/test/files/neg/delambdafy_t6260_method.check
+++ b/test/files/pos/delambdafy_t6260_method.check
diff --git a/test/files/neg/delambdafy_t6260_method.flags b/test/files/pos/delambdafy_t6260_method.flags
index 48b438ddf8..48b438ddf8 100644
--- a/test/files/neg/delambdafy_t6260_method.flags
+++ b/test/files/pos/delambdafy_t6260_method.flags
diff --git a/test/files/neg/delambdafy_t6260_method.scala b/test/files/pos/delambdafy_t6260_method.scala
index 93b5448227..93b5448227 100644
--- a/test/files/neg/delambdafy_t6260_method.scala
+++ b/test/files/pos/delambdafy_t6260_method.scala
diff --git a/test/files/pos/existential-java-case-class/Client.scala b/test/files/pos/existential-java-case-class/Client.scala
new file mode 100644
index 0000000000..368899820f
--- /dev/null
+++ b/test/files/pos/existential-java-case-class/Client.scala
@@ -0,0 +1,3 @@
+case class CC(x: J[_])
+
+case class CC1(x: Any => J[_])
diff --git a/test/files/pos/existential-java-case-class/J.java b/test/files/pos/existential-java-case-class/J.java
new file mode 100644
index 0000000000..7fd7848286
--- /dev/null
+++ b/test/files/pos/existential-java-case-class/J.java
@@ -0,0 +1 @@
+public class J<T extends String> {}
diff --git a/test/files/pos/macro-bundle-disambiguate-bundle.check b/test/files/pos/macro-bundle-disambiguate-bundle.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/macro-bundle-disambiguate-bundle.check
diff --git a/test/files/pos/macro-bundle-disambiguate-bundle.scala b/test/files/pos/macro-bundle-disambiguate-bundle.scala
new file mode 100644
index 0000000000..04809317e1
--- /dev/null
+++ b/test/files/pos/macro-bundle-disambiguate-bundle.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: Context) {
+ def impl = ???
+}
+
+object Macros {
+ def impl(c: Context)(x: c.Tree) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+} \ No newline at end of file
diff --git a/test/files/pos/macro-bundle-disambiguate-nonbundle.check b/test/files/pos/macro-bundle-disambiguate-nonbundle.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/macro-bundle-disambiguate-nonbundle.check
diff --git a/test/files/pos/macro-bundle-disambiguate-nonbundle.scala b/test/files/pos/macro-bundle-disambiguate-nonbundle.scala
new file mode 100644
index 0000000000..cb66f28a0b
--- /dev/null
+++ b/test/files/pos/macro-bundle-disambiguate-nonbundle.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+class Macros(val c: Context) {
+ def impl(x: c.Tree) = ???
+}
+
+object Macros {
+ def impl(c: Context) = ???
+}
+
+object Test extends App {
+ def foo: Unit = macro Macros.impl
+} \ No newline at end of file
diff --git a/test/files/neg/t5954.flags b/test/files/pos/package-ob-case.flags
index 85d8eb2ba2..85d8eb2ba2 100644
--- a/test/files/neg/t5954.flags
+++ b/test/files/pos/package-ob-case.flags
diff --git a/test/files/neg/package-ob-case.scala b/test/files/pos/package-ob-case/A_1.scala
index 91a1fb7e48..91a1fb7e48 100644
--- a/test/files/neg/package-ob-case.scala
+++ b/test/files/pos/package-ob-case/A_1.scala
diff --git a/test/files/pos/package-ob-case/B_2.scala b/test/files/pos/package-ob-case/B_2.scala
new file mode 100644
index 0000000000..91a1fb7e48
--- /dev/null
+++ b/test/files/pos/package-ob-case/B_2.scala
@@ -0,0 +1,5 @@
+package foo {
+ package object foo {
+ case class X(z: Int) { }
+ }
+}
diff --git a/test/files/pos/t1786-counter.scala b/test/files/pos/t1786-counter.scala
new file mode 100644
index 0000000000..c1ad2c204f
--- /dev/null
+++ b/test/files/pos/t1786-counter.scala
@@ -0,0 +1,38 @@
+trait ShapeLevel
+
+object Fail {
+ abstract class ProductNodeShape[Level <: ShapeLevel, C, M <: C, U <: C, P <: C] extends Shape[Level, M, U, P] {
+ def copy(shapes: Seq[Shape[_, _, _, _]]): Shape[Level, _, _, _]
+ }
+
+ abstract class Shape[Level <: ShapeLevel, -Mixed_, Unpacked_, Packed_]
+
+ final class TupleShape[Level <: ShapeLevel, M <: Product, U <: Product, P <: Product](val shapes: Shape[_, _, _, _]*) extends ProductNodeShape[Level, Product, M, U, P] {
+ def copy(shapes: Seq[Shape[_, _, _, _]]): Shape[Level, _, _, _] = ???
+ }
+
+ trait ShapeLevel
+}
+
+object Ok {
+ abstract class Shape[Level <: ShapeLevel, -Mixed_, Unpacked_, Packed_]
+
+ abstract class ProductNodeShape[Level <: ShapeLevel, C, M <: C, U <: C, P <: C] extends Shape[Level, M, U, P] {
+ def copy(shapes: Seq[Shape[_, _, _, _]]): Shape[Level, _, _, _]
+ }
+
+ final class TupleShape[Level <: ShapeLevel, M <: Product, U <: Product, P <: Product](val shapes: Shape[_, _, _, _]*) extends ProductNodeShape[Level, Product, M, U, P] {
+ def copy(shapes: Seq[Shape[_, _, _, _]]): Shape[Level, _, _, _] = ???
+ }
+}
+
+// This is why we reverted the fix for SI-1786 -- see SI-6169 for a potential alternative that could be extended to cover this.
+// both objects type check on 2.10.3, but only Ok was accepted by 2.11 after the original fix to SI-1786.
+// Fail results in:
+/*
+t1786-counter.scala:10: error: class TupleShape needs to be abstract, since method copy in class ProductNodeShape of type (shapes: Seq[Fail.Shape[_, _, _, _]])Fail.Shape[Level, _, _, _] is not defined
+(Note that Seq[Fail.Shape[_, _, _, _]] does not match Seq[Fail.Shape[_ <: Fail.ShapeLevel, _, _, _]]: their type parameters differ)
+ final class TupleShape[Level <: ShapeLevel, M <: Product, U <: Product, P <: Product](val shapes: Shape[_, _, _, _]*) extends ProductNodeShape[Level, Product, M, U, P] {
+ ^
+one error found
+*/ \ No newline at end of file
diff --git a/test/files/pos/t1786-cycle.scala b/test/files/pos/t1786-cycle.scala
new file mode 100644
index 0000000000..af5d892c6a
--- /dev/null
+++ b/test/files/pos/t1786-cycle.scala
@@ -0,0 +1,57 @@
+trait GenTraversableLike[+A, +Repr] extends Any
+
+object O {
+ (null: Any) match {
+ case _: LongTraversableLike[_] =>
+ }
+}
+
+trait LongTraversable extends LongTraversableLike[LongTraversable]
+
+trait LongTraversableLike[+Repr <: LongTraversableLike[Repr]] extends GenTraversableLike[Any, Repr]
+
+/*
+% scalac-hash v2.11.0-M8 test/files/pos/t1786-cycle.scala
+[warn] v2.11.0-M8 failed, using closest available
+test/files/pos/t1786-cycle.scala:11: error: illegal cyclic reference involving trait LongTraversableLike
+trait LongTraversableLike[+Repr <: LongTraversableLike[Repr]] extends GenTraversableLike[Any, Repr]
+ ^
+one error found
+
+Okay again after SI-1786 was reverted.
+
+
+|-- object O BYVALmode-EXPRmode (site: package <empty>)
+| |-- super EXPRmode-POLYmode-QUALmode (silent: <init> in O)
+| | |-- this EXPRmode (silent: <init> in O)
+| | | \-> O.type
+| | \-> O.type
+| |-- (null: Any) match { case (_: LongTraversableLike[(_ @ <em... BYVALmode-EXPRmode (site: value <local O> in O)
+| | |-- (null: Any) BYVALmode-EXPRmode (site: value <local O> in O)
+| | | |-- Any TYPEmode (site: value <local O> in O)
+| | | | \-> Any
+| | | |-- null : pt=Any EXPRmode (site: value <local O> in O)
+| | | | \-> Null(null)
+| | | \-> Any
+| | |-- (_: LongTraversableLike[(_ @ <empty>)]) : pt=Any PATTERNmode (site: value <local O> in O) enrichment only
+| | | |-- LongTraversableLike[(_ @ <empty>)] TYPEPATmode-TYPEmode (site: value <local O> in O) enrichment only
+| | | | |-- <: LongTraversableLike[Repr] TYPEmode (site: type Repr in <empty>)
+| | | | | |-- LongTraversableLike[Repr] TYPEmode (site: type Repr in <empty>)
+| | | | | | |-- Repr NOmode (site: type Repr in <empty>)
+| | | | | | | \-> Repr
+| | | | | | \-> LongTraversableLike[Repr]
+| | | | | [adapt] <: LongTraversableLike[Repr] is now a TypeTree( <: LongTraversableLike[Repr])
+| | | | | \-> <: LongTraversableLike[Repr]
+| | | | |-- (_ @ <empty>) TYPEPATmode-TYPEmode (site: value <local O> in O) enrichment only
+| | | | | \-> _
+| | | | |-- GenTraversableLike FUNmode-TYPEmode (site: trait LongTraversableLike)
+| | | | | \-> GenTraversableLike
+| | | | |-- GenTraversableLike[Any, Repr] TYPEmode (site: trait LongTraversableLike)
+| | | | | |-- Any TYPEmode (site: trait LongTraversableLike)
+| | | | | | \-> Any
+| | | | | |-- Repr TYPEmode (site: trait LongTraversableLike)
+| | | | | | \-> Repr
+| | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving trait LongTraversableLike: while typing GenTraversableLike[Any, Repr]
+test/files/pos/t1786-cycle.scala:11: error: illegal cyclic reference involving trait LongTraversableLike
+trait LongTraversableLike[+Repr <: LongTraversableLike[Repr]] extends GenT
+*/ \ No newline at end of file
diff --git a/test/files/pos/t261-ab.scala b/test/files/pos/t261-ab.scala
deleted file mode 100644
index df641e811a..0000000000
--- a/test/files/pos/t261-ab.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-trait A { val foo: String = "A" }
-trait B {
- private val foo: String = "B"
- def f = println(foo)
-}
-object Test extends App with B with A {
- println(foo) // prints "A", as expected
- f // prints "B", as expected
-}
diff --git a/test/files/pos/t261-ba.scala b/test/files/pos/t261-ba.scala
deleted file mode 100644
index 6c9c5b10b7..0000000000
--- a/test/files/pos/t261-ba.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-trait B {
- private val foo: String = "B"
- def f = println(foo)
-}
-trait A { val foo: String = "A" }
-object Test extends App with B with A {
- println(foo) // prints "A", as expected
- f // prints "B", as expected
-}
diff --git a/test/files/pos/t3452f.scala b/test/files/pos/t3452f.scala
new file mode 100644
index 0000000000..efe25a62fc
--- /dev/null
+++ b/test/files/pos/t3452f.scala
@@ -0,0 +1,10 @@
+class Base[Coll] {
+ trait Transformed[S] {
+ lazy val underlying: Coll = ???
+ }
+}
+
+class Derived extends Base[String] {
+ class C extends Transformed[Any]
+}
+
diff --git a/test/files/neg/t5760-pkgobj-warn/stalepkg_1.scala b/test/files/pos/t5760-pkgobj-warn/stalepkg_1.scala
index ed4b731bb0..ed4b731bb0 100644
--- a/test/files/neg/t5760-pkgobj-warn/stalepkg_1.scala
+++ b/test/files/pos/t5760-pkgobj-warn/stalepkg_1.scala
diff --git a/test/files/neg/t5760-pkgobj-warn/stalepkg_2.scala b/test/files/pos/t5760-pkgobj-warn/stalepkg_2.scala
index 9abcdbab17..9abcdbab17 100644
--- a/test/files/neg/t5760-pkgobj-warn/stalepkg_2.scala
+++ b/test/files/pos/t5760-pkgobj-warn/stalepkg_2.scala
diff --git a/test/files/pos/t5900a.scala b/test/files/pos/t5900a.scala
new file mode 100644
index 0000000000..cb02f67fb2
--- /dev/null
+++ b/test/files/pos/t5900a.scala
@@ -0,0 +1,9 @@
+case class Transition[S](x: S)
+
+object C
+
+object Test {
+ (??? : Any) match {
+ case Transition(C) =>
+ }
+}
diff --git a/test/files/pos/t5954a/A_1.scala b/test/files/pos/t5954a/A_1.scala
new file mode 100644
index 0000000000..10ead0b1ca
--- /dev/null
+++ b/test/files/pos/t5954a/A_1.scala
@@ -0,0 +1,6 @@
+package p1 {
+ object `package` {
+ implicit class Foo(a: Any)
+ object Foo
+ }
+}
diff --git a/test/files/pos/t5954a/B_2.scala b/test/files/pos/t5954a/B_2.scala
new file mode 100644
index 0000000000..10ead0b1ca
--- /dev/null
+++ b/test/files/pos/t5954a/B_2.scala
@@ -0,0 +1,6 @@
+package p1 {
+ object `package` {
+ implicit class Foo(a: Any)
+ object Foo
+ }
+}
diff --git a/test/files/pos/t5954b/A_1.scala b/test/files/pos/t5954b/A_1.scala
new file mode 100644
index 0000000000..8465e8f8c6
--- /dev/null
+++ b/test/files/pos/t5954b/A_1.scala
@@ -0,0 +1,6 @@
+package p {
+ package object base {
+ class B
+ object B
+ }
+}
diff --git a/test/files/pos/t5954b/B_2.scala b/test/files/pos/t5954b/B_2.scala
new file mode 100644
index 0000000000..f7e4704b3e
--- /dev/null
+++ b/test/files/pos/t5954b/B_2.scala
@@ -0,0 +1,5 @@
+package p {
+ package object base {
+ case class B()
+ }
+}
diff --git a/test/files/pos/t5954c.flags b/test/files/pos/t5954c.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/pos/t5954c.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/pos/t5954c/A_1.scala b/test/files/pos/t5954c/A_1.scala
new file mode 100644
index 0000000000..29ad9547a2
--- /dev/null
+++ b/test/files/pos/t5954c/A_1.scala
@@ -0,0 +1,18 @@
+package object A {
+ // these used to should be prevented by the implementation restriction
+ // but are now allowed
+ class B
+ object B
+ trait C
+ object C
+ case class D()
+ // all the rest of these should be ok
+ class E
+ object F
+ val g = "omg"
+ var h = "wtf"
+ def i = "lol"
+ type j = String
+ class K(val k : Int) extends AnyVal
+ implicit class L(val l : Int)
+}
diff --git a/test/files/pos/t5954c/B_2.scala b/test/files/pos/t5954c/B_2.scala
new file mode 100644
index 0000000000..29ad9547a2
--- /dev/null
+++ b/test/files/pos/t5954c/B_2.scala
@@ -0,0 +1,18 @@
+package object A {
+ // these used to should be prevented by the implementation restriction
+ // but are now allowed
+ class B
+ object B
+ trait C
+ object C
+ case class D()
+ // all the rest of these should be ok
+ class E
+ object F
+ val g = "omg"
+ var h = "wtf"
+ def i = "lol"
+ type j = String
+ class K(val k : Int) extends AnyVal
+ implicit class L(val l : Int)
+}
diff --git a/test/files/pos/t5954d.flags b/test/files/pos/t5954d.flags
new file mode 100644
index 0000000000..6ced0e7090
--- /dev/null
+++ b/test/files/pos/t5954d.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xdev
diff --git a/test/files/pos/t5954d/A_1.scala b/test/files/pos/t5954d/A_1.scala
new file mode 100644
index 0000000000..8465e8f8c6
--- /dev/null
+++ b/test/files/pos/t5954d/A_1.scala
@@ -0,0 +1,6 @@
+package p {
+ package object base {
+ class B
+ object B
+ }
+}
diff --git a/test/files/pos/t5954d/B_2.scala b/test/files/pos/t5954d/B_2.scala
new file mode 100644
index 0000000000..a4aa2eb587
--- /dev/null
+++ b/test/files/pos/t5954d/B_2.scala
@@ -0,0 +1,7 @@
+package p {
+ trait T {
+ class B
+ object B
+ }
+ package object base extends T
+}
diff --git a/test/files/pos/t6169/Exist.java b/test/files/pos/t6169/Exist.java
new file mode 100644
index 0000000000..dfc6b36b33
--- /dev/null
+++ b/test/files/pos/t6169/Exist.java
@@ -0,0 +1,4 @@
+public class Exist<T extends String> {
+ // java helpfully re-interprets Exist<?> as Exist<? extends String>
+ public Exist<?> foo() { throw new RuntimeException(); }
+} \ No newline at end of file
diff --git a/test/files/pos/t6169/ExistF.java b/test/files/pos/t6169/ExistF.java
new file mode 100644
index 0000000000..70fabd74cf
--- /dev/null
+++ b/test/files/pos/t6169/ExistF.java
@@ -0,0 +1,4 @@
+public class ExistF<T extends ExistF<T>> {
+ // java helpfully re-interprets ExistF<?> as ExistF<?0 extends ExistF<?0>>
+ public ExistF<?> foo() { throw new RuntimeException(); }
+} \ No newline at end of file
diff --git a/test/files/pos/t6169/ExistIndir.java b/test/files/pos/t6169/ExistIndir.java
new file mode 100644
index 0000000000..e66d1698c4
--- /dev/null
+++ b/test/files/pos/t6169/ExistIndir.java
@@ -0,0 +1,4 @@
+public class ExistIndir<T extends String, U extends T> {
+ // java helpfully re-interprets ExistIndir<?> as ExistIndir<? extends String>
+ public ExistIndir<?, ?> foo() { throw new RuntimeException(); }
+}
diff --git a/test/files/pos/t6169/OP.java b/test/files/pos/t6169/OP.java
new file mode 100644
index 0000000000..15e4c5640f
--- /dev/null
+++ b/test/files/pos/t6169/OP.java
@@ -0,0 +1 @@
+public abstract class OP<T> { }
diff --git a/test/files/pos/t6169/Skin.java b/test/files/pos/t6169/Skin.java
new file mode 100644
index 0000000000..780de1ee09
--- /dev/null
+++ b/test/files/pos/t6169/Skin.java
@@ -0,0 +1 @@
+public interface Skin<C extends Skinnable> { }
diff --git a/test/files/pos/t6169/Skinnable.java b/test/files/pos/t6169/Skinnable.java
new file mode 100644
index 0000000000..f91eaa30d8
--- /dev/null
+++ b/test/files/pos/t6169/Skinnable.java
@@ -0,0 +1,3 @@
+public interface Skinnable {
+ OP<Skin<?>> skinProperty();
+}
diff --git a/test/files/pos/t6169/skinnable.scala b/test/files/pos/t6169/skinnable.scala
new file mode 100644
index 0000000000..3ba2734526
--- /dev/null
+++ b/test/files/pos/t6169/skinnable.scala
@@ -0,0 +1,14 @@
+object ObjectProperty {
+ implicit def jfxObjectProperty2sfx[T](p: OP[T]) = new ObjectProperty[T](p)
+}
+
+class ObjectProperty[T](val delegate: OP[T])
+
+trait TestWildcardBoundInference {
+ def delegate: Skinnable
+ def skin: ObjectProperty[Skin[_ /* inferred: <: Skinnable */]] = ObjectProperty.jfxObjectProperty2sfx(delegate.skinProperty)
+ skin: ObjectProperty[Skin[_ <: Skinnable]]
+
+ def skinCheckInference = delegate.skinProperty
+ skinCheckInference: ObjectProperty[Skin[_ <: Skinnable]]
+} \ No newline at end of file
diff --git a/test/files/pos/t6169/t6169.scala b/test/files/pos/t6169/t6169.scala
new file mode 100644
index 0000000000..37f42619ca
--- /dev/null
+++ b/test/files/pos/t6169/t6169.scala
@@ -0,0 +1,7 @@
+class Test {
+ class MyExist extends ExistF[MyExist]
+ // SI-8197, SI-6169: java infers the bounds of existentials, so we have to as well now that SI-1786 is fixed...
+ def stringy: Exist[_ <: String] = (new Exist[String]).foo
+ def fbounded: (ExistF[t] forSome {type t <: ExistF[t] }) = (new MyExist).foo
+ def indir: ExistIndir[_ <: String, _ <: String] = (new ExistIndir[String, String]).foo
+} \ No newline at end of file
diff --git a/test/files/neg/t6260.flags b/test/files/pos/t6260.flags
index 2349d8294d..2349d8294d 100644
--- a/test/files/neg/t6260.flags
+++ b/test/files/pos/t6260.flags
diff --git a/test/files/neg/t6260.scala b/test/files/pos/t6260.scala
index 93b5448227..93b5448227 100644
--- a/test/files/neg/t6260.scala
+++ b/test/files/pos/t6260.scala
diff --git a/test/files/neg/t6260b.scala b/test/files/pos/t6260b.scala
index 73e2e58f73..73e2e58f73 100644
--- a/test/files/neg/t6260b.scala
+++ b/test/files/pos/t6260b.scala
diff --git a/test/files/pos/t6948.scala b/test/files/pos/t6948.scala
new file mode 100644
index 0000000000..12a1d7eaf2
--- /dev/null
+++ b/test/files/pos/t6948.scala
@@ -0,0 +1,10 @@
+object t6948 {
+ val rand = new scala.util.Random()
+ def a1 = rand.shuffle(0 to 5)
+ // Tis not to be
+ // def a2 = rand.shuffle(0 until 5)
+ def a3 = rand.shuffle(Vector(1, 2, 3))
+ def a4 = rand.shuffle(scala.collection.Seq(1, 2, 3))
+ def a5 = rand.shuffle(scala.collection.immutable.Seq(1, 2, 3))
+ def a6 = rand.shuffle(scala.collection.mutable.Seq(1, 2, 3))
+}
diff --git a/test/files/pos/t7475a.scala b/test/files/pos/t7475a.scala
new file mode 100644
index 0000000000..810ce9a05c
--- /dev/null
+++ b/test/files/pos/t7475a.scala
@@ -0,0 +1,11 @@
+trait AbstractPublic {
+ def queue: Any
+}
+trait ConcretePrivate {
+ private val queue: Any = ()
+}
+
+abstract class Mix
+ extends ConcretePrivate with AbstractPublic {
+ final def queue: Any = ()
+}
diff --git a/test/files/pos/t7475b.scala b/test/files/pos/t7475b.scala
new file mode 100644
index 0000000000..a34743b8be
--- /dev/null
+++ b/test/files/pos/t7475b.scala
@@ -0,0 +1,8 @@
+trait U {
+}
+
+trait T {
+ type TT = Any with T with U
+ private val priv = 0
+ (??? : TT).priv
+}
diff --git a/test/files/pos/t7475d.scala b/test/files/pos/t7475d.scala
new file mode 100644
index 0000000000..497c2bf443
--- /dev/null
+++ b/test/files/pos/t7475d.scala
@@ -0,0 +1,11 @@
+trait T {
+ type TT = T with Any
+ private val priv = 0
+ (??? : TT).priv
+}
+
+trait U {
+ type UU = Any with U
+ private val priv = 0
+ (??? : UU).priv
+}
diff --git a/test/files/pos/t7475e.scala b/test/files/pos/t7475e.scala
new file mode 100644
index 0000000000..fbc965c4ca
--- /dev/null
+++ b/test/files/pos/t7475e.scala
@@ -0,0 +1,13 @@
+trait U {
+ private val priv = 0
+ type TT = U with T // should allow `priv`
+ (??? : TT).priv
+}
+
+trait Base {
+
+}
+
+trait T extends Base {
+
+}
diff --git a/test/files/pos/t7753.scala b/test/files/pos/t7753.scala
new file mode 100644
index 0000000000..93ad23f114
--- /dev/null
+++ b/test/files/pos/t7753.scala
@@ -0,0 +1,36 @@
+import scala.language.{ higherKinds, implicitConversions }
+
+trait Foo { type Out }
+
+trait SI {
+ val instance: Foo
+ type Out
+}
+
+object Test {
+ def test {
+ def indirect(si: SI)(v: si.instance.Out) = v
+
+ val foo: Foo { type Out = Int } = ???
+ def conv(i: Foo): SI { type Out = i.Out; val instance: i.type } = ???
+
+ val converted = conv(foo)
+
+ val v1: Int = indirect(converted)(23) // Okay (after refining the return type `instance` in the return type of `conv`)
+ /*
+ indirect(converted){(v: converted.instance.Out)converted.instance.Out}(
+ 23{Int(23)}
+ ){converted.instance.Out};
+ */
+
+ val v2: Int = indirect(conv(foo))(23) // Used to fail as follows:
+ /*
+ indirect(
+ conv(foo){si.SI{type Out = foo.Out; val instance: si.Test.<refinement>.type}}
+ ){(v: si.instance.Out)si.instance.Out}(
+ 23{<error>}
+ ){<error>};
+ */
+
+ }
+}
diff --git a/test/files/pos/t8134/A_1.scala b/test/files/pos/t8134/A_1.scala
new file mode 100644
index 0000000000..32bce003fb
--- /dev/null
+++ b/test/files/pos/t8134/A_1.scala
@@ -0,0 +1,4 @@
+// a.scala
+package object pkg {
+ class AnyOps(val x: Any) extends AnyVal
+}
diff --git a/test/files/pos/t8134/B_2.scala b/test/files/pos/t8134/B_2.scala
new file mode 100644
index 0000000000..32bce003fb
--- /dev/null
+++ b/test/files/pos/t8134/B_2.scala
@@ -0,0 +1,4 @@
+// a.scala
+package object pkg {
+ class AnyOps(val x: Any) extends AnyVal
+}
diff --git a/test/files/pos/t8177.scala b/test/files/pos/t8177.scala
new file mode 100644
index 0000000000..fe265f8d0a
--- /dev/null
+++ b/test/files/pos/t8177.scala
@@ -0,0 +1,12 @@
+// exercise coevolveSym: SingleType with an underlying RefinedType
+trait Thing { type A }
+object IntThing extends Thing { type A = Int }
+
+// The following erroneously failed with error: method f overrides nothing.
+// because asSeenFrom produced a typeref of the shape T'#A where A referred to a symbol defined in a T of times past
+// More precisely, the TypeRef case of TypeMap's mapOver correctly modified prefix
+// from having an underlying type of { type A = Ain } to { type A = Int }, with a new symbol for A (now with info Int),
+// but the symbol in the outer type ref wasn't co-evolved (so it still referred to the { type A = AIn } underlying the old prefix)
+// coEvolveSym used to only look at prefixes that were directly RefinedTypes, but they could also be SingleTypes with an underlying RefinedType
+class View[AIn](val in: Thing { type A = AIn }) { def f(p: in.A): in.A = p }
+class SubView extends View[Int](IntThing) { override def f(p: in.A): in.A = p }
diff --git a/test/files/pos/t8177a.scala b/test/files/pos/t8177a.scala
new file mode 100644
index 0000000000..7e2cfb386c
--- /dev/null
+++ b/test/files/pos/t8177a.scala
@@ -0,0 +1,9 @@
+// exercise coevolveSym
+trait Thing { type A; var p: A = _ }
+class AA[T](final val x: Thing { type A = T }) {
+ def foo: x.A = ???
+}
+
+class B extends AA[Int](null) {
+ override def foo: B.this.x.A = super.foo
+}
diff --git a/test/files/pos/t8177b.scala b/test/files/pos/t8177b.scala
new file mode 100644
index 0000000000..b7ed9342a3
--- /dev/null
+++ b/test/files/pos/t8177b.scala
@@ -0,0 +1,13 @@
+// exercise coevolveSym: SingleType with an underlying RefinedType, via a type alias
+trait Thing { type A }
+object IntThing extends Thing { type A = Int }
+object ThingHolder { type Alias[AIn] = Thing { type A = AIn } }
+
+// The following erroneously failed with error: method f overrides nothing.
+// because asSeenFrom produced a typeref of the shape T'#A where A referred to a symbol defined in a T of times past
+// More precisely, the TypeRef case of TypeMap's mapOver correctly modified prefix
+// from having an underlying type of { type A = Ain } to { type A = Int }, with a new symbol for A (now with info Int),
+// but the symbol in the outer type ref wasn't co-evolved (so it still referred to the { type A = AIn } underlying the old prefix)
+// coEvolveSym used to only look at prefixes that were directly RefinedTypes, but they could also be SingleTypes with an underlying RefinedType
+class View[AIn](val in: ThingHolder.Alias[AIn]) { def f(p: in.A): in.A = p }
+class SubView extends View[Int](IntThing) { override def f(p: in.A): in.A = p } \ No newline at end of file
diff --git a/test/files/pos/t8177d.scala b/test/files/pos/t8177d.scala
new file mode 100644
index 0000000000..d15a05a359
--- /dev/null
+++ b/test/files/pos/t8177d.scala
@@ -0,0 +1,12 @@
+// exercise coevolveSym
+trait HasElem { type A }
+trait View[AIn] {
+ val tc: HasElem { type A = AIn }
+ def f2(p: tc.A): tc.A = p
+}
+
+object Test {
+ val view: View[Int] = null
+
+ view f2 5 // fails
+}
diff --git a/test/files/pos/t8177e.scala b/test/files/pos/t8177e.scala
new file mode 100644
index 0000000000..cb1136ff11
--- /dev/null
+++ b/test/files/pos/t8177e.scala
@@ -0,0 +1,3 @@
+// exercise coevolveSym
+trait T[A] { val foo: { type B = A } = ???; def bar(b: foo.B) = () }
+object O extends T[Int] { bar(0) }
diff --git a/test/files/pos/t8177g.scala b/test/files/pos/t8177g.scala
new file mode 100644
index 0000000000..bb66d32021
--- /dev/null
+++ b/test/files/pos/t8177g.scala
@@ -0,0 +1,11 @@
+// exercise coevolveSym: ThisType
+trait HasA { type A }
+class AA[T] {
+ type HasAT[T] = HasA{ type A = T }
+ val x: HasAT[T] = ???
+ def foo: x.A = ???
+}
+
+class B extends AA[Int] {
+ override def foo: B.this.x.A = super.foo
+} \ No newline at end of file
diff --git a/test/files/pos/t8177h.scala b/test/files/pos/t8177h.scala
new file mode 100644
index 0000000000..90b8a26ce7
--- /dev/null
+++ b/test/files/pos/t8177h.scala
@@ -0,0 +1,5 @@
+class Module { self =>
+ type settingsType <: Any
+ final type commonModuleType = Module {type settingsType = self.settingsType}
+ def foo(s: self.type): commonModuleType = s
+}
diff --git a/test/files/pos/t8207.scala b/test/files/pos/t8207.scala
new file mode 100644
index 0000000000..680b40f379
--- /dev/null
+++ b/test/files/pos/t8207.scala
@@ -0,0 +1,6 @@
+class C { me =>
+ import me.{toString => ts}
+ locally(this: me.type)
+ trait T
+ type X = me.T
+}
diff --git a/test/files/pos/t8209a.check b/test/files/pos/t8209a.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/t8209a.check
diff --git a/test/files/pos/t8209a/Macros_1.scala b/test/files/pos/t8209a/Macros_1.scala
new file mode 100644
index 0000000000..17014b4744
--- /dev/null
+++ b/test/files/pos/t8209a/Macros_1.scala
@@ -0,0 +1,17 @@
+import scala.language.experimental.macros
+import scala.language.implicitConversions
+import scala.reflect.macros.blackbox.Context
+
+class A
+object A { implicit def a2b(a: A): B = ??? }
+class B
+class C extends A
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ q"new C"
+ }
+
+ def foo: A = macro impl
+} \ No newline at end of file
diff --git a/test/files/pos/t8209a/Test_2.scala b/test/files/pos/t8209a/Test_2.scala
new file mode 100644
index 0000000000..e19d572f55
--- /dev/null
+++ b/test/files/pos/t8209a/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ val a: A = Macros.foo
+ val b: B = Macros.foo
+} \ No newline at end of file
diff --git a/test/files/pos/t8209b.check b/test/files/pos/t8209b.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/t8209b.check
diff --git a/test/files/pos/t8209b/Macros_1.scala b/test/files/pos/t8209b/Macros_1.scala
new file mode 100644
index 0000000000..705f7d630c
--- /dev/null
+++ b/test/files/pos/t8209b/Macros_1.scala
@@ -0,0 +1,17 @@
+import scala.language.experimental.macros
+import scala.language.implicitConversions
+import scala.reflect.macros.whitebox.Context
+
+class A
+object A { implicit def a2b(a: A): B = ??? }
+class B
+class C extends A
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ q"new C"
+ }
+
+ def foo: A = macro impl
+} \ No newline at end of file
diff --git a/test/files/pos/t8209b/Test_2.scala b/test/files/pos/t8209b/Test_2.scala
new file mode 100644
index 0000000000..e19d572f55
--- /dev/null
+++ b/test/files/pos/t8209b/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ val a: A = Macros.foo
+ val b: B = Macros.foo
+} \ No newline at end of file
diff --git a/test/files/pos/t8219.scala b/test/files/pos/t8219.scala
new file mode 100644
index 0000000000..e1653b6238
--- /dev/null
+++ b/test/files/pos/t8219.scala
@@ -0,0 +1,15 @@
+trait Equalizer[T]
+trait Gen[A]
+
+class Broken {
+ implicit def const[T](x: T): Gen[T] = ???
+ implicit def convertToEqualizer[T](left: T): Equalizer[T] = ???
+
+ def in(a: Any) = ()
+ in {
+ import scala.None // any import will do..
+ "" == "" // this no longer triggers the bug, as Object#== now overrides Any#==
+ }
+
+ // We can still trigger the bug with a structural type, see pending/neg/t8219.scala
+}
diff --git a/test/files/pos/t8219b.scala b/test/files/pos/t8219b.scala
new file mode 100644
index 0000000000..d55d3139e1
--- /dev/null
+++ b/test/files/pos/t8219b.scala
@@ -0,0 +1,49 @@
+trait Equalizer[T]
+trait Gen[A]
+
+class Broken {
+ implicit def const[T](x: T): Gen[T] = ???
+ implicit def convertToEqualizer[T](left: T): Equalizer[T] = ???
+
+ def in(a: Any) = ()
+ in {
+ import scala.None // any import will do..
+ "" == "" // no longer a problem, see pos/t8129.scala
+ }
+
+ // We used to fall into the errant code path above when `Any#==` and `AnyRef#==`
+ // were overloaded.
+ //
+ // Real classes couldn't get away with that overloading; it would result in
+ // a compiler error because the variants would collapse into an overriding
+ // relationship after erasure.
+ //
+ //
+ // But, a structural type can! This triggers the same error, and served as
+ // a backstop for this test if we change the signatures of `AnyRef#==` to
+ // override `Any#==`.
+ type T = {
+ def a(a: AnyRef): Boolean
+ def a(a: Any): Boolean
+ }
+
+ def t: T = ???
+
+ in {
+ import scala.None // any import will do..
+ t.a("")
+ }
+
+ // Or, we can get here with ambiguous implicits from the formal parameter
+ // type of the less specific overload to that of the more specific.
+ object T {
+ def foo(a: Any) = true
+ def foo(a: String) = true
+ }
+ in {
+ import scala.None
+ implicit def any2str1(a: Any) = ""
+ implicit def any2str2(a: Any) = ""
+ T.foo("")
+ }
+}
diff --git a/test/files/pos/t8223.scala b/test/files/pos/t8223.scala
new file mode 100644
index 0000000000..52d6b0098e
--- /dev/null
+++ b/test/files/pos/t8223.scala
@@ -0,0 +1,29 @@
+package p {
+ class ViewEnv[AIn] {
+ type A = AIn
+ class SubView { def has(x: A): Boolean = ??? }
+ def get: SubView = new SubView
+ }
+
+ trait HasA { type A }
+ trait Indexable[R] extends HasA
+ class ArrayTC[AIn] extends Indexable[Array[AIn]] { type A = AIn }
+}
+
+package object p {
+ implicit def arrayTypeClass[A] : ArrayTC[A] = new ArrayTC[A]
+ object intArrayTC extends ArrayTC[Int]
+
+ type EnvAlias[W <: HasA] = ViewEnv[W#A]
+ type SubAlias[W <: HasA] = ViewEnv[W#A]#SubView
+
+ def f0[R](xs: R)(implicit tc: Indexable[R]): ViewEnv[tc.A]#SubView = new ViewEnv[tc.A]() get
+ def f1[R](xs: R)(implicit tc: Indexable[R]): EnvAlias[tc.type]#SubView = new ViewEnv[tc.A]() get
+ def f2[R](xs: R)(implicit tc: Indexable[R]): SubAlias[tc.type] = new ViewEnv[tc.A]() get
+
+ def g0 = f0(Array(1)) has 2 // ok
+ def g1 = f1(Array(1)) has 2 // ok
+ def g2 = f2(Array(1)) has 2 // "found: Int(2), required: tc.A"
+ def g3 = f2(Array(1))(new ArrayTC[Int]) has 2 // "found: Int(2), required: tc.A"
+ def g4 = f2(Array(1))(intArrayTC) has 2 // ok
+}
diff --git a/test/files/pos/t8237.scala b/test/files/pos/t8237.scala
new file mode 100644
index 0000000000..005089079e
--- /dev/null
+++ b/test/files/pos/t8237.scala
@@ -0,0 +1,29 @@
+import scala.language.higherKinds
+
+object TestExplicit {
+ trait TC[A]
+ def fTt[A,E[X] <: List[X]](a: A)(implicit tt: TC[E[A]]) = a
+ implicit def tc[T]: TC[T] = ???
+
+ // Typechecking results in SOE in TypeVar.isGround
+ fTt(1)(tc)
+ // fun = TestExplicit.this.fTt[Int, E](1)
+ // args = TestExplicit.this.tc[E[Int]]
+ // argTpes.head.instantiateTypeParams = TC[?E#1[Int]]
+ // formals.head.instantiateTypeParams = TC[?E#2[Int]]
+ // (where ?E#1 and ?E#2 as distinct AppliedTypeVars that resulted
+ // from separate applications of type args to the same HKTypeVar, ?E)
+ //
+ // As we check if the argument conforms to the formal, we would have
+ // AppliedTypeVars sharing the same TypeConstraints on the LHS and RHS,
+ // which leads to a cyclic constraint.
+}
+
+object TestImplicit {
+ trait TC[A]
+ def fTt[A,E[X] <: List[X]](a: A)(implicit tt: TC[E[A]]) = a
+ implicit def tc[T]: TC[T] = ???
+
+ // Oddly enough, this one works.
+ fTt(1)
+}
diff --git a/test/files/pos/t8237b.scala b/test/files/pos/t8237b.scala
new file mode 100644
index 0000000000..52bb310e8b
--- /dev/null
+++ b/test/files/pos/t8237b.scala
@@ -0,0 +1,10 @@
+import scala.language.higherKinds
+import scala.reflect.runtime.universe._
+object Test {
+
+ def fTt[A,E[X]<:List[X]](a: A)(implicit tt: TypeTag[E[A]]) = a
+
+ trait TC[A]
+ implicit def TCListInt[A]: TC[A] = ???
+ fTt(1)
+}
diff --git a/test/files/pos/t8244d/InodeBase_1.java b/test/files/pos/t8244d/InodeBase_1.java
new file mode 100644
index 0000000000..36c2123418
--- /dev/null
+++ b/test/files/pos/t8244d/InodeBase_1.java
@@ -0,0 +1,6 @@
+import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
+
+abstract class INodeBase_1<K, V> {
+ @SuppressWarnings("rawtypes")
+ public static final AtomicReferenceFieldUpdater<INodeBase_1, Object> updater = null;
+}
diff --git a/test/files/pos/t8244d/Test_2.scala b/test/files/pos/t8244d/Test_2.scala
new file mode 100644
index 0000000000..cb39c9692c
--- /dev/null
+++ b/test/files/pos/t8244d/Test_2.scala
@@ -0,0 +1,3 @@
+class INodeX[K, V] extends INodeBase_1[K, V] {
+ INodeBase_1.updater.set(this, null)
+}
diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check
index 1f868097ca..4bf68b3d4e 100644
--- a/test/files/presentation/callcc-interpreter.check
+++ b/test/files/presentation/callcc-interpreter.check
@@ -3,7 +3,7 @@ reload: CallccInterpreter.scala
askTypeCompletion at CallccInterpreter.scala(51,34)
================================================================================
[response] askTypeCompletion at (51,34)
-retrieved 59 members
+retrieved 57 members
abstract trait Term extends AnyRef
abstract trait Value extends AnyRef
case class Add extends callccInterpreter.Term with Product with Serializable
@@ -38,10 +38,8 @@ def toString(): String
def unitM[A](a: A): callccInterpreter.M[A]
def →[B](y: B): (callccInterpreter.type, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/presentation/completion-implicit-chained.check b/test/files/presentation/completion-implicit-chained.check
index f9d77f7a53..c583b7877c 100644
--- a/test/files/presentation/completion-implicit-chained.check
+++ b/test/files/presentation/completion-implicit-chained.check
@@ -3,7 +3,7 @@ reload: Completions.scala
askTypeCompletion at Completions.scala(11,16)
================================================================================
[response] askTypeCompletion at (11,16)
-retrieved 24 members
+retrieved 22 members
[inaccessible] protected[package lang] def clone(): Object
[inaccessible] protected[package lang] def finalize(): Unit
def equals(x$1: Any): Boolean
@@ -11,10 +11,8 @@ def hashCode(): Int
def map(x: Int => Int)(implicit a: DummyImplicit): test.O.type
def toString(): String
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/presentation/ide-bug-1000349.check b/test/files/presentation/ide-bug-1000349.check
index c59fa6843f..79bfde5343 100644
--- a/test/files/presentation/ide-bug-1000349.check
+++ b/test/files/presentation/ide-bug-1000349.check
@@ -3,7 +3,7 @@ reload: CompletionOnEmptyArgMethod.scala
askTypeCompletion at CompletionOnEmptyArgMethod.scala(2,17)
================================================================================
[response] askTypeCompletion at (2,17)
-retrieved 32 members
+retrieved 30 members
def +(other: String): String
def ->[B](y: B): (Foo, B)
def ensuring(cond: Boolean): Foo
@@ -17,10 +17,8 @@ def hashCode(): Int
def toString(): String
def →[B](y: B): (Foo, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/presentation/ide-bug-1000475.check b/test/files/presentation/ide-bug-1000475.check
index f5b4253e1a..4fb7f18285 100644
--- a/test/files/presentation/ide-bug-1000475.check
+++ b/test/files/presentation/ide-bug-1000475.check
@@ -3,7 +3,7 @@ reload: Foo.scala
askTypeCompletion at Foo.scala(3,7)
================================================================================
[response] askTypeCompletion at (3,7)
-retrieved 31 members
+retrieved 29 members
[inaccessible] protected[package lang] def clone(): Object
[inaccessible] protected[package lang] def finalize(): Unit
def +(other: String): String
@@ -18,10 +18,8 @@ def hashCode(): Int
def toString(): String
def →[B](y: B): (Object, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
@@ -37,7 +35,7 @@ final def wait(x$1: Long,x$2: Int): Unit
askTypeCompletion at Foo.scala(6,10)
================================================================================
[response] askTypeCompletion at (6,10)
-retrieved 31 members
+retrieved 29 members
[inaccessible] protected[package lang] def clone(): Object
[inaccessible] protected[package lang] def finalize(): Unit
def +(other: String): String
@@ -52,10 +50,8 @@ def hashCode(): Int
def toString(): String
def →[B](y: B): (Object, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
@@ -71,7 +67,7 @@ final def wait(x$1: Long,x$2: Int): Unit
askTypeCompletion at Foo.scala(7,7)
================================================================================
[response] askTypeCompletion at (7,7)
-retrieved 31 members
+retrieved 29 members
[inaccessible] protected[package lang] def clone(): Object
[inaccessible] protected[package lang] def finalize(): Unit
def +(other: String): String
@@ -86,10 +82,8 @@ def hashCode(): Int
def toString(): String
def →[B](y: B): (Object, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check
index dff89b155b..d8c7a369f7 100644
--- a/test/files/presentation/ide-bug-1000531.check
+++ b/test/files/presentation/ide-bug-1000531.check
@@ -3,7 +3,7 @@ reload: CrashOnLoad.scala
askTypeCompletion at CrashOnLoad.scala(6,12)
================================================================================
[response] askTypeCompletion at (6,12)
-retrieved 120 members
+retrieved 117 members
[inaccessible] protected[package lang] def clone(): Object
[inaccessible] protected[package lang] def finalize(): Unit
[inaccessible] protected[this] def reversed: List[B]
@@ -107,10 +107,8 @@ def zipWithIndex: Iterator[(B, Int)]
def zip[B](that: Iterator[B]): Iterator[(B, B)]
def →[B](y: B): (java.util.Iterator[B], B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/presentation/implicit-member.check b/test/files/presentation/implicit-member.check
index 5ad52b4dd3..3bd3d8af41 100644
--- a/test/files/presentation/implicit-member.check
+++ b/test/files/presentation/implicit-member.check
@@ -3,7 +3,7 @@ reload: ImplicitMember.scala
askTypeCompletion at ImplicitMember.scala(7,7)
================================================================================
[response] askTypeCompletion at (7,7)
-retrieved 34 members
+retrieved 32 members
def +(other: String): String
def ->[B](y: B): (Implicit.type, B)
def ensuring(cond: Boolean): Implicit.type
@@ -17,10 +17,8 @@ def toString(): String
def →[B](y: B): (Implicit.type, B)
final class AppliedImplicit[A] extends AnyRef
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/presentation/ping-pong.check b/test/files/presentation/ping-pong.check
index 20f17aa7d0..220bdf33b2 100644
--- a/test/files/presentation/ping-pong.check
+++ b/test/files/presentation/ping-pong.check
@@ -3,7 +3,7 @@ reload: PingPong.scala
askTypeCompletion at PingPong.scala(10,23)
================================================================================
[response] askTypeCompletion at (10,23)
-retrieved 35 members
+retrieved 32 members
[inaccessible] private[this] val ping: Ping
[inaccessible] protected[package lang] def clone(): Object
[inaccessible] protected[package lang] def finalize(): Unit
@@ -19,10 +19,8 @@ def hashCode(): Int
def poke(): Unit
def →[B](y: B): (Pong, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
@@ -40,7 +38,7 @@ private[this] val name: String
askTypeCompletion at PingPong.scala(19,20)
================================================================================
[response] askTypeCompletion at (19,20)
-retrieved 35 members
+retrieved 33 members
[inaccessible] protected[package lang] def clone(): Object
[inaccessible] protected[package lang] def finalize(): Unit
def +(other: String): String
@@ -57,10 +55,8 @@ def name: String
def poke: Unit
def →[B](y: B): (Ping, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/presentation/scope-completion-3.check b/test/files/presentation/scope-completion-3.check
index df3007ab4e..b70a7d5c6b 100644
--- a/test/files/presentation/scope-completion-3.check
+++ b/test/files/presentation/scope-completion-3.check
@@ -3,19 +3,7 @@ reload: Completions.scala
askScopeCompletion at Completions.scala(75,2)
================================================================================
[response] askScopeCompletion at (75,2)
-retrieved 49 members
-[inaccessible] private class Cb2 extends AnyRef
-[inaccessible] private class Ct2 extends AnyRef
-[inaccessible] private def fb2: Int
-[inaccessible] private def ft2: Int
-[inaccessible] private object Ob2
-[inaccessible] private object Ot2
-[inaccessible] private type tb2 = Completion1.this.tb2
-[inaccessible] private type tt2 = Completion1.this.tt2
-[inaccessible] private[this] val vb2: Int
-[inaccessible] private[this] val vt2: Int
-[inaccessible] private[this] var rb2: Int
-[inaccessible] private[this] var rt2: Int
+retrieved 37 members
abstract class Base1 extends AnyRef
abstract trait Trait1 extends AnyRef
class Cb1 extends AnyRef
@@ -58,19 +46,7 @@ type tt1 = Completion1.this.tt1
askScopeCompletion at Completions.scala(104,2)
================================================================================
[response] askScopeCompletion at (104,2)
-retrieved 49 members
-[inaccessible] private class Cb2 extends AnyRef
-[inaccessible] private class Ct2 extends AnyRef
-[inaccessible] private def fb2: Int
-[inaccessible] private def ft2: Int
-[inaccessible] private object Ob2
-[inaccessible] private object Ot2
-[inaccessible] private type tb2 = test.Completion2.tb2
-[inaccessible] private type tt2 = test.Completion2.tt2
-[inaccessible] private[this] val vb2: Int
-[inaccessible] private[this] val vt2: Int
-[inaccessible] private[this] var rb2: Int
-[inaccessible] private[this] var rt2: Int
+retrieved 37 members
abstract class Base1 extends AnyRef
abstract trait Trait1 extends AnyRef
class Cb1 extends AnyRef
diff --git a/test/files/presentation/scope-completion-import.check b/test/files/presentation/scope-completion-import.check
index 220ffc399b..50197e5822 100644
--- a/test/files/presentation/scope-completion-import.check
+++ b/test/files/presentation/scope-completion-import.check
@@ -3,10 +3,8 @@ reload: Completions.scala
askScopeCompletion at Completions.scala(23,4)
================================================================================
[response] askScopeCompletion at (23,4)
-retrieved 18 members
-[inaccessible] private[this] val pVCCC: Int
+retrieved 16 members
[inaccessible] private[this] val pVOOO: Int
-[inaccessible] private[this] var pRCCC: Int
[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
@@ -27,10 +25,8 @@ val o: test.O.type
askScopeCompletion at Completions.scala(27,4)
================================================================================
[response] askScopeCompletion at (27,4)
-retrieved 17 members
-[inaccessible] private[this] val pVCCC: Int
+retrieved 15 members
[inaccessible] private[this] val pVOOO: Int
-[inaccessible] private[this] var pRCCC: Int
[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
@@ -126,10 +122,8 @@ val c: test.C
askScopeCompletion at Completions.scala(49,4)
================================================================================
[response] askScopeCompletion at (49,4)
-retrieved 18 members
-[inaccessible] private[this] val pVCCC: Int
+retrieved 16 members
[inaccessible] private[this] val pVOOO: Int
-[inaccessible] private[this] var pRCCC: Int
[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
@@ -150,10 +144,8 @@ private[this] var rOOO: Int
askScopeCompletion at Completions.scala(59,4)
================================================================================
[response] askScopeCompletion at (59,4)
-retrieved 19 members
-[inaccessible] private[this] val pVCCC: Int
+retrieved 17 members
[inaccessible] private[this] val pVOOO: Int
-[inaccessible] private[this] var pRCCC: Int
[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
diff --git a/test/files/presentation/t5708.check b/test/files/presentation/t5708.check
index 04806b5867..4b33893e98 100644
--- a/test/files/presentation/t5708.check
+++ b/test/files/presentation/t5708.check
@@ -3,7 +3,7 @@ reload: Completions.scala
askTypeCompletion at Completions.scala(17,9)
================================================================================
[response] askTypeCompletion at (17,9)
-retrieved 39 members
+retrieved 37 members
[inaccessible] private def privateM: String
[inaccessible] private[this] val privateV: String
[inaccessible] private[this] val protectedV: String
@@ -22,10 +22,8 @@ def hashCode(): Int
def toString(): String
def →[B](y: B): (test.Compat.type, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/presentation/visibility.check b/test/files/presentation/visibility.check
index 217da34b9c..b77887f8f7 100644
--- a/test/files/presentation/visibility.check
+++ b/test/files/presentation/visibility.check
@@ -3,7 +3,7 @@ reload: Completions.scala
askTypeCompletion at Completions.scala(14,12)
================================================================================
[response] askTypeCompletion at (14,12)
-retrieved 37 members
+retrieved 35 members
[inaccessible] private[this] def secretPrivateThis(): Unit
def +(other: String): String
def ->[B](y: B): (accessibility.Foo, B)
@@ -19,10 +19,8 @@ def someTests(other: accessibility.Foo): Unit
def toString(): String
def →[B](y: B): (accessibility.Foo, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
@@ -43,7 +41,7 @@ protected[package lang] def finalize(): Unit
askTypeCompletion at Completions.scala(16,11)
================================================================================
[response] askTypeCompletion at (16,11)
-retrieved 37 members
+retrieved 35 members
def +(other: String): String
def ->[B](y: B): (accessibility.Foo, B)
def ensuring(cond: Boolean): accessibility.Foo
@@ -58,10 +56,8 @@ def someTests(other: accessibility.Foo): Unit
def toString(): String
def →[B](y: B): (accessibility.Foo, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
@@ -83,8 +79,7 @@ protected[package lang] def finalize(): Unit
askTypeCompletion at Completions.scala(22,11)
================================================================================
[response] askTypeCompletion at (22,11)
-retrieved 37 members
-[inaccessible] private def secretPrivate(): Unit
+retrieved 34 members
def +(other: String): String
def ->[B](y: B): (accessibility.AccessibilityChecks, B)
def ensuring(cond: Boolean): accessibility.AccessibilityChecks
@@ -100,10 +95,8 @@ def someTests: Unit
def toString(): String
def →[B](y: B): (accessibility.AccessibilityChecks, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
@@ -123,7 +116,7 @@ protected[package lang] def finalize(): Unit
askTypeCompletion at Completions.scala(28,10)
================================================================================
[response] askTypeCompletion at (28,10)
-retrieved 37 members
+retrieved 35 members
[inaccessible] private def secretPrivate(): Unit
[inaccessible] private[this] def secretPrivateThis(): Unit
[inaccessible] protected def secretProtected(): Unit
@@ -143,10 +136,8 @@ def someTests(other: accessibility.Foo): Unit
def toString(): String
def →[B](y: B): (accessibility.Foo, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
@@ -163,7 +154,7 @@ protected[package accessibility] def secretProtectedInPackage(): Unit
askTypeCompletion at Completions.scala(37,8)
================================================================================
[response] askTypeCompletion at (37,8)
-retrieved 37 members
+retrieved 35 members
[inaccessible] private def secretPrivate(): Unit
[inaccessible] private[this] def secretPrivateThis(): Unit
[inaccessible] protected def secretProtected(): Unit
@@ -184,10 +175,8 @@ def someTests(other: accessibility.Foo): Unit
def toString(): String
def →[B](y: B): (accessibility.Foo, B)
final def !=(x$1: Any): Boolean
-final def !=(x$1: AnyRef): Boolean
final def ##(): Int
final def ==(x$1: Any): Boolean
-final def ==(x$1: AnyRef): Boolean
final def asInstanceOf[T0]: T0
final def eq(x$1: AnyRef): Boolean
final def isInstanceOf[T0]: Boolean
diff --git a/test/files/run/inferred-type-constructors.check b/test/files/run/inferred-type-constructors.check
new file mode 100644
index 0000000000..5992ef02ad
--- /dev/null
+++ b/test/files/run/inferred-type-constructors.check
@@ -0,0 +1,56 @@
+warning: there were 2 feature warning(s); re-run with -feature for details
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Seq[Int]
+ p.m.Set[Int]
+ p.m.Seq[Int]
+ private[m] p.m.ASet[Int]
+ p.i.Seq[Int]
+ private[i] p.i.ASet[Int]
+ private[i] p.i.ASeq[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ p.m.Set[Int]
+ p.Iterable[Int]
+ p.Set[Int]
+ p.Iterable[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ p.Seq[Int]
+ p.Iterable[Int]
+ private[p] p.ASet[Int]
+ private[p] p.AIterable[Int]
+ p.Iterable[Int]
+ p.i.Seq[Int]
+ private[p] p.AIterable[Int]
+ List[Nothing]
+ scala.collection.immutable.Vector[Nothing]
+ scala.collection.immutable.Iterable[(Int, Int)]
+ scala.collection.immutable.Set[Int]
+ Seq[Int]
+ Array[Int]
+ scala.collection.AbstractSet[Int]
+ Comparable[java.lang.String]
+ scala.collection.immutable.LinearSeq[Int]
+ Iterable[Int]
diff --git a/test/files/run/inferred-type-constructors.scala b/test/files/run/inferred-type-constructors.scala
new file mode 100644
index 0000000000..79a8653f68
--- /dev/null
+++ b/test/files/run/inferred-type-constructors.scala
@@ -0,0 +1,125 @@
+package p {
+ trait TCon[+CC[X]] {
+ def fPublic: CC[Int] = ???
+ private[p] def fPackagePrivate: CC[Int] = ???
+ protected[p] def fPackageProtected: CC[Int] = ???
+ }
+ trait Iterable[+A] extends TCon[Iterable]
+ trait Set[A] extends Iterable[A] with TCon[Set]
+ trait Seq[+A] extends Iterable[A] with TCon[Seq]
+
+ private[p] abstract class AIterable[+A] extends Iterable[A]
+ private[p] abstract class ASeq[+A] extends AIterable[A] with Seq[A]
+ private[p] abstract class ASet[A] extends AIterable[A] with Set[A]
+
+ package m {
+ private[m] abstract class ASeq[A] extends p.ASeq[A] with Seq[A]
+ private[m] abstract class ASet[A] extends p.ASet[A] with Set[A]
+ trait Set[A] extends p.Set[A] with TCon[Set]
+ trait Seq[A] extends p.Seq[A] with TCon[Seq]
+ trait BitSet extends ASet[Int]
+ trait IntSeq extends ASeq[Int]
+ }
+
+ package i {
+ private[i] abstract class ASeq[+A] extends p.ASeq[A] with Seq[A]
+ private[i] abstract class ASet[A] extends p.ASet[A] with Set[A]
+ trait Set[A] extends p.Set[A] with TCon[Set]
+ trait Seq[+A] extends p.Seq[A] with TCon[Seq]
+ trait BitSet extends ASet[Int]
+ trait IntSeq extends ASeq[Int]
+ }
+}
+
+object Test {
+ import scala.reflect.runtime.universe._
+ // Complicated by the absence of usable type constructor type tags.
+ def extract[A, CC[X]](xs: CC[A]): CC[A] = xs
+ def whatis[T: TypeTag](x: T): Unit = {
+ val tpe = typeOf[T]
+ val access = tpe.typeSymbol.asInstanceOf[scala.reflect.internal.HasFlags].accessString.replaceAllLiterally("package ", "")
+ println(f"$access%15s $tpe")
+ }
+
+ trait IntIterable extends p.Iterable[Int]
+ trait IntSet extends p.Set[Int]
+ trait IntSeq extends p.Seq[Int]
+
+ trait MutableIntSet extends p.m.Set[Int]
+ trait MutableIntSeq extends p.m.Seq[Int]
+
+ trait ImmutableIntSet extends p.i.Set[Int]
+ trait ImmutableIntSeq extends p.i.Seq[Int]
+
+ def f1: IntIterable = null
+ def f2: IntSet = null
+ def f3: IntSeq = null
+
+ def g1: MutableIntSet = null
+ def g2: MutableIntSeq = null
+ def g3: p.m.BitSet = null
+
+ def h1: ImmutableIntSeq = null
+ def h2: p.i.BitSet = null
+ def h3: p.i.IntSeq = null
+
+ def main(args: Array[String]): Unit = {
+ whatis(extract(f1))
+ whatis(extract(f2))
+ whatis(extract(f3))
+ whatis(extract(g1))
+ whatis(extract(g2))
+ whatis(extract(g3))
+ whatis(extract(h1))
+ whatis(extract(h2))
+ whatis(extract(h3))
+
+ whatis(extract(if (true) f1 else f2))
+ whatis(extract(if (true) f1 else f3))
+ whatis(extract(if (true) f1 else g1))
+ whatis(extract(if (true) f1 else g2))
+ whatis(extract(if (true) f1 else g3))
+ whatis(extract(if (true) f1 else h1))
+ whatis(extract(if (true) f1 else h2))
+ whatis(extract(if (true) f1 else h3))
+ whatis(extract(if (true) f2 else f3))
+ whatis(extract(if (true) f2 else g1))
+ whatis(extract(if (true) f2 else g2))
+ whatis(extract(if (true) f2 else g3))
+ whatis(extract(if (true) f2 else h1))
+ whatis(extract(if (true) f2 else h2))
+ whatis(extract(if (true) f2 else h3))
+ whatis(extract(if (true) f3 else g1))
+ whatis(extract(if (true) f3 else g2))
+ whatis(extract(if (true) f3 else g3))
+ whatis(extract(if (true) f3 else h1))
+ whatis(extract(if (true) f3 else h2))
+ whatis(extract(if (true) f3 else h3))
+ whatis(extract(if (true) g1 else g2))
+ whatis(extract(if (true) g1 else g3))
+ whatis(extract(if (true) g1 else h1))
+ whatis(extract(if (true) g1 else h2))
+ whatis(extract(if (true) g1 else h3))
+ whatis(extract(if (true) g2 else g3))
+ whatis(extract(if (true) g2 else h1))
+ whatis(extract(if (true) g2 else h2))
+ whatis(extract(if (true) g2 else h3))
+ whatis(extract(if (true) g3 else h1))
+ whatis(extract(if (true) g3 else h2))
+ whatis(extract(if (true) g3 else h3))
+ whatis(extract(if (true) h1 else h2))
+ whatis(extract(if (true) h1 else h3))
+ whatis(extract(if (true) h2 else h3))
+
+ whatis(extract(Nil))
+ whatis(extract(Vector()))
+ whatis(extract(Map[Int,Int]()))
+ whatis(extract(Set[Int]()))
+ whatis(extract(Seq[Int]()))
+ whatis(extract(Array[Int]()))
+ whatis(extract(scala.collection.immutable.BitSet(1)))
+ whatis(extract("abc"))
+ whatis(extract(if (true) Stream(1) else List(1)))
+ whatis(extract(if (true) Seq(1) else Set(1)))
+ }
+}
diff --git a/test/files/run/mixin-signatures.check b/test/files/run/mixin-signatures.check
new file mode 100644
index 0000000000..3031fe75af
--- /dev/null
+++ b/test/files/run/mixin-signatures.check
@@ -0,0 +1,59 @@
+class Test$bar1$ {
+ public java.lang.String Test$bar1$.f(java.lang.Object)
+ public java.lang.Object Test$bar1$.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar1$.g(java.lang.String)
+ public java.lang.Object Test$bar1$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar1$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar1$.h(java.lang.Object)
+}
+
+class Test$bar2$ {
+ public java.lang.Object Test$bar2$.f(java.lang.String)
+ public java.lang.Object Test$bar2$.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar2$.g(java.lang.String)
+ public java.lang.Object Test$bar2$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar2$.g(java.lang.String) <bridge> <synthetic>
+ public java.lang.Object Test$bar2$.h(java.lang.Object)
+}
+
+class Test$bar3$ {
+ public java.lang.String Foo3.f(java.lang.Object)
+ generic: public java.lang.String Foo3.f(T)
+ public java.lang.Object Foo3.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar3$.g(java.lang.String)
+ public java.lang.Object Test$bar3$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar3$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Foo3.h(java.lang.Object)
+}
+
+class Test$bar4$ {
+ public java.lang.Object Foo4.f(java.lang.String)
+ generic: public R Foo4.f(java.lang.String)
+ public java.lang.Object Foo4.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar4$.g(java.lang.String)
+ public java.lang.Object Test$bar4$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar4$.g(java.lang.String) <bridge> <synthetic>
+ public java.lang.Object Foo4.h(java.lang.Object)
+}
+
+class Test$bar5$ {
+ public java.lang.String Test$bar5$.f(java.lang.String)
+ public java.lang.Object Test$bar5$.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar5$.f(java.lang.String) <bridge> <synthetic>
+ public java.lang.String Test$bar5$.f(java.lang.Object) <bridge> <synthetic>
+ public java.lang.String Test$bar5$.g(java.lang.String)
+ public java.lang.Object Test$bar5$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar5$.g(java.lang.String) <bridge> <synthetic>
+ public java.lang.String Test$bar5$.g(java.lang.Object) <bridge> <synthetic>
+ public java.lang.Object Test$bar5$.h(java.lang.Object)
+}
+
+class Foo1$class {
+ public static java.lang.String Foo1$class.f(Foo1,java.lang.Object)
+}
+
+class Foo2$class {
+ public static java.lang.Object Foo2$class.f(Foo2,java.lang.String)
+}
+
+000000000000000000000000000000000000
diff --git a/test/files/run/mixin-signatures.scala b/test/files/run/mixin-signatures.scala
new file mode 100644
index 0000000000..afd3fad877
--- /dev/null
+++ b/test/files/run/mixin-signatures.scala
@@ -0,0 +1,105 @@
+trait Base[T, R] {
+ def f(x: T): R
+ def g(x: T): R
+ def h(x: T): R = null.asInstanceOf[R]
+}
+
+trait Foo1[T] extends Base[T, String] {
+ def f(x: T): String = null
+ def g(x: T): String
+}
+trait Foo2[R] extends Base[String, R] {
+ def f(x: String): R = { print(x.length) ; null.asInstanceOf[R] }
+ def g(x: String): R
+}
+abstract class Foo3[T] extends Base[T, String] {
+ def f(x: T): String = ""
+ def g(x: T): String
+}
+abstract class Foo4[R] extends Base[String, R] {
+ def f(x: String): R = { print(x.length) ; null.asInstanceOf[R] }
+ def g(x: String): R
+}
+
+object Test {
+ object bar1 extends Foo1[String] { def g(x: String): String = { print(x.length) ; "" } }
+ object bar2 extends Foo2[String] { def g(x: String): String = { print(x.length) ; "" } }
+ object bar3 extends Foo3[String] { def g(x: String): String = { print(x.length) ; "" } }
+ object bar4 extends Foo4[String] { def g(x: String): String = { print(x.length) ; "" } }
+
+ // Notice that in bar5, f and g require THREE bridges, because the final
+ // implementation is (String)String, but:
+ //
+ // inherited abstract signatures: T(R), (T)String, and (String)R
+ // which erase to: (Object)Object, (Object)String, and (String)Object
+ //
+ // each of which must be bridged to the actual (String)String implementation.
+ //
+ // public java.lang.String Test$bar5$.g(java.lang.String)
+ // public java.lang.Object Test$bar5$.g(java.lang.String) <bridge> <synthetic>
+ // public java.lang.Object Test$bar5$.g(java.lang.Object) <bridge> <synthetic>
+ // public java.lang.String Test$bar5$.g(java.lang.Object) <bridge> <synthetic>
+ object bar5 extends Foo1[String] with Foo2[String] {
+ override def f(x: String): String = { print(x.length) ; x }
+ def g(x: String): String = { print(x.length) ; x }
+ }
+
+ final def m1[T, R](x: Base[T, R], y: T) = { x.f(y) ; x.g(y) ; x.h(y) }
+ final def m2[T](x: Base[T, String], y: T) = { x.f(y) ; x.g(y) ; x.h(y) }
+ final def m3[R](x: Base[String, R]) = { x.f("") ; x.g("") ; x.h("") }
+ final def m4(x: Base[String, String]) = { x.f("") ; x.g("") ; x.h("") }
+
+ final def m11[T](x: Foo1[T], y: T) = { x.f(y) ; x.g(y) ; x.h(y) }
+ final def m12(x: Foo1[String]) = { x.f("") ; x.g("") ; x.h("") }
+ final def m21[T](x: Foo2[T], y: T) = { x.f("") ; x.g("") ; x.h("") }
+ final def m22(x: Foo2[String]) = { x.f("") ; x.g("") ; x.h("") }
+ final def m31[T](x: Foo3[T], y: T) = { x.f(y) ; x.g(y) ; x.h(y) }
+ final def m32(x: Foo3[String]) = { x.f("") ; x.g("") ; x.h("") }
+ final def m41[T](x: Foo4[T], y: T) = { x.f("") ; x.g("") ; x.h("") }
+ final def m42(x: Foo4[String]) = { x.f("") ; x.g("") ; x.h("") }
+
+ def go = {
+ m1(bar1, "") ; m2(bar1, "") ; m3(bar1) ; m4(bar1)
+ m1(bar2, "") ; m2(bar2, "") ; m3(bar2) ; m4(bar2)
+ m1(bar3, "") ; m2(bar3, "") ; m3(bar3) ; m4(bar3)
+ m1(bar4, "") ; m2(bar4, "") ; m3(bar4) ; m4(bar4)
+
+ m11(bar1, "") ; m12(bar1)
+ m21(bar2, "") ; m22(bar2)
+ m31(bar3, "") ; m32(bar3)
+ m41(bar4, "") ; m42(bar4)
+ ""
+ }
+
+ def flagsString(m: java.lang.reflect.Method) = {
+ val str = List(
+ if (m.isBridge) "<bridge>" else "",
+ if (m.isSynthetic) "<synthetic>" else ""
+ ) filterNot (_ == "") mkString " "
+
+ if (str == "") "" else " " + str
+ //
+ // val flags = scala.reflect.internal.ClassfileConstants.toScalaMethodFlags(m.getModifiers())
+ // scala.tools.nsc.symtab.Flags.flagsToString(flags)
+ }
+
+ def show(clazz: Class[_]) {
+ print(clazz + " {")
+ clazz.getMethods.sortBy(x => (x.getName, x.isBridge, x.toString)) filter (_.getName.length == 1) foreach { m =>
+ print("\n " + m + flagsString(m))
+ if ("" + m != "" + m.toGenericString) {
+ print("\n generic: " + m.toGenericString)
+ }
+ }
+ println("\n}")
+ println("")
+ }
+ def show(x: AnyRef) { show(x.getClass) }
+ def show(x: String) { show(Class.forName(x)) }
+
+ def main(args: Array[String]): Unit = {
+ List(bar1, bar2, bar3, bar4, bar5) foreach show
+ List("Foo1$class", "Foo2$class") foreach show
+ println(go)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check
index 352aefaf25..b153ae0470 100644
--- a/test/files/run/reflection-magicsymbols-invoke.check
+++ b/test/files/run/reflection-magicsymbols-invoke.check
@@ -28,7 +28,7 @@ it's important to print the list of AnyVal's members
if some of them change (possibly, adding and/or removing magic symbols), we must update this test
constructor AnyVal: ()AnyVal
method getClass: ()Class[_ <: AnyVal]
-testing AnyVal.<init>: class java.lang.InstantiationException: null
+testing AnyVal.<init>: class scala.ScalaReflectionException: unsupported symbol constructor AnyVal when invoking bytecodeless method mirror for scala.AnyVal.<init>(): AnyVal (bound to null)
testing AnyVal.getClass: class scala.ScalaReflectionException: expected a member of class Integer, you provided method scala.AnyVal.getClass
============
AnyRef
@@ -36,12 +36,10 @@ it's important to print the list of AnyRef's members
if some of them change (possibly, adding and/or removing magic symbols), we must update this test
constructor Object: ()java.lang.Object
method !=: (x$1: Any)Boolean
-method !=: (x$1: AnyRef)Boolean
method ##: ()Int
method $asInstanceOf: [T0]()T0
method $isInstanceOf: [T0]()Boolean
method ==: (x$1: Any)Boolean
-method ==: (x$1: AnyRef)Boolean
method asInstanceOf: [T0]=> T0
method clone: ()java.lang.Object
method eq: (x$1: AnyRef)Boolean
@@ -82,14 +80,11 @@ Array
it's important to print the list of Array's members
if some of them change (possibly, adding and/or removing magic symbols), we must update this test
constructor Array: (_length: Int)Array[T]
-constructor Cloneable: ()java.lang.Cloneable
method !=: (x$1: Any)Boolean
-method !=: (x$1: AnyRef)Boolean
method ##: ()Int
method $asInstanceOf: [T0]()T0
method $isInstanceOf: [T0]()Boolean
method ==: (x$1: Any)Boolean
-method ==: (x$1: AnyRef)Boolean
method apply: (i: Int)T
method asInstanceOf: [T0]=> T0
method clone: ()Array[T]
diff --git a/test/files/run/reflection-sorted-members.check b/test/files/run/reflection-sorted-members.check
index c148e19e69..415e073149 100644
--- a/test/files/run/reflection-sorted-members.check
+++ b/test/files/run/reflection-sorted-members.check
@@ -1,4 +1,3 @@
value a
value b
value c
-value x
diff --git a/test/files/run/t261.check b/test/files/run/t261.check
new file mode 100644
index 0000000000..35d242ba79
--- /dev/null
+++ b/test/files/run/t261.check
@@ -0,0 +1,2 @@
+A
+B
diff --git a/test/files/run/t261.scala b/test/files/run/t261.scala
new file mode 100644
index 0000000000..d8ddb28c00
--- /dev/null
+++ b/test/files/run/t261.scala
@@ -0,0 +1,11 @@
+trait A { val foo: String = "A" }
+trait B {
+ private val foo: String = "B"
+ def f = println(foo)
+}
+object Test extends A with B {
+ def main(args: Array[String]) = {
+ println(foo)
+ f
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t3452.check b/test/files/run/t3452.check
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/test/files/run/t3452.check
@@ -0,0 +1 @@
+4
diff --git a/test/files/run/t3452.scala b/test/files/run/t3452.scala
new file mode 100644
index 0000000000..253fc93cfa
--- /dev/null
+++ b/test/files/run/t3452.scala
@@ -0,0 +1,21 @@
+trait IStringPair[T] {
+ def a : String
+ def b : String
+ def build(a : String, b : String) : T
+ def cat(that : IStringPair[T]) = build(this.a + that.a, this.b + that.b)
+ override def toString = a + b
+}
+
+class StringPair(val a : String, val b : String) extends IStringPair[StringPair] {
+ def build(a : String, b : String) = new StringPair(a, b)
+ def len = a.length + b.length
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val a = new StringPair("A", "B")
+ val b = new StringPair("1", "2")
+ val c = a cat b
+ println(c.len)
+ }
+}
diff --git a/test/files/run/t3452a.check b/test/files/run/t3452a.check
new file mode 100644
index 0000000000..9ff787eb86
--- /dev/null
+++ b/test/files/run/t3452a.check
@@ -0,0 +1 @@
+BulkSearch.searchFor called.
diff --git a/test/files/run/t3452a/J_2.java b/test/files/run/t3452a/J_2.java
new file mode 100644
index 0000000000..62057ffe61
--- /dev/null
+++ b/test/files/run/t3452a/J_2.java
@@ -0,0 +1,5 @@
+public class J_2 {
+ public static void main(String[] args) {
+ BulkSearchInstance.searchFor(new UpRelation());
+ }
+}
diff --git a/test/files/run/t3452a/S_1.scala b/test/files/run/t3452a/S_1.scala
new file mode 100644
index 0000000000..791faf42fa
--- /dev/null
+++ b/test/files/run/t3452a/S_1.scala
@@ -0,0 +1,24 @@
+abstract class BulkSearch {
+ type R <: Row
+ type Rel <: Relation [R]
+ type Corr <: Correspondence[R]
+
+ def searchFor(input: Rel): Mapping[Corr] = { println("BulkSearch.searchFor called.") ; null }
+}
+
+object BulkSearchInstance extends BulkSearch {
+ type R = UpRow
+ type Rel = UpRelation
+ type Corr = UpCorrespondence
+}
+
+class Row
+class UpRow extends Row
+
+class Relation [R <: Row]
+class UpRelation extends Relation [UpRow]
+
+class Correspondence [R <: Row]
+class UpCorrespondence extends Correspondence [UpRow]
+
+class Mapping[MC <: Correspondence[_]]
diff --git a/test/files/run/t3452a/S_3.scala b/test/files/run/t3452a/S_3.scala
new file mode 100644
index 0000000000..aaa898dcde
--- /dev/null
+++ b/test/files/run/t3452a/S_3.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ J_2.main(args)
+ }
+}
diff --git a/test/files/run/t3452b-bcode.check b/test/files/run/t3452b-bcode.check
new file mode 100644
index 0000000000..204c3d0437
--- /dev/null
+++ b/test/files/run/t3452b-bcode.check
@@ -0,0 +1,2 @@
+Search received: test
+SearchC received: test
diff --git a/test/files/run/t3452b-bcode.flags b/test/files/run/t3452b-bcode.flags
new file mode 100644
index 0000000000..c30091d3de
--- /dev/null
+++ b/test/files/run/t3452b-bcode.flags
@@ -0,0 +1 @@
+-Ybackend:GenBCode
diff --git a/test/files/run/t3452b-bcode/J_2.java b/test/files/run/t3452b-bcode/J_2.java
new file mode 100644
index 0000000000..839f334508
--- /dev/null
+++ b/test/files/run/t3452b-bcode/J_2.java
@@ -0,0 +1,6 @@
+public class J_2 {
+ public static void j() {
+ StringSearch.search("test");
+ StringSearch.searchC("test");
+ }
+}
diff --git a/test/files/run/t3452b-bcode/S_1.scala b/test/files/run/t3452b-bcode/S_1.scala
new file mode 100644
index 0000000000..a209f12035
--- /dev/null
+++ b/test/files/run/t3452b-bcode/S_1.scala
@@ -0,0 +1,17 @@
+trait Search[M] {
+ def search(input: M): C[Int] = {
+ println("Search received: " + input)
+ null
+ }
+}
+
+class SearchC[M] {
+ def searchC(input: M): C[Int] = {
+ println("SearchC received: " + input)
+ null
+ }
+}
+
+object StringSearch extends SearchC[String] with Search[String]
+
+trait C[T]
diff --git a/test/files/run/t3452b-bcode/S_3.scala b/test/files/run/t3452b-bcode/S_3.scala
new file mode 100644
index 0000000000..102b433f47
--- /dev/null
+++ b/test/files/run/t3452b-bcode/S_3.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ J_2.j()
+ }
+}
diff --git a/test/files/run/t3452b.check b/test/files/run/t3452b.check
new file mode 100644
index 0000000000..204c3d0437
--- /dev/null
+++ b/test/files/run/t3452b.check
@@ -0,0 +1,2 @@
+Search received: test
+SearchC received: test
diff --git a/test/files/run/t3452b/J_2.java b/test/files/run/t3452b/J_2.java
new file mode 100644
index 0000000000..839f334508
--- /dev/null
+++ b/test/files/run/t3452b/J_2.java
@@ -0,0 +1,6 @@
+public class J_2 {
+ public static void j() {
+ StringSearch.search("test");
+ StringSearch.searchC("test");
+ }
+}
diff --git a/test/files/run/t3452b/S_1.scala b/test/files/run/t3452b/S_1.scala
new file mode 100644
index 0000000000..a209f12035
--- /dev/null
+++ b/test/files/run/t3452b/S_1.scala
@@ -0,0 +1,17 @@
+trait Search[M] {
+ def search(input: M): C[Int] = {
+ println("Search received: " + input)
+ null
+ }
+}
+
+class SearchC[M] {
+ def searchC(input: M): C[Int] = {
+ println("SearchC received: " + input)
+ null
+ }
+}
+
+object StringSearch extends SearchC[String] with Search[String]
+
+trait C[T]
diff --git a/test/files/run/t3452b/S_3.scala b/test/files/run/t3452b/S_3.scala
new file mode 100644
index 0000000000..102b433f47
--- /dev/null
+++ b/test/files/run/t3452b/S_3.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ J_2.j()
+ }
+}
diff --git a/test/files/run/t3452c.check b/test/files/run/t3452c.check
new file mode 100644
index 0000000000..ab47181198
--- /dev/null
+++ b/test/files/run/t3452c.check
@@ -0,0 +1,8 @@
+3
+3
+3
+3
+3
+3
+3
+3
diff --git a/test/files/run/t3452c.scala b/test/files/run/t3452c.scala
new file mode 100644
index 0000000000..2c55767abc
--- /dev/null
+++ b/test/files/run/t3452c.scala
@@ -0,0 +1,113 @@
+trait Base[A, B, C] {
+ def f(x: A, y: B, z: C): Unit
+ def g(x: A, y: B, z: C) = f(x, y, z)
+ def h(x: A, y: B, z: C) = g(x, y, z)
+}
+
+trait D1[B, C] extends Base[String, B, C]
+trait D2[A, B] extends Base[A, B, String]
+trait D3[A, C] extends Base[A, String, C]
+trait D4[A] extends Base[A, String, String]
+trait D5[B] extends Base[String, B, String]
+trait D6[C] extends Base[String, String, C]
+trait D7 extends Base[String, String, String]
+
+trait E1[B, C] extends Base[String, B, C] { def f(x: String, y: B, z: C): Unit ; override def h(x: String, y: B, z: C) = g(x, y, z) }
+trait E2[A, B] extends Base[A, B, String] { def f(x: A, y: B, z: String): Unit ; override def h(x: A, y: B, z: String) = g(x, y, z) }
+trait E3[A, C] extends Base[A, String, C] { def f(x: A, y: String, z: C): Unit ; override def h(x: A, y: String, z: C) = g(x, y, z) }
+trait E4[A] extends Base[A, String, String] { def f(x: A, y: String, z: String): Unit ; override def h(x: A, y: String, z: String) = g(x, y, z) }
+trait E5[B] extends Base[String, B, String] { def f(x: String, y: B, z: String): Unit ; override def h(x: String, y: B, z: String) = g(x, y, z) }
+trait E6[C] extends Base[String, String, C] { def f(x: String, y: String, z: C): Unit ; override def h(x: String, y: String, z: C) = g(x, y, z) }
+trait E7 extends Base[String, String, String] { def f(x: String, y: String, z: String): Unit ; override def h(x: String, y: String, z: String) = g(x, y, z) }
+
+trait F1[B, C] extends Base[String, B, C] { def f(x: String, y: B, z: C): Unit = println(x.length) }
+trait F2[A, B] extends Base[A, B, String] { def f(x: A, y: B, z: String): Unit = println(z.length) }
+trait F3[A, C] extends Base[A, String, C] { def f(x: A, y: String, z: C): Unit = println(y.length) }
+trait F4[A] extends Base[A, String, String] { def f(x: A, y: String, z: String): Unit = println(y.length) }
+trait F5[B] extends Base[String, B, String] { def f(x: String, y: B, z: String): Unit = println(x.length) }
+trait F6[C] extends Base[String, String, C] { def f(x: String, y: String, z: C): Unit = println(x.length) }
+trait F7 extends Base[String, String, String] { def f(x: String, y: String, z: String): Unit = println(x.length) }
+
+abstract class DBag extends D1[String, String] with D2[String, String] with D3[String, String] with D4[String] with D5[String] with D6[String] with D7 {
+ def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+abstract class EBag extends E1[String, String] with E2[String, String] with E3[String, String] with E4[String] with E5[String] with E6[String] with E7 {
+ def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+abstract class FBag extends F1[String, String] with F2[String, String] with F3[String, String] with F4[String] with F5[String] with F6[String] with F7 {
+ override def f(x: String, y: String, z: String) = println(x.length + y.length + z.length)
+}
+
+abstract class GBag1[A, B] extends Base[A, B, String] with D2[A, B] {
+ def f(x: A, y: B, z: String) = println(z.length)
+}
+abstract class GBag2[A] extends GBag1[A, String] with D4[A] {
+ override def f(x: A, y: String, z: String) = println(z.length)
+}
+abstract class GBag3 extends GBag2[String] with D7 {
+ override def f(x: String, y: String, z: String) = println(z.length)
+}
+class GBag extends GBag3 with D2[String, String] with D3[String, String] with D4[String] with D5[String] with D6[String] with D7 {
+}
+
+object Test {
+ def f0(x: Base[String, String, String]) = x.f("a", "b", "c")
+ def f1(x: D1[String, String]) = x.f("a", "b", "c")
+ def f2(x: D2[String, String]) = x.f("a", "b", "c")
+ def f3(x: D3[String, String]) = x.f("a", "b", "c")
+ def f4(x: D4[String]) = x.f("a", "b", "c")
+ def f5(x: D5[String]) = x.f("a", "b", "c")
+ def f6(x: D6[String]) = x.f("a", "b", "c")
+ def f7(x: D7) = x.f("a", "b", "c")
+
+ def main(args: Array[String]): Unit = {
+ val x = new DBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ f4(x)
+ f5(x)
+ f6(x)
+ f7(x)
+ }
+}
+
+object TestE {
+ def f0(x: Base[String, String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f1(x: E1[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f2(x: E2[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f3(x: E3[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f4(x: E4[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f5(x: E5[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f6(x: E6[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f7(x: E7) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+
+ def main(args: Array[String]): Unit = {
+ val x = new EBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ f4(x)
+ f5(x)
+ f6(x)
+ f7(x)
+ }
+}
+
+
+object TestG {
+ def f0(x: Base[String, String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f1(x: GBag1[String, String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f2(x: GBag2[String]) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+ def f3(x: GBag3) = { x.f("a", "b", "c") ; x.g("a", "b", "c") ; x.h("a", "b", "c") }
+
+ def main(args: Array[String]): Unit = {
+ val x = new GBag { }
+ f0(x)
+ f1(x)
+ f2(x)
+ f3(x)
+ }
+}
diff --git a/test/files/run/t3452d/A.scala b/test/files/run/t3452d/A.scala
new file mode 100644
index 0000000000..67a2080d27
--- /dev/null
+++ b/test/files/run/t3452d/A.scala
@@ -0,0 +1,7 @@
+trait TraversableLike[A, Repr] {
+ def tail: Repr = null.asInstanceOf[Repr]
+}
+
+abstract class AbstractTrav[A] extends TraversableLike[A, Traversable[A]]
+
+class C[A] extends AbstractTrav[A]
diff --git a/test/files/run/t3452d/Test.java b/test/files/run/t3452d/Test.java
new file mode 100644
index 0000000000..875be6176c
--- /dev/null
+++ b/test/files/run/t3452d/Test.java
@@ -0,0 +1,12 @@
+import scala.collection.immutable.Nil;
+import scala.collection.immutable.List;
+import scala.collection.Traversable;
+
+public class Test {
+ public static void main(String[] args) {
+ C<String> c = new C<String>();
+ // TODO add a bridge during mixin so we can expose
+ // sharper generic signature for `tail`.
+ /*Traversable<String>*/ Object ls = c.tail();
+ }
+}
diff --git a/test/files/run/t3452e/A.scala b/test/files/run/t3452e/A.scala
new file mode 100644
index 0000000000..939172f401
--- /dev/null
+++ b/test/files/run/t3452e/A.scala
@@ -0,0 +1,4 @@
+trait F1[T, R] {
+ def andThen[A](g: R => A): Int = 0
+}
+class C1[TT, RR] extends F1[TT, RR]
diff --git a/test/files/run/t3452e/B.java b/test/files/run/t3452e/B.java
new file mode 100644
index 0000000000..0268af9987
--- /dev/null
+++ b/test/files/run/t3452e/B.java
@@ -0,0 +1,2 @@
+class B extends C1<String, String> {
+}
diff --git a/test/files/run/t3452e/Test.scala b/test/files/run/t3452e/Test.scala
new file mode 100644
index 0000000000..fc175bf94a
--- /dev/null
+++ b/test/files/run/t3452e/Test.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ new B
+}
diff --git a/test/files/run/t3452f.scala b/test/files/run/t3452f.scala
new file mode 100644
index 0000000000..af64f5c042
--- /dev/null
+++ b/test/files/run/t3452f.scala
@@ -0,0 +1,19 @@
+import language.higherKinds
+
+trait GenSet[A]
+
+trait GenSetTemplate[A, +CC[X] <: GenSet[X]] {
+ def empty: CC[A] = ???
+}
+
+trait SetLike[A, +This <: SetLike[A, This] with Set[A]] {
+ def empty: This
+}
+
+abstract class Set[A] extends GenSet[A] with SetLike[A,Set[A]] with GenSetTemplate[A,Set]
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ locally(classOf[Set[_]]) // trigger classloading to verify class
+ }
+}
diff --git a/test/files/run/t3452g/A.scala b/test/files/run/t3452g/A.scala
new file mode 100644
index 0000000000..a3f74c1e1e
--- /dev/null
+++ b/test/files/run/t3452g/A.scala
@@ -0,0 +1,9 @@
+trait TraversableLike[A, Repr] {
+ def tail: Repr = null.asInstanceOf[Repr]
+}
+
+abstract class AbstractTrav[A] extends TraversableLike[A, AbstractTrav[A]]
+
+object O extends AbstractTrav[String]
+
+class C[A] extends AbstractTrav[A]
diff --git a/test/files/run/t3452g/Test.java b/test/files/run/t3452g/Test.java
new file mode 100644
index 0000000000..c3b4222d16
--- /dev/null
+++ b/test/files/run/t3452g/Test.java
@@ -0,0 +1,14 @@
+
+public class Test {
+ public static void main(String[] args) {
+ // To get better types here, we would need to
+ // add bridge during mixin so we can expose
+ // a generic return type of Traversable<A>, because the erasure
+ // of this (Traversable) differs from the erasure of the mixed
+ // method (erasure(Repr) = Object)
+
+ Object lsSharp = O.tail();
+
+ Object lsSharp2 = new C<String>().tail();
+ }
+}
diff --git a/test/files/run/t3452h.scala b/test/files/run/t3452h.scala
new file mode 100644
index 0000000000..6237d3ea64
--- /dev/null
+++ b/test/files/run/t3452h.scala
@@ -0,0 +1,8 @@
+class Mix___eFoo_I_wBar__f extends Foo_I_ with Bar__f { f; }
+trait T
+abstract class Foo_I_ { class I extends T ; def f: I ; f; }
+trait Bar__f { type I>:Null<:T; def f: I = {null}; f; def gobble: I = {null}}
+
+object Test extends App {
+ new Mix___eFoo_I_wBar__f
+}
diff --git a/test/files/run/t6260-delambdafy.check b/test/files/run/t6260-delambdafy.check
new file mode 100644
index 0000000000..b2a7bed988
--- /dev/null
+++ b/test/files/run/t6260-delambdafy.check
@@ -0,0 +1,4 @@
+f(C@2e)
+
+Test$lambda$1$$apply
+apply
diff --git a/test/files/run/t6260-delambdafy.flags b/test/files/run/t6260-delambdafy.flags
new file mode 100644
index 0000000000..48b438ddf8
--- /dev/null
+++ b/test/files/run/t6260-delambdafy.flags
@@ -0,0 +1 @@
+-Ydelambdafy:method
diff --git a/test/files/run/t6260-delambdafy.scala b/test/files/run/t6260-delambdafy.scala
new file mode 100644
index 0000000000..056b1edd4e
--- /dev/null
+++ b/test/files/run/t6260-delambdafy.scala
@@ -0,0 +1,12 @@
+class C[A](private val a: Any) extends AnyVal
+
+object Test {
+ val f = (x: C[Any]) => {println(s"f($x)"); x}
+ def main(args: Array[String]) {
+ f(new C("."))
+ val methods = f.getClass.getDeclaredMethods.map(_.getName).sorted
+ println("")
+ println(methods.mkString("\n"))
+ }
+}
+
diff --git a/test/files/run/t6260c.check b/test/files/run/t6260c.check
new file mode 100644
index 0000000000..1a57f2d741
--- /dev/null
+++ b/test/files/run/t6260c.check
@@ -0,0 +1,5 @@
+f(C@2e)
+
+Test$$anonfun$$apply
+apply
+g(C@2e)
diff --git a/test/files/run/t6260c.scala b/test/files/run/t6260c.scala
new file mode 100644
index 0000000000..845dc157b7
--- /dev/null
+++ b/test/files/run/t6260c.scala
@@ -0,0 +1,17 @@
+class C[A](private val a: Any) extends AnyVal
+
+object Test {
+ val f = (x: C[Any]) => {println(s"f($x)"); x}
+ trait T[A] {
+ def apply(a: A): A
+ }
+ val g = new T[C[Any]] { def apply(a: C[Any]) = { println(s"g($a)"); a } }
+ def main(args: Array[String]) {
+ f(new C("."))
+ val methods = f.getClass.getDeclaredMethods.map(_.getName).sorted
+ println("")
+ println(methods.mkString("\n"))
+ g.apply(new C("."))
+ }
+}
+
diff --git a/test/files/run/t6411a.check b/test/files/run/t6411a.check
new file mode 100644
index 0000000000..9226146195
--- /dev/null
+++ b/test/files/run/t6411a.check
@@ -0,0 +1,96 @@
+meth = method yg_1
+as seen by Scala reflection: def yg_1[T](y: Y[T]): T
+as seen by Java reflection: public java.lang.Object a$.yg_1(java.lang.Object)
+result = 1
+meth = method yg_1
+as seen by Scala reflection: def yg_1[T](y: Y[T]): T
+as seen by Java reflection: public java.lang.Object a$.yg_1(java.lang.Object)
+result = 1
+meth = method yi_2
+as seen by Scala reflection: def yi_2(y: Y[Int]): Int
+as seen by Java reflection: public int a$.yi_2(java.lang.Integer)
+result = 2
+meth = method yi_2
+as seen by Scala reflection: def yi_2(y: Y[Int]): Int
+as seen by Java reflection: public int a$.yi_2(java.lang.Integer)
+result = class java.lang.IllegalArgumentException: argument type mismatch
+meth = method ys_3
+as seen by Scala reflection: def ys_3(y: Y[String]): String
+as seen by Java reflection: public java.lang.String a$.ys_3(java.lang.String)
+result = class java.lang.IllegalArgumentException: argument type mismatch
+meth = method ys_3
+as seen by Scala reflection: def ys_3(y: Y[String]): String
+as seen by Java reflection: public java.lang.String a$.ys_3(java.lang.String)
+result = 3
+meth = method ya_4
+as seen by Scala reflection: def ya_4(ys: Array[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.ya_4(Y[])
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method ya_4
+as seen by Scala reflection: def ya_4(ys: Array[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.ya_4(Y[])
+result = List(4)
+meth = method yl_5
+as seen by Scala reflection: def yl_5(ys: List[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.yl_5(scala.collection.immutable.List)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method yl_5
+as seen by Scala reflection: def yl_5(ys: List[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.yl_5(scala.collection.immutable.List)
+result = List(5)
+meth = method yni_7
+as seen by Scala reflection: def yni_7(y: => Y[Int]): Int
+as seen by Java reflection: public int a$.yni_7(scala.Function0)
+result = 7
+meth = method yns_8
+as seen by Scala reflection: def yns_8(y: => Y[String]): String
+as seen by Java reflection: public java.lang.String a$.yns_8(scala.Function0)
+result = 8
+meth = method zg_1
+as seen by Scala reflection: def zg_1[T](z: Z[T]): T
+as seen by Java reflection: public java.lang.Object a$.zg_1(Z)
+result = 1
+meth = method zg_1
+as seen by Scala reflection: def zg_1[T](z: Z[T]): T
+as seen by Java reflection: public java.lang.Object a$.zg_1(Z)
+result = 1
+meth = method zi_2
+as seen by Scala reflection: def zi_2(z: Z[Int]): Int
+as seen by Java reflection: public int a$.zi_2(Z)
+result = 2
+meth = method zi_2
+as seen by Scala reflection: def zi_2(z: Z[Int]): Int
+as seen by Java reflection: public int a$.zi_2(Z)
+result = class java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
+meth = method zs_3
+as seen by Scala reflection: def zs_3(z: Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zs_3(Z)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method zs_3
+as seen by Scala reflection: def zs_3(z: Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zs_3(Z)
+result = 3
+meth = method za_4
+as seen by Scala reflection: def za_4(zs: Array[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.za_4(Z[])
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method za_4
+as seen by Scala reflection: def za_4(zs: Array[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.za_4(Z[])
+result = List(4)
+meth = method zl_5
+as seen by Scala reflection: def zl_5(zs: List[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.zl_5(scala.collection.immutable.List)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method zl_5
+as seen by Scala reflection: def zl_5(zs: List[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.zl_5(scala.collection.immutable.List)
+result = List(5)
+meth = method zni_7
+as seen by Scala reflection: def zni_7(z: => Z[Int]): Int
+as seen by Java reflection: public int a$.zni_7(scala.Function0)
+result = 7
+meth = method zns_8
+as seen by Scala reflection: def zns_8(z: => Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zns_8(scala.Function0)
+result = 8
diff --git a/test/files/run/t6411a.scala b/test/files/run/t6411a.scala
new file mode 100644
index 0000000000..3bfeac2890
--- /dev/null
+++ b/test/files/run/t6411a.scala
@@ -0,0 +1,81 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.language.reflectiveCalls
+
+class Y[T](val i: T) extends AnyVal {
+ override def toString = s"Y($i)"
+}
+class Z[T](val i: T) extends AnyRef {
+ override def toString = s"Z($i)"
+}
+
+object a {
+ def yg_1[T](y: Y[T]) = y.i
+ def yi_2(y: Y[Int]) = y.i
+ def ys_3(y: Y[String]) = y.i
+ def ya_4(ys: Array[Y[String]]) = ys.toList.map(_.i)
+ def yl_5(ys: List[Y[String]]) = ys.map(_.i)
+ def yv_6(ys: Y[String]*) = ys.toList.map(_.i)
+ def yni_7(y: => Y[Int]) = y.i
+ def yns_8(y: => Y[String]) = y.i
+
+ def zg_1[T](z: Z[T]) = z.i
+ def zi_2(z: Z[Int]) = z.i
+ def zs_3(z: Z[String]) = z.i
+ def za_4(zs: Array[Z[String]]) = zs.toList.map(_.i)
+ def zl_5(zs: List[Z[String]]) = zs.map(_.i)
+ def zv_6(zs: Z[String]*) = zs.toList.map(_.i)
+ def zni_7(z: => Z[Int]) = z.i
+ def zns_8(z: => Z[String]) = z.i
+}
+
+object Test extends App {
+ def test(methName: String, arg: Any) = {
+ val moduleA = cm.reflect(a)
+ val msym = moduleA.symbol.typeSignature.declaration(TermName(methName)).asMethod
+ println(s"meth = $msym")
+ val mmirror = moduleA.reflectMethod(msym)
+ val mresult =
+ try { mmirror(arg) }
+ catch {
+ case ex: Exception =>
+ val ex1 = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ s"${ex1.getClass}: ${ex1.getMessage}"
+ }
+ println(s"as seen by Scala reflection: ${msym.asInstanceOf[scala.reflect.internal.Symbols#Symbol].defString}")
+ println(s"as seen by Java reflection: ${mmirror.asInstanceOf[{val jmeth: java.lang.reflect.Method}].jmeth}")
+ println(s"result = $mresult")
+ }
+
+ test("yg_1", new Y(1))
+ test("yg_1", new Y("1"))
+ test("yi_2", new Y(2))
+ test("yi_2", new Y("2"))
+ test("ys_3", new Y(3))
+ test("ys_3", new Y("3"))
+ test("ya_4", Array(new Y(4)))
+ test("ya_4", Array(new Y("4")))
+ test("yl_5", List(new Y(5)))
+ test("yl_5", List(new Y("5")))
+ // FIXME: disabled because of SI-7056
+ // test("yv_6", new Y(6))
+ // test("yv_6", new Y("6"))
+ test("yni_7", new Y(7))
+ test("yns_8", new Y("8"))
+
+ test("zg_1", new Z(1))
+ test("zg_1", new Z("1"))
+ test("zi_2", new Z(2))
+ test("zi_2", new Z("2"))
+ test("zs_3", new Z(3))
+ test("zs_3", new Z("3"))
+ test("za_4", Array(new Z(4)))
+ test("za_4", Array(new Z("4")))
+ test("zl_5", List(new Z(5)))
+ test("zl_5", List(new Z("5")))
+ // FIXME: disabled because of SI-7056
+ // test("zv_6", new Z(6))
+ // test("zv_6", new Z("6"))
+ test("zni_7", new Z(7))
+ test("zns_8", new Z("8"))
+} \ No newline at end of file
diff --git a/test/files/run/t6411b.check b/test/files/run/t6411b.check
new file mode 100644
index 0000000000..e20bed6d8d
--- /dev/null
+++ b/test/files/run/t6411b.check
@@ -0,0 +1 @@
+Bar(Foo(3))
diff --git a/test/files/run/t6411b.scala b/test/files/run/t6411b.scala
new file mode 100644
index 0000000000..af30108826
--- /dev/null
+++ b/test/files/run/t6411b.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+
+case class Foo(n: Int) extends AnyVal
+case class Bar(foo: Foo)
+
+object Test extends App {
+ val mirror = runtimeMirror(getClass.getClassLoader)
+ val cm = mirror.reflectClass(typeOf[Bar].typeSymbol.asClass)
+ val ctor = typeOf[Bar].declaration(nme.CONSTRUCTOR).asMethod
+ val ctorm = cm.reflectConstructor(ctor)
+ println(ctorm(Foo(3)))
+} \ No newline at end of file
diff --git a/test/files/run/t6554.check b/test/files/run/t6554.check
new file mode 100644
index 0000000000..6e0af7b474
--- /dev/null
+++ b/test/files/run/t6554.check
@@ -0,0 +1 @@
+public java.lang.Object Bar.minBy(java.lang.Object) / public java.lang.Object Bar.minBy(java.lang.Object)
diff --git a/test/files/run/t6554.scala b/test/files/run/t6554.scala
new file mode 100644
index 0000000000..5d29d16666
--- /dev/null
+++ b/test/files/run/t6554.scala
@@ -0,0 +1,11 @@
+trait Foo[A] {
+ def minBy[B](b: B): A = ???
+}
+
+class Bar extends Foo[Int]
+
+object Test extends App {
+ val sigs = classOf[Bar].getDeclaredMethods.map(m => s"${m.toString} / ${m.toGenericString}").sorted
+ println(sigs.mkString("\n"))
+}
+// Was public java.lang.Object Bar.minBy(java.lang.Object) / public <B> int Bar.minBy(B)
diff --git a/test/files/run/t6632.check b/test/files/run/t6632.check
index 1f084b1dac..26cf061b5f 100644
--- a/test/files/run/t6632.check
+++ b/test/files/run/t6632.check
@@ -1,3 +1,5 @@
java.lang.IndexOutOfBoundsException: -1
java.lang.IndexOutOfBoundsException: -2
java.lang.IndexOutOfBoundsException: -3
+java.lang.IndexOutOfBoundsException: -1
+java.lang.IndexOutOfBoundsException: 5
diff --git a/test/files/run/t6632.scala b/test/files/run/t6632.scala
index 0242e60104..f338b73fa6 100644
--- a/test/files/run/t6632.scala
+++ b/test/files/run/t6632.scala
@@ -3,27 +3,20 @@ object Test extends App {
def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
- val lb0 = newLB
+ def iiobe[A](f: => A) =
+ try { f }
+ catch { case ex: IndexOutOfBoundsException => println(ex) }
- try {
- lb0.insert(-1, 'x)
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
+ val lb0 = newLB
+ iiobe( lb0.insert(-1, 'x) )
val lb1 = newLB
-
- try {
- lb1.insertAll(-2, Array('x, 'y, 'z))
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
+ iiobe( lb1.insertAll(-2, Array('x, 'y, 'z)) )
val lb2 = newLB
+ iiobe( lb2.update(-3, 'u) )
- try {
- lb2.update(-3, 'u)
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
-} \ No newline at end of file
+ val lb3 = newLB
+ iiobe( lb3.updated(-1, 'u) )
+ iiobe( lb3.updated(5, 'u) )
+}
diff --git a/test/files/run/t6908.scala b/test/files/run/t6908.scala
new file mode 100644
index 0000000000..a641de96b9
--- /dev/null
+++ b/test/files/run/t6908.scala
@@ -0,0 +1,6 @@
+object Test {
+ def main(args: Array[String]) {
+ val set = collection.mutable.Set("1", null, "3").par
+ assert( set exists (_ eq null) )
+ }
+}
diff --git a/test/files/run/t6992.check b/test/files/run/t6992.check
index 1a0684c995..021f32ec95 100644
--- a/test/files/run/t6992.check
+++ b/test/files/run/t6992.check
@@ -1,3 +1,4 @@
+Test.foo.T
Int
42
42
diff --git a/test/files/run/t6992/Test_2.scala b/test/files/run/t6992/Test_2.scala
index 05282d6f5b..1ed8958d38 100644
--- a/test/files/run/t6992/Test_2.scala
+++ b/test/files/run/t6992/Test_2.scala
@@ -2,7 +2,9 @@ import scala.language.reflectiveCalls
object Test extends App {
val foo = Macros.foo("T")
- println(scala.reflect.runtime.universe.weakTypeOf[foo.T].typeSymbol.typeSignature)
+ val ttpe = scala.reflect.runtime.universe.weakTypeOf[foo.T]
+ println(ttpe)
+ println(ttpe.typeSymbol.typeSignature)
val bar = Macros.bar("test")
println(bar.test)
diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check
index ebf85b731f..2b4adf36b4 100644
--- a/test/files/run/t7185.check
+++ b/test/files/run/t7185.check
@@ -24,9 +24,7 @@ tree: reflect.runtime.universe.Apply =
scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typecheck(tree): Any}
res0: Any =
{
- {
- $read.O.apply()
- }
+ $read.O.apply()
}
scala>
diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check
index d03ee3a6cf..b7443aa0c4 100644
--- a/test/files/run/t7319.check
+++ b/test/files/run/t7319.check
@@ -21,7 +21,7 @@ scala> convert(Some[Int](0))
--- because ---
argument expression's type is not compatible with formal parameter type;
found : Some[Int]
- required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
+ required: ?F[_$1] forSome { type _$1 <: ?F[_$2] forSome { type _$2 } }
convert(Some[Int](0))
^
<console>:12: error: type mismatch;
diff --git a/test/files/run/t7328.check b/test/files/run/t7328.check
new file mode 100644
index 0000000000..e386fe70d9
--- /dev/null
+++ b/test/files/run/t7328.check
@@ -0,0 +1,4 @@
+Foo
+Foo(3)
+Foo(3)
+Foo(5)
diff --git a/test/files/run/t7328.scala b/test/files/run/t7328.scala
new file mode 100644
index 0000000000..8816fa2347
--- /dev/null
+++ b/test/files/run/t7328.scala
@@ -0,0 +1,18 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+case class Foo(x: Int) extends AnyVal
+case class Bar(foo: Foo)
+
+object Test extends App {
+ val foo = typeOf[Bar].declaration(TermName("foo")).asMethod
+ println(foo.returnType) // Foo
+
+ val bar = Bar(Foo(3))
+ println(bar.foo) // Foo(3)
+
+ val im = cm.reflect(bar)
+ println(im.reflectField(foo).get) // incorrectly gives java.lang.Integer(3) not Foo(3)
+ im.reflectField(foo).set(Foo(5)) // java.lang.IllegalArgumentException: Can not set int field Bar.foo to Foo
+ println(im.reflectMethod(foo)()) // incorrectly gives java.lang.Integer(3) not Foo(3)
+} \ No newline at end of file
diff --git a/test/files/run/t7374.check b/test/files/run/t7374.check
new file mode 100644
index 0000000000..4efa6f7af3
--- /dev/null
+++ b/test/files/run/t7374.check
@@ -0,0 +1,3 @@
+List(2, 3)
+ParVector(1, 2, 3)
+List(1, 2)
diff --git a/test/files/run/t7374/Some.scala b/test/files/run/t7374/Some.scala
new file mode 100644
index 0000000000..3266a5642e
--- /dev/null
+++ b/test/files/run/t7374/Some.scala
@@ -0,0 +1,3 @@
+object SomeScala {
+ def list = List(1, 2, 3)
+}
diff --git a/test/files/run/t7374/Test.java b/test/files/run/t7374/Test.java
new file mode 100644
index 0000000000..02f86146ca
--- /dev/null
+++ b/test/files/run/t7374/Test.java
@@ -0,0 +1,7 @@
+public class Test {
+ public static void main(String[] args) {
+ System.out.println(SomeScala.list().tail());
+ System.out.println(SomeScala.list().par());
+ System.out.println(SomeScala.list().init());
+ }
+}
diff --git a/test/files/run/t7475b.check b/test/files/run/t7475b.check
new file mode 100644
index 0000000000..51993f072d
--- /dev/null
+++ b/test/files/run/t7475b.check
@@ -0,0 +1,2 @@
+2
+2
diff --git a/test/files/run/t7475b.scala b/test/files/run/t7475b.scala
new file mode 100644
index 0000000000..a205602b6d
--- /dev/null
+++ b/test/files/run/t7475b.scala
@@ -0,0 +1,11 @@
+trait A { private val x = 1 }
+trait B { val x = 2 }
+trait C1 extends B with A { println(x) }
+trait C2 extends A with B { println(x) }
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ new C1 { }
+ new C2 { }
+ }
+}
diff --git a/test/files/run/t7507.scala b/test/files/run/t7507.scala
index 6c1959ddac..a5eab6248f 100644
--- a/test/files/run/t7507.scala
+++ b/test/files/run/t7507.scala
@@ -4,6 +4,10 @@ trait Cake extends Slice
trait Slice { self: Cake => // must have self type that extends `Slice`
private[this] val bippy = () // must be private[this]
locally(bippy)
+ class C1 {
+ locally(bippy)
+ locally(self.bippy)
+ }
}
// Originally reported bug:
diff --git a/test/files/run/t7570a.check b/test/files/run/t7570a.check
new file mode 100644
index 0000000000..3cc58df837
--- /dev/null
+++ b/test/files/run/t7570a.check
@@ -0,0 +1 @@
+C
diff --git a/test/files/run/t7570a.scala b/test/files/run/t7570a.scala
new file mode 100644
index 0000000000..b8b4ddeaf2
--- /dev/null
+++ b/test/files/run/t7570a.scala
@@ -0,0 +1,11 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+import definitions._
+import Flag._
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val csym = tb.define(q"""class C { override def toString = "C" }""")
+ println(tb.eval(q"new $csym"))
+} \ No newline at end of file
diff --git a/test/files/run/t7570b.check b/test/files/run/t7570b.check
new file mode 100644
index 0000000000..0c28247025
--- /dev/null
+++ b/test/files/run/t7570b.check
@@ -0,0 +1 @@
+compilation failed: reflective toolbox has failed: cannot have free terms in a top-level definition
diff --git a/test/files/run/t7570b.scala b/test/files/run/t7570b.scala
new file mode 100644
index 0000000000..f1db193186
--- /dev/null
+++ b/test/files/run/t7570b.scala
@@ -0,0 +1,17 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.{ToolBox, ToolBoxError}
+import definitions._
+import Flag._
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val msg = build.newFreeTerm("msg", "C")
+ build.setTypeSignature(msg, typeOf[String])
+ try {
+ val csym = tb.define(q"""class C { override def toString = $msg }""")
+ println(tb.eval(q"new $csym"))
+ } catch {
+ case ToolBoxError(message, _) => println(s"compilation failed: $message")
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7570c.check b/test/files/run/t7570c.check
new file mode 100644
index 0000000000..61e659d9e0
--- /dev/null
+++ b/test/files/run/t7570c.check
@@ -0,0 +1,2 @@
+(class C,true,false,false)
+(object D,false,true,false)
diff --git a/test/files/run/t7570c.scala b/test/files/run/t7570c.scala
new file mode 100644
index 0000000000..a5bdbffe18
--- /dev/null
+++ b/test/files/run/t7570c.scala
@@ -0,0 +1,13 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.{ToolBox, ToolBoxError}
+import definitions._
+import Flag._
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val csym = tb.define(q"""class C { override def toString = "C" }""")
+ println((csym, csym.isClass, csym.isModule, csym.isModuleClass))
+ val dsym = tb.define(q"""object D { override def toString = "D" }""".asInstanceOf[ModuleDef])
+ println((dsym, dsym.isClass, dsym.isModule, dsym.isModuleClass))
+} \ No newline at end of file
diff --git a/test/files/run/t7711-script-args.check b/test/files/run/t7711-script-args.check
new file mode 100644
index 0000000000..d107590a8a
--- /dev/null
+++ b/test/files/run/t7711-script-args.check
@@ -0,0 +1,2 @@
+Hello, scripted test!
+What good news have you for me today?
diff --git a/test/files/run/t7711-script-args.scala b/test/files/run/t7711-script-args.scala
new file mode 100644
index 0000000000..02535aa954
--- /dev/null
+++ b/test/files/run/t7711-script-args.scala
@@ -0,0 +1,7 @@
+
+import scala.tools.partest.ScriptTest
+
+object Test extends ScriptTest {
+ override def extraSettings = s"${super.extraSettings} -Xlint"
+ override def argv = Seq("good", "news")
+}
diff --git a/test/files/run/t7711-script-args.script b/test/files/run/t7711-script-args.script
new file mode 100644
index 0000000000..19b7a74924
--- /dev/null
+++ b/test/files/run/t7711-script-args.script
@@ -0,0 +1,12 @@
+#!/bin/bash
+exec ${SCALA_HOME}/bin/scala "$0" "$@" 2>&1
+!#
+
+Console println s"Hello, scripted test!"
+Console println s"What ${args mkString " "} have you for me today?"
+
+//def unused = 88
+//newSource1.scala:8: warning: private method in <$anon: AnyRef> is never used
+//Console println s"Hello, $argv, are you still here?"
+//newSource1.scala:9: error: not found: value argv
+
diff --git a/test/disabled/run/t7843-jsr223-service.check b/test/files/run/t7843-jsr223-service.check
index a668df3567..a668df3567 100644
--- a/test/disabled/run/t7843-jsr223-service.check
+++ b/test/files/run/t7843-jsr223-service.check
diff --git a/test/files/run/t7843-jsr223-service.scala b/test/files/run/t7843-jsr223-service.scala
new file mode 100644
index 0000000000..31112212ea
--- /dev/null
+++ b/test/files/run/t7843-jsr223-service.scala
@@ -0,0 +1,8 @@
+import scala.tools.nsc.interpreter.IMain
+
+object Test extends App {
+ val engine = new IMain.Factory getScriptEngine()
+ engine.asInstanceOf[IMain].settings.usejavacp.value = true
+ engine put ("n", 10)
+ engine eval "1 to n.asInstanceOf[Int] foreach print"
+}
diff --git a/test/files/run/t7933.check b/test/files/run/t7933.check
new file mode 100644
index 0000000000..317e9677c3
--- /dev/null
+++ b/test/files/run/t7933.check
@@ -0,0 +1,2 @@
+hello
+hello
diff --git a/test/files/run/t7933.scala b/test/files/run/t7933.scala
new file mode 100644
index 0000000000..b06dffcd80
--- /dev/null
+++ b/test/files/run/t7933.scala
@@ -0,0 +1,11 @@
+import scala.tools.nsc.interpreter.IMain
+
+object Test extends App {
+ val engine = new IMain.Factory getScriptEngine()
+ engine.asInstanceOf[IMain].settings.usejavacp.value = true
+ val res2 = engine.asInstanceOf[javax.script.Compilable]
+ res2 compile "8" eval()
+ val res5 = res2 compile """println("hello") ; 8"""
+ res5 eval()
+ res5 eval()
+}
diff --git a/test/files/run/t8104.check b/test/files/run/t8104.check
index c2593eb199..40523a2868 100644
--- a/test/files/run/t8104.check
+++ b/test/files/run/t8104.check
@@ -1 +1,2 @@
-TypeTag[(Int, Int)]
+WeakTypeTag[<refinement>.this.Repr]
+(Int, Int)
diff --git a/test/files/run/t8104/Test_2.scala b/test/files/run/t8104/Test_2.scala
index 630176f175..55c080a563 100644
--- a/test/files/run/t8104/Test_2.scala
+++ b/test/files/run/t8104/Test_2.scala
@@ -9,7 +9,10 @@ object Test extends App {
case class C(x: Int, y: Int)
import scala.reflect.runtime.universe._
- def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: TypeTag[Repr]) = println(tag)
+ def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: WeakTypeTag[Repr]) = {
+ println(tag)
+ println(tag.tpe.typeSymbol.typeSignature)
+ }
reprify(C(40, 2))
implicitly[Generic.Aux[C, (Int, Int)]]
diff --git a/test/files/run/t8153.check b/test/files/run/t8153.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/files/run/t8153.check
@@ -0,0 +1 @@
+2
diff --git a/test/files/run/t8153.scala b/test/files/run/t8153.scala
new file mode 100644
index 0000000000..f9b223f974
--- /dev/null
+++ b/test/files/run/t8153.scala
@@ -0,0 +1,14 @@
+object Test {
+ def f() = {
+ val lb = scala.collection.mutable.ListBuffer[Int](1, 2)
+ val it = lb.iterator
+ if (it.hasNext) it.next
+ val xs = lb.toList
+ lb += 3
+ it.mkString
+ }
+
+ def main(args: Array[String]) {
+ println(f())
+ }
+}
diff --git a/test/files/run/t8177f.scala b/test/files/run/t8177f.scala
new file mode 100644
index 0000000000..f50a5d98d6
--- /dev/null
+++ b/test/files/run/t8177f.scala
@@ -0,0 +1,20 @@
+trait Thing { type A; var p: A = _ }
+class A[T](final val x: Thing { type A = T }) {
+ type Q = T
+
+ def x1: T = x.p
+ def x2: Q = x.p
+ def x3: x.A = x.p
+}
+// all result types should be inferred as Int
+class B extends A[Int](null) {
+ def y1 = x1
+ def y2 = x2
+ val y3 = x3 // before SI-8177, this lead to a signature that erased to java.lang.Object
+}
+
+
+object Test extends App {
+ val methods = classOf[B].getDeclaredMethods.sortBy(_.getName)
+ assert(methods.forall(_.toGenericString.startsWith("public int")))
+}
diff --git a/test/files/run/t8188.scala b/test/files/run/t8188.scala
new file mode 100644
index 0000000000..ec3a968e4a
--- /dev/null
+++ b/test/files/run/t8188.scala
@@ -0,0 +1,25 @@
+object Test {
+ def main(args: Array[String]) {
+ import java.io.ByteArrayInputStream
+ import java.io.ByteArrayOutputStream
+ import java.io.ObjectInputStream
+ import java.io.ObjectOutputStream
+ import scala.collection.concurrent.TrieMap
+
+ def ser[T](o: T): Array[Byte] = {
+ val baos = new ByteArrayOutputStream()
+ new ObjectOutputStream(baos).writeObject(o)
+ baos.toByteArray()
+ }
+
+ def deser[T](bs: Array[Byte]): T =
+ new ObjectInputStream(new ByteArrayInputStream(bs)).readObject().asInstanceOf[T]
+
+ def cloneViaSerialization[T](t: T): T = deser(ser(t))
+
+ val f = cloneViaSerialization(_: TrieMap[Int, Int])
+ val tm = TrieMap(1 -> 2)
+ assert( f(f(tm)) == tm )
+ assert( ser(tm).length == ser(f(tm)).length )
+ }
+}
diff --git a/test/files/run/t8245.scala b/test/files/run/t8245.scala
new file mode 100644
index 0000000000..d44defbb9e
--- /dev/null
+++ b/test/files/run/t8245.scala
@@ -0,0 +1,14 @@
+object Test {
+ def foo(o: Option[Int]): Int = {
+ lazy val i: Int = {
+ def local: Int = {if ("".isEmpty) return 42; -42}
+ assert(local == 42)
+ o.getOrElse(return -1)
+ }
+ i + 1
+ }
+
+ def main(args: Array[String]) {
+ assert(foo(None) == -1)
+ }
+}
diff --git a/test/files/run/t8266-octal-interp.check b/test/files/run/t8266-octal-interp.check
new file mode 100644
index 0000000000..6e9454119b
--- /dev/null
+++ b/test/files/run/t8266-octal-interp.check
@@ -0,0 +1,30 @@
+t8266-octal-interp.scala:4: warning: Octal escape literals are deprecated, use \b instead.
+ f"a\10c",
+ ^
+t8266-octal-interp.scala:5: warning: Octal escape literals are deprecated, use \t instead.
+ f"a\11c",
+ ^
+t8266-octal-interp.scala:6: warning: Octal escape literals are deprecated, use \n instead.
+ f"a\12c",
+ ^
+t8266-octal-interp.scala:7: warning: Octal escape literals are deprecated, use \r instead.
+ f"a\15c",
+ ^
+t8266-octal-interp.scala:8: warning: Octal escape literals are deprecated, use \u0022 instead.
+ f"a\42c",
+ ^
+t8266-octal-interp.scala:9: warning: Octal escape literals are deprecated, use \\ instead.
+ f"a\134c",
+ ^
+t8266-octal-interp.scala:10: warning: Octal escape literals are deprecated, use \u0069 instead.
+ f"a\15151515c"
+ ^
+ac
+a c
+a
+c
+a
+c
+a"c
+a\c
+ai51515c
diff --git a/test/files/run/t8266-octal-interp.flags b/test/files/run/t8266-octal-interp.flags
new file mode 100644
index 0000000000..dcc59ebe32
--- /dev/null
+++ b/test/files/run/t8266-octal-interp.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/test/files/run/t8266-octal-interp.scala b/test/files/run/t8266-octal-interp.scala
new file mode 100644
index 0000000000..f85ae0367d
--- /dev/null
+++ b/test/files/run/t8266-octal-interp.scala
@@ -0,0 +1,16 @@
+
+trait X {
+ def f = Seq(
+ f"a\10c",
+ f"a\11c",
+ f"a\12c",
+ f"a\15c",
+ f"a\42c",
+ f"a\134c",
+ f"a\15151515c"
+ )
+}
+
+object Test extends App with X {
+ f foreach println
+}
diff --git a/test/files/run/t8280.check b/test/files/run/t8280.check
new file mode 100644
index 0000000000..ed392841c7
--- /dev/null
+++ b/test/files/run/t8280.check
@@ -0,0 +1,9 @@
+Int
+Int
+Int
+Int
+Int
+Int
+Int
+Int
+Int
diff --git a/test/files/run/t8280.scala b/test/files/run/t8280.scala
new file mode 100644
index 0000000000..0734d63b6e
--- /dev/null
+++ b/test/files/run/t8280.scala
@@ -0,0 +1,82 @@
+import scala.language.implicitConversions
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ Moop1.ob1
+ Moop1.ob2
+ Moop1.ob3
+ Moop2.ob1
+ Moop2.ob2
+ Moop2.ob3
+ Moop3.ob1
+ Moop3.ob2
+ Moop3.ob3
+ }
+}
+
+// int object vs.
+object Moop1 {
+ object ob1 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
+// int def vs.
+object Moop2 {
+ object ob1 {
+ implicit def f1(x: Int): String = "Int"
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit def f1(x: Int): String = "Int"
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit def f1(x: Int): String = "Int"
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
+// int val vs.
+object Moop3 {
+ object ob1 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" }
+
+ println(5: String)
+ }
+ object ob2 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit def f2(x: Long): String = "Long"
+
+ println(5: String)
+ }
+ object ob3 {
+ implicit val f1: Int => String = _ => "Int"
+ implicit val f2: Long => String = _ => "Long"
+
+ println(5: String)
+ }
+}
+
diff --git a/test/files/run/typecheck.check b/test/files/run/typecheck.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/typecheck.check
diff --git a/test/files/run/typecheck/Macros_1.scala b/test/files/run/typecheck/Macros_1.scala
new file mode 100644
index 0000000000..ee1c8da763
--- /dev/null
+++ b/test/files/run/typecheck/Macros_1.scala
@@ -0,0 +1,12 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ c.typecheck(q"class C")
+ q"()"
+ }
+
+ def foo: Any = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/typecheck/Test_2.scala b/test/files/run/typecheck/Test_2.scala
new file mode 100644
index 0000000000..01bf5198cc
--- /dev/null
+++ b/test/files/run/typecheck/Test_2.scala
@@ -0,0 +1,10 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ Macros.foo
+
+ val tb = cm.mkToolBox()
+ tb.typecheck(q"class C")
+} \ No newline at end of file
diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
index dcd4f63a4d..5f22925335 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
@@ -7,21 +7,22 @@ object DefinitionConstructionProps
with TraitConstruction
with TypeDefConstruction
with ValDefConstruction
+ with PatDefConstruction
with DefConstruction
- with PackageConstruction
+ with PackageConstruction
with ImportConstruction {
- property("SI-6842") = test {
- val x: Tree = q"val x: Int"
- assertEqAst(q"def f($x) = 0", "def f(x: Int) = 0")
- assertEqAst(q"class C($x)", "class C(val x: Int)")
- assertEqAst(q"class C { $x => }", "class C { x: Int => }")
- assertEqAst(q"trait B { $x => }", "trait B { x: Int => }")
- assertEqAst(q"object A { $x => }", "object A { x: Int => }")
- val t: Tree = q"type T"
- assertEqAst(q"def f[$t] = 0", "def f[T] = 0")
- assertEqAst(q"class C[$t]", "class C[T]")
- assertEqAst(q"trait B[$t]", "trait B[T]")
- }
+
+ val x: Tree = q"val x: Int"
+ property("SI-6842 a1") = test { assertEqAst(q"def f($x) = 0", "def f(x: Int) = 0") }
+ property("SI-6842 a2") = test { assertEqAst(q"class C($x)", "class C(val x: Int)") }
+ property("SI-6842 a3") = test { assertEqAst(q"class C { $x => }", "class C { x: Int => }") }
+ property("SI-6842 a4") = test { assertEqAst(q"trait B { $x => }", "trait B { x: Int => }") }
+ property("SI-6842 a5") = test { assertEqAst(q"object A { $x => }", "object A { x: Int => }") }
+
+ val t: Tree = q"type T"
+ property("SI-6842 b1") = test { assertEqAst(q"def f[$t] = 0", "def f[T] = 0") }
+ property("SI-6842 b2") = test { assertEqAst(q"class C[$t]", "class C[T]") }
+ property("SI-6842 b3") = test { assertEqAst(q"trait B[$t]", "trait B[T]") }
}
trait ClassConstruction { self: QuasiquoteProperties =>
@@ -200,13 +201,54 @@ trait TypeDefConstruction { self: QuasiquoteProperties =>
}
trait ValDefConstruction { self: QuasiquoteProperties =>
- property("splice term name into val") = forAll { (name: TermName, tpt: Tree, rhs: Tree) =>
+ property("splice into val") = forAll { (name: TermName, tpt: Tree, rhs: Tree) =>
q"val $name: $tpt = $rhs" ≈ ValDef(Modifiers(), name, tpt, rhs)
}
- property("splice term name into var") = forAll { (name: TermName, tpt: Tree, rhs: Tree) =>
+ property("splice into var") = forAll { (name: TermName, tpt: Tree, rhs: Tree) =>
q"var $name: $tpt = $rhs" ≈ ValDef(Modifiers(MUTABLE), name, tpt, rhs)
}
+
+ // left tree is not a pattern due to Si-8211
+ property("SI-8202") = test {
+ assertEqAst(q"val (x: Int) = 1", "val x: Int = 1")
+ }
+}
+
+trait PatDefConstruction { self: QuasiquoteProperties =>
+ property("splice pattern into pat def") = test {
+ val pat = pq"(a, b)"
+ assertEqAst(q"val $pat = (1, 2)", "val (a, b) = (1, 2)")
+ val tpt = tq"(Int, Int)"
+ assertEqAst(q"val $pat: $tpt = (1, 2)", "val (a, b): (Int, Int) = (1, 2)")
+ }
+
+ property("splice pattern into pat def within other pattern (1)") = test {
+ val pat = pq"(a, b)"
+ assertEqAst(q"val Foo($pat) = Foo((1, 2))", "val Foo((a, b)) = Foo((1, 2))")
+ val tpt = tq"Foo"
+ assertEqAst(q"val Foo($pat): $tpt = Foo((1, 2))", "val Foo((a, b)): Foo = Foo((1, 2))")
+ }
+
+ property("splice patterns into pat def within other pattern (2)") = test {
+ val pat1 = pq"(a, b)"; val pat2 = pq"(c, d)"
+ assertEqAst(q"val ($pat1, $pat2) = ((1, 2), (3, 4))", "val ((a, b), (c, d)) = ((1, 2), (3, 4))")
+ val tpt = tq"((Int, Int), (Int, Int))"
+ assertEqAst(q"val ($pat1, $pat2): $tpt = ((1, 2), (3, 4))", "val ((a, b), (c, d)): ((Int, Int), (Int, Int)) = ((1, 2), (3, 4))")
+ }
+
+ property("splice pattern without free vars into pat def") = test {
+ val pat = pq"((1, 2), 3)"
+ assertEqAst(q"val $pat = ((1, 2), 3)", "{ val ((1, 2), 3) = ((1, 2), 3) }")
+ val tpt = tq"((Int, Int), Int)"
+ assertEqAst(q"val $pat: $tpt = ((1, 2), 3)","{ val ((1, 2), 3): ((Int, Int), Int) = ((1, 2), 3) }")
+ }
+
+ // won't result into pattern match due to SI-8211
+ property("splice typed pat into pat def") = test {
+ val pat = pq"x: Int"
+ assertEqAst(q"val $pat = 2", "{ val x: Int = 2 }")
+ }
}
trait MethodConstruction { self: QuasiquoteProperties =>
diff --git a/test/files/scalacheck/quasiquotes/LiftableProps.scala b/test/files/scalacheck/quasiquotes/LiftableProps.scala
index bd631b8734..20cfcbe139 100644
--- a/test/files/scalacheck/quasiquotes/LiftableProps.scala
+++ b/test/files/scalacheck/quasiquotes/LiftableProps.scala
@@ -99,7 +99,6 @@ object LiftableProps extends QuasiquoteProperties("liftable") {
}
property("lift tuple") = test {
- assert(q"${Tuple1(1)}" ≈ q"scala.Tuple1(1)")
assert(q"${(1, 2)}" ≈ q"(1, 2)")
assert(q"${(1, 2, 3)}" ≈ q"(1, 2, 3)")
assert(q"${(1, 2, 3, 4)}" ≈ q"(1, 2, 3, 4)")
diff --git a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala b/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
index 582e915258..ca4c8609ac 100644
--- a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
@@ -29,4 +29,8 @@ object PatternConstructionProps extends QuasiquoteProperties("pattern constructi
property("splice into casedef") = forAll { (pat: Tree, cond: Tree, body: Tree) =>
cq"$pat if $cond => $body" ≈ CaseDef(pat, cond, body)
}
-} \ No newline at end of file
+
+ property("splice into alternative") = forAll { (first: Tree, rest: List[Tree]) =>
+ pq"$first | ..$rest" ≈ Alternative(first :: rest)
+ }
+}
diff --git a/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
index c8e66c7ef5..ad3266bcec 100644
--- a/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
@@ -36,4 +36,9 @@ object PatternDeconstructionProps extends QuasiquoteProperties("pattern deconstr
val cq"$pat0 if $cond0 => $body0" = cq"$pat if $cond => $body"
pat0 ≈ pat && cond0 ≈ cond && body0 ≈ body
}
+
+ property("extract alternative") = forAll { (first: Tree, rest: List[Tree]) =>
+ val pq"$first1 | ..$rest1" = pq"$first | ..$rest"
+ first1 ≈ first && rest1 ≈ rest
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
index 589b8d4d72..5d84984514 100644
--- a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
+++ b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
@@ -28,7 +28,7 @@ trait Helpers {
override def transform(tree: Tree): Tree = tree match {
case Ident(SimplifiedName(name)) => Ident(name)
- case ValDef(mods, SimplifiedName(name), tpt, rhs) => ValDef(mods, name, tpt, rhs)
+ case ValDef(mods, SimplifiedName(name), tpt, rhs) => ValDef(mods, name, transform(tpt), transform(rhs))
case Bind(SimplifiedName(name), rhs) => Bind(name, rhs)
case _ =>
super.transform(tree)
diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
index 058880a25c..c1aa23ac23 100644
--- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
@@ -139,6 +139,11 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
assert(q"(..$empty)" ≈ q"()")
}
+ property("splice single element list into tuple") = test {
+ val xs = q"x" :: Nil
+ assert(q"(..$xs)" ≈ xs.head)
+ }
+
property("function param flags are the same") = test {
val xy = q"val x: A" :: q"val y: B" :: Nil
assertEqAst(q"(..$xy) => x + y", "(x: A, y: B) => x + y")
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
index 148bb383b0..7c9b5ead20 100644
--- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
@@ -82,6 +82,11 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
assert(last ≈ q"d")
}
+ property("deconstruct expr as tuple") = test {
+ val q"(..$elems)" = q"foo"
+ assert(elems ≈ List(q"foo"))
+ }
+
property("deconstruct cases") = test {
val q"$x match { case ..$cases }" = q"x match { case 1 => case 2 => }"
assert(x ≈ q"x")
diff --git a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
index 78b54a4e49..08ed15e8a5 100644
--- a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
@@ -18,6 +18,11 @@ object TypeConstructionProps extends QuasiquoteProperties("type construction")
assert(tq"(t0, ..$ts)" ≈ tq"scala.Tuple3[t0, t1, t2]")
}
+ property("single-element tuple type") = test {
+ val ts = q"T" :: Nil
+ assert(tq"(..$ts)" ≈ ts.head)
+ }
+
property("refined type") = test {
val stats = q"def foo" :: q"val x: Int" :: q"type Y = String" :: Nil
assert(tq"T { ..$stats }" ≈ tq"T { def foo; val x: Int; type Y = String }")
diff --git a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
index 0fdcc19052..8ec1779353 100644
--- a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
@@ -35,6 +35,11 @@ object TypeDeconstructionProps extends QuasiquoteProperties("type deconstruction
assert(last ≈ tq"t2")
}
+ property("tuple type (5)") = test {
+ val tq"(..$ts)" = tq"T"
+ assert(ts ≈ List(tq"T"))
+ }
+
property("refined type") = test {
val tq"T { ..$stats }" = tq"T { def foo; val x: Int; type Y = String }"
assert(stats ≈ List(q"def foo", q"val x: Int", q"type Y = String"))
diff --git a/test/files/scalacheck/quasiquotes/UnliftableProps.scala b/test/files/scalacheck/quasiquotes/UnliftableProps.scala
index 8b827c98ff..4e996c90d7 100644
--- a/test/files/scalacheck/quasiquotes/UnliftableProps.scala
+++ b/test/files/scalacheck/quasiquotes/UnliftableProps.scala
@@ -111,8 +111,6 @@ object UnliftableProps extends QuasiquoteProperties("unliftable") {
}
property("unlift tuple") = test {
- // fails due to SI-8045
- // val q"${t1: Tuple1[Int]}" = q"_root_.scala.Tuple1(1)"
val q"${t2: (Int, Int)}" = q"(1, 2)"
val q"${t3: (Int, Int, Int)}" = q"(1, 2, 3)"
val q"${t4: (Int, Int, Int, Int)}" = q"(1, 2, 3, 4)"
diff --git a/test/files/scalacheck/range.scala b/test/files/scalacheck/range.scala
index 1eb186f303..493083a51f 100644
--- a/test/files/scalacheck/range.scala
+++ b/test/files/scalacheck/range.scala
@@ -265,7 +265,8 @@ object TooLargeRange extends Properties("Too Large Range") {
property("Too large range throws exception") = forAll(genTooLargeStart) { start =>
try {
val r = Range.inclusive(start, Int.MaxValue, 1)
- println("how here? r = " + r.toString)
+ val l = r.length
+ println("how here? length = " + l + ", r = " + r.toString)
false
}
catch { case _: IllegalArgumentException => true }
diff --git a/test/junit/scala/collection/NumericRangeTest.scala b/test/junit/scala/collection/NumericRangeTest.scala
index 0260723b9d..3980c31577 100644
--- a/test/junit/scala/collection/NumericRangeTest.scala
+++ b/test/junit/scala/collection/NumericRangeTest.scala
@@ -6,7 +6,7 @@ import org.junit.Test
import scala.math._
import scala.util._
-/* Tests various maps by making sure they all agree on the same answers. */
+/* Tests various ranges by making sure they all agree on the same answers. */
@RunWith(classOf[JUnit4])
class RangeConsistencyTest {
def r2nr[T: Integral](
@@ -120,4 +120,21 @@ class RangeConsistencyTest {
case _ => false
}
}}
+
+ @Test
+ def testSI6736() {
+ // These operations on overfull ranges should all succeed.
+ assert( (0 to Int.MaxValue).contains(4) )
+ assert( !((Int.MinValue to 0).contains(4)) )
+ assert( (Int.MinValue to 0).last == 0 )
+ assert( (Int.MinValue until 5).last == 4 )
+ assert( (-7 to -99 by -4).last == -99 && (-7 until -99 by -4).last == -95 )
+ assert( (Int.MinValue to 5) == (Int.MinValue until 6) )
+ assert( (-3 to Int.MaxValue).drop(4).length == Int.MaxValue )
+ assert( (-3 to Int.MaxValue).take(1234) == (-3 to 1230) )
+ assert( (-3 to Int.MaxValue).dropRight(4).length == Int.MaxValue )
+ assert( (-3 to Int.MaxValue).takeRight(1234).length == 1234 )
+ assert( (-3 to Int.MaxValue).dropWhile(_ <= 0).length == Int.MaxValue )
+ assert( (-3 to Int.MaxValue).span(_ <= 0) match { case (a,b) => a.length == 4 && b.length == Int.MaxValue } )
+ }
}
diff --git a/test/junit/scala/collection/SetMapConsistencyTest.scala b/test/junit/scala/collection/SetMapConsistencyTest.scala
index 7bb8ca958b..eed6007eef 100644
--- a/test/junit/scala/collection/SetMapConsistencyTest.scala
+++ b/test/junit/scala/collection/SetMapConsistencyTest.scala
@@ -478,7 +478,7 @@ class SetMapConsistencyTest {
}
@Test
- def si8213() {
+ def testSI8213() {
val am = new scala.collection.mutable.AnyRefMap[String, Int]
for (i <- 0 until 1024) am += i.toString -> i
am.getOrElseUpdate("1024", { am.clear; -1 })
@@ -488,4 +488,30 @@ class SetMapConsistencyTest {
lm.getOrElseUpdate(1024, { lm.clear; -1 })
assert(lm == scala.collection.mutable.LongMap(1024L -> -1))
}
+
+ // Mutating when an iterator is in the wild shouldn't produce random junk in the iterator
+ // Todo: test all sets/maps this way
+ @Test
+ def testSI8154() {
+ def f() = {
+ val xs = scala.collection.mutable.AnyRefMap[String, Int]("a" -> 1)
+ val it = xs.iterator
+ it.hasNext
+ xs.clear()
+
+ if (it.hasNext) Some(it.next)
+ else None
+ }
+ assert(f() match {
+ case Some((a,b)) if (a==null || b==null) => false
+ case _ => true
+ })
+ }
+
+ @Test
+ def testSI8264() {
+ val hs = Set(-2147483648, 1, -45023380, -1, 1971207058, -54312241, -234243394) - -1
+ assert( hs.toList.toSet == hs )
+ assert( hs == hs.toList.toSet )
+ }
}
diff --git a/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala b/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
index a3699a4eeb..b42e9a07cb 100644
--- a/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
+++ b/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
@@ -69,6 +69,7 @@ class SymbolTableForUnitTesting extends SymbolTable {
// Members declared in scala.reflect.internal.Required
def picklerPhase: scala.reflect.internal.Phase = SomePhase
+ def erasurePhase: scala.reflect.internal.Phase = SomePhase
// Members declared in scala.reflect.internal.SymbolTable
def currentRunId: Int = 1
diff --git a/test/files/neg/t7886.scala b/test/pending/neg/t7886.scala
index 55d80a0a43..55d80a0a43 100644
--- a/test/files/neg/t7886.scala
+++ b/test/pending/neg/t7886.scala
diff --git a/test/pending/neg/t7886b.scala b/test/pending/neg/t7886b.scala
new file mode 100644
index 0000000000..1db8be9821
--- /dev/null
+++ b/test/pending/neg/t7886b.scala
@@ -0,0 +1,23 @@
+trait Covariant[+A]
+trait Contra[-A] { def accept(p: A): Unit }
+trait Invariant[A] extends Covariant[A] with Contra[A]
+
+trait T
+case class Unravel[A](m: Contra[A], msg: A) extends T
+
+object Test extends Covariant[Any] {
+ def g(m: Contra[Any]): Unit = m accept 5
+ def f(x: T): Unit = x match {
+ case Unravel(m, msg) => g(m)
+ case _ =>
+ }
+ def main(args: Array[String]) {
+ f(Unravel[String](new Contra[String] { def accept(x: String) = x.length }, ""))
+ }
+}
+// java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+// at Test$$anon$1.accept(a.scala:18)
+// at Test$.g(a.scala:13)
+// at Test$.f(a.scala:15)
+// at Test$.main(a.scala:18)
+// at Test.main(a.scala)
diff --git a/test/files/pos/pattern-typing.scala b/test/pending/pos/pattern-typing.scala
index 7286cc38af..7286cc38af 100644
--- a/test/files/pos/pattern-typing.scala
+++ b/test/pending/pos/pattern-typing.scala
diff --git a/test/files/pos/t1786.scala b/test/pending/pos/t1786.scala
index 32d6c06f6e..6299eb9eae 100644
--- a/test/files/pos/t1786.scala
+++ b/test/pending/pos/t1786.scala
@@ -1,3 +1,11 @@
+/** This a consequence of the current type checking algorithm, where bounds are checked only after variables are instantiated.
+ * I believe this will change once we go to contraint-based type inference.
+ * Alternatively, we can pursue a more extensive fix to SI-6169
+ *
+ * The below code shows a compiler flaw in that the wildcard "_" as value for a bounded type parameter either
+ * breaks the boundary - as it result in Any - or doesn't evaluate to the boundary (as I'd hoped it to be).
+*/
+
class SomeClass(val intValue:Int)
class MyClass[T <: SomeClass](val myValue:T)
class Flooz[A >: Null <: SomeClass, T >: Null <: A](var value: T)
diff --git a/test/files/pos/t5459.scala b/test/pending/pos/t5459.scala
index 971e6f896d..971e6f896d 100644
--- a/test/files/pos/t5459.scala
+++ b/test/pending/pos/t5459.scala
diff --git a/test/support/java-tests.txt b/test/support/java-tests.txt
new file mode 100644
index 0000000000..e0a3fddab3
--- /dev/null
+++ b/test/support/java-tests.txt
@@ -0,0 +1,97 @@
+test/files/buildmanager/t2280
+test/files/buildmanager/t3045
+test/files/buildmanager/t3133
+test/files/jvm/deprecation
+test/files/jvm/t1143-2
+test/files/jvm/t1342
+test/files/jvm/t1464
+test/files/jvm/t2470
+test/files/jvm/t2570
+test/files/jvm/t2585
+test/files/jvm/t3003
+test/files/jvm/t3415
+test/files/jvm/ticket2163
+test/files/jvm/ticket4283
+test/files/jvm/varargs
+test/files/neg/abstract-class-error
+test/files/neg/java-access-neg
+test/files/neg/primitive-sigs-1
+test/files/neg/protected-static-fail
+test/files/neg/t0673
+test/files/neg/t1548
+test/files/neg/t3663
+test/files/neg/t3757
+test/files/neg/t4851
+test/files/pos/chang
+test/files/pos/ilya
+test/files/pos/ilya2
+test/files/pos/java-access-pos
+test/files/pos/javaReadsSigs
+test/files/pos/protected-static
+test/files/pos/raw-map
+test/files/pos/signatures
+test/files/pos/super
+test/files/pos/t0288
+test/files/pos/t0695
+test/files/pos/t1101
+test/files/pos/t1102
+test/files/pos/t1150
+test/files/pos/t1152
+test/files/pos/t1176
+test/files/pos/t1186
+test/files/pos/t1196
+test/files/pos/t1197
+test/files/pos/t1203
+test/files/pos/t1230
+test/files/pos/t1231
+test/files/pos/t1232
+test/files/pos/t1235
+test/files/pos/t1254
+test/files/pos/t1263
+test/files/pos/t1409
+test/files/pos/t1459
+test/files/pos/t1642
+test/files/pos/t1711
+test/files/pos/t1745
+test/files/pos/t1751
+test/files/pos/t1782
+test/files/pos/t1836
+test/files/pos/t1840
+test/files/pos/t1937
+test/files/pos/t2377
+test/files/pos/t2409
+test/files/pos/t2413
+test/files/pos/t2433
+test/files/pos/t2464
+test/files/pos/t2569
+test/files/pos/t2868
+test/files/pos/t294
+test/files/pos/t2940
+test/files/pos/t2956
+test/files/pos/t3249
+test/files/pos/t3349
+test/files/pos/t3404
+test/files/pos/t3429
+test/files/pos/t3486
+test/files/pos/t3521
+test/files/pos/t3567
+test/files/pos/t3622
+test/files/pos/t3642
+test/files/pos/t3938
+test/files/pos/t3946
+test/files/pos/t4402
+test/files/pos/t4603
+test/files/pos/t4737
+test/files/pos/t5644
+test/files/pos/t5703
+test/files/run/inner-parse
+test/files/run/t1430
+test/files/run/t2296a
+test/files/run/t2296b
+test/files/run/t3452a
+test/files/run/t3452b
+test/files/run/t3897
+test/files/run/t4119
+test/files/run/t4238
+test/files/run/t4317
+test/files/run/t4891