diff options
Diffstat (limited to 'test/files')
131 files changed, 1038 insertions, 609 deletions
diff --git a/test/files/continuations-neg/ts-1681-nontail-return.check b/test/files/continuations-neg/ts-1681-nontail-return.check deleted file mode 100644 index 8fe15f154b..0000000000 --- a/test/files/continuations-neg/ts-1681-nontail-return.check +++ /dev/null @@ -1,4 +0,0 @@ -ts-1681-nontail-return.scala:10: error: return expressions in CPS code must be in tail position - return v - ^ -one error found diff --git a/test/files/continuations-neg/ts-1681-nontail-return.scala b/test/files/continuations-neg/ts-1681-nontail-return.scala deleted file mode 100644 index af86ad304f..0000000000 --- a/test/files/continuations-neg/ts-1681-nontail-return.scala +++ /dev/null @@ -1,18 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } - def caller = reset { println(p(3)) } - - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - if (v == 8) - return v - v + 1 - } -} - -object Test extends App { - val repro = new ReturnRepro - repro.caller -} diff --git a/test/files/continuations-run/ts-1681-2.check b/test/files/continuations-run/ts-1681-2.check deleted file mode 100644 index 35b3c93780..0000000000 --- a/test/files/continuations-run/ts-1681-2.check +++ /dev/null @@ -1,5 +0,0 @@ -8 -hi -8 -from try -8 diff --git a/test/files/continuations-run/ts-1681-2.scala b/test/files/continuations-run/ts-1681-2.scala deleted file mode 100644 index 8a896dec2c..0000000000 --- a/test/files/continuations-run/ts-1681-2.scala +++ /dev/null @@ -1,44 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cps[Any] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - def caller3 = reset { println(p3(3)) } - - def p(i: Int): Int @cps[Any] = { - val v= s1 + 3 - return v - } - - def p2(i: Int): Int @cps[Any] = { - val v = s1 + 3 - if (v > 0) { - println("hi") - return v - } else { - println("hi") - return 8 - } - } - - def p3(i: Int): Int @cps[Any] = { - val v = s1 + 3 - try { - println("from try") - return v - } catch { - case e: Exception => - println("from catch") - return 7 - } - } - -} - -object Test extends App { - val repro = new ReturnRepro - repro.caller - repro.caller2 - repro.caller3 -} diff --git a/test/files/continuations-run/ts-1681-3.check b/test/files/continuations-run/ts-1681-3.check deleted file mode 100644 index 71489f097c..0000000000 --- a/test/files/continuations-run/ts-1681-3.check +++ /dev/null @@ -1,4 +0,0 @@ -enter return expr -8 -hi -8 diff --git a/test/files/continuations-run/ts-1681-3.scala b/test/files/continuations-run/ts-1681-3.scala deleted file mode 100644 index 62c547f5a2..0000000000 --- a/test/files/continuations-run/ts-1681-3.scala +++ /dev/null @@ -1,27 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - return { println("enter return expr"); v } - } - - def p2(i: Int): Int @cpsParam[Unit, Any] = { - val v = s1 + 3 - if (v > 0) { - return { println("hi"); v } - } else { - return { println("hi"); 8 } - } - } -} - -object Test extends App { - val repro = new ReturnRepro - repro.caller - repro.caller2 -} diff --git a/test/files/continuations-run/ts-1681.check b/test/files/continuations-run/ts-1681.check deleted file mode 100644 index 85176d8e66..0000000000 --- a/test/files/continuations-run/ts-1681.check +++ /dev/null @@ -1,3 +0,0 @@ -8 -hi -8 diff --git a/test/files/continuations-run/ts-1681.scala b/test/files/continuations-run/ts-1681.scala deleted file mode 100644 index efb1abae15..0000000000 --- a/test/files/continuations-run/ts-1681.scala +++ /dev/null @@ -1,29 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - return v - } - - def p2(i: Int): Int @cpsParam[Unit, Any] = { - val v = s1 + 3 - if (v > 0) { - println("hi") - return v - } else { - println("hi") - return 8 - } - } -} - -object Test extends App { - val repro = new ReturnRepro - repro.caller - repro.caller2 -} diff --git a/test/files/jvm/manifests-new.check b/test/files/jvm/manifests-new.check index 9ff49ef8b4..1c0bf6a568 100644 --- a/test/files/jvm/manifests-new.check +++ b/test/files/jvm/manifests-new.check @@ -1,58 +1,58 @@ -x=(), t=TypeTag[Unit], k=TypeRef, s=class Unit -x=true, t=TypeTag[Boolean], k=TypeRef, s=class Boolean -x=a, t=TypeTag[Char], k=TypeRef, s=class Char -x=1, t=TypeTag[Int], k=TypeRef, s=class Int -x=abc, t=TypeTag[java.lang.String], k=TypeRef, s=class String -x='abc, t=TypeTag[Symbol], k=TypeRef, s=class Symbol - -x=List(()), t=TypeTag[List[Unit]], k=TypeRef, s=class List -x=List(true), t=TypeTag[List[Boolean]], k=TypeRef, s=class List -x=List(1), t=TypeTag[List[Int]], k=TypeRef, s=class List -x=List(abc), t=TypeTag[List[java.lang.String]], k=TypeRef, s=class List -x=List('abc), t=TypeTag[List[Symbol]], k=TypeRef, s=class List - -x=[Z, t=TypeTag[Array[Boolean]], k=TypeRef, s=class Array -x=[C, t=TypeTag[Array[Char]], k=TypeRef, s=class Array -x=[I, t=TypeTag[Array[Int]], k=TypeRef, s=class Array -x=[Ljava.lang.String;, t=TypeTag[Array[java.lang.String]], k=TypeRef, s=class Array -x=[Lscala.Symbol;, t=TypeTag[Array[Symbol]], k=TypeRef, s=class Array - -x=((),()), t=TypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2 -x=(true,false), t=TypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2 -x=(1,2), t=TypeTag[(Int, Int)], k=TypeRef, s=class Tuple2 -x=(abc,xyz), t=TypeTag[(java.lang.String, java.lang.String)], k=TypeRef, s=class Tuple2 -x=('abc,'xyz), t=TypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2 - -x=Test$, t=TypeTag[Test.type], k=SingleType, s=object Test -x=scala.collection.immutable.List$, t=TypeTag[scala.collection.immutable.List.type], k=SingleType, s=object List - -x=Foo, t=TypeTag[Foo[Int]], k=TypeRef, s=class Foo -x=Foo, t=TypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo -x=Foo, t=TypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo -x=Foo, t=TypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo - -x=Test1$$anon$1, t=TypeTag[Bar[java.lang.String]], k=RefinedType, s=<local Test1> -x=Test1$$anon$2, t=TypeTag[Bar[java.lang.String]], k=RefinedType, s=<local Test1> - -()=() -true=true -a=a -1=1 -'abc='abc - -List(())=List(()) -List(true)=List(true) -List('abc)=List('abc) - -Array()=Array() -Array(true)=Array(true) -Array(a)=Array(a) -Array(1)=Array(1) - -((),())=((),()) -(true,false)=(true,false) - -List(List(1), List(2))=List(List(1), List(2)) - -Array(Array(1), Array(2))=Array(Array(1), Array(2)) - +x=(), t=TypeTag[Unit], k=TypeRef, s=class Unit
+x=true, t=TypeTag[Boolean], k=TypeRef, s=class Boolean
+x=a, t=TypeTag[Char], k=TypeRef, s=class Char
+x=1, t=TypeTag[Int], k=TypeRef, s=class Int
+x=abc, t=TypeTag[java.lang.String], k=TypeRef, s=class String
+x='abc, t=TypeTag[Symbol], k=TypeRef, s=class Symbol
+
+x=List(()), t=TypeTag[List[Unit]], k=TypeRef, s=class List
+x=List(true), t=TypeTag[List[Boolean]], k=TypeRef, s=class List
+x=List(1), t=TypeTag[List[Int]], k=TypeRef, s=class List
+x=List(abc), t=TypeTag[List[java.lang.String]], k=TypeRef, s=class List
+x=List('abc), t=TypeTag[List[Symbol]], k=TypeRef, s=class List
+
+x=[Z, t=TypeTag[Array[Boolean]], k=TypeRef, s=class Array
+x=[C, t=TypeTag[Array[Char]], k=TypeRef, s=class Array
+x=[I, t=TypeTag[Array[Int]], k=TypeRef, s=class Array
+x=[Ljava.lang.String;, t=TypeTag[Array[java.lang.String]], k=TypeRef, s=class Array
+x=[Lscala.Symbol;, t=TypeTag[Array[Symbol]], k=TypeRef, s=class Array
+
+x=((),()), t=TypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2
+x=(true,false), t=TypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2
+x=(1,2), t=TypeTag[(Int, Int)], k=TypeRef, s=class Tuple2
+x=(abc,xyz), t=TypeTag[(java.lang.String, java.lang.String)], k=TypeRef, s=class Tuple2
+x=('abc,'xyz), t=TypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2
+
+x=Test$, t=TypeTag[Test.type], k=SingleType, s=object Test
+x=scala.collection.immutable.List$, t=TypeTag[scala.collection.immutable.List.type], k=SingleType, s=object List
+
+x=Foo, t=TypeTag[Foo[Int]], k=TypeRef, s=class Foo
+x=Foo, t=TypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo
+x=Foo, t=TypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo
+x=Foo, t=TypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo
+
+x=Test1$$anon$1, t=TypeTag[Bar[String]], k=RefinedType, s=<local Test1>
+x=Test1$$anon$2, t=TypeTag[Bar[String]], k=RefinedType, s=<local Test1>
+
+()=()
+true=true
+a=a
+1=1
+'abc='abc
+
+List(())=List(())
+List(true)=List(true)
+List('abc)=List('abc)
+
+Array()=Array()
+Array(true)=Array(true)
+Array(a)=Array(a)
+Array(1)=Array(1)
+
+((),())=((),())
+(true,false)=(true,false)
+
+List(List(1), List(2))=List(List(1), List(2))
+
+Array(Array(1), Array(2))=Array(Array(1), Array(2))
+
diff --git a/test/files/neg/catch-all.check b/test/files/neg/catch-all.check index ab3d28777d..62f895cc7e 100644 --- a/test/files/neg/catch-all.check +++ b/test/files/neg/catch-all.check @@ -1,10 +1,10 @@ catch-all.scala:2: error: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning. - try { "warn" } catch { case _ => } - ^ + try { "warn" } catch { case _ => } + ^ catch-all.scala:4: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. - try { "warn" } catch { case x => } - ^ + try { "warn" } catch { case x => } + ^ catch-all.scala:6: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. - try { "warn" } catch { case _: RuntimeException => ; case x => } - ^ + try { "warn" } catch { case _: RuntimeException => ; case x => } + ^ three errors found diff --git a/test/files/neg/catch-all.scala b/test/files/neg/catch-all.scala index 35a6d7af91..c05be77044 100644 --- a/test/files/neg/catch-all.scala +++ b/test/files/neg/catch-all.scala @@ -1,19 +1,31 @@ object CatchAll { - try { "warn" } catch { case _ => } + try { "warn" } catch { case _ => } - try { "warn" } catch { case x => } + try { "warn" } catch { case x => } - try { "warn" } catch { case _: RuntimeException => ; case x => } + try { "warn" } catch { case _: RuntimeException => ; case x => } - try { "okay" } catch { case _: Throwable => } + val t = T - try { "okay" } catch { case _: Exception => } + try { "okay" } catch { case T => } - try { "okay" } catch { case okay: Throwable => } + try { "okay" } catch { case `t` => } - try { "okay" } catch { case okay: Exception => } + try { "okay" } catch { case x @ T => } - try { "okay" } catch { case _ if "".isEmpty => } + try { "okay" } catch { case x @ `t` => } - "okay" match { case _ => "" } + try { "okay" } catch { case _: Throwable => } + + try { "okay" } catch { case _: Exception => } + + try { "okay" } catch { case okay: Throwable => } + + try { "okay" } catch { case okay: Exception => } + + try { "okay" } catch { case _ if "".isEmpty => } + + "okay" match { case _ => "" } } + +object T extends Throwable diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check new file mode 100644 index 0000000000..841e893249 --- /dev/null +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -0,0 +1,61 @@ +classmanifests_new_deprecations.scala:2: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ def cm1[T: ClassManifest] = ???
+ ^
+classmanifests_new_deprecations.scala:3: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ def cm2[T](implicit evidence$1: ClassManifest[T]) = ???
+ ^
+classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ val cm3: ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ val cm3: ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:6: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ def rcm1[T: scala.reflect.ClassManifest] = ???
+ ^
+classmanifests_new_deprecations.scala:7: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ???
+ ^
+classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ val rcm3: scala.reflect.ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ val rcm3: scala.reflect.ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ type CM[T] = ClassManifest[T]
+ ^
+classmanifests_new_deprecations.scala:15: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ type RCM[T] = scala.reflect.ClassManifest[T]
+ ^
+classmanifests_new_deprecations.scala:20: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ def m1[T: Manifest] = ???
+ ^
+classmanifests_new_deprecations.scala:21: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ def m2[T](implicit evidence$1: Manifest[T]) = ???
+ ^
+classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ val m3: Manifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ val m3: Manifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:24: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ def rm1[T: scala.reflect.Manifest] = ???
+ ^
+classmanifests_new_deprecations.scala:25: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ???
+ ^
+classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ val rm3: scala.reflect.Manifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ val rm3: scala.reflect.Manifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:28: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ type M[T] = Manifest[T]
+ ^
+classmanifests_new_deprecations.scala:33: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ type RM[T] = scala.reflect.Manifest[T]
+ ^
+20 errors found
diff --git a/test/files/neg/classmanifests_new_deprecations.flags b/test/files/neg/classmanifests_new_deprecations.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/classmanifests_new_deprecations.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/classmanifests_new_deprecations.scala b/test/files/neg/classmanifests_new_deprecations.scala new file mode 100644 index 0000000000..563a0bc197 --- /dev/null +++ b/test/files/neg/classmanifests_new_deprecations.scala @@ -0,0 +1,37 @@ +object Test extends App { + def cm1[T: ClassManifest] = ??? + def cm2[T](implicit evidence$1: ClassManifest[T]) = ??? + val cm3: ClassManifest[Int] = null + + def rcm1[T: scala.reflect.ClassManifest] = ??? + def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ??? + val rcm3: scala.reflect.ClassManifest[Int] = null + + type CM[T] = ClassManifest[T] + def acm1[T: CM] = ??? + def acm2[T](implicit evidence$1: CM[T]) = ??? + val acm3: CM[Int] = null + + type RCM[T] = scala.reflect.ClassManifest[T] + def arcm1[T: RCM] = ??? + def arcm2[T](implicit evidence$1: RCM[T]) = ??? + val arcm3: RCM[Int] = null + + def m1[T: Manifest] = ??? + def m2[T](implicit evidence$1: Manifest[T]) = ??? + val m3: Manifest[Int] = null + + def rm1[T: scala.reflect.Manifest] = ??? + def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ??? + val rm3: scala.reflect.Manifest[Int] = null + + type M[T] = Manifest[T] + def am1[T: M] = ??? + def am2[T](implicit evidence$1: M[T]) = ??? + val am3: M[Int] = null + + type RM[T] = scala.reflect.Manifest[T] + def arm1[T: RM] = ??? + def arm2[T](implicit evidence$1: RM[T]) = ??? + val arm3: RM[Int] = null +}
\ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.check b/test/files/neg/interop_abstypetags_arenot_classmanifests.check index 3134aadb58..15bdcfc5b1 100644 --- a/test/files/neg/interop_abstypetags_arenot_classmanifests.check +++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.check @@ -1,4 +1,4 @@ -interop_abstypetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T]
+interop_abstypetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T.
println(classManifest[T])
^
one error found
diff --git a/test/files/neg/interop_typetags_arenot_classmanifests.check b/test/files/neg/interop_typetags_arenot_classmanifests.check index 403625b4da..b404f94d69 100644 --- a/test/files/neg/interop_typetags_arenot_classmanifests.check +++ b/test/files/neg/interop_typetags_arenot_classmanifests.check @@ -1,4 +1,4 @@ -interop_typetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T]
+interop_typetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T.
println(classManifest[T])
^
one error found
diff --git a/test/files/neg/macro-invalidret-nonuniversetree.check b/test/files/neg/macro-invalidret-nonuniversetree.check index 4fc06b5ceb..1b9487982f 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree.check +++ b/test/files/neg/macro-invalidret-nonuniversetree.check @@ -1,7 +1,7 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.makro.Context): c.Expr[Any]
- found : (c: scala.reflect.makro.Context): reflect.mirror.Literal
-type mismatch for return type: reflect.mirror.Literal does not conform to c.Expr[Any]
+ found : (c: scala.reflect.makro.Context): reflect.basis.Literal
+type mismatch for return type: reflect.basis.Literal does not conform to c.Expr[Any]
def foo = macro Impls.foo
^
one error found
diff --git a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala index 86b7c8d8d0..da0eb0ac83 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala +++ b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala @@ -1,5 +1,5 @@ import scala.reflect.makro.{Context => Ctx} object Impls { - def foo(c: Ctx) = scala.reflect.mirror.Literal(scala.reflect.mirror.Constant(42)) + def foo(c: Ctx) = scala.reflect.basis.Literal(scala.reflect.basis.Constant(42)) } diff --git a/test/files/neg/t2442.check b/test/files/neg/t2442.check new file mode 100644 index 0000000000..714816fd62 --- /dev/null +++ b/test/files/neg/t2442.check @@ -0,0 +1,9 @@ +t2442.scala:4: error: match may not be exhaustive. +It would fail on the following input: THREE + def f(e: MyEnum) = e match { + ^ +t2442.scala:11: error: match may not be exhaustive. +It would fail on the following input: BLUE + def g(e: MySecondEnum) = e match { + ^ +two errors found diff --git a/test/files/neg/t2442.flags b/test/files/neg/t2442.flags new file mode 100644 index 0000000000..32cf036c3d --- /dev/null +++ b/test/files/neg/t2442.flags @@ -0,0 +1 @@ +-Xexperimental -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t2442/MyEnum.java b/test/files/neg/t2442/MyEnum.java new file mode 100644 index 0000000000..3ffbbb31b8 --- /dev/null +++ b/test/files/neg/t2442/MyEnum.java @@ -0,0 +1,3 @@ +public enum MyEnum { + ONE, TWO, THREE; +}
\ No newline at end of file diff --git a/test/files/neg/t2442/MySecondEnum.java b/test/files/neg/t2442/MySecondEnum.java new file mode 100644 index 0000000000..0f841286de --- /dev/null +++ b/test/files/neg/t2442/MySecondEnum.java @@ -0,0 +1,6 @@ +public enum MySecondEnum { + RED(1), BLUE(2) { public void foo() {} }; + MySecondEnum(int i) {} + + public void foo() {} +}
\ No newline at end of file diff --git a/test/files/neg/t2442/t2442.scala b/test/files/neg/t2442/t2442.scala new file mode 100644 index 0000000000..b0a0f3cd41 --- /dev/null +++ b/test/files/neg/t2442/t2442.scala @@ -0,0 +1,15 @@ +class Test { + import MyEnum._ + + def f(e: MyEnum) = e match { + case ONE => println("one") + case TWO => println("two") + // missing case --> exhaustivity warning! + } + + import MySecondEnum._ + def g(e: MySecondEnum) = e match { + case RED => println("red") + // missing case --> exhaustivity warning! + } +}
\ No newline at end of file diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check index a97a7d31ec..92d71f7e4e 100644 --- a/test/files/neg/t3692-old.check +++ b/test/files/neg/t3692-old.check @@ -1,8 +1,11 @@ -t3692-old.scala:6: warning: object Manifest in package reflect is deprecated: Use TypeTag instead
- new ManifestTester().toJavaMap(map)
- ^
+t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
+ ^
+t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
+ private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
+ ^
t3692-old.scala:15: error: unreachable code
case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
^
-one warning found
+two warnings found
one error found
diff --git a/test/files/neg/t4541.check b/test/files/neg/t4541.check index c01226685f..7bd8ff78f9 100644 --- a/test/files/neg/t4541.check +++ b/test/files/neg/t4541.check @@ -1,7 +1,7 @@ -t4541.scala:11: error: scala.reflect.internal.Types$TypeError: variable data in class Sparse cannot be accessed in Sparse[Int] +t4541.scala:11: error: variable data in class Sparse cannot be accessed in Sparse[Int] Access to protected method data not permitted because prefix type Sparse[Int] does not conform to class Sparse$mcI$sp where the access take place that.data ^ -one error found
\ No newline at end of file +one error found diff --git a/test/files/neg/t4541b.check b/test/files/neg/t4541b.check index 54d9c3d1ee..8a52fd97f4 100644 --- a/test/files/neg/t4541b.check +++ b/test/files/neg/t4541b.check @@ -1,7 +1,7 @@ -t4541b.scala:13: error: scala.reflect.internal.Types$TypeError: variable data in class SparseArray cannot be accessed in SparseArray[Int] +t4541b.scala:13: error: variable data in class SparseArray cannot be accessed in SparseArray[Int] Access to protected method data not permitted because prefix type SparseArray[Int] does not conform to class SparseArray$mcI$sp where the access take place use(that.data.clone) ^ -one error found
\ No newline at end of file +one error found diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check new file mode 100644 index 0000000000..96eb1fd364 --- /dev/null +++ b/test/files/neg/t5148.check @@ -0,0 +1,2 @@ +error: bad reference while unpickling Imports.class: term memberHandlers not found in scala.tools.nsc.interpreter.IMain +one error found diff --git a/test/files/neg/t5148.scala b/test/files/neg/t5148.scala new file mode 100644 index 0000000000..fca64e57df --- /dev/null +++ b/test/files/neg/t5148.scala @@ -0,0 +1,4 @@ +package scala.tools.nsc +package interpreter + +class IMain extends Imports diff --git a/test/files/neg/t5839.check b/test/files/neg/t5839.check new file mode 100644 index 0000000000..d4b125bd1e --- /dev/null +++ b/test/files/neg/t5839.check @@ -0,0 +1,6 @@ +t5839.scala:5: error: type mismatch; + found : (x: String => String)Int <and> (x: Int)Int + required: Int => String + val x: String = goo(foo _) + ^ +one error found diff --git a/test/files/neg/t5839.scala b/test/files/neg/t5839.scala new file mode 100644 index 0000000000..d3a5d4b25f --- /dev/null +++ b/test/files/neg/t5839.scala @@ -0,0 +1,7 @@ +object Test { + def goo[T](x: Int => T): T = x(1) + implicit def f(x: Int): String = "" + def foo(x: Int): Int = x + 1 + val x: String = goo(foo _) + def foo(x: String => String) = 1 +} diff --git a/test/files/neg/t5969.check b/test/files/neg/t5969.check new file mode 100644 index 0000000000..9d8ac9a3a5 --- /dev/null +++ b/test/files/neg/t5969.check @@ -0,0 +1,7 @@ +t5969.scala:9: error: overloaded method value g with alternatives: + (x: C2)String <and> + (x: C1)String + cannot be applied to (String) + if (false) List(g(x)) else List[C1]() map g + ^ +one error found diff --git a/test/files/neg/t5969.scala b/test/files/neg/t5969.scala new file mode 100644 index 0000000000..62f87fd7ab --- /dev/null +++ b/test/files/neg/t5969.scala @@ -0,0 +1,11 @@ +class C1 +class C2 +class A { + def f(x: Any) = x + def g(x: C1): String = "A" + def g(x: C2): String = "B" + + def crash() = f(List[String]() flatMap { x => + if (false) List(g(x)) else List[C1]() map g + }) +} diff --git a/test/files/neg/t6013.check b/test/files/neg/t6013.check new file mode 100644 index 0000000000..502da999f5 --- /dev/null +++ b/test/files/neg/t6013.check @@ -0,0 +1,7 @@ +DerivedScala.scala:4: error: class C needs to be abstract, since there is a deferred declaration of method foo in class B of type => Int which is not implemented in a subclass +class C extends B + ^ +DerivedScala.scala:7: error: class DerivedScala needs to be abstract, since there is a deferred declaration of method foo in class Abstract of type ()Boolean which is not implemented in a subclass +class DerivedScala extends Abstract + ^ +two errors found diff --git a/test/files/neg/t6013/Abstract.java b/test/files/neg/t6013/Abstract.java new file mode 100644 index 0000000000..c0ef046bbd --- /dev/null +++ b/test/files/neg/t6013/Abstract.java @@ -0,0 +1,7 @@ +public abstract class Abstract extends Base { + // overrides Base#bar under the erasure model + public void bar(java.util.List<java.lang.Integer> foo) { return; } + + // must force re-implementation in derived classes + public abstract boolean foo(); +} diff --git a/test/files/neg/t6013/Base.java b/test/files/neg/t6013/Base.java new file mode 100644 index 0000000000..b73d7fd821 --- /dev/null +++ b/test/files/neg/t6013/Base.java @@ -0,0 +1,10 @@ +abstract public class Base { + // This must considered to be overridden by Abstract#foo based + // on the erased signatures. This special case is handled by + // `javaErasedOverridingSym` in `RefChecks`. + public abstract void bar(java.util.List<java.lang.String> foo) { return; } + + // But, a concrete method in a Java superclass must not excuse + // a deferred method in the Java subclass! + public boolean foo() { return true; } +} diff --git a/test/files/neg/t6013/DerivedScala.scala b/test/files/neg/t6013/DerivedScala.scala new file mode 100644 index 0000000000..fc0c55d398 --- /dev/null +++ b/test/files/neg/t6013/DerivedScala.scala @@ -0,0 +1,7 @@ +// Scala extending Scala (this case was working fine before this bug.) +class A { def foo: Int = 0 } +abstract class B extends A { def foo: Int } +class C extends B + +// Scala extending Java +class DerivedScala extends Abstract diff --git a/test/files/neg/t649.check b/test/files/neg/t649.check index a6670886b5..5a270d4751 100644 --- a/test/files/neg/t649.check +++ b/test/files/neg/t649.check @@ -1,4 +1,4 @@ t649.scala:3: error: overloaded method foo needs result type def foo[A] = foo[A] - ^ + ^ one error found diff --git a/test/files/pos/exponential-spec.scala b/test/files/pos/exponential-spec.scala new file mode 100644 index 0000000000..83aef58f7e --- /dev/null +++ b/test/files/pos/exponential-spec.scala @@ -0,0 +1,47 @@ +// a.scala +// Sat Jun 30 19:51:17 PDT 2012 + +trait Exp[T] + +object Test { + def f[T](exp: Exp[T]): Exp[T] = ( + f[T] _ + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] // 4s + compose f[T] // 5s + compose f[T] // 5s + compose f[T] // 6s + compose f[T] // 7s + compose f[T] // 8s + compose f[T] // 11s + compose f[T] // 17s + compose f[T] // 29s + compose f[T] // 54s + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + )(exp) +} diff --git a/test/files/pos/rangepos-anonapply.flags b/test/files/pos/rangepos-anonapply.flags new file mode 100644 index 0000000000..281f0a10cd --- /dev/null +++ b/test/files/pos/rangepos-anonapply.flags @@ -0,0 +1 @@ +-Yrangepos diff --git a/test/files/pos/rangepos-anonapply.scala b/test/files/pos/rangepos-anonapply.scala new file mode 100644 index 0000000000..2f3e4ad6cd --- /dev/null +++ b/test/files/pos/rangepos-anonapply.scala @@ -0,0 +1,9 @@ +class Test { + trait PropTraverser { + def apply(x: Int): Unit = {} + } + + def gather(x: Int) { + (new PropTraverser {})(x) + } +} diff --git a/test/files/pos/t4176b.scala b/test/files/pos/t4176b.scala new file mode 100644 index 0000000000..11914c50c8 --- /dev/null +++ b/test/files/pos/t4176b.scala @@ -0,0 +1,5 @@ +object Test { + def foo(a: String*) = a + val fooEta = foo _ + (foo: Seq[String] => Seq[String]) +} diff --git a/test/files/pos/t5846.scala b/test/files/pos/t5846.scala new file mode 100644 index 0000000000..b06f5ac39c --- /dev/null +++ b/test/files/pos/t5846.scala @@ -0,0 +1,10 @@ + + + + +/** Return the most general sorted map type. */ +object Test extends App { + + val empty: collection.SortedMap[String, String] = collection.SortedMap.empty[String, String] + +} diff --git a/test/files/pos/t5899.flags b/test/files/pos/t5899.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t5899.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t5899.scala b/test/files/pos/t5899.scala new file mode 100644 index 0000000000..b16f1f84fe --- /dev/null +++ b/test/files/pos/t5899.scala @@ -0,0 +1,19 @@ +import scala.tools.nsc._ + +trait Foo { + val global: Global + import global.{Name, Symbol, nme} + + case class Bippy(name: Name) + + def f(x: Bippy, sym: Symbol): Int = { + // no warning (!) for + // val Stable = sym.name.toTermName + + val Stable = sym.name + Bippy(Stable) match { + case Bippy(nme.WILDCARD) => 1 + case Bippy(Stable) => 2 // should not be considered unreachable + } + } +}
\ No newline at end of file diff --git a/test/files/pos/t5932.flags b/test/files/pos/t5932.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t5932.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t5932.scala b/test/files/pos/t5932.scala new file mode 100644 index 0000000000..d824523d5b --- /dev/null +++ b/test/files/pos/t5932.scala @@ -0,0 +1,15 @@ +class A + +case object B extends A + +object Test { + val x1 = (B: A) + + println(x1 == B) // no warning + println(B == x1) // no warning + + val x2 = (B: A with Product) + + println(x2 == B) // no warning + println(B == x2) // spurious warning: "always returns false" +} diff --git a/test/files/pos/t5953.scala b/test/files/pos/t5953.scala index 90e7d84646..7ba035ec3b 100644 --- a/test/files/pos/t5953.scala +++ b/test/files/pos/t5953.scala @@ -10,7 +10,7 @@ package object foo { package foo { object Test { - def f1[T](xs: Traversable[T]) = xs.convertTo[immutable.Vector] + def f1[T](xs: Traversable[T]) = xs.to[immutable.Vector] def f2[T](xs: Traversable[T]) = xs.build[immutable.Vector] } } diff --git a/test/files/pos/t5967.scala b/test/files/pos/t5967.scala new file mode 100644 index 0000000000..eb9bd6dfa7 --- /dev/null +++ b/test/files/pos/t5967.scala @@ -0,0 +1,6 @@ +object Test { + def f(a: Int*) = a match { + case 0 :: Nil => "List(0)! My favorite Seq!" + case _ => a.toString + } +} diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index 9d4674d7c7..4be98a6b21 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -25,7 +25,6 @@ retrieved 126 members [accessible: true] `method collectFirst[B](pf: PartialFunction[B,B])Option[B]` [accessible: true] `method collect[B](pf: PartialFunction[B,B])Iterator[B]` [accessible: true] `method contains(elem: Any)Boolean` -[accessible: true] `method convertTo[Col[_]](implicit cbf: scala.collection.generic.CanBuildFrom[Nothing,B,Col[B]])Col[B]` [accessible: true] `method copyToArray[B >: B](xs: Array[B])Unit` [accessible: true] `method copyToArray[B >: B](xs: Array[B], start: Int)Unit` [accessible: true] `method copyToArray[B >: B](xs: Array[B], start: Int, len: Int)Unit` @@ -111,6 +110,7 @@ retrieved 126 members [accessible: true] `method toString()String` [accessible: true] `method toTraversable=> Traversable[B]` [accessible: true] `method toVector=> Vector[B]` +[accessible: true] `method to[Col[_]](implicit cbf: scala.collection.generic.CanBuildFrom[Nothing,B,Col[B]])Col[B]` [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` diff --git a/test/files/res/t5489.check b/test/files/res/t5489.check new file mode 100644 index 0000000000..6cf64f734b --- /dev/null +++ b/test/files/res/t5489.check @@ -0,0 +1,4 @@ + +nsc> +nsc> +nsc> diff --git a/test/files/res/t5489.res b/test/files/res/t5489.res new file mode 100644 index 0000000000..5b787b7765 --- /dev/null +++ b/test/files/res/t5489.res @@ -0,0 +1,2 @@ +t5489/t5489.scala +t5489/t5489.scala
\ No newline at end of file diff --git a/test/files/res/t5489/t5489.scala b/test/files/res/t5489/t5489.scala new file mode 100644 index 0000000000..f821a1a9b6 --- /dev/null +++ b/test/files/res/t5489/t5489.scala @@ -0,0 +1,14 @@ +package repro + +trait HasString { + def blerg(): String +} + +class CausesProblems { + def problems = ( + if ("don't optimize me away!".length == 0) + new HasString { def blerg() = "wut" } + else + new HasString { def blerg() = "okay" } + ).blerg() +} diff --git a/test/files/run/abstypetags_core.check b/test/files/run/abstypetags_core.check index 55c8cb7e89..8d20e099c4 100644 --- a/test/files/run/abstypetags_core.check +++ b/test/files/run/abstypetags_core.check @@ -1,28 +1,30 @@ -true -TypeTag[Byte] -true -TypeTag[Short] -true -TypeTag[Char] -true -TypeTag[Int] -true -TypeTag[Long] -true -TypeTag[Float] -true -TypeTag[Double] -true -TypeTag[Boolean] -true -TypeTag[Unit] -true -TypeTag[Any] -true -TypeTag[java.lang.Object] -true -TypeTag[Null] -true -TypeTag[Nothing] -true -TypeTag[java.lang.String] +true
+TypeTag[Byte]
+true
+TypeTag[Short]
+true
+TypeTag[Char]
+true
+TypeTag[Int]
+true
+TypeTag[Long]
+true
+TypeTag[Float]
+true
+TypeTag[Double]
+true
+TypeTag[Boolean]
+true
+TypeTag[Unit]
+true
+TypeTag[Any]
+true
+TypeTag[AnyVal]
+true
+TypeTag[AnyRef]
+true
+TypeTag[java.lang.Object]
+true
+TypeTag[Null]
+true
+TypeTag[Nothing]
diff --git a/test/files/run/abstypetags_core.scala b/test/files/run/abstypetags_core.scala index a49817f4d4..226de94055 100644 --- a/test/files/run/abstypetags_core.scala +++ b/test/files/run/abstypetags_core.scala @@ -21,12 +21,14 @@ object Test extends App { println(implicitly[AbsTypeTag[Unit]]) println(implicitly[AbsTypeTag[Any]] eq AbsTypeTag.Any) println(implicitly[AbsTypeTag[Any]]) + println(implicitly[AbsTypeTag[AnyVal]] eq AbsTypeTag.AnyVal) + println(implicitly[AbsTypeTag[AnyVal]]) + println(implicitly[AbsTypeTag[AnyRef]] eq AbsTypeTag.AnyRef) + println(implicitly[AbsTypeTag[AnyRef]]) println(implicitly[AbsTypeTag[Object]] eq AbsTypeTag.Object) println(implicitly[AbsTypeTag[Object]]) println(implicitly[AbsTypeTag[Null]] eq AbsTypeTag.Null) println(implicitly[AbsTypeTag[Null]]) println(implicitly[AbsTypeTag[Nothing]] eq AbsTypeTag.Nothing) println(implicitly[AbsTypeTag[Nothing]]) - println(implicitly[AbsTypeTag[String]] eq AbsTypeTag.String) - println(implicitly[AbsTypeTag[String]]) }
\ No newline at end of file diff --git a/test/files/run/classmanifests_new_alias.check b/test/files/run/classmanifests_new_alias.check new file mode 100644 index 0000000000..ffb8482f91 --- /dev/null +++ b/test/files/run/classmanifests_new_alias.check @@ -0,0 +1,2 @@ +Int
+true
diff --git a/test/files/run/classmanifests_new_alias.scala b/test/files/run/classmanifests_new_alias.scala new file mode 100644 index 0000000000..12bd93bab6 --- /dev/null +++ b/test/files/run/classmanifests_new_alias.scala @@ -0,0 +1,5 @@ +object Test extends App { + type CM[T] = ClassManifest[T] + println(implicitly[CM[Int]]) + println(implicitly[CM[Int]] eq Manifest.Int) +}
\ No newline at end of file diff --git a/test/files/run/classmanifests_new_core.check b/test/files/run/classmanifests_new_core.check new file mode 100644 index 0000000000..ffb8482f91 --- /dev/null +++ b/test/files/run/classmanifests_new_core.check @@ -0,0 +1,2 @@ +Int
+true
diff --git a/test/files/run/classmanifests_new_core.scala b/test/files/run/classmanifests_new_core.scala new file mode 100644 index 0000000000..63dbfab25c --- /dev/null +++ b/test/files/run/classmanifests_new_core.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(classManifest[Int]) + println(classManifest[Int] eq Manifest.Int) +}
\ No newline at end of file diff --git a/test/files/run/classtags_core.check b/test/files/run/classtags_core.check index 7beada3f1c..6519db2178 100644 --- a/test/files/run/classtags_core.check +++ b/test/files/run/classtags_core.check @@ -21,8 +21,10 @@ ClassTag[class java.lang.Object] true
ClassTag[class java.lang.Object]
true
+ClassTag[class java.lang.Object]
+true
+ClassTag[class java.lang.Object]
+true
ClassTag[class scala.runtime.Null$]
true
ClassTag[class scala.runtime.Nothing$]
-true
-ClassTag[class java.lang.String]
diff --git a/test/files/run/classtags_core.scala b/test/files/run/classtags_core.scala index 17c69d9c41..0e174d8243 100644 --- a/test/files/run/classtags_core.scala +++ b/test/files/run/classtags_core.scala @@ -21,12 +21,14 @@ object Test extends App { println(implicitly[ClassTag[Unit]]) println(implicitly[ClassTag[Any]] eq ClassTag.Any) println(implicitly[ClassTag[Any]]) + println(implicitly[ClassTag[AnyVal]] eq ClassTag.AnyVal) + println(implicitly[ClassTag[AnyVal]]) + println(implicitly[ClassTag[AnyRef]] eq ClassTag.AnyRef) + println(implicitly[ClassTag[AnyRef]]) println(implicitly[ClassTag[Object]] eq ClassTag.Object) println(implicitly[ClassTag[Object]]) println(implicitly[ClassTag[Null]] eq ClassTag.Null) println(implicitly[ClassTag[Null]]) println(implicitly[ClassTag[Nothing]] eq ClassTag.Nothing) println(implicitly[ClassTag[Nothing]]) - println(implicitly[ClassTag[String]] eq ClassTag.String) - println(implicitly[ClassTag[String]]) }
\ No newline at end of file diff --git a/test/files/run/collection-conversions.check b/test/files/run/collection-conversions.check index 08d0fa32c5..5e43d25f7e 100644 --- a/test/files/run/collection-conversions.check +++ b/test/files/run/collection-conversions.check @@ -11,6 +11,7 @@ :[Direct] Array : OK :[Copy] Array : OK :[Copy] ParVector: OK + :[Copy] ParArray : OK -- Testing Vector --- :[Direct] Vector : OK :[Copy] Vector : OK @@ -24,6 +25,7 @@ :[Direct] Array : OK :[Copy] Array : OK :[Copy] ParVector: OK + :[Copy] ParArray : OK -- Testing List --- :[Direct] Vector : OK :[Copy] Vector : OK @@ -37,6 +39,7 @@ :[Direct] Array : OK :[Copy] Array : OK :[Copy] ParVector: OK + :[Copy] ParArray : OK -- Testing Buffer --- :[Direct] Vector : OK :[Copy] Vector : OK @@ -50,6 +53,7 @@ :[Direct] Array : OK :[Copy] Array : OK :[Copy] ParVector: OK + :[Copy] ParArray : OK -- Testing ParVector --- :[Direct] Vector : OK :[Copy] Vector : OK @@ -63,6 +67,21 @@ :[Direct] Array : OK :[Copy] Array : OK :[Copy] ParVector: OK + :[Copy] ParArray : OK +-- Testing ParArray --- + :[Direct] Vector : OK + :[Copy] Vector : OK + :[Direct] Buffer : OK + :[Copy] Buffer : OK + :[Direct] GenSeq : OK + :[Copy] GenSeq : OK + :[Copy] Seq : OK + :[Direct] Stream : OK + :[Copy] Stream : OK + :[Direct] Array : OK + :[Copy] Array : OK + :[Copy] ParVector: OK + :[Copy] ParArray : OK -- Testing Set --- :[Direct] Vector : OK :[Copy] Vector : OK @@ -76,6 +95,7 @@ :[Direct] Array : OK :[Copy] Array : OK :[Copy] ParVector: OK + :[Copy] ParArray : OK -- Testing SetView --- :[Direct] Vector : OK :[Copy] Vector : OK @@ -89,6 +109,7 @@ :[Direct] Array : OK :[Copy] Array : OK :[Copy] ParVector: OK + :[Copy] ParArray : OK -- Testing BufferView --- :[Direct] Vector : OK :[Copy] Vector : OK @@ -102,3 +123,4 @@ :[Direct] Array : OK :[Copy] Array : OK :[Copy] ParVector: OK + :[Copy] ParArray : OK
\ No newline at end of file diff --git a/test/files/run/collection-conversions.scala b/test/files/run/collection-conversions.scala index b5c4d8e261..d842742230 100644 --- a/test/files/run/collection-conversions.scala +++ b/test/files/run/collection-conversions.scala @@ -1,6 +1,7 @@ import collection._ import mutable.Buffer import parallel.immutable.ParVector +import parallel.mutable.ParArray import reflect.ClassTag object Test { @@ -29,30 +30,33 @@ object Test { val testStream = Stream(1,2,3) val testArray = Array(1,2,3) val testParVector = ParVector(1,2,3) + val testParArray = ParArray(1,2,3) def testConversion[A: ClassTag](name: String, col: => GenTraversableOnce[A]): Unit = { val tmp = col println("-- Testing " + name + " ---") printResult("[Direct] Vector ", col.toVector, testVector) - printResult("[Copy] Vector ", col.convertTo[Vector], testVector) + printResult("[Copy] Vector ", col.to[Vector], testVector) printResult("[Direct] Buffer ", col.toBuffer, testBuffer) - printResult("[Copy] Buffer ", col.convertTo[Buffer], testBuffer) + printResult("[Copy] Buffer ", col.to[Buffer], testBuffer) printResult("[Direct] GenSeq ", col.toSeq, testGenSeq) - printResult("[Copy] GenSeq ", col.convertTo[GenSeq], testGenSeq) - printResult("[Copy] Seq ", col.convertTo[Seq], testSeq) + printResult("[Copy] GenSeq ", col.to[GenSeq], testGenSeq) + printResult("[Copy] Seq ", col.to[Seq], testSeq) printResult("[Direct] Stream ", col.toStream, testStream) - printResult("[Copy] Stream ", col.convertTo[Stream], testStream) + printResult("[Copy] Stream ", col.to[Stream], testStream) printResult("[Direct] Array ", col.toArray, testArray) - printResult("[Copy] Array ", col.convertTo[Array], testArray) - printResult("[Copy] ParVector", col.convertTo[ParVector], testParVector) + printResult("[Copy] Array ", col.to[Array], testArray) + printResult("[Copy] ParVector", col.to[ParVector], testParVector) + printResult("[Copy] ParArray ", col.to[ParArray], testParArray) } def main(args: Array[String]): Unit = { - testConversion("iterator", (1 to 3).iterator) + testConversion("iterator", (1 to 3).iterator) testConversion("Vector", Vector(1,2,3)) testConversion("List", List(1,2,3)) testConversion("Buffer", Buffer(1,2,3)) testConversion("ParVector", ParVector(1,2,3)) + testConversion("ParArray", ParArray(1,2,3)) testConversion("Set", Set(1,2,3)) testConversion("SetView", Set(1,2,3).view) testConversion("BufferView", Buffer(1,2,3).view) diff --git a/test/files/run/enrich-gentraversable.check b/test/files/run/enrich-gentraversable.check index 348b38d6a4..94c66e3692 100644 --- a/test/files/run/enrich-gentraversable.check +++ b/test/files/run/enrich-gentraversable.check @@ -2,3 +2,7 @@ List(2, 4) Array(2, 4) HW Vector(72, 108, 108, 32, 114, 108, 100) +List(2, 4) +Array(2, 4) +HW +Vector(72, 108, 108, 32, 114, 108, 100) diff --git a/test/files/run/enrich-gentraversable.scala b/test/files/run/enrich-gentraversable.scala index c9320ff985..52eded55fd 100644 --- a/test/files/run/enrich-gentraversable.scala +++ b/test/files/run/enrich-gentraversable.scala @@ -1,30 +1,67 @@ object Test extends App { - import scala.collection.generic.{ CanBuildFrom, FromRepr, HasElem } + import scala.collection.{GenTraversableOnce,GenTraversableLike} + import scala.collection.generic._ def typed[T](t : => T) {} - - class FilterMapImpl[A, Repr](val r : Repr)(implicit hasElem : HasElem[Repr, A]) { - def filterMap[B, That](f : A => Option[B])(implicit cbf : CanBuildFrom[Repr, B, That]) : That = r.flatMap(f(_).toSeq) + def testTraversableLike = { + class FilterMapImpl[A, Repr](val r: GenTraversableLike[A, Repr]) /* extends AnyVal */ { + final def filterMap[B, That](f: A => Option[B])(implicit cbf: CanBuildFrom[Repr, B, That]): That = + r.flatMap(f(_).toSeq) + } + implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableLike[Repr]): FilterMapImpl[fr.A,Repr] = + new FilterMapImpl[fr.A, Repr](fr.conversion(r)) + + val l = List(1, 2, 3, 4, 5) + val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None) + typed[List[Int]](fml) + println(fml) + + val a = Array(1, 2, 3, 4, 5) + val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None) + typed[Array[Int]](fma) + println(fma.deep) + + val s = "Hello World" + val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None) + typed[String](fms1) + println(fms1) + + val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None) + typed[IndexedSeq[Int]](fms2) + println(fms2) } + def testTraversableOnce = { + class FilterMapImpl[A, Repr](val r: GenTraversableOnce[A]) /* extends AnyVal */ { + final def filterMap[B, That](f: A => Option[B])(implicit cbf: CanBuildFrom[Repr, B, That]): That = { + val b = cbf() + for(e <- r.seq) f(e) foreach (b +=) - implicit def filterMap[Repr : FromRepr](r : Repr) = new FilterMapImpl(r) - - val l = List(1, 2, 3, 4, 5) - val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None) - typed[List[Int]](fml) - println(fml) - - val a = Array(1, 2, 3, 4, 5) - val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None) - typed[Array[Int]](fma) - println(fma.deep) + b.result + } + } + implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableOnce[Repr]): FilterMapImpl[fr.A,Repr] = + new FilterMapImpl[fr.A, Repr](fr.conversion(r)) - val s = "Hello World" - val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None) - typed[String](fms1) - println(fms1) + val l = List(1, 2, 3, 4, 5) + val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None) + typed[List[Int]](fml) + println(fml) - val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None) - typed[IndexedSeq[Int]](fms2) - println(fms2) + val a = Array(1, 2, 3, 4, 5) + val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None) + typed[Array[Int]](fma) + println(fma.deep) + + val s = "Hello World" + val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None) + typed[String](fms1) + println(fms1) + + val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None) + typed[IndexedSeq[Int]](fms2) + println(fms2) + } + + testTraversableLike + testTraversableOnce } diff --git a/test/files/run/interop_classtags_are_classmanifests.check b/test/files/run/interop_classtags_are_classmanifests.check index c59e92d4eb..7a0a829af2 100644 --- a/test/files/run/interop_classtags_are_classmanifests.check +++ b/test/files/run/interop_classtags_are_classmanifests.check @@ -1,3 +1,3 @@ -Int
-java.lang.String
-Array[Int]
+ClassTag[int]
+ClassTag[class java.lang.String]
+ClassTag[class [I]
diff --git a/test/files/run/macro-reify-splice-splice/Macros_1.scala b/test/files/run/macro-reify-splice-splice/Macros_1.scala index 030a0a217e..4f1b600f63 100644 --- a/test/files/run/macro-reify-splice-splice/Macros_1.scala +++ b/test/files/run/macro-reify-splice-splice/Macros_1.scala @@ -1,5 +1,4 @@ import scala.reflect.makro.{Context => Ctx} -import scala.reflect.{mirror => mr} object Macros { def foo = macro Impls.foo diff --git a/test/files/run/newTags.check b/test/files/run/newTags.check index d83740c40c..2cbc265d7a 100644 --- a/test/files/run/newTags.check +++ b/test/files/run/newTags.check @@ -1,5 +1,5 @@ -TypeRef(ThisType(class immutable),class List,List(TypeRef(ThisType(class scala),class Int,List())))
+TypeRef(SingleType(SingleType(SingleType(NoPrefix,class <root>),module scala),module package),class List,List(TypeRef(ThisType(class scala),class Int,List())))
List[Int]
-TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List())))
-scala.collection.immutable.Map[java.lang.String,java.lang.String]
-TypeTag[TypeRef(ThisType(class immutable),class Map,List(TypeRef(ThisType(class lang),class String,List()), TypeRef(ThisType(class lang),class String,List())))]
+TypeRef(SingleType(ThisType(class scala),module Predef),class Map,List(TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()), TypeRef(SingleType(ThisType(class scala),module Predef),class String,List())))
+Map[String,String]
+TypeTag[TypeRef(SingleType(ThisType(class scala),module Predef),class Map,List(TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()), TypeRef(SingleType(ThisType(class scala),module Predef),class String,List())))]
diff --git a/test/files/run/patmat-finally.scala b/test/files/run/patmat-finally.scala new file mode 100644 index 0000000000..6f769b30a0 --- /dev/null +++ b/test/files/run/patmat-finally.scala @@ -0,0 +1,25 @@ +/** Test pattern matching and finally, see SI-5929. */ +object Test extends App { + def bar(s1: Object, s2: Object) { + s1 match { + case _ => + } + + try { + () + } finally { + s2 match { + case _ => + } + } + } + + def x = { + null match { case _ => } + + try { 1 } finally { while(false) { } } + } + + bar(null, null) + x +} diff --git a/test/files/run/reflection-repl.check b/test/files/run/reflection-repl.check index e93fb6d6e7..341dd10ab0 100644 --- a/test/files/run/reflection-repl.check +++ b/test/files/run/reflection-repl.check @@ -4,6 +4,6 @@ Type :help for more information. scala>
scala> scala.reflect.runtime.universe.typeOf[List[Nothing]]
-res0: reflect.runtime.universe.Type = List[Nothing]
+res0: reflect.runtime.universe.Type = scala.List[Nothing]
scala>
diff --git a/test/files/run/reify-aliases.check b/test/files/run/reify-aliases.check new file mode 100644 index 0000000000..392dd59a1d --- /dev/null +++ b/test/files/run/reify-aliases.check @@ -0,0 +1 @@ +TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())
diff --git a/test/files/run/reify-aliases.scala b/test/files/run/reify-aliases.scala new file mode 100644 index 0000000000..45b1a34e24 --- /dev/null +++ b/test/files/run/reify-aliases.scala @@ -0,0 +1,5 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + println(showRaw(typeOf[String])) +}
\ No newline at end of file diff --git a/test/files/run/reify_ann1a.check b/test/files/run/reify_ann1a.check index 9df18b2362..9bbb0ab87a 100644 --- a/test/files/run/reify_ann1a.check +++ b/test/files/run/reify_ann1a.check @@ -1,5 +1,5 @@ {
- @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends Object {
+ @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends AnyRef {
@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b")) = _;
def <init>(@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b"))) = {
super.<init>();
@@ -14,15 +14,15 @@ ()
}
{
- @ann(immutable.this.List.apply[java.lang.String]("1a")) @ann(immutable.this.List.apply[java.lang.String]("1b")) class C[@ann(immutable.this.List.apply[java.lang.String]("2a")) @ann(immutable.this.List.apply[java.lang.String]("2b")) T] extends Object {
- @ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a")) = _;
- def <init>(@ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a"))): C[T] = {
+ @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends AnyRef {
+ @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _;
+ def <init>(@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = {
C.super.<init>();
()
};
- @ann(immutable.this.List.apply[java.lang.String]("5a")) @ann(immutable.this.List.apply[java.lang.String]("5b")) def f(x: Int @ann(immutable.this.List.apply[java.lang.String]("6b")) @ann(immutable.this.List.apply[java.lang.String]("6a"))): Int = {
- @ann(immutable.this.List.apply[java.lang.String]("7a")) @ann(immutable.this.List.apply[java.lang.String]("7b")) val r: Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[java.lang.String]("8a"))): Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")));
- val s: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")) = (4: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")));
+ @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = {
+ @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")));
+ val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")));
r.+(s)
}
};
diff --git a/test/files/run/reify_ann1b.check b/test/files/run/reify_ann1b.check index bae838f15f..4a51c02701 100644 --- a/test/files/run/reify_ann1b.check +++ b/test/files/run/reify_ann1b.check @@ -1,5 +1,5 @@ {
- @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T >: Nothing <: Any] extends Object {
+ @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T >: Nothing <: Any] extends AnyRef {
@new ann(bar = "3a") @new ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _;
def <init>(@new ann(bar = "3a") @new ann(bar = "3b") x: T @ann(bar = "4a") @ann(bar = "4b")) = {
super.<init>();
@@ -14,7 +14,7 @@ ()
}
{
- @ann(bar = "1a") @ann(bar = "1b") class C[@ann(bar = "2a") @ann(bar = "2b") T] extends Object {
+ @ann(bar = "1a") @ann(bar = "1b") class C[@ann(bar = "2a") @ann(bar = "2b") T] extends AnyRef {
@ann(bar = "3a") @ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4b") @ann(bar = "4a") = _;
def <init>(@ann(bar = "3a") @ann(bar = "3b") x: T @ann(bar = "4b") @ann(bar = "4a")): C[T] = {
C.super.<init>();
diff --git a/test/files/run/reify_ann2a.check b/test/files/run/reify_ann2a.check index bb30441f8c..4d67bbf786 100644 --- a/test/files/run/reify_ann2a.check +++ b/test/files/run/reify_ann2a.check @@ -6,7 +6,7 @@ ()
}
};
- @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends Object {
+ @new ann(immutable.this.List.apply("1a")) @new ann(immutable.this.List.apply("1b")) class C[@new ann(immutable.this.List.apply("2a")) @new ann(immutable.this.List.apply("2b")) T >: Nothing <: Any] extends AnyRef {
@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b")) = _;
def <init>(@new ann(immutable.this.List.apply("3a")) @new ann(immutable.this.List.apply("3b")) x: T @ann(immutable.this.List.apply("4a")) @ann(immutable.this.List.apply("4b"))) = {
super.<init>();
@@ -22,21 +22,21 @@ }
{
class ann extends scala.annotation.Annotation with scala.annotation.StaticAnnotation {
- <paramaccessor> private[this] val bar: List[java.lang.String] = _;
- def <init>(bar: List[java.lang.String]): ann = {
+ <paramaccessor> private[this] val bar: List[String] = _;
+ def <init>(bar: List[String]): ann = {
ann.super.<init>();
()
}
};
- @ann(immutable.this.List.apply[java.lang.String]("1a")) @ann(immutable.this.List.apply[java.lang.String]("1b")) class C[@ann(immutable.this.List.apply[java.lang.String]("2a")) @ann(immutable.this.List.apply[java.lang.String]("2b")) T] extends Object {
- @ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a")) = _;
- def <init>(@ann(immutable.this.List.apply[java.lang.String]("3a")) @ann(immutable.this.List.apply[java.lang.String]("3b")) x: T @ann(immutable.this.List.apply[java.lang.String]("4b")) @ann(immutable.this.List.apply[java.lang.String]("4a"))): C[T] = {
+ @ann(immutable.this.List.apply[String]("1a")) @ann(immutable.this.List.apply[String]("1b")) class C[@ann(immutable.this.List.apply[String]("2a")) @ann(immutable.this.List.apply[String]("2b")) T] extends AnyRef {
+ @ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) <paramaccessor> private[this] val x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a")) = _;
+ def <init>(@ann(immutable.this.List.apply[String]("3a")) @ann(immutable.this.List.apply[String]("3b")) x: T @ann(immutable.this.List.apply[String]("4b")) @ann(immutable.this.List.apply[String]("4a"))): C[T] = {
C.super.<init>();
()
};
- @ann(immutable.this.List.apply[java.lang.String]("5a")) @ann(immutable.this.List.apply[java.lang.String]("5b")) def f(x: Int @ann(immutable.this.List.apply[java.lang.String]("6b")) @ann(immutable.this.List.apply[java.lang.String]("6a"))): Int = {
- @ann(immutable.this.List.apply[java.lang.String]("7a")) @ann(immutable.this.List.apply[java.lang.String]("7b")) val r: Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[java.lang.String]("8a"))): Int @ann(immutable.this.List.apply[java.lang.String]("8b")) @ann(immutable.this.List.apply[java.lang.String]("8a")));
- val s: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")) = (4: Int @ann(immutable.this.List.apply[java.lang.String]("9b")) @ann(immutable.this.List.apply[java.lang.String]("9a")));
+ @ann(immutable.this.List.apply[String]("5a")) @ann(immutable.this.List.apply[String]("5b")) def f(x: Int @ann(immutable.this.List.apply[String]("6b")) @ann(immutable.this.List.apply[String]("6a"))): Int = {
+ @ann(immutable.this.List.apply[String]("7a")) @ann(immutable.this.List.apply[String]("7b")) val r: Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")) = ((x.+(3): Int @ann(immutable.this.List.apply[String]("8a"))): Int @ann(immutable.this.List.apply[String]("8b")) @ann(immutable.this.List.apply[String]("8a")));
+ val s: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")) = (4: Int @ann(immutable.this.List.apply[String]("9b")) @ann(immutable.this.List.apply[String]("9a")));
r.+(s)
}
};
diff --git a/test/files/run/reify_ann3.check b/test/files/run/reify_ann3.check index 9452a9701e..96b4cf9c4e 100644 --- a/test/files/run/reify_ann3.check +++ b/test/files/run/reify_ann3.check @@ -1,5 +1,5 @@ {
- class Tree[A >: Nothing <: Any, B >: Nothing <: Any] extends Object {
+ class Tree[A >: Nothing <: Any, B >: Nothing <: Any] extends AnyRef {
@new inline @getter() final <paramaccessor> val key: A = _;
def <init>(key: A) = {
super.<init>();
@@ -9,7 +9,7 @@ ()
}
{
- class Tree[A, B] extends Object {
+ class Tree[A, B] extends AnyRef {
final <paramaccessor> private[this] val key: A = _;
@inline @scala.annotation.meta.getter final <stable> <accessor> <paramaccessor> def key: A = Tree.this.key;
def <init>(key: A): Tree[A,B] = {
diff --git a/test/files/run/reify_ann4.check b/test/files/run/reify_ann4.check index 406ee7bc08..6f853053d2 100644 --- a/test/files/run/reify_ann4.check +++ b/test/files/run/reify_ann4.check @@ -5,7 +5,7 @@ ()
}
};
- class C extends Object {
+ class C extends AnyRef {
def <init>() = {
super.<init>();
()
@@ -21,7 +21,7 @@ ()
}
};
- class C extends Object {
+ class C extends AnyRef {
def <init>(): C = {
C.super.<init>();
()
diff --git a/test/files/run/reify_ann5.check b/test/files/run/reify_ann5.check index ecf08eebb2..d443c601a0 100644 --- a/test/files/run/reify_ann5.check +++ b/test/files/run/reify_ann5.check @@ -1,5 +1,5 @@ {
- class C extends Object {
+ class C extends AnyRef {
@new inline @beanGetter() @new BeanProperty() <paramaccessor> val x: Int = _;
def <init>(x: Int) = {
super.<init>();
@@ -9,7 +9,7 @@ ()
}
{
- class C extends Object {
+ class C extends AnyRef {
@scala.beans.BeanProperty <paramaccessor> private[this] val x: Int = _;
<stable> <accessor> <paramaccessor> def x: Int = C.this.x;
def <init>(x: Int): C = {
diff --git a/test/files/run/reify_classfileann_a.check b/test/files/run/reify_classfileann_a.check index 685ecf5de6..6f17b26158 100644 --- a/test/files/run/reify_classfileann_a.check +++ b/test/files/run/reify_classfileann_a.check @@ -1,5 +1,5 @@ {
- @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends Object {
+ @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends AnyRef {
def <init>() = {
super.<init>();
()
@@ -8,7 +8,7 @@ ()
}
{
- @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4")) class C extends Object {
+ @ann(bar = "1", quux = ["2", "3"], baz = ann(bar = "4")) class C extends AnyRef {
def <init>(): C = {
C.super.<init>();
()
diff --git a/test/files/run/reify_classfileann_b.check b/test/files/run/reify_classfileann_b.check index 0aac9aeb2a..33270e0035 100644 --- a/test/files/run/reify_classfileann_b.check +++ b/test/files/run/reify_classfileann_b.check @@ -1,5 +1,5 @@ {
- class C extends Object {
+ class C extends AnyRef {
def <init>() = {
super.<init>();
()
@@ -9,7 +9,7 @@ ()
}
{
- class C extends Object {
+ class C extends AnyRef {
def <init>(): C = {
C.super.<init>();
()
diff --git a/test/files/run/reify_implicits-new.check b/test/files/run/reify_implicits-new.check deleted file mode 100644 index e3aeb20f6b..0000000000 --- a/test/files/run/reify_implicits-new.check +++ /dev/null @@ -1 +0,0 @@ -x = List(1, 2, 3, 4) diff --git a/test/files/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala deleted file mode 100644 index 42a1deef26..0000000000 --- a/test/files/run/reify_implicits-new.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.reflect.{ClassTag, classTag} -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - reify { - implicit def arrayWrapper[A : ClassTag](x: Array[A]) = - new { - def sort(p: (A, A) => Boolean) = { - util.Sorting.stableSort(x, p); x - } - } - val x = Array(2, 3, 1, 4) - println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) - }.eval -}
\ No newline at end of file diff --git a/test/files/run/reify_implicits-old.check b/test/files/run/reify_implicits-old.check deleted file mode 100644 index e3aeb20f6b..0000000000 --- a/test/files/run/reify_implicits-old.check +++ /dev/null @@ -1 +0,0 @@ -x = List(1, 2, 3, 4) diff --git a/test/files/run/reify_implicits-old.scala b/test/files/run/reify_implicits-old.scala deleted file mode 100644 index 8ff256d2d4..0000000000 --- a/test/files/run/reify_implicits-old.scala +++ /dev/null @@ -1,15 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - reify { - implicit def arrayWrapper[A : ClassManifest](x: Array[A]) = - new { - def sort(p: (A, A) => Boolean) = { - util.Sorting.stableSort(x, p); x - } - } - val x = Array(2, 3, 1, 4) - println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) - }.eval -}
\ No newline at end of file diff --git a/test/files/run/reify_magicsymbols.check b/test/files/run/reify_magicsymbols.check new file mode 100644 index 0000000000..e2aa46a364 --- /dev/null +++ b/test/files/run/reify_magicsymbols.check @@ -0,0 +1,13 @@ +Any +AnyVal +AnyRef +Null +Nothing +List[Any] +List[AnyVal] +List[AnyRef] +List[Null] +List[Nothing] +AnyRef{def foo(x: Int): Int} +Int* => Unit +=> Int => Unit diff --git a/test/files/run/reify_magicsymbols.scala b/test/files/run/reify_magicsymbols.scala new file mode 100644 index 0000000000..256ecbea33 --- /dev/null +++ b/test/files/run/reify_magicsymbols.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + println(typeOf[Any]) + println(typeOf[AnyVal]) + println(typeOf[AnyRef]) + println(typeOf[Null]) + println(typeOf[Nothing]) + println(typeOf[List[Any]]) + println(typeOf[List[AnyVal]]) + println(typeOf[List[AnyRef]]) + println(typeOf[List[Null]]) + println(typeOf[List[Nothing]]) + println(typeOf[{def foo(x: Int): Int}]) + println(typeOf[(Int*) => Unit]) + println(typeOf[(=> Int) => Unit]) +}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_09.check b/test/files/run/reify_newimpl_09.check deleted file mode 100644 index 220bd6875a..0000000000 --- a/test/files/run/reify_newimpl_09.check +++ /dev/null @@ -1 +0,0 @@ -List(2)
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_09.scala b/test/files/run/reify_newimpl_09.scala deleted file mode 100644 index 27fbd37b71..0000000000 --- a/test/files/run/reify_newimpl_09.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.ToolBox -import scala.tools.reflect.Eval - -object Test extends App { - { - type T = Int - val code = reify { - List[T](2) - } - println(code.eval) - } -}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_10.check b/test/files/run/reify_newimpl_10.check deleted file mode 100644 index 220bd6875a..0000000000 --- a/test/files/run/reify_newimpl_10.check +++ /dev/null @@ -1 +0,0 @@ -List(2)
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_10.scala b/test/files/run/reify_newimpl_10.scala deleted file mode 100644 index 791e52943a..0000000000 --- a/test/files/run/reify_newimpl_10.scala +++ /dev/null @@ -1,14 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.ToolBox -import scala.tools.reflect.Eval - -object Test extends App { - { - type T = Int - implicit val tt = implicitly[TypeTag[String]].asInstanceOf[TypeTag[T]] // this "mistake" is made for a reason! - val code = reify { - List[T](2) - } - println(code.eval) - } -}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_16.check b/test/files/run/reify_newimpl_16.check deleted file mode 100644 index 220bd6875a..0000000000 --- a/test/files/run/reify_newimpl_16.check +++ /dev/null @@ -1 +0,0 @@ -List(2)
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_16.scala b/test/files/run/reify_newimpl_16.scala deleted file mode 100644 index a0cadf4d48..0000000000 --- a/test/files/run/reify_newimpl_16.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.ToolBox -import scala.tools.reflect.Eval - -object Test extends App { - { - class C { - type T = Int - val code = reify { - List[T](2) - } - println(code.eval) - } - - new C - } -}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_17.check b/test/files/run/reify_newimpl_17.check deleted file mode 100644 index e592e0e94e..0000000000 --- a/test/files/run/reify_newimpl_17.check +++ /dev/null @@ -1,2 +0,0 @@ -scala.tools.reflect.ToolBoxError: reflective toolbox has failed:
-unresolved free type variables (namely: U defined by C in reify_newimpl_17.scala:6:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/reify_newimpl_17.scala b/test/files/run/reify_newimpl_17.scala deleted file mode 100644 index 8fbcd52502..0000000000 --- a/test/files/run/reify_newimpl_17.scala +++ /dev/null @@ -1,20 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.ToolBox -import scala.tools.reflect.Eval - -object Test extends App { - class C[U] { - type T = U - val code = reify { - List[T](2.asInstanceOf[T]) - } - println(code.eval) - } - - try { - new C[Int] - } catch { - case ex: Throwable => - println(ex) - } -}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index 6c5f124960..c006cb7ffb 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -14,7 +14,7 @@ scala> def foo[T]{ foo: [T]=> Unit
scala> foo[Int]
-AbsTypeTag[List[T]]
+AbsTypeTag[scala.List[T]]
scala>
diff --git a/test/files/run/reify_newimpl_28.check b/test/files/run/reify_newimpl_28.check deleted file mode 100644 index a7029974a4..0000000000 --- a/test/files/run/reify_newimpl_28.check +++ /dev/null @@ -1 +0,0 @@ -List(2)
diff --git a/test/files/run/reify_newimpl_28.scala b/test/files/run/reify_newimpl_28.scala deleted file mode 100644 index 524a110704..0000000000 --- a/test/files/run/reify_newimpl_28.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.ToolBox -import scala.tools.reflect.Eval - -object Test extends App { - { - object C { - type T = Int - val code = reify { - List[T](2) - } - println(code.eval) - } - - C - } -}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_32.check b/test/files/run/reify_newimpl_32.check deleted file mode 100644 index a7029974a4..0000000000 --- a/test/files/run/reify_newimpl_32.check +++ /dev/null @@ -1 +0,0 @@ -List(2)
diff --git a/test/files/run/reify_newimpl_32.scala b/test/files/run/reify_newimpl_32.scala deleted file mode 100644 index 095e59d919..0000000000 --- a/test/files/run/reify_newimpl_32.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.ToolBox -import scala.tools.reflect.Eval - -object Test extends App { - { - object C { - type T = Int - val code = reify { - List[C.T](2) - } - println(code.eval) - } - - C - } -}
\ No newline at end of file diff --git a/test/files/run/reify_newimpl_34.check b/test/files/run/reify_newimpl_34.check deleted file mode 100644 index a7029974a4..0000000000 --- a/test/files/run/reify_newimpl_34.check +++ /dev/null @@ -1 +0,0 @@ -List(2)
diff --git a/test/files/run/reify_newimpl_34.scala b/test/files/run/reify_newimpl_34.scala deleted file mode 100644 index a0a575ed7d..0000000000 --- a/test/files/run/reify_newimpl_34.scala +++ /dev/null @@ -1,18 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.ToolBox -import scala.tools.reflect.Eval - -object Test extends App { - { - object C { - type T = Int - lazy val c = C - val code = reify { - List[c.T](2) - } - println(code.eval) - } - - C - } -}
\ No newline at end of file diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index 1b1c6fdbb8..07e99781e3 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -44,8 +44,8 @@ object Test extends App { val Literal(Constant(s_format: String)) = format val paramsStack = scala.collection.mutable.Stack(params: _*) val parsed = s_format.split("(?<=%[\\w%])|(?=%[\\w%])") map { - case "%d" => createTempValDef( paramsStack.pop, IntTpe ) - case "%s" => createTempValDef( paramsStack.pop, StringTpe ) + case "%d" => createTempValDef( paramsStack.pop, typeOf[Int] ) + case "%s" => createTempValDef( paramsStack.pop, typeOf[String] ) case "%%" => { (None:Option[Tree], Literal(Constant("%"))) } diff --git a/test/files/run/showraw_mods.check b/test/files/run/showraw_mods.check index 83055f2b70..6fc3ffe051 100644 --- a/test/files/run/showraw_mods.check +++ b/test/files/run/showraw_mods.check @@ -1 +1 @@ -Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), newTypeName("C"), List(), Template(List(Ident(java.lang.Object)), emptyValDef, List(DefDef(Modifiers(), newTermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), newTermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), newTermName("y"), TypeTree(), Select(This(newTypeName("C")), newTermName("x"))), ValDef(Modifiers(LAZY), newTermName("z"), TypeTree(), Select(This(newTypeName("C")), newTermName("y"))))))), Literal(Constant(())))
+Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), newTypeName("C"), List(), Template(List(Ident(newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), newTermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), newTermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), newTermName("y"), TypeTree(), Select(This(newTypeName("C")), newTermName("x"))), ValDef(Modifiers(LAZY), newTermName("z"), TypeTree(), Select(This(newTypeName("C")), newTermName("y"))))))), Literal(Constant(())))
diff --git a/test/files/run/showraw_tree.check b/test/files/run/showraw_tree.check index 82724cae44..d3a1fddf48 100644 --- a/test/files/run/showraw_tree.check +++ b/test/files/run/showraw_tree.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(java.lang.String), Ident(java.lang.String)))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(java.lang.String), Ident(java.lang.String)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_ids.check b/test/files/run/showraw_tree_ids.check index c6dbd6f1ce..0c189130cf 100644 --- a/test/files/run/showraw_tree_ids.check +++ b/test/files/run/showraw_tree_ids.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#1903), List(Ident(java.lang.String#129), Ident(java.lang.String#129)))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#1908), List(Ident(java.lang.String#129), Ident(java.lang.String#129)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_ids.scala b/test/files/run/showraw_tree_ids.scala index b56b8b4476..ea9a3cd4c2 100644 --- a/test/files/run/showraw_tree_ids.scala +++ b/test/files/run/showraw_tree_ids.scala @@ -3,6 +3,7 @@ import scala.reflect.runtime.universe._ object Test extends App { val tree1 = reify(new collection.immutable.HashMap[String, String]) val tree2 = reify(new collection.mutable.HashMap[String, String]) - println(showRaw(tree1.tree, printIds = true)) - println(showRaw(tree2.tree, printIds = true)) + def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>") + println(stabilize(showRaw(tree1.tree, printIds = true))) + println(stabilize(showRaw(tree2.tree, printIds = true))) }
\ No newline at end of file diff --git a/test/files/run/showraw_tree_kinds.check b/test/files/run/showraw_tree_kinds.check index a12e21c611..7b4ab456b0 100644 --- a/test/files/run/showraw_tree_kinds.check +++ b/test/files/run/showraw_tree_kinds.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Ident(java.lang.String#CLS), Ident(java.lang.String#CLS)))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Ident(java.lang.String#CLS), Ident(java.lang.String#CLS)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_types_ids.check b/test/files/run/showraw_tree_types_ids.check index 02e7aeed7c..39e68dc881 100644 --- a/test/files/run/showraw_tree_types_ids.check +++ b/test/files/run/showraw_tree_types_ids.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#1903), List(TypeTree[4]().setOriginal(Ident[4](java.lang.String#129)), TypeTree[4]().setOriginal(Ident[4](java.lang.String#129)))))), nme.CONSTRUCTOR#1913), List())
-[1] TypeRef(ThisType(scala.collection.immutable#1898), scala.collection.immutable.HashMap#1903, List(TypeRef(ThisType(java.lang#128), java.lang.String#129, List()), TypeRef(ThisType(java.lang#128), java.lang.String#129, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#1898), scala.collection.immutable.HashMap#1903, List(TypeRef(ThisType(java.lang#128), java.lang.String#129, List()), TypeRef(ThisType(java.lang#128), java.lang.String#129, List()))))
-[3] TypeRef(ThisType(scala.collection.immutable#1898), scala.collection.immutable.HashMap#1903, List())
-[4] TypeRef(ThisType(java.lang#128), java.lang.String#129, List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#1908), List(TypeTree[4]().setOriginal(Ident[4](java.lang.String#129)), TypeTree[4]().setOriginal(Ident[4](java.lang.String#129)))))), nme.CONSTRUCTOR#2231), List())
-[4] TypeRef(ThisType(java.lang#128), java.lang.String#129, List())
-[5] TypeRef(ThisType(scala.collection.mutable#1907), scala.collection.mutable.HashMap#1908, List(TypeRef(ThisType(java.lang#128), java.lang.String#129, List()), TypeRef(ThisType(java.lang#128), java.lang.String#129, List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#1907), scala.collection.mutable.HashMap#1908, List(TypeRef(ThisType(java.lang#128), java.lang.String#129, List()), TypeRef(ThisType(java.lang#128), java.lang.String#129, List()))))
-[7] TypeRef(ThisType(scala.collection.mutable#1907), scala.collection.mutable.HashMap#1908, List())
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
+[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))))
+[3] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List())
+[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())
+Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
+[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())
+[5] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))
+[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))))
+[7] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List())
diff --git a/test/files/run/showraw_tree_types_ids.scala b/test/files/run/showraw_tree_types_ids.scala index cb2c2bfb0f..198729e705 100644 --- a/test/files/run/showraw_tree_types_ids.scala +++ b/test/files/run/showraw_tree_types_ids.scala @@ -5,6 +5,7 @@ object Test extends App { val tb = runtimeMirror(getClass.getClassLoader).mkToolBox() val tree1 = reify(new collection.immutable.HashMap[String, String]) val tree2 = reify(new collection.mutable.HashMap[String, String]) - println(showRaw(tb.typeCheck(tree1.tree), printIds = true, printTypes = true)) - println(showRaw(tb.typeCheck(tree2.tree), printIds = true, printTypes = true)) + def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>") + println(stabilize(showRaw(tb.typeCheck(tree1.tree), printIds = true, printTypes = true))) + println(stabilize(showRaw(tb.typeCheck(tree2.tree), printIds = true, printTypes = true))) }
\ No newline at end of file diff --git a/test/files/run/showraw_tree_types_typed.check b/test/files/run/showraw_tree_types_typed.check index 60176c7192..0a41f5185c 100644 --- a/test/files/run/showraw_tree_types_typed.check +++ b/test/files/run/showraw_tree_types_typed.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](java.lang.String)), TypeTree[4]().setOriginal(Ident[4](java.lang.String)))))), nme.CONSTRUCTOR), List())
-[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(java.lang), java.lang.String, List()), TypeRef(ThisType(java.lang), java.lang.String, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(java.lang), java.lang.String, List()), TypeRef(ThisType(java.lang), java.lang.String, List()))))
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List())
+[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))))
[3] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List())
-[4] TypeRef(ThisType(java.lang), java.lang.String, List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](java.lang.String)), TypeTree[4]().setOriginal(Ident[4](java.lang.String)))))), nme.CONSTRUCTOR), List())
-[4] TypeRef(ThisType(java.lang), java.lang.String, List())
-[5] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(java.lang), java.lang.String, List()), TypeRef(ThisType(java.lang), java.lang.String, List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(java.lang), java.lang.String, List()), TypeRef(ThisType(java.lang), java.lang.String, List()))))
+[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List())
+Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List())
+[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List())
+[5] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))
+[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))))
[7] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List())
diff --git a/test/files/run/showraw_tree_types_untyped.check b/test/files/run/showraw_tree_types_untyped.check index 82724cae44..d3a1fddf48 100644 --- a/test/files/run/showraw_tree_types_untyped.check +++ b/test/files/run/showraw_tree_types_untyped.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(java.lang.String), Ident(java.lang.String)))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(java.lang.String), Ident(java.lang.String)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_ultimate.check b/test/files/run/showraw_tree_ultimate.check index 0b409554a0..400b736704 100644 --- a/test/files/run/showraw_tree_ultimate.check +++ b/test/files/run/showraw_tree_ultimate.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#1903#CLS), List(TypeTree[4]().setOriginal(Ident[4](java.lang.String#129#CLS)), TypeTree[4]().setOriginal(Ident[4](java.lang.String#129#CLS)))))), nme.CONSTRUCTOR#1913#PCTOR), List())
-[1] TypeRef(ThisType(scala.collection.immutable#1898#PK), scala.collection.immutable.HashMap#1903#CLS, List(TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List()), TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#1898#PK), scala.collection.immutable.HashMap#1903#CLS, List(TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List()), TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List()))))
-[3] TypeRef(ThisType(scala.collection.immutable#1898#PK), scala.collection.immutable.HashMap#1903#CLS, List())
-[4] TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#1908#CLS), List(TypeTree[4]().setOriginal(Ident[4](java.lang.String#129#CLS)), TypeTree[4]().setOriginal(Ident[4](java.lang.String#129#CLS)))))), nme.CONSTRUCTOR#2231#CTOR), List())
-[4] TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List())
-[5] TypeRef(ThisType(scala.collection.mutable#1907#PK), scala.collection.mutable.HashMap#1908#CLS, List(TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List()), TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#1907#PK), scala.collection.mutable.HashMap#1908#CLS, List(TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List()), TypeRef(ThisType(java.lang#128#PK), java.lang.String#129#CLS, List()))))
-[7] TypeRef(ThisType(scala.collection.mutable#1907#PK), scala.collection.mutable.HashMap#1908#CLS, List())
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#PCTOR), List())
+[1] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))))
+[3] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List())
+[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())
+Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#CTOR), List())
+[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())
+[5] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))
+[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))))
+[7] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List())
diff --git a/test/files/run/showraw_tree_ultimate.scala b/test/files/run/showraw_tree_ultimate.scala index dfd7abde52..a8507623bc 100644 --- a/test/files/run/showraw_tree_ultimate.scala +++ b/test/files/run/showraw_tree_ultimate.scala @@ -5,6 +5,7 @@ object Test extends App { val tb = runtimeMirror(getClass.getClassLoader).mkToolBox() val tree1 = reify(new collection.immutable.HashMap[String, String]) val tree2 = reify(new collection.mutable.HashMap[String, String]) - println(showRaw(tb.typeCheck(tree1.tree), printIds = true, printKinds = true, printTypes = true)) - println(showRaw(tb.typeCheck(tree2.tree), printIds = true, printKinds = true, printTypes = true)) + def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>") + println(stabilize(showRaw(tb.typeCheck(tree1.tree), printIds = true, printKinds = true, printTypes = true))) + println(stabilize(showRaw(tb.typeCheck(tree2.tree), printIds = true, printKinds = true, printTypes = true))) }
\ No newline at end of file diff --git a/test/files/run/t3326.check b/test/files/run/t3326.check new file mode 100644 index 0000000000..d0e11cebf7 --- /dev/null +++ b/test/files/run/t3326.check @@ -0,0 +1,8 @@ +Map(2 -> Hello, 1 -> World) +Map(5 -> Foo, 4 -> Bar) +Map(5 -> Foo, 4 -> Bar, 2 -> Hello, 1 -> World) +Map(3 -> ?, 2 -> Hello, 1 -> World) +Map(2 -> Hello, 1 -> World) +Map(5 -> Foo, 4 -> Bar) +Map(5 -> Foo, 4 -> Bar, 2 -> Hello, 1 -> World) +Map(3 -> ?, 2 -> Hello, 1 -> World)
\ No newline at end of file diff --git a/test/files/run/t3326.scala b/test/files/run/t3326.scala new file mode 100644 index 0000000000..f70cb01504 --- /dev/null +++ b/test/files/run/t3326.scala @@ -0,0 +1,74 @@ + + + +import scala.math.Ordering + + + +/** The heart of the problem - we want to retain the ordering when + * using `++` on sorted maps. + * + * There are 2 `++` overloads - a generic one in traversables and + * a map-specific one in `MapLike` - which knows about the ordering. + * + * The problem here is that the expected return type for the expression + * in which `++` appears drives the decision of the overload that needs + * to be taken. + * The `collection.SortedMap` does not have `++` overridden to return + * `SortedMap`, but `immutable.Map` instead. + * This is why `collection.SortedMap` used to resort to the generic + * `TraversableLike.++` which knows nothing about the ordering. + * + * To avoid `collection.SortedMap`s resort to the more generic `TraverableLike.++`, + * we override the `MapLike.++` overload in `collection.SortedMap` to return + * the proper type `SortedMap`. + */ +object Test { + + def main(args: Array[String]) { + testCollectionSorted() + testImmutableSorted() + } + + def testCollectionSorted() { + import collection._ + val order = implicitly[Ordering[Int]].reverse + var m1: SortedMap[Int, String] = SortedMap.empty[Int, String](order) + var m2: SortedMap[Int, String] = SortedMap.empty[Int, String](order) + + m1 += (1 -> "World") + m1 += (2 -> "Hello") + + m2 += (4 -> "Bar") + m2 += (5 -> "Foo") + + val m3: SortedMap[Int, String] = m1 ++ m2 + + println(m1) + println(m2) + println(m3) + + println(m1 + (3 -> "?")) + } + + def testImmutableSorted() { + import collection.immutable._ + val order = implicitly[Ordering[Int]].reverse + var m1: SortedMap[Int, String] = SortedMap.empty[Int, String](order) + var m2: SortedMap[Int, String] = SortedMap.empty[Int, String](order) + + m1 += (1 -> "World") + m1 += (2 -> "Hello") + + m2 += (4 -> "Bar") + m2 += (5 -> "Foo") + + val m3: SortedMap[Int, String] = m1 ++ m2 + + println(m1) + println(m2) + println(m3) + + println(m1 + (3 -> "?")) + } +} diff --git a/test/files/run/t4027.check b/test/files/run/t4027.check new file mode 100644 index 0000000000..bdacfc1c06 --- /dev/null +++ b/test/files/run/t4027.check @@ -0,0 +1,12 @@ +Map(2 -> true, 4 -> true) +Map(1 -> false!, 2 -> true!, 3 -> false!, 4 -> true!) +Map(2 -> 4, 4 -> 4) +Map(1 -> 6, 2 -> 5, 3 -> 6, 4 -> 5) +Map() +Map(1 -> false!) +Map(2 -> true, 4 -> true) +Map(1 -> false!, 2 -> true!, 3 -> false!, 4 -> true!) +Map(2 -> 4, 4 -> 4) +Map(1 -> 6, 2 -> 5, 3 -> 6, 4 -> 5) +Map() +Map(1 -> false!)
\ No newline at end of file diff --git a/test/files/run/t4027.scala b/test/files/run/t4027.scala new file mode 100644 index 0000000000..d70ca0cc3a --- /dev/null +++ b/test/files/run/t4027.scala @@ -0,0 +1,27 @@ + + +import collection._ + + +/** Sorted maps should have `filterKeys` and `mapValues` which return sorted maps. + * Mapping, filtering, etc. on these views should return sorted maps again. + */ +object Test extends App { + + val sortedmap = SortedMap(1 -> false, 2 -> true, 3 -> false, 4 -> true) + println(sortedmap.filterKeys(_ % 2 == 0): SortedMap[Int, Boolean]) + println(sortedmap.mapValues(_ + "!"): SortedMap[Int, String]) + println(sortedmap.filterKeys(_ % 2 == 0).map(t => (t._1, t._2.toString.length)): SortedMap[Int, Int]) + println(sortedmap.mapValues(_ + "!").map(t => (t._1, t._2.toString.length)): SortedMap[Int, Int]) + println(sortedmap.filterKeys(_ % 2 == 0).filter(t => t._1 < 2): SortedMap[Int, Boolean]) + println(sortedmap.mapValues(_ + "!").filter(t => t._1 < 2): SortedMap[Int, String]) + + val immsortedmap = immutable.SortedMap(1 -> false, 2 -> true, 3 -> false, 4 -> true) + println(immsortedmap.filterKeys(_ % 2 == 0): immutable.SortedMap[Int, Boolean]) + println(immsortedmap.mapValues(_ + "!"): immutable.SortedMap[Int, String]) + println(immsortedmap.filterKeys(_ % 2 == 0).map(t => (t._1, t._2.toString.length)): immutable.SortedMap[Int, Int]) + println(immsortedmap.mapValues(_ + "!").map(t => (t._1, t._2.toString.length)): immutable.SortedMap[Int, Int]) + println(immsortedmap.filterKeys(_ % 2 == 0).filter(t => t._1 < 2): immutable.SortedMap[Int, Boolean]) + println(immsortedmap.mapValues(_ + "!").filter(t => t._1 < 2): immutable.SortedMap[Int, String]) + +} diff --git a/test/files/run/t5224.check b/test/files/run/t5224.check index c754f23551..ffeb7b43ce 100644 --- a/test/files/run/t5224.check +++ b/test/files/run/t5224.check @@ -1,5 +1,5 @@ {
- @new Foo(bar = "qwe") class C extends Object {
+ @new Foo(bar = "qwe") class C extends AnyRef {
def <init>() = {
super.<init>();
()
diff --git a/test/files/run/t5271_3.check b/test/files/run/t5271_3.check index 2b920a36a8..3cfedbacd7 100644 --- a/test/files/run/t5271_3.check +++ b/test/files/run/t5271_3.check @@ -1,5 +1,5 @@ {
- object C extends Object {
+ object C extends AnyRef {
def <init>() = {
super.<init>();
()
diff --git a/test/files/run/t5704.check b/test/files/run/t5704.check index 74c4610988..0f6c84d2ec 100644 --- a/test/files/run/t5704.check +++ b/test/files/run/t5704.check @@ -1 +1 @@ -java.lang.String
+String
diff --git a/test/files/run/t5914.check b/test/files/run/t5914.check new file mode 100644 index 0000000000..818e321255 --- /dev/null +++ b/test/files/run/t5914.check @@ -0,0 +1 @@ +correct diff --git a/test/files/run/t5914.scala b/test/files/run/t5914.scala new file mode 100644 index 0000000000..45d8815738 --- /dev/null +++ b/test/files/run/t5914.scala @@ -0,0 +1,23 @@ +import scala.reflect.ClassTag + +trait Trees { + class Tree + implicit val ttTag: ClassTag[TypeTree] + type TypeTree <: Tree + val TypeTree: TypeTreeExtractor + abstract class TypeTreeExtractor { + def unapply(t: TypeTree): Option[String] + } + def test(tree: Tree) = + tree match { + case TypeTree(_) => println("lolwut") + case null => println("correct") + } +} + +object Test extends App with Trees { + val ttTag = implicitly[ClassTag[TypeTree]] + case class TypeTree(meh: String) extends Tree + object TypeTree extends TypeTreeExtractor + test(null) // should not crash +}
\ No newline at end of file diff --git a/test/files/run/t5971.check b/test/files/run/t5971.check new file mode 100644 index 0000000000..0c36a1ff02 --- /dev/null +++ b/test/files/run/t5971.check @@ -0,0 +1,4 @@ +r,b +r +a,b +r,a,b
\ No newline at end of file diff --git a/test/files/run/t5971.scala b/test/files/run/t5971.scala new file mode 100644 index 0000000000..dbd9beebb3 --- /dev/null +++ b/test/files/run/t5971.scala @@ -0,0 +1,23 @@ + + + + + +/** When using `AbstractTransformed` abstract inner class in views in order + * to force generating bridges, one must take care to push the corresponding + * collection trait (such as `Iterable` or `Seq`) as far as possible to the + * left in the linearization order -- otherwise, overridden methods from these + * traits can override the already overridden methods in view. This was the + * case with `takeWhile`. + * Mind blowing, I know. + */ +object Test { + + def main(args: Array[String]) { + println("bar".view.reverse.filter(_ > 'a').mkString(",")) + println("bar".view.reverse.take(1).mkString(",")) + println("bar".view.reverse.dropWhile(_ > 'a').mkString(",")) + println("bar".view.reverse.takeWhile(_ => true).mkString(",")) + } + +} diff --git a/test/files/run/t5986.check b/test/files/run/t5986.check new file mode 100644 index 0000000000..4101770c6d --- /dev/null +++ b/test/files/run/t5986.check @@ -0,0 +1,15 @@ +Foo(bar, 1) +Foo(bar, 1) +Foo(bar, 1),Foo(baz, 3),Foo(bazz, 4) +Foo(bar, 1) +Foo(bar, 1) +Foo(bar, 1),Foo(baz, 3),Foo(bazz, 4) +Foo(bar, 1) +Foo(bar, 1) +Foo(bar, 1),Foo(baz, 3),Foo(bazz, 4) +Foo(bar, 1) +Foo(bar, 1) +Foo(bar, 1),Foo(baz, 3),Foo(bazz, 4) +Foo(bar, 1) +Foo(bar, 1) +Foo(bar, 1),Foo(baz, 3),Foo(bazz, 4)
\ No newline at end of file diff --git a/test/files/run/t5986.scala b/test/files/run/t5986.scala new file mode 100644 index 0000000000..8cf7086f98 --- /dev/null +++ b/test/files/run/t5986.scala @@ -0,0 +1,36 @@ + + + +import scala.collection._ + + + +/** A sorted set should not replace elements when adding + * and the element already exists in the set. + */ +object Test { + + class Foo(val name: String, val n: Int) { + override def equals(obj: Any): Boolean = obj match { case other: Foo => name == other.name; case _ => false } + override def hashCode = name.## + override def toString = "Foo(" + name + ", " + n + ")" + } + + implicit val ordering: Ordering[Foo] = Ordering.fromLessThan[Foo] { (a, b) => a.name.compareTo(b.name) < 0 } + + def check[S <: Set[Foo]](set: S) { + def output(s: Set[Foo]) = println(s.toList.sorted.mkString(",")) + output(set + new Foo("bar", 2)) + output(set ++ List(new Foo("bar", 2), new Foo("bar", 3), new Foo("bar", 4))) + output(set union Set(new Foo("bar", 2), new Foo("baz", 3), new Foo("bazz", 4))) + } + + def main(args: Array[String]) { + check(Set(new Foo("bar", 1))) + check(immutable.Set(new Foo("bar", 1))) + check(mutable.Set(new Foo("bar", 1))) + check(immutable.SortedSet(new Foo("bar", 1))) + check(mutable.SortedSet(new Foo("bar", 1))) + } + +} diff --git a/test/files/run/test-cpp.check b/test/files/run/test-cpp.check index 40a976119f..a7163edb5f 100644 --- a/test/files/run/test-cpp.check +++ b/test/files/run/test-cpp.check @@ -1,73 +1,65 @@ -37c37 -< locals: value args, value x, value y ---- -> locals: value args -42,43d41 -< 52 CONSTANT(2) -< 52 STORE_LOCAL(value x) -45,46d42 -< 53 LOAD_LOCAL(value x) -< 53 STORE_LOCAL(value y) -49c45 -< 54 LOAD_LOCAL(value y) ---- -> 54 CONSTANT(2) -92c88 -< locals: value args, value x, value y ---- -> locals: value args, value x -101,102d96 -< 82 LOAD_LOCAL(value x) -< 82 STORE_LOCAL(value y) -105c99 -< 83 LOAD_LOCAL(value y) ---- -> 83 LOAD_LOCAL(value x) -135c129 -< locals: value args, value x, value y ---- -> locals: value args -140,141d133 -< 66 THIS(TestAliasChainDerefThis) -< 66 STORE_LOCAL(value x) -143,144d134 -< 67 LOAD_LOCAL(value x) -< 67 STORE_LOCAL(value y) -147c137 -< 68 LOAD_LOCAL(value y) ---- -> 68 THIS(Object) -176c166 -< locals: value x, value y ---- -> locals: value x -181,182d170 -< 29 LOAD_LOCAL(value x) -< 29 STORE_LOCAL(value y) -185c173 -< 30 LOAD_LOCAL(value y) ---- -> 30 LOAD_LOCAL(value x) -223,224d210 -< 97 LOAD_LOCAL(variable x) -< 97 STORE_LOCAL(variable y) -227c213 -< 98 LOAD_LOCAL(variable y) ---- -> 98 LOAD_LOCAL(variable x) -233,234d218 -< 101 LOAD_LOCAL(variable y) -< 101 STORE_LOCAL(variable x) -236c220 -< 102 LOAD_LOCAL(variable x) ---- -> 102 LOAD_LOCAL(variable y) -345c329 -< 41 THIS(TestSetterInline) ---- -> 41 THIS(Object) -347c331 -< 41 CALL_METHOD TestSetterInline._postSetHook_$eq (static-instance) ---- -> 41 STORE_FIELD variable _postSetHook (dynamic) - +37c37
+< locals: value args, value x, value y
+---
+> locals: value args
+42,43d41
+< 52 CONSTANT(2)
+< 52 STORE_LOCAL(value x)
+45,46d42
+< 53 LOAD_LOCAL(value x)
+< 53 STORE_LOCAL(value y)
+49c45
+< 54 LOAD_LOCAL(value y)
+---
+> 54 CONSTANT(2)
+92c88
+< locals: value args, value x, value y
+---
+> locals: value args, value x
+101,102d96
+< 82 LOAD_LOCAL(value x)
+< 82 STORE_LOCAL(value y)
+105c99
+< 83 LOAD_LOCAL(value y)
+---
+> 83 LOAD_LOCAL(value x)
+135c129
+< locals: value args, value x, value y
+---
+> locals: value args
+140,141d133
+< 66 THIS(TestAliasChainDerefThis)
+< 66 STORE_LOCAL(value x)
+143,144d134
+< 67 LOAD_LOCAL(value x)
+< 67 STORE_LOCAL(value y)
+147c137
+< 68 LOAD_LOCAL(value y)
+---
+> 68 THIS(Object)
+176c166
+< locals: value x, value y
+---
+> locals: value x
+181,182d170
+< 29 LOAD_LOCAL(value x)
+< 29 STORE_LOCAL(value y)
+185c173
+< 30 LOAD_LOCAL(value y)
+---
+> 30 LOAD_LOCAL(value x)
+223,224d210
+< 97 LOAD_LOCAL(variable x)
+< 97 STORE_LOCAL(variable y)
+227c213
+< 98 LOAD_LOCAL(variable y)
+---
+> 98 LOAD_LOCAL(variable x)
+233,234d218
+< 101 LOAD_LOCAL(variable y)
+< 101 STORE_LOCAL(variable x)
+236c220
+< 102 LOAD_LOCAL(variable x)
+---
+> 102 LOAD_LOCAL(variable y)
+
diff --git a/test/files/run/concretetypetags_core.check b/test/files/run/typetags_core.check index d042e0900d..8d20e099c4 100644 --- a/test/files/run/concretetypetags_core.check +++ b/test/files/run/typetags_core.check @@ -19,10 +19,12 @@ TypeTag[Unit] true
TypeTag[Any]
true
+TypeTag[AnyVal]
+true
+TypeTag[AnyRef]
+true
TypeTag[java.lang.Object]
true
TypeTag[Null]
true
TypeTag[Nothing]
-true
-TypeTag[java.lang.String]
diff --git a/test/files/run/concretetypetags_core.scala b/test/files/run/typetags_core.scala index a870f77c5f..5257d55118 100644 --- a/test/files/run/concretetypetags_core.scala +++ b/test/files/run/typetags_core.scala @@ -21,12 +21,14 @@ object Test extends App { println(implicitly[TypeTag[Unit]]) println(implicitly[TypeTag[Any]] eq TypeTag.Any) println(implicitly[TypeTag[Any]]) + println(implicitly[TypeTag[AnyVal]] eq TypeTag.AnyVal) + println(implicitly[TypeTag[AnyVal]]) + println(implicitly[TypeTag[AnyRef]] eq TypeTag.AnyRef) + println(implicitly[TypeTag[AnyRef]]) println(implicitly[TypeTag[Object]] eq TypeTag.Object) println(implicitly[TypeTag[Object]]) println(implicitly[TypeTag[Null]] eq TypeTag.Null) println(implicitly[TypeTag[Null]]) println(implicitly[TypeTag[Nothing]] eq TypeTag.Nothing) println(implicitly[TypeTag[Nothing]]) - println(implicitly[TypeTag[String]] eq TypeTag.String) - println(implicitly[TypeTag[String]]) }
\ No newline at end of file diff --git a/test/files/run/concretetypetags_multi.check b/test/files/run/typetags_multi.check index 6110252c36..6110252c36 100644 --- a/test/files/run/concretetypetags_multi.check +++ b/test/files/run/typetags_multi.check diff --git a/test/files/run/concretetypetags_multi.scala b/test/files/run/typetags_multi.scala index b30aac80a6..b30aac80a6 100644 --- a/test/files/run/concretetypetags_multi.scala +++ b/test/files/run/typetags_multi.scala diff --git a/test/files/scalacheck/redblacktree.scala b/test/files/scalacheck/redblacktree.scala index e4b356c889..e2609fa200 100644 --- a/test/files/scalacheck/redblacktree.scala +++ b/test/files/scalacheck/redblacktree.scala @@ -121,7 +121,7 @@ package scala.collection.immutable.redblacktree { override type ModifyParm = Int override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size + 1) - override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = update(tree, generateKey(tree, parm), 0) + override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = update(tree, generateKey(tree, parm), 0, true) def generateKey(tree: Tree[String, Int], parm: ModifyParm): String = nodeAt(tree, parm) match { case Some((key, _)) => key.init.mkString + "MN" @@ -144,7 +144,7 @@ package scala.collection.immutable.redblacktree { override type ModifyParm = Int override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = nodeAt(tree, parm) map { - case (key, _) => update(tree, key, newValue) + case (key, _) => update(tree, key, newValue, true) } getOrElse tree property("update modifies values") = forAll(genInput) { case (tree, parm, newTree) => |