diff options
author | Paul Phillips <paulp@improving.org> | 2012-08-21 07:40:28 +0200 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-01 10:34:06 -0700 |
commit | 35316be5a89b2c9622e92594245aaf72a3820c88 (patch) | |
tree | c23ef6bdf01f643ce98204c0e3d10420d1a86058 /test/files/run/reflection-equality.check | |
parent | 6cda8a6f972d014f9b73c54a43bb80f99b64adb4 (diff) | |
download | scala-35316be5a89b2c9622e92594245aaf72a3820c88.tar.gz scala-35316be5a89b2c9622e92594245aaf72a3820c88.tar.bz2 scala-35316be5a89b2c9622e92594245aaf72a3820c88.zip |
Better errors for Any/AnyRef issues.
When an error occurs because some type does not conform
to AnyRef (and an AnyRef-derived type would have sufficed)
try to say something useful about the situation.
This commit also initializes scope members before printing
error messages because the + version seems more useful than
the - version (taken from one of the checkfile diffs.)
- def <init>: <?>
- def methodIntIntInt: <?>
+ def <init>(): X
+ def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int
Diffstat (limited to 'test/files/run/reflection-equality.check')
-rw-r--r-- | test/files/run/reflection-equality.check | 106 |
1 files changed, 53 insertions, 53 deletions
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> |