summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bitsets.check4
-rw-r--r--test/files/run/bitsets.scala14
-rw-r--r--test/files/run/macro-expand-nullary-generic.check10
-rw-r--r--test/files/run/macro-expand-tparams-explicit.check2
-rw-r--r--test/files/run/macro-expand-tparams-implicit.check2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-a.check6
-rw-r--r--test/files/run/macro-expand-tparams-prefix-b.check4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c1.check4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c2.check4
-rw-r--r--test/files/run/macro-expand-tparams-prefix-d1.check2
-rw-r--r--test/files/run/macro-undetparams-consfromsls.check6
-rw-r--r--test/files/run/macro-undetparams-macroitself.check2
-rw-r--r--test/files/run/reify-each-node-type.check35
-rw-r--r--test/files/run/reify-each-node-type.scala108
-rw-r--r--test/files/run/t6387.check1
-rw-r--r--test/files/run/t6387.scala16
-rw-r--r--test/files/run/t6937.check26
-rw-r--r--test/files/run/t6937.scala12
-rw-r--r--test/files/run/t7319.check38
-rw-r--r--test/files/run/t7319.scala13
-rw-r--r--test/files/run/t7337.check1
-rw-r--r--test/files/run/t7337.scala19
-rw-r--r--test/files/run/t7341.check0
-rwxr-xr-xtest/files/run/t7341.flags1
-rwxr-xr-xtest/files/run/t7341.scala15
25 files changed, 307 insertions, 38 deletions
diff --git a/test/files/run/bitsets.check b/test/files/run/bitsets.check
index 41c2ccdcb8..9bbc769b72 100644
--- a/test/files/run/bitsets.check
+++ b/test/files/run/bitsets.check
@@ -42,6 +42,10 @@ b2:BitSet(5)
b3:BitSet(5, 7)
b4:BitSet(7)
b0:BitSet(5, 6, 7)
+bMax:BitSet(2147483647)
+2147483647
+bLarge:BitSet(2000000001)
+false
is0 = BitSet()
is1 = BitSet()
is2 = BitSet(2)
diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala
index d55f9e4e83..c88782cab7 100644
--- a/test/files/run/bitsets.scala
+++ b/test/files/run/bitsets.scala
@@ -115,6 +115,19 @@ object TestMutable3 {
println(s"b0:$b0")
}
+object TestMutable4 {
+ import scala.collection.mutable.BitSet
+
+ val bMax = BitSet(Int.MaxValue)
+ println(s"bMax:$bMax")
+ bMax.foreach(println)
+
+ val bLarge = BitSet(2000000001)
+ println(s"bLarge:$bLarge")
+
+ println(bMax == bLarge)
+}
+
object TestImmutable {
import scala.collection.immutable.BitSet
@@ -190,6 +203,7 @@ object Test extends App {
TestMutable
TestMutable2
TestMutable3
+ TestMutable4
TestImmutable
TestImmutable2
}
diff --git a/test/files/run/macro-expand-nullary-generic.check b/test/files/run/macro-expand-nullary-generic.check
index 133840c469..42976f4baf 100644
--- a/test/files/run/macro-expand-nullary-generic.check
+++ b/test/files/run/macro-expand-nullary-generic.check
@@ -1,6 +1,6 @@
-it works TypeTag[Int]
-it works TypeTag[Int]
-it works TypeTag[Int]
-it works TypeTag[Int]
-it works TypeTag[Int]
+it works WeakTypeTag[Int]
+it works WeakTypeTag[Int]
+it works WeakTypeTag[Int]
+it works WeakTypeTag[Int]
+it works WeakTypeTag[Int]
kkthxbai
diff --git a/test/files/run/macro-expand-tparams-explicit.check b/test/files/run/macro-expand-tparams-explicit.check
index e7e6718406..b6b4f6fa3a 100644
--- a/test/files/run/macro-expand-tparams-explicit.check
+++ b/test/files/run/macro-expand-tparams-explicit.check
@@ -1 +1 @@
-TypeTag[Int]
+WeakTypeTag[Int]
diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check
index fa6b335afb..a9bf55423e 100644
--- a/test/files/run/macro-expand-tparams-implicit.check
+++ b/test/files/run/macro-expand-tparams-implicit.check
@@ -1,2 +1,2 @@
-TypeTag[Int]
+WeakTypeTag[Int]
WeakTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check
index 0bf3c55bbe..ca44a4f652 100644
--- a/test/files/run/macro-expand-tparams-prefix-a.check
+++ b/test/files/run/macro-expand-tparams-prefix-a.check
@@ -1,4 +1,4 @@
-TypeTag[Int]
-TypeTag[Int]
+WeakTypeTag[Int]
+WeakTypeTag[Int]
WeakTypeTag[String]
-TypeTag[Boolean]
+WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check
index 77c2ee9051..2ff2ce435d 100644
--- a/test/files/run/macro-expand-tparams-prefix-b.check
+++ b/test/files/run/macro-expand-tparams-prefix-b.check
@@ -1,2 +1,2 @@
-TypeTag[Boolean] TypeTag[Int]
-TypeTag[Boolean] WeakTypeTag[String]
+WeakTypeTag[Boolean] WeakTypeTag[Int]
+WeakTypeTag[Boolean] WeakTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check
index f0dd5b9cd8..0f24f74db1 100644
--- a/test/files/run/macro-expand-tparams-prefix-c1.check
+++ b/test/files/run/macro-expand-tparams-prefix-c1.check
@@ -1,3 +1,3 @@
-TypeTag[Int]
+WeakTypeTag[Int]
WeakTypeTag[String]
-TypeTag[Boolean]
+WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check
index f0dd5b9cd8..0f24f74db1 100644
--- a/test/files/run/macro-expand-tparams-prefix-c2.check
+++ b/test/files/run/macro-expand-tparams-prefix-c2.check
@@ -1,3 +1,3 @@
-TypeTag[Int]
+WeakTypeTag[Int]
WeakTypeTag[String]
-TypeTag[Boolean]
+WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check
index c5aaaf5a09..7832503256 100644
--- a/test/files/run/macro-expand-tparams-prefix-d1.check
+++ b/test/files/run/macro-expand-tparams-prefix-d1.check
@@ -1,3 +1,3 @@
WeakTypeTag[T]
WeakTypeTag[U]
-TypeTag[Boolean]
+WeakTypeTag[Boolean]
diff --git a/test/files/run/macro-undetparams-consfromsls.check b/test/files/run/macro-undetparams-consfromsls.check
index b10a90043e..3fee58d9c1 100644
--- a/test/files/run/macro-undetparams-consfromsls.check
+++ b/test/files/run/macro-undetparams-consfromsls.check
@@ -1,5 +1,5 @@
-A = TypeTag[Int]
-B = TypeTag[Nothing]
+A = WeakTypeTag[Int]
+B = WeakTypeTag[Nothing]
List(1)
-A = TypeTag[Any]
+A = WeakTypeTag[Any]
List(abc, 1)
diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check
index fa6b335afb..a9bf55423e 100644
--- a/test/files/run/macro-undetparams-macroitself.check
+++ b/test/files/run/macro-undetparams-macroitself.check
@@ -1,2 +1,2 @@
-TypeTag[Int]
+WeakTypeTag[Int]
WeakTypeTag[String]
diff --git a/test/files/run/reify-each-node-type.check b/test/files/run/reify-each-node-type.check
new file mode 100644
index 0000000000..af6fd13a7b
--- /dev/null
+++ b/test/files/run/reify-each-node-type.check
@@ -0,0 +1,35 @@
+ 1 s Ident
+ 2 r.List Select
+ 3 r.List.apply() Apply
+ 4 r.List.apply(1) Literal
+ 5 r.List.apply[Int]() TypeApply
+ 6 (1: Int) Typed
+ 7 (null: r.List[Int]) AppliedTypeTree
+ 8 { (); () } Block
+ 9 { val x: Int = 0; () } ValDef
+10 { val x = 0; () } TypeTree
+11 if (true) () else () If
+12 { def f: Unit = (); () } DefDef
+13 { def m = NN.super.q; () } Super
+14 { abstract trait A extends AnyRef; () } ClassDef Template
+15 { def f(x: Any): Unit = (); () } EmptyTree
+16 (null: r.D with r.E) CompoundTypeTree
+17 { type T = Int; () } TypeDef
+18 { type CC[T >: Nothing <: r.D] = r.C[T]; () } TypeBoundsTree
+19 try { 0 } finally Predef.println("") Try
+20 ((x: Int) => x) Function
+21 { var v = 1; v = 2 } Assign
+22 { class A extends AnyRef { def <init>() = { super.<init>(); This
+23 new r.List[Int]() New
+24 0: @unchecked Annotated
+25 (null: r.Outer#Inner) SelectFromTypeTree
+26 (null: Nil.type) SingletonTypeTree
+27 (null: T forSome { type T >: Nothing <: Any }) ExistentialTypeTree
+28 { import r.{A, B=>C}; () } Import
+29 { def f: Int = return 0; () } Return
+30 { object x extends AnyRef { def <init>() = { super.<init>(); ModuleDef
+31 throw new Exception() Throw
+32 0 match { case _ => 0 } Match CaseDef
+33 0 match { case (1| 2) => 0 } Alternative
+34 NN.q match { case (x @ r.List) => 0 } Bind
+35 NN.q match { case r.UnSeq(1, (_)*) => 0 } Star
diff --git a/test/files/run/reify-each-node-type.scala b/test/files/run/reify-each-node-type.scala
new file mode 100644
index 0000000000..a827da766d
--- /dev/null
+++ b/test/files/run/reify-each-node-type.scala
@@ -0,0 +1,108 @@
+import scala.reflect.runtime.universe._
+
+object r {
+ class A
+ class B
+ class List[+A]
+ object List { def apply[A](xs: A*): List[A] = new List[A] }
+ object Nil extends List[Nothing]
+
+ trait OuterP[A] {
+ trait Inner
+ trait InnerP[B]
+ }
+ trait Outer {
+ trait Inner
+ trait InnerP[B]
+ }
+ object Un { def unapply(x: Any) = Some(5) }
+ object UnSeq { def unapplySeq(x: Any) = Some(Seq(5)) }
+ class C[T]
+ class D
+ trait E
+
+ trait SN {
+ def q: Any = null
+ }
+}
+
+object s {
+ import r._
+
+ trait NN extends SN {
+ def act[T](expr: Expr[T]): Unit
+
+ act(reify { s /* Ident */ })
+ act(reify { r.List /* Select */ })
+ act(reify { List() /* Apply */ })
+ act(reify { List(1) /* Literal */ })
+ act(reify { List[Int]() /* TypeApply */ })
+ act(reify { 1: Int /* Typed */ })
+ act(reify { null: List[Int] /* AppliedTypeTree */ })
+ act(reify { () ; () /* Block */ })
+ act(reify { val x: Int = 0 /* ValDef */ })
+ act(reify { val x = 0 /* TypeTree */ })
+ act(reify { if (true) () /* If */ })
+ act(reify { def f { } /* DefDef */ })
+ act(reify { def m = super.q /* Super */ })
+ act(reify { trait A /* ClassDef Template */ })
+ act(reify { def f(x: Any) { } /* EmptyTree */ })
+ act(reify { null: D with E /* CompoundTypeTree */ })
+ act(reify { type T = Int /* TypeDef */ })
+ act(reify { type CC[T <: D] = C[T] /* TypeBoundsTree */ })
+ act(reify { try 0 finally println("") /* Try */ })
+ act(reify { (x: Int) => x /* Function */ })
+ act(reify { var v = 1 ; v = 2 /* Assign */ })
+ act(reify { class A() { def this(x: A) = this() } /* This */ })
+ act(reify { new List[Int] /* New */ })
+ act(reify { 0: @unchecked /* Annotated */ })
+ act(reify { null: Outer#Inner /* SelectFromTypeTree */ })
+ act(reify { null: Nil.type /* SingletonTypeTree */ })
+ act(reify { null: (T forSome { type T }) /* ExistentialTypeTree */ })
+ act(reify { import r.{ A, B => C }; /* Import */ })
+ act(reify { def f: Int = return 0 /* Return */ })
+ act(reify { object x /* ModuleDef */ })
+ act(reify { throw new java.lang.Exception /* Throw */ })
+ act(reify { 0 match { case _ => 0 } /* Match CaseDef */ })
+ act(reify { 0 match { case 1 | 2 => 0 } /* Alternative */ })
+ act(reify { q match { case x @ List => 0 } /* Bind */ })
+ act(reify { q match { case UnSeq(1, _*) => 0 } /* Star */ })
+
+ // ``unexpected: bound type that doesn't have a tpe: Ident(newTypeName("Int"))''
+ // act(reify { r.List[T forSome { type T <: Int }]() }) // Was crashing , no longer
+ //
+ // error: exception during macro expansion:
+ // scala.MatchError: collection.this.Seq.unapplySeq[A] (of class scala.reflect.internal.Trees$TypeApply)
+ // at scala.reflect.reify.phases.Reshape$$anon$1.extractExtractor$1(Reshape.scala:73)
+ // at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:82)
+ // at scala.reflect.reify.phases.Reshape$$anon$1.transform(Reshape.scala:24)
+ // at scala.reflect.internal.Trees$class.itransform(Trees.scala:1290)
+ //
+ // act(reify { r.List[Any]() match { case Seq(1, _*) => 1 } } )
+
+ // act(reify { List[OuterP[Int]#InnerP[Byte]]() })
+ //
+ // SI-7243
+ //
+ // test/files/run/reify-each-node-type.scala:85: error: Cannot materialize r.List.apply[r.OuterP[Int]#InnerP[Byte]]() as { ... } because:
+ // scala.reflect.macros.TypecheckException: value TypeTreeWithDeferredRefCheck is not a member of type parameter U
+ // act(reify { List[OuterP[Int]#InnerP[Byte]]() })
+ // ^
+ // one error found
+ }
+}
+
+object Test {
+ var idx = 0
+ val seen = scala.collection.mutable.Set[String]()
+
+ object N extends s.NN {
+ def act[T](expr: Expr[T]): Unit = {
+ idx += 1
+ val ts = expr.tree filter (_ => true) map (_.getClass.getName split "[.$]" last) filterNot seen distinct;
+ println("%2d %60s %s".format(idx, expr.tree.toString.replaceAll("""\s+""", " ").take(60), ts mkString " "))
+ seen ++= ts
+ }
+ }
+ def main(args: Array[String]): Unit = N
+}
diff --git a/test/files/run/t6387.check b/test/files/run/t6387.check
deleted file mode 100644
index 83b33d238d..0000000000
--- a/test/files/run/t6387.check
+++ /dev/null
@@ -1 +0,0 @@
-1000
diff --git a/test/files/run/t6387.scala b/test/files/run/t6387.scala
deleted file mode 100644
index bbebb5f511..0000000000
--- a/test/files/run/t6387.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-trait A {
- def foo: Long
-}
-
-object Test {
- def a(): A = new A {
- var foo: Long = 1000L
-
- val test = () => {
- foo = 28
- }
- }
- def main(args: Array[String]) {
- println(a().foo)
- }
-}
diff --git a/test/files/run/t6937.check b/test/files/run/t6937.check
new file mode 100644
index 0000000000..9a1fa4cfaf
--- /dev/null
+++ b/test/files/run/t6937.check
@@ -0,0 +1,26 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{universe=>ru}
+
+scala> import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.runtime.{currentMirror=>cm}
+
+scala> import scala.reflect.api.{Universe => ApiUniverse}
+import scala.reflect.api.{Universe=>ApiUniverse}
+
+scala> class A
+defined class A
+
+scala> lazy val apiru = ru: ApiUniverse
+apiru: scala.reflect.api.Universe = <lazy>
+
+scala> apiru.typeTag[A].in(cm)
+res0: reflect.runtime.universe.TypeTag[A] = TypeTag[A]
+
+scala>
+
+scala>
diff --git a/test/files/run/t6937.scala b/test/files/run/t6937.scala
new file mode 100644
index 0000000000..4b30894bf3
--- /dev/null
+++ b/test/files/run/t6937.scala
@@ -0,0 +1,12 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+ import scala.reflect.runtime.{universe => ru}
+ import scala.reflect.runtime.{currentMirror => cm}
+ import scala.reflect.api.{Universe => ApiUniverse}
+ class A
+ lazy val apiru = ru: ApiUniverse
+ apiru.typeTag[A].in(cm)
+ """
+} \ No newline at end of file
diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check
new file mode 100644
index 0000000000..966736915e
--- /dev/null
+++ b/test/files/run/t7319.check
@@ -0,0 +1,38 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> class M[A]
+defined class M
+
+scala> implicit def ma0[A](a: A): M[A] = null
+warning: there were 1 feature warning(s); re-run with -feature for details
+ma0: [A](a: A)M[A]
+
+scala> implicit def ma1[A](a: A): M[A] = null
+warning: there were 1 feature warning(s); re-run with -feature for details
+ma1: [A](a: A)M[A]
+
+scala> def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0
+warning: there were 1 feature warning(s); re-run with -feature for details
+convert: [F[X <: F[X]]](builder: F[_ <: F[_]])Int
+
+scala> convert(Some[Int](0))
+<console>:12: error: no type parameters for method convert: (builder: F[_ <: F[_]])Int exist so that it can be applied to arguments (Some[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : Some[Int]
+ required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
+ convert(Some[Int](0))
+ ^
+<console>:12: error: type mismatch;
+ found : Some[Int]
+ required: F[_ <: F[_]]
+ convert(Some[Int](0))
+ ^
+
+scala> 0
+res1: Int = 0
+
+scala>
diff --git a/test/files/run/t7319.scala b/test/files/run/t7319.scala
new file mode 100644
index 0000000000..23ffeb977d
--- /dev/null
+++ b/test/files/run/t7319.scala
@@ -0,0 +1,13 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ // so we can provide the ambiguities, rather than relying in Predef implicits
+ override def extraSettings = "-Yno-predef"
+ override def code = """
+class M[A]
+implicit def ma0[A](a: A): M[A] = null
+implicit def ma1[A](a: A): M[A] = null
+def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0
+convert(Some[Int](0))
+0""" // before the fix, this line, and all that followed, re-issued the implicit ambiguity error.
+}
diff --git a/test/files/run/t7337.check b/test/files/run/t7337.check
new file mode 100644
index 0000000000..dd2b31f23c
--- /dev/null
+++ b/test/files/run/t7337.check
@@ -0,0 +1 @@
+doesnotexist does not exist or is not a directory
diff --git a/test/files/run/t7337.scala b/test/files/run/t7337.scala
new file mode 100644
index 0000000000..d878182ed0
--- /dev/null
+++ b/test/files/run/t7337.scala
@@ -0,0 +1,19 @@
+import scala.tools.partest._
+import scala.tools.nsc._
+import util.{CommandLineParser}
+
+object Test extends DirectTest {
+ override def code = "class C"
+ override def newCompiler(args: String*): Global = {
+ val settings = newSettings((CommandLineParser tokenize ("-d doesnotexist " + extraSettings)) ++ args.toList)
+ newCompiler(settings)
+ }
+
+ override def show() {
+ try {
+ newCompiler()
+ } catch {
+ case fe: FatalError => println(fe.getMessage)
+ }
+ }
+}
diff --git a/test/files/run/t7341.check b/test/files/run/t7341.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/t7341.check
diff --git a/test/files/run/t7341.flags b/test/files/run/t7341.flags
new file mode 100755
index 0000000000..ae08446055
--- /dev/null
+++ b/test/files/run/t7341.flags
@@ -0,0 +1 @@
+-Xcheckinit \ No newline at end of file
diff --git a/test/files/run/t7341.scala b/test/files/run/t7341.scala
new file mode 100755
index 0000000000..dc526c6c19
--- /dev/null
+++ b/test/files/run/t7341.scala
@@ -0,0 +1,15 @@
+object Obj {
+ private var cache: Any = ()
+ def returning(f: () => Unit) = ()
+ def foo {
+ returning(() => cache = ())
+ }
+
+ def apply(): Any = {
+ cache
+ }
+}
+
+object Test extends App {
+ Obj()
+}