summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/lib/javac-artifacts.jar.desired.sha12
-rw-r--r--test/files/neg/classmanifests_new_deprecations.flags2
-rw-r--r--test/files/neg/for-comprehension-old.flags1
-rw-r--r--test/files/neg/macro-deprecate-idents.flags2
-rw-r--r--test/files/neg/macro-invalidshape-d.flags2
-rw-r--r--test/files/neg/names-defaults-neg.flags1
-rw-r--r--test/files/neg/t3614.check4
-rw-r--r--test/files/neg/t3995.check6
-rw-r--r--test/files/neg/t3995.scala32
-rw-r--r--test/files/neg/t5361.check4
-rw-r--r--test/files/neg/t5361.scala3
-rw-r--r--test/files/neg/t5390.check4
-rw-r--r--test/files/neg/t5390.scala10
-rw-r--r--test/files/neg/t5390b.check4
-rw-r--r--test/files/neg/t5390b.scala10
-rw-r--r--test/files/neg/t5390c.check4
-rw-r--r--test/files/neg/t5390c.scala10
-rw-r--r--test/files/neg/t5390d.check4
-rw-r--r--test/files/neg/t5390d.scala10
-rw-r--r--test/files/neg/t5589neg.flags1
-rw-r--r--test/files/neg/t5956.flags1
-rw-r--r--test/files/neg/t6788.check5
-rw-r--r--test/files/neg/t6788.scala7
-rw-r--r--test/files/neg/t6795.check4
-rw-r--r--test/files/neg/t6795.scala3
-rw-r--r--test/files/neg/t6829.check36
-rw-r--r--test/files/neg/t6829.scala64
-rw-r--r--test/files/pos/annotated-treecopy.check0
-rw-r--r--test/files/pos/annotated-treecopy.flags1
-rw-r--r--test/files/pos/annotated-treecopy/Impls_Macros_1.scala53
-rw-r--r--test/files/pos/annotated-treecopy/Test_2.scala5
-rw-r--r--test/files/pos/classtag-pos.flags1
-rw-r--r--test/files/pos/classtag-pos.scala5
-rw-r--r--test/files/pos/setter-not-implicit.flags1
-rw-r--r--test/files/pos/setter-not-implicit.scala3
-rw-r--r--test/files/pos/t5390.scala11
-rw-r--r--test/files/run/streams.check14
-rw-r--r--test/files/run/streams.scala20
-rw-r--r--test/files/run/t2544.check4
-rw-r--r--test/files/run/t2544.scala22
-rw-r--r--test/files/run/t6194.check1
-rw-r--r--test/files/run/t6194.scala8
-rw-r--r--test/files/run/t6548.check2
-rw-r--r--test/files/run/t6548.scala12
44 files changed, 383 insertions, 16 deletions
diff --git a/test/files/lib/javac-artifacts.jar.desired.sha1 b/test/files/lib/javac-artifacts.jar.desired.sha1
index 8dbbc1d451..a49c986386 100644
--- a/test/files/lib/javac-artifacts.jar.desired.sha1
+++ b/test/files/lib/javac-artifacts.jar.desired.sha1
@@ -1 +1 @@
-c5788c5e518eb267445c5a995fd98b2210f90a58 ?javac-artifacts.jar
+61931a51bb1a2d308d214b96d06e9a8808515dcf ?javac-artifacts.jar
diff --git a/test/files/neg/classmanifests_new_deprecations.flags b/test/files/neg/classmanifests_new_deprecations.flags
index e8fb65d50c..c6bfaf1f64 100644
--- a/test/files/neg/classmanifests_new_deprecations.flags
+++ b/test/files/neg/classmanifests_new_deprecations.flags
@@ -1 +1 @@
--Xfatal-warnings \ No newline at end of file
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/for-comprehension-old.flags b/test/files/neg/for-comprehension-old.flags
new file mode 100644
index 0000000000..dcc59ebe32
--- /dev/null
+++ b/test/files/neg/for-comprehension-old.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/test/files/neg/macro-deprecate-idents.flags b/test/files/neg/macro-deprecate-idents.flags
index e8fb65d50c..c6bfaf1f64 100644
--- a/test/files/neg/macro-deprecate-idents.flags
+++ b/test/files/neg/macro-deprecate-idents.flags
@@ -1 +1 @@
--Xfatal-warnings \ No newline at end of file
+-deprecation -Xfatal-warnings
diff --git a/test/files/neg/macro-invalidshape-d.flags b/test/files/neg/macro-invalidshape-d.flags
index cd66464f2f..83b7265eb9 100644
--- a/test/files/neg/macro-invalidshape-d.flags
+++ b/test/files/neg/macro-invalidshape-d.flags
@@ -1 +1 @@
--language:experimental.macros \ No newline at end of file
+-deprecation -language:experimental.macros
diff --git a/test/files/neg/names-defaults-neg.flags b/test/files/neg/names-defaults-neg.flags
new file mode 100644
index 0000000000..dcc59ebe32
--- /dev/null
+++ b/test/files/neg/names-defaults-neg.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/test/files/neg/t3614.check b/test/files/neg/t3614.check
index 0f9c83aa0d..81628ef37f 100644
--- a/test/files/neg/t3614.check
+++ b/test/files/neg/t3614.check
@@ -1,4 +1,4 @@
-t3614.scala:2: error: class type required but AnyRef{def a: Int} found
+t3614.scala:2: error: only declarations allowed here
def v = new ({ def a=0 })
- ^
+ ^
one error found
diff --git a/test/files/neg/t3995.check b/test/files/neg/t3995.check
new file mode 100644
index 0000000000..00ecf4ca5b
--- /dev/null
+++ b/test/files/neg/t3995.check
@@ -0,0 +1,6 @@
+t3995.scala:31: error: type mismatch;
+ found : String("")
+ required: _1.F0 where val _1: Lift
+ (new Lift).apply("")
+ ^
+one error found
diff --git a/test/files/neg/t3995.scala b/test/files/neg/t3995.scala
new file mode 100644
index 0000000000..b03617ac86
--- /dev/null
+++ b/test/files/neg/t3995.scala
@@ -0,0 +1,32 @@
+class Lift {
+ def apply(f: F0) {}
+
+ class F0
+ object F0 {
+ implicit def f2f0(fn: String): F0 = ???
+ }
+}
+
+object Test {
+ val l = new Lift
+ val f = ""
+
+ "": l.F0 // okay
+
+ l.apply("") // okay
+
+ {
+ val l = new Lift
+ l.apply("") // okay
+ }
+
+ // fails trying to mkAttributedQualifier for pre = Skolem(_1 <: Lift with Singletom).F0
+ // should this even have shown up in `companionImplicitMap`? It says that:
+ //
+ // "@return For those parts that refer to classes with companion objects that
+ // can be accessed with unambiguous stable prefixes, the implicits infos
+ // which are members of these companion objects."
+ //
+ // The skolem is stable, but it doen't seem much good to us
+ (new Lift).apply("")
+}
diff --git a/test/files/neg/t5361.check b/test/files/neg/t5361.check
new file mode 100644
index 0000000000..d7fee87ccd
--- /dev/null
+++ b/test/files/neg/t5361.check
@@ -0,0 +1,4 @@
+t5361.scala:2: error: only declarations allowed here
+ val x : { val self = this } = new { self => }
+ ^
+one error found
diff --git a/test/files/neg/t5361.scala b/test/files/neg/t5361.scala
new file mode 100644
index 0000000000..1705c09df3
--- /dev/null
+++ b/test/files/neg/t5361.scala
@@ -0,0 +1,3 @@
+class A {
+ val x : { val self = this } = new { self => }
+}
diff --git a/test/files/neg/t5390.check b/test/files/neg/t5390.check
new file mode 100644
index 0000000000..6a0129b898
--- /dev/null
+++ b/test/files/neg/t5390.check
@@ -0,0 +1,4 @@
+t5390.scala:7: error: forward reference extends over definition of value b
+ val b = a.B("")
+ ^
+one error found
diff --git a/test/files/neg/t5390.scala b/test/files/neg/t5390.scala
new file mode 100644
index 0000000000..dd628f8851
--- /dev/null
+++ b/test/files/neg/t5390.scala
@@ -0,0 +1,10 @@
+class A {
+ object B { def apply(s: String) = 0}
+}
+
+object X {
+ def foo {
+ val b = a.B("")
+ val a = new A
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t5390b.check b/test/files/neg/t5390b.check
new file mode 100644
index 0000000000..cbf8fafa6b
--- /dev/null
+++ b/test/files/neg/t5390b.check
@@ -0,0 +1,4 @@
+t5390b.scala:7: error: forward reference extends over definition of value b
+ val b = a.B("")
+ ^
+one error found
diff --git a/test/files/neg/t5390b.scala b/test/files/neg/t5390b.scala
new file mode 100644
index 0000000000..c3373b87d3
--- /dev/null
+++ b/test/files/neg/t5390b.scala
@@ -0,0 +1,10 @@
+class A {
+ case class B(s: String)
+}
+
+object X {
+ def foo {
+ val b = a.B("")
+ val a = new A
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t5390c.check b/test/files/neg/t5390c.check
new file mode 100644
index 0000000000..f8a794d690
--- /dev/null
+++ b/test/files/neg/t5390c.check
@@ -0,0 +1,4 @@
+t5390c.scala:7: error: forward reference extends over definition of value b
+ val b = new a.B("")
+ ^
+one error found
diff --git a/test/files/neg/t5390c.scala b/test/files/neg/t5390c.scala
new file mode 100644
index 0000000000..6b11576611
--- /dev/null
+++ b/test/files/neg/t5390c.scala
@@ -0,0 +1,10 @@
+class A {
+ case class B(s: String)
+}
+
+object X {
+ def foo {
+ val b = new a.B("")
+ val a = new A
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t5390d.check b/test/files/neg/t5390d.check
new file mode 100644
index 0000000000..daa29142e7
--- /dev/null
+++ b/test/files/neg/t5390d.check
@@ -0,0 +1,4 @@
+t5390d.scala:7: error: forward reference extends over definition of value b
+ val b = a.B.toString
+ ^
+one error found
diff --git a/test/files/neg/t5390d.scala b/test/files/neg/t5390d.scala
new file mode 100644
index 0000000000..7a2671b443
--- /dev/null
+++ b/test/files/neg/t5390d.scala
@@ -0,0 +1,10 @@
+class A {
+ case class B(s: String)
+}
+
+object X {
+ def foo {
+ val b = a.B.toString
+ val a = new A
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t5589neg.flags b/test/files/neg/t5589neg.flags
new file mode 100644
index 0000000000..dcc59ebe32
--- /dev/null
+++ b/test/files/neg/t5589neg.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/test/files/neg/t5956.flags b/test/files/neg/t5956.flags
new file mode 100644
index 0000000000..dcc59ebe32
--- /dev/null
+++ b/test/files/neg/t5956.flags
@@ -0,0 +1 @@
+-deprecation
diff --git a/test/files/neg/t6788.check b/test/files/neg/t6788.check
new file mode 100644
index 0000000000..96a6f8b601
--- /dev/null
+++ b/test/files/neg/t6788.check
@@ -0,0 +1,5 @@
+t6788.scala:6: error: not found: value foo
+Error occurred in an application involving default arguments.
+ s.copy(b = foo)
+ ^
+one error found
diff --git a/test/files/neg/t6788.scala b/test/files/neg/t6788.scala
new file mode 100644
index 0000000000..77949ed621
--- /dev/null
+++ b/test/files/neg/t6788.scala
@@ -0,0 +1,7 @@
+case class B[T](b: T, a: List[Int]) // need two args, B must be polymorphic
+
+class A {
+ var s: B[Int] = _ // has to be a var
+
+ s.copy(b = foo)
+}
diff --git a/test/files/neg/t6795.check b/test/files/neg/t6795.check
new file mode 100644
index 0000000000..88ef3e9a52
--- /dev/null
+++ b/test/files/neg/t6795.check
@@ -0,0 +1,4 @@
+t6795.scala:3: error: `abstract override' modifier not allowed for type members
+trait T1 extends T { abstract override type U = Int }
+ ^
+one error found
diff --git a/test/files/neg/t6795.scala b/test/files/neg/t6795.scala
new file mode 100644
index 0000000000..a523c89c82
--- /dev/null
+++ b/test/files/neg/t6795.scala
@@ -0,0 +1,3 @@
+trait T { type U }
+// "abstract override" shouldn't be allowed on types
+trait T1 extends T { abstract override type U = Int }
diff --git a/test/files/neg/t6829.check b/test/files/neg/t6829.check
new file mode 100644
index 0000000000..8ee6d182eb
--- /dev/null
+++ b/test/files/neg/t6829.check
@@ -0,0 +1,36 @@
+t6829.scala:35: error: type mismatch;
+ found : AgentSimulation.this.state.type (with underlying type G#State)
+ required: _10.State
+ lazy val actions: Map[G#Agent,G#Action] = agents.map(a => a -> a.chooseAction(state)).toMap
+ ^
+t6829.scala:45: error: trait AgentSimulation takes type parameters
+ pastHistory: List[G#State] = Nil) extends AgentSimulation
+ ^
+t6829.scala:47: error: class LearningSimulation takes type parameters
+ lazy val step: LearningSimulation = {
+ ^
+t6829.scala:49: error: not found: value actions
+ val (s,a,s2) = (state,actions(agent),nextState)
+ ^
+t6829.scala:49: error: not found: value nextState
+ val (s,a,s2) = (state,actions(agent),nextState)
+ ^
+t6829.scala:50: error: type mismatch;
+ found : s.type (with underlying type Any)
+ required: _54.State where val _54: G
+ val r = rewards(agent).r(s,a,s2)
+ ^
+t6829.scala:51: error: type mismatch;
+ found : s.type (with underlying type Any)
+ required: _51.State
+ agent.learn(s,a,s2,r): G#Agent
+ ^
+t6829.scala:53: error: not found: value nextState
+Error occurred in an application involving default arguments.
+ copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory)
+ ^
+t6829.scala:53: error: not found: value currentHistory
+Error occurred in an application involving default arguments.
+ copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory)
+ ^
+9 errors found
diff --git a/test/files/neg/t6829.scala b/test/files/neg/t6829.scala
new file mode 100644
index 0000000000..7cbe3c9542
--- /dev/null
+++ b/test/files/neg/t6829.scala
@@ -0,0 +1,64 @@
+package bugs
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: arya
+ * Date: 12/18/12
+ * Time: 4:17 PM
+ * To change this template use File | Settings | File Templates.
+ */
+object currenttype2 {
+
+ type Reward = Double
+
+ trait AbstractAgent[State,Action] {
+ type A = AbstractAgent[State,Action]
+ def chooseAction(s: State): Action
+ def startEpisode: A = this
+ def learn(s1: State, a: Action, s2: State, r: Reward): A
+ }
+
+ case class RewardFunction[State,Action](r: (State,Action,State) => Reward)
+
+ trait Rules[G<:GameDomain] {
+ def simulate(state: G#State, agentActions: List[(G#Agent,G#Action)]): G#State
+ }
+
+ trait AgentSimulation[G<:GameDomain] {
+ val agents: List[G#Agent]
+ val state: G#State
+ val rewards: Map[G#Agent,G#Rewards]
+ val rules: Rules[G]
+ val pastHistory: List[G#State]
+ lazy val currentHistory = state :: pastHistory
+
+ lazy val actions: Map[G#Agent,G#Action] = agents.map(a => a -> a.chooseAction(state)).toMap
+ lazy val nextState: G#State = rules.simulate(state, actions.toList)
+
+ def step: AgentSimulation[G]
+ }
+
+ case class LearningSimulation[G<:GameDomain](agents: List[G#Agent],
+ state: G#State,
+ rewards: Map[G#Agent,G#Rewards],
+ rules: Rules[G],
+ pastHistory: List[G#State] = Nil) extends AgentSimulation
+ {
+ lazy val step: LearningSimulation = {
+ val updatedAgents: List[G#Agent] = agents map { agent =>
+ val (s,a,s2) = (state,actions(agent),nextState)
+ val r = rewards(agent).r(s,a,s2)
+ agent.learn(s,a,s2,r): G#Agent
+ }
+ copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory)
+ }
+ }
+
+ trait GameDomain {
+ domain =>
+ type State
+ type Action
+ type Agent = AbstractAgent[State, Action] // agent supertype
+ type Rewards = RewardFunction[State,Action]
+ }
+ }
diff --git a/test/files/pos/annotated-treecopy.check b/test/files/pos/annotated-treecopy.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/annotated-treecopy.check
diff --git a/test/files/pos/annotated-treecopy.flags b/test/files/pos/annotated-treecopy.flags
new file mode 100644
index 0000000000..cd66464f2f
--- /dev/null
+++ b/test/files/pos/annotated-treecopy.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
new file mode 100644
index 0000000000..d92fbca380
--- /dev/null
+++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
@@ -0,0 +1,53 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+import collection.mutable.ListBuffer
+import collection.mutable.Stack
+
+object Macros {
+ trait TypedFunction {
+ def tree: scala.reflect.runtime.universe.Tree
+ val typeIn: String
+ val typeOut: String
+ }
+
+ def tree[T,U](f:Function1[T,U]): Function1[T,U] = macro tree_impl[T,U]
+
+ def tree_impl[T:c.WeakTypeTag,U:c.WeakTypeTag](c: Context)
+ (f:c.Expr[Function1[T,U]]): c.Expr[Function1[T,U]] = {
+ import c.universe._
+ val ttag = c.weakTypeTag[U]
+ f match {
+ case Expr(Function(List(ValDef(_,n,tp,_)),b)) =>
+ // normalize argument name
+ var b1 = new Transformer {
+ override def transform(tree: Tree): Tree = tree match {
+ case Ident(x) if (x==n) => Ident(newTermName("_arg"))
+ case tt @ TypeTree() if tt.original != null => TypeTree(tt.tpe) setOriginal transform(tt.original)
+ // without the fix to LazyTreeCopier.Annotated, we would need to uncomment the line below to make the macro work
+ // that's because the pattern match in the input expression gets expanded into Typed(<x>, TypeTree(<Int @unchecked>))
+ // with the original of the TypeTree being Annotated(<@unchecked>, Ident(<x>))
+ // then the macro tries to replace all Ident(<x>) trees with Ident(<_arg>), recurs into the original of the TypeTree, changes it,
+ // but leaves the <@unchecked> part untouched. this signals the misguided LazyTreeCopier that the Annotated tree hasn't been modified,
+ // so the original tree should be copied over and returned => crash when later <x: @unchecked> re-emerges from TypeTree.original
+ // case Annotated(annot, arg) => treeCopy.Annotated(tree, transform(annot).duplicate, transform(arg))
+ case _ => super.transform(tree)
+ }
+ }.transform(b)
+
+ val reifiedTree = c.reifyTree(treeBuild.mkRuntimeUniverseRef, EmptyTree, b1)
+ val reifiedExpr = c.Expr[scala.reflect.runtime.universe.Expr[T => U]](reifiedTree)
+ val template =
+ c.universe.reify(new (T => U) with TypedFunction {
+ override def toString = c.literal(tp+" => "+ttag.tpe+" { "+b1.toString+" } ").splice // DEBUG
+ def tree = reifiedExpr.splice.tree
+ val typeIn = c.literal(tp.toString).splice
+ val typeOut = c.literal(ttag.tpe.toString).splice
+ def apply(_arg: T): U = c.Expr[U](b1)(ttag.asInstanceOf[c.WeakTypeTag[U]]).splice
+ })
+ val untyped = c.resetLocalAttrs(template.tree)
+
+ c.Expr[T => U](untyped)
+ case _ => sys.error("Bad function type")
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/annotated-treecopy/Test_2.scala b/test/files/pos/annotated-treecopy/Test_2.scala
new file mode 100644
index 0000000000..836e0d888d
--- /dev/null
+++ b/test/files/pos/annotated-treecopy/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ import Macros._
+ // tree { (x:((Int,Int,Int),(Int,Int,Int))) => { val y=x; val ((r1,m1,c1),(r2,m2,c2))=y; (r1, m1 + m2 + r1 * c1 * c2, c2) } }
+ tree { (x:((Int,Int,Int),(Int,Int,Int))) => { val ((r1,m1,c1),(r2,m2,c2))=x; (r1, m1 + m2 + r1 * c1 * c2, c2) } }
+} \ No newline at end of file
diff --git a/test/files/pos/classtag-pos.flags b/test/files/pos/classtag-pos.flags
new file mode 100644
index 0000000000..281f0a10cd
--- /dev/null
+++ b/test/files/pos/classtag-pos.flags
@@ -0,0 +1 @@
+-Yrangepos
diff --git a/test/files/pos/classtag-pos.scala b/test/files/pos/classtag-pos.scala
new file mode 100644
index 0000000000..768d2e27f4
--- /dev/null
+++ b/test/files/pos/classtag-pos.scala
@@ -0,0 +1,5 @@
+import scala.reflect.runtime.universe._
+
+class A {
+ def f[T: TypeTag] = typeOf[T] match { case TypeRef(_, _, args) => args }
+}
diff --git a/test/files/pos/setter-not-implicit.flags b/test/files/pos/setter-not-implicit.flags
new file mode 100644
index 0000000000..792c40565b
--- /dev/null
+++ b/test/files/pos/setter-not-implicit.flags
@@ -0,0 +1 @@
+-feature -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/setter-not-implicit.scala b/test/files/pos/setter-not-implicit.scala
new file mode 100644
index 0000000000..9bfffc2ceb
--- /dev/null
+++ b/test/files/pos/setter-not-implicit.scala
@@ -0,0 +1,3 @@
+object O {
+ implicit var x: Int = 0
+}
diff --git a/test/files/pos/t5390.scala b/test/files/pos/t5390.scala
new file mode 100644
index 0000000000..36febb6a58
--- /dev/null
+++ b/test/files/pos/t5390.scala
@@ -0,0 +1,11 @@
+class A {
+ case class B[A](s: String)
+}
+
+object X {
+ def foo {
+ val a = new A
+ val b = new a.B[c.type]("") // not a forward reference
+ val c = ""
+ }
+} \ No newline at end of file
diff --git a/test/files/run/streams.check b/test/files/run/streams.check
index 7f894052d9..db6d2eebab 100644
--- a/test/files/run/streams.check
+++ b/test/files/run/streams.check
@@ -1,5 +1,8 @@
Stream()
Stream()
+true
+true
+true
Array(1)
Stream(1, ?)
@@ -8,12 +11,21 @@ Stream()
Stream()
Stream(1)
Stream()
+true
+true
+true
+true
Array(1, 2)
Stream(2)
Stream()
Stream(1, 2)
Stream()
+true
+true
+true
+true
+true
999
512
@@ -23,3 +35,5 @@ Stream(100001, ?)
true
true
705082704
+
+true
diff --git a/test/files/run/streams.scala b/test/files/run/streams.scala
index 51b4e5d76c..03b2622edd 100644
--- a/test/files/run/streams.scala
+++ b/test/files/run/streams.scala
@@ -2,6 +2,9 @@ object Test extends App {
val s0: Stream[Int] = Stream.empty
println(s0.take(1))
println(s0.takeWhile(_ > 0))
+ println(s0.lengthCompare(-5) > 0)
+ println(s0.lengthCompare(0) == 0)
+ println(s0.lengthCompare(5) < 0)
println
val s1 = Stream.cons(1, Stream.empty)
@@ -12,6 +15,10 @@ object Test extends App {
println(s1.drop(2))
println(s1.drop(-1))
println(s1.dropWhile(_ > 0))
+ println(s1.lengthCompare(-5) > 0)
+ println(s1.lengthCompare(0) > 0)
+ println(s1.lengthCompare(1) == 0)
+ println(s1.lengthCompare(5) < 0)
println
val s2 = s1.append(Stream.cons(2, Stream.empty))
@@ -20,6 +27,11 @@ object Test extends App {
println(s2.drop(2))
println(s2.drop(-1))
println(s2.dropWhile(_ > 0))
+ println(s2.lengthCompare(-5) > 0)
+ println(s2.lengthCompare(0) > 0)
+ println(s2.lengthCompare(1) > 0)
+ println(s2.lengthCompare(2) == 0)
+ println(s2.lengthCompare(5) < 0)
println
val s3 = Stream.range(1, 1000) //100000 (ticket #153: Stackoverflow)
@@ -43,4 +55,12 @@ object Test extends App {
println(Stream.from(1).take(size).foldLeft(0)(_ + _))
val arr = new Array[Int](size)
Stream.from(1).take(size).copyToArray(arr, 0)
+
+ println
+
+ // ticket #6415
+ lazy val x = { println("evaluated"); 1 }
+ val s4 = 0 #:: x #:: Stream.empty
+
+ println(s4.isDefinedAt(0))
}
diff --git a/test/files/run/t2544.check b/test/files/run/t2544.check
index 716b146ac4..d19538dca3 100644
--- a/test/files/run/t2544.check
+++ b/test/files/run/t2544.check
@@ -2,8 +2,8 @@
2
3
3
--2
--2
+-1
+-1
1
1
0
diff --git a/test/files/run/t2544.scala b/test/files/run/t2544.scala
index 7e7cfeb357..6bee2f1082 100644
--- a/test/files/run/t2544.scala
+++ b/test/files/run/t2544.scala
@@ -1,19 +1,25 @@
object Test {
object Foo extends Seq[Int] {
def apply(i: Int) = i
- def length = 4
+ def length = 5
def iterator = Iterator(0,1,2,3,4)
}
+ def lengthEquiv(result: Int) = println(
+ if (result < 0) -1
+ else if (result == 0) 0
+ else 1
+ )
+
def main(args: Array[String]) = {
println(Foo indexWhere(_ >= 2,1))
println(Foo.toList indexWhere(_ >= 2,1))
println(Foo segmentLength(_ <= 3,1))
println(Foo.toList segmentLength(_ <= 3,1))
- println(Foo lengthCompare 7)
- println(Foo.toList lengthCompare 7)
- println(Foo lengthCompare 2)
- println(Foo.toList lengthCompare 2)
- println(Foo lengthCompare 5)
- println(Foo.toList lengthCompare 5)
+ lengthEquiv(Foo lengthCompare 7)
+ lengthEquiv(Foo.toList lengthCompare 7)
+ lengthEquiv(Foo lengthCompare 2)
+ lengthEquiv(Foo.toList lengthCompare 2)
+ lengthEquiv(Foo lengthCompare 5)
+ lengthEquiv(Foo.toList lengthCompare 5)
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/t6194.check b/test/files/run/t6194.check
new file mode 100644
index 0000000000..b325f479d7
--- /dev/null
+++ b/test/files/run/t6194.check
@@ -0,0 +1 @@
+C:\FooBar\Java\includes\*.jar
diff --git a/test/files/run/t6194.scala b/test/files/run/t6194.scala
new file mode 100644
index 0000000000..ced3259427
--- /dev/null
+++ b/test/files/run/t6194.scala
@@ -0,0 +1,8 @@
+import scala.tools.nsc.util._
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val cp = ClassPath.expandPath("""C:\FooBar\Java\includes\*.jar""") mkString java.io.File.pathSeparator
+ println(cp)
+ }
+}
diff --git a/test/files/run/t6548.check b/test/files/run/t6548.check
new file mode 100644
index 0000000000..e82cae110a
--- /dev/null
+++ b/test/files/run/t6548.check
@@ -0,0 +1,2 @@
+false
+List(JavaAnnotationWithNestedEnum(value = VALUE))
diff --git a/test/files/run/t6548.scala b/test/files/run/t6548.scala
new file mode 100644
index 0000000000..be3eb5b932
--- /dev/null
+++ b/test/files/run/t6548.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+class Bean {
+ @JavaAnnotationWithNestedEnum(JavaAnnotationWithNestedEnum.Value.VALUE)
+ def value = 1
+}
+
+object Test extends App {
+ println(cm.staticClass("Bean").isCaseClass)
+ println(typeOf[Bean].declaration(newTermName("value")).annotations)
+}