diff options
Diffstat (limited to 'test')
76 files changed, 429 insertions, 17 deletions
diff --git a/test/files/instrumented/InstrumentationTest.check b/test/files/instrumented/InstrumentationTest.check new file mode 100644 index 0000000000..3652df270a --- /dev/null +++ b/test/files/instrumented/InstrumentationTest.check @@ -0,0 +1,4 @@ +true +Method call statistics: + 1 scala/Predef$.println(Ljava/lang/Object;)V + 1 scala/runtime/BoxesRunTime.boxToBoolean(Z)Ljava/lang/Boolean; diff --git a/test/files/instrumented/InstrumentationTest.scala b/test/files/instrumented/InstrumentationTest.scala new file mode 100644 index 0000000000..ec5314c624 --- /dev/null +++ b/test/files/instrumented/InstrumentationTest.scala @@ -0,0 +1,14 @@ +import scala.tools.partest.instrumented.Instrumentation._ + +/** Tests if instrumentation itself works correctly */ +object Test { + def main(args: Array[String]) { + // force predef initialization before profiling + Predef + startProfiling() + // should box the boolean + println(true) + stopProfiling() + printStatistics() + } +} diff --git a/test/files/instrumented/README b/test/files/instrumented/README new file mode 100644 index 0000000000..32d0ef2da5 --- /dev/null +++ b/test/files/instrumented/README @@ -0,0 +1,15 @@ +Tests in `instrumented` directory are executed the same way as in `run` but +they have additional byte-code instrumentation performed for profiling. You +should put your tests in `instrumented` directory if you are interested in +method call counts. Examples include tests for specialization (you want to +count boxing and unboxing method calls) or high-level tests for optimizer +where you are interested if methods are successfuly inlined (so they should +not be called at runtime) or closures are eliminated (so no constructors +of closures are called). + +Check `scala.tools.partest.instrumented.Instrumentation` to learn how to +use the instrumentation infrastructure. + +The instrumentation itself is achieved by attaching a Java agent to the forked +VM process that injects calls to profiler. Check +`scala.tools.partest.instrumented.Instrumentation`. diff --git a/test/files/neg/reflection-names-neg.check b/test/files/neg/reflection-names-neg.check new file mode 100644 index 0000000000..a56a19e7fd --- /dev/null +++ b/test/files/neg/reflection-names-neg.check @@ -0,0 +1,10 @@ +reflection-names-neg.scala:5: error: type mismatch; + found : String("abc") + required: reflect.runtime.universe.Name +Note that implicit conversions are not applicable because they are ambiguous: + both method stringToTermName in trait Names of type (s: String)reflect.runtime.universe.TermName + and method stringToTypeName in trait Names of type (s: String)reflect.runtime.universe.TypeName + are possible conversion functions from String("abc") to reflect.runtime.universe.Name + val x2 = ("abc": Name) drop 1 // error + ^ +one error found diff --git a/test/files/neg/reflection-names-neg.scala b/test/files/neg/reflection-names-neg.scala new file mode 100644 index 0000000000..7283d16db9 --- /dev/null +++ b/test/files/neg/reflection-names-neg.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test { + val x1 = "abc" drop 1 // "bc": String + val x2 = ("abc": Name) drop 1 // error +} diff --git a/test/files/neg/t1286.check b/test/files/neg/t1286.check index c937fb9cf1..912709613c 100644 --- a/test/files/neg/t1286.check +++ b/test/files/neg/t1286.check @@ -1,9 +1,5 @@ -a.scala:1: error: Companions 'object Foo' and 'trait Foo' must be defined in same file: - Found in t1286/b.scala and t1286/a.scala -trait Foo { - ^ b.scala:1: error: Companions 'trait Foo' and 'object Foo' must be defined in same file: Found in t1286/a.scala and t1286/b.scala object Foo extends Foo { ^ -two errors found +one error found diff --git a/test/files/neg/t5830.check b/test/files/neg/t5830.check index 85cb84378f..726fac2a1e 100644 --- a/test/files/neg/t5830.check +++ b/test/files/neg/t5830.check @@ -1,4 +1,7 @@ t5830.scala:6: error: unreachable code case 'a' => println("b") // unreachable ^ -one error found +t5830.scala:4: error: could not emit switch for @switch annotated match + def unreachable(ch: Char) = (ch: @switch) match { + ^ +two errors found diff --git a/test/files/neg/t5956.check b/test/files/neg/t5956.check new file mode 100644 index 0000000000..6641dac97f --- /dev/null +++ b/test/files/neg/t5956.check @@ -0,0 +1,20 @@ +t5956.scala:1: warning: case classes without a parameter list have been deprecated; +use either case objects or case classes with `()' as parameter list. +object O { case class C[T]; class C } + ^ +t5956.scala:2: warning: case classes without a parameter list have been deprecated; +use either case objects or case classes with `()' as parameter list. +object T { case class C[T]; case class C } + ^ +t5956.scala:2: warning: case classes without a parameter list have been deprecated; +use either case objects or case classes with `()' as parameter list. +object T { case class C[T]; case class C } + ^ +t5956.scala:1: error: C is already defined as case class C +object O { case class C[T]; class C } + ^ +t5956.scala:2: error: C is already defined as case class C +object T { case class C[T]; case class C } + ^ +three warnings found +two errors found diff --git a/test/files/neg/t5956.scala b/test/files/neg/t5956.scala new file mode 100644 index 0000000000..d985fa97a4 --- /dev/null +++ b/test/files/neg/t5956.scala @@ -0,0 +1,2 @@ +object O { case class C[T]; class C } +object T { case class C[T]; case class C } diff --git a/test/files/neg/t6011.check b/test/files/neg/t6011.check new file mode 100644 index 0000000000..5b5a861e5b --- /dev/null +++ b/test/files/neg/t6011.check @@ -0,0 +1,10 @@ +t6011.scala:4: error: unreachable code + case 'a' | 'c' => 1 // unreachable + ^ +t6011.scala:10: error: unreachable code + case 'b' | 'a' => 1 // unreachable + ^ +t6011.scala:8: error: could not emit switch for @switch annotated match + def f2(ch: Char): Any = (ch: @annotation.switch) match { + ^ +three errors found diff --git a/test/files/neg/t6011.flags b/test/files/neg/t6011.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/t6011.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t6011.scala b/test/files/neg/t6011.scala new file mode 100644 index 0000000000..a36cca7897 --- /dev/null +++ b/test/files/neg/t6011.scala @@ -0,0 +1,23 @@ +object Test { + def f(ch: Char): Any = ch match { + case 'a' => 1 + case 'a' | 'c' => 1 // unreachable + } + + // won't be compiled to a switch since it has an unreachable (duplicate) case + def f2(ch: Char): Any = (ch: @annotation.switch) match { + case 'a' | 'b' => 1 + case 'b' | 'a' => 1 // unreachable + case _ => + } + + // s'all good + def f3(ch: Char): Any = (ch: @annotation.switch) match { + case 'a' | 'b' if (true: Boolean) => 1 + case 'b' | 'a' => 1 // ok + case _ => // need third case to check switch annotation (two-case switches are always okay to compile to if-then-else) + } + + + def main(args: Array[String]): Unit = f('a') +}
\ No newline at end of file diff --git a/test/files/neg/t6048.check b/test/files/neg/t6048.check new file mode 100644 index 0000000000..051f41877e --- /dev/null +++ b/test/files/neg/t6048.check @@ -0,0 +1,10 @@ +t6048.scala:3: error: unreachable code + case _ if false => x // unreachable + ^ +t6048.scala:8: error: unreachable code + case _ if false => x // unreachable + ^ +t6048.scala:14: error: unreachable code + case 5 if true => x // unreachable + ^ +three errors found diff --git a/test/files/neg/t6048.flags b/test/files/neg/t6048.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/t6048.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t6048.scala b/test/files/neg/t6048.scala new file mode 100644 index 0000000000..803e651d19 --- /dev/null +++ b/test/files/neg/t6048.scala @@ -0,0 +1,22 @@ +class A { + def f1(x: Int) = x match { + case _ if false => x // unreachable + case 5 => x + } + + def f2(x: Int) = x match { + case _ if false => x // unreachable + case 5 if true => x + } + + def f3(x: Int) = x match { + case _ => x + case 5 if true => x // unreachable + } + + def test1(x: Int) = x match { + case c if c < 0 => 0 + case 1 => 1 + case _ => 2 + } +} diff --git a/test/files/pos/t6028/t6028_1.scala b/test/files/pos/t6028/t6028_1.scala new file mode 100644 index 0000000000..6edb76069e --- /dev/null +++ b/test/files/pos/t6028/t6028_1.scala @@ -0,0 +1,3 @@ +class C { + def foo(a: Int): Unit = () => a +} diff --git a/test/files/pos/t6028/t6028_2.scala b/test/files/pos/t6028/t6028_2.scala new file mode 100644 index 0000000000..f44048c0ab --- /dev/null +++ b/test/files/pos/t6028/t6028_2.scala @@ -0,0 +1,4 @@ +object Test { + // ensure that parameter names are untouched by lambdalift + new C().foo(a = 0) +} diff --git a/test/files/run/reflect-resolveoverload-invalid.scala b/test/files/run/reflect-resolveoverload-invalid.scala index def28ccbb4..8c5dc9f94b 100644 --- a/test/files/run/reflect-resolveoverload-invalid.scala +++ b/test/files/run/reflect-resolveoverload-invalid.scala @@ -27,7 +27,7 @@ object Test extends App { val d = t member u.newTermName("d") asTermSymbol val e = t member u.newTermName("e") asTermSymbol - val n1 = a.resolveOverloaded(posVargs = List(u.typeOf[Char])) + val n1 = a.resolveOverloaded(posVargs = List(u.typeOf[Long])) val n2 = b.resolveOverloaded(posVargs = List(u.typeOf[A])) val n3 = c.resolveOverloaded(posVargs = List(u.typeOf[B], u.typeOf[B])) val n4 = d.resolveOverloaded(targs = List(u.typeOf[Int])) diff --git a/test/files/run/reflect-resolveoverload2.scala b/test/files/run/reflect-resolveoverload2.scala index b5f719814b..a800a3e92c 100644 --- a/test/files/run/reflect-resolveoverload2.scala +++ b/test/files/run/reflect-resolveoverload2.scala @@ -2,16 +2,20 @@ class A class B extends A class C { - def a(x: Int) = 1 - def a(x: String) = 2 - //def b(x: => Int)(s: String) = 1 - //def b(x: => String)(a: Array[_]) = 2 - def c(x: A) = 1 - def c(x: B) = 2 - //def d(x: => A)(s: String) = 1 - //def d(x: => B)(a: Array[_]) = 2 - def e(x: A) = 1 - def e(x: B = new B) = 2 + def a(x: Int) = 1 + def a(x: String) = 2 + //def b(x: => Int)(s: String) = 1 + //def b(x: => String)(a: Array[_]) = 2 + def c(x: A) = 1 + def c(x: B) = 2 + //def d(x: => A)(s: String) = 1 + //def d(x: => B)(a: Array[_]) = 2 + def e(x: A) = 1 + def e(x: B = new B) = 2 + def f(x: Int) = 1 + def f(x: String) = 2 + def f(x: Long) = 3 + def f(x: Double) = 4 } object Test extends App { @@ -29,6 +33,8 @@ object Test extends App { } assert(c.a(1) == invoke("a", 1, u.typeOf[Int])) assert(c.a("a") == invoke("a", "a", u.typeOf[String])) + assert(c.a('a') == invoke("a", 'a', u.typeOf[Char])) + assert(c.a(3: Byte) == invoke("a", 3: Byte, u.typeOf[Byte])) //assert(c.b(1)(null) == invoke("b", 1, u.typeOf[Int])) //assert(c.b("a")(null) == invoke("b", "a", u.typeOf[String])) assert(c.c(new A) == invoke("c", new A, u.typeOf[A])) @@ -37,4 +43,9 @@ object Test extends App { //assert(c.d(new B)(null) == invoke("d", new B, u.typeOf[B])) assert(c.e(new A) == invoke("e", new A, u.typeOf[A])) assert(c.e(new B) == invoke("e", new B, u.typeOf[B])) + assert(c.f(1: Short) == invoke("f", 1: Short, u.typeOf[Short])) + assert(c.f(2) == invoke("f", 2, u.typeOf[Int])) + assert(c.f(3L) == invoke("f", 3L, u.typeOf[Long])) + assert(c.f(4f) == invoke("f", 4f, u.typeOf[Float])) + assert(c.f(5d) == invoke("f", 5d, u.typeOf[Double])) } diff --git a/test/files/run/reflection-names.check b/test/files/run/reflection-names.check new file mode 100644 index 0000000000..f8cb78cc67 --- /dev/null +++ b/test/files/run/reflection-names.check @@ -0,0 +1,4 @@ +(java.lang.String,bc) +(scala.reflect.internal.Names$TermName_R,bc) +(scala.reflect.internal.Names$TypeName_R,bc) +(scala.reflect.internal.Names$TypeName_R,bc) diff --git a/test/files/run/reflection-names.scala b/test/files/run/reflection-names.scala new file mode 100644 index 0000000000..2433c84813 --- /dev/null +++ b/test/files/run/reflection-names.scala @@ -0,0 +1,15 @@ +import scala.tools.nsc._ + +object Test { + val global = new Global(new Settings()) + import global._ + + val x1 = "abc" drop 1 // "bc": String + val x2 = ("abc": TermName) drop 1 // "bc": TermName + val x3 = ("abc": TypeName) drop 1 // "bc": TypeName + val x4 = (("abc": TypeName): Name) drop 1 // "bc": Name + + def main(args: Array[String]): Unit = { + List(x1, x2, x3, x4) foreach (x => println(x.getClass.getName, x)) + } +} diff --git a/test/files/run/t5588.check b/test/files/run/t5588.check new file mode 100644 index 0000000000..bb101b641b --- /dev/null +++ b/test/files/run/t5588.check @@ -0,0 +1,2 @@ +true +true diff --git a/test/files/run/t5588.scala b/test/files/run/t5588.scala new file mode 100644 index 0000000000..f214d16684 --- /dev/null +++ b/test/files/run/t5588.scala @@ -0,0 +1,14 @@ +object Test { + object MyEnum extends Enumeration { + val Foo = Value(2000000000) + val Bar = Value(-2000000000) + val X = Value(Integer.MAX_VALUE) + val Y = Value(Integer.MIN_VALUE) + } + + import MyEnum._ + def main(args: Array[String]) { + println(Foo > Bar) + println(X > Y) + } +} diff --git a/test/files/run/t6011b.check b/test/files/run/t6011b.check new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/files/run/t6011b.check @@ -0,0 +1 @@ +3 diff --git a/test/files/run/t6011b.scala b/test/files/run/t6011b.scala new file mode 100644 index 0000000000..3d405e0705 --- /dev/null +++ b/test/files/run/t6011b.scala @@ -0,0 +1,11 @@ +object Test extends App { + var cond = true + + // should not generate a switch + def f(ch: Char): Int = ch match { + case 'a' if cond => 1 + case 'z' | 'a' => 2 + } + + println(f('a') + f('z')) // 3 +}
\ No newline at end of file diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check new file mode 100644 index 0000000000..dca61115ad --- /dev/null +++ b/test/files/run/t6028.check @@ -0,0 +1,84 @@ +[[syntax trees at end of lambdalift]] // newSource1 +package <empty> { + class T extends Object { + <paramaccessor> val T$$classParam: Int = _; + def <init>(classParam: Int): T = { + T.super.<init>(); + () + }; + private[this] val field: Int = 0; + <stable> <accessor> def field(): Int = T.this.field; + def foo(methodParam: Int): Function0 = { + val methodLocal: Int = 0; + { + (new anonymous class $anonfun$foo$1(T.this, methodParam, methodLocal): Function0) + } + }; + def bar(barParam: Int): Object = { + @volatile var MethodLocalObject$module: scala.runtime.VolatileObjectRef = new scala.runtime.VolatileObjectRef(<empty>); + T.this.MethodLocalObject$1(barParam, MethodLocalObject$module) + }; + def tryy(tryyParam: Int): Function0 = { + var tryyLocal: scala.runtime.IntRef = new scala.runtime.IntRef(0); + { + (new anonymous class $anonfun$tryy$1(T.this, tryyParam, tryyLocal): Function0) + } + }; + @SerialVersionUID(0) final <synthetic> class $anonfun$foo$1 extends scala.runtime.AbstractFunction0$mcI$sp with Serializable { + def <init>($outer: T, methodParam$1: Int, methodLocal$1: Int): anonymous class $anonfun$foo$1 = { + $anonfun$foo$1.super.<init>(); + () + }; + final def apply(): Int = $anonfun$foo$1.this.apply$mcI$sp(); + <specialized> def apply$mcI$sp(): Int = $anonfun$foo$1.this.$outer.T$$classParam.+($anonfun$foo$1.this.$outer.field()).+($anonfun$foo$1.this.methodParam$1).+($anonfun$foo$1.this.methodLocal$1); + <synthetic> <paramaccessor> private[this] val $outer: T = _; + <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer; + final <bridge> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply()); + <synthetic> <paramaccessor> private[this] val methodParam$1: Int = _; + <synthetic> <paramaccessor> private[this] val methodLocal$1: Int = _ + }; + abstract trait MethodLocalTrait$1 extends Object { + <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T + }; + object MethodLocalObject$2 extends Object with T#MethodLocalTrait$1 { + def <init>($outer: T, barParam$1: Int): ... = { + MethodLocalObject$2.super.<init>(); + MethodLocalObject$2.this.$asInstanceOf[T#MethodLocalTrait$1$class]()./*MethodLocalTrait$1$class*/$init$(barParam$1); + () + }; + <synthetic> <paramaccessor> private[this] val $outer: T = _; + <synthetic> <stable> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer; + <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer + }; + final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: scala.runtime.VolatileObjectRef): ... = { + MethodLocalObject$module$1.elem = new ...(T.this, barParam$1); + MethodLocalObject$module$1.elem.$asInstanceOf[...]() + }; + abstract trait MethodLocalTrait$1$class extends Object with T#MethodLocalTrait$1 { + def /*MethodLocalTrait$1$class*/$init$(barParam$1: Int): Unit = { + () + }; + scala.this.Predef.print(scala.Int.box(barParam$1)) + }; + @SerialVersionUID(0) final <synthetic> class $anonfun$tryy$1 extends scala.runtime.AbstractFunction0$mcV$sp with Serializable { + def <init>($outer: T, tryyParam$1: Int, tryyLocal$1: scala.runtime.IntRef): anonymous class $anonfun$tryy$1 = { + $anonfun$tryy$1.super.<init>(); + () + }; + final def apply(): Unit = $anonfun$tryy$1.this.apply$mcV$sp(); + <specialized> def apply$mcV$sp(): Unit = try { + $anonfun$tryy$1.this.tryyLocal$1.elem = $anonfun$tryy$1.this.tryyParam$1 + } finally (); + <synthetic> <paramaccessor> private[this] val $outer: T = _; + <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer; + final <bridge> def apply(): Object = { + $anonfun$tryy$1.this.apply(); + scala.runtime.BoxedUnit.UNIT + }; + <synthetic> <paramaccessor> private[this] val tryyParam$1: Int = _; + <synthetic> <paramaccessor> private[this] val tryyLocal$1: scala.runtime.IntRef = _ + } + } +} + +warning: there were 1 feature warnings; re-run with -feature for details diff --git a/test/files/run/t6028.scala b/test/files/run/t6028.scala new file mode 100644 index 0000000000..cab17535fc --- /dev/null +++ b/test/files/run/t6028.scala @@ -0,0 +1,21 @@ +import scala.tools.partest._ +import java.io.{Console => _, _} + +object Test extends DirectTest { + + override def extraSettings: String = "-usejavacp -Xprint:lambdalift -d " + testOutput.path + + override def code = """class T(classParam: Int) { + | val field: Int = 0 + | def foo(methodParam: Int) = {val methodLocal = 0 ; () => classParam + field + methodParam + methodLocal } + | def bar(barParam: Int) = { trait MethodLocalTrait { print(barParam) }; object MethodLocalObject extends MethodLocalTrait; MethodLocalObject } + | def tryy(tryyParam: Int) = { var tryyLocal = 0; () => try { tryyLocal = tryyParam } finally () } + |} + |""".stripMargin.trim + + override def show(): Unit = { + Console.withErr(System.out) { + compile() + } + } +} diff --git a/test/files/run/t6077_patmat_cse_irrefutable.check b/test/files/run/t6077_patmat_cse_irrefutable.check new file mode 100644 index 0000000000..9766475a41 --- /dev/null +++ b/test/files/run/t6077_patmat_cse_irrefutable.check @@ -0,0 +1 @@ +ok diff --git a/test/files/run/t6077_patmat_cse_irrefutable.scala b/test/files/run/t6077_patmat_cse_irrefutable.scala new file mode 100644 index 0000000000..b130ae7813 --- /dev/null +++ b/test/files/run/t6077_patmat_cse_irrefutable.scala @@ -0,0 +1,13 @@ +class LiteralNode(val value: Any) + +object LiteralNode { + // irrefutable + def unapply(n: LiteralNode) = Some(n.value) +} + +object Test extends App { + ((new LiteralNode(false)): Any) match { + case LiteralNode(true) => println("uh-oh") + case LiteralNode(false) => println("ok") + } +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-classmanifest-basic.check b/test/files/run/valueclasses-classmanifest-basic.check new file mode 100644 index 0000000000..554c75e074 --- /dev/null +++ b/test/files/run/valueclasses-classmanifest-basic.check @@ -0,0 +1 @@ +Foo
diff --git a/test/files/run/valueclasses-classmanifest-basic.scala b/test/files/run/valueclasses-classmanifest-basic.scala new file mode 100644 index 0000000000..c2aa08ef86 --- /dev/null +++ b/test/files/run/valueclasses-classmanifest-basic.scala @@ -0,0 +1,5 @@ +class Foo(val x: Int) extends AnyVal + +object Test extends App { + println(classManifest[Foo]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-classmanifest-existential.check b/test/files/run/valueclasses-classmanifest-existential.check new file mode 100644 index 0000000000..e9fc6e27ea --- /dev/null +++ b/test/files/run/valueclasses-classmanifest-existential.check @@ -0,0 +1 @@ +Foo[<?>]
diff --git a/test/files/run/valueclasses-classmanifest-existential.scala b/test/files/run/valueclasses-classmanifest-existential.scala new file mode 100644 index 0000000000..11999df678 --- /dev/null +++ b/test/files/run/valueclasses-classmanifest-existential.scala @@ -0,0 +1,5 @@ +class Foo[T](val x: T) extends AnyVal + +object Test extends App { + println(classManifest[Foo[_]]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-classmanifest-generic.check b/test/files/run/valueclasses-classmanifest-generic.check new file mode 100644 index 0000000000..1418c5cff9 --- /dev/null +++ b/test/files/run/valueclasses-classmanifest-generic.check @@ -0,0 +1 @@ +Foo[java.lang.String]
diff --git a/test/files/run/valueclasses-classmanifest-generic.scala b/test/files/run/valueclasses-classmanifest-generic.scala new file mode 100644 index 0000000000..280152dc1d --- /dev/null +++ b/test/files/run/valueclasses-classmanifest-generic.scala @@ -0,0 +1,5 @@ +class Foo[T](val x: T) extends AnyVal + +object Test extends App { + println(classManifest[Foo[String]]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-classtag-basic.check b/test/files/run/valueclasses-classtag-basic.check new file mode 100644 index 0000000000..0c13986b32 --- /dev/null +++ b/test/files/run/valueclasses-classtag-basic.check @@ -0,0 +1 @@ +ClassTag[class Foo]
diff --git a/test/files/run/valueclasses-classtag-basic.scala b/test/files/run/valueclasses-classtag-basic.scala new file mode 100644 index 0000000000..912a4bb019 --- /dev/null +++ b/test/files/run/valueclasses-classtag-basic.scala @@ -0,0 +1,5 @@ +class Foo(val x: Int) extends AnyVal + +object Test extends App { + println(scala.reflect.classTag[Foo]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-classtag-existential.check b/test/files/run/valueclasses-classtag-existential.check new file mode 100644 index 0000000000..95e94e7aee --- /dev/null +++ b/test/files/run/valueclasses-classtag-existential.check @@ -0,0 +1 @@ +ClassTag[class java.lang.Object]
diff --git a/test/files/run/valueclasses-classtag-existential.scala b/test/files/run/valueclasses-classtag-existential.scala new file mode 100644 index 0000000000..e0db9cdd75 --- /dev/null +++ b/test/files/run/valueclasses-classtag-existential.scala @@ -0,0 +1,5 @@ +class Foo[T](val x: T) extends AnyVal + +object Test extends App { + println(scala.reflect.classTag[Foo[_]]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-classtag-generic.check b/test/files/run/valueclasses-classtag-generic.check new file mode 100644 index 0000000000..0c13986b32 --- /dev/null +++ b/test/files/run/valueclasses-classtag-generic.check @@ -0,0 +1 @@ +ClassTag[class Foo]
diff --git a/test/files/run/valueclasses-classtag-generic.scala b/test/files/run/valueclasses-classtag-generic.scala new file mode 100644 index 0000000000..bd1f213835 --- /dev/null +++ b/test/files/run/valueclasses-classtag-generic.scala @@ -0,0 +1,5 @@ +class Foo[T](val x: T) extends AnyVal + +object Test extends App { + println(scala.reflect.classTag[Foo[String]]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-manifest-basic.check b/test/files/run/valueclasses-manifest-basic.check new file mode 100644 index 0000000000..554c75e074 --- /dev/null +++ b/test/files/run/valueclasses-manifest-basic.check @@ -0,0 +1 @@ +Foo
diff --git a/test/files/run/valueclasses-manifest-basic.scala b/test/files/run/valueclasses-manifest-basic.scala new file mode 100644 index 0000000000..eefab20168 --- /dev/null +++ b/test/files/run/valueclasses-manifest-basic.scala @@ -0,0 +1,5 @@ +class Foo(val x: Int) extends AnyVal + +object Test extends App { + println(manifest[Foo]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-manifest-existential.check b/test/files/run/valueclasses-manifest-existential.check new file mode 100644 index 0000000000..fdce051039 --- /dev/null +++ b/test/files/run/valueclasses-manifest-existential.check @@ -0,0 +1 @@ +Foo[_ <: Any]
diff --git a/test/files/run/valueclasses-manifest-existential.scala b/test/files/run/valueclasses-manifest-existential.scala new file mode 100644 index 0000000000..47eb6d64dd --- /dev/null +++ b/test/files/run/valueclasses-manifest-existential.scala @@ -0,0 +1,5 @@ +class Foo[T](val x: T) extends AnyVal + +object Test extends App { + println(manifest[Foo[_]]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-manifest-generic.check b/test/files/run/valueclasses-manifest-generic.check new file mode 100644 index 0000000000..1418c5cff9 --- /dev/null +++ b/test/files/run/valueclasses-manifest-generic.check @@ -0,0 +1 @@ +Foo[java.lang.String]
diff --git a/test/files/run/valueclasses-manifest-generic.scala b/test/files/run/valueclasses-manifest-generic.scala new file mode 100644 index 0000000000..18313fba6f --- /dev/null +++ b/test/files/run/valueclasses-manifest-generic.scala @@ -0,0 +1,5 @@ +class Foo[T](val x: T) extends AnyVal + +object Test extends App { + println(manifest[Foo[String]]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-typetag-basic.check b/test/files/run/valueclasses-typetag-basic.check new file mode 100644 index 0000000000..554c75e074 --- /dev/null +++ b/test/files/run/valueclasses-typetag-basic.check @@ -0,0 +1 @@ +Foo
diff --git a/test/files/run/valueclasses-typetag-basic.scala b/test/files/run/valueclasses-typetag-basic.scala new file mode 100644 index 0000000000..d0243f7378 --- /dev/null +++ b/test/files/run/valueclasses-typetag-basic.scala @@ -0,0 +1,5 @@ +class Foo(val x: Int) extends AnyVal + +object Test extends App { + println(scala.reflect.runtime.universe.typeOf[Foo]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-typetag-existential.check b/test/files/run/valueclasses-typetag-existential.check new file mode 100644 index 0000000000..0efa24a45f --- /dev/null +++ b/test/files/run/valueclasses-typetag-existential.check @@ -0,0 +1 @@ +Foo[_]
diff --git a/test/files/run/valueclasses-typetag-existential.scala b/test/files/run/valueclasses-typetag-existential.scala new file mode 100644 index 0000000000..4cdaa44a83 --- /dev/null +++ b/test/files/run/valueclasses-typetag-existential.scala @@ -0,0 +1,5 @@ +class Foo[T](val x: T) extends AnyVal + +object Test extends App { + println(scala.reflect.runtime.universe.typeOf[Foo[_]]) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-typetag-generic.check b/test/files/run/valueclasses-typetag-generic.check new file mode 100644 index 0000000000..fce2e64f79 --- /dev/null +++ b/test/files/run/valueclasses-typetag-generic.check @@ -0,0 +1 @@ +Foo[String]
diff --git a/test/files/run/valueclasses-typetag-generic.scala b/test/files/run/valueclasses-typetag-generic.scala new file mode 100644 index 0000000000..eb32dfcadb --- /dev/null +++ b/test/files/run/valueclasses-typetag-generic.scala @@ -0,0 +1,5 @@ +class Foo[T](val x: T) extends AnyVal + +object Test extends App { + println(scala.reflect.runtime.universe.typeOf[Foo[String]]) +}
\ No newline at end of file diff --git a/test/files/specialized/t6035.check b/test/files/specialized/t6035.check new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/files/specialized/t6035.check @@ -0,0 +1 @@ +0 diff --git a/test/files/specialized/t6035/first_1.scala b/test/files/specialized/t6035/first_1.scala new file mode 100644 index 0000000000..1289e9f48e --- /dev/null +++ b/test/files/specialized/t6035/first_1.scala @@ -0,0 +1,5 @@ +trait Foo[@specialized(Int) A] { + def foo(x: A): A +} + +abstract class Inter extends Foo[Int] diff --git a/test/files/specialized/t6035/second_2.scala b/test/files/specialized/t6035/second_2.scala new file mode 100644 index 0000000000..fb317e2a6a --- /dev/null +++ b/test/files/specialized/t6035/second_2.scala @@ -0,0 +1,13 @@ +class Baz extends Inter { + def foo(x: Int) = x + 1 +} + +object Test { + def main(args: Array[String]) { + // it's important that the type is Inter so we do not call Baz.foo(I)I directly! + val baz: Inter = new Baz + // here we should go through specialized version of foo and thus have zero boxing + baz.foo(1) + println(runtime.BoxesRunTime.integerBoxCount) + } +} diff --git a/test/files/pos/t1751.cmds b/test/pending/pos/t1751.cmds index d4a4898ffd..d4a4898ffd 100644 --- a/test/files/pos/t1751.cmds +++ b/test/pending/pos/t1751.cmds diff --git a/test/files/pos/t1751/A1_2.scala b/test/pending/pos/t1751/A1_2.scala index 354d5eecd0..354d5eecd0 100644 --- a/test/files/pos/t1751/A1_2.scala +++ b/test/pending/pos/t1751/A1_2.scala diff --git a/test/files/pos/t1751/A2_1.scala b/test/pending/pos/t1751/A2_1.scala index c768062e43..c768062e43 100644 --- a/test/files/pos/t1751/A2_1.scala +++ b/test/pending/pos/t1751/A2_1.scala diff --git a/test/files/pos/t1751/SuiteClasses.java b/test/pending/pos/t1751/SuiteClasses.java index a415e4f572..a415e4f572 100644 --- a/test/files/pos/t1751/SuiteClasses.java +++ b/test/pending/pos/t1751/SuiteClasses.java diff --git a/test/files/pos/t1782.cmds b/test/pending/pos/t1782.cmds index 61f3d3788e..61f3d3788e 100644 --- a/test/files/pos/t1782.cmds +++ b/test/pending/pos/t1782.cmds diff --git a/test/files/pos/t1782/Ann.java b/test/pending/pos/t1782/Ann.java index 0dcfbd2ed7..0dcfbd2ed7 100644 --- a/test/files/pos/t1782/Ann.java +++ b/test/pending/pos/t1782/Ann.java diff --git a/test/files/pos/t1782/Days.java b/test/pending/pos/t1782/Days.java index 203a87b1c2..203a87b1c2 100644 --- a/test/files/pos/t1782/Days.java +++ b/test/pending/pos/t1782/Days.java diff --git a/test/files/pos/t1782/ImplementedBy.java b/test/pending/pos/t1782/ImplementedBy.java index 6aa8b4fa9e..6aa8b4fa9e 100644 --- a/test/files/pos/t1782/ImplementedBy.java +++ b/test/pending/pos/t1782/ImplementedBy.java diff --git a/test/files/pos/t1782/Test_1.scala b/test/pending/pos/t1782/Test_1.scala index 6467a74c29..6467a74c29 100644 --- a/test/files/pos/t1782/Test_1.scala +++ b/test/pending/pos/t1782/Test_1.scala diff --git a/test/files/pos/t294.cmds b/test/pending/pos/t294.cmds index 62c9a5a068..62c9a5a068 100644 --- a/test/files/pos/t294.cmds +++ b/test/pending/pos/t294.cmds diff --git a/test/files/pos/t294/Ann.java b/test/pending/pos/t294/Ann.java index 934ca46297..934ca46297 100644 --- a/test/files/pos/t294/Ann.java +++ b/test/pending/pos/t294/Ann.java diff --git a/test/files/pos/t294/Ann2.java b/test/pending/pos/t294/Ann2.java index 025b79e794..025b79e794 100644 --- a/test/files/pos/t294/Ann2.java +++ b/test/pending/pos/t294/Ann2.java diff --git a/test/files/pos/t294/Test_1.scala b/test/pending/pos/t294/Test_1.scala index ff1f34b10e..ff1f34b10e 100644 --- a/test/files/pos/t294/Test_1.scala +++ b/test/pending/pos/t294/Test_1.scala diff --git a/test/files/pos/t294/Test_2.scala b/test/pending/pos/t294/Test_2.scala index 9fb1c6e175..9fb1c6e175 100644 --- a/test/files/pos/t294/Test_2.scala +++ b/test/pending/pos/t294/Test_2.scala diff --git a/test/files/run/t3897.check b/test/pending/run/t3897.check index 244b83716f..244b83716f 100644 --- a/test/files/run/t3897.check +++ b/test/pending/run/t3897.check diff --git a/test/files/run/t3897/J_2.java b/test/pending/run/t3897/J_2.java index 178412dc92..178412dc92 100644 --- a/test/files/run/t3897/J_2.java +++ b/test/pending/run/t3897/J_2.java diff --git a/test/files/run/t3897/a_1.scala b/test/pending/run/t3897/a_1.scala index 4da959e2ac..4da959e2ac 100644 --- a/test/files/run/t3897/a_1.scala +++ b/test/pending/run/t3897/a_1.scala diff --git a/test/files/run/t3897/a_2.scala b/test/pending/run/t3897/a_2.scala index 4d9e59ef05..4d9e59ef05 100644 --- a/test/files/run/t3897/a_2.scala +++ b/test/pending/run/t3897/a_2.scala diff --git a/test/files/run/t5293-map.scala b/test/pending/run/t5293-map.scala index 2707aed07e..2707aed07e 100644 --- a/test/files/run/t5293-map.scala +++ b/test/pending/run/t5293-map.scala diff --git a/test/files/run/t5293.scala b/test/pending/run/t5293.scala index 01ead45d2a..01ead45d2a 100644 --- a/test/files/run/t5293.scala +++ b/test/pending/run/t5293.scala |