diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/dynamic-anyval.check | 4 | ||||
-rw-r--r-- | test/files/run/dynamic-anyval.scala | 22 | ||||
-rw-r--r-- | test/files/run/reflection-equality.check | 106 | ||||
-rw-r--r-- | test/files/run/reflection-fieldmirror-accessorsareokay.scala | 2 | ||||
-rw-r--r-- | test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala | 2 | ||||
-rw-r--r-- | test/files/run/reflection-fieldmirror-privatethis.scala | 2 | ||||
-rw-r--r-- | test/files/run/reflection-fieldsymbol-navigation.scala | 4 | ||||
-rw-r--r-- | test/files/run/static-annot-repl.check | 12 | ||||
-rw-r--r-- | test/files/run/t5064.check | 25 | ||||
-rw-r--r-- | test/files/run/t5064.scala | 23 | ||||
-rw-r--r-- | test/files/run/t5256a.check | 10 | ||||
-rw-r--r-- | test/files/run/t5256b.check | 10 | ||||
-rw-r--r-- | test/files/run/t5256d.check | 64 | ||||
-rw-r--r-- | test/files/run/t5256e.check | 4 | ||||
-rw-r--r-- | test/files/run/t5256f.check | 8 | ||||
-rw-r--r-- | test/files/run/t6273.check | 19 | ||||
-rw-r--r-- | test/files/run/t6273.scala | 11 | ||||
-rw-r--r-- | test/files/run/t6290.scala | 4 |
18 files changed, 223 insertions, 109 deletions
diff --git a/test/files/run/dynamic-anyval.check b/test/files/run/dynamic-anyval.check new file mode 100644 index 0000000000..dee7bef8e8 --- /dev/null +++ b/test/files/run/dynamic-anyval.check @@ -0,0 +1,4 @@ +().dingo(bippy, 5) +List(1, 2, 3).dingo(bippy, 5) +().dingo(bippy, 5) +List(1, 2, 3).dingo(bippy, 5) diff --git a/test/files/run/dynamic-anyval.scala b/test/files/run/dynamic-anyval.scala new file mode 100644 index 0000000000..605503d377 --- /dev/null +++ b/test/files/run/dynamic-anyval.scala @@ -0,0 +1,22 @@ +import scala.language.dynamics + +object Test { + implicit class DynamicValue[T](val value: T) extends AnyVal with Dynamic { + def applyDynamic(name: String)(args: Any*) = println(s"""$this.$name(${args mkString ", "})""") + override def toString = "" + value + } + implicit class DynamicValue2[T](val value: T) extends Dynamic { + def applyDynamic(name: String)(args: Any*) = println(s"""$this.$name(${args mkString ", "})""") + override def toString = "" + value + } + + def f[T](x: DynamicValue[T]) = x.dingo("bippy", 5) + def g[T](x: DynamicValue2[T]) = x.dingo("bippy", 5) + + def main(args: Array[String]): Unit = { + f(()) + f(List(1, 2, 3)) + g(()) + g(List(1, 2, 3)) + } +} diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check index be531fbbd3..17c1f6dd70 100644 --- a/test/files/run/reflection-equality.check +++ b/test/files/run/reflection-equality.check @@ -1,53 +1,53 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> class X {
- def methodIntIntInt(x: Int, y: Int) = x+y
-}
-defined class X
-
-scala>
-
-scala> import scala.reflect.runtime.universe._
-import scala.reflect.runtime.universe._
-
-scala> import scala.reflect.runtime.{ currentMirror => cm }
-import scala.reflect.runtime.{currentMirror=>cm}
-
-scala> def im: InstanceMirror = cm.reflect(new X)
-im: reflect.runtime.universe.InstanceMirror
-
-scala> val cs: ClassSymbol = im.symbol
-cs: reflect.runtime.universe.ClassSymbol = class X
-
-scala> val ts: Type = cs.typeSignature
-ts: reflect.runtime.universe.Type =
-java.lang.Object {
- def <init>: <?>
- def methodIntIntInt: <?>
-}
-
-scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod
-ms: reflect.runtime.universe.MethodSymbol = method methodIntIntInt
-
-scala> val MethodType( _, t1 ) = ms.typeSignature
-t1: reflect.runtime.universe.Type = scala.Int
-
-scala> val t2 = typeOf[scala.Int]
-t2: reflect.runtime.universe.Type = Int
-
-scala> t1 == t2
-res0: Boolean = false
-
-scala> t1 =:= t2
-res1: Boolean = true
-
-scala> t1 <:< t2
-res2: Boolean = true
-
-scala> t2 <:< t1
-res3: Boolean = true
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> class X { + def methodIntIntInt(x: Int, y: Int) = x+y +} +defined class X + +scala> + +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ + +scala> import scala.reflect.runtime.{ currentMirror => cm } +import scala.reflect.runtime.{currentMirror=>cm} + +scala> def im: InstanceMirror = cm.reflect(new X) +im: reflect.runtime.universe.InstanceMirror + +scala> val cs: ClassSymbol = im.symbol +cs: reflect.runtime.universe.ClassSymbol = class X + +scala> val ts: Type = cs.typeSignature +ts: reflect.runtime.universe.Type = +java.lang.Object { + def <init>(): X + def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int +} + +scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod +ms: reflect.runtime.universe.MethodSymbol = method methodIntIntInt + +scala> val MethodType( _, t1 ) = ms.typeSignature +t1: reflect.runtime.universe.Type = scala.Int + +scala> val t2 = typeOf[scala.Int] +t2: reflect.runtime.universe.Type = Int + +scala> t1 == t2 +res0: Boolean = false + +scala> t1 =:= t2 +res1: Boolean = true + +scala> t1 <:< t2 +res2: Boolean = true + +scala> t2 <:< t1 +res3: Boolean = true + +scala> diff --git a/test/files/run/reflection-fieldmirror-accessorsareokay.scala b/test/files/run/reflection-fieldmirror-accessorsareokay.scala index 9590cbe811..16354025f3 100644 --- a/test/files/run/reflection-fieldmirror-accessorsareokay.scala +++ b/test/files/run/reflection-fieldmirror-accessorsareokay.scala @@ -14,7 +14,7 @@ object Test extends App { def test(f: Symbol) = { try { val fm: FieldMirror = im.reflectField(f.asTerm) - println(fm.symbol.isVariable) + println(fm.symbol.isVar) println(fm.get) fm.set(2) println(fm.get) diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala index 5cfe583ed5..2b4a9bb55e 100644 --- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala +++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala @@ -12,5 +12,5 @@ object Test extends App { val cs = im.symbol val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm val fm: FieldMirror = im.reflectField(f) - println(fm.symbol.isVariable) + println(fm.symbol.isVar) } diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala index 7aa179958d..ab838dbb1b 100644 --- a/test/files/run/reflection-fieldmirror-privatethis.scala +++ b/test/files/run/reflection-fieldmirror-privatethis.scala @@ -12,7 +12,7 @@ object Test extends App { val cs = im.symbol val f = cs.typeSignature.declaration(newTermName("x")).asTerm val fm: FieldMirror = im.reflectField(f) - println(fm.symbol.isVariable) + println(fm.symbol.isVar) println(fm.get) fm.set(2) println(fm.get) diff --git a/test/files/run/reflection-fieldsymbol-navigation.scala b/test/files/run/reflection-fieldsymbol-navigation.scala index da4612a564..4448724988 100644 --- a/test/files/run/reflection-fieldsymbol-navigation.scala +++ b/test/files/run/reflection-fieldsymbol-navigation.scala @@ -7,9 +7,9 @@ class C { object Test extends App { val x = typeOf[C].member(newTermName("x")).asTerm println(x) - println(x.isVariable) + println(x.isVar) println(x.accessed) - println(x.accessed.asTerm.isVariable) + println(x.accessed.asTerm.isVar) println(x.getter) println(x.setter) }
\ No newline at end of file diff --git a/test/files/run/static-annot-repl.check b/test/files/run/static-annot-repl.check index d1029a9809..3a1532b823 100644 --- a/test/files/run/static-annot-repl.check +++ b/test/files/run/static-annot-repl.check @@ -13,7 +13,9 @@ scala> @static val x2 = 43 x2: Int = 43 scala> @static def x3 = 44 -x3: Int +<console>:8: error: The @static annotation is not allowed on method definitions. + @static def x3 = 44 + ^ scala> x1 res0: Int = 42 @@ -22,11 +24,15 @@ scala> x2 res1: Int = 43 scala> x3 -res2: Int = 44 +<console>:9: error: not found: value x3 + x3 + ^ scala> class Test { @static def x = 42 } -defined class Test +<console>:9: error: The @static annotation is not allowed on method definitions. + @static def x = 42 + ^ scala>
\ No newline at end of file diff --git a/test/files/run/t5064.check b/test/files/run/t5064.check new file mode 100644 index 0000000000..077006abd9 --- /dev/null +++ b/test/files/run/t5064.check @@ -0,0 +1,25 @@ +[12] T5064.super.<init>() +[12] T5064.super.<init> +[12] this +[16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) +[16:20] immutable.this.List.apply +<16:20> immutable.this.List +<16:20> immutable.this +[16:23] scala.this.Predef.wrapIntArray(Array[Int]{1}) +[20] scala.this.Predef.wrapIntArray +[20] scala.this.Predef +[20] scala.this +[26:32] collection.this.Seq.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) +[26:29] collection.this.Seq.apply +<26:29> collection.this.Seq +<26:29> collection.this +[26:32] scala.this.Predef.wrapIntArray(Array[Int]{1}) +[29] scala.this.Predef.wrapIntArray +[29] scala.this.Predef +[29] scala.this +[35:39] immutable.this.List +<35:39> immutable.this +[42:45] collection.this.Seq +<42:45> collection.this +[48:51] immutable.this.Nil +<48:51> immutable.this diff --git a/test/files/run/t5064.scala b/test/files/run/t5064.scala new file mode 100644 index 0000000000..35f0951765 --- /dev/null +++ b/test/files/run/t5064.scala @@ -0,0 +1,23 @@ +import scala.tools.partest._ + +object Test extends CompilerTest { + import global._ + override def extraSettings = super.extraSettings + " -Yrangepos" + override def sources = List( + """|class T5064 { + | List(1) + | Seq(1) + | List + | Seq + | Nil + |}""".stripMargin + ) + def check(source: String, unit: CompilationUnit) { + for (ClassDef(_, _, _, Template(_, _, stats)) <- unit.body ; stat <- stats ; t <- stat) { + t match { + case _: Select | _: Apply | _: This => println("%-15s %s".format(t.pos.show, t)) + case _ => + } + } + } +}
\ No newline at end of file diff --git a/test/files/run/t5256a.check b/test/files/run/t5256a.check index 518663b3da..7e60139db3 100644 --- a/test/files/run/t5256a.check +++ b/test/files/run/t5256a.check @@ -1,6 +1,6 @@ -class A
-A
+class A +A Object { - def <init>: <?> - def foo: <?> -}
+ def <init>(): A + def foo: Nothing +} diff --git a/test/files/run/t5256b.check b/test/files/run/t5256b.check index d6015f2743..a80df6eb30 100644 --- a/test/files/run/t5256b.check +++ b/test/files/run/t5256b.check @@ -1,6 +1,6 @@ -class A
-Test.A
+class A +Test.A Object { - def <init>: <?> - def foo: <?> -}
+ def <init>(): Test.A + def foo: Nothing +} diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check index dd32c05a93..9742ae572e 100644 --- a/test/files/run/t5256d.check +++ b/test/files/run/t5256d.check @@ -1,32 +1,32 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> import scala.reflect.runtime.universe._
-import scala.reflect.runtime.universe._
-
-scala> import scala.reflect.runtime.{currentMirror => cm}
-import scala.reflect.runtime.{currentMirror=>cm}
-
-scala> class A { def foo = ??? }
-defined class A
-
-scala> val c = cm.classSymbol(classOf[A])
-c: reflect.runtime.universe.ClassSymbol = class A
-
-scala> println(c)
-class A
-
-scala> println(c.fullName)
-$line8.$read.$iw.$iw.$iw.$iw.A
-
-scala> println(c.typeSignature)
-java.lang.Object {
- def <init>: <?>
- def foo: <?>
-}
-
-scala>
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe._ + +scala> import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.runtime.{currentMirror=>cm} + +scala> class A { def foo = ??? } +defined class A + +scala> val c = cm.classSymbol(classOf[A]) +c: reflect.runtime.universe.ClassSymbol = class A + +scala> println(c) +class A + +scala> println(c.fullName) +$line8.$read.$iw.$iw.$iw.$iw.A + +scala> println(c.typeSignature) +java.lang.Object { + def <init>(): A + def foo: scala.Nothing +} + +scala> + +scala> diff --git a/test/files/run/t5256e.check b/test/files/run/t5256e.check index 6c6de90acc..011115720c 100644 --- a/test/files/run/t5256e.check +++ b/test/files/run/t5256e.check @@ -1,6 +1,6 @@ class A Test.C.A Object { - def <init>: <?> - def foo: <?> + def <init>(): C.this.A + def foo: Nothing } diff --git a/test/files/run/t5256f.check b/test/files/run/t5256f.check index c840793fd5..e0fec85596 100644 --- a/test/files/run/t5256f.check +++ b/test/files/run/t5256f.check @@ -1,12 +1,12 @@ class A1 Test.A1 Object { - def <init>: <?> - def foo: <?> + def <init>(): Test.A1 + def foo: Nothing } class A2 Test.A2 Object { - def <init>: <?> - def foo: <?> + def <init>(): Test.this.A2 + def foo: Nothing } diff --git a/test/files/run/t6273.check b/test/files/run/t6273.check new file mode 100644 index 0000000000..c1c18daac2 --- /dev/null +++ b/test/files/run/t6273.check @@ -0,0 +1,19 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> val y = 55 +y: Int = 55 + +scala> val x = s""" + y = $y +""" +x: String = +" + y = 55 +" + +scala> + +scala> diff --git a/test/files/run/t6273.scala b/test/files/run/t6273.scala new file mode 100644 index 0000000000..ed0fd452e0 --- /dev/null +++ b/test/files/run/t6273.scala @@ -0,0 +1,11 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def tq = "\"\"\"" + def code = s""" +val y = 55 +val x = s$tq + y = $$y +$tq + """ +} diff --git a/test/files/run/t6290.scala b/test/files/run/t6290.scala new file mode 100644 index 0000000000..9d05db0d18 --- /dev/null +++ b/test/files/run/t6290.scala @@ -0,0 +1,4 @@ +object Test { + implicit val foo = language.dynamics + def main(args: Array[String]): Unit = () +} |