diff options
Diffstat (limited to 'test/pending')
24 files changed, 326 insertions, 0 deletions
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/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/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/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/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/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/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 |