diff options
Diffstat (limited to 'test/pending')
57 files changed, 554 insertions, 365 deletions
diff --git a/test/pending/neg/dbldef.check b/test/pending/neg/dbldef.check deleted file mode 100644 index 3ee63475e4..0000000000 --- a/test/pending/neg/dbldef.check +++ /dev/null @@ -1,14 +0,0 @@ -dbldef.scala:1: error: x is already defined as value x -case class test0(x: Int, x: Float) - ^ -dbldef.scala:1: error: type mismatch; - found : Float - required: Int -case class test0(x: Int, x: Float) - ^ -dbldef.scala:1: error: type mismatch; - found : Float - required: Int -case class test0(x: Int, x: Float) - ^ -three errors found diff --git a/test/pending/neg/dbldef.scala b/test/pending/neg/dbldef.scala deleted file mode 100644 index c70fb97b2c..0000000000 --- a/test/pending/neg/dbldef.scala +++ /dev/null @@ -1 +0,0 @@ -case class test0(x: Int, x: Float) diff --git a/test/pending/neg/t1557.scala b/test/pending/neg/t1557.scala new file mode 100644 index 0000000000..ba93b45fad --- /dev/null +++ b/test/pending/neg/t1557.scala @@ -0,0 +1,18 @@ +object Test extends App { + trait A + trait B extends A + + trait C { + trait D { type T >: B <: A } + val y: (D with this.type)#T = new B { } + } + + class D extends C { + trait E + type T = E + def frob(arg : E) : E = arg + frob(y) + } + + new D +}
\ No newline at end of file diff --git a/test/pending/neg/t2066.scala b/test/pending/neg/t2066.scala new file mode 100644 index 0000000000..46177b19f7 --- /dev/null +++ b/test/pending/neg/t2066.scala @@ -0,0 +1,16 @@ +object Test extends App { + trait A { + def f[T[_]](x : T[Int]) : T[Any] + } + + class B extends A { + def f[T[+_]](x : T[Int]) : T[Any] = x + } + + class P[Y](var y : Y) + + val p = new P(1) + val palias = (new B():A).f[P](p) + palias.y = "hello" + val z: Int = p.y +}
\ No newline at end of file diff --git a/test/pending/neg/t5378.scala b/test/pending/neg/t5378.scala new file mode 100644 index 0000000000..cada29b0a0 --- /dev/null +++ b/test/pending/neg/t5378.scala @@ -0,0 +1,19 @@ +import language.reflectiveCalls + +class Coll[+T] { + def contains = new { def apply[T1 <: T](value: T1) = ??? } +} + +object Test { + def main(args: Array[String]): Unit = { + val xs = new Coll[List[String]] + val ys: Coll[Traversable[String]] = xs + + println(ys contains Nil) + // java.lang.NoSuchMethodException: Coll$$anon$1.apply(scala.collection.Traversable) + // at java.lang.Class.getMethod(Class.java:1605) + // at Test$.reflMethod$Method1(a.scala:14) + // at Test$.main(a.scala:14) + // at Test.main(a.scala) + } +} diff --git a/test/pending/neg/t5618.check b/test/pending/neg/t5618.check new file mode 100644 index 0000000000..118e812ae4 --- /dev/null +++ b/test/pending/neg/t5618.check @@ -0,0 +1,7 @@ +t5618.scala:12: error: could not find implicit value for parameter class1: Class1 + val class2 = new Class2 + ^ +t5618.scala:18: error: could not find implicit value for parameter class1: Class1 + val class2 = new Class2 + ^ +two errors found
\ No newline at end of file diff --git a/test/pending/neg/t5618.scala b/test/pending/neg/t5618.scala new file mode 100644 index 0000000000..66e06787f1 --- /dev/null +++ b/test/pending/neg/t5618.scala @@ -0,0 +1,27 @@ + + + + +case class Class1 + + +case class Class2(implicit class1: Class1) + + +object Test1 { + val class2 = new Class2 + implicit val class1 = new Class1 +} + + +object Test2 { + val class2 = new Class2 + implicit val class1: Class1 = new Class1 +} + + +object Test3 { + implicit val class1 = new Class1 + val class2 = new Class2 +} + diff --git a/test/pending/pos/no-widen-locals.scala b/test/pending/pos/no-widen-locals.scala deleted file mode 100644 index 013e63f0a2..0000000000 --- a/test/pending/pos/no-widen-locals.scala +++ /dev/null @@ -1,19 +0,0 @@ -// Worked from r23262 until that was reverted somewhere -// around r25016. -import annotation.switch - -object Test { - def f(x: Int) = { - val X1 = 5 - val X2 = 10 - val X3 = 15 - val X4 = 20 - - (x: @switch) match { - case X1 => 1 - case X2 => 2 - case X3 => 3 - case X4 => 4 - } - } -} diff --git a/test/pending/pos/t1357.scala b/test/pending/pos/t1357.scala deleted file mode 100644 index 7bc6d45034..0000000000 --- a/test/pending/pos/t1357.scala +++ /dev/null @@ -1,21 +0,0 @@ -object NonEmptyCons { - def unapply[H, T](c: (H, T)): Option[(H, T)] = Some(c) -} - - -object Main { - - type BT[+H, +T <: Tuple2[Tuple2[H, T], Tuple2[H, T]]] = Tuple2[H, T] - - // type T = Tuple2[String,String] - type BinaryTree[+E] = BT[E, T forSome { type T <: Tuple2[BT[E, T], BT[E, T]] }] - - def foo[E](tree: BinaryTree[E]): Unit = tree match { - case NonEmptyCons(_, tail) => { - tail match { - case NonEmptyCons(_, _) => { - } - } - } - } -}
\ No newline at end of file diff --git a/test/pending/pos/t4683.scala b/test/pending/pos/t4683.scala new file mode 100644 index 0000000000..7af7024159 --- /dev/null +++ b/test/pending/pos/t4683.scala @@ -0,0 +1,11 @@ + + + + +class DelayedInitTest { + def a = () + class B extends DelayedInit { + a + def delayedInit(body: => Unit) = () + } +} diff --git a/test/pending/pos/t5399.scala b/test/pending/pos/t5399.scala index d8c1d5e51c..89caba39c1 100644 --- a/test/pending/pos/t5399.scala +++ b/test/pending/pos/t5399.scala @@ -1,15 +1,8 @@ class Test { - type AnyCyclic = Execute[Task]#CyclicException[_] + class A[T] + class B[T](val a: A[T]) - trait Task[T] + case class CaseClass[T](x: T) - trait Execute[A[_] <: AnyRef] { - class CyclicException[T](val caller: A[T], val target: A[T]) - } - - def convertCyclic(c: AnyCyclic): String = - (c.caller, c.target) match { - case (caller: Task[_], target: Task[_]) => "bazinga!" - } + def break(existB: B[_]) = CaseClass(existB.a) match { case CaseClass(_) => } } - diff --git a/test/pending/pos/t5399a.scala b/test/pending/pos/t5399a.scala new file mode 100644 index 0000000000..4ebd85ad03 --- /dev/null +++ b/test/pending/pos/t5399a.scala @@ -0,0 +1,19 @@ +class Foo { + trait Init[T] + class ScopedKey[T] extends Init[T] + + trait Setting[T] { + val key: ScopedKey[T] + } + + case class ScopedKey1[T](val foo: Init[T]) extends ScopedKey[T] + + val scalaHome: Setting[Option[String]] = null + val scalaVersion: Setting[String] = null + + def testPatternMatch(s: Setting[_]) { + s.key match { + case ScopedKey1(scalaHome.key | scalaVersion.key) => () + } + } +} diff --git a/test/pending/pos/t5503.flags b/test/pending/pos/t5503.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/pending/pos/t5503.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/pending/pos/t5503.scala b/test/pending/pos/t5503.scala new file mode 100644 index 0000000000..8a1925df1f --- /dev/null +++ b/test/pending/pos/t5503.scala @@ -0,0 +1,18 @@ +trait A { + type Type + type MethodType <: Type + + val MethodType: MethodTypeExtractor = null + + abstract class MethodTypeExtractor { + def unapply(tpe: MethodType): Option[(Any, Any)] + } +} + +object Test { + val a: A = null + + def foo(tpe: a.Type) = tpe match { + case a.MethodType(_, _) => + } +}
\ No newline at end of file diff --git a/test/pending/pos/t5521.scala b/test/pending/pos/t5521.scala new file mode 100644 index 0000000000..dc025d0945 --- /dev/null +++ b/test/pending/pos/t5521.scala @@ -0,0 +1,3 @@ +class Foo { type Bar } + +class Quux(val foo: Foo)(val bar: foo.Bar)
\ No newline at end of file diff --git a/test/pending/pos/t5534.scala b/test/pending/pos/t5534.scala new file mode 100644 index 0000000000..834c4fd68d --- /dev/null +++ b/test/pending/pos/t5534.scala @@ -0,0 +1,11 @@ +object Phrase extends Enumeration { + type Phrase = Value + val PHRASE1 = Value("My phrase 1") + val PHRASE2 = Value("My phrase 2") +} + +class Entity(text:String) + +object Test { + val myMapWithPhrases = Phrase.values.map(p => (p -> new Entity(p.toString))).toMap +}
\ No newline at end of file diff --git a/test/pending/pos/t5559.scala b/test/pending/pos/t5559.scala new file mode 100644 index 0000000000..586e52cd4f --- /dev/null +++ b/test/pending/pos/t5559.scala @@ -0,0 +1,23 @@ + + + + +object Test { + + class Inv[T] + + def foo[S](interface: Inv[_ >: S], implementation: Inv[S]) {} + + def bar[R, T <: R](interface: Inv[R], impl: Inv[T]) { + //foo[T](interface, impl) + foo(interface, impl) // Compilation Error + // Inv[R] <: Inv[_ >: S] + // Inv[T] <: Inv[S] + // ---------------------- + // R >: S + // T == S + } + +} + + diff --git a/test/pending/pos/t5564.scala b/test/pending/pos/t5564.scala new file mode 100644 index 0000000000..1783a903ed --- /dev/null +++ b/test/pending/pos/t5564.scala @@ -0,0 +1,5 @@ +trait C + +class Foo[@specialized(Int) T, A] { + def bar[B >: A <: C]: T = ??? +} diff --git a/test/pending/pos/t5579.scala b/test/pending/pos/t5579.scala new file mode 100644 index 0000000000..a1ee077fe7 --- /dev/null +++ b/test/pending/pos/t5579.scala @@ -0,0 +1,29 @@ +import language.existentials + +class Result[+A] + +case class Success[A](x: A) extends Result[A] + +class Apply[A] + +object Apply { + def apply[A](f: Int => Result[A]): Apply[A] = new Apply[A] +} + +object TestUnit { + //Error is here: + def goo = Apply { i => + i match { + case 1 => Success(Some(1)) + case _ => Success(None) + } + } + + //If type is defined explicitly (which I wanted from compiler to infer), then all is ok + def foo = Apply[t forSome { type t >: Some[Int] with None.type <: Option[Int] }] { i => + i match { + case 1 => Success(Some(1)) + case _ => Success(None) + } + } +} diff --git a/test/pending/pos/t5585.scala b/test/pending/pos/t5585.scala new file mode 100644 index 0000000000..5d3eb86111 --- /dev/null +++ b/test/pending/pos/t5585.scala @@ -0,0 +1,18 @@ +class Result[+A] + +case class Success[A](x: A) extends Result[A] + +class Apply[A] + +object Apply { + def apply[A](f: Int => Result[A]): Apply[A] = new Apply[A] +} + +object TestUnit { + def goo : Apply[Option[Int]] = Apply { i => + val p = i match { + case 1 => Success(Some(1)) + case _ => Success(None) + } + } +}
\ No newline at end of file diff --git a/test/pending/pos/t5606.scala b/test/pending/pos/t5606.scala new file mode 100644 index 0000000000..2545271e32 --- /dev/null +++ b/test/pending/pos/t5606.scala @@ -0,0 +1,9 @@ + + + + + + + + +case class CaseTest[_](someData:String) diff --git a/test/pending/pos/t5639/Bar.scala b/test/pending/pos/t5639/Bar.scala new file mode 100644 index 0000000000..f577500acd --- /dev/null +++ b/test/pending/pos/t5639/Bar.scala @@ -0,0 +1,7 @@ +package pack.age + +import pack.age.Implicits._ + +object Quux { + def baz : Baz = 1 +} diff --git a/test/pending/pos/t5639/Foo.scala b/test/pending/pos/t5639/Foo.scala new file mode 100644 index 0000000000..6602150661 --- /dev/null +++ b/test/pending/pos/t5639/Foo.scala @@ -0,0 +1,7 @@ +package pack.age + +class Baz + +object Implicits { + implicit def Baz(n: Int): Baz = new Baz +} diff --git a/test/pending/pos/t5654.scala b/test/pending/pos/t5654.scala new file mode 100644 index 0000000000..eb711a5f37 --- /dev/null +++ b/test/pending/pos/t5654.scala @@ -0,0 +1,4 @@ +case class Bomb(a: Array[_]) +case class Bomb2(a: Array[T] forSome { type T }) +class Okay1(a: Array[_]) +case class Okay2(s: Seq[_])
\ No newline at end of file diff --git a/test/pending/pos/t5712.scala b/test/pending/pos/t5712.scala new file mode 100644 index 0000000000..31f365028a --- /dev/null +++ b/test/pending/pos/t5712.scala @@ -0,0 +1,14 @@ +import scala.tools.nsc._ + +object Test { + + // works + def mkReifier(global: Global)(typer: global.analyzer.Typer) = typer + +/* +<console>:10: error: not found: value global + class Reifier(global: Global)(typer: global.analyzer.Typer) { } +*/ + class Reifier(global: Global)(typer: global.analyzer.Typer) { } + +} diff --git a/test/pending/presentation/t5708.check b/test/pending/presentation/t5708.check new file mode 100644 index 0000000000..9d944d6cfc --- /dev/null +++ b/test/pending/presentation/t5708.check @@ -0,0 +1,81 @@ +reload: Completions.scala + +askTypeCompletion at Completions.scala(9,9) +================================================================================ +[response] aksTypeCompletion at (9,9) +retrieved 38 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(test.Compat.type, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)test.Compat.type` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)test.Compat.type` +[accessible: true] `method ensuring(cond: test.Compat.type => Boolean)test.Compat.type` +[accessible: true] `method ensuring(cond: test.Compat.type => Boolean, msg: => Any)test.Compat.type` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> test.Compat.type` +[accessible: true] `method →[B](y: B)(test.Compat.type, B)` +[accessible: true] `lazy value fooInt` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: true] `value CONST_STRINGString("constant")` +[accessible: false] `value __leftOfArrowtest.Compat.type` +[accessible: false] `value __resultOfEnsuringtest.Compat.type` +[accessible: false] `value selfAny` +================================================================================ + +askTypeCompletion at Completions.scala(10,9) +================================================================================ +[response] aksTypeCompletion at (10,9) +retrieved 38 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(test.Compat.type, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)test.Compat.type` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)test.Compat.type` +[accessible: true] `method ensuring(cond: test.Compat.type => Boolean)test.Compat.type` +[accessible: true] `method ensuring(cond: test.Compat.type => Boolean, msg: => Any)test.Compat.type` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> test.Compat.type` +[accessible: true] `method →[B](y: B)(test.Compat.type, B)` +[accessible: true] `lazy value fooInt` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: true] `value CONST_STRINGString("constant")` +[accessible: false] `value __leftOfArrowtest.Compat.type` +[accessible: false] `value __resultOfEnsuringtest.Compat.type` +[accessible: false] `value selfAny` +================================================================================ diff --git a/test/pending/presentation/t5708/Test.scala b/test/pending/presentation/t5708/Test.scala new file mode 100644 index 0000000000..96e758d974 --- /dev/null +++ b/test/pending/presentation/t5708/Test.scala @@ -0,0 +1,5 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest { + +}
\ No newline at end of file diff --git a/test/pending/presentation/t5708/src/Completions.scala b/test/pending/presentation/t5708/src/Completions.scala new file mode 100644 index 0000000000..cc41492df7 --- /dev/null +++ b/test/pending/presentation/t5708/src/Completions.scala @@ -0,0 +1,11 @@ +package test + +object Compat { + final val CONST_STRING = "constant" + lazy val foo = 4 +} + +class Foo { + Compat./*!*/CONST_STRING // its 'accessible' flag is false + Compat./*!*/foo // its 'accessible' flag is false +} diff --git a/test/pending/run/reify_csv.check b/test/pending/run/reify_csv.check deleted file mode 100644 index b56f4bb50b..0000000000 --- a/test/pending/run/reify_csv.check +++ /dev/null @@ -1,10 +0,0 @@ -List(phase name, id, description) -record(parser,1,parse source into ASTs, perform simple desugaring) -record(namer,2,resolve names, attach symbols to named trees) -record(packageobjects,3,load package objects) -record(typer,4,the meat and potatoes: type the trees) -record(superaccessors,5,add super accessors in traits and nested classes) -record(pickler,6,serialize symbol tables) -record(refchecks,7,reference/override checking, translate nested objects) -record(selectiveanf,8,) -record(liftcode,9,reify trees) diff --git a/test/pending/run/reify_csv.scala b/test/pending/run/reify_csv.scala deleted file mode 100644 index 966521575c..0000000000 --- a/test/pending/run/reify_csv.scala +++ /dev/null @@ -1,35 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - val csv = """ - | phase name; id; description - | parser; 1; parse source into ASTs, perform simple desugaring - | namer; 2; resolve names, attach symbols to named trees - |packageobjects; 3; load package objects - | typer; 4; the meat and potatoes: type the trees - |superaccessors; 5; add super accessors in traits and nested classes - | pickler; 6; serialize symbol tables - | refchecks; 7; reference/override checking, translate nested objects - | selectiveanf; 8; - | liftcode; 9; reify trees""".stripMargin.split("\n").map{_.trim()}.drop(1).toList - - val fields = csv.head.split(";").map{_.trim()}.toList - println(fields) - - reify({ - object Csv { - case class record(`phase name`: String, id: String, description: String) - - object record { - def parse(lines: List[String]) = { - lines drop(1) map { line => line.split(";", -1).toList match { - case phase$whitespace$name :: id :: description :: _ => record(phase$whitespace$name.trim(), id.trim(), description.trim()) - case _ => throw new Exception("format error") - }} - } - } - } - - Csv.record.parse(csv) foreach println - }).eval -} diff --git a/test/pending/run/reify_lazyevaluation.check b/test/pending/run/reify_lazyevaluation.check deleted file mode 100644 index 1c7f96cd96..0000000000 --- a/test/pending/run/reify_lazyevaluation.check +++ /dev/null @@ -1,8 +0,0 @@ -s = Susp(?) -evaluating... -s() = 3 -s = Susp(3) -2 + s = 5 -sl2 = Susp(?) -sl2() = Some(3) -sl2 = Susp(Some(3)) diff --git a/test/pending/run/reify_lazyevaluation.scala b/test/pending/run/reify_lazyevaluation.scala deleted file mode 100644 index 1a0c858914..0000000000 --- a/test/pending/run/reify_lazyevaluation.scala +++ /dev/null @@ -1,58 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - object lazyLib { - - /** Delay the evaluation of an expression until it is needed. */ - def delay[A](value: => A): Susp[A] = new SuspImpl[A](value) - - /** Get the value of a delayed expression. */ - implicit def force[A](s: Susp[A]): A = s() - - /** - * Data type of suspended computations. (The name froms from ML.) - */ - abstract class Susp[+A] extends Function0[A] - - /** - * Implementation of suspended computations, separated from the - * abstract class so that the type parameter can be invariant. - */ - class SuspImpl[A](lazyValue: => A) extends Susp[A] { - private var maybeValue: Option[A] = None - - override def apply() = maybeValue match { - case None => - val value = lazyValue - maybeValue = Some(value) - value - case Some(value) => - value - } - - override def toString() = maybeValue match { - case None => "Susp(?)" - case Some(value) => "Susp(" + value + ")" - } - } - } - - import lazyLib._ - - val s: Susp[Int] = delay { println("evaluating..."); 3 } - - println("s = " + s) // show that s is unevaluated - println("s() = " + s()) // evaluate s - println("s = " + s) // show that the value is saved - println("2 + s = " + (2 + s)) // implicit call to force() - - val sl = delay { Some(3) } - val sl1: Susp[Some[Int]] = sl - val sl2: Susp[Option[Int]] = sl1 // the type is covariant - - println("sl2 = " + sl2) - println("sl2() = " + sl2()) - println("sl2 = " + sl2) - }.eval -} diff --git a/test/pending/run/reify_properties.check b/test/pending/run/reify_properties.check deleted file mode 100644 index d769bea4b0..0000000000 --- a/test/pending/run/reify_properties.check +++ /dev/null @@ -1,2 +0,0 @@ -user1: MR. ROBERT <noname> -user2: MR. BOB KUZ diff --git a/test/pending/run/reify_properties.scala b/test/pending/run/reify_properties.scala deleted file mode 100644 index 5cacc262ac..0000000000 --- a/test/pending/run/reify_properties.scala +++ /dev/null @@ -1,56 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - /** A mutable property whose getter and setter may be customized. */ - case class Property[T](init: T) { - private var value: T = init - - /** The getter function, defaults to identity. */ - private var setter: T => T = identity[T] - - /** The setter function, defaults to identity. */ - private var getter: T => T = identity[T] - - /** Retrive the value held in this property. */ - def apply(): T = getter(value) - - /** Update the value held in this property, through the setter. */ - def update(newValue: T) = value = setter(newValue) - - /** Change the getter. */ - def get(newGetter: T => T) = { getter = newGetter; this } - - /** Change the setter */ - def set(newSetter: T => T) = { setter = newSetter; this } - } - - class User { - // Create a property with custom getter and setter - val firstname = Property("") - .get { v => v.toUpperCase() } - .set { v => "Mr. " + v } - val lastname = Property("<noname>") - - /** Scala provides syntactic sugar for calling 'apply'. Simply - * adding a list of arguments between parenthesis (in this case, - * an empty list) is translated to a call to 'apply' with those - * arguments. - */ - override def toString() = firstname() + " " + lastname() - } - - val user1 = new User - - // Syntactic sugar for 'update': an assignment is translated to a - // call to method 'update' - user1.firstname() = "Robert" - - val user2 = new User - user2.firstname() = "bob" - user2.lastname() = "KUZ" - - println("user1: " + user1) - println("user2: " + user2) - }.eval -} diff --git a/test/pending/run/t1697.scala b/test/pending/run/t1697.scala deleted file mode 100644 index 01590dd405..0000000000 --- a/test/pending/run/t1697.scala +++ /dev/null @@ -1,19 +0,0 @@ -class Term -case class Num(n: Int) extends Term -case class Add(x: Term, y: Term) extends Term - -object Value { - def unapply(term: Any): Boolean = true -} - -object Test { - def main(args: Array[String]) { - val term = Add(Num(1), Add(Num(2), Num(3))) - val res = term match { - case Add(Num(x), Num(y)) => "Add(Num, Num)" - case Add(Value(), y) => "Add(Value, ?)" - case _ => "?" - } - assert(res == "Add(Value, ?)") - } -} diff --git a/test/pending/run/t3705.scala b/test/pending/run/t3705.scala deleted file mode 100644 index fcc020f28c..0000000000 --- a/test/pending/run/t3705.scala +++ /dev/null @@ -1,17 +0,0 @@ -// package foo - -import scala.xml._ -object Test { - def updateNodes(ns: Seq[Node]): Seq[Node] = - for(subnode <- ns) yield subnode match { - case <d>{_}</d> if true => <d>abc</d> - case Elem(prefix, label, attribs, scope, children @ _*) => - Elem(prefix, label, attribs, scope, updateNodes(children) : _*) - case other => other - } - def main(args: Array[String]): Unit = { - updateNodes(<b />) - - } -} - diff --git a/test/pending/run/t4415.scala b/test/pending/run/t4415.scala deleted file mode 100644 index f96031d650..0000000000 --- a/test/pending/run/t4415.scala +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Demonstration of issue with Extractors. If lines 15/16 are not present, get at runtime: - * - * Exception in thread "main" java.lang.VerifyError: (class: ExtractorIssue$$, method: convert signature: (LTopProperty;)LMyProp;) Accessing value from uninitialized register 5 - * at ExtractorIssue.main(ExtractorIssue.scala) - * at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)] - * - * If lines 15/16 are present, the compiler crashes: - * - * fatal error (server aborted): not enough arguments for method body%3: (val p: MyProp[java.lang.String])MyProp[_33]. - * Unspecified value parameter p. - */ -object Test { - - def main(args: Array[String]) { - convert(new SubclassProperty) - } - - def convert(prop: TopProperty): MyProp[_] = { - prop match { - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //case SubclassSecondMatch(p) => p // if these lines are present, the compiler crashes. If commented, unsafe byte - //case SecondMatch(p) => p // byte code is generated, which causes a java.lang.VerifyError at runtime - /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - case SubclassMatch(p) => p - case StandardMatch(p) => p - } - } -} - -class TopProperty - -class StandardProperty extends TopProperty -class SubclassProperty extends StandardProperty - -class SecondProperty extends TopProperty -class SubclassSecondProperty extends StandardProperty - -trait MyProp[T] -case class MyPropImpl[T] extends MyProp[T] - -object SubclassMatch { - - def unapply(prop: SubclassProperty) : Option[MyProp[String]] = { - Some(new MyPropImpl) - } - - def apply(prop: MyProp[String]) : SubclassProperty = { - new SubclassProperty() - } -} - -object StandardMatch { - - def unapply(prop: StandardProperty) : Option[MyProp[String]] = { - Some(new MyPropImpl) - } - - def apply(prop: MyProp[String]) : StandardProperty = { - new StandardProperty() - } -} - -object SubclassSecondMatch { - - def unapply(prop: SubclassSecondProperty) : Option[MyProp[BigInt]] = { - Some(new MyPropImpl) - } - - def apply(prop: MyProp[String]) : SubclassSecondProperty = { - new SubclassSecondProperty() - } -} - -object SecondMatch { - - def unapply(prop: SecondProperty) : Option[MyProp[BigInt]] = { - Some(new MyPropImpl) - } - - def apply(prop: MyProp[String]) : SecondProperty = { - new SecondProperty() - } -}
\ No newline at end of file diff --git a/test/pending/run/t4560.scala b/test/pending/run/t4560.scala new file mode 100644 index 0000000000..fe62136319 --- /dev/null +++ b/test/pending/run/t4560.scala @@ -0,0 +1,9 @@ +trait B { + this: Test.type => + + def y = new { def f() = () } + def fail() = y.f() +} +object Test extends B { + def main(args: Array[String]): Unit = fail() +}
\ No newline at end of file diff --git a/test/pending/run/t4728.check b/test/pending/run/t4728.check new file mode 100644 index 0000000000..7a754f414c --- /dev/null +++ b/test/pending/run/t4728.check @@ -0,0 +1,2 @@ +1 +2
\ No newline at end of file diff --git a/test/pending/run/t4728.scala b/test/pending/run/t4728.scala new file mode 100644 index 0000000000..36f7860613 --- /dev/null +++ b/test/pending/run/t4728.scala @@ -0,0 +1,11 @@ +class X +class Y extends X +object Ambiguous { + def f(x: X) = 1 + def f(ys: Y*) = 2 +} + +object Test extends App { + println(Ambiguous.f(new X)) + println(Ambiguous.f(new Y)) +}
\ No newline at end of file diff --git a/test/pending/run/t5258a.check b/test/pending/run/t5258a.check deleted file mode 100644 index 4e0b2da04c..0000000000 --- a/test/pending/run/t5258a.check +++ /dev/null @@ -1 +0,0 @@ -int
\ No newline at end of file diff --git a/test/pending/run/t5258a.scala b/test/pending/run/t5258a.scala deleted file mode 100644 index 127829c724..0000000000 --- a/test/pending/run/t5258a.scala +++ /dev/null @@ -1,7 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - println(classOf[Int]) - }.eval -}
\ No newline at end of file diff --git a/test/pending/run/t5610a.check b/test/pending/run/t5610a.check new file mode 100644 index 0000000000..2aa46b3b91 --- /dev/null +++ b/test/pending/run/t5610a.check @@ -0,0 +1 @@ +Stroke a kitten diff --git a/test/pending/run/t5610a.scala b/test/pending/run/t5610a.scala new file mode 100644 index 0000000000..f20b295762 --- /dev/null +++ b/test/pending/run/t5610a.scala @@ -0,0 +1,19 @@ +object Test extends App { + class Result(_str: => String) { + lazy val str = _str + } + + def foo(str: => String)(i: Int) = new Result(str) + + def bar(f: Int => Result) = f(42) + + var test: String = null + val result = bar(foo(test)) + test = "bar" + + if (result.str == null) { + println("Destroy ALL THE THINGS!!!") + } else { + println("Stroke a kitten") + } +}
\ No newline at end of file diff --git a/test/pending/run/t5610b.check b/test/pending/run/t5610b.check new file mode 100644 index 0000000000..2aa46b3b91 --- /dev/null +++ b/test/pending/run/t5610b.check @@ -0,0 +1 @@ +Stroke a kitten diff --git a/test/pending/run/t5610b.scala b/test/pending/run/t5610b.scala new file mode 100644 index 0000000000..d922d6333c --- /dev/null +++ b/test/pending/run/t5610b.scala @@ -0,0 +1,21 @@ +object Bug { + def main(args: Array[String]) { + var test: String = null + val result = bar(foo(test)) + test = "bar" + + if (result.str == null) { + println("Destroy ALL THE THINGS!!!") + } else { + println("Stroke a kitten") + } + } + + class Result(_str: => String) { + lazy val str = _str + } + + def foo(str: => String)(i: Int) = new Result(str) + + def bar(f: Int => Result) = f(42) +}
\ No newline at end of file diff --git a/test/pending/run/t5676.flags b/test/pending/run/t5676.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/pending/run/t5676.flags @@ -0,0 +1 @@ +-Xexperimental
\ No newline at end of file diff --git a/test/pending/run/t5676.scala b/test/pending/run/t5676.scala new file mode 100644 index 0000000000..3ff498eaa2 --- /dev/null +++ b/test/pending/run/t5676.scala @@ -0,0 +1,25 @@ + + + + +class Bar[T] + + +class Foo[T] { + object A extends Bar[T] +} + + +class Baz[S] extends Foo[S] { + override object A extends Bar[S] +} + + +object Test { + + def main(a: Array[String]) { + val b = new Baz[Any] + println(b) + } + +} diff --git a/test/pending/run/t5695.check b/test/pending/run/t5695.check new file mode 100644 index 0000000000..d50069ab4f --- /dev/null +++ b/test/pending/run/t5695.check @@ -0,0 +1,2 @@ +.. +.. diff --git a/test/pending/run/t5695/part_1.scala b/test/pending/run/t5695/part_1.scala new file mode 100644 index 0000000000..b8e8f8e52f --- /dev/null +++ b/test/pending/run/t5695/part_1.scala @@ -0,0 +1,12 @@ +import language.experimental.macros +import scala.reflect.makro.Context + +object Defs { + + def mkInt = macro mkIntImpl + def mkIntImpl(c: Context): c.Expr[Any] = { + println(c.enclosingApplication) + c.reify{ 23 } + } + +} diff --git a/test/pending/run/t5695/part_2.scala b/test/pending/run/t5695/part_2.scala new file mode 100644 index 0000000000..d34219437d --- /dev/null +++ b/test/pending/run/t5695/part_2.scala @@ -0,0 +1,8 @@ +import Defs._ + +object Test extends App { + + val i1 = mkInt + val i2 = identity(mkInt) + +} diff --git a/test/pending/run/t5698/client.scala b/test/pending/run/t5698/client.scala new file mode 100644 index 0000000000..de672c1809 --- /dev/null +++ b/test/pending/run/t5698/client.scala @@ -0,0 +1,9 @@ +package client + + + +object Client extends App { + val peer = actors.remote.Node("localhost", 23456) + val a = actors.remote.RemoteActor.select(peer, 'test) + a ! server.TestMsg +} diff --git a/test/pending/run/t5698/server.scala b/test/pending/run/t5698/server.scala new file mode 100644 index 0000000000..e8f3cea225 --- /dev/null +++ b/test/pending/run/t5698/server.scala @@ -0,0 +1,22 @@ +package server + + + +object Server extends App { + + class ServerActor extends actors.Actor { + def act() { + actors.remote.RemoteActor.alive(23456) + actors.remote.RemoteActor.register('test, actors.Actor.self) + loop { + react { + case TestMsg => println("Yay!") + } + } + } + } + + val a = new ServerActor + a.start() + +} diff --git a/test/pending/run/t5698/testmsg.scala b/test/pending/run/t5698/testmsg.scala new file mode 100644 index 0000000000..004ff0b8c7 --- /dev/null +++ b/test/pending/run/t5698/testmsg.scala @@ -0,0 +1,5 @@ +package server + + + +case object TestMsg diff --git a/test/pending/run/t5722.scala b/test/pending/run/t5722.scala new file mode 100644 index 0000000000..21ace060d6 --- /dev/null +++ b/test/pending/run/t5722.scala @@ -0,0 +1,6 @@ +object Test extends App { + def foo[T: ClassTag] = println(classOf[T]) + foo[Int] + foo[Array[Int]] + foo[List[Int]] +}
\ No newline at end of file diff --git a/test/pending/run/t5726a.scala b/test/pending/run/t5726a.scala new file mode 100644 index 0000000000..24d828a159 --- /dev/null +++ b/test/pending/run/t5726a.scala @@ -0,0 +1,17 @@ +import language.dynamics + +class DynamicTest extends Dynamic { + def selectDynamic(name: String) = s"value of $name" + def updateDynamic(name: String)(value: Any) { + println(s"You have just updated property '$name' with value: $value") + } +} + +object MyApp extends App { + def testing() { + val test = new DynamicTest + test.firstName = "John" + } + + testing() +}
\ No newline at end of file diff --git a/test/pending/run/t5726b.scala b/test/pending/run/t5726b.scala new file mode 100644 index 0000000000..839dcf40b5 --- /dev/null +++ b/test/pending/run/t5726b.scala @@ -0,0 +1,16 @@ +import language.dynamics + +class DynamicTest extends Dynamic { + def updateDynamic(name: String)(value: Any) { + println(s"You have just updated property '$name' with value: $value") + } +} + +object MyApp extends App { + def testing() { + val test = new DynamicTest + test.firstName = "John" + } + + testing() +}
\ No newline at end of file |