summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-06-03 22:15:32 -0700
committerPaul Phillips <paulp@improving.org>2013-06-04 08:12:05 -0700
commit767a25fe2178b00f494d55bdaae53535cd7fb57d (patch)
tree1bae0553a051f6a8805391db9e75858fd297f3b6 /test/files
parentfb06073844f388ec4c007b4c08e7d508fc88d5ab (diff)
parente317d0bcc9fa8f2a2e6d93c4ad5edf5326f5a617 (diff)
downloadscala-767a25fe2178b00f494d55bdaae53535cd7fb57d.tar.gz
scala-767a25fe2178b00f494d55bdaae53535cd7fb57d.tar.bz2
scala-767a25fe2178b00f494d55bdaae53535cd7fb57d.zip
Merge branch 'pr/merge-2.10.2' into master
* pr/merge-2.10.2: SI-7375 ClassTag for value class aliases SI-7507 Fix lookup of private[this] member in presence of self type. SI-7532 Fix regression in Java inner classfile reader SI-7517 Fix higher kinded type inference regression SI-7516 Revert "SI-7234 Make named args play nice w. depmet types" A test case for a recent LUB progression. SI-7421 remove unneeded extra-attachement in maven deploy SI-7486 Regressions in implicit search. SI-7509 Avoid crasher as erronous args flow through NamesDefaults SI-6138 Centralize and refine detection of `getClass` calls SI-7497 Fix scala.util.Properties.isMac SI-7473 Bad for expr crashes postfix Increase build.number to 2.10.3 SI-7391 Always use ForkJoin in Scala actors on ... ... Java 6 and above (except when the porperty actors.enableForkJoin says otherwise) Reimplementing much of the DefaultPromise methods Optimizations: 1) Avoiding to call 'synchronized' in tryComplete and in tryAwait 2) Implementing blocking by using an optimized latch so no blocking ops for non-blockers 3) Reducing method size of isCompleted to be cheaper to inline 4) 'result' to use Try.get instead of patmat c.typeCheck(silent = true) now suppresses ambiguous errors Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/reflect/macros/contexts/Typers.scala src/compiler/scala/reflect/reify/package.scala src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/library/scala/concurrent/impl/Promise.scala src/reflect/scala/reflect/internal/Types.scala
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/t6138.check7
-rw-r--r--test/files/neg/t6138.scala5
-rw-r--r--test/files/neg/t7441.check6
-rw-r--r--test/files/neg/t7441.scala7
-rw-r--r--test/files/neg/t7473.check7
-rw-r--r--test/files/neg/t7473.scala7
-rw-r--r--test/files/neg/t7507.check4
-rw-r--r--test/files/neg/t7507.scala7
-rw-r--r--test/files/neg/t7509.check12
-rw-r--r--test/files/neg/t7509.scala4
-rw-r--r--test/files/pos/lub-dealias-widen.scala34
-rw-r--r--test/files/pos/t7234.scala15
-rw-r--r--test/files/pos/t7234b.scala20
-rw-r--r--test/files/pos/t7486.scala8
-rw-r--r--test/files/pos/t7516/A_1.scala9
-rw-r--r--test/files/pos/t7516/B_2.scala4
-rw-r--r--test/files/pos/t7517.scala22
-rw-r--r--test/files/pos/t7532/A_1.java6
-rw-r--r--test/files/pos/t7532/B_2.scala5
-rw-r--r--test/files/pos/t7532b/A_1.scala7
-rw-r--r--test/files/pos/t7532b/B_2.scala8
-rw-r--r--test/files/run/t7375a.check4
-rw-r--r--test/files/run/t7375a.scala16
-rw-r--r--test/files/run/t7375b.check4
-rw-r--r--test/files/run/t7375b/Macros_1.scala18
-rw-r--r--test/files/run/t7375b/Test_2.scala3
-rw-r--r--test/files/run/t7507.scala31
27 files changed, 224 insertions, 56 deletions
diff --git a/test/files/neg/t6138.check b/test/files/neg/t6138.check
new file mode 100644
index 0000000000..8fd9978248
--- /dev/null
+++ b/test/files/neg/t6138.check
@@ -0,0 +1,7 @@
+t6138.scala:4: error: ambiguous reference to overloaded definition,
+both method getClass in object definitions of type (s: Int)Any
+and method getClass in object definitions of type (s: String)Any
+match argument types (Nothing)
+ getClass(???): String
+ ^
+one error found
diff --git a/test/files/neg/t6138.scala b/test/files/neg/t6138.scala
new file mode 100644
index 0000000000..2f45a46b1c
--- /dev/null
+++ b/test/files/neg/t6138.scala
@@ -0,0 +1,5 @@
+object definitions {
+ def getClass(s: String): Any = ???
+ def getClass(s: Int): Any = ???
+ getClass(???): String
+}
diff --git a/test/files/neg/t7441.check b/test/files/neg/t7441.check
deleted file mode 100644
index f259457197..0000000000
--- a/test/files/neg/t7441.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t7441.scala:4: error: type mismatch;
- found : Int(1)
- required: List[Any]
- def test = apply(1)
- ^
-one error found
diff --git a/test/files/neg/t7441.scala b/test/files/neg/t7441.scala
deleted file mode 100644
index dad7421e3f..0000000000
--- a/test/files/neg/t7441.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-object Test {
- object Bar {
- def apply(xs: List[Any]): Int = 0
- def test = apply(1)
- }
- implicit def foo = 1
-}
diff --git a/test/files/neg/t7473.check b/test/files/neg/t7473.check
new file mode 100644
index 0000000000..bc8c29d463
--- /dev/null
+++ b/test/files/neg/t7473.check
@@ -0,0 +1,7 @@
+t7473.scala:6: error: '<-' expected but '=' found.
+ (for (x = Option(i); if x == j) yield 42) toList
+ ^
+t7473.scala:6: error: illegal start of simple expression
+ (for (x = Option(i); if x == j) yield 42) toList
+ ^
+two errors found
diff --git a/test/files/neg/t7473.scala b/test/files/neg/t7473.scala
new file mode 100644
index 0000000000..593231d5f2
--- /dev/null
+++ b/test/files/neg/t7473.scala
@@ -0,0 +1,7 @@
+
+object Foo {
+ val i,j = 3
+ //for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found.
+ // evil postfix!
+ (for (x = Option(i); if x == j) yield 42) toList
+}
diff --git a/test/files/neg/t7507.check b/test/files/neg/t7507.check
new file mode 100644
index 0000000000..d402869fd4
--- /dev/null
+++ b/test/files/neg/t7507.check
@@ -0,0 +1,4 @@
+t7507.scala:6: error: value bippy in trait Cake cannot be accessed in Cake
+ locally(bippy)
+ ^
+one error found
diff --git a/test/files/neg/t7507.scala b/test/files/neg/t7507.scala
new file mode 100644
index 0000000000..1b4756d955
--- /dev/null
+++ b/test/files/neg/t7507.scala
@@ -0,0 +1,7 @@
+trait Cake extends Slice {
+ private[this] val bippy = ()
+}
+
+trait Slice { self: Cake =>
+ locally(bippy)
+}
diff --git a/test/files/neg/t7509.check b/test/files/neg/t7509.check
new file mode 100644
index 0000000000..eaa6303cf5
--- /dev/null
+++ b/test/files/neg/t7509.check
@@ -0,0 +1,12 @@
+t7509.scala:3: error: inferred type arguments [Int] do not conform to method crash's type parameter bounds [R <: AnyRef]
+ crash(42)
+ ^
+t7509.scala:3: error: type mismatch;
+ found : Int(42)
+ required: R
+ crash(42)
+ ^
+t7509.scala:3: error: could not find implicit value for parameter ev: R
+ crash(42)
+ ^
+three errors found
diff --git a/test/files/neg/t7509.scala b/test/files/neg/t7509.scala
new file mode 100644
index 0000000000..3cba801ea7
--- /dev/null
+++ b/test/files/neg/t7509.scala
@@ -0,0 +1,4 @@
+object NMWE {
+ def crash[R <: AnyRef](f: R)(implicit ev: R): Any = ???
+ crash(42)
+}
diff --git a/test/files/pos/lub-dealias-widen.scala b/test/files/pos/lub-dealias-widen.scala
new file mode 100644
index 0000000000..38854fbc5c
--- /dev/null
+++ b/test/files/pos/lub-dealias-widen.scala
@@ -0,0 +1,34 @@
+import scala.language.higherKinds
+
+sealed trait Path {
+ type EncodeFunc
+ type Route[R] = List[String] => R
+
+ def >>(f: Route[Int]): Sitelet[EncodeFunc] = ???
+}
+
+case object PAny extends Path {
+ type EncodeFunc = List[String] => String
+}
+
+case class PLit[Next <: Path]() extends Path {
+ type EncodeFunc = Next#EncodeFunc
+}
+
+trait Sitelet[EncodeFunc] { self =>
+ def &[G <: H, H >: EncodeFunc](that: Sitelet[G]): Sitelet[H] = ???
+}
+
+object Test {
+ val r: Sitelet[Int => (Int => String)] = ???
+
+ val p2: PLit[PAny.type] = ???
+ val r2 /*: Sitelet[List[String] => String] */ // annotate type and it compiles with 2.10.0
+ = p2 >> { (xs: List[String]) => 0 }
+
+ // This works after https://github.com/scala/scala/commit/a06d31f6a
+ // Before: error: inferred type arguments [List[String] => String,List[String] => String]
+ // do not conform to method &'s type parameter bounds
+ // [G <: H,H >: Int => (Int => String)]
+ val s = r & r2
+} \ No newline at end of file
diff --git a/test/files/pos/t7234.scala b/test/files/pos/t7234.scala
deleted file mode 100644
index 59a233d835..0000000000
--- a/test/files/pos/t7234.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-trait Main {
- trait A {
- type B
- }
- trait C {
- def c(a: A, x: Int = 0)(b: a.B)
- }
- def c: C
- def d(a: A, x: Int = 0)(b: a.B)
-
- def ok1(a: A)(b: a.B) = c.c(a, 42)(b)
- def ok2(a: A)(b: a.B) = d(a)(b)
-
- def fail(a: A)(b: a.B) = c.c(a)(b)
-}
diff --git a/test/files/pos/t7234b.scala b/test/files/pos/t7234b.scala
deleted file mode 100644
index fee98e87a8..0000000000
--- a/test/files/pos/t7234b.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-trait Main {
- trait A {
- type B
- def b: B
- }
- trait C {
- def c(a: A, x: Int = 0)(b: => a.B, bs: a.B*)
- def d(a: A = null, x: Int = 0)(b1: => a.B = a.b, b2: a.B = a.b)
- }
- def c: C
- def ok(a: A)(b: a.B) = c.c(a, 42)(b)
- def fail(a: A)(b: a.B) = c.c(a)(b)
- def fail2(a: A)(b: a.B) = c.c(a)(b, b)
- def fail3(a: A)(b: a.B) = c.c(a)(b, Seq[a.B](b): _*)
-
- def fail4(a: A)(b: a.B) = c.d(a)()
- def fail5(a: A)(b: a.B) = c.d(a)(b1 = a.b)
- def fail6(a: A)(b: a.B) = c.d(a)(b2 = a.b)
- def fail7(a: A)(b: a.B) = c.d()()
-}
diff --git a/test/files/pos/t7486.scala b/test/files/pos/t7486.scala
deleted file mode 100644
index 6dd7f4c4ac..0000000000
--- a/test/files/pos/t7486.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-object Test{
- var locker = 0
- // remove implicit, or change to `locker = locker + 1` to make it compile.
- implicit val davyJones0 = {
- locker += 0
- 0
- }
-}
diff --git a/test/files/pos/t7516/A_1.scala b/test/files/pos/t7516/A_1.scala
new file mode 100644
index 0000000000..3bba19966d
--- /dev/null
+++ b/test/files/pos/t7516/A_1.scala
@@ -0,0 +1,9 @@
+import scala.reflect._,macros._, scala.language.experimental.macros
+
+object A {
+ def impl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = {
+ val r = c.universe.reify { List(t.splice) }
+ c.Expr[List[T]]( c.resetLocalAttrs(r.tree) )
+ }
+ def demo[T](t: T): List[T] = macro impl[T]
+}
diff --git a/test/files/pos/t7516/B_2.scala b/test/files/pos/t7516/B_2.scala
new file mode 100644
index 0000000000..1b8531bc85
--- /dev/null
+++ b/test/files/pos/t7516/B_2.scala
@@ -0,0 +1,4 @@
+object B {
+ final case class CV(p: Int = 3, g: Int = 2)
+ A.demo { val d = 4; CV(g = d); "a" }
+}
diff --git a/test/files/pos/t7517.scala b/test/files/pos/t7517.scala
new file mode 100644
index 0000000000..7ce4c6b13e
--- /dev/null
+++ b/test/files/pos/t7517.scala
@@ -0,0 +1,22 @@
+trait Box[ K[A[x]] ]
+
+object Box {
+ // type constructor composition
+ sealed trait ∙[A[_], B[_]] { type l[T] = A[B[T]] }
+
+ // composes type constructors inside K
+ type SplitBox[K[A[x]], B[x]] = Box[ ({ type l[A[x]] = K[ (A ∙ B)#l] })#l ]
+
+ def split[ K[A[x]], B[x] ](base: Box[K]): SplitBox[K,B] = ???
+
+ class Composed[B[_], L[A[x]] ] {
+ val box: Box[L] = ???
+
+ type Split[ A[x] ] = L[ (A ∙ B)#l ]
+ val a: Box[Split] = Box.split(box)
+
+ //Either of these work:
+ val a1: Box[Split] = Box.split[L,B](box)
+ val a2: Box[ ({ type l[A[x]] = L[ (A ∙ B)#l ] })#l ] = Box.split(box)
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t7532/A_1.java b/test/files/pos/t7532/A_1.java
new file mode 100644
index 0000000000..1ade76cc70
--- /dev/null
+++ b/test/files/pos/t7532/A_1.java
@@ -0,0 +1,6 @@
+class R {
+ public class attr { // Will have the bytecode name `R$attr`, not to be confused with `R@tr`!
+ }
+ public static class attr1 {
+ }
+}
diff --git a/test/files/pos/t7532/B_2.scala b/test/files/pos/t7532/B_2.scala
new file mode 100644
index 0000000000..ee7ce7751f
--- /dev/null
+++ b/test/files/pos/t7532/B_2.scala
@@ -0,0 +1,5 @@
+object Test {
+ val r = new R
+ new r.attr() // Was: error while loading attr, class file '.../t7532-pos.obj/R$attr.class' has location not matching its contents: contains class
+ new R.attr1
+} \ No newline at end of file
diff --git a/test/files/pos/t7532b/A_1.scala b/test/files/pos/t7532b/A_1.scala
new file mode 100644
index 0000000000..e8f9540609
--- /dev/null
+++ b/test/files/pos/t7532b/A_1.scala
@@ -0,0 +1,7 @@
+package pack
+class R {
+ class attr // Will have the bytecode name `R$attr`, not to be confused with `R@tr`!
+ class `@`
+}
+
+class `@` \ No newline at end of file
diff --git a/test/files/pos/t7532b/B_2.scala b/test/files/pos/t7532b/B_2.scala
new file mode 100644
index 0000000000..1555a5daa7
--- /dev/null
+++ b/test/files/pos/t7532b/B_2.scala
@@ -0,0 +1,8 @@
+import pack._
+
+object Test {
+ val r = new R
+ new r.attr()
+ new r.`@`
+ new `@`
+} \ No newline at end of file
diff --git a/test/files/run/t7375a.check b/test/files/run/t7375a.check
new file mode 100644
index 0000000000..a0a15dfb2f
--- /dev/null
+++ b/test/files/run/t7375a.check
@@ -0,0 +1,4 @@
+C1
+C2
+C1
+C2
diff --git a/test/files/run/t7375a.scala b/test/files/run/t7375a.scala
new file mode 100644
index 0000000000..e46ad08f63
--- /dev/null
+++ b/test/files/run/t7375a.scala
@@ -0,0 +1,16 @@
+import scala.reflect.ClassTag
+
+class C1(val n: Int) extends AnyVal
+class C2(val n: Int) extends AnyRef
+
+object Test {
+ type F1 = C1
+ type F2 = C2
+
+ def main(args: Array[String]): Unit = {
+ println(implicitly[ClassTag[C1]])
+ println(implicitly[ClassTag[C2]])
+ println(implicitly[ClassTag[F1]])
+ println(implicitly[ClassTag[F2]])
+ }
+}
diff --git a/test/files/run/t7375b.check b/test/files/run/t7375b.check
new file mode 100644
index 0000000000..d7578e28ba
--- /dev/null
+++ b/test/files/run/t7375b.check
@@ -0,0 +1,4 @@
+Predef.this.classOf[C1]
+Predef.this.classOf[C2]
+Predef.this.classOf[C1]
+Predef.this.classOf[C2]
diff --git a/test/files/run/t7375b/Macros_1.scala b/test/files/run/t7375b/Macros_1.scala
new file mode 100644
index 0000000000..70e79cc2b4
--- /dev/null
+++ b/test/files/run/t7375b/Macros_1.scala
@@ -0,0 +1,18 @@
+import language.experimental.macros
+import scala.reflect.macros.Context
+
+class C1(val n: Int) extends AnyVal
+class C2(val n: Int) extends AnyRef
+
+object Macros {
+ type F1 = C1
+ type F2 = C2
+
+ def foo = macro impl
+ def impl(c: Context) = {
+ import c.universe._
+ def test[T: c.TypeTag] = reify(println(c.literal(c.reifyRuntimeClass(c.typeOf[T]).toString).splice)).tree
+ def tests = Block(List(test[C1], test[C2], test[F1], test[F2]), Literal(Constant(())))
+ c.Expr[Unit](tests)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t7375b/Test_2.scala b/test/files/run/t7375b/Test_2.scala
new file mode 100644
index 0000000000..acfddae942
--- /dev/null
+++ b/test/files/run/t7375b/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.foo
+} \ No newline at end of file
diff --git a/test/files/run/t7507.scala b/test/files/run/t7507.scala
new file mode 100644
index 0000000000..6c1959ddac
--- /dev/null
+++ b/test/files/run/t7507.scala
@@ -0,0 +1,31 @@
+trait Cake extends Slice
+
+// Minimization
+trait Slice { self: Cake => // must have self type that extends `Slice`
+ private[this] val bippy = () // must be private[this]
+ locally(bippy)
+}
+
+// Originally reported bug:
+trait Cake1 extends Slice1
+trait Slice1 { self: Cake1 =>
+ import java.lang.String // any import will do!
+ val Tuple2(x, y) = ((1, 2))
+}
+
+
+// Nesting
+trait Cake3 extends Outer.Slice3
+
+// Minimization
+object Outer {
+ private[this] val bippy = ()
+ trait Slice3 { self: Cake3 =>
+ locally(bippy)
+ }
+}
+
+object Test extends App {
+ val s1 = new Cake1 {}
+ assert((s1.x, s1.y) == (1, 2), (s1.x, s1.y))
+}