diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-07-30 21:14:42 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-08-02 15:50:01 +0200 |
commit | 013acf6eb0117ca12ab2a0d0e8560df40a7392a3 (patch) | |
tree | 2f69939025e5796381327bd16f602b5be9cfcba4 /test/files/run/compiler-asSeenFrom.scala | |
parent | 367b82de04bdee24b0994e30c1464297eae16d74 (diff) | |
download | scala-013acf6eb0117ca12ab2a0d0e8560df40a7392a3.tar.gz scala-013acf6eb0117ca12ab2a0d0e8560df40a7392a3.tar.bz2 scala-013acf6eb0117ca12ab2a0d0e8560df40a7392a3.zip |
renames asType to toType and asXXXSymbol to asXXX
This renaming arguably makes the intent of `asType` more clear,
but more importantly it shaves 6 symbols off pervasive casts that
are required to anything meaningful with reflection API
(as in mirror.reflectMethod(tpe.member(newTermName("x")).asMethodSymbol)).
Diffstat (limited to 'test/files/run/compiler-asSeenFrom.scala')
-rw-r--r-- | test/files/run/compiler-asSeenFrom.scala | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala index 1fc3a5ee71..19feb45101 100644 --- a/test/files/run/compiler-asSeenFrom.scala +++ b/test/files/run/compiler-asSeenFrom.scala @@ -47,10 +47,10 @@ package ll { for (p <- typeRefPrefixes ; c <- classes filter (isPossibleEnclosure(p.typeSymbol, _)) ; a <- targs) yield typeRef(p, c, List(a)) ) - + val wfmt = "%-" + 25 + "s" def to_s(x: Any): String = wfmt.format(x.toString.replaceAll("""\bll\.""", "")) - + def fmt(args: Any*): String = { (args map to_s mkString " ").replaceAll("""\s+$""", "") } @@ -61,7 +61,7 @@ package ll { } def permuteAsSeenFrom(targs: List[Type]) = ( - for { + for { tp <- typeRefs(targs filterNot (_ eq NoType)) prefix <- asSeenPrefixes if tp.prefix != prefix @@ -72,11 +72,11 @@ package ll { } yield ((site, tp, prefix, seen)) ) - + def block(label: Any)(lines: List[String]): List[String] = { val first = "" + label + " {" val last = "}" - + first +: lines.map(" " + _) :+ last } @@ -84,7 +84,7 @@ package ll { permuteAsSeenFrom(targs).groupBy(_._1).toList.sortBy(_._1.toString) flatMap { case (site, xs) => block(fmt(site)) { - fmt("type", "seen from prefix", "is") :: + fmt("type", "seen from prefix", "is") :: fmt("----", "----------------", "--") :: { xs.groupBy(_._2).toList.sortBy(_._1.toString) flatMap { case (tp, ys) => @@ -95,15 +95,15 @@ package ll { } } } - + def pretty(xs: List[_]) = if (xs.isEmpty) "" else xs.mkString("\n ", "\n ", "\n") def signaturesIn(info: Type): List[String] = ( - info.members + info.members.toList filterNot (s => s.isType || s.owner == ObjectClass || s.owner == AnyClass || s.isConstructor) map (_.defString) ) - + def check(source: String, unit: global.CompilationUnit) = { import syms._ |