summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-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/name-lookup-stable.check11
-rw-r--r--test/files/neg/name-lookup-stable.scala20
-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/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/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/t7886.scala22
-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/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/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/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/pattern-typing.scala29
-rw-r--r--test/files/pos/t1786-counter.scala38
-rw-r--r--test/files/pos/t1786-cycle.scala57
-rw-r--r--test/files/pos/t1786.scala19
-rw-r--r--test/files/pos/t261-ab.scala9
-rw-r--r--test/files/pos/t261-ba.scala9
-rw-r--r--test/files/pos/t5459.scala48
-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/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/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/t8223.scala29
-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/ide-bug-1000531.check2
-rw-r--r--test/files/presentation/ping-pong.check2
-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/visibility.check3
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.check1
-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/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/t7475b.check2
-rw-r--r--test/files/run/t7475b.scala11
-rw-r--r--test/files/run/t7507.scala4
-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/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/t8280.check9
-rw-r--r--test/files/run/t8280.scala82
-rw-r--r--test/files/scalacheck/quasiquotes/PatternConstructionProps.scala6
-rw-r--r--test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala5
-rw-r--r--test/files/scalacheck/range.scala3
123 files changed, 1266 insertions, 312 deletions
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/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/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/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/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/t7886.scala b/test/files/neg/t7886.scala
deleted file mode 100644
index 55d80a0a43..0000000000
--- a/test/files/neg/t7886.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-trait Covariant[+A]
-trait Contra[-A] { def accept(p: A): Unit }
-trait Invariant[A] extends Covariant[A] with Contra[A]
-
-case class Unravel[A](m: Contra[A], msg: A)
-
-object Test extends Covariant[Any] {
- def g(m: Contra[Any]): Unit = m accept 5
- def f(x: Any): Unit = x match {
- case Unravel(m, msg) => g(m)
- case _ =>
- }
- def main(args: Array[String]) {
- f(Unravel[String](new Contra[String] { def accept(x: String) = x.length }, ""))
- }
-}
-// java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
-// at Test$$anon$1.accept(a.scala:18)
-// at Test$.g(a.scala:13)
-// at Test$.f(a.scala:15)
-// at Test$.main(a.scala:18)
-// at Test.main(a.scala)
diff --git a/test/files/neg/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/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/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/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/pattern-typing.scala b/test/files/pos/pattern-typing.scala
deleted file mode 100644
index 7286cc38af..0000000000
--- a/test/files/pos/pattern-typing.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-import scala.language.higherKinds
-
-trait Bound[B]
-
-package p1 {
- case class Sub[B <: Bound[B]](p: B)
- object Test {
- def g[A](x: Bound[A]) = ()
- def f(x: Any) = x match { case Sub(p) => g(p) }
- }
-}
-
-package p2 {
- trait Traversable[+A] { def head: A = ??? }
- trait Seq[+A] extends Traversable[A] { def length: Int = ??? }
-
- case class SubHK[B <: Bound[B], CC[X] <: Traversable[X]](xs: CC[B])
- class MyBound extends Bound[MyBound]
- class MySeq extends Seq[MyBound]
-
- object Test {
- def g[B](x: Bound[B]) = ()
-
- def f1(x: Any) = x match { case SubHK(xs) => xs }
- def f2[B <: Bound[B], CC[X] <: Traversable[X]](sub: SubHK[B, CC]): CC[B] = sub match { case SubHK(xs) => xs }
- def f3 = g(f1(SubHK(new MySeq)).head)
- def f4 = g(f2(SubHK(new MySeq)).head)
- }
-}
diff --git a/test/files/pos/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/t1786.scala b/test/files/pos/t1786.scala
deleted file mode 100644
index 32d6c06f6e..0000000000
--- a/test/files/pos/t1786.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-class SomeClass(val intValue:Int)
-class MyClass[T <: SomeClass](val myValue:T)
-class Flooz[A >: Null <: SomeClass, T >: Null <: A](var value: T)
-
-class A {
- def f1(i:MyClass[_]) = i.myValue.intValue
- def f2(i:MyClass[_ <: SomeClass]) = i.myValue.intValue
- // def f3[T](i: MyClass[T]) = i.myValue.intValue
- def f4[T <: SomeClass](i: MyClass[T]) = i.myValue.intValue
- // def f5[T >: Null](i: MyClass[T]) = i.myValue.intValue
- // def f6[T >: Null <: String](i: MyClass[T]) = i.myValue.intValue + i.myValue.charAt(0)
-
- // def g1[A, T](x: Flooz[A, T]) = { x.value = null ; x.value.intValue }
- def g2(x: Flooz[_, _]) = { x.value = null ; x.value.intValue }
-
- class MyClass2(x: MyClass[_]) { val p = x.myValue.intValue }
- // class MyClass3[T <: String](x: MyClass[T]) { val p = x.myValue.intValue + x.myValue.length }
- // class MyClass4[T >: Null](x: MyClass[T]) { val p = x.myValue.intValue }
-}
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/t5459.scala b/test/files/pos/t5459.scala
deleted file mode 100644
index 971e6f896d..0000000000
--- a/test/files/pos/t5459.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-trait A1
-trait A2
-trait A3
-trait L1 extends A1 with A2 with A3
-
-object Test {
- trait T1[-A <: A1]
- trait T2[-A >: L1]
- trait T3[ A <: A1]
- trait T4[ A >: L1]
- trait T5[+A <: A1]
- trait T6[+A >: L1]
-
- def f1(x: T1[_]) = x
- def f2(x: T2[_]) = x
- def f3(x: T3[_]) = x
- def f4(x: T4[_]) = x
- def f5(x: T5[_]) = x
- def f6(x: T6[_]) = x
- // a.scala:22: error: type arguments [Any] do not conform to trait T5's type parameter bounds [+A <: A1]
- // def f5(x: T5[_]) = x
- // ^
-
- def g1(x: T1[_ <: A1]) = x
- def g2(x: T2[_ >: L1]) = x
- def g3(x: T3[_ <: A1]) = x
- def g4(x: T4[_ >: L1]) = x
- def g5(x: T5[_ <: A1]) = x
- def g6(x: T6[_ >: L1]) = x
-
- def q1(x: T1[_ >: L1]) = x
- def q2(x: T2[_ <: A1]) = x
- def q3(x: T3[_ >: L1]) = x
- def q4(x: T4[_ <: A1]) = x
- def q5(x: T5[_ >: L1]) = x
- def q6(x: T6[_ <: A1]) = x
- // a.scala:41: error: type arguments [Any] do not conform to trait T5's type parameter bounds [+A <: A1]
- // def q5(x: T5[_ >: L1]) = x
- // ^
- // two errors found
-
- def h1(x: T1[_ >: L1 <: A1]) = x
- def h2(x: T2[_ >: L1 <: A1]) = x
- def h3(x: T3[_ >: L1 <: A1]) = x
- def h4(x: T4[_ >: L1 <: A1]) = x
- def h5(x: T5[_ >: L1 <: A1]) = x
- def h6(x: T6[_ >: L1 <: A1]) = x
-}
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/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/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/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/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/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check
index ef8a1d12de..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 118 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]
diff --git a/test/files/presentation/ping-pong.check b/test/files/presentation/ping-pong.check
index ab4cfc9e7a..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 33 members
+retrieved 32 members
[inaccessible] private[this] val ping: Ping
[inaccessible] protected[package lang] def clone(): Object
[inaccessible] protected[package lang] def finalize(): Unit
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/visibility.check b/test/files/presentation/visibility.check
index 1ae1213f2d..b77887f8f7 100644
--- a/test/files/presentation/visibility.check
+++ b/test/files/presentation/visibility.check
@@ -79,8 +79,7 @@ protected[package lang] def finalize(): Unit
askTypeCompletion at Completions.scala(22,11)
================================================================================
[response] askTypeCompletion at (22,11)
-retrieved 35 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
diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check
index 037ba33d21..b153ae0470 100644
--- a/test/files/run/reflection-magicsymbols-invoke.check
+++ b/test/files/run/reflection-magicsymbols-invoke.check
@@ -80,7 +80,6 @@ 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 ##: ()Int
method $asInstanceOf: [T0]()T0
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/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/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/t7711-script-args.check b/test/files/run/t7711-script-args.check
new file mode 100644
index 0000000000..d107590a8a
--- /dev/null
+++ b/test/files/run/t7711-script-args.check
@@ -0,0 +1,2 @@
+Hello, scripted test!
+What good news have you for me today?
diff --git a/test/files/run/t7711-script-args.scala b/test/files/run/t7711-script-args.scala
new file mode 100644
index 0000000000..02535aa954
--- /dev/null
+++ b/test/files/run/t7711-script-args.scala
@@ -0,0 +1,7 @@
+
+import scala.tools.partest.ScriptTest
+
+object Test extends ScriptTest {
+ override def extraSettings = s"${super.extraSettings} -Xlint"
+ override def argv = Seq("good", "news")
+}
diff --git a/test/files/run/t7711-script-args.script b/test/files/run/t7711-script-args.script
new file mode 100644
index 0000000000..19b7a74924
--- /dev/null
+++ b/test/files/run/t7711-script-args.script
@@ -0,0 +1,12 @@
+#!/bin/bash
+exec ${SCALA_HOME}/bin/scala "$0" "$@" 2>&1
+!#
+
+Console println s"Hello, scripted test!"
+Console println s"What ${args mkString " "} have you for me today?"
+
+//def unused = 88
+//newSource1.scala:8: warning: private method in <$anon: AnyRef> is never used
+//Console println s"Hello, $argv, are you still here?"
+//newSource1.scala:9: error: not found: value argv
+
diff --git a/test/files/run/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/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/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/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 }